diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-04-20 09:21:28 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-04-20 09:21:28 +0800 |
commit | f79601ee58a07ec6275d4588845578795f550d84 (patch) | |
tree | 5ce3e35ec1cb6b97ae94c2de1d80bd39dbe3fa42 /ui | |
parent | b8c57433ce0f6a50318671912b02082e12a0ecb0 (diff) | |
download | tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.tar tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.tar.gz tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.tar.bz2 tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.tar.lz tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.tar.xz tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.tar.zst tangerine-wallet-browser-f79601ee58a07ec6275d4588845578795f550d84.zip |
Generate explorer link to match current blockchain
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/account-detail.js | 5 | ||||
-rw-r--r-- | ui/app/components/transaction-list.js | 42 | ||||
-rw-r--r-- | ui/index.js | 5 | ||||
-rw-r--r-- | ui/lib/explorer-link.js | 12 |
4 files changed, 26 insertions, 38 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 871c0e66c..025644efe 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -17,6 +17,7 @@ function mapStateToProps(state) { address: state.appState.currentView.context, accountDetail: accountDetail, transactions: state.metamask.transactions, + networkVersion: state.networkVersion, } } @@ -74,7 +75,9 @@ AccountDetailScreen.prototype.render = function() { ]), ]), - transactionList(transactions), + transactionList(transactions + .filter(tx => tx.txParams.from === state.address) + .sort((a, b) => b.time - a.time), state.networkVersion), this.exportedAccount(accountDetail), // transaction table diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index e01c8c1f0..865ce5370 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -1,39 +1,9 @@ -/* -transactions -: -Array[3] -0 -: -Object -id -: -1461025348948185 -status -: -"confirmed" -time -: -1461025348948 -txParams -: -Object -data -: -"0x90b98a11000000000000000000000000c5b8dbac4c1d3f152cdeb400e2313f309c410acb00000000000000000000000000000000000000000000000000000000000003e8" -from -: -"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825" -to -: -"0xcd1ca6275b45065c4db4ec024859f8fd9d8d44ba" -__proto__ -: -Object -*/ const h = require('react-hyperscript') const formatBalance = require('../util').formatBalance +const addressSummary = require('../util').addressSummary +const explorerLink = require('../../lib/explorer-link') -module.exports = function(transactions) { +module.exports = function(transactions, network) { return h('details', [ h('summary', [ @@ -41,7 +11,7 @@ module.exports = function(transactions) { ]), h('.flex-row.flex-space-around', [ - h('div.font-small','Transaction'), + h('div.font-small','To'), h('div.font-small','Amount'), ]), @@ -56,10 +26,10 @@ module.exports = function(transactions) { return h('.tx.flex-row.flex-space-around', [ h('a.font-small', { - href: 'http://testnet.etherscan.io/tx/0xfc37bda95ce571bd0a393e8e7f6da394f1420a57b7d53f7c93821bff61f9b580', + href: explorerLink(transaction.hash, parseInt(network)), target: '_blank', }, - '0xfc37bda...b580'), + addressSummary(transaction.txParams.to)), h('div.font-small', formatBalance(transaction.txParams.value)) ]) }) diff --git a/ui/index.js b/ui/index.js index 05d30d8d3..4ecce2fbe 100644 --- a/ui/index.js +++ b/ui/index.js @@ -32,7 +32,10 @@ function startApp(metamaskState, accountManager, opts){ // appState represents the current tab's popup state appState: { currentDomain: opts.currentDomain, - } + }, + + // Which blockchain we are using: + networkVersion: opts.networkVersion, }) // if unconfirmed txs, start on txConf page diff --git a/ui/lib/explorer-link.js b/ui/lib/explorer-link.js new file mode 100644 index 000000000..a2e7872f9 --- /dev/null +++ b/ui/lib/explorer-link.js @@ -0,0 +1,12 @@ +module.exports = function(hash, network) { + let prefix + switch (network) { + case 1: // main net + prefix = '' + case 2: // morden test net + prefix = 'testnet.' + default: + prefix = '' + } + return `http://${prefix}etherscan.io/tx/${hash}` +} |