Skip to content

Commit 2156579

Browse files
Merge pull request #8029 from BitGo/feat/WIN-8547-chiliz-chain-onboarding
feat(statics): onboard Chiliz Chain (CHZ) L1 EVM
2 parents 82e8bf9 + d99cdc4 commit 2156579

File tree

10 files changed

+197
-12
lines changed

10 files changed

+197
-12
lines changed

modules/key-card/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@bitgo/sdk-api": "^1.73.4",
3737
"@bitgo/sdk-core": "^36.30.0",
3838
"@bitgo/statics": "^58.24.0",
39-
"jspdf": "^4.0.0",
39+
"jspdf": "^4.1.0",
4040
"qrcode": "^1.5.1"
4141
},
4242
"devDependencies": {

modules/sdk-core/src/bitgo/environments.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ const mainnetBase: EnvironmentTemplate = {
218218
apechain: {
219219
baseUrl: 'https://api.etherscan.io/v2',
220220
},
221+
chiliz: {
222+
baseUrl: 'https://api.chiliscan.com',
223+
},
221224
phrs: {
222225
baseUrl: 'https://testnet.dplabs-internal.com', // TODO: WIN-5787 add mainnet url when its available
223226
},
@@ -403,6 +406,9 @@ const testnetBase: EnvironmentTemplate = {
403406
apechain: {
404407
baseUrl: 'https://api.etherscan.io/v2',
405408
},
409+
chiliz: {
410+
baseUrl: 'https://api.testnet.chiliscan.com',
411+
},
406412
phrs: {
407413
baseUrl: 'https://testnet.dplabs-internal.com', // Wrong value, Not available yet
408414
},

modules/statics/src/account.ts

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,16 @@ export class CoredaoERC20Token extends ContractAddressDefinedToken {
517517
}
518518
}
519519

520+
/**
521+
* The Chiliz Chain network supports tokens
522+
* Chiliz Chain Tokens are ERC20 tokens
523+
*/
524+
export class ChilizERC20Token extends ContractAddressDefinedToken {
525+
constructor(options: Erc20ConstructorOptions) {
526+
super(options);
527+
}
528+
}
529+
520530
/**
521531
* The World Chain network supports tokens
522532
* World Chain Tokens are ERC20 tokens
@@ -2720,6 +2730,96 @@ export function tcoredaoErc20(
27202730
);
27212731
}
27222732

2733+
/**
2734+
* Factory function for ChilizErc20 token instances.
2735+
*
2736+
* @param id uuid v4
2737+
* @param name unique identifier of the token
2738+
* @param fullName Complete human-readable name of the token
2739+
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
2740+
* @param contractAddress Contract address of this token
2741+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2742+
* @param prefix? Optional token prefix. Defaults to empty string
2743+
* @param suffix? Optional token suffix. Defaults to token name.
2744+
* @param network? Optional token network. Defaults to Chiliz Chain mainnet network.
2745+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
2746+
* @param primaryKeyCurve The elliptic curve for this chain/token
2747+
*/
2748+
export function chilizErc20(
2749+
id: string,
2750+
name: string,
2751+
fullName: string,
2752+
decimalPlaces: number,
2753+
contractAddress: string,
2754+
asset: UnderlyingAsset,
2755+
features: CoinFeature[] = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.EIP1559],
2756+
prefix = '',
2757+
suffix: string = name.toUpperCase(),
2758+
network: AccountNetwork = Networks.main.chiliz,
2759+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
2760+
) {
2761+
return Object.freeze(
2762+
new ChilizERC20Token({
2763+
id,
2764+
name,
2765+
fullName,
2766+
network,
2767+
contractAddress,
2768+
prefix,
2769+
suffix,
2770+
features,
2771+
decimalPlaces,
2772+
asset,
2773+
isToken: true,
2774+
primaryKeyCurve,
2775+
baseUnit: BaseUnit.ETH,
2776+
})
2777+
);
2778+
}
2779+
2780+
/**
2781+
* Factory function for Chiliz testnet ChilizErc20 token instances.
2782+
*
2783+
* @param id uuid v4
2784+
* @param name unique identifier of the token
2785+
* @param fullName Complete human-readable name of the token
2786+
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
2787+
* @param contractAddress Contract address of this token
2788+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2789+
* @param prefix? Optional token prefix. Defaults to empty string
2790+
* @param suffix? Optional token suffix. Defaults to token name.
2791+
* @param network? Optional token network. Defaults to the Chiliz Chain test network.
2792+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
2793+
* @param primaryKeyCurve The elliptic curve for this chain/token
2794+
*/
2795+
export function tchilizErc20(
2796+
id: string,
2797+
name: string,
2798+
fullName: string,
2799+
decimalPlaces: number,
2800+
contractAddress: string,
2801+
asset: UnderlyingAsset,
2802+
features: CoinFeature[] = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.EIP1559],
2803+
prefix = '',
2804+
suffix: string = name.toUpperCase(),
2805+
network: AccountNetwork = Networks.test.chiliz,
2806+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
2807+
) {
2808+
return chilizErc20(
2809+
id,
2810+
name,
2811+
fullName,
2812+
decimalPlaces,
2813+
contractAddress,
2814+
asset,
2815+
features,
2816+
prefix,
2817+
suffix,
2818+
network,
2819+
primaryKeyCurve
2820+
);
2821+
}
2822+
27232823
/**
27242824
* Factory function for WorldErc20 token instances.
27252825
*

modules/statics/src/allCoinsAndTokens.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
arbethErc20,
88
beraErc20,
99
celoToken,
10+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
11+
chilizErc20,
1012
coredaoErc20,
1113
eosToken,
1214
erc1155,
@@ -32,6 +34,8 @@ import {
3234
tarbethErc20,
3335
tberaErc20,
3436
tceloToken,
37+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
38+
tchilizErc20,
3539
tcoredaoErc20,
3640
teosToken,
3741
terc1155,
@@ -2828,6 +2832,46 @@ export const allCoinsAndTokens = [
28282832
BaseUnit.ETH,
28292833
CELO_FEATURES
28302834
),
2835+
account(
2836+
'c7e1dc7f-add5-4eed-9931-2c201801e3a2',
2837+
'chiliz',
2838+
'Chiliz',
2839+
Networks.main.chiliz,
2840+
18,
2841+
UnderlyingAsset.CHILIZ,
2842+
BaseUnit.ETH,
2843+
[
2844+
...EVM_FEATURES,
2845+
CoinFeature.SHARED_EVM_SIGNING,
2846+
CoinFeature.SHARED_EVM_SDK,
2847+
CoinFeature.EVM_COMPATIBLE_IMS,
2848+
CoinFeature.EVM_COMPATIBLE_UI,
2849+
CoinFeature.EVM_COMPATIBLE_WP,
2850+
CoinFeature.EVM_NON_BITGO_RECOVERY,
2851+
CoinFeature.EVM_UNSIGNED_SWEEP_RECOVERY,
2852+
CoinFeature.SUPPORTS_ERC20,
2853+
]
2854+
),
2855+
account(
2856+
'c014b2ec-02ea-468f-b73f-24442146208e',
2857+
'tchiliz',
2858+
'Testnet Chiliz',
2859+
Networks.test.chiliz,
2860+
18,
2861+
UnderlyingAsset.CHILIZ,
2862+
BaseUnit.ETH,
2863+
[
2864+
...EVM_FEATURES,
2865+
CoinFeature.SHARED_EVM_SIGNING,
2866+
CoinFeature.SHARED_EVM_SDK,
2867+
CoinFeature.EVM_COMPATIBLE_IMS,
2868+
CoinFeature.EVM_COMPATIBLE_UI,
2869+
CoinFeature.EVM_COMPATIBLE_WP,
2870+
CoinFeature.EVM_NON_BITGO_RECOVERY,
2871+
CoinFeature.EVM_UNSIGNED_SWEEP_RECOVERY,
2872+
CoinFeature.SUPPORTS_ERC20,
2873+
]
2874+
),
28312875
erc20Token(
28322876
'16c438c1-714a-4ad7-bdb1-fb8d2575c466',
28332877
'tbaseeth:usdc',

modules/statics/src/base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export enum CoinFamily {
4141
BTG = 'btg',
4242
CANTON = 'canton',
4343
CELO = 'celo',
44+
CHILIZ = 'chiliz', // Chiliz Chain
4445
COREDAO = 'coredao',
4546
COREUM = 'coreum',
4647
CRONOS = 'cronos',
@@ -568,6 +569,7 @@ export enum UnderlyingAsset {
568569
DASH = 'dash',
569570
DOT = 'dot',
570571
CELO = 'celo', // Celo main coin
572+
CHILIZ = 'chiliz', // Chiliz Chain native coin
571573
COREDAO = 'coredao',
572574
COREUM = 'coreum',
573575
CRONOS = 'cronos',

modules/statics/src/coins/ofcCoins.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ export const ofcCoins = [
134134
),
135135
ofc('8b93e788-52fa-4fd6-b499-40f13fe194fc', 'ofccoreum', 'Coreum', 6, UnderlyingAsset.COREUM, CoinKind.CRYPTO),
136136
ofc('a88adc55-c1c8-4a4e-8436-df3868a50daa', 'ofccelo', 'Celo Gold', 18, UnderlyingAsset.CELO, CoinKind.CRYPTO),
137+
ofc('17cf28b5-f958-46c3-be88-53cc42bf0c76', 'ofcchiliz', 'Chiliz', 18, UnderlyingAsset.CHILIZ, CoinKind.CRYPTO),
138+
tofc(
139+
'365ea5b1-71a8-4c57-82ba-a0effb9aae47',
140+
'ofctchiliz',
141+
'Testnet Chiliz',
142+
18,
143+
UnderlyingAsset.CHILIZ,
144+
CoinKind.CRYPTO
145+
),
137146
ofc('9e2da785-8349-4153-8276-941319575833', 'ofcxtz', 'Tezos', 6, UnderlyingAsset.XTZ, CoinKind.CRYPTO),
138147
ofc(
139148
'283b93b5-741b-4c85-a201-097267d65097',

modules/statics/src/networks.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,26 @@ class CeloTestnet extends Testnet implements EthereumNetwork {
613613
tokenOperationHashPrefix = 'CELO-ERC20';
614614
}
615615

616+
class Chiliz extends Mainnet implements EthereumNetwork {
617+
name = 'Chiliz';
618+
family = CoinFamily.CHILIZ;
619+
explorerUrl = 'https://chiliscan.com/tx/';
620+
accountExplorerUrl = 'https://chiliscan.com/address/';
621+
chainId = 88888;
622+
nativeCoinOperationHashPrefix = '88888';
623+
tokenOperationHashPrefix = '88888-ERC20';
624+
}
625+
626+
class ChilizTestnet extends Testnet implements EthereumNetwork {
627+
name = 'ChilizTestnet';
628+
family = CoinFamily.CHILIZ;
629+
explorerUrl = 'https://testnet.chiliscan.com/tx/';
630+
accountExplorerUrl = 'https://testnet.chiliscan.com/address/';
631+
chainId = 88882;
632+
nativeCoinOperationHashPrefix = '88882';
633+
tokenOperationHashPrefix = '88882-ERC20';
634+
}
635+
616636
// TODO update explorerUrl STLX-1657
617637
class Casper extends Mainnet implements AccountNetwork {
618638
name = 'Casper';
@@ -2393,6 +2413,7 @@ export const Networks = {
23932413
canton: Object.freeze(new Canton()),
23942414
casper: Object.freeze(new Casper()),
23952415
celo: Object.freeze(new Celo()),
2416+
chiliz: Object.freeze(new Chiliz()),
23962417
coredao: Object.freeze(new Coredao()),
23972418
coreum: Object.freeze(new Coreum()),
23982419
cronos: Object.freeze(new Cronos()),
@@ -2506,8 +2527,9 @@ export const Networks = {
25062527
bsc: Object.freeze(new BinanceSmartChainTestnet()),
25072528
canton: Object.freeze(new CantonTestnet()),
25082529
casper: Object.freeze(new CasperTestnet()),
2509-
coredao: Object.freeze(new CoredaoTestnet()),
25102530
celo: Object.freeze(new CeloTestnet()),
2531+
chiliz: Object.freeze(new ChilizTestnet()),
2532+
coredao: Object.freeze(new CoredaoTestnet()),
25112533
cronos: Object.freeze(new CronosTestnet()),
25122534
dash: Object.freeze(new DashTestnet()),
25132535
dogecoin: Object.freeze(new DogecoinTestnet()),

modules/statics/test/unit/fixtures/expectedColdFeatures.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const expectedColdFeatures = {
8383
'bld',
8484
'bsc',
8585
'canton',
86+
'chiliz',
8687
'coredao',
8788
'coreum',
8889
'cronos',
@@ -149,6 +150,7 @@ export const expectedColdFeatures = {
149150
'tbld',
150151
'tbsc',
151152
'tcanton',
153+
'tchiliz',
152154
'tcoredao',
153155
'tcoreum',
154156
'tcronos',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"**/cacache/glob": "11.1.0",
6868
"**/pacote/glob": "11.1.0",
6969
"**/sha.js": ">=2.4.12",
70-
"jspdf": ">=4.0.0",
70+
"jspdf": ">=4.1.0",
7171
"@ethereumjs/util": "8.0.3",
7272
"@types/keyv": "3.1.4",
7373
"@types/react": "17.0.24",

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10369,10 +10369,10 @@ domhandler@^5.0.2, domhandler@^5.0.3:
1036910369
dependencies:
1037010370
domelementtype "^2.3.0"
1037110371

10372-
dompurify@^3.2.4:
10373-
version "3.2.6"
10374-
resolved "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz"
10375-
integrity sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==
10372+
dompurify@^3.3.1:
10373+
version "3.3.1"
10374+
resolved "https://registry.npmjs.org/dompurify/-/dompurify-3.3.1.tgz#c7e1ddebfe3301eacd6c0c12a4af284936dbbb86"
10375+
integrity sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==
1037610376
optionalDependencies:
1037710377
"@types/trusted-types" "^2.0.7"
1037810378

@@ -14180,18 +14180,18 @@ jsonpointer@^5.0.0:
1418014180
resolved "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz"
1418114181
integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==
1418214182

14183-
jspdf@>=4.0.0, jspdf@^4.0.0:
14184-
version "4.0.0"
14185-
resolved "https://registry.npmjs.org/jspdf/-/jspdf-4.0.0.tgz#3731c0a1a7d8afe28c681891236f8ad4a662d893"
14186-
integrity sha512-w12U97Z6edKd2tXDn3LzTLg7C7QLJlx0BPfM3ecjK2BckUl9/81vZ+r5gK4/3KQdhAcEZhENUxRhtgYBj75MqQ==
14183+
jspdf@>=4.1.0, jspdf@^4.1.0:
14184+
version "4.1.0"
14185+
resolved "https://registry.npmjs.org/jspdf/-/jspdf-4.1.0.tgz#4fb476251c8751c996175cfaac02d30fdf8c7b7a"
14186+
integrity sha512-xd1d/XRkwqnsq6FP3zH1Q+Ejqn2ULIJeDZ+FTKpaabVpZREjsJKRJwuokTNgdqOU+fl55KgbvgZ1pRTSWCP2kQ==
1418714187
dependencies:
1418814188
"@babel/runtime" "^7.28.4"
1418914189
fast-png "^6.2.0"
1419014190
fflate "^0.8.1"
1419114191
optionalDependencies:
1419214192
canvg "^3.0.11"
1419314193
core-js "^3.6.0"
14194-
dompurify "^3.2.4"
14194+
dompurify "^3.3.1"
1419514195
html2canvas "^1.0.0-rc.5"
1419614196

1419714197
jsprim@^2.0.2:

0 commit comments

Comments
 (0)