commit
7915e62d65
@ -0,0 +1,44 @@ |
||||
const ObservableStore = require('obs-store') |
||||
const extend = require('xtend') |
||||
|
||||
class RecentBlocksController { |
||||
|
||||
constructor (opts = {}) { |
||||
const { blockTracker } = opts |
||||
this.blockTracker = blockTracker |
||||
this.historyLength = opts.historyLength || 40 |
||||
|
||||
const initState = extend({ |
||||
recentBlocks: [], |
||||
}, opts.initState) |
||||
this.store = new ObservableStore(initState) |
||||
|
||||
this.blockTracker.on('block', this.processBlock.bind(this)) |
||||
} |
||||
|
||||
resetState () { |
||||
this.store.updateState({ |
||||
recentBlocks: [], |
||||
}) |
||||
} |
||||
|
||||
processBlock (newBlock) { |
||||
const block = extend(newBlock, { |
||||
gasPrices: newBlock.transactions.map((tx) => { |
||||
return tx.gasPrice |
||||
}), |
||||
}) |
||||
delete block.transactions |
||||
|
||||
const state = this.store.getState() |
||||
state.recentBlocks.push(block) |
||||
|
||||
while (state.recentBlocks.length > this.historyLength) { |
||||
state.recentBlocks.shift() |
||||
} |
||||
|
||||
this.store.updateState(state) |
||||
} |
||||
} |
||||
|
||||
module.exports = RecentBlocksController |
@ -0,0 +1,739 @@ |
||||
{ |
||||
"metamask": { |
||||
"isInitialized": true, |
||||
"isUnlocked": true, |
||||
"isMascara": false, |
||||
"rpcTarget": "https://rawtestrpc.metamask.io/", |
||||
"identities": { |
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": { |
||||
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"name": "Account 1" |
||||
} |
||||
}, |
||||
"unapprovedTxs": {}, |
||||
"noActiveNotices": true, |
||||
"frequentRpcList": [ |
||||
"http://192.168.1.34:7545/" |
||||
], |
||||
"addressBook": [], |
||||
"tokenExchangeRates": {}, |
||||
"coinOptions": {}, |
||||
"provider": { |
||||
"type": "mainnet", |
||||
"rpcTarget": "https://mainnet.infura.io/metamask" |
||||
}, |
||||
"network": "1", |
||||
"accounts": { |
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": { |
||||
"code": "0x", |
||||
"balance": "0x1b3f641ed0c2f62", |
||||
"nonce": "0x35", |
||||
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825" |
||||
} |
||||
}, |
||||
"currentBlockGasLimit": "0x66df83", |
||||
"selectedAddressTxList": [ |
||||
{ |
||||
"id": 3516145537630216, |
||||
"time": 1512615655535, |
||||
"status": "submitted", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xc1b710800", |
||||
"gas": "0x7b0c", |
||||
"nonce": "0x35", |
||||
"chainId": "0x1" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208", |
||||
"history": [ |
||||
{ |
||||
"id": 3516145537630216, |
||||
"time": 1512615655535, |
||||
"status": "unapproved", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xe6f7cec00", |
||||
"gas": "0x7b0c" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208" |
||||
}, |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/txParams/gasPrice", |
||||
"value": "0xc1b710800", |
||||
"note": "confTx: user approved transaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "approved", |
||||
"note": "txStateManager: setting status to approved" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/nonce", |
||||
"value": "0x35", |
||||
"note": "transactions#approveTransaction" |
||||
}, |
||||
{ |
||||
"op": "add", |
||||
"path": "/nonceDetails", |
||||
"value": { |
||||
"params": { |
||||
"highestLocalNonce": 53, |
||||
"highestSuggested": 53, |
||||
"nextNetworkNonce": 53 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 53, |
||||
"details": { |
||||
"startPoint": 53, |
||||
"highest": 53 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 53, |
||||
"details": { |
||||
"baseCount": 53 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/chainId", |
||||
"value": "0x1", |
||||
"note": "txStateManager: setting status to signed" |
||||
}, |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "signed" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/rawTx", |
||||
"value": "0xf86c35850c1b710800827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008026a0f5142ba79a13ca7ec65548953017edafb217803244bbf9821d9ad077d89921e9a03afcb614169c90be9905d5b469d06984825c76675d3a535937cdb8f2ad1c0a95", |
||||
"note": "transactions#publishTransaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/hash", |
||||
"value": "0x7ce19c0d128ca11293b44a4e6d3cc9063665c00ea8c8eb400f548e132c147353", |
||||
"note": "transactions#setTxHash" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "submitted", |
||||
"note": "txStateManager: setting status to submitted" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/firstRetryBlockNumber", |
||||
"value": "0x478ab3", |
||||
"note": "transactions/pending-tx-tracker#event: tx:block-update" |
||||
} |
||||
] |
||||
], |
||||
"nonceDetails": { |
||||
"params": { |
||||
"highestLocalNonce": 53, |
||||
"highestSuggested": 53, |
||||
"nextNetworkNonce": 53 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 53, |
||||
"details": { |
||||
"startPoint": 53, |
||||
"highest": 53 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 53, |
||||
"details": { |
||||
"baseCount": 53 |
||||
} |
||||
} |
||||
}, |
||||
"rawTx": "0xf86c35850c1b710800827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008026a0f5142ba79a13ca7ec65548953017edafb217803244bbf9821d9ad077d89921e9a03afcb614169c90be9905d5b469d06984825c76675d3a535937cdb8f2ad1c0a95", |
||||
"hash": "0x7ce19c0d128ca11293b44a4e6d3cc9063665c00ea8c8eb400f548e132c147353", |
||||
"firstRetryBlockNumber": "0x478ab3" |
||||
}, |
||||
{ |
||||
"id": 3516145537630211, |
||||
"time": 1512613432658, |
||||
"status": "confirmed", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xba43b7400", |
||||
"gas": "0x7b0c", |
||||
"nonce": "0x34", |
||||
"chainId": "0x1" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208", |
||||
"history": [ |
||||
{ |
||||
"id": 3516145537630211, |
||||
"time": 1512613432658, |
||||
"status": "unapproved", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xdf8475800", |
||||
"gas": "0x7b0c" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208" |
||||
}, |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/txParams/gasPrice", |
||||
"value": "0xba43b7400", |
||||
"note": "confTx: user approved transaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "approved", |
||||
"note": "txStateManager: setting status to approved" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/nonce", |
||||
"value": "0x34", |
||||
"note": "transactions#approveTransaction" |
||||
}, |
||||
{ |
||||
"op": "add", |
||||
"path": "/nonceDetails", |
||||
"value": { |
||||
"params": { |
||||
"highestLocalNonce": 52, |
||||
"highestSuggested": 52, |
||||
"nextNetworkNonce": 52 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 52, |
||||
"details": { |
||||
"startPoint": 52, |
||||
"highest": 52 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 52, |
||||
"details": { |
||||
"baseCount": 52 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/chainId", |
||||
"value": "0x1", |
||||
"note": "txStateManager: setting status to signed" |
||||
}, |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "signed" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/rawTx", |
||||
"value": "0xf86c34850ba43b7400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008026a073a4afdb8e8ad32b0cf9039af56c66baffd60d30e75cee5c1b783208824eafb8a0021ca6c1714a2c71281333ab77f776d3514348ab77967280fca8a5b4be44285e", |
||||
"note": "transactions#publishTransaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/hash", |
||||
"value": "0x5c98409883fdfd3cd24058a83b91470da6c40ffae41a40eb90d7dee0b837d26d", |
||||
"note": "transactions#setTxHash" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "submitted", |
||||
"note": "txStateManager: setting status to submitted" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/firstRetryBlockNumber", |
||||
"value": "0x478a2c", |
||||
"note": "transactions/pending-tx-tracker#event: tx:block-update" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "confirmed", |
||||
"note": "txStateManager: setting status to confirmed" |
||||
} |
||||
] |
||||
], |
||||
"nonceDetails": { |
||||
"params": { |
||||
"highestLocalNonce": 52, |
||||
"highestSuggested": 52, |
||||
"nextNetworkNonce": 52 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 52, |
||||
"details": { |
||||
"startPoint": 52, |
||||
"highest": 52 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 52, |
||||
"details": { |
||||
"baseCount": 52 |
||||
} |
||||
} |
||||
}, |
||||
"rawTx": "0xf86c34850ba43b7400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008026a073a4afdb8e8ad32b0cf9039af56c66baffd60d30e75cee5c1b783208824eafb8a0021ca6c1714a2c71281333ab77f776d3514348ab77967280fca8a5b4be44285e", |
||||
"hash": "0x5c98409883fdfd3cd24058a83b91470da6c40ffae41a40eb90d7dee0b837d26d", |
||||
"firstRetryBlockNumber": "0x478a2c" |
||||
}, |
||||
{ |
||||
"id": 3516145537630210, |
||||
"time": 1512612826136, |
||||
"status": "confirmed", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xa7a358200", |
||||
"gas": "0x7b0c", |
||||
"nonce": "0x33", |
||||
"chainId": "0x1" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208", |
||||
"history": [ |
||||
{ |
||||
"id": 3516145537630210, |
||||
"time": 1512612826136, |
||||
"status": "unapproved", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xba43b7400", |
||||
"gas": "0x7b0c" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208" |
||||
}, |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/txParams/gasPrice", |
||||
"value": "0xa7a358200", |
||||
"note": "confTx: user approved transaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "approved", |
||||
"note": "txStateManager: setting status to approved" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/nonce", |
||||
"value": "0x33", |
||||
"note": "transactions#approveTransaction" |
||||
}, |
||||
{ |
||||
"op": "add", |
||||
"path": "/nonceDetails", |
||||
"value": { |
||||
"params": { |
||||
"highestLocalNonce": 0, |
||||
"highestSuggested": 51, |
||||
"nextNetworkNonce": 51 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 51, |
||||
"details": { |
||||
"startPoint": 51, |
||||
"highest": 51 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 51, |
||||
"details": { |
||||
"baseCount": 51 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/chainId", |
||||
"value": "0x1", |
||||
"note": "txStateManager: setting status to signed" |
||||
}, |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "signed" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/rawTx", |
||||
"value": "0xf86c33850a7a358200827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008026a0021a8cd6c10208cc593e22af53637e5d127cee5cc6f9443a3e758a02afff1d7ca025f7420e974d3f2c668c165040987c72543a8e709bfea3528a62836a6ced9ce8", |
||||
"note": "transactions#publishTransaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/hash", |
||||
"value": "0x289772800898bc9cd414530d8581c0da257a9055e4aaaa6d10d92d700bfbd044", |
||||
"note": "transactions#setTxHash" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "submitted", |
||||
"note": "txStateManager: setting status to submitted" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/firstRetryBlockNumber", |
||||
"value": "0x478a04", |
||||
"note": "transactions/pending-tx-tracker#event: tx:block-update" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "confirmed", |
||||
"note": "txStateManager: setting status to confirmed" |
||||
} |
||||
] |
||||
], |
||||
"nonceDetails": { |
||||
"params": { |
||||
"highestLocalNonce": 0, |
||||
"highestSuggested": 51, |
||||
"nextNetworkNonce": 51 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 51, |
||||
"details": { |
||||
"startPoint": 51, |
||||
"highest": 51 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 51, |
||||
"details": { |
||||
"baseCount": 51 |
||||
} |
||||
} |
||||
}, |
||||
"rawTx": "0xf86c33850a7a358200827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008026a0021a8cd6c10208cc593e22af53637e5d127cee5cc6f9443a3e758a02afff1d7ca025f7420e974d3f2c668c165040987c72543a8e709bfea3528a62836a6ced9ce8", |
||||
"hash": "0x289772800898bc9cd414530d8581c0da257a9055e4aaaa6d10d92d700bfbd044", |
||||
"firstRetryBlockNumber": "0x478a04" |
||||
}, |
||||
{ |
||||
"id": 3516145537630209, |
||||
"time": 1512612809252, |
||||
"status": "failed", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0x77359400", |
||||
"gas": "0x7b0c", |
||||
"nonce": "0x33", |
||||
"chainId": "0x1" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208", |
||||
"history": [ |
||||
{ |
||||
"id": 3516145537630209, |
||||
"time": 1512612809252, |
||||
"status": "unapproved", |
||||
"metamaskNetworkId": "1", |
||||
"txParams": { |
||||
"from": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"to": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"value": "0x16345785d8a0000", |
||||
"gasPrice": "0xba43b7400", |
||||
"gas": "0x7b0c" |
||||
}, |
||||
"gasPriceSpecified": false, |
||||
"gasLimitSpecified": false, |
||||
"estimatedGas": "5208" |
||||
}, |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/txParams/gasPrice", |
||||
"value": "0x77359400", |
||||
"note": "confTx: user approved transaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "approved", |
||||
"note": "txStateManager: setting status to approved" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/nonce", |
||||
"value": "0x33", |
||||
"note": "transactions#approveTransaction" |
||||
}, |
||||
{ |
||||
"op": "add", |
||||
"path": "/nonceDetails", |
||||
"value": { |
||||
"params": { |
||||
"highestLocalNonce": 0, |
||||
"highestSuggested": 51, |
||||
"nextNetworkNonce": 51 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 51, |
||||
"details": { |
||||
"startPoint": 51, |
||||
"highest": 51 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 51, |
||||
"details": { |
||||
"baseCount": 51 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/txParams/chainId", |
||||
"value": "0x1", |
||||
"note": "txStateManager: setting status to signed" |
||||
}, |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "signed" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/rawTx", |
||||
"value": "0xf86b338477359400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008025a098624a27ae79b2b1adc63b913850f266a920cb9d93e6588b8df9b8883eb1b323a00cc6fd855723a234f4f93b48caf7a7659366d09e5c5887f0a4c2e5fa68012cd7", |
||||
"note": "transactions#publishTransaction" |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "add", |
||||
"path": "/err", |
||||
"value": { |
||||
"message": "Error: [ethjs-rpc] rpc error with payload {\"id\":7801900228852,\"jsonrpc\":\"2.0\",\"params\":[\"0xf86b338477359400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008025a098624a27ae79b2b1adc63b913850f266a920cb9d93e6588b8df9b8883eb1b323a00cc6fd855723a234f4f93b48caf7a7659366d09e5c5887f0a4c2e5fa68012cd7\"],\"method\":\"eth_sendRawTransaction\"} Error: transaction underpriced", |
||||
"stack": "Error: [ethjs-rpc] rpc error with payload {\"id\":7801900228852,\"jsonrpc\":\"2.0\",\"params\":[\"0xf86b338477359400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008025a098624a27ae79b2b1adc63b913850f266a920cb9d93e6588b8df9b8883eb1b323a00cc6fd855723a234f4f93b48caf7a7659366d09e5c5887f0a4c2e5fa68012cd7\"],\"method\":\"eth_sendRawTransaction\"} Error: transaction underpriced\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:60327:26\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:88030:9\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16678:16\n at replenish (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16522:25)\n at iterateeCallback (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16512:17)\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16694:16\n at resultObj.id (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:88012:9)\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16813:16\n at replenish (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16527:17)\n at iterateeCallback (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16512:17)" |
||||
} |
||||
} |
||||
], |
||||
[ |
||||
{ |
||||
"op": "replace", |
||||
"path": "/status", |
||||
"value": "failed", |
||||
"note": "txStateManager: setting status to failed" |
||||
} |
||||
] |
||||
], |
||||
"nonceDetails": { |
||||
"params": { |
||||
"highestLocalNonce": 0, |
||||
"highestSuggested": 51, |
||||
"nextNetworkNonce": 51 |
||||
}, |
||||
"local": { |
||||
"name": "local", |
||||
"nonce": 51, |
||||
"details": { |
||||
"startPoint": 51, |
||||
"highest": 51 |
||||
} |
||||
}, |
||||
"network": { |
||||
"name": "network", |
||||
"nonce": 51, |
||||
"details": { |
||||
"baseCount": 51 |
||||
} |
||||
} |
||||
}, |
||||
"rawTx": "0xf86b338477359400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008025a098624a27ae79b2b1adc63b913850f266a920cb9d93e6588b8df9b8883eb1b323a00cc6fd855723a234f4f93b48caf7a7659366d09e5c5887f0a4c2e5fa68012cd7", |
||||
"err": { |
||||
"message": "Error: [ethjs-rpc] rpc error with payload {\"id\":7801900228852,\"jsonrpc\":\"2.0\",\"params\":[\"0xf86b338477359400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008025a098624a27ae79b2b1adc63b913850f266a920cb9d93e6588b8df9b8883eb1b323a00cc6fd855723a234f4f93b48caf7a7659366d09e5c5887f0a4c2e5fa68012cd7\"],\"method\":\"eth_sendRawTransaction\"} Error: transaction underpriced", |
||||
"stack": "Error: [ethjs-rpc] rpc error with payload {\"id\":7801900228852,\"jsonrpc\":\"2.0\",\"params\":[\"0xf86b338477359400827b0c94fdea65c8e26263f6d9a1b5de9555d2931a33b82588016345785d8a00008025a098624a27ae79b2b1adc63b913850f266a920cb9d93e6588b8df9b8883eb1b323a00cc6fd855723a234f4f93b48caf7a7659366d09e5c5887f0a4c2e5fa68012cd7\"],\"method\":\"eth_sendRawTransaction\"} Error: transaction underpriced\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:60327:26\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:88030:9\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16678:16\n at replenish (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16522:25)\n at iterateeCallback (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16512:17)\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16694:16\n at resultObj.id (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:88012:9)\n at chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16813:16\n at replenish (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16527:17)\n at iterateeCallback (chrome-extension://ebjbdknjcgcbchkagneicjfpneaghdhb/scripts/background.js:16512:17)" |
||||
} |
||||
} |
||||
], |
||||
"unapprovedMsgs": {}, |
||||
"unapprovedMsgCount": 0, |
||||
"unapprovedPersonalMsgs": {}, |
||||
"unapprovedPersonalMsgCount": 0, |
||||
"unapprovedTypedMessages": {}, |
||||
"unapprovedTypedMessagesCount": 0, |
||||
"keyringTypes": [ |
||||
"Simple Key Pair", |
||||
"HD Key Tree" |
||||
], |
||||
"keyrings": [ |
||||
{ |
||||
"type": "HD Key Tree", |
||||
"accounts": [ |
||||
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825" |
||||
] |
||||
} |
||||
], |
||||
"computedBalances": {}, |
||||
"currentAccountTab": "history", |
||||
"tokens": [ |
||||
{ |
||||
"address": "0x0d8775f648430679a709e98d2b0cb6250d2887ef", |
||||
"symbol": "BAT", |
||||
"decimals": "18" |
||||
} |
||||
], |
||||
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", |
||||
"currentCurrency": "usd", |
||||
"conversionRate": 418.62, |
||||
"conversionDate": 1512615622, |
||||
"infuraNetworkStatus": { |
||||
"mainnet": "ok", |
||||
"ropsten": "ok", |
||||
"kovan": "ok", |
||||
"rinkeby": "ok" |
||||
}, |
||||
"shapeShiftTxList": [], |
||||
"lostAccounts": [] |
||||
}, |
||||
"appState": { |
||||
"shouldClose": true, |
||||
"menuOpen": false, |
||||
"currentView": { |
||||
"name": "accountDetail", |
||||
"context": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825" |
||||
}, |
||||
"accountDetail": { |
||||
"subview": "transactions", |
||||
"accountExport": "none", |
||||
"privateKey": "" |
||||
}, |
||||
"transForward": false, |
||||
"isLoading": false, |
||||
"warning": null, |
||||
"forgottenPassword": false, |
||||
"scrollToBottom": false |
||||
}, |
||||
"identities": {}, |
||||
"version": "3.12.1", |
||||
"platform": { |
||||
"arch": "x86-64", |
||||
"nacl_arch": "x86-64", |
||||
"os": "mac" |
||||
}, |
||||
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36" |
||||
} |
@ -0,0 +1,48 @@ |
||||
const assert = require('assert') |
||||
const PreferencesController = require('../../app/scripts/controllers/preferences') |
||||
|
||||
describe('preferences controller', function () { |
||||
let preferencesController |
||||
|
||||
before(() => { |
||||
preferencesController = new PreferencesController() |
||||
}) |
||||
|
||||
describe('addToken', function () { |
||||
it('should add that token to its state', async function () { |
||||
const address = '0xabcdef1234567' |
||||
const symbol = 'ABBR' |
||||
const decimals = 5 |
||||
|
||||
await preferencesController.addToken(address, symbol, decimals) |
||||
|
||||
const tokens = preferencesController.getTokens() |
||||
assert.equal(tokens.length, 1, 'one token added') |
||||
|
||||
const added = tokens[0] |
||||
assert.equal(added.address, address, 'set address correctly') |
||||
assert.equal(added.symbol, symbol, 'set symbol correctly') |
||||
assert.equal(added.decimals, decimals, 'set decimals correctly') |
||||
}) |
||||
|
||||
it('should allow updating a token value', async function () { |
||||
const address = '0xabcdef1234567' |
||||
const symbol = 'ABBR' |
||||
const decimals = 5 |
||||
|
||||
await preferencesController.addToken(address, symbol, decimals) |
||||
|
||||
const newDecimals = 6 |
||||
await preferencesController.addToken(address, symbol, newDecimals) |
||||
|
||||
const tokens = preferencesController.getTokens() |
||||
assert.equal(tokens.length, 1, 'one token added') |
||||
|
||||
const added = tokens[0] |
||||
assert.equal(added.address, address, 'set address correctly') |
||||
assert.equal(added.symbol, symbol, 'set symbol correctly') |
||||
assert.equal(added.decimals, newDecimals, 'updated decimals correctly') |
||||
}) |
||||
}) |
||||
}) |
||||
|
Loading…
Reference in new issue