mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
use eth-json-rpc-errors
This commit is contained in:
parent
3696e4c648
commit
58c5fe01bf
@ -1,6 +1,7 @@
|
||||
const ObservableStore = require('obs-store')
|
||||
const SafeEventEmitter = require('safe-event-emitter')
|
||||
const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware')
|
||||
const { errors: rpcErrors } = require('eth-json-rpc-errors')
|
||||
|
||||
/**
|
||||
* A controller that services user-approved requests for a full Ethereum provider API
|
||||
@ -48,7 +49,7 @@ class ProviderApprovalController extends SafeEventEmitter {
|
||||
if (approved) {
|
||||
res.result = [this.preferencesController.getSelectedAddress()]
|
||||
} else {
|
||||
throw new Error('User denied account authorization')
|
||||
throw rpcErrors.eth.userRejectedRequest('User denied account authorization')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ const ObservableStore = require('obs-store')
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
const Transaction = require('ethereumjs-tx')
|
||||
const EthQuery = require('ethjs-query')
|
||||
const { errors: rpcErrors } = require('eth-json-rpc-errors')
|
||||
const abi = require('human-standard-token-abi')
|
||||
const abiDecoder = require('abi-decoder')
|
||||
abiDecoder.addABI(abi)
|
||||
@ -166,11 +167,11 @@ class TransactionController extends EventEmitter {
|
||||
case 'submitted':
|
||||
return resolve(finishedTxMeta.hash)
|
||||
case 'rejected':
|
||||
return reject(cleanErrorStack(new Error('MetaMask Tx Signature: User denied transaction signature.')))
|
||||
return reject(cleanErrorStack(rpcErrors.eth.userRejectedRequest('MetaMask Tx Signature: User denied transaction signature.')))
|
||||
case 'failed':
|
||||
return reject(cleanErrorStack(new Error(finishedTxMeta.err.message)))
|
||||
return reject(cleanErrorStack(rpcErrors.internal(finishedTxMeta.err.message)))
|
||||
default:
|
||||
return reject(cleanErrorStack(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`)))
|
||||
return reject(cleanErrorStack(rpcErrors.internal(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`)))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -51,11 +51,11 @@
|
||||
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/lodash": "^4.17.12"
|
||||
},
|
||||
"dependencies": {
|
||||
"3box": "^1.10.2",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@material-ui/core": "1.0.0",
|
||||
"@sentry/browser": "^4.1.1",
|
||||
"@zxing/library": "^0.8.0",
|
||||
"3box": "^1.10.2",
|
||||
"abi-decoder": "^1.2.0",
|
||||
"abortcontroller-polyfill": "^1.3.0",
|
||||
"asmcrypto.js": "^2.3.2",
|
||||
@ -85,6 +85,7 @@
|
||||
"eth-block-tracker": "^4.4.2",
|
||||
"eth-contract-metadata": "^1.9.2",
|
||||
"eth-ens-namehash": "^2.0.8",
|
||||
"eth-json-rpc-errors": "^1.0.1",
|
||||
"eth-json-rpc-filters": "^4.1.0",
|
||||
"eth-json-rpc-infura": "^4.0.1",
|
||||
"eth-json-rpc-middleware": "^4.2.0",
|
||||
|
Loading…
Reference in New Issue
Block a user