1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

continue rename selectedAccount to selectedAddress

This commit is contained in:
kumavis 2017-01-30 15:25:12 -08:00
parent f9b31fe2c3
commit 2fa60cfcbf
32 changed files with 51 additions and 55 deletions

View File

@ -50,9 +50,9 @@ reloadStream.once('data', triggerReload)
// })
// endOfStream(pingStream, triggerReload)
// set web3 defaultAcount
// set web3 defaultAccount
inpageProvider.publicConfigStore.subscribe(function (state) {
web3.eth.defaultAccount = state.selectedAccount
web3.eth.defaultAccount = state.PreferencesController.selectedAddress
})
//

View File

@ -63,20 +63,20 @@ function MetamaskInpageProvider (connectionStream) {
MetamaskInpageProvider.prototype.send = function (payload) {
const self = this
let selectedAccount
let selectedAddress
let result = null
switch (payload.method) {
case 'eth_accounts':
// read from localStorage
selectedAccount = self.publicConfigStore.getState().selectedAccount
result = selectedAccount ? [selectedAccount] : []
selectedAddress = self.publicConfigStore.getState().selectedAddress
result = selectedAddress ? [selectedAddress] : []
break
case 'eth_coinbase':
// read from localStorage
selectedAccount = self.publicConfigStore.getState().selectedAccount
result = selectedAccount || '0x0000000000000000000000000000000000000000'
selectedAddress = self.publicConfigStore.getState().selectedAddress
result = selectedAddress
break
case 'eth_uninstallFilter':

View File

@ -126,8 +126,8 @@ module.exports = class MetamaskController extends EventEmitter {
rpcUrl: this.configManager.getCurrentRpcAddress(),
// account mgmt
getAccounts: (cb) => {
let selectedAccount = this.preferencesController.getSelectedAddress()
let result = selectedAccount ? [selectedAccount] : []
let selectedAddress = this.preferencesController.getSelectedAddress()
let result = selectedAddress ? [selectedAddress] : []
cb(null, result)
},
// tx signing
@ -154,9 +154,9 @@ module.exports = class MetamaskController extends EventEmitter {
)
function selectPublicState(state) {
const result = { selectedAccount: undefined }
const result = { selectedAddress: undefined }
try {
result.selectedAccount = state.KeyringController.selectedAccount
result.selectedAddress = state.KeyringController.selectedAddress
} catch (_) {}
return result
}

View File

@ -25,11 +25,11 @@ module.exports = class TransactionManager extends EventEmitter {
}
getState () {
var selectedAccount = this.getSelectedAddress()
var selectedAddress = this.getSelectedAddress()
return {
transactions: this.getTxList(),
unconfTxs: this.getUnapprovedTxList(),
selectedAccountTxList: this.getFilteredTxList({metamaskNetworkId: this.getNetwork(), from: selectedAccount}),
selectedAddressTxList: this.getFilteredTxList({metamaskNetworkId: this.getNetwork(), from: selectedAddress}),
}
}

File diff suppressed because one or more lines are too long

View File

@ -133,7 +133,7 @@
"address": "0x704107d04affddd9b66ab9de3dd7b095852e9b69"
}
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "1",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -142,7 +142,7 @@
"provider": {
"type": "mainnet"
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"appState": {
"menuOpen": false,

View File

@ -99,7 +99,7 @@
"status": "confirmed",
"containsDelegateCall": false
}],
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -108,7 +108,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"appState": {
"menuOpen": false,

View File

@ -57,7 +57,7 @@
}
},
"transactions": [],
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -66,7 +66,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"appState": {
"menuOpen": false,

View File

@ -37,7 +37,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x9858e7d8b79fc3e6d989636721584498926da38a",
"selectedAddress": "0x9858e7d8b79fc3e6d989636721584498926da38a",
"selectedAccountTxList": [],
"isDisclaimerConfirmed": true,
"unconfMsgs": {},

View File

@ -77,7 +77,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x87658c15aefe7448008a28513a11b6b130ef4cd0",
"selectedAddress": "0x87658c15aefe7448008a28513a11b6b130ef4cd0",
"isDisclaimerConfirmed": true,
"unconfMsgs": {},
"messages": [],

View File

@ -89,7 +89,6 @@
}
},
"transactions": [],
"selectedAccount": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80",
"network": "2",
"isDisclaimerConfirmed": true,
"unconfMsgs": {},
@ -98,7 +97,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80",
"selectedAddress": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80",
"seedWords": null
},
"appState": {

View File

@ -95,7 +95,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9",
"selectedAddress": "0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9",
"seedWords": false,
"isDisclaimerConfirmed": true,
"unconfMsgs": {},

View File

@ -57,7 +57,6 @@
}
},
"transactions": [],
"selectedAccount": "0x843963b837841dad3b0f5969ff271108776616df",
"network": "2",
"isDisclaimerConfirmed": true,
"unconfMsgs": {},
@ -65,7 +64,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x843963b837841dad3b0f5969ff271108776616df",
"selectedAddress": "0x843963b837841dad3b0f5969ff271108776616df",
"seedWords": null
},
"appState": {

View File

@ -157,7 +157,6 @@
"estimatedGas": "0x5208"
}
],
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "166",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -167,7 +166,7 @@
"type": "rpc",
"rpcTarget": "555.203.16.244"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"appState": {
"menuOpen": false,

View File

@ -54,7 +54,7 @@
}
},
"transactions": [],
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -63,7 +63,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"appState": {
"menuOpen": false,

View File

@ -61,8 +61,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"seedWords": null
},
"appState": {

View File

@ -27,7 +27,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x01208723ba84e15da2e71656544a2963b0c06d40",
"selectedAddress": "0x01208723ba84e15da2e71656544a2963b0c06d40",
"selectedAccountTxList": [],
"seedWords": false,
"isDisclaimerConfirmed": true,

View File

@ -27,7 +27,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x01208723ba84e15da2e71656544a2963b0c06d40",
"selectedAddress": "0x01208723ba84e15da2e71656544a2963b0c06d40",
"selectedAccountTxList": [],
"seedWords": null,
"isDisclaimerConfirmed": true,

View File

@ -11,7 +11,7 @@
"conversionDate": 1473358355,
"accounts": {},
"transactions": [],
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1473186153102",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -22,7 +22,7 @@
"type": "rpc",
"rpcTarget": "http://localhost:8545"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"appState": {
"menuOpen": false,

View File

@ -61,7 +61,7 @@
}
},
"transactions": [],
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -70,7 +70,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"appState": {
"menuOpen": false,

View File

@ -36,7 +36,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0xa6ef573d60594731178b7f85d80da13cc2af52dd",
"selectedAddress": "0xa6ef573d60594731178b7f85d80da13cc2af52dd",
"isConfirmed": true,
"unconfMsgs": {},
"messages": [],

View File

@ -33,7 +33,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x24a1d059462456aa332d6da9117aa7f91a46f2ac",
"selectedAddress": "0x24a1d059462456aa332d6da9117aa7f91a46f2ac",
"seedWords": null,
"isDisclaimerConfirmed": true,
"unconfMsgs": {},

File diff suppressed because one or more lines are too long

View File

@ -351,7 +351,7 @@
"hash": "0xb6e6ff57e7b5f6bd7f2e6dc44c39f4e858a227c9509586634ca547179345a13e"
}
],
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1471904489432",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -384,7 +384,7 @@
"type": "rpc",
"rpcTarget": "http://localhost:8545"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"appState": {
"menuOpen": false,

File diff suppressed because one or more lines are too long

View File

@ -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":[],"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":{}}
{"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"},"selectedAddress":"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

View File

@ -52,7 +52,7 @@
"hash": "0xad609a6931f54a575ad71222ffc27cd6746017106d5b89f4ad300b37b273f8ac"
}
],
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1479753732793",
"isConfirmed": true,
"isEthConfirmed": true,
@ -64,7 +64,7 @@
"type": "rpc",
"rpcTarget": "http://localhost:8545"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"isDisclaimerConfirmed": true
},
"appState": {

View File

@ -55,7 +55,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"appState": {
"menuOpen": false,

View File

@ -46,7 +46,7 @@
}
},
"transactions": [],
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1",
"seedWords": null,
"isDisclaimerConfirmed": true,
@ -56,7 +56,7 @@
"provider": {
"type": "mainnet"
},
"selectedAccount": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"appState": {
"menuOpen": false,

View File

@ -13,7 +13,7 @@
"provider": {
"type": "testnet"
},
"selectedAccount": "0x4dd5d356c5a016a220bcd69e82e5af680a430d00"
"selectedAddress": "0x4dd5d356c5a016a220bcd69e82e5af680a430d00"
},
"showSeedWords": false,
"isEthConfirmed": true

View File

@ -31,7 +31,7 @@ describe('SHOW_ACCOUNT_DETAIL', function() {
it('updates metamask state', function() {
var initialState = {
metamask: {
selectedAccount: 'foo'
selectedAddress: 'foo'
}
}
freeze(initialState)
@ -43,6 +43,6 @@ describe('SHOW_ACCOUNT_DETAIL', function() {
freeze(action)
var resultingState = reducers(initialState, action)
assert.equal(resultingState.metamask.selectedAccount, action.value)
assert.equal(resultingState.metamask.selectedAddress, action.value)
})
})