mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Merge pull request #4507 from whymarrh/fix-account-order
Render accounts in keyring order
This commit is contained in:
commit
191c3df108
@ -75,9 +75,9 @@
|
||||
{
|
||||
"type": "HD Key Tree",
|
||||
"accounts": [
|
||||
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -115,9 +115,9 @@
|
||||
{
|
||||
"type": "HD Key Tree",
|
||||
"accounts": [
|
||||
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -76,9 +76,9 @@
|
||||
{
|
||||
"type": "HD Key Tree",
|
||||
"accounts": [
|
||||
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -94,9 +94,9 @@
|
||||
{
|
||||
"type": "HD Key Tree",
|
||||
"accounts": [
|
||||
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -76,9 +76,9 @@
|
||||
{
|
||||
"type": "HD Key Tree",
|
||||
"accounts": [
|
||||
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -83,9 +83,9 @@
|
||||
{
|
||||
"type": "HD Key Tree",
|
||||
"accounts": [
|
||||
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -23,9 +23,10 @@ class AccountDropdowns extends Component {
|
||||
|
||||
renderAccounts () {
|
||||
const { identities, selected, keyrings } = this.props
|
||||
const accountOrder = keyrings.reduce((list, keyring) => list.concat(keyring.accounts), [])
|
||||
|
||||
return Object.keys(identities).map((key, index) => {
|
||||
const identity = identities[key]
|
||||
return accountOrder.map((address, index) => {
|
||||
const identity = identities[address]
|
||||
const isSelected = identity.address === selected
|
||||
|
||||
const simpleAddress = identity.address.substring(2).toLowerCase()
|
||||
|
@ -135,11 +135,12 @@ AccountMenu.prototype.renderAccounts = function () {
|
||||
showAccountDetail,
|
||||
} = this.props
|
||||
|
||||
return Object.keys(identities).map((key, index) => {
|
||||
const identity = identities[key]
|
||||
const accountOrder = keyrings.reduce((list, keyring) => list.concat(keyring.accounts), [])
|
||||
return accountOrder.map((address) => {
|
||||
const identity = identities[address]
|
||||
const isSelected = identity.address === selectedAddress
|
||||
|
||||
const balanceValue = accounts[key] ? accounts[key].balance : ''
|
||||
const balanceValue = accounts[address] ? accounts[address].balance : ''
|
||||
const formattedBalance = balanceValue ? formatBalance(balanceValue, 6) : '...'
|
||||
const simpleAddress = identity.address.substring(2).toLowerCase()
|
||||
|
||||
|
@ -4,7 +4,6 @@ const copyToClipboard = require('copy-to-clipboard')
|
||||
//
|
||||
// Sub-Reducers take in the complete state and return their sub-state
|
||||
//
|
||||
const reduceIdentities = require('./reducers/identities')
|
||||
const reduceMetamask = require('./reducers/metamask')
|
||||
const reduceApp = require('./reducers/app')
|
||||
const reduceLocale = require('./reducers/locale')
|
||||
@ -21,12 +20,6 @@ function rootReducer (state, action) {
|
||||
return action.value
|
||||
}
|
||||
|
||||
//
|
||||
// Identities
|
||||
//
|
||||
|
||||
state.identities = reduceIdentities(state, action)
|
||||
|
||||
//
|
||||
// MetaMask
|
||||
//
|
||||
|
@ -1,15 +0,0 @@
|
||||
const extend = require('xtend')
|
||||
|
||||
module.exports = reduceIdentities
|
||||
|
||||
function reduceIdentities (state, action) {
|
||||
// clone + defaults
|
||||
var idState = extend({
|
||||
|
||||
}, state.identities)
|
||||
|
||||
switch (action.type) {
|
||||
default:
|
||||
return idState
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user