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
48 changes: 42 additions & 6 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 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
13 changes: 10 additions & 3 deletions src/transaction/TransactionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ 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 +367,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 */
default:
return reject(
ethErrors.rpc.internal(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(meta)}`)
);
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/AccountTrackerController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ComposableController from '../src/ComposableController';
import { stub, spy } from 'sinon';

const HttpProvider = require('ethjs-provider-http');
const provider = new HttpProvider('https://ropsten.infura.io');
const provider = new HttpProvider('https://ropsten.infura.io/v3/341eacb578dd44a1a049cbc5f6fd4035');

describe('AccountTrackerController', () => {
it('should set default state', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/AssetsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AssetsContractController } from '../src/assets/AssetsContractController

const HttpProvider = require('ethjs-provider-http');
const KUDOSADDRESS = '0x2aea4add166ebf38b63d09a75de1a7b94aa24163';
const MAINNET_PROVIDER = new HttpProvider('https://mainnet.infura.io');
const MAINNET_PROVIDER = new HttpProvider('https://mainnet.infura.io/v3/341eacb578dd44a1a049cbc5f6fd4035');
const OPEN_SEA_API = 'https://api.opensea.io/api/v1/';

describe('AssetsController', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/TransactionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ function mockFetch(data: any) {
}
const HttpProvider = require('ethjs-provider-http');
const MOCK_PRFERENCES = { state: { selectedAddress: 'foo' } };
const PROVIDER = new HttpProvider('https://ropsten.infura.io');
const MAINNET_PROVIDER = new HttpProvider('https://mainnet.infura.io');
const PROVIDER = new HttpProvider('https://ropsten.infura.io/v3/341eacb578dd44a1a049cbc5f6fd4035');
const MAINNET_PROVIDER = new HttpProvider('https://mainnet.infura.io/v3/341eacb578dd44a1a049cbc5f6fd4035');
const MOCK_NETWORK = {
provider: PROVIDER,
state: { network: '3', provider: { type: 'ropsten' } },
Expand Down