@ledgerhq/coin-tester-solana 1.6.2-nightly.20251120023735 → 1.6.2-nightly.20251121023744
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 +9 -9
- package/lib/src/fixtures.d.ts +1 -1
- package/lib/src/fixtures.d.ts.map +1 -1
- package/lib/src/fixtures.js +53 -12
- package/lib/src/fixtures.js.map +1 -1
- package/lib/src/scenarii/solana.d.ts.map +1 -1
- package/lib/src/scenarii/solana.js +0 -2
- package/lib/src/scenarii/solana.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-es/src/fixtures.d.ts +1 -1
- package/lib-es/src/fixtures.d.ts.map +1 -1
- package/lib-es/src/fixtures.js +53 -12
- package/lib-es/src/fixtures.js.map +1 -1
- package/lib-es/src/scenarii/solana.d.ts.map +1 -1
- package/lib-es/src/scenarii/solana.js +0 -2
- package/lib-es/src/scenarii/solana.js.map +1 -1
- package/lib-es/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/fixtures.ts +54 -12
- package/src/scenarii/solana.ts +0 -2
- package/src/scenarii.test.ts +2 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-tester-solana",
|
|
3
|
-
"version": "1.6.2-nightly.
|
|
3
|
+
"version": "1.6.2-nightly.20251121023744",
|
|
4
4
|
"description": "Ledger Solana Coin Tester",
|
|
5
5
|
"main": "src/scenarii.test.ts",
|
|
6
6
|
"keywords": [
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"bignumber.js": "^9",
|
|
50
50
|
"docker-compose": "^1",
|
|
51
51
|
"msw": "^2",
|
|
52
|
-
"@ledgerhq/coin-framework": "^6.9.0-nightly.
|
|
53
|
-
"@ledgerhq/coin-tester": "^0.12.0-nightly.
|
|
54
|
-
"@ledgerhq/coin-solana": "^0.37.0-nightly.
|
|
55
|
-
"@ledgerhq/cryptoassets": "^13.33.0-nightly.
|
|
56
|
-
"@ledgerhq/live-env": "^2.21.0-nightly.
|
|
57
|
-
"@ledgerhq/live-signer-solana": "^0.6.1-nightly.
|
|
52
|
+
"@ledgerhq/coin-framework": "^6.9.0-nightly.20251121023744",
|
|
53
|
+
"@ledgerhq/coin-tester": "^0.12.0-nightly.20251121023744",
|
|
54
|
+
"@ledgerhq/coin-solana": "^0.37.0-nightly.20251121023744",
|
|
55
|
+
"@ledgerhq/cryptoassets": "^13.33.0-nightly.20251121023744",
|
|
56
|
+
"@ledgerhq/live-env": "^2.21.0-nightly.20251121023744",
|
|
57
|
+
"@ledgerhq/live-signer-solana": "^0.6.1-nightly.20251121023744",
|
|
58
58
|
"@ledgerhq/types-cryptoassets": "^7.30.0",
|
|
59
|
-
"@ledgerhq/types-live": "^6.89.0-nightly.
|
|
59
|
+
"@ledgerhq/types-live": "^6.89.0-nightly.20251121023744"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/jest": "^29",
|
package/src/fixtures.ts
CHANGED
|
@@ -1,26 +1,43 @@
|
|
|
1
|
-
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
1
|
+
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
2
|
import { decodeAccountId } from "@ledgerhq/coin-framework/account";
|
|
3
3
|
import { getDerivationScheme, runDerivationScheme } from "@ledgerhq/coin-framework/derivation";
|
|
4
4
|
import { TokenAccount } from "@ledgerhq/types-live";
|
|
5
5
|
import BigNumber from "bignumber.js";
|
|
6
6
|
import { SolanaAccount } from "@ledgerhq/coin-solana/types";
|
|
7
7
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
8
|
-
import {
|
|
9
|
-
import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
|
|
10
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
8
|
+
import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
|
|
11
9
|
import { HttpResponse, http } from "msw";
|
|
12
10
|
import { setupServer } from "msw/node";
|
|
13
11
|
|
|
14
|
-
initializeLegacyTokens(addTokens);
|
|
15
|
-
|
|
16
12
|
export const RECIPIENT = "Hj69wRzkrFuf1Nby4yzPEFHdsmQdMoVYjvDKZSLjZFEp";
|
|
17
13
|
export const SOLANA = getCryptoCurrencyById("solana");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
|
|
15
|
+
export const SOLANA_USDC: TokenCurrency = {
|
|
16
|
+
type: "TokenCurrency",
|
|
17
|
+
id: "solana/spl/epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v",
|
|
18
|
+
contractAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
19
|
+
parentCurrency: SOLANA,
|
|
20
|
+
tokenType: "spl",
|
|
21
|
+
name: "USD Coin",
|
|
22
|
+
ticker: "USDC",
|
|
23
|
+
delisted: false,
|
|
24
|
+
disableCountervalue: false,
|
|
25
|
+
units: [{ name: "USDC", code: "USDC", magnitude: 6 }],
|
|
26
|
+
} as TokenCurrency;
|
|
27
|
+
|
|
28
|
+
export const SOLANA_CWIF: TokenCurrency = {
|
|
29
|
+
type: "TokenCurrency",
|
|
30
|
+
id: "solana/spl/7atgf8kqo4wjrd5atgx7t1v2zvvykpjbffnevf1icfv1",
|
|
31
|
+
contractAddress: "7atgF8KQo4wJrD5ATGX7t1V2zVvykPJbFfNeVf1icFv1",
|
|
32
|
+
parentCurrency: SOLANA,
|
|
33
|
+
tokenType: "spl",
|
|
34
|
+
name: "Catwifhat",
|
|
35
|
+
ticker: "CWIF",
|
|
36
|
+
delisted: false,
|
|
37
|
+
disableCountervalue: false,
|
|
38
|
+
units: [{ name: "CWIF", code: "CWIF", magnitude: 2 }],
|
|
39
|
+
} as TokenCurrency;
|
|
40
|
+
|
|
24
41
|
export const SOLANA_VIRTUAL: TokenCurrency = {
|
|
25
42
|
type: "TokenCurrency",
|
|
26
43
|
id: "solana/spl/3iql8bfs2ve7mww4ehaqqhasbmrncrpxizwat2zfyr9y",
|
|
@@ -30,7 +47,32 @@ export const SOLANA_VIRTUAL: TokenCurrency = {
|
|
|
30
47
|
contractAddress: "3iQL8BFS2vE7mww4ehAqQHAsbmRNCrPxizWAT2Zfyr9y",
|
|
31
48
|
parentCurrency: SOLANA,
|
|
32
49
|
tokenType: "spl",
|
|
50
|
+
delisted: false,
|
|
51
|
+
disableCountervalue: false,
|
|
33
52
|
};
|
|
53
|
+
|
|
54
|
+
setupMockCryptoAssetsStore({
|
|
55
|
+
findTokenByAddressInCurrency: async (address: string, currencyId: string) => {
|
|
56
|
+
if (currencyId !== "solana") return undefined;
|
|
57
|
+
const normalizedAddress = address.toLowerCase();
|
|
58
|
+
if (normalizedAddress === SOLANA_USDC.contractAddress.toLowerCase()) {
|
|
59
|
+
return SOLANA_USDC;
|
|
60
|
+
}
|
|
61
|
+
if (normalizedAddress === SOLANA_CWIF.contractAddress.toLowerCase()) {
|
|
62
|
+
return SOLANA_CWIF;
|
|
63
|
+
}
|
|
64
|
+
if (normalizedAddress === SOLANA_VIRTUAL.contractAddress.toLowerCase()) {
|
|
65
|
+
return SOLANA_VIRTUAL;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
},
|
|
69
|
+
findTokenById: async (id: string) => {
|
|
70
|
+
if (id === SOLANA_USDC.id) return SOLANA_USDC;
|
|
71
|
+
if (id === SOLANA_CWIF.id) return SOLANA_CWIF;
|
|
72
|
+
if (id === SOLANA_VIRTUAL.id) return SOLANA_VIRTUAL;
|
|
73
|
+
return undefined;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
34
76
|
export const WITHDRAWABLE_AMOUNT = 2e9;
|
|
35
77
|
|
|
36
78
|
export const makeAccount = (
|
package/src/scenarii/solana.ts
CHANGED
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
} from "../connection";
|
|
32
32
|
import { Config, getChainAPI } from "@ledgerhq/coin-solana/network/index";
|
|
33
33
|
import { makeBridges } from "@ledgerhq/coin-solana/bridge/bridge";
|
|
34
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
35
34
|
|
|
36
35
|
global.console = require("console");
|
|
37
36
|
jest.setTimeout(100_000);
|
|
@@ -454,7 +453,6 @@ export const scenarioSolana: Scenario<SolanaTransaction, SolanaAccount> = {
|
|
|
454
453
|
await createSplAccount(account.freshAddress, SOLANA_USDC, 5, "spl-token");
|
|
455
454
|
await createSplAccount(account.freshAddress, SOLANA_CWIF, 5, "spl-token-2022");
|
|
456
455
|
// Token not supported on LL as of 09/06/2025
|
|
457
|
-
addTokens([SOLANA_VIRTUAL]);
|
|
458
456
|
await createSplAccount(account.freshAddress, SOLANA_VIRTUAL, 5, "spl-token");
|
|
459
457
|
await initVoteAccount();
|
|
460
458
|
await initStakeAccount(account.freshAddress, WITHDRAWABLE_AMOUNT);
|
package/src/scenarii.test.ts
CHANGED
|
@@ -2,10 +2,8 @@ import { executeScenario } from "@ledgerhq/coin-tester/main";
|
|
|
2
2
|
import { killSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
|
|
3
3
|
import { scenarioSolana } from "./scenarii/solana";
|
|
4
4
|
import { killAgave } from "./agave";
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
8
|
-
import { setCryptoAssetsStoreGetter } from "@ledgerhq/coin-solana/cryptoAssetsStore";
|
|
5
|
+
// Import fixtures to setup mock store
|
|
6
|
+
import "./fixtures";
|
|
9
7
|
|
|
10
8
|
["exit", "SIGINT", "SIGQUIT", "SIGTERM", "SIGUSR1", "SIGUSR2", "uncaughtException"].map(e =>
|
|
11
9
|
process.on(e, async () => {
|
|
@@ -13,9 +11,6 @@ import { setCryptoAssetsStoreGetter } from "@ledgerhq/coin-solana/cryptoAssetsSt
|
|
|
13
11
|
}),
|
|
14
12
|
);
|
|
15
13
|
|
|
16
|
-
initializeLegacyTokens(addTokens);
|
|
17
|
-
setCryptoAssetsStoreGetter(() => legacyCryptoAssetsStore);
|
|
18
|
-
|
|
19
14
|
describe("Solana Deterministic Tester", () => {
|
|
20
15
|
it("scenario Solana", async () => {
|
|
21
16
|
try {
|