Skip to content

Commit

Permalink
deps: remove ethjs-util (#349)
Browse files Browse the repository at this point in the history
Legacy package. Replaced utility functions with equivalents from already
used @metamask/utils.
  • Loading branch information
legobeat authored Nov 15, 2023
1 parent ef18b9d commit 5dea85e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@metamask/abi-utils": "^2.0.2",
"@metamask/utils": "^8.1.0",
"ethereum-cryptography": "^2.1.2",
"ethjs-util": "^0.1.6",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1"
},
Expand Down
12 changes: 9 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import {
ecrecover,
fromRpcSig,
fromSigned,
isHexString,
toBuffer,
ToBufferInputTypes,
toUnsigned,
} from '@ethereumjs/util';
import { add0x, bytesToHex, numberToBytes } from '@metamask/utils';
import { intToHex, isHexString, stripHexPrefix } from 'ethjs-util';
import {
numberToHex,
remove0x,
add0x,
bytesToHex,
numberToBytes,
} from '@metamask/utils';

/**
* Pads the front of the given hex string with zeroes until it reaches the
Expand Down Expand Up @@ -76,7 +82,7 @@ export function concatSig(v: Buffer, r: Buffer, s: Buffer): string {
const vSig = bufferToInt(v);
const rStr = padWithZeroes(toUnsigned(rSig).toString('hex'), 64);
const sStr = padWithZeroes(toUnsigned(sSig).toString('hex'), 64);
const vStr = stripHexPrefix(intToHex(vSig));
const vStr = remove0x(numberToHex(vSig));
return add0x(rStr.concat(sStr, vStr));
}

Expand Down
27 changes: 0 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,6 @@ __metadata:
eslint-plugin-node: ^11.1.0
eslint-plugin-prettier: ^4.2.1
ethereum-cryptography: ^2.1.2
ethjs-util: ^0.1.6
jest: ^27.0.6
prettier: ^2.3.2
prettier-plugin-packagejson: ^2.2.11
Expand Down Expand Up @@ -2706,16 +2705,6 @@ __metadata:
languageName: node
linkType: hard

"ethjs-util@npm:^0.1.6":
version: 0.1.6
resolution: "ethjs-util@npm:0.1.6"
dependencies:
is-hex-prefixed: 1.0.0
strip-hex-prefix: 1.0.0
checksum: 1f42959e78ec6f49889c49c8a98639e06f52a15966387dd39faf2930db48663d026efb7db2702dcffe7f2a99c4a0144b7ce784efdbf733f4077aae95de76d65f
languageName: node
linkType: hard

"execa@npm:^5.0.0, execa@npm:^5.1.1":
version: 5.1.1
resolution: "execa@npm:5.1.1"
Expand Down Expand Up @@ -3432,13 +3421,6 @@ __metadata:
languageName: node
linkType: hard

"is-hex-prefixed@npm:1.0.0":
version: 1.0.0
resolution: "is-hex-prefixed@npm:1.0.0"
checksum: 5ac58e6e528fb029cc43140f6eeb380fad23d0041cc23154b87f7c9a1b728bcf05909974e47248fd0b7fcc11ba33cf7e58d64804883056fabd23e2b898be41de
languageName: node
linkType: hard

"is-lambda@npm:^1.0.1":
version: 1.0.1
resolution: "is-lambda@npm:1.0.1"
Expand Down Expand Up @@ -5581,15 +5563,6 @@ __metadata:
languageName: node
linkType: hard

"strip-hex-prefix@npm:1.0.0":
version: 1.0.0
resolution: "strip-hex-prefix@npm:1.0.0"
dependencies:
is-hex-prefixed: 1.0.0
checksum: 4cafe7caee1d281d3694d14920fd5d3c11adf09371cef7e2ccedd5b83efd9e9bd2219b5d6ce6e809df6e0f437dc9d30db1192116580875698aad164a6d6b285b
languageName: node
linkType: hard

"strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1":
version: 3.1.1
resolution: "strip-json-comments@npm:3.1.1"
Expand Down

0 comments on commit 5dea85e

Please sign in to comment.