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 8fdf27c
Show file tree
Hide file tree
Showing 6 changed files with 6 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
2 changes: 1 addition & 1 deletion packages/controller-utils/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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 8fdf27c

Please sign in to comment.