@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.
- package/CHANGELOG.md +17 -0
- package/lib/src/scenarii/blast.js +5 -5
- package/lib/src/scenarii/blast.js.map +1 -1
- package/lib/src/scenarii/core.d.ts.map +1 -1
- package/lib/src/scenarii/core.js +4 -14
- package/lib/src/scenarii/core.js.map +1 -1
- package/lib/src/scenarii/ethereum.d.ts.map +1 -1
- package/lib/src/scenarii/ethereum.js +5 -2
- package/lib/src/scenarii/ethereum.js.map +1 -1
- package/lib/src/scenarii/polygon.js +2 -2
- package/lib/src/scenarii/polygon.js.map +1 -1
- package/lib/src/scenarii/scroll.js +5 -5
- package/lib/src/scenarii/scroll.js.map +1 -1
- package/lib/src/scenarii/sonic.d.ts.map +1 -1
- package/lib/src/scenarii/sonic.js +2 -2
- package/lib/src/scenarii/sonic.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-es/src/scenarii/blast.js +5 -5
- package/lib-es/src/scenarii/blast.js.map +1 -1
- package/lib-es/src/scenarii/core.d.ts.map +1 -1
- package/lib-es/src/scenarii/core.js +5 -12
- package/lib-es/src/scenarii/core.js.map +1 -1
- package/lib-es/src/scenarii/ethereum.d.ts.map +1 -1
- package/lib-es/src/scenarii/ethereum.js +5 -2
- package/lib-es/src/scenarii/ethereum.js.map +1 -1
- package/lib-es/src/scenarii/polygon.js +2 -2
- package/lib-es/src/scenarii/polygon.js.map +1 -1
- package/lib-es/src/scenarii/scroll.js +5 -5
- package/lib-es/src/scenarii/scroll.js.map +1 -1
- package/lib-es/src/scenarii/sonic.d.ts.map +1 -1
- package/lib-es/src/scenarii/sonic.js +2 -2
- package/lib-es/src/scenarii/sonic.js.map +1 -1
- package/lib-es/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/scenarii/blast.ts +5 -5
- package/src/scenarii/core.ts +6 -16
- package/src/scenarii/ethereum.ts +6 -2
- package/src/scenarii/polygon.ts +2 -2
- package/src/scenarii/scroll.ts +5 -5
- package/src/scenarii/sonic.ts +3 -4
- 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.
|
|
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.
|
|
55
|
-
"@ledgerhq/coin-framework": "^6.
|
|
56
|
-
"@ledgerhq/coin-tester": "^0.
|
|
57
|
-
"@ledgerhq/cryptoassets": "^13.
|
|
58
|
-
"@ledgerhq/live-common": "^34.
|
|
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.
|
|
60
|
+
"@ledgerhq/live-signer-evm": "^0.10.1-nightly.20251107095716",
|
|
61
61
|
"@ledgerhq/types-cryptoassets": "^7.30.0",
|
|
62
|
-
"@ledgerhq/types-live": "^6.
|
|
62
|
+
"@ledgerhq/types-live": "^6.89.0-nightly.20251107095716"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@swc/core": "1.4.11",
|
package/src/scenarii/blast.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
package/src/scenarii/core.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
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 =
|
|
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,
|
package/src/scenarii/ethereum.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
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";
|
package/src/scenarii/polygon.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
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";
|
package/src/scenarii/scroll.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
package/src/scenarii/sonic.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
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
|
|
package/src/scenarii.test.ts
CHANGED
|
@@ -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/
|
|
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
|
-
|
|
18
|
+
initializeLegacyTokens(addTokens);
|
|
17
19
|
setCryptoAssetsStoreForCoinFramework(legacyCryptoAssetsStore);
|
|
18
20
|
|
|
19
21
|
// Note this config runs with NanoX
|