@ledgerhq/coin-tester-evm 1.10.0 → 1.11.0-nightly.20251107095716

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/src/scenarii/blast.js +5 -5
  3. package/lib/src/scenarii/blast.js.map +1 -1
  4. package/lib/src/scenarii/core.d.ts.map +1 -1
  5. package/lib/src/scenarii/core.js +4 -14
  6. package/lib/src/scenarii/core.js.map +1 -1
  7. package/lib/src/scenarii/ethereum.d.ts.map +1 -1
  8. package/lib/src/scenarii/ethereum.js +5 -2
  9. package/lib/src/scenarii/ethereum.js.map +1 -1
  10. package/lib/src/scenarii/polygon.js +2 -2
  11. package/lib/src/scenarii/polygon.js.map +1 -1
  12. package/lib/src/scenarii/scroll.js +5 -5
  13. package/lib/src/scenarii/scroll.js.map +1 -1
  14. package/lib/src/scenarii/sonic.d.ts.map +1 -1
  15. package/lib/src/scenarii/sonic.js +2 -2
  16. package/lib/src/scenarii/sonic.js.map +1 -1
  17. package/lib/tsconfig.tsbuildinfo +1 -1
  18. package/lib-es/src/scenarii/blast.js +5 -5
  19. package/lib-es/src/scenarii/blast.js.map +1 -1
  20. package/lib-es/src/scenarii/core.d.ts.map +1 -1
  21. package/lib-es/src/scenarii/core.js +5 -12
  22. package/lib-es/src/scenarii/core.js.map +1 -1
  23. package/lib-es/src/scenarii/ethereum.d.ts.map +1 -1
  24. package/lib-es/src/scenarii/ethereum.js +5 -2
  25. package/lib-es/src/scenarii/ethereum.js.map +1 -1
  26. package/lib-es/src/scenarii/polygon.js +2 -2
  27. package/lib-es/src/scenarii/polygon.js.map +1 -1
  28. package/lib-es/src/scenarii/scroll.js +5 -5
  29. package/lib-es/src/scenarii/scroll.js.map +1 -1
  30. package/lib-es/src/scenarii/sonic.d.ts.map +1 -1
  31. package/lib-es/src/scenarii/sonic.js +2 -2
  32. package/lib-es/src/scenarii/sonic.js.map +1 -1
  33. package/lib-es/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +8 -8
  35. package/src/scenarii/blast.ts +5 -5
  36. package/src/scenarii/core.ts +6 -16
  37. package/src/scenarii/ethereum.ts +6 -2
  38. package/src/scenarii/polygon.ts +2 -2
  39. package/src/scenarii/scroll.ts +5 -5
  40. package/src/scenarii/sonic.ts +3 -4
  41. package/src/scenarii.test.ts +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-tester-evm",
3
- "version": "1.10.0",
3
+ "version": "1.11.0-nightly.20251107095716",
4
4
  "description": "Ledger EVM Coin Tester",
5
5
  "main": "src/scenarii.test.ts",
6
6
  "keywords": [
@@ -51,15 +51,15 @@
51
51
  "dotenv": "^16.4.5",
52
52
  "ethers": "6.15.0",
53
53
  "msw": "^2.2.1",
54
- "@ledgerhq/coin-evm": "^2.34.0",
55
- "@ledgerhq/coin-framework": "^6.8.0",
56
- "@ledgerhq/coin-tester": "^0.11.0",
57
- "@ledgerhq/cryptoassets": "^13.32.0",
58
- "@ledgerhq/live-common": "^34.52.0",
54
+ "@ledgerhq/coin-evm": "^2.35.0-nightly.20251107095716",
55
+ "@ledgerhq/coin-framework": "^6.9.0-nightly.20251107095716",
56
+ "@ledgerhq/coin-tester": "^0.12.0-nightly.20251107095716",
57
+ "@ledgerhq/cryptoassets": "^13.33.0-nightly.20251107095716",
58
+ "@ledgerhq/live-common": "^34.53.0-nightly.20251107095716",
59
59
  "@ledgerhq/live-config": "^3.2.0",
60
- "@ledgerhq/live-signer-evm": "^0.10.0",
60
+ "@ledgerhq/live-signer-evm": "^0.10.1-nightly.20251107095716",
61
61
  "@ledgerhq/types-cryptoassets": "^7.30.0",
62
- "@ledgerhq/types-live": "^6.88.0"
62
+ "@ledgerhq/types-live": "^6.89.0-nightly.20251107095716"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@swc/core": "1.4.11",
@@ -2,7 +2,7 @@ import { LegacySignerEth } from "@ledgerhq/live-signer-evm";
2
2
  import { BigNumber } from "bignumber.js";
3
3
  import { ethers } from "ethers";
4
4
  import { Account } from "@ledgerhq/types-live";
5
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
5
+ import { tokensById } from "@ledgerhq/cryptoassets/legacy/legacy-state";
6
6
  import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
7
7
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
8
8
  import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
@@ -39,7 +39,7 @@ const makeScenarioTransactions = ({ address }: { address: string }): BlastScenar
39
39
  },
40
40
  };
41
41
 
42
- const MIM_ON_BLAST = findTokenById(TOKEN_ID);
42
+ const MIM_ON_BLAST = tokensById[TOKEN_ID];
43
43
  if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
44
44
  const scenarioSendMIMTransaction: BlastScenarioTransaction = {
45
45
  name: "Send 80 MIM",
@@ -110,7 +110,7 @@ export const scenarioBlast: Scenario<EvmTransaction, Account> = {
110
110
 
111
111
  const scenarioAccount = makeAccount(address, blast);
112
112
 
113
- const MIM_ON_BLAST = findTokenById(TOKEN_ID);
113
+ const MIM_ON_BLAST = tokensById[TOKEN_ID];
114
114
  if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
115
115
  await callMyDealer({
116
116
  provider,
@@ -132,7 +132,7 @@ export const scenarioBlast: Scenario<EvmTransaction, Account> = {
132
132
  await indexBlocks();
133
133
  },
134
134
  beforeAll: account => {
135
- const MIM_ON_BLAST = findTokenById(TOKEN_ID);
135
+ const MIM_ON_BLAST = tokensById[TOKEN_ID];
136
136
  if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
137
137
  expect(account.balance.toFixed()).toBe(ethers.parseEther("10000").toString());
138
138
  expect(account.subAccounts?.[0]?.type).toBe("TokenAccount");
@@ -141,7 +141,7 @@ export const scenarioBlast: Scenario<EvmTransaction, Account> = {
141
141
  );
142
142
  },
143
143
  afterAll: account => {
144
- const MIM_ON_BLAST = findTokenById(TOKEN_ID);
144
+ const MIM_ON_BLAST = tokensById[TOKEN_ID];
145
145
  if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
146
146
  expect(account.subAccounts?.length).toBe(1);
147
147
  expect(account.subAccounts?.[0].balance.toFixed()).toBe(
@@ -1,29 +1,23 @@
1
1
  import { makeAccount } from "../fixtures";
2
- import { buildAccountBridge, buildCurrencyBridge } from "@ledgerhq/coin-evm/bridge/js";
3
2
  import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
4
- import resolver from "@ledgerhq/coin-evm/hw-getAddress";
5
- import { EvmSigner } from "@ledgerhq/coin-evm/types/signer";
6
3
  import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
7
4
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
8
- import { SignerContext } from "@ledgerhq/coin-framework/signer";
9
5
  import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
10
6
  import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
11
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
7
+ import { tokensById } from "@ledgerhq/cryptoassets/legacy/legacy-state";
12
8
  import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
13
- import { LegacySignerEth } from "@ledgerhq/live-signer-evm";
14
9
  import { Account } from "@ledgerhq/types-live";
15
10
  import { BigNumber } from "bignumber.js";
16
11
  import { ethers } from "ethers";
17
12
  import { killAnvil, spawnAnvil } from "../anvil";
18
- import { VITALIK, core } from "../helpers";
13
+ import { VITALIK, core, getBridges } from "../helpers";
19
14
  import { indexBlocks, initMswHandlers, resetIndexer, setBlock } from "../indexer";
20
15
  import { defaultNanoApp } from "../constants";
21
16
 
22
17
  type CoreScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
23
18
 
24
- const stcoreOnCore = findTokenById(
25
- "core/erc20/liquid_staked_core_0xb3a8f0f0da9ffc65318aa39e55079796093029ad",
26
- );
19
+ const stcoreOnCore =
20
+ tokensById["core/erc20/liquid_staked_core_0xb3a8f0f0da9ffc65318aa39e55079796093029ad"];
27
21
  if (!stcoreOnCore) throw new Error("stCORE on Core token not found");
28
22
  const STCORE_ON_CORE = stcoreOnCore;
29
23
 
@@ -69,13 +63,12 @@ const makeScenarioTransactions = ({ address }: { address: string }): CoreScenari
69
63
 
70
64
  export const scenarioCore: Scenario<EvmTransaction, Account> = {
71
65
  name: "Ledger Live Basic CORE Transactions",
72
- setup: async () => {
66
+ setup: async strategy => {
73
67
  const [{ transport, getOnSpeculosConfirmation }] = await Promise.all([
74
68
  spawnSpeculos(`/${defaultNanoApp.firmware}/Ethereum/app_${defaultNanoApp.version}.elf`),
75
69
  spawnAnvil("https://rpc.ankr.com/core"),
76
70
  ]);
77
71
  const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
78
- const signerContext: SignerContext<EvmSigner> = (_, fn) => fn(new LegacySignerEth(transport));
79
72
 
80
73
  setCoinConfig(() => ({
81
74
  info: {
@@ -114,10 +107,7 @@ export const scenarioCore: Scenario<EvmTransaction, Account> = {
114
107
  initMswHandlers(getCoinConfig(core).info);
115
108
 
116
109
  const onSignerConfirmation = getOnSpeculosConfirmation();
117
- const currencyBridge = buildCurrencyBridge(signerContext);
118
- await currencyBridge.preload(core);
119
- const accountBridge = buildAccountBridge(signerContext);
120
- const getAddress = resolver(signerContext);
110
+ const { currencyBridge, accountBridge, getAddress } = getBridges(strategy, transport, "core");
121
111
  const { address } = await getAddress("", {
122
112
  path: "44'/60'/0'/0/0",
123
113
  currency: core,
@@ -1,7 +1,9 @@
1
1
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
2
2
  import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
3
3
  import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
4
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
4
+ import { tokensById } from "@ledgerhq/cryptoassets/legacy/legacy-state";
5
+ import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
6
+ import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
5
7
  import { Account } from "@ledgerhq/types-live";
6
8
  import { BigNumber } from "bignumber.js";
7
9
  import { ethers } from "ethers";
@@ -18,9 +20,11 @@ import { defaultNanoApp } from "../constants";
18
20
  import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
19
21
  import { BridgeStrategy } from "@ledgerhq/coin-tester/types";
20
22
 
23
+ initializeLegacyTokens(addTokens);
24
+
21
25
  type EthereumScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
22
26
 
23
- const usdcOnEthereum = findTokenById("ethereum/erc20/usd__coin");
27
+ const usdcOnEthereum = tokensById["ethereum/erc20/usd__coin"];
24
28
  if (!usdcOnEthereum) throw new Error("USDC on Ethereum token not found");
25
29
  const USDC_ON_ETHEREUM = usdcOnEthereum;
26
30
  const boredApeContract = "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D";
@@ -1,7 +1,7 @@
1
1
  import { BigNumber } from "bignumber.js";
2
2
  import { ethers } from "ethers";
3
3
  import { Account } from "@ledgerhq/types-live";
4
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
4
+ import { tokensById } from "@ledgerhq/cryptoassets/legacy/legacy-state";
5
5
  import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
6
6
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
7
7
  import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
@@ -17,7 +17,7 @@ import { BridgeStrategy } from "@ledgerhq/coin-tester/types";
17
17
 
18
18
  type PolygonScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
19
19
 
20
- const usdcOnPolygon = findTokenById("polygon/erc20/usd_coin_(pos)");
20
+ const usdcOnPolygon = tokensById["polygon/erc20/usd_coin_(pos)"];
21
21
  if (!usdcOnPolygon) throw new Error("USDC on Polygon token not found");
22
22
  const USDC_ON_POLYGON = usdcOnPolygon;
23
23
  const yootContract = "0x670fd103b1a08628e9557cD66B87DeD841115190";
@@ -2,7 +2,7 @@ import { LegacySignerEth } from "@ledgerhq/live-signer-evm";
2
2
  import { BigNumber } from "bignumber.js";
3
3
  import { ethers } from "ethers";
4
4
  import { Account } from "@ledgerhq/types-live";
5
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
5
+ import { tokensById } from "@ledgerhq/cryptoassets/legacy/legacy-state";
6
6
  import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
7
7
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
8
8
  import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
@@ -43,7 +43,7 @@ const makeScenarioTransactions = ({
43
43
  },
44
44
  };
45
45
 
46
- const USDC_ON_SCROLL = findTokenById("scroll/erc20/usd_coin");
46
+ const USDC_ON_SCROLL = tokensById["scroll/erc20/usd_coin"];
47
47
  if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
48
48
  const scenarioSendUSDCTransaction: ScrollScenarioTransaction = {
49
49
  name: "Send USDC",
@@ -114,7 +114,7 @@ export const scenarioScroll: Scenario<EvmTransaction, Account> = {
114
114
 
115
115
  const scenarioAccount = makeAccount(address, scroll);
116
116
 
117
- const USDC_ON_SCROLL = findTokenById(TOKEN_ID);
117
+ const USDC_ON_SCROLL = tokensById[TOKEN_ID];
118
118
  if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
119
119
  await callMyDealer({
120
120
  provider,
@@ -136,7 +136,7 @@ export const scenarioScroll: Scenario<EvmTransaction, Account> = {
136
136
  await indexBlocks();
137
137
  },
138
138
  beforeAll: account => {
139
- const USDC_ON_SCROLL = findTokenById(TOKEN_ID);
139
+ const USDC_ON_SCROLL = tokensById[TOKEN_ID];
140
140
  if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
141
141
  expect(account.balance.toFixed()).toBe(ethers.parseEther("10000").toString());
142
142
  expect(account.subAccounts?.[0]?.type).toBe("TokenAccount");
@@ -145,7 +145,7 @@ export const scenarioScroll: Scenario<EvmTransaction, Account> = {
145
145
  );
146
146
  },
147
147
  afterAll: account => {
148
- const USDC_ON_SCROLL = findTokenById(TOKEN_ID);
148
+ const USDC_ON_SCROLL = tokensById[TOKEN_ID];
149
149
  if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
150
150
  expect(account.subAccounts?.length).toBe(1);
151
151
  expect(account.subAccounts?.[0].balance.toFixed()).toBe(
@@ -1,7 +1,7 @@
1
1
  import { BigNumber } from "bignumber.js";
2
2
  import { ethers } from "ethers";
3
3
  import { Account } from "@ledgerhq/types-live";
4
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
4
+ import { tokensById } from "@ledgerhq/cryptoassets/legacy/legacy-state";
5
5
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
6
6
  import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
7
7
  import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
@@ -16,9 +16,8 @@ import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
16
16
 
17
17
  type SonicScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
18
18
 
19
- const usdcOnSonic = findTokenById(
20
- "sonic/erc20/bridged_usdc_sonic_labs_0x29219dd400f2bf60e5a23d13be72b486d4038894",
21
- );
19
+ const usdcOnSonic =
20
+ tokensById["sonic/erc20/bridged_usdc_sonic_labs_0x29219dd400f2bf60e5a23d13be72b486d4038894"];
22
21
  if (!usdcOnSonic) throw new Error("USDC on Sonic token not found");
23
22
  const USDC_ON_SONIC = usdcOnSonic;
24
23
 
@@ -8,12 +8,14 @@ import { scenarioBlast } from "./scenarii/blast";
8
8
  import { scenarioSonic } from "./scenarii/sonic";
9
9
  import { scenarioCore } from "./scenarii/core";
10
10
  import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
11
- import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/tokens";
11
+ import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
12
+ import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
13
+ import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
12
14
 
13
15
  global.console = require("console");
14
16
  jest.setTimeout(100_000);
15
17
 
16
- //TODO mock call to CAL when available
18
+ initializeLegacyTokens(addTokens);
17
19
  setCryptoAssetsStoreForCoinFramework(legacyCryptoAssetsStore);
18
20
 
19
21
  // Note this config runs with NanoX