@ledgerhq/coin-tester-evm 1.9.0-nightly.3 → 1.9.0-nightly.4
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 +15 -0
- package/lib/src/scenarii/blast.d.ts.map +1 -1
- package/lib/src/scenarii/blast.js +12 -4
- 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 -1
- 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 +4 -1
- package/lib/src/scenarii/ethereum.js.map +1 -1
- package/lib/src/scenarii/polygon.d.ts.map +1 -1
- package/lib/src/scenarii/polygon.js +4 -1
- package/lib/src/scenarii/polygon.js.map +1 -1
- package/lib/src/scenarii/scroll.d.ts.map +1 -1
- package/lib/src/scenarii/scroll.js +12 -4
- 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 +4 -1
- package/lib/src/scenarii/sonic.js.map +1 -1
- package/lib/src/scenarii.test.d.ts.map +1 -1
- package/lib/src/scenarii.test.js +2 -30
- package/lib/src/scenarii.test.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-es/src/scenarii/blast.d.ts.map +1 -1
- package/lib-es/src/scenarii/blast.js +13 -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 -2
- 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.d.ts.map +1 -1
- package/lib-es/src/scenarii/polygon.js +5 -2
- package/lib-es/src/scenarii/polygon.js.map +1 -1
- package/lib-es/src/scenarii/scroll.d.ts.map +1 -1
- package/lib-es/src/scenarii/scroll.js +13 -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 +5 -2
- package/lib-es/src/scenarii/sonic.js.map +1 -1
- package/lib-es/src/scenarii.test.d.ts.map +1 -1
- package/lib-es/src/scenarii.test.js +2 -7
- package/lib-es/src/scenarii.test.js.map +1 -1
- package/lib-es/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/scenarii/blast.ts +9 -5
- package/src/scenarii/core.ts +4 -2
- package/src/scenarii/ethereum.ts +4 -2
- package/src/scenarii/polygon.ts +4 -2
- package/src/scenarii/scroll.ts +9 -5
- package/src/scenarii/sonic.ts +4 -2
- package/src/scenarii.test.ts +2 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-tester-evm",
|
|
3
|
-
"version": "1.9.0-nightly.
|
|
3
|
+
"version": "1.9.0-nightly.4",
|
|
4
4
|
"description": "Ledger EVM Coin Tester",
|
|
5
5
|
"main": "src/scenarii.test.ts",
|
|
6
6
|
"keywords": [
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"dotenv": "^16.4.5",
|
|
52
52
|
"ethers": "6.15.0",
|
|
53
53
|
"msw": "^2.2.1",
|
|
54
|
-
"@ledgerhq/coin-evm": "^2.33.0-nightly.
|
|
55
|
-
"@ledgerhq/coin-framework": "^6.7.0-nightly.
|
|
54
|
+
"@ledgerhq/coin-evm": "^2.33.0-nightly.2",
|
|
55
|
+
"@ledgerhq/coin-framework": "^6.7.0-nightly.2",
|
|
56
56
|
"@ledgerhq/coin-tester": "^0.10.1",
|
|
57
|
-
"@ledgerhq/cryptoassets": "^13.31.0-nightly.
|
|
58
|
-
"@ledgerhq/live-common": "^34.51.0-nightly.
|
|
57
|
+
"@ledgerhq/cryptoassets": "^13.31.0-nightly.2",
|
|
58
|
+
"@ledgerhq/live-common": "^34.51.0-nightly.4",
|
|
59
59
|
"@ledgerhq/live-config": "^3.2.0",
|
|
60
|
-
"@ledgerhq/live-signer-evm": "^0.8.2-nightly.
|
|
60
|
+
"@ledgerhq/live-signer-evm": "^0.8.2-nightly.2",
|
|
61
61
|
"@ledgerhq/types-cryptoassets": "^7.29.0-nightly.0",
|
|
62
62
|
"@ledgerhq/types-live": "^6.87.0-nightly.1"
|
|
63
63
|
},
|
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 { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
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,8 @@ const makeScenarioTransactions = ({ address }: { address: string }): BlastScenar
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const MIM_ON_BLAST =
|
|
42
|
+
const MIM_ON_BLAST = findTokenById(TOKEN_ID);
|
|
43
|
+
if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
|
|
43
44
|
const scenarioSendMIMTransaction: BlastScenarioTransaction = {
|
|
44
45
|
name: "Send 80 MIM",
|
|
45
46
|
amount: new BigNumber(ethers.parseUnits("80", MIM_ON_BLAST.units[0].magnitude).toString()),
|
|
@@ -109,7 +110,8 @@ export const scenarioBlast: Scenario<EvmTransaction, Account> = {
|
|
|
109
110
|
|
|
110
111
|
const scenarioAccount = makeAccount(address, blast);
|
|
111
112
|
|
|
112
|
-
const MIM_ON_BLAST =
|
|
113
|
+
const MIM_ON_BLAST = findTokenById(TOKEN_ID);
|
|
114
|
+
if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
|
|
113
115
|
await callMyDealer({
|
|
114
116
|
provider,
|
|
115
117
|
drug: MIM_ON_BLAST,
|
|
@@ -130,7 +132,8 @@ export const scenarioBlast: Scenario<EvmTransaction, Account> = {
|
|
|
130
132
|
await indexBlocks();
|
|
131
133
|
},
|
|
132
134
|
beforeAll: account => {
|
|
133
|
-
const MIM_ON_BLAST =
|
|
135
|
+
const MIM_ON_BLAST = findTokenById(TOKEN_ID);
|
|
136
|
+
if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
|
|
134
137
|
expect(account.balance.toFixed()).toBe(ethers.parseEther("10000").toString());
|
|
135
138
|
expect(account.subAccounts?.[0]?.type).toBe("TokenAccount");
|
|
136
139
|
expect(account.subAccounts?.[0]?.balance?.toFixed()).toBe(
|
|
@@ -138,7 +141,8 @@ export const scenarioBlast: Scenario<EvmTransaction, Account> = {
|
|
|
138
141
|
);
|
|
139
142
|
},
|
|
140
143
|
afterAll: account => {
|
|
141
|
-
const MIM_ON_BLAST =
|
|
144
|
+
const MIM_ON_BLAST = findTokenById(TOKEN_ID);
|
|
145
|
+
if (!MIM_ON_BLAST) throw new Error("MIM on Blast token not found");
|
|
142
146
|
expect(account.subAccounts?.length).toBe(1);
|
|
143
147
|
expect(account.subAccounts?.[0].balance.toFixed()).toBe(
|
|
144
148
|
ethers.parseUnits("20", MIM_ON_BLAST.units[0].magnitude).toString(),
|
package/src/scenarii/core.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
|
|
|
8
8
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
9
9
|
import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
|
|
10
10
|
import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
|
|
11
|
-
import {
|
|
11
|
+
import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
12
12
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
13
13
|
import { LegacySignerEth } from "@ledgerhq/live-signer-evm";
|
|
14
14
|
import { Account } from "@ledgerhq/types-live";
|
|
@@ -21,9 +21,11 @@ import { defaultNanoApp } from "../scenarii.test";
|
|
|
21
21
|
|
|
22
22
|
type CoreScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const stcoreOnCore = findTokenById(
|
|
25
25
|
"core/erc20/liquid_staked_core_0xb3a8f0f0da9ffc65318aa39e55079796093029ad",
|
|
26
26
|
);
|
|
27
|
+
if (!stcoreOnCore) throw new Error("stCORE on Core token not found");
|
|
28
|
+
const STCORE_ON_CORE = stcoreOnCore;
|
|
27
29
|
|
|
28
30
|
const makeScenarioTransactions = ({ address }: { address: string }): CoreScenarioTransaction[] => {
|
|
29
31
|
const scenarioSendSTransaction: CoreScenarioTransaction = {
|
package/src/scenarii/ethereum.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
5
5
|
import { Account } from "@ledgerhq/types-live";
|
|
6
6
|
import { BigNumber } from "bignumber.js";
|
|
7
7
|
import { ethers } from "ethers";
|
|
@@ -20,7 +20,9 @@ import { BridgeStrategy } from "@ledgerhq/coin-tester/types";
|
|
|
20
20
|
|
|
21
21
|
type EthereumScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const usdcOnEthereum = findTokenById("ethereum/erc20/usd__coin");
|
|
24
|
+
if (!usdcOnEthereum) throw new Error("USDC on Ethereum token not found");
|
|
25
|
+
const USDC_ON_ETHEREUM = usdcOnEthereum;
|
|
24
26
|
const boredApeContract = "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D";
|
|
25
27
|
const boredApeTokenId = "3368";
|
|
26
28
|
const cloneXContract = "0x348FC118bcC65a92dC033A951aF153d14D945312";
|
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 { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
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,9 @@ import { BridgeStrategy } from "@ledgerhq/coin-tester/types";
|
|
|
17
17
|
|
|
18
18
|
type PolygonScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const usdcOnPolygon = findTokenById("polygon/erc20/usd_coin_(pos)");
|
|
21
|
+
if (!usdcOnPolygon) throw new Error("USDC on Polygon token not found");
|
|
22
|
+
const USDC_ON_POLYGON = usdcOnPolygon;
|
|
21
23
|
const yootContract = "0x670fd103b1a08628e9557cD66B87DeD841115190";
|
|
22
24
|
const yootTokenId = "1988";
|
|
23
25
|
const emberContract = "0xa5511E9941E303101b50675926Fd4d9c1A8a8805";
|
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 { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
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,8 @@ const makeScenarioTransactions = ({
|
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const USDC_ON_SCROLL =
|
|
46
|
+
const USDC_ON_SCROLL = findTokenById("scroll/erc20/usd_coin");
|
|
47
|
+
if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
|
|
47
48
|
const scenarioSendUSDCTransaction: ScrollScenarioTransaction = {
|
|
48
49
|
name: "Send USDC",
|
|
49
50
|
amount: new BigNumber(ethers.parseUnits("80", USDC_ON_SCROLL.units[0].magnitude).toString()),
|
|
@@ -113,7 +114,8 @@ export const scenarioScroll: Scenario<EvmTransaction, Account> = {
|
|
|
113
114
|
|
|
114
115
|
const scenarioAccount = makeAccount(address, scroll);
|
|
115
116
|
|
|
116
|
-
const USDC_ON_SCROLL =
|
|
117
|
+
const USDC_ON_SCROLL = findTokenById(TOKEN_ID);
|
|
118
|
+
if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
|
|
117
119
|
await callMyDealer({
|
|
118
120
|
provider,
|
|
119
121
|
drug: USDC_ON_SCROLL,
|
|
@@ -134,7 +136,8 @@ export const scenarioScroll: Scenario<EvmTransaction, Account> = {
|
|
|
134
136
|
await indexBlocks();
|
|
135
137
|
},
|
|
136
138
|
beforeAll: account => {
|
|
137
|
-
const USDC_ON_SCROLL =
|
|
139
|
+
const USDC_ON_SCROLL = findTokenById(TOKEN_ID);
|
|
140
|
+
if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
|
|
138
141
|
expect(account.balance.toFixed()).toBe(ethers.parseEther("10000").toString());
|
|
139
142
|
expect(account.subAccounts?.[0]?.type).toBe("TokenAccount");
|
|
140
143
|
expect(account.subAccounts?.[0]?.balance?.toFixed()).toBe(
|
|
@@ -142,7 +145,8 @@ export const scenarioScroll: Scenario<EvmTransaction, Account> = {
|
|
|
142
145
|
);
|
|
143
146
|
},
|
|
144
147
|
afterAll: account => {
|
|
145
|
-
const USDC_ON_SCROLL =
|
|
148
|
+
const USDC_ON_SCROLL = findTokenById(TOKEN_ID);
|
|
149
|
+
if (!USDC_ON_SCROLL) throw new Error("USDC on Scroll token not found");
|
|
146
150
|
expect(account.subAccounts?.length).toBe(1);
|
|
147
151
|
expect(account.subAccounts?.[0].balance.toFixed()).toBe(
|
|
148
152
|
ethers.parseUnits("20", USDC_ON_SCROLL.units[0].magnitude).toString(),
|
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 { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
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,11 @@ import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
|
16
16
|
|
|
17
17
|
type SonicScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const usdcOnSonic = findTokenById(
|
|
20
20
|
"sonic/erc20/bridged_usdc_sonic_labs_0x29219dd400f2bf60e5a23d13be72b486d4038894",
|
|
21
21
|
);
|
|
22
|
+
if (!usdcOnSonic) throw new Error("USDC on Sonic token not found");
|
|
23
|
+
const USDC_ON_SONIC = usdcOnSonic;
|
|
22
24
|
|
|
23
25
|
const makeScenarioTransactions = ({ address }: { address: string }): SonicScenarioTransaction[] => {
|
|
24
26
|
const scenarioSendSTransaction: SonicScenarioTransaction = {
|
package/src/scenarii.test.ts
CHANGED
|
@@ -8,19 +8,13 @@ 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
|
|
12
|
-
import * as legacy from "@ledgerhq/cryptoassets/tokens";
|
|
11
|
+
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/tokens";
|
|
13
12
|
|
|
14
13
|
global.console = require("console");
|
|
15
14
|
jest.setTimeout(100_000);
|
|
16
15
|
|
|
17
16
|
//TODO mock call to CAL when available
|
|
18
|
-
|
|
19
|
-
setCryptoAssetsStoreForCoinFramework({
|
|
20
|
-
getTokenById: legacy.getTokenById,
|
|
21
|
-
findTokenById: legacy.findTokenById,
|
|
22
|
-
findTokenByAddressInCurrency: legacy.findTokenByAddressInCurrency,
|
|
23
|
-
} as CryptoAssetsStore);
|
|
17
|
+
setCryptoAssetsStoreForCoinFramework(legacyCryptoAssetsStore);
|
|
24
18
|
|
|
25
19
|
// Note this config runs with NanoX
|
|
26
20
|
// https://github.com/LedgerHQ/ledger-live/blob/develop/libs/coin-tester/docker-compose.yml
|