From 78c2bbe53b14e063811a59bed5a656d19a399c49 Mon Sep 17 00:00:00 2001 From: Kashif Jamil Date: Thu, 9 Jan 2025 00:48:49 +0530 Subject: [PATCH] feat(statics): added ICP to statics TICKET: WIN-4236 --- modules/statics/src/base.ts | 3 ++ modules/statics/src/coins.ts | 32 +++++++++++++++++++ modules/statics/src/networks.ts | 13 ++++++++ .../unit/fixtures/expectedColdFeatures.ts | 2 ++ 4 files changed, 50 insertions(+) diff --git a/modules/statics/src/base.ts b/modules/statics/src/base.ts index 5c58448324..514ead82af 100644 --- a/modules/statics/src/base.ts +++ b/modules/statics/src/base.ts @@ -51,6 +51,7 @@ export enum CoinFamily { FIAT = 'fiat', HASH = 'hash', // Provenance HBAR = 'hbar', + ICP = 'icp', INJECTIVE = 'injective', ISLM = 'islm', KAVA = 'kava', @@ -360,6 +361,7 @@ export enum UnderlyingAsset { GTC = 'gtc', HASH = 'hash', // Provenance HBAR = 'hbar', // Hedera main coin + ICP = 'icp', INJECTIVE = 'injective', ISLM = 'islm', KAVA = 'kava', @@ -2457,6 +2459,7 @@ export enum BaseUnit { ISLM = 'aISLM', RUNE = 'rune', TAO = 'rao', + ICP = 'e8s', } export interface BaseCoinConstructorOptions { diff --git a/modules/statics/src/coins.ts b/modules/statics/src/coins.ts index 3e782793d8..3f007e97a4 100644 --- a/modules/statics/src/coins.ts +++ b/modules/statics/src/coins.ts @@ -426,11 +426,21 @@ const APT_FEATURES = [ ...AccountCoin.DEFAULT_FEATURES, CoinFeature.TSS, CoinFeature.TSS_COLD, + CoinFeature.MPCV2, CoinFeature.STAKING, CoinFeature.BULK_TRANSACTION, CoinFeature.BULK_STAKING_TRANSACTION, CoinFeature.SUPPORTS_TOKENS, ]; + +const ICP_FEATURES = [ + ...AccountCoin.DEFAULT_FEATURES, + CoinFeature.TSS, + CoinFeature.TSS_COLD, + CoinFeature.MPCV2, + CoinFeature.SUPPORTS_TOKENS, +]; + const TAO_FEATURES = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.TSS, CoinFeature.TSS_COLD, CoinFeature.STAKING]; const ETH_FEATURES_WITH_FRANKFURT = [...ETH_FEATURES, CoinFeature.CUSTODY_BITGO_FRANKFURT]; @@ -1443,6 +1453,28 @@ export const coins = CoinMap.fromCoins([ TAO_FEATURES, KeyCurve.Ed25519 ), + account( + '35254b6a-5370-4e22-844b-be504b510103', + 'icp', + 'Internet Computer', + Networks.main.icp, + 8, + UnderlyingAsset.ICP, + BaseUnit.ICP, + ICP_FEATURES, + KeyCurve.Ed25519 + ), + account( + 'ce572773-26c2-4038-a96d-26649a9a96df', + 'ticp', + 'Testnet Internet Computer', + Networks.test.icp, + 8, + UnderlyingAsset.ICP, + BaseUnit.ICP, + ICP_FEATURES, + KeyCurve.Ed25519 + ), erc20CompatibleAccountCoin( 'bfae821b-cf3a-4190-b1a8-a54af51d730e', 'celo', diff --git a/modules/statics/src/networks.ts b/modules/statics/src/networks.ts index d2b810c6c1..ca3849fdde 100644 --- a/modules/statics/src/networks.ts +++ b/modules/statics/src/networks.ts @@ -163,6 +163,17 @@ class AptTestnet extends Testnet implements AccountNetwork { explorerUrl = 'https://explorer.aptoslabs.com/?network=testnet'; } +class Icp extends Mainnet implements AccountNetwork { + name = 'Internet Computer'; + family = CoinFamily.ICP; + explorerUrl = 'https://www.icpexplorer.org'; //TODO(WIN-4242): update to the prod rosetta explorer url +} + +class IcpTestnet extends Testnet implements AccountNetwork { + name = 'Testnet Internet Computer'; + family = CoinFamily.ICP; + explorerUrl = 'https://www.icpexplorer.org'; //TODO(WIN-4242): update to the test rosetta explorer url +} class Arbitrum extends Mainnet implements EthereumNetwork { name = 'Arbitrum'; family = CoinFamily.ARBETH; @@ -1188,6 +1199,7 @@ export const Networks = { fiat: Object.freeze(new Fiat()), hash: Object.freeze(new Hash()), hedera: Object.freeze(new Hedera()), + icp: Object.freeze(new Icp()), injective: Object.freeze(new Injective()), islm: Object.freeze(new Islm()), kava: Object.freeze(new Kava()), @@ -1249,6 +1261,7 @@ export const Networks = { ethereumClassicTestnet: Object.freeze(new EthereumClassicTestnet()), hash: Object.freeze(new HashTestnet()), hedera: Object.freeze(new HederaTestnet()), + icp: Object.freeze(new IcpTestnet()), injective: Object.freeze(new InjectiveTestnet()), islm: Object.freeze(new IslmTestnet()), kava: Object.freeze(new KavaTestnet()), diff --git a/modules/statics/test/unit/fixtures/expectedColdFeatures.ts b/modules/statics/test/unit/fixtures/expectedColdFeatures.ts index 5e44c017ee..d3a9d896a0 100644 --- a/modules/statics/test/unit/fixtures/expectedColdFeatures.ts +++ b/modules/statics/test/unit/fixtures/expectedColdFeatures.ts @@ -67,6 +67,7 @@ export const expectedColdFeatures = { 'coreum', 'dot', 'hash', + 'icp', 'islm', 'injective', 'kava', @@ -90,6 +91,7 @@ export const expectedColdFeatures = { 'thash', 'thorchain:rune', 'tia', + 'ticp', 'tislm', 'tinjective', 'tkava',