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

Merge pull request #4507 from whymarrh/fix-account-order

Render accounts in keyring order
This commit is contained in:
Dan J Miller 2018-06-06 15:21:45 -02:30 committed by GitHub
commit 191c3df108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 45 deletions

View File

@ -75,9 +75,9 @@
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{

View File

@ -115,9 +115,9 @@
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{

View File

@ -76,9 +76,9 @@
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{

View File

@ -94,9 +94,9 @@
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{

View File

@ -76,9 +76,9 @@
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{

View File

@ -83,9 +83,9 @@
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{

View File

@ -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()

View File

@ -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()

View File

@ -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
//

View File

@ -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
}
}