Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk-coin-icp): added ICP to statics #5347

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export enum CoinFamily {
FIAT = 'fiat',
HASH = 'hash', // Provenance
HBAR = 'hbar',
ICP = 'icp',
INJECTIVE = 'injective',
ISLM = 'islm',
KAVA = 'kava',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -2457,6 +2459,7 @@ export enum BaseUnit {
ISLM = 'aISLM',
RUNE = 'rune',
TAO = 'rao',
ICP = 'e8s',
}

export interface BaseCoinConstructorOptions {
Expand Down
32 changes: 32 additions & 0 deletions modules/statics/src/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
mohd-kashif marked this conversation as resolved.
Show resolved Hide resolved
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];
Expand Down Expand Up @@ -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',
Expand Down
13 changes: 13 additions & 0 deletions modules/statics/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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()),
Expand Down
2 changes: 2 additions & 0 deletions modules/statics/test/unit/fixtures/expectedColdFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const expectedColdFeatures = {
'coreum',
'dot',
'hash',
'icp',
'islm',
'injective',
'kava',
Expand All @@ -90,6 +91,7 @@ export const expectedColdFeatures = {
'thash',
'thorchain:rune',
'tia',
'ticp',
'tislm',
'tinjective',
'tkava',
Expand Down
Loading