mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'develop' into testing
This commit is contained in:
commit
238f2eb179
@ -9,6 +9,9 @@ workflows:
|
|||||||
- prep-build:
|
- prep-build:
|
||||||
requires:
|
requires:
|
||||||
- prep-deps-npm
|
- prep-deps-npm
|
||||||
|
- prep-docs:
|
||||||
|
requires:
|
||||||
|
- prep-deps-npm
|
||||||
- prep-scss:
|
- prep-scss:
|
||||||
requires:
|
requires:
|
||||||
- prep-deps-npm
|
- prep-deps-npm
|
||||||
@ -63,12 +66,22 @@ workflows:
|
|||||||
- prep-deps-npm
|
- prep-deps-npm
|
||||||
- prep-build
|
- prep-build
|
||||||
- all-tests-pass
|
- all-tests-pass
|
||||||
- job-publish:
|
- job-publish-prerelease:
|
||||||
requires:
|
requires:
|
||||||
- prep-deps-npm
|
- prep-deps-npm
|
||||||
- prep-build
|
- prep-build
|
||||||
- job-screens
|
- job-screens
|
||||||
- all-tests-pass
|
- all-tests-pass
|
||||||
|
- job-publish-release:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
requires:
|
||||||
|
- prep-deps-npm
|
||||||
|
- prep-build
|
||||||
|
- prep-docs
|
||||||
|
- job-screens
|
||||||
|
- all-tests-pass
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prep-deps-npm:
|
prep-deps-npm:
|
||||||
@ -124,6 +137,21 @@ jobs:
|
|||||||
- dist
|
- dist
|
||||||
- builds
|
- builds
|
||||||
|
|
||||||
|
prep-docs:
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:8-browsers
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- restore_cache:
|
||||||
|
key: dependency-cache-{{ .Revision }}
|
||||||
|
- run:
|
||||||
|
name: build:dist
|
||||||
|
command: npm run doc
|
||||||
|
- save_cache:
|
||||||
|
key: docs-cache-{{ .Revision }}
|
||||||
|
paths:
|
||||||
|
- docs/jsdoc
|
||||||
|
|
||||||
prep-scss:
|
prep-scss:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:8-browsers
|
- image: circleci/node:8-browsers
|
||||||
@ -225,7 +253,7 @@ jobs:
|
|||||||
paths:
|
paths:
|
||||||
- test-artifacts
|
- test-artifacts
|
||||||
|
|
||||||
job-publish:
|
job-publish-prerelease:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:8-browsers
|
- image: circleci/node:8-browsers
|
||||||
steps:
|
steps:
|
||||||
@ -251,9 +279,29 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: build:announce
|
name: build:announce
|
||||||
command: ./development/metamaskbot-build-announce.js
|
command: ./development/metamaskbot-build-announce.js
|
||||||
|
|
||||||
|
job-publish-release:
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:8-browsers
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- restore_cache:
|
||||||
|
key: dependency-cache-{{ .Revision }}
|
||||||
|
- restore_cache:
|
||||||
|
key: build-cache-{{ .Revision }}
|
||||||
|
- restore_cache:
|
||||||
|
key: docs-cache-{{ .Revision }}
|
||||||
|
- restore_cache:
|
||||||
|
key: job-screens-{{ .Revision }}
|
||||||
- run:
|
- run:
|
||||||
name: sentry sourcemaps upload
|
name: sentry sourcemaps upload
|
||||||
command: npm run sentry:publish
|
command: npm run sentry:publish
|
||||||
|
- run:
|
||||||
|
name: github gh-pages docs publish
|
||||||
|
command: >
|
||||||
|
git config user.name metamaskbot
|
||||||
|
git config user.email admin@metamask.io
|
||||||
|
gh-pages -d docs/jsdocs
|
||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
docker:
|
docker:
|
||||||
|
@ -322,7 +322,7 @@ function setupController (initState, initLangCode) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A runtime.Port object, as provided by the browser:
|
* A runtime.Port object, as provided by the browser:
|
||||||
* @link https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/Port
|
* @see https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/Port
|
||||||
* @typedef Port
|
* @typedef Port
|
||||||
* @type Object
|
* @type Object
|
||||||
*/
|
*/
|
||||||
|
@ -111,21 +111,6 @@ 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} whether 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
|
||||||
|
|
||||||
|
@ -382,7 +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),
|
getFilteredTxList: nodeify(txController.getFilteredTxList, txController),
|
||||||
|
|
||||||
// messageManager
|
// messageManager
|
||||||
signMessage: nodeify(this.signMessage, this),
|
signMessage: nodeify(this.signMessage, this),
|
||||||
|
@ -231,6 +231,7 @@
|
|||||||
"ganache-cli": "^6.1.0",
|
"ganache-cli": "^6.1.0",
|
||||||
"ganache-core": "^2.1.0",
|
"ganache-core": "^2.1.0",
|
||||||
"geckodriver": "^1.11.0",
|
"geckodriver": "^1.11.0",
|
||||||
|
"gh-pages": "^1.1.0",
|
||||||
"gifencoder": "^1.1.0",
|
"gifencoder": "^1.1.0",
|
||||||
"gulp": "github:gulpjs/gulp#6d71a658c61edb3090221579d8f97dbe086ba2ed",
|
"gulp": "github:gulpjs/gulp#6d71a658c61edb3090221579d8f97dbe086ba2ed",
|
||||||
"gulp-babel": "^7.0.0",
|
"gulp-babel": "^7.0.0",
|
||||||
|
@ -40,36 +40,6 @@ 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…
x
Reference in New Issue
Block a user