Skip to content

Commit 99ca9c3

Browse files
feat: adding the statics for FLARE P CHAIN
Ticket: WIN-6328
1 parent 1a8b8b4 commit 99ca9c3

File tree

7 files changed

+189
-0
lines changed

7 files changed

+189
-0
lines changed

modules/bitgo/test/v2/unit/keychains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ describe('V2 Keychains', function () {
9292
n.asset !== UnderlyingAsset.SONIC &&
9393
n.asset !== UnderlyingAsset.SEIEVM &&
9494
n.asset !== UnderlyingAsset.KAIA &&
95+
n.asset !== UnderlyingAsset.FLRP &&
9596
coinFamilyValues.includes(n.name)
9697
);
9798

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ interface EnvironmentTemplate {
7171
xdcExplorerApiToken?: string;
7272
flrExplorerBaseUrl?: string;
7373
flrExplorerApiToken?: string;
74+
flrpExplorerBaseUrl?: string;
75+
// flrpExplorerApiToken?: string;
7476
sgbExplorerBaseUrl?: string;
7577
sgbExplorerApiToken?: string;
7678
icpNodeUrl: string;
@@ -232,6 +234,7 @@ const mainnetBase: EnvironmentTemplate = {
232234
monExplorerBaseUrl: 'https://mainnet-beta.monvision.io',
233235
stxNodeUrl: 'https://api.hiro.so',
234236
vetNodeUrl: 'https://rpc-mainnet.vechain.energy',
237+
flrpExplorerBaseUrl: 'https://coston2-rpc.flare.network',
235238
};
236239

237240
const testnetBase: EnvironmentTemplate = {
@@ -302,6 +305,7 @@ const testnetBase: EnvironmentTemplate = {
302305
worldExplorerBaseUrl: 'https://sepolia.worldscan.org/',
303306
somniaExplorerBaseUrl: 'https://shannon-explorer.somnia.network/',
304307
soneiumExplorerBaseUrl: 'https://soneium-minato.blockscout.com',
308+
flrpExplorerBaseUrl: 'https://coston2-explorer.flare.network', // To be checked again
305309
evm: {
306310
phrs: {
307311
baseUrl: 'https://testnet.dplabs-internal.com',

modules/statics/src/base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export enum CoinFamily {
5555
FETCHAI = 'fetchai',
5656
FIAT = 'fiat',
5757
FLR = 'flr',
58+
FLRP = 'flrp', // Flare P Chain
5859
HASH = 'hash', // Provenance
5960
HBAR = 'hbar',
6061
ICP = 'icp',
@@ -468,6 +469,7 @@ export enum UnderlyingAsset {
468469
EURR = 'eurr',
469470
FETCHAI = 'fetchai',
470471
FLR = 'flr',
472+
FLRP = 'flrp', // Flare P Chain
471473
GTC = 'gtc',
472474
HASH = 'hash', // Provenance
473475
HBAR = 'hbar', // Hedera main coin

modules/statics/src/coins.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
import { ofcToken } from './ofc';
5454
import { ada } from './ada';
5555
import { avaxp } from './avaxp';
56+
import { flrp } from './flrp';
5657
import { BaseCoin, BaseUnit, CoinFeature, KeyCurve, UnderlyingAsset } from './base';
5758
import { AmsTokenConfig, TrimmedAmsTokenConfig } from './tokenConfig';
5859
import { erc20Coins } from './coins/erc20Coins';
@@ -153,6 +154,14 @@ export const coins = CoinMap.fromCoins([
153154
Networks.test.avalancheP,
154155
UnderlyingAsset.AVAXP
155156
),
157+
flrp('f90c4f28-447d-4b34-a75a-a94bbce97c14', 'flrp', 'Flare P Chain', Networks.main.flrp, UnderlyingAsset.FLRP),
158+
flrp(
159+
'f90c4f28-447d-4b34-a75a-a94bbce97c14',
160+
'tflrp',
161+
'Flare P Chain Testnet',
162+
Networks.test.flrp,
163+
UnderlyingAsset.FLRP
164+
),
156165
ada(
157166
'fd4d125e-f14f-414b-bd17-6cb1393265f0',
158167
'ada',

modules/statics/src/flrp.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import { BaseCoin, BaseUnit, CoinFeature, CoinKind, KeyCurve, UnderlyingAsset } from './base';
2+
import { AvalancheNetwork } from './networks';
3+
4+
export interface FLRPConstructorOptions {
5+
id: string;
6+
fullName: string;
7+
name: string;
8+
network: AvalancheNetwork; // To be checked again
9+
features: CoinFeature[];
10+
asset: UnderlyingAsset;
11+
prefix?: string;
12+
suffix?: string;
13+
primaryKeyCurve: KeyCurve;
14+
}
15+
16+
export class FLRPCoin extends BaseCoin {
17+
public static readonly DEFAULT_FEATURES = [
18+
CoinFeature.UNSPENT_MODEL,
19+
CoinFeature.CUSTODY_BITGO_TRUST,
20+
CoinFeature.CUSTODY_BITGO_MENA_FZE,
21+
CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE,
22+
CoinFeature.CUSTODY_BITGO_GERMANY,
23+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
24+
CoinFeature.MULTISIG_COLD,
25+
CoinFeature.MULTISIG,
26+
];
27+
28+
/**
29+
* Additional fields for utxo coins
30+
*/
31+
public readonly network: AvalancheNetwork;
32+
33+
constructor(options: FLRPConstructorOptions) {
34+
super({
35+
...options,
36+
kind: CoinKind.CRYPTO,
37+
isToken: false,
38+
decimalPlaces: 9,
39+
baseUnit: BaseUnit.ETH,
40+
});
41+
42+
this.network = options.network;
43+
}
44+
45+
protected disallowedFeatures(): Set<CoinFeature> {
46+
return new Set([CoinFeature.ACCOUNT_MODEL]);
47+
}
48+
49+
protected requiredFeatures(): Set<CoinFeature> {
50+
return new Set([CoinFeature.UNSPENT_MODEL]);
51+
}
52+
}
53+
54+
/**
55+
* Factory function for utxo coin instances.
56+
*
57+
* @param id uuid v4
58+
* @param name unique identifier of the coin
59+
* @param fullName Complete human-readable name of the coin
60+
* @param network Network object for this coin
61+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
62+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `UtxoCoin`
63+
* @param prefix? Optional coin prefix. Defaults to empty string
64+
* @param suffix? Optional coin suffix. Defaults to coin name.
65+
* @param primaryKeyCurve The elliptic curve for this chain/token
66+
*/
67+
export function flrp(
68+
id: string,
69+
name: string,
70+
fullName: string,
71+
network: AvalancheNetwork, //To be checked again
72+
asset: UnderlyingAsset,
73+
features: CoinFeature[] = FLRPCoin.DEFAULT_FEATURES,
74+
prefix = '',
75+
suffix: string = name.toUpperCase(),
76+
/** All UTXOs BitGo supports are SECP256K1 **/
77+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
78+
) {
79+
return Object.freeze(
80+
new FLRPCoin({
81+
id,
82+
name,
83+
fullName,
84+
network,
85+
prefix,
86+
suffix,
87+
features,
88+
asset,
89+
primaryKeyCurve,
90+
})
91+
);
92+
}

modules/statics/src/networks.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,61 @@ class AvalanchePTestnet extends Testnet implements AvalancheNetwork {
311311
minDelegationFee = '2';
312312
}
313313

314+
//TO BE CHECKED AGAIN
315+
class FlrP extends Mainnet implements AvalancheNetwork {
316+
name = 'FlareP';
317+
family = CoinFamily.FLRP;
318+
explorerUrl = 'https://flare.space/dapp/p-chain-explorer';
319+
accountExplorerUrl = 'https://subnets.avax.network/p-chain/address/'; // To be checked again
320+
blockchainID = '11111111111111111111111111111111LpoYY'; // To be checked again
321+
cChainBlockchainID = '2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5'; // To be checked again
322+
avaxAssetID = 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z'; // To be checked again
323+
networkID = 1;
324+
hrp = 'flare';
325+
alias = 'P';
326+
vm = 'platformvm';
327+
txFee = '1000000';
328+
maxImportFee = '10000000';
329+
createSubnetTx = '1000000000';
330+
createChainTx = '1000000000';
331+
creationTxFee = '10000000';
332+
minConsumption = '0.1';
333+
maxConsumption = '0.12';
334+
maxSupply = '720000000000000000';
335+
minStake = '2000000000000';
336+
minStakeDuration = '1209600';
337+
maxStakeDuration = '31536000';
338+
minDelegationStake = '25000000000';
339+
minDelegationFee = '2';
340+
}
341+
342+
//TO BE CHECKED AGAIN
343+
class FlrPTestnet extends Testnet implements AvalancheNetwork {
344+
name = 'FlarePTestnet';
345+
family = CoinFamily.FLRP;
346+
explorerUrl = 'https://subnets-test.avax.network/p-chain/tx/';
347+
accountExplorerUrl = 'https://subnets-test.avax.network/p-chain/address/';
348+
blockchainID = '11111111111111111111111111111111LpoYY';
349+
cChainBlockchainID = 'yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp';
350+
avaxAssetID = 'U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK';
351+
networkID = 5;
352+
alias = 'P';
353+
hrp = 'flare';
354+
vm = 'platformvm';
355+
txFee = '1000000';
356+
maxImportFee = '10000000';
357+
createSubnetTx = '1000000000';
358+
createChainTx = '1000000000';
359+
creationTxFee = '10000000';
360+
minConsumption = '0.1';
361+
maxConsumption = '0.12';
362+
maxSupply = '720000000000000000';
363+
minStake = '1000000000';
364+
minStakeDuration = '86400';
365+
maxStakeDuration = '31536000';
366+
minDelegationStake = '1000000000';
367+
minDelegationFee = '2';
368+
}
314369
class BinanceSmartChain extends Mainnet implements EthereumNetwork {
315370
name = 'BinanceSmartChain';
316371
family = CoinFamily.BSC;
@@ -1686,6 +1741,7 @@ export const Networks = {
16861741
fiat: Object.freeze(new Fiat()),
16871742
fetchai: Object.freeze(new FetchAi()),
16881743
flr: Object.freeze(new Flare()),
1744+
flrp: Object.freeze(new FlrP()),
16891745
hash: Object.freeze(new Hash()),
16901746
hedera: Object.freeze(new Hedera()),
16911747
icp: Object.freeze(new Icp()),
@@ -1769,6 +1825,7 @@ export const Networks = {
17691825
fiat: Object.freeze(new FiatTestnet()),
17701826
fetchai: Object.freeze(new FetchAiTestnet()),
17711827
flr: Object.freeze(new FlareTestnet()),
1828+
flrp: Object.freeze(new FlrPTestnet()),
17721829
mon: Object.freeze(new MonadTestnet()),
17731830
pyrmont: Object.freeze(new Pyrmont()),
17741831
ethereumClassicTestnet: Object.freeze(new EthereumClassicTestnet()),

modules/statics/test/unit/coins.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ const custodyFeatures: Record<string, { features: CoinFeature[] }> = {
5959
avaxp: {
6060
features: [CoinFeature.CUSTODY_BITGO_GERMANY, CoinFeature.CUSTODY_BITGO_FRANKFURT],
6161
},
62+
flrp: {
63+
features: [
64+
CoinFeature.CUSTODY_BITGO_GERMANY,
65+
CoinFeature.CUSTODY_BITGO_NEW_YORK,
66+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
67+
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
68+
CoinFeature.CUSTODY_BITGO_SISTER_TRUST_ONE,
69+
CoinFeature.CUSTODY_BITGO_KOREA,
70+
CoinFeature.CUSTODY_BITGO_SINGAPORE,
71+
CoinFeature.CUSTODY_BITGO_SWITZERLAND,
72+
],
73+
},
6274
btc: {
6375
features: [
6476
CoinFeature.CUSTODY_BITGO_GERMANY,
@@ -432,6 +444,18 @@ const custodyFeatures: Record<string, { features: CoinFeature[] }> = {
432444
tavaxp: {
433445
features: [CoinFeature.CUSTODY_BITGO_GERMANY, CoinFeature.CUSTODY_BITGO_FRANKFURT],
434446
},
447+
tflr: {
448+
features: [
449+
CoinFeature.CUSTODY_BITGO_GERMANY,
450+
CoinFeature.CUSTODY_BITGO_NEW_YORK,
451+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
452+
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
453+
CoinFeature.CUSTODY_BITGO_SISTER_TRUST_ONE,
454+
CoinFeature.CUSTODY_BITGO_KOREA,
455+
CoinFeature.CUSTODY_BITGO_SINGAPORE,
456+
CoinFeature.CUSTODY_BITGO_SWITZERLAND,
457+
],
458+
},
435459
tbtc: {
436460
features: [
437461
CoinFeature.CUSTODY_BITGO_GERMANY,

0 commit comments

Comments
 (0)