Skip to content

Commit 776fae2

Browse files
committed
fix: update ethers to v6.15.0
1 parent 405e2c2 commit 776fae2

38 files changed

+734
-900
lines changed

.changeset/chatty-houses-ring.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@ledgerhq/coin-tester-evm": minor
3+
"@ledgerhq/coin-filecoin": minor
4+
"@ledgerhq/coin-evm": minor
5+
---
6+
7+
Update ethers library to v6.15.0

libs/coin-modules/coin-evm/docs/adapters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Set of functions in charge of converting a transaction format specific to a libr
44
## Files
55

66
#### ethers.ts
7-
Functions used to convert transactions for the [ethers.js v5 library](https://docs.ethers.org/v5/)
7+
Functions used to convert transactions for the [ethers.js v6 library](https://docs.ethers.org/v6/)
88

99
#### etherscan.ts
1010
Functions used to convert transactions coming from the [etherscan-like explorers](https://docs.etherscan.io/api-endpoints/accounts)

libs/coin-modules/coin-evm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"axios": "1.11.0",
7575
"bignumber.js": "^9.1.2",
7676
"eip55": "^2.1.1",
77-
"ethers": "5.7.2",
77+
"ethers": "6.15.0",
7878
"expect": "^27.4.6",
7979
"imurmurhash": "^0.1.4",
8080
"invariant": "^2.2.2",

libs/coin-modules/coin-evm/src/__tests__/fixtures/prepareTransaction.fixtures.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ export const expectedData = (
6262
switch (type) {
6363
case "erc20":
6464
return Buffer.from(
65-
new ethers.utils.Interface(ERC20ABI)
65+
new ethers.Interface(ERC20ABI)
6666
.encodeFunctionData("transfer", [transaction.recipient, transaction.amount.toFixed()])
6767
.slice(2),
6868
"hex",
6969
);
7070
case "erc721":
7171
return Buffer.from(
72-
new ethers.utils.Interface(ERC721ABI)
72+
new ethers.Interface(ERC721ABI)
7373
.encodeFunctionData("safeTransferFrom(address,address,uint256,bytes)", [
7474
account.freshAddress,
7575
transaction.recipient,
@@ -81,7 +81,7 @@ export const expectedData = (
8181
);
8282
case "erc1155":
8383
return Buffer.from(
84-
new ethers.utils.Interface(ERC1155ABI)
84+
new ethers.Interface(ERC1155ABI)
8585
.encodeFunctionData("safeTransferFrom(address,address,uint256,uint256,bytes)", [
8686
account.freshAddress,
8787
transaction.recipient,

libs/coin-modules/coin-evm/src/__tests__/unit/adapters/ethers.unit.test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,31 @@ describe("EVM Family", () => {
4242
describe("ethers", () => {
4343
describe("transactionToEthersTransaction", () => {
4444
it("should build convert an EIP1559 ledger live transaction to an ethers transaction", () => {
45-
const ethers1559Tx: ethers.Transaction = {
45+
const ethers1559Tx: ethers.TransactionLike = {
4646
to: "0xkvn",
4747
nonce: 0,
48-
gasLimit: ethers.BigNumber.from(21000),
48+
gasLimit: 21000n,
4949
data: "0x" + testData,
50-
value: ethers.BigNumber.from(100),
51-
chainId: 1,
50+
value: 100n,
51+
chainId: 1n,
5252
type: 2,
53-
maxFeePerGas: ethers.BigNumber.from(10000),
54-
maxPriorityFeePerGas: ethers.BigNumber.from(10000),
53+
maxFeePerGas: 10000n,
54+
maxPriorityFeePerGas: 10000n,
5555
};
5656

5757
expect(transactionToEthersTransaction(eip1559Tx)).toEqual(ethers1559Tx);
5858
});
5959

6060
it("should build convert an legacy ledger live transaction to an ethers transaction", () => {
61-
const legacyEthersTx: ethers.Transaction = {
61+
const legacyEthersTx: ethers.TransactionLike = {
6262
to: "0xkvn",
6363
nonce: 0,
64-
gasLimit: ethers.BigNumber.from(21000),
64+
gasLimit: 21000n,
6565
data: "0x" + testData,
66-
value: ethers.BigNumber.from(100),
67-
chainId: 1,
66+
value: 100n,
67+
chainId: 1n,
6868
type: 0,
69-
gasPrice: ethers.BigNumber.from(10000),
69+
gasPrice: 10000n,
7070
};
7171

7272
expect(transactionToEthersTransaction(legacyTx)).toEqual(legacyEthersTx);
@@ -78,16 +78,16 @@ describe("EVM Family", () => {
7878
maxFeePerGas: new BigNumber("29625091714.5"),
7979
};
8080

81-
const ethers1559Tx: ethers.Transaction = {
81+
const ethers1559Tx: ethers.TransactionLike = {
8282
to: "0xkvn",
8383
nonce: 0,
84-
gasLimit: ethers.BigNumber.from(21000),
84+
gasLimit: 21000n,
8585
data: "0x" + testData,
86-
value: ethers.BigNumber.from(100),
87-
chainId: 1,
86+
value: 100n,
87+
chainId: 1n,
8888
type: 2,
89-
maxFeePerGas: ethers.BigNumber.from("29625091715"),
90-
maxPriorityFeePerGas: ethers.BigNumber.from(10000),
89+
maxFeePerGas: 29625091715n,
90+
maxPriorityFeePerGas: 10000n,
9191
};
9292

9393
expect(transactionToEthersTransaction(txWithFloatingPoint)).toEqual(ethers1559Tx);
@@ -110,15 +110,15 @@ describe("EVM Family", () => {
110110
type: 0,
111111
};
112112

113-
const ethersTxWithUnrealisticNonce: ethers.Transaction = {
113+
const ethersTxWithUnrealisticNonce: ethers.TransactionLike = {
114114
to: "0xkvn",
115115
nonce: Number.MAX_SAFE_INTEGER - 1,
116-
gasLimit: ethers.BigNumber.from(21000),
116+
gasLimit: 21000n,
117117
data: "0x" + testData,
118-
value: ethers.BigNumber.from(100),
119-
chainId: 1,
118+
value: 100n,
119+
chainId: 1n,
120120
type: 0,
121-
gasPrice: ethers.BigNumber.from(10000),
121+
gasPrice: 10000n,
122122
};
123123

124124
expect(transactionToEthersTransaction(createdTransactionWithDefaultNonce)).toEqual(

0 commit comments

Comments
 (0)