frontend/imports/startup/client/network.js
// Otherwise set it to localStorage, Session, or first element in accounts
Otherwise set it to localStorage, Session, or first element in accounts
Otherwise set it to localStorage Session or first element in accounts
function checkAccounts() {
  web3Obj.eth.getAccounts((error, accounts) => {
    if (!error) {
      if (!_.contains(accounts, web3Obj.eth.defaultAccount)) {
        if (_.contains(accounts, localStorage.getItem('address'))) {
          web3Obj.eth.defaultAccount = localStorage.getItem('address');
        } else if (_.contains(accounts, Session.get('address'))) {
          web3Obj.eth.defaultAccount = Session.get('address');
        } else if (accounts.length > 0) {
          web3Obj.eth.defaultAccount = accounts[0];
        } else {
          web3Obj.eth.defaultAccount = undefined;
        }
      }
      localStorage.setItem('address', web3Obj.eth.defaultAccount);
      Session.set('address', web3Obj.eth.defaultAccount);
      Session.set('accounts', accounts);
    }
  });
}
function checkAccounts ( ) { web3Obj . eth . getAccounts ( ( error , accounts ) => { if ( ! error ) { if ( ! _ . contains ( accounts , web3Obj . eth . defaultAccount ) ) { if ( _ . contains ( accounts , localStorage . getItem ( 'address' ) ) ) { web3Obj . eth . defaultAccount = localStorage . getItem ( 'address' ) ; } else if ( _ . contains ( accounts , Session . get ( 'address' ) ) ) { web3Obj . eth . defaultAccount = Session . get ( 'address' ) ; } else if ( accounts . length > 0 ) { web3Obj . eth . defaultAccount = accounts [ 0 ] ; } else { web3Obj . eth . defaultAccount = undefined ; } } localStorage . setItem ( 'address' , web3Obj . eth . defaultAccount ) ; Session . set ( 'address' , web3Obj . eth . defaultAccount ) ; Session . set ( 'accounts' , accounts ) ; } } ) ; }
Otherwise set it to localStorage, Session, or first element in accounts
Otherwise set it to localStorage Session or first element in accounts