mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
change all instances of selectedAddress to selectedAccount.
This commit is contained in:
parent
9123e70434
commit
f5b0795ac5
@ -50,7 +50,7 @@ endOfStream(pingStream, triggerReload)
|
||||
|
||||
// set web3 defaultAcount
|
||||
inpageProvider.publicConfigStore.subscribe(function (state) {
|
||||
web3.eth.defaultAccount = state.selectedAddress
|
||||
web3.eth.defaultAccount = state.selectedAccount
|
||||
})
|
||||
|
||||
//
|
||||
|
@ -61,7 +61,6 @@ module.exports = class KeyringController extends EventEmitter {
|
||||
transactions: this.configManager.getTxList(),
|
||||
unconfMsgs: messageManager.unconfirmedMsgs(),
|
||||
messages: messageManager.getMsgList(),
|
||||
selectedAddress: address,
|
||||
selectedAccount: address,
|
||||
shapeShiftTxList: this.configManager.getShapeShiftTxList(),
|
||||
currentFiat: this.configManager.getCurrentFiat(),
|
||||
@ -329,7 +328,7 @@ module.exports = class KeyringController extends EventEmitter {
|
||||
}, [])
|
||||
}
|
||||
|
||||
setSelectedAddress (address, cb) {
|
||||
setSelectedAccount (address, cb) {
|
||||
var addr = normalize(address)
|
||||
this.configManager.setSelectedAccount(addr)
|
||||
cb(null, addr)
|
||||
|
@ -66,20 +66,20 @@ function MetamaskInpageProvider (connectionStream) {
|
||||
MetamaskInpageProvider.prototype.send = function (payload) {
|
||||
const self = this
|
||||
|
||||
let selectedAddress
|
||||
let selectedAccount
|
||||
let result = null
|
||||
switch (payload.method) {
|
||||
|
||||
case 'eth_accounts':
|
||||
// read from localStorage
|
||||
selectedAddress = self.publicConfigStore.get('selectedAddress')
|
||||
result = selectedAddress ? [selectedAddress] : []
|
||||
selectedAccount = self.publicConfigStore.get('selectedAddress')
|
||||
result = selectedAccount ? [selectedAccount] : []
|
||||
break
|
||||
|
||||
case 'eth_coinbase':
|
||||
// read from localStorage
|
||||
selectedAddress = self.publicConfigStore.get('selectedAddress')
|
||||
result = selectedAddress || '0x0000000000000000000000000000000000000000'
|
||||
selectedAccount = self.publicConfigStore.get('selectedAddress')
|
||||
result = selectedAccount || '0x0000000000000000000000000000000000000000'
|
||||
break
|
||||
|
||||
// throw not-supported Error
|
||||
|
@ -67,7 +67,7 @@ module.exports = class MetamaskController {
|
||||
addNewKeyring: keyringController.addNewKeyring.bind(keyringController),
|
||||
addNewAccount: keyringController.addNewAccount.bind(keyringController),
|
||||
submitPassword: keyringController.submitPassword.bind(keyringController),
|
||||
setSelectedAddress: keyringController.setSelectedAddress.bind(keyringController),
|
||||
setSelectedAccount: keyringController.setSelectedAccount.bind(keyringController),
|
||||
approveTransaction: keyringController.approveTransaction.bind(keyringController),
|
||||
cancelTransaction: keyringController.cancelTransaction.bind(keyringController),
|
||||
signMessage: keyringController.signMessage.bind(keyringController),
|
||||
@ -125,8 +125,8 @@ module.exports = class MetamaskController {
|
||||
rpcUrl: this.configManager.getCurrentRpcAddress(),
|
||||
// account mgmt
|
||||
getAccounts: (cb) => {
|
||||
var selectedAddress = this.configManager.getSelectedAccount()
|
||||
var result = selectedAddress ? [selectedAddress] : []
|
||||
var selectedAccount = this.configManager.getSelectedAccount()
|
||||
var result = selectedAccount ? [selectedAccount] : []
|
||||
cb(null, result)
|
||||
},
|
||||
// tx signing
|
||||
@ -177,14 +177,14 @@ module.exports = class MetamaskController {
|
||||
// keyringController substate
|
||||
function keyringControllerToPublic (state) {
|
||||
return {
|
||||
selectedAddress: state.selectedAddress,
|
||||
selectedAccount: state.selectedAccount,
|
||||
}
|
||||
}
|
||||
// config substate
|
||||
function configToPublic (state) {
|
||||
return {
|
||||
provider: state.provider,
|
||||
selectedAddress: state.selectedAccount,
|
||||
selectedAccount: state.selectedAccount,
|
||||
}
|
||||
}
|
||||
// dump obj into store
|
||||
|
File diff suppressed because one or more lines are too long
@ -133,7 +133,7 @@
|
||||
"address": "0x704107d04affddd9b66ab9de3dd7b095852e9b69"
|
||||
}
|
||||
},
|
||||
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"network": "1",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
@ -99,7 +99,7 @@
|
||||
"status": "confirmed",
|
||||
"containsDelegateCall": false
|
||||
}],
|
||||
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"network": "2",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
@ -57,7 +57,7 @@
|
||||
}
|
||||
},
|
||||
"transactions": [],
|
||||
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"network": "2",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
@ -89,7 +89,7 @@
|
||||
}
|
||||
},
|
||||
"transactions": [],
|
||||
"selectedAddress": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80",
|
||||
"selectedAccount": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80",
|
||||
"network": "2",
|
||||
"isDisclaimerConfirmed": true,
|
||||
"unconfMsgs": {},
|
||||
|
@ -57,7 +57,7 @@
|
||||
}
|
||||
},
|
||||
"transactions": [],
|
||||
"selectedAddress": "0x843963b837841dad3b0f5969ff271108776616df",
|
||||
"selectedAccount": "0x843963b837841dad3b0f5969ff271108776616df",
|
||||
"network": "2",
|
||||
"isDisclaimerConfirmed": true,
|
||||
"unconfMsgs": {},
|
||||
|
@ -157,7 +157,7 @@
|
||||
"estimatedGas": "0x5208"
|
||||
}
|
||||
],
|
||||
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"network": "166",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
@ -54,7 +54,7 @@
|
||||
}
|
||||
},
|
||||
"transactions": [],
|
||||
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"network": "2",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
@ -62,7 +62,7 @@
|
||||
"type": "testnet"
|
||||
},
|
||||
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||
"seedWords": null
|
||||
},
|
||||
"appState": {
|
||||
|
@ -11,7 +11,7 @@
|
||||
"conversionDate": 1473358355,
|
||||
"accounts": {},
|
||||
"transactions": [],
|
||||
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"network": "1473186153102",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
File diff suppressed because one or more lines are too long
@ -351,7 +351,7 @@
|
||||
"hash": "0xb6e6ff57e7b5f6bd7f2e6dc44c39f4e858a227c9509586634ca547179345a13e"
|
||||
}
|
||||
],
|
||||
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"network": "1471904489432",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"metamask":{"isInitialized":true,"isUnlocked":true,"currentDomain":"example.com","rpcTarget":"https://rawtestrpc.metamask.io/","identities":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"name":"Wallet 1","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","mayBeFauceting":false},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"name":"Wallet 2","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb","mayBeFauceting":false},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"name":"Wallet 3","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d","mayBeFauceting":false}},"unconfTxs":{"1467868023090690":{"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false}},"accounts":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"code":"0x","balance":"0x38326dc32cf80800","nonce":"0x10000c","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"code":"0x","balance":"0x15e578bd8e9c8000","nonce":"0x100000","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"code":"0x","nonce":"0x100000","balance":"0x2386f26fc10000","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"}},"transactions":[],"selectedAddress":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","network":"2","seedWords":null,"isDisclaimerConfirmed":true,"unconfMsgs":{},"messages":[],"provider":{"type":"testnet"},"selectedAccount":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"appState":{"menuOpen":false,"currentView":{"name":"confTx","context":0},"accountDetail":{"subview":"transactions"},"currentDomain":"extensions","transForward":true,"isLoading":false,"warning":null},"identities":{}}
|
||||
{"metamask":{"isInitialized":true,"isUnlocked":true,"currentDomain":"example.com","rpcTarget":"https://rawtestrpc.metamask.io/","identities":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"name":"Wallet 1","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","mayBeFauceting":false},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"name":"Wallet 2","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb","mayBeFauceting":false},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"name":"Wallet 3","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d","mayBeFauceting":false}},"unconfTxs":{"1467868023090690":{"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false}},"accounts":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"code":"0x","balance":"0x38326dc32cf80800","nonce":"0x10000c","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"code":"0x","balance":"0x15e578bd8e9c8000","nonce":"0x100000","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"code":"0x","nonce":"0x100000","balance":"0x2386f26fc10000","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"}},"transactions":[],"selectedAccount":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","network":"2","seedWords":null,"isDisclaimerConfirmed":true,"unconfMsgs":{},"messages":[],"provider":{"type":"testnet"},"selectedAccount":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"appState":{"menuOpen":false,"currentView":{"name":"confTx","context":0},"accountDetail":{"subview":"transactions"},"currentDomain":"extensions","transForward":true,"isLoading":false,"warning":null},"identities":{}}
|
||||
|
File diff suppressed because one or more lines are too long
@ -52,7 +52,7 @@
|
||||
"hash": "0xad609a6931f54a575ad71222ffc27cd6746017106d5b89f4ad300b37b273f8ac"
|
||||
}
|
||||
],
|
||||
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"network": "1479753732793",
|
||||
"isConfirmed": true,
|
||||
"isEthConfirmed": true,
|
||||
|
@ -46,7 +46,7 @@
|
||||
}
|
||||
},
|
||||
"transactions": [],
|
||||
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"network": "1",
|
||||
"seedWords": null,
|
||||
"isDisclaimerConfirmed": true,
|
||||
|
@ -44,6 +44,5 @@ describe('SHOW_ACCOUNT_DETAIL', function() {
|
||||
|
||||
var resultingState = reducers(initialState, action)
|
||||
assert.equal(resultingState.metamask.selectedAccount, action.value)
|
||||
assert.equal(resultingState.metamask.selectedAddress, action.value)
|
||||
})
|
||||
})
|
||||
|
@ -16,7 +16,7 @@ function AccountListItem () {
|
||||
|
||||
AccountListItem.prototype.render = function () {
|
||||
const identity = this.props.identity
|
||||
var isSelected = this.props.selectedAddress === identity.address
|
||||
var isSelected = this.props.selectedAccount === identity.address
|
||||
var account = this.props.accounts[identity.address]
|
||||
const selectedClass = isSelected ? '.selected' : ''
|
||||
|
||||
|
@ -19,7 +19,7 @@ function mapStateToProps (state) {
|
||||
accounts: state.metamask.accounts,
|
||||
identities: state.metamask.identities,
|
||||
unconfTxs: state.metamask.unconfTxs,
|
||||
selectedAddress: state.metamask.selectedAddress,
|
||||
selectedAccount: state.metamask.selectedAccount,
|
||||
scrollToBottom: state.appState.scrollToBottom,
|
||||
pending,
|
||||
}
|
||||
@ -72,7 +72,7 @@ AccountsScreen.prototype.render = function () {
|
||||
return h(AccountListItem, {
|
||||
key: `acct-panel-${identity.address}`,
|
||||
identity,
|
||||
selectedAddress: this.props.selectedAddress,
|
||||
selectedAccount: this.props.selectedAccount,
|
||||
accounts: this.props.accounts,
|
||||
onShowDetail: this.onShowDetail.bind(this),
|
||||
pending,
|
||||
@ -133,8 +133,8 @@ AccountsScreen.prototype.navigateToConfTx = function () {
|
||||
AccountsScreen.prototype.onSelect = function (address, event) {
|
||||
event.stopPropagation()
|
||||
// if already selected, deselect
|
||||
if (this.props.selectedAddress === address) address = null
|
||||
this.props.dispatch(actions.setSelectedAddress(address))
|
||||
if (this.props.selectedAccount === address) address = null
|
||||
this.props.dispatch(actions.setselectedAccount(address))
|
||||
}
|
||||
|
||||
AccountsScreen.prototype.onShowDetail = function (address, event) {
|
||||
|
@ -71,7 +71,7 @@ var actions = {
|
||||
TRANSACTION_ERROR: 'TRANSACTION_ERROR',
|
||||
NEXT_TX: 'NEXT_TX',
|
||||
PREVIOUS_TX: 'PREV_TX',
|
||||
setSelectedAddress: setSelectedAddress,
|
||||
setselectedAccount: setselectedAccount,
|
||||
signMsg: signMsg,
|
||||
cancelMsg: cancelMsg,
|
||||
sendTx: sendTx,
|
||||
@ -259,9 +259,9 @@ function showInfoPage () {
|
||||
}
|
||||
}
|
||||
|
||||
function setSelectedAddress (address) {
|
||||
function setselectedAccount (address) {
|
||||
return (dispatch) => {
|
||||
background.setSelectedAddress(address)
|
||||
background.setselectedAccount(address)
|
||||
}
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ function lockMetamask () {
|
||||
function showAccountDetail (address) {
|
||||
return (dispatch) => {
|
||||
dispatch(actions.showLoadingIndication())
|
||||
background.setSelectedAddress(address, (err, address) => {
|
||||
background.setselectedAccount(address, (err, address) => {
|
||||
dispatch(actions.hideLoadingIndication())
|
||||
if (err) {
|
||||
return dispatch(actions.displayWarning(err.message))
|
||||
|
@ -16,7 +16,7 @@ PendingMsgDetails.prototype.render = function () {
|
||||
var msgData = state.txData
|
||||
|
||||
var msgParams = msgData.msgParams || {}
|
||||
var address = msgParams.from || state.selectedAddress
|
||||
var address = msgParams.from || state.selectedAccount
|
||||
var identity = state.identities[address] || { address: address }
|
||||
var account = state.accounts[address] || { address: address }
|
||||
|
||||
|
@ -24,7 +24,7 @@ PTXP.render = function () {
|
||||
var txData = props.txData
|
||||
|
||||
var txParams = txData.txParams || {}
|
||||
var address = txParams.from || props.selectedAddress
|
||||
var address = txParams.from || props.selectedAccount
|
||||
var identity = props.identities[address] || { address: address }
|
||||
var account = props.accounts[address]
|
||||
var balance = account ? account.balance : '0x0'
|
||||
|
@ -18,7 +18,7 @@ function mapStateToProps (state) {
|
||||
return {
|
||||
identities: state.metamask.identities,
|
||||
accounts: state.metamask.accounts,
|
||||
selectedAddress: state.metamask.selectedAddress,
|
||||
selectedAccount: state.metamask.selectedAccount,
|
||||
unconfTxs: state.metamask.unconfTxs,
|
||||
unconfMsgs: state.metamask.unconfMsgs,
|
||||
index: state.appState.currentView.context,
|
||||
@ -90,12 +90,12 @@ ConfirmTxScreen.prototype.render = function () {
|
||||
// Properties
|
||||
txData: txData,
|
||||
key: txData.id,
|
||||
selectedAddress: state.selectedAddress,
|
||||
selectedAccount: state.selectedAccount,
|
||||
accounts: state.accounts,
|
||||
identities: state.identities,
|
||||
insufficientBalance: this.checkBalnceAgainstTx(txData),
|
||||
// Actions
|
||||
buyEth: this.buyEth.bind(this, txParams.from || state.selectedAddress),
|
||||
buyEth: this.buyEth.bind(this, txParams.from || state.selectedAccount),
|
||||
sendTransaction: this.sendTransaction.bind(this, txData),
|
||||
cancelTransaction: this.cancelTransaction.bind(this, txData),
|
||||
signMessage: this.signMessage.bind(this, txData),
|
||||
@ -120,7 +120,7 @@ ConfirmTxScreen.prototype.checkBalnceAgainstTx = function (txData) {
|
||||
var state = this.props
|
||||
|
||||
var txParams = txData.txParams || {}
|
||||
var address = txParams.from || state.selectedAddress
|
||||
var address = txParams.from || state.selectedAccount
|
||||
var account = state.accounts[address]
|
||||
var balance = account ? account.balance : '0x0'
|
||||
|
||||
|
@ -285,7 +285,7 @@ function reduceApp (state, action) {
|
||||
warning: null,
|
||||
currentView: {
|
||||
name: 'accountDetail',
|
||||
context: state.metamask.selectedAddress,
|
||||
context: state.metamask.selectedAccount,
|
||||
},
|
||||
accountDetail: {
|
||||
subview: 'transactions',
|
||||
|
@ -98,7 +98,6 @@ function reduceMetamask (state, action) {
|
||||
isUnlocked: true,
|
||||
isInitialized: true,
|
||||
selectedAccount: action.value,
|
||||
selectedAddress: action.value,
|
||||
})
|
||||
delete newState.seedWords
|
||||
return newState
|
||||
|
@ -53,14 +53,14 @@ function addUnconfTx (txParams) {
|
||||
}
|
||||
|
||||
var isUnlocked = false
|
||||
var selectedAddress = null
|
||||
var selectedAccount = null
|
||||
|
||||
function getState () {
|
||||
return {
|
||||
isUnlocked: isUnlocked,
|
||||
identities: isUnlocked ? identities : {},
|
||||
unconfTxs: isUnlocked ? unconfTxs : {},
|
||||
selectedAddress: selectedAddress,
|
||||
selectedAccount: selectedAccount,
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +85,8 @@ accountManager.submitPassword = function (password, cb) {
|
||||
}
|
||||
}
|
||||
|
||||
accountManager.setSelectedAddress = function (address, cb) {
|
||||
selectedAddress = address
|
||||
accountManager.setselectedAccount = function (address, cb) {
|
||||
selectedAccount = address
|
||||
cb(null, getState())
|
||||
this._didUpdate()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user