Skip to content

Commit

Permalink
replace ethers with submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 committed Sep 8, 2022
1 parent c0977b4 commit f745ac9
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
"build:link": "yarn build && cd dist && yarn link && rm -rf node_modules && cd .."
},
"dependencies": {
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/providers": "^5.7.0",
"@metamask/controllers": "^30.0.0",
"@types/lodash": "^4.14.176",
"bignumber.js": "^9.0.1",
"ethers": "^5.5.1",
"fast-json-patch": "^3.1.0",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.21"
Expand Down
6 changes: 3 additions & 3 deletions src/SmartTransactionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
util,
} from '@metamask/controllers';
import { BigNumber } from 'bignumber.js';
import { ethers } from 'ethers';
import { Web3Provider } from '@ethersproject/providers';
import mapValues from 'lodash/mapValues';
import cloneDeep from 'lodash/cloneDeep';
import {
Expand Down Expand Up @@ -132,7 +132,7 @@ export default class SmartTransactionsController extends BaseController<

this.getNonceLock = getNonceLock;
this.getNetwork = getNetwork;
this.ethersProvider = new ethers.providers.Web3Provider(provider);
this.ethersProvider = new Web3Provider(provider);
this.confirmExternalTransaction = confirmExternalTransaction;
this.trackMetaMetricsEvent = trackMetaMetricsEvent;

Expand All @@ -144,7 +144,7 @@ export default class SmartTransactionsController extends BaseController<
this.configure({ chainId });
this.initializeSmartTransactionsForChainId();
this.checkPoll(this.state);
this.ethersProvider = new ethers.providers.Web3Provider(provider);
this.ethersProvider = new Web3Provider(provider);
});

this.subscribe((currentState: any) => this.checkPoll(currentState));
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jsonDiffer from 'fast-json-patch';
import _ from 'lodash';
import { BigNumber } from 'bignumber.js';
import { ethers } from 'ethers';
import { hexlify } from '@ethersproject/bytes';
import {
APIType,
SmartTransaction,
Expand Down Expand Up @@ -208,5 +208,5 @@ export const isSmartTransactionCancellable = (

export const incrementNonceInHex = (nonceInHex: string): string => {
const nonceInDec = new BigNumber(nonceInHex, 16).toString(10);
return ethers.utils.hexlify(Number(nonceInDec) + 1);
return hexlify(Number(nonceInDec) + 1);
};
Loading

0 comments on commit f745ac9

Please sign in to comment.