@ledgerhq/cryptoassets 9.9.0 → 9.10.0-next.0

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 (43) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -0
  3. package/lib/abandonseed.d.ts.map +1 -1
  4. package/lib/abandonseed.js +8 -0
  5. package/lib/abandonseed.js.map +1 -1
  6. package/lib/currencies.d.ts.map +1 -1
  7. package/lib/currencies.js +94 -24
  8. package/lib/currencies.js.map +1 -1
  9. package/lib/currencies.test.js +2 -0
  10. package/lib/currencies.test.js.map +1 -1
  11. package/lib/data/internet_computer.d.ts +4 -0
  12. package/lib/data/internet_computer.d.ts.map +1 -0
  13. package/lib/data/internet_computer.js +17 -0
  14. package/lib/data/internet_computer.js.map +1 -0
  15. package/lib/tokens.d.ts.map +1 -1
  16. package/lib/tokens.js +21 -0
  17. package/lib/tokens.js.map +1 -1
  18. package/lib/types.d.ts +1 -0
  19. package/lib/types.d.ts.map +1 -1
  20. package/lib-es/abandonseed.d.ts.map +1 -1
  21. package/lib-es/abandonseed.js +8 -0
  22. package/lib-es/abandonseed.js.map +1 -1
  23. package/lib-es/currencies.d.ts.map +1 -1
  24. package/lib-es/currencies.js +94 -24
  25. package/lib-es/currencies.js.map +1 -1
  26. package/lib-es/currencies.test.js +2 -0
  27. package/lib-es/currencies.test.js.map +1 -1
  28. package/lib-es/data/internet_computer.d.ts +4 -0
  29. package/lib-es/data/internet_computer.d.ts.map +1 -0
  30. package/lib-es/data/internet_computer.js +15 -0
  31. package/lib-es/data/internet_computer.js.map +1 -0
  32. package/lib-es/tokens.d.ts.map +1 -1
  33. package/lib-es/tokens.js +21 -0
  34. package/lib-es/tokens.js.map +1 -1
  35. package/lib-es/types.d.ts +1 -0
  36. package/lib-es/types.d.ts.map +1 -1
  37. package/package.json +3 -3
  38. package/src/abandonseed.ts +8 -0
  39. package/src/currencies.test.ts +2 -0
  40. package/src/currencies.ts +94 -24
  41. package/src/data/internet_computer.ts +17 -0
  42. package/src/tokens.ts +29 -0
  43. package/src/types.ts +1 -0
@@ -217,6 +217,8 @@ test("testnet currencies must also set disableCountervalue to true", () => {
217
217
  expect(
218
218
  listCryptoCurrencies(true)
219
219
  .filter(c => c.isTestnetFor)
220
+ /** @todo remove this after the ethereum/evm merge */
221
+ .filter(c => !c.id.includes("_as_evm_test_only"))
220
222
  .filter(c => !c.disableCountervalue)
221
223
  .map(c => c.id),
222
224
  ).toEqual([]);
package/src/currencies.ts CHANGED
@@ -1472,30 +1472,6 @@ export const cryptocurrenciesById: Record<CryptoCurrencyId, CryptoCurrency> = {
1472
1472
  ],
1473
1473
  explorerViews: [],
1474
1474
  },
1475
- icp: {
1476
- type: "CryptoCurrency",
1477
- id: "icp",
1478
- coinType: CoinType.ICP,
1479
- family: "icp",
1480
- ticker: "ICP",
1481
- scheme: "icp",
1482
- color: "#000",
1483
- managerAppName: "InternetComputer",
1484
- name: "Internet Computer (ICP)",
1485
- units: [
1486
- {
1487
- name: "ICP",
1488
- code: "ICP",
1489
- magnitude: 8,
1490
- },
1491
- ],
1492
- explorerViews: [
1493
- {
1494
- address: "https://dashboard.internetcomputer.org/account/$address",
1495
- tx: "https://dashboard.internetcomputer.org/transaction/$hash",
1496
- },
1497
- ],
1498
- },
1499
1475
  iota: {
1500
1476
  type: "CryptoCurrency",
1501
1477
  id: "iota",
@@ -3460,6 +3436,11 @@ export const cryptocurrenciesById: Record<CryptoCurrencyId, CryptoCurrency> = {
3460
3436
  code: "STX",
3461
3437
  magnitude: 6,
3462
3438
  },
3439
+ {
3440
+ name: "uSTX",
3441
+ code: "uSTX",
3442
+ magnitude: 0,
3443
+ },
3463
3444
  ],
3464
3445
  explorerViews: [
3465
3446
  {
@@ -3593,7 +3574,96 @@ export const cryptocurrenciesById: Record<CryptoCurrencyId, CryptoCurrency> = {
3593
3574
  },
3594
3575
  ],
3595
3576
  },
3577
+ internet_computer: {
3578
+ type: "CryptoCurrency",
3579
+ id: "internet_computer",
3580
+ coinType: CoinType.ICP,
3581
+ name: "Internet Computer",
3582
+ managerAppName: "InternetComputer",
3583
+ ticker: "ICP",
3584
+ scheme: "internet_computer",
3585
+ color: "#e1effa",
3586
+ family: "internet_computer",
3587
+ units: [
3588
+ {
3589
+ name: "ICP",
3590
+ code: "ICP",
3591
+ magnitude: 8,
3592
+ },
3593
+ ],
3594
+ explorerViews: [
3595
+ {
3596
+ tx: "https://www.icpexplorer.org/#/tx/$hash",
3597
+ address: "https://www.icpexplorer.org/#/acct/$address",
3598
+ },
3599
+ ],
3600
+ },
3601
+ // ethereum nanoapp currencies
3596
3602
  // Light Integrations are at the end of the list until we figure out a way to fix the ticker/managerApp collisions
3603
+ ethereum_as_evm_test_only: {
3604
+ type: "CryptoCurrency",
3605
+ id: "ethereum_as_evm_test_only",
3606
+ coinType: CoinType.ETH,
3607
+ name: "Ethereum EVM (TEST ONLY DO NOT USE)",
3608
+ managerAppName: "Ethereum",
3609
+ ticker: "ETH",
3610
+ scheme: "ethereum_as_evm_test_only",
3611
+ color: "#ff6969",
3612
+ family: "evm",
3613
+ units: ethereumUnits("ETH", "ETH"),
3614
+ isTestnetFor: "ethereum",
3615
+ ethereumLikeInfo: {
3616
+ chainId: 1,
3617
+ networkId: 1,
3618
+ rpc: "https://rpc.ankr.com/eth",
3619
+ explorer: {
3620
+ uri: "https://api.etherscan.io",
3621
+ type: "etherscan",
3622
+ },
3623
+ },
3624
+ explorerViews: [
3625
+ {
3626
+ tx: "https://etherscan.io/tx/$hash",
3627
+ address: "https://etherscan.io/address/$address",
3628
+ token: "https://etherscan.io/token/$contractAddress?a=$address",
3629
+ },
3630
+ ],
3631
+ },
3632
+ polygon_as_evm_test_only: {
3633
+ type: "CryptoCurrency",
3634
+ id: "polygon_as_evm_test_only",
3635
+ coinType: CoinType.ETH,
3636
+ name: "Polygon EVM (TEST ONLY DO NOT USE)",
3637
+ managerAppName: "Polygon",
3638
+ ticker: "MATIC",
3639
+ scheme: "polygon_as_evm_test_only",
3640
+ color: "#f7a363",
3641
+ family: "evm",
3642
+ units: [
3643
+ {
3644
+ name: "MATIC",
3645
+ code: "MATIC",
3646
+ magnitude: 18,
3647
+ },
3648
+ ],
3649
+ isTestnetFor: "polygon",
3650
+ ethereumLikeInfo: {
3651
+ chainId: 137,
3652
+ networkId: 137,
3653
+ rpc: "https://rpc.ankr.com/polygon",
3654
+ explorer: {
3655
+ uri: "https://api.polygonscan.com",
3656
+ type: "etherscan",
3657
+ },
3658
+ },
3659
+ explorerViews: [
3660
+ {
3661
+ tx: "https://polygonscan.com/tx/$hash",
3662
+ address: "https://polygonscan.com/address/$address",
3663
+ token: "https://polygonscan.com/token/$contractAddress?a=$address",
3664
+ },
3665
+ ],
3666
+ },
3597
3667
  arbitrum: {
3598
3668
  type: "CryptoCurrency",
3599
3669
  id: "arbitrum",
@@ -0,0 +1,17 @@
1
+ export type ICPToken = [string, string, string, string, number, boolean];
2
+
3
+ const tokens: ICPToken[] = [
4
+ // [assetCode, assetIssuer, asset type, name, precision, enableCountervalues]
5
+ // Note: asset type is only used in Receive asset message and always should be
6
+ // "InternetComputer"
7
+ [
8
+ "USDC",
9
+ "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
10
+ "InternetComputer",
11
+ "USDC",
12
+ 7,
13
+ true,
14
+ ],
15
+ ];
16
+
17
+ export default tokens;
package/src/tokens.ts CHANGED
@@ -7,6 +7,7 @@ import erc20tokens, { ERC20Token } from "./data/erc20";
7
7
  import esdttokens, { ElrondESDTToken } from "./data/esdt";
8
8
  import polygonTokens, { PolygonERC20Token } from "./data/polygon-erc20";
9
9
  import stellarTokens, { StellarToken } from "./data/stellar";
10
+ import icpTokens, { ICPToken } from "./data/internet_computer";
10
11
  import trc10tokens, { TRC10Token } from "./data/trc10";
11
12
  import trc20tokens, { TRC20Token } from "./data/trc20";
12
13
  //import spltokens from "../data/spl";
@@ -29,6 +30,7 @@ addTokens(asatokens.map(convertAlgorandASATokens));
29
30
  addTokens(esdttokens.map(convertElrondESDTTokens));
30
31
  addTokens(cardanoNativeTokens.map(convertCardanoNativeTokens));
31
32
  addTokens(stellarTokens.map(convertStellarTokens));
33
+ addTokens(icpTokens.map(convertICPTokens));
32
34
  //addTokens(spltokens.map(convertSplTokens));
33
35
  type TokensListOptions = {
34
36
  withDelisted: boolean;
@@ -476,3 +478,30 @@ function convertStellarTokens([
476
478
  ],
477
479
  };
478
480
  }
481
+
482
+ function convertICPTokens([
483
+ assetCode,
484
+ assetIssuer,
485
+ assetType,
486
+ name,
487
+ precision,
488
+ enableCountervalues,
489
+ ]: ICPToken): TokenCurrency {
490
+ return {
491
+ type: "TokenCurrency",
492
+ id: `icp/asset/${assetCode}:${assetIssuer}`,
493
+ contractAddress: assetIssuer,
494
+ parentCurrency: getCryptoCurrencyById("internet_computer"),
495
+ tokenType: assetType,
496
+ name,
497
+ ticker: assetCode,
498
+ disableCountervalue: !enableCountervalues,
499
+ units: [
500
+ {
501
+ name,
502
+ code: assetCode,
503
+ magnitude: precision,
504
+ },
505
+ ],
506
+ };
507
+ }
package/src/types.ts CHANGED
@@ -7,3 +7,4 @@ export type { PolygonERC20Token } from "./data/polygon-erc20";
7
7
  export type { StellarToken } from "./data/stellar";
8
8
  export type { TRC10Token } from "./data/trc10";
9
9
  export type { TRC20Token } from "./data/trc20";
10
+ export type { ICPToken } from "./data/internet_computer";