Skip to content

Commit

Permalink
controller-utils,gas-controller: remove redundant toString call
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Nov 20, 2023
1 parent 3727aaa commit 4cf75e8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion jest.config.packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ module.exports = {
'<rootDir>/../$1/src',
// Some @metamask/* packages we are referencing aren't in this monorepo,
// so in that case use their published versions
'<rootDir>/../../types/@metamask/$1.d.ts',
'<rootDir>/../../node_modules/@metamask/$1',
],
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@types/node": "^16.18.54",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"bn.js": "^5.2.1",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.5.0",
Expand Down
1 change: 1 addition & 0 deletions packages/controller-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@metamask/auto-changelog": "^3.4.3",
"@metamask/eth-query": "^4.0.0",
"@types/jest": "^27.4.1",
"bn.js": "^5.2.1",
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"nock": "^13.3.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/controller-utils/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type EthQuery from '@metamask/eth-query';
import { fromWei, toWei } from '@metamask/ethjs-unit';

Check failure on line 2 in packages/controller-utils/src/util.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

'/home/runner/work/core/core/node_modules/@metamask/ethjs-unit/lib/index.js' imported multiple times
import unit from '@metamask/ethjs-unit';

Check failure on line 3 in packages/controller-utils/src/util.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

'unit' is defined but never used

Check failure on line 3 in packages/controller-utils/src/util.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

'/home/runner/work/core/core/node_modules/@metamask/ethjs-unit/lib/index.js' imported multiple times
import type { Hex, Json } from '@metamask/utils';
import { isStrictHexString } from '@metamask/utils';
import ensNamehash from 'eth-ens-namehash';
Expand Down Expand Up @@ -108,7 +109,7 @@ export function gweiDecToWEIBN(n: number | string) {
*/
export function weiHexToGweiDec(hex: string) {
const hexWei = new BN(stripHexPrefix(hex), 16);
return fromWei(hexWei, 'gwei').toString(10);
return fromWei(hexWei, 'gwei');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/gas-fee-controller/src/gas-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const makeClientIdHeader = (clientId: string) => ({ 'X-Client-Id': clientId });
*/
export function normalizeGWEIDecimalNumbers(n: string | number) {
const numberAsWEIHex = gweiDecToWEIBN(n).toString(16);
const numberAsGWEI = weiHexToGweiDec(numberAsWEIHex).toString(10);
const numberAsGWEI = weiHexToGweiDec(numberAsWEIHex);
return numberAsGWEI;
}

Expand Down
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ __metadata:
"@metamask/utils": ^8.2.0
"@spruceid/siwe-parser": 1.1.3
"@types/jest": ^27.4.1
bn.js: ^5.2.1
deepmerge: ^4.2.2
eth-ens-namehash: ^2.0.8
ethereumjs-util: ^7.0.10
Expand Down Expand Up @@ -1611,6 +1612,7 @@ __metadata:
"@types/node": ^16.18.54
"@typescript-eslint/eslint-plugin": ^5.62.0
"@typescript-eslint/parser": ^5.62.0
bn.js: ^5.2.1
eslint: ^8.44.0
eslint-config-prettier: ^8.5.0
eslint-import-resolver-typescript: ^2.5.0
Expand Down

0 comments on commit 4cf75e8

Please sign in to comment.