Merge branch 'develop' into e2e-tests
This commit is contained in:
commit
6c9b303dbd
|
@ -181,7 +181,7 @@
|
||||||
"message": "DEN je vaša šifrirana shramba v MetaMasku."
|
"message": "DEN je vaša šifrirana shramba v MetaMasku."
|
||||||
},
|
},
|
||||||
"deposit": {
|
"deposit": {
|
||||||
"message": "Vplačilo"
|
"message": "Vplačaj"
|
||||||
},
|
},
|
||||||
"depositBTC": {
|
"depositBTC": {
|
||||||
"message": "Vplačajte vaš BTC na spodnji naslov:"
|
"message": "Vplačajte vaš BTC na spodnji naslov:"
|
||||||
|
@ -507,10 +507,10 @@
|
||||||
"message": "Ni se začelo"
|
"message": "Ni se začelo"
|
||||||
},
|
},
|
||||||
"oldUI": {
|
"oldUI": {
|
||||||
"message": "Starejši uporabniški vmesnik"
|
"message": "Star UI"
|
||||||
},
|
},
|
||||||
"oldUIMessage": {
|
"oldUIMessage": {
|
||||||
"message": "Vrnili ste se v starejši uporabniški vmesnik. V novega se lahko vrnete z možnostjo v spustnem meniju v zgornjem desnem kotu."
|
"message": "Vrnili ste se v star uporabniški vmesnik. V novega se lahko vrnete z možnostjo v spustnem meniju v zgornjem desnem kotu."
|
||||||
},
|
},
|
||||||
"or": {
|
"or": {
|
||||||
"message": "ali",
|
"message": "ali",
|
||||||
|
@ -759,7 +759,7 @@
|
||||||
"message": "Vpišite vaše geslo"
|
"message": "Vpišite vaše geslo"
|
||||||
},
|
},
|
||||||
"uiWelcome": {
|
"uiWelcome": {
|
||||||
"message": "Dobrodošli v novem uporabniškem vmesniku (Beta)"
|
"message": "Dobrodošli v nov UI (Beta)"
|
||||||
},
|
},
|
||||||
"uiWelcomeMessage": {
|
"uiWelcomeMessage": {
|
||||||
"message": "Zdaj uporabljate novi MetaMask uporabniški vmesnik. Razglejte se, preizkusite nove funkcije, kot so pošiljanje žetonov, in nas obvestite, če imate kakšne težave."
|
"message": "Zdaj uporabljate novi MetaMask uporabniški vmesnik. Razglejte se, preizkusite nove funkcije, kot so pošiljanje žetonov, in nas obvestite, če imate kakšne težave."
|
||||||
|
|
|
@ -111,6 +111,21 @@ class TransactionController extends EventEmitter {
|
||||||
this.txStateManager.wipeTransactions(address)
|
this.txStateManager.wipeTransactions(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check if a txMeta in the list with the same nonce has been confirmed in a block
|
||||||
|
if the txParams dont have a nonce will return false
|
||||||
|
@returns {boolean} weather the nonce has been used in a transaction confirmed in a block
|
||||||
|
@param {object} txMeta - the txMeta object
|
||||||
|
*/
|
||||||
|
async isNonceTaken (txMeta) {
|
||||||
|
const { from, nonce } = txMeta.txParams
|
||||||
|
if ('nonce' in txMeta.txParams) {
|
||||||
|
const sameNonceTxList = this.txStateManager.getFilteredTxList({from, nonce, status: 'confirmed'})
|
||||||
|
return (sameNonceTxList.length >= 1)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
add a new unapproved transaction to the pipeline
|
add a new unapproved transaction to the pipeline
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ class TransactionStateManager extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
getTxsByMetaData (key, value, txList = this.getTxList()) {
|
getTxsByMetaData (key, value, txList = this.getTxList()) {
|
||||||
return txList.filter((txMeta) => {
|
return txList.filter((txMeta) => {
|
||||||
if (txMeta.txParams[key]) {
|
if (key in txMeta.txParams) {
|
||||||
return txMeta.txParams[key] === value
|
return txMeta.txParams[key] === value
|
||||||
} else {
|
} else {
|
||||||
return txMeta[key] === value
|
return txMeta[key] === value
|
||||||
|
|
|
@ -382,6 +382,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||||
updateTransaction: nodeify(txController.updateTransaction, txController),
|
updateTransaction: nodeify(txController.updateTransaction, txController),
|
||||||
updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController),
|
updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController),
|
||||||
retryTransaction: nodeify(this.retryTransaction, this),
|
retryTransaction: nodeify(this.retryTransaction, this),
|
||||||
|
isNonceTaken: nodeify(txController.isNonceTaken, txController),
|
||||||
|
|
||||||
// messageManager
|
// messageManager
|
||||||
signMessage: nodeify(this.signMessage, this),
|
signMessage: nodeify(this.signMessage, this),
|
||||||
|
|
|
@ -40,6 +40,36 @@ describe('Transaction Controller', function () {
|
||||||
txController.nonceTracker.getNonceLock = () => Promise.resolve({ nextNonce: 0, releaseLock: noop })
|
txController.nonceTracker.getNonceLock = () => Promise.resolve({ nextNonce: 0, releaseLock: noop })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('#isNonceTaken', function () {
|
||||||
|
it('should return true', function (done) {
|
||||||
|
txController.txStateManager._saveTxList([
|
||||||
|
{ id: 1, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} },
|
||||||
|
{ id: 2, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} },
|
||||||
|
{ id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} },
|
||||||
|
])
|
||||||
|
txController.isNonceTaken({txParams: {nonce:0, from:'0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'}})
|
||||||
|
.then((isNonceTaken) => {
|
||||||
|
assert(isNonceTaken)
|
||||||
|
done()
|
||||||
|
}).catch(done)
|
||||||
|
|
||||||
|
})
|
||||||
|
it('should return false', function (done) {
|
||||||
|
txController.txStateManager._saveTxList([
|
||||||
|
{ id: 1, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} },
|
||||||
|
{ id: 2, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} },
|
||||||
|
{ id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {nonce: 0, from: '0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'} },
|
||||||
|
])
|
||||||
|
|
||||||
|
txController.isNonceTaken({txParams: {nonce:0, from:'0x8ACCE2391C0d510a6C5E5D8f819A678F79B7E675'}})
|
||||||
|
.then((isNonceTaken) => {
|
||||||
|
assert(!isNonceTaken)
|
||||||
|
done()
|
||||||
|
}).catch(done)
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('#getState', function () {
|
describe('#getState', function () {
|
||||||
it('should return a state object with the right keys and datat types', function () {
|
it('should return a state object with the right keys and datat types', function () {
|
||||||
const exposedState = txController.getState()
|
const exposedState = txController.getState()
|
||||||
|
|
Loading…
Reference in New Issue