Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# node
npm-debug.log
yarn-error.log
npm-debug.log
yarn-error.log
node_modules
package-lock.json

# tarball from `yarn pack`
*.tgz

coverage
dist
docs
node_modules
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"await-semaphore": "^0.1.3",
"eth-contract-metadata": "^1.11.0",
"eth-ens-namehash": "^2.0.8",
"eth-json-rpc-errors": "^2.0.2",
"eth-json-rpc-infura": "^4.0.1",
"eth-keyring-controller": "^5.3.0",
"eth-method-registry": "1.1.0",
Expand Down Expand Up @@ -69,7 +70,7 @@
"tslint": "^5.10.0",
"tslint-config-prettier": "^1.13.0",
"typedoc": "^0.15.0",
"typescript": "^3.5.3"
"typescript": "^3.7.5"
},
"jest": {
"moduleFileExtensions": [
Expand Down
14 changes: 11 additions & 3 deletions src/transaction/TransactionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { EventEmitter } from 'events';
import { addHexPrefix, bufferToHex } from 'ethereumjs-util';
import BaseController, { BaseConfig, BaseState } from '../BaseController';
import NetworkController from '../network/NetworkController';
import { IEthErrors } from 'eth-json-rpc-errors/@types';
const ethErrors: IEthErrors = require('eth-json-rpc-errors').ethErrors;

import {
BNToHex,
fractionBN,
Expand Down Expand Up @@ -365,11 +368,16 @@ export class TransactionController extends BaseController<TransactionConfig, Tra
case 'submitted':
return resolve(meta.transactionHash);
case 'rejected':
return reject(new Error('User rejected the transaction.'));
return reject(ethErrors.provider.userRejectedRequest('User rejected the transaction'));
case 'cancelled':
return reject(new Error('User cancelled the transaction.'));
return reject(ethErrors.rpc.internal('User cancelled the transaction'));
case 'failed':
return reject(new Error(meta.error!.message));
return reject(ethErrors.rpc.internal(meta.error!.message));
/* istanbul ignore next */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine!

default:
return reject(
ethErrors.rpc.internal(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(meta)}`)
);
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function normalizeTransaction(transaction: Transaction) {
let key: keyof Transaction;
for (key in NORMALIZERS) {
if (transaction[key as keyof Transaction]) {
normalizedTransaction[key] = NORMALIZERS[key](transaction[key]);
normalizedTransaction[key] = NORMALIZERS[key](transaction[key]) as never;
}
}
return normalizedTransaction;
Expand Down
14 changes: 13 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,13 @@ eth-json-rpc-errors@^1.0.1:
dependencies:
fast-safe-stringify "^2.0.6"

eth-json-rpc-errors@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/eth-json-rpc-errors/-/eth-json-rpc-errors-2.0.2.tgz#c1965de0301fe941c058e928bebaba2e1285e3c4"
integrity sha512-uBCRM2w2ewusRHGxN8JhcuOb2RN3ueAOYH/0BhqdFmQkZx5lj5+fLKTz0mIVOzd4FG5/kUksCzCD7eTEim6gaA==
dependencies:
fast-safe-stringify "^2.0.6"

eth-json-rpc-filters@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.1.1.tgz#15277c66790236d85f798f4d7dc6bab99a798cd2"
Expand Down Expand Up @@ -5545,11 +5552,16 @@ typedoc@^0.15.0:
typedoc-default-themes "^0.6.0"
typescript "3.5.x"

typescript@3.5.x, typescript@^3.5.3:
typescript@3.5.x:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==

typescript@^3.7.5:
version "3.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a"
integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==

uglify-js@^3.1.4:
version "3.6.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.5.tgz#b0ee796d2ae7e25672e04f65629b997cd4b30bd6"
Expand Down