@ledgerhq/coin-tester-evm 1.8.2-nightly.1 → 1.9.0-nightly.11
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 +143 -0
- package/lib/src/{scenarii.test.d.ts → constants.d.ts} +1 -1
- package/lib/src/constants.d.ts.map +1 -0
- package/lib/src/constants.js +5 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/fixtures.d.ts +4 -0
- package/lib/src/fixtures.d.ts.map +1 -0
- package/lib/src/fixtures.js +63 -0
- package/lib/src/fixtures.js.map +1 -0
- package/lib/src/scenarii/blast.d.ts.map +1 -1
- package/lib/src/scenarii/blast.js +16 -8
- 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 +8 -5
- 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 +8 -5
- 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 +8 -5
- 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 +16 -8
- 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 +8 -5
- package/lib/src/scenarii/sonic.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-es/src/{scenarii.test.d.ts → constants.d.ts} +1 -1
- package/lib-es/src/constants.d.ts.map +1 -0
- package/lib-es/src/constants.js +2 -0
- package/lib-es/src/constants.js.map +1 -0
- package/lib-es/src/fixtures.d.ts +4 -0
- package/lib-es/src/fixtures.d.ts.map +1 -0
- package/lib-es/src/fixtures.js +56 -0
- package/lib-es/src/fixtures.js.map +1 -0
- package/lib-es/src/scenarii/blast.d.ts.map +1 -1
- package/lib-es/src/scenarii/blast.js +15 -7
- 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 +7 -4
- 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 +7 -4
- 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 +7 -4
- 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 +15 -7
- 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 +7 -4
- package/lib-es/src/scenarii/sonic.js.map +1 -1
- package/lib-es/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/constants.ts +1 -0
- package/src/fixtures.ts +64 -0
- package/src/scenarii/blast.ts +11 -7
- package/src/scenarii/core.ts +6 -4
- package/src/scenarii/ethereum.ts +6 -4
- package/src/scenarii/polygon.ts +6 -4
- package/src/scenarii/scroll.ts +11 -7
- package/src/scenarii/sonic.ts +6 -4
- package/src/scenarii.test.ts +2 -11
- package/lib/src/scenarii.test.d.ts.map +0 -1
- package/lib/src/scenarii.test.js +0 -123
- package/lib/src/scenarii.test.js.map +0 -1
- package/lib-es/src/scenarii.test.d.ts.map +0 -1
- package/lib-es/src/scenarii.test.js +0 -97
- package/lib-es/src/scenarii.test.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-tester-evm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-nightly.11",
|
|
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.10.
|
|
57
|
-
"@ledgerhq/cryptoassets": "^13.
|
|
58
|
-
"@ledgerhq/live-common": "^34.51.0-nightly.
|
|
54
|
+
"@ledgerhq/coin-evm": "^2.33.0-nightly.9",
|
|
55
|
+
"@ledgerhq/coin-framework": "^6.7.0-nightly.8",
|
|
56
|
+
"@ledgerhq/coin-tester": "^0.10.2-nightly.0",
|
|
57
|
+
"@ledgerhq/cryptoassets": "^13.31.0-nightly.7",
|
|
58
|
+
"@ledgerhq/live-common": "^34.51.0-nightly.11",
|
|
59
59
|
"@ledgerhq/live-config": "^3.2.0",
|
|
60
|
-
"@ledgerhq/live-signer-evm": "^0.8.
|
|
61
|
-
"@ledgerhq/types-cryptoassets": "^7.
|
|
62
|
-
"@ledgerhq/types-live": "^6.
|
|
60
|
+
"@ledgerhq/live-signer-evm": "^0.8.2-nightly.9",
|
|
61
|
+
"@ledgerhq/types-cryptoassets": "^7.29.0-nightly.0",
|
|
62
|
+
"@ledgerhq/types-live": "^6.87.0-nightly.5"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@swc/core": "1.4.11",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"ts-jest": "^29.1.2",
|
|
73
73
|
"ts-node": "^10.9.2",
|
|
74
74
|
"typescript": "^5.3.3",
|
|
75
|
-
"@ledgerhq/hw-transport": "
|
|
75
|
+
"@ledgerhq/hw-transport": "6.31.13-nightly.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"clean": "rimraf lib lib-es",
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const defaultNanoApp = { firmware: "2.4.2" as const, version: "1.17.0" as const };
|
package/src/fixtures.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { getDerivationScheme, runDerivationScheme } from "@ledgerhq/coin-framework/derivation";
|
|
3
|
+
import { decodeAccountId } from "@ledgerhq/coin-framework/account/index";
|
|
4
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
5
|
+
import { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
6
|
+
|
|
7
|
+
export const makeAccount = (
|
|
8
|
+
address: string,
|
|
9
|
+
currency: CryptoCurrency,
|
|
10
|
+
subAccounts: TokenAccount[] = [],
|
|
11
|
+
): Account => {
|
|
12
|
+
const id = `js:2:${currency.id}:${address}:`;
|
|
13
|
+
const { derivationMode, xpubOrAddress } = decodeAccountId(id);
|
|
14
|
+
const scheme = getDerivationScheme({
|
|
15
|
+
derivationMode: derivationMode,
|
|
16
|
+
currency,
|
|
17
|
+
});
|
|
18
|
+
const index = 0;
|
|
19
|
+
const freshAddressPath = runDerivationScheme(scheme, currency, {
|
|
20
|
+
account: index,
|
|
21
|
+
node: 0,
|
|
22
|
+
address: 0,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const account: Account = {
|
|
26
|
+
type: "Account",
|
|
27
|
+
xpub: xpubOrAddress,
|
|
28
|
+
subAccounts,
|
|
29
|
+
seedIdentifier: xpubOrAddress,
|
|
30
|
+
used: true,
|
|
31
|
+
swapHistory: [],
|
|
32
|
+
id,
|
|
33
|
+
derivationMode,
|
|
34
|
+
currency,
|
|
35
|
+
index,
|
|
36
|
+
nfts: [],
|
|
37
|
+
freshAddress: xpubOrAddress,
|
|
38
|
+
freshAddressPath,
|
|
39
|
+
balance: new BigNumber(0),
|
|
40
|
+
spendableBalance: new BigNumber(0),
|
|
41
|
+
operationsCount: 0,
|
|
42
|
+
operations: [],
|
|
43
|
+
pendingOperations: [],
|
|
44
|
+
lastSyncDate: new Date(),
|
|
45
|
+
blockHeight: 0,
|
|
46
|
+
creationDate: new Date(),
|
|
47
|
+
balanceHistoryCache: {
|
|
48
|
+
HOUR: {
|
|
49
|
+
latestDate: null,
|
|
50
|
+
balances: [],
|
|
51
|
+
},
|
|
52
|
+
DAY: {
|
|
53
|
+
latestDate: null,
|
|
54
|
+
balances: [],
|
|
55
|
+
},
|
|
56
|
+
WEEK: {
|
|
57
|
+
latestDate: null,
|
|
58
|
+
balances: [],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return account;
|
|
64
|
+
};
|
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";
|
|
@@ -10,9 +10,9 @@ import { resetIndexer, setBlock, indexBlocks, initMswHandlers } from "../indexer
|
|
|
10
10
|
import { buildAccountBridge, buildCurrencyBridge } from "@ledgerhq/coin-evm/bridge/js";
|
|
11
11
|
import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
12
12
|
import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
|
|
13
|
-
import { makeAccount } from "
|
|
13
|
+
import { makeAccount } from "../fixtures";
|
|
14
14
|
import { blast, callMyDealer, VITALIK } from "../helpers";
|
|
15
|
-
import { defaultNanoApp } from "../
|
|
15
|
+
import { defaultNanoApp } from "../constants";
|
|
16
16
|
import { killAnvil, spawnAnvil } from "../anvil";
|
|
17
17
|
import resolver from "@ledgerhq/coin-evm/hw-getAddress";
|
|
18
18
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
@@ -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeAccount } from "
|
|
1
|
+
import { makeAccount } from "../fixtures";
|
|
2
2
|
import { buildAccountBridge, buildCurrencyBridge } from "@ledgerhq/coin-evm/bridge/js";
|
|
3
3
|
import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
4
4
|
import resolver from "@ledgerhq/coin-evm/hw-getAddress";
|
|
@@ -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";
|
|
@@ -17,13 +17,15 @@ import { ethers } from "ethers";
|
|
|
17
17
|
import { killAnvil, spawnAnvil } from "../anvil";
|
|
18
18
|
import { VITALIK, core } from "../helpers";
|
|
19
19
|
import { indexBlocks, initMswHandlers, resetIndexer, setBlock } from "../indexer";
|
|
20
|
-
import { defaultNanoApp } from "../
|
|
20
|
+
import { defaultNanoApp } from "../constants";
|
|
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,11 +1,11 @@
|
|
|
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";
|
|
8
|
-
import { makeAccount } from "
|
|
8
|
+
import { makeAccount } from "../fixtures";
|
|
9
9
|
import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
10
10
|
import {
|
|
11
11
|
EvmNftTransaction,
|
|
@@ -14,13 +14,15 @@ import {
|
|
|
14
14
|
import { killAnvil, spawnAnvil } from "../anvil";
|
|
15
15
|
import { callMyDealer, ethereum, VITALIK, getBridges } from "../helpers";
|
|
16
16
|
import { indexBlocks, initMswHandlers, resetIndexer, setBlock } from "../indexer";
|
|
17
|
-
import { defaultNanoApp } from "../
|
|
17
|
+
import { defaultNanoApp } from "../constants";
|
|
18
18
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
19
19
|
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,23 +1,25 @@
|
|
|
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";
|
|
8
8
|
import { resetIndexer, initMswHandlers, setBlock, indexBlocks } from "../indexer";
|
|
9
9
|
import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
|
|
10
10
|
import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
11
|
-
import { makeAccount } from "
|
|
11
|
+
import { makeAccount } from "../fixtures";
|
|
12
12
|
import { callMyDealer, getBridges, polygon, VITALIK } from "../helpers";
|
|
13
|
-
import { defaultNanoApp } from "../
|
|
13
|
+
import { defaultNanoApp } from "../constants";
|
|
14
14
|
import { killAnvil, spawnAnvil } from "../anvil";
|
|
15
15
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
16
16
|
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";
|
|
@@ -10,9 +10,9 @@ import { resetIndexer, setBlock, indexBlocks, initMswHandlers } from "../indexer
|
|
|
10
10
|
import { buildAccountBridge, buildCurrencyBridge } from "@ledgerhq/coin-evm/bridge/js";
|
|
11
11
|
import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
12
12
|
import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
|
|
13
|
-
import { makeAccount } from "
|
|
13
|
+
import { makeAccount } from "../fixtures";
|
|
14
14
|
import { callMyDealer, scroll, VITALIK } from "../helpers";
|
|
15
|
-
import { defaultNanoApp } from "../
|
|
15
|
+
import { defaultNanoApp } from "../constants";
|
|
16
16
|
import { killAnvil, spawnAnvil } from "../anvil";
|
|
17
17
|
import resolver from "@ledgerhq/coin-evm/hw-getAddress";
|
|
18
18
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
@@ -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,24 +1,26 @@
|
|
|
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";
|
|
8
8
|
import { resetIndexer, indexBlocks, initMswHandlers, setBlock } from "../indexer";
|
|
9
9
|
import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
|
|
10
10
|
import { getCoinConfig, setCoinConfig } from "@ledgerhq/coin-evm/config";
|
|
11
|
-
import { makeAccount } from "
|
|
11
|
+
import { makeAccount } from "../fixtures";
|
|
12
12
|
import { VITALIK, callMyDealer, getBridges, sonic } from "../helpers";
|
|
13
|
-
import { defaultNanoApp } from "../
|
|
13
|
+
import { defaultNanoApp } from "../constants";
|
|
14
14
|
import { killAnvil, spawnAnvil } from "../anvil";
|
|
15
15
|
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,25 +8,16 @@ 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
|
-
findTokenByAddress: legacy.findTokenByAddress,
|
|
21
|
-
getTokenById: legacy.getTokenById,
|
|
22
|
-
findTokenById: legacy.findTokenById,
|
|
23
|
-
findTokenByAddressInCurrency: legacy.findTokenByAddressInCurrency,
|
|
24
|
-
findTokenByTicker: legacy.findTokenByTicker,
|
|
25
|
-
} as CryptoAssetsStore);
|
|
17
|
+
setCryptoAssetsStoreForCoinFramework(legacyCryptoAssetsStore);
|
|
26
18
|
|
|
27
19
|
// Note this config runs with NanoX
|
|
28
20
|
// https://github.com/LedgerHQ/ledger-live/blob/develop/libs/coin-tester/docker-compose.yml
|
|
29
|
-
export const defaultNanoApp = { firmware: "2.4.2" as const, version: "1.17.0" as const };
|
|
30
21
|
|
|
31
22
|
describe.each([["legacy"], ["generic-adapter"]] as const)(
|
|
32
23
|
"EVM Deterministic Tester (%s strategy)",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scenarii.test.d.ts","sourceRoot":"","sources":["../../src/scenarii.test.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,cAAc;;;CAA6D,CAAC"}
|
package/lib/src/scenarii.test.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.defaultNanoApp = void 0;
|
|
27
|
-
const speculos_1 = require("@ledgerhq/coin-tester/signers/speculos");
|
|
28
|
-
const main_1 = require("@ledgerhq/coin-tester/main");
|
|
29
|
-
const anvil_1 = require("./anvil");
|
|
30
|
-
const ethereum_1 = require("./scenarii/ethereum");
|
|
31
|
-
const polygon_1 = require("./scenarii/polygon");
|
|
32
|
-
const scroll_1 = require("./scenarii/scroll");
|
|
33
|
-
const blast_1 = require("./scenarii/blast");
|
|
34
|
-
const sonic_1 = require("./scenarii/sonic");
|
|
35
|
-
const core_1 = require("./scenarii/core");
|
|
36
|
-
const index_1 = require("@ledgerhq/coin-framework/crypto-assets/index");
|
|
37
|
-
const legacy = __importStar(require("@ledgerhq/cryptoassets/tokens"));
|
|
38
|
-
global.console = require("console");
|
|
39
|
-
jest.setTimeout(100_000);
|
|
40
|
-
//TODO mock call to CAL when available
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
42
|
-
(0, index_1.setCryptoAssetsStore)({
|
|
43
|
-
findTokenByAddress: legacy.findTokenByAddress,
|
|
44
|
-
getTokenById: legacy.getTokenById,
|
|
45
|
-
findTokenById: legacy.findTokenById,
|
|
46
|
-
findTokenByAddressInCurrency: legacy.findTokenByAddressInCurrency,
|
|
47
|
-
findTokenByTicker: legacy.findTokenByTicker,
|
|
48
|
-
});
|
|
49
|
-
// Note this config runs with NanoX
|
|
50
|
-
// https://github.com/LedgerHQ/ledger-live/blob/develop/libs/coin-tester/docker-compose.yml
|
|
51
|
-
exports.defaultNanoApp = { firmware: "2.4.2", version: "1.17.0" };
|
|
52
|
-
describe.each([["legacy"], ["generic-adapter"]])("EVM Deterministic Tester (%s strategy)", strategy => {
|
|
53
|
-
it("scenario Ethereum", async () => {
|
|
54
|
-
try {
|
|
55
|
-
await (0, main_1.executeScenario)(ethereum_1.scenarioEthereum, strategy);
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
if (e != "done") {
|
|
59
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
60
|
-
throw e;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
it("scenario Sonic", async () => {
|
|
65
|
-
try {
|
|
66
|
-
await (0, main_1.executeScenario)(sonic_1.scenarioSonic, strategy);
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
if (e != "done") {
|
|
70
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
71
|
-
throw e;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
it("scenario polygon", async () => {
|
|
76
|
-
try {
|
|
77
|
-
await (0, main_1.executeScenario)(polygon_1.scenarioPolygon, strategy);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
if (e != "done") {
|
|
81
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
82
|
-
throw e;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
it("scenario Core", async () => {
|
|
87
|
-
try {
|
|
88
|
-
await (0, main_1.executeScenario)(core_1.scenarioCore, strategy);
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
if (e != "done") {
|
|
92
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
93
|
-
throw e;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
it.skip("scenario scroll", async () => {
|
|
98
|
-
try {
|
|
99
|
-
await (0, main_1.executeScenario)(scroll_1.scenarioScroll);
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
if (e != "done") {
|
|
103
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
104
|
-
throw e;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
it.skip("scenario blast", async () => {
|
|
109
|
-
try {
|
|
110
|
-
await (0, main_1.executeScenario)(blast_1.scenarioBlast);
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
if (e != "done") {
|
|
114
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
115
|
-
throw e;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
["exit", "SIGINT", "SIGQUIT", "SIGTERM", "SIGUSR1", "SIGUSR2", "uncaughtException"].map(e => process.on(e, async () => {
|
|
121
|
-
await Promise.all([(0, speculos_1.killSpeculos)(), (0, anvil_1.killAnvil)()]);
|
|
122
|
-
}));
|
|
123
|
-
//# sourceMappingURL=scenarii.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scenarii.test.js","sourceRoot":"","sources":["../../src/scenarii.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAsE;AACtE,qDAA6D;AAC7D,mCAAoC;AACpC,kDAAuD;AACvD,gDAAqD;AACrD,8CAAmD;AACnD,4CAAiD;AACjD,4CAAiD;AACjD,0CAA+C;AAC/C,wEAA4H;AAE5H,sEAAwD;AAExD,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAEzB,sCAAsC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EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,IAAA,sBAAe,EAAC,qBAAa,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,IAAI,MAAM,EAAE,CAAC;gBAChB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,uBAAY,GAAE,EAAE,IAAA,iBAAS,GAAE,CAAC,CAAC,CAAC;gBACjD,MAAM,CAAC,CAAC;YACV,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAC1F,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,uBAAY,GAAE,EAAE,IAAA,iBAAS,GAAE,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scenarii.test.d.ts","sourceRoot":"","sources":["../../src/scenarii.test.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,cAAc;;;CAA6D,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { killSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
|
|
2
|
-
import { executeScenario } from "@ledgerhq/coin-tester/main";
|
|
3
|
-
import { killAnvil } from "./anvil";
|
|
4
|
-
import { scenarioEthereum } from "./scenarii/ethereum";
|
|
5
|
-
import { scenarioPolygon } from "./scenarii/polygon";
|
|
6
|
-
import { scenarioScroll } from "./scenarii/scroll";
|
|
7
|
-
import { scenarioBlast } from "./scenarii/blast";
|
|
8
|
-
import { scenarioSonic } from "./scenarii/sonic";
|
|
9
|
-
import { scenarioCore } from "./scenarii/core";
|
|
10
|
-
import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
|
|
11
|
-
import * as legacy from "@ledgerhq/cryptoassets/tokens";
|
|
12
|
-
global.console = require("console");
|
|
13
|
-
jest.setTimeout(100_000);
|
|
14
|
-
//TODO mock call to CAL when available
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
16
|
-
setCryptoAssetsStoreForCoinFramework({
|
|
17
|
-
findTokenByAddress: legacy.findTokenByAddress,
|
|
18
|
-
getTokenById: legacy.getTokenById,
|
|
19
|
-
findTokenById: legacy.findTokenById,
|
|
20
|
-
findTokenByAddressInCurrency: legacy.findTokenByAddressInCurrency,
|
|
21
|
-
findTokenByTicker: legacy.findTokenByTicker,
|
|
22
|
-
});
|
|
23
|
-
// Note this config runs with NanoX
|
|
24
|
-
// https://github.com/LedgerHQ/ledger-live/blob/develop/libs/coin-tester/docker-compose.yml
|
|
25
|
-
export const defaultNanoApp = { firmware: "2.4.2", version: "1.17.0" };
|
|
26
|
-
describe.each([["legacy"], ["generic-adapter"]])("EVM Deterministic Tester (%s strategy)", strategy => {
|
|
27
|
-
it("scenario Ethereum", async () => {
|
|
28
|
-
try {
|
|
29
|
-
await executeScenario(scenarioEthereum, strategy);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
if (e != "done") {
|
|
33
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
34
|
-
throw e;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
it("scenario Sonic", async () => {
|
|
39
|
-
try {
|
|
40
|
-
await executeScenario(scenarioSonic, strategy);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
if (e != "done") {
|
|
44
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
45
|
-
throw e;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
it("scenario polygon", async () => {
|
|
50
|
-
try {
|
|
51
|
-
await executeScenario(scenarioPolygon, strategy);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
if (e != "done") {
|
|
55
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
56
|
-
throw e;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
it("scenario Core", async () => {
|
|
61
|
-
try {
|
|
62
|
-
await executeScenario(scenarioCore, strategy);
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
if (e != "done") {
|
|
66
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
67
|
-
throw e;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
it.skip("scenario scroll", async () => {
|
|
72
|
-
try {
|
|
73
|
-
await executeScenario(scenarioScroll);
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
if (e != "done") {
|
|
77
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
78
|
-
throw e;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
it.skip("scenario blast", async () => {
|
|
83
|
-
try {
|
|
84
|
-
await executeScenario(scenarioBlast);
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
if (e != "done") {
|
|
88
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
89
|
-
throw e;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
["exit", "SIGINT", "SIGQUIT", "SIGTERM", "SIGUSR1", "SIGUSR2", "uncaughtException"].map(e => process.on(e, async () => {
|
|
95
|
-
await Promise.all([killSpeculos(), killAnvil()]);
|
|
96
|
-
}));
|
|
97
|
-
//# sourceMappingURL=scenarii.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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