@ledgerhq/coin-evm 2.9.3 → 2.9.4-nightly.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +17 -0
- package/lib/__tests__/unit/api/node/rpc.unit.test.js +28 -3
- package/lib/__tests__/unit/api/node/rpc.unit.test.js.map +1 -1
- package/lib/api/node/rpc.common.js +2 -2
- package/lib/api/node/rpc.common.js.map +1 -1
- package/lib/specs.js +1 -1
- package/lib/specs.js.map +1 -1
- package/lib-es/__tests__/unit/api/node/rpc.unit.test.js +28 -3
- package/lib-es/__tests__/unit/api/node/rpc.unit.test.js.map +1 -1
- package/lib-es/api/node/rpc.common.js +2 -2
- package/lib-es/api/node/rpc.common.js.map +1 -1
- package/lib-es/specs.js +1 -1
- package/lib-es/specs.js.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/unit/api/node/rpc.unit.test.ts +35 -4
- package/src/__tests__/unit/editTransaction/__snapshots__/getFormattedFeeFields.test.ts.snap +854 -854
- package/src/api/node/rpc.common.ts +2 -2
- package/src/specs.ts +1 -1
|
@@ -3,7 +3,11 @@ import { ethers } from "ethers";
|
|
|
3
3
|
import BigNumber from "bignumber.js";
|
|
4
4
|
import { delay } from "@ledgerhq/live-promise";
|
|
5
5
|
import { CryptoCurrency, CryptoCurrencyId, EthereumLikeInfo } from "@ledgerhq/types-cryptoassets";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
EvmTransactionLegacy,
|
|
8
|
+
Transaction as EvmTransaction,
|
|
9
|
+
EvmTransactionEIP1559,
|
|
10
|
+
} from "../../../../types";
|
|
7
11
|
import { GasEstimationError, InsufficientFunds } from "../../../../errors";
|
|
8
12
|
import { makeAccount } from "../../../fixtures/common.fixtures";
|
|
9
13
|
import * as RPC_API from "../../../../api/node/rpc.common";
|
|
@@ -309,6 +313,20 @@ describe("EVM Family", () => {
|
|
|
309
313
|
});
|
|
310
314
|
|
|
311
315
|
describe("getFeeData", () => {
|
|
316
|
+
const eip1559Tx: EvmTransactionEIP1559 = {
|
|
317
|
+
amount: new BigNumber(100),
|
|
318
|
+
useAllAmount: false,
|
|
319
|
+
recipient: "0xlmb",
|
|
320
|
+
family: "evm",
|
|
321
|
+
mode: "send",
|
|
322
|
+
nonce: 0,
|
|
323
|
+
gasLimit: new BigNumber(0),
|
|
324
|
+
chainId: 1,
|
|
325
|
+
maxFeePerGas: new BigNumber(0),
|
|
326
|
+
maxPriorityFeePerGas: new BigNumber(0),
|
|
327
|
+
type: 2,
|
|
328
|
+
};
|
|
329
|
+
|
|
312
330
|
it("should return the expected payload for an EIP1559 tx", async () => {
|
|
313
331
|
jest
|
|
314
332
|
.spyOn(ethers.providers.StaticJsonRpcProvider.prototype, "send")
|
|
@@ -327,7 +345,7 @@ describe("EVM Family", () => {
|
|
|
327
345
|
}
|
|
328
346
|
});
|
|
329
347
|
|
|
330
|
-
expect(await RPC_API.getFeeData(fakeCurrency as CryptoCurrency,
|
|
348
|
+
expect(await RPC_API.getFeeData(fakeCurrency as CryptoCurrency, eip1559Tx)).toEqual({
|
|
331
349
|
maxFeePerGas: new BigNumber("6000000014"),
|
|
332
350
|
maxPriorityFeePerGas: new BigNumber("5999999988"),
|
|
333
351
|
gasPrice: null,
|
|
@@ -353,7 +371,7 @@ describe("EVM Family", () => {
|
|
|
353
371
|
}
|
|
354
372
|
});
|
|
355
373
|
|
|
356
|
-
expect(await RPC_API.getFeeData(fakeCurrency as CryptoCurrency,
|
|
374
|
+
expect(await RPC_API.getFeeData(fakeCurrency as CryptoCurrency, eip1559Tx)).toEqual({
|
|
357
375
|
maxFeePerGas: new BigNumber("1000000026"),
|
|
358
376
|
maxPriorityFeePerGas: new BigNumber(1e9),
|
|
359
377
|
gasPrice: null,
|
|
@@ -361,6 +379,19 @@ describe("EVM Family", () => {
|
|
|
361
379
|
});
|
|
362
380
|
});
|
|
363
381
|
|
|
382
|
+
const legacyTx: EvmTransactionLegacy = {
|
|
383
|
+
amount: new BigNumber(100),
|
|
384
|
+
useAllAmount: false,
|
|
385
|
+
recipient: "0xlmb",
|
|
386
|
+
family: "evm",
|
|
387
|
+
mode: "send",
|
|
388
|
+
nonce: 0,
|
|
389
|
+
gasLimit: new BigNumber(0),
|
|
390
|
+
chainId: 1,
|
|
391
|
+
gasPrice: new BigNumber(0),
|
|
392
|
+
type: 0,
|
|
393
|
+
};
|
|
394
|
+
|
|
364
395
|
it("should return the expected payload for a legacy tx", async () => {
|
|
365
396
|
jest
|
|
366
397
|
.spyOn(ethers.providers.StaticJsonRpcProvider.prototype, "perform")
|
|
@@ -387,7 +418,7 @@ describe("EVM Family", () => {
|
|
|
387
418
|
...fakeCurrency,
|
|
388
419
|
id: "optimism",
|
|
389
420
|
} as CryptoCurrency,
|
|
390
|
-
|
|
421
|
+
legacyTx,
|
|
391
422
|
),
|
|
392
423
|
).toEqual({
|
|
393
424
|
maxFeePerGas: null,
|