Skip to content

Commit b5dc194

Browse files
Merge pull request #9347 from BitGo/feat/prl/pr1-statics
feat(statics): add Pearl to statics
2 parents b646e8d + 22a12fc commit b5dc194

5 files changed

Lines changed: 58 additions & 0 deletions

File tree

modules/statics/src/base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export enum CoinFamily {
110110
OPETH = 'opeth',
111111
OSMO = 'osmo',
112112
PLUME = 'plume',
113+
PEARL = 'pearl',
113114
RBTC = 'rbtc',
114115
SCROLLETH = 'scrolleth', // Scroll L2
115116
SGB = 'sgb',
@@ -1684,6 +1685,7 @@ export enum UnderlyingAsset {
16841685
PRDX = 'prdx',
16851686
PRINTS = 'prints',
16861687
PRISM = 'prism',
1688+
PEARL = 'pearl',
16871689
PRO = 'pro',
16881690
PROM = 'prom',
16891691
PROS = 'pros',

modules/statics/src/networks.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,31 @@ class ZCashTestnet extends Testnet implements UtxoNetwork {
14311431
explorerUrl = 'https://testnet.zcashexplorer.app/transactions/';
14321432
}
14331433

1434+
/*
1435+
* Pearl is served through @bitgo/wasm-utxo and is deliberately NOT registered as a
1436+
* network in @bitgo/utxo-lib.
1437+
*
1438+
* `utxolibName` is required by UtxoNetwork, so it carries the wasm-utxo `CoinName`
1439+
* instead. It must not be resolved via `utxolib.networks[...]` - that yields
1440+
* undefined for Pearl and throws `TypeError: invalid network` downstream. Use the
1441+
* wasm-utxo coin name directly.
1442+
*/
1443+
class Pearl extends Mainnet implements UtxoNetwork {
1444+
name = 'Pearl';
1445+
family = CoinFamily.PEARL;
1446+
/** wasm-utxo CoinName, not a utxo-lib network - see note above */
1447+
utxolibName = 'pearl';
1448+
explorerUrl = undefined;
1449+
}
1450+
1451+
class PearlTestnet extends Testnet implements UtxoNetwork {
1452+
name = 'PearlTestnet';
1453+
family = CoinFamily.PEARL;
1454+
/** wasm-utxo CoinName, not a utxo-lib network - see note above */
1455+
utxolibName = 'tpearl';
1456+
explorerUrl = undefined;
1457+
}
1458+
14341459
class Near extends Mainnet implements AccountNetwork {
14351460
name = 'Near';
14361461
family = CoinFamily.NEAR;
@@ -2953,6 +2978,7 @@ export const Networks = {
29532978
plume: Object.freeze(new Plume()),
29542979
polygon: Object.freeze(new Polygon()),
29552980
polyx: Object.freeze(new Polymesh()),
2981+
pearl: Object.freeze(new Pearl()),
29562982
phrs: Object.freeze(new Pharos()),
29572983
ctc: Object.freeze(new Creditcoin()),
29582984
hypeevm: Object.freeze(new HypeEVM()),
@@ -3087,6 +3113,7 @@ export const Networks = {
30873113
mantra: Object.freeze(new MantraTestnet()),
30883114
polygon: Object.freeze(new PolygonTestnet()),
30893115
polyx: Object.freeze(new PolymeshTestnet()),
3116+
pearl: Object.freeze(new PearlTestnet()),
30903117
phrs: Object.freeze(new PharosTestnet()),
30913118
ctc: Object.freeze(new CreditcoinTestnet()),
30923119
hypeevm: Object.freeze(new HypeEVMTestnet()),

modules/statics/src/utxo.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ const DOGE_FEATURES = [
143143
const DASH_FEATURES = [...UtxoCoin.DEFAULT_FEATURES, CoinFeature.CUSTODY_BITGO_FRANKFURT, CoinFeature.BULK_TRANSACTION];
144144
const TDASH_FEATURES = [...UtxoCoin.DEFAULT_FEATURES, CoinFeature.BULK_TRANSACTION];
145145
const ZEC_FEATURES = [...UtxoCoin.DEFAULT_FEATURES, CoinFeature.BULK_TRANSACTION, CoinFeature.CUSTODY_BITGO_FRANKFURT];
146+
const PEARL_FEATURES = [...UtxoCoin.DEFAULT_FEATURES, CoinFeature.BULK_TRANSACTION, CoinFeature.DISTRIBUTED_CUSTODY];
146147
export const utxoCoins: Readonly<BaseCoin>[] = [
147148
utxo(
148149
'8d6e08d5-399f-414f-8430-6ceca1798cbf',
@@ -320,6 +321,24 @@ export const utxoCoins: Readonly<BaseCoin>[] = [
320321
BaseUnit.ZEC,
321322
ZEC_FEATURES
322323
),
324+
utxo(
325+
'4518a5b9-00d3-476e-bc40-d3f87eb82250',
326+
'pearl',
327+
'Pearl',
328+
Networks.main.pearl,
329+
UnderlyingAsset.PEARL,
330+
BaseUnit.BTC,
331+
PEARL_FEATURES
332+
),
333+
utxo(
334+
'5d88723a-7e86-43c7-9fb1-f4cee7abc48f',
335+
'tpearl',
336+
'Testnet Pearl',
337+
Networks.test.pearl,
338+
UnderlyingAsset.PEARL,
339+
BaseUnit.BTC,
340+
PEARL_FEATURES
341+
),
323342
utxo(
324343
'c93a9160-458f-4a31-bea0-4a93ae8b1d2d',
325344
'doge',

modules/statics/test/unit/coins.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,14 @@ describe('Distributed Custody Features', () => {
12181218
coin.features.includes(CoinFeature.DISTRIBUTED_CUSTODY).should.eql(true);
12191219
});
12201220
});
1221+
1222+
it('pearl and tpearl should have distributed custody feature', () => {
1223+
const targetCoins = ['pearl', 'tpearl'];
1224+
targetCoins.forEach((coinName) => {
1225+
const coin = coins.get(coinName);
1226+
coin.features.includes(CoinFeature.DISTRIBUTED_CUSTODY).should.eql(true);
1227+
});
1228+
});
12211229
});
12221230

12231231
describe('Bulk Transaction Features', () => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const expectedColdFeatures = {
3333
'etc',
3434
'hbar',
3535
'ltc',
36+
'pearl',
3637
'rbtc',
3738
'stx',
3839
'talgo',
@@ -53,6 +54,7 @@ export const expectedColdFeatures = {
5354
'tetc',
5455
'thbar',
5556
'tltc',
57+
'tpearl',
5658
'trbtc',
5759
'tstx',
5860
'txlm',

0 commit comments

Comments
 (0)