Skip to content

Commit 8317443

Browse files
manojkumar138claude
andcommitted
feat(statics): add Pearl (PEARL) to statics and utxo-lib networks
Add Pearl mainnet/testnet coin definitions to @bitgo/statics and network params to @bitgo/utxo-lib. Pearl is a Taproot-only UTXO chain (btcd fork) using BIP-340 Schnorr signatures and BIP-341 script-path spending. Bump @bitgo/wasm-utxo to ^4.27.0, which adds pearl/tpearl coin support. TICKET: CECHO-1780 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 8b1ee36 commit 8317443

93 files changed

Lines changed: 2529 additions & 125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/abstract-utxo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@bitgo/utxo-descriptors": "^1.3.4",
6868
"@bitgo/utxo-lib": "^11.24.1",
6969
"@bitgo/utxo-ord": "^1.32.4",
70-
"@bitgo/wasm-utxo": "^4.21.1",
70+
"@bitgo/wasm-utxo": "^4.27.0",
7171
"@types/lodash": "^4.14.121",
7272
"@types/superagent": "4.1.15",
7373
"bignumber.js": "^9.0.2",

modules/abstract-utxo/test/unit/coins.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ describe('utxoCoins', function () {
7070
['ecashTest', 'tbcha'],
7171
['litecoin', 'ltc'],
7272
['litecoinTest', 'tltc'],
73+
// Pearl has no AbstractUtxoCoin implementation yet - added in a follow-up PR.
74+
['pearl', undefined],
75+
['tpearl', undefined],
7376
['zcash', 'zec'],
7477
['zcashTest', 'tzec'],
7578
]

modules/abstract-utxo/test/unit/transaction/fixedScript/parsePsbt.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { fixedScriptWallet } from '@bitgo/wasm-utxo';
88
import { parseTransaction } from '../../../../src/transaction/fixedScript/parseTransaction';
99
import { ParsedTransaction } from '../../../../src/transaction/types';
1010
import { UtxoWallet } from '../../../../src/wallet';
11-
import { getCoinNameForNetwork, getUtxoCoin } from '../../util';
11+
import { getCoinNameForNetwork, getUtxoCoin, hasUtxoCoinForNetwork } from '../../util';
1212
import { explainPsbtWasm } from '../../../../src/transaction/fixedScript';
1313
import type { TransactionExplanation } from '../../../../src/transaction/fixedScript/explainTransaction';
1414
import { TransactionPrebuild } from '../../../../src/abstractUtxoCoin';
@@ -205,6 +205,7 @@ function describeParseTransactionWith(
205205
function describeTransaction(filter: (test: utxolib.testutil.AcidTest) => boolean = () => true) {
206206
describe(`parseTransaction`, function () {
207207
utxolib.testutil.AcidTest.suite()
208+
.filter((test) => hasUtxoCoinForNetwork(test.network))
208209
.filter(filter)
209210
.forEach((test) => {
210211
// Default case: psbt format, infer recipients from explanation

modules/abstract-utxo/test/unit/util/utxoCoins.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ export function getNetworkForCoinName(coinName: string): utxolib.Network {
6565
return network;
6666
}
6767

68+
/**
69+
* @return true iff an AbstractUtxoCoin implementation exists for the network.
70+
*
71+
* Networks can be defined in utxo-lib before their coin class lands here (pearl is
72+
* added to utxo-lib first, its coin class follows in a later PR). Suites driven off
73+
* utxolib.getNetworkList()/AcidTest.suite() use this to skip those networks.
74+
*/
75+
export function hasUtxoCoinForNetwork(network: utxolib.Network): boolean {
76+
return Object.values(coinNameToNetwork).includes(network);
77+
}
78+
6879
/**
6980
* Get coin name for a utxolib Network. For test infrastructure only.
7081
*/

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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,20 @@ class ZCashTestnet extends Testnet implements UtxoNetwork {
14311431
explorerUrl = 'https://testnet.zcashexplorer.app/transactions/';
14321432
}
14331433

1434+
class Pearl extends Mainnet implements UtxoNetwork {
1435+
name = 'Pearl';
1436+
family = CoinFamily.PEARL;
1437+
utxolibName = 'pearl';
1438+
explorerUrl = undefined;
1439+
}
1440+
1441+
class PearlTestnet extends Testnet implements UtxoNetwork {
1442+
name = 'PearlTestnet';
1443+
family = CoinFamily.PEARL;
1444+
utxolibName = 'tpearl';
1445+
explorerUrl = undefined;
1446+
}
1447+
14341448
class Near extends Mainnet implements AccountNetwork {
14351449
name = 'Near';
14361450
family = CoinFamily.NEAR;
@@ -2953,6 +2967,7 @@ export const Networks = {
29532967
plume: Object.freeze(new Plume()),
29542968
polygon: Object.freeze(new Polygon()),
29552969
polyx: Object.freeze(new Polymesh()),
2970+
pearl: Object.freeze(new Pearl()),
29562971
phrs: Object.freeze(new Pharos()),
29572972
ctc: Object.freeze(new Creditcoin()),
29582973
hypeevm: Object.freeze(new HypeEVM()),
@@ -3087,6 +3102,7 @@ export const Networks = {
30873102
mantra: Object.freeze(new MantraTestnet()),
30883103
polygon: Object.freeze(new PolygonTestnet()),
30893104
polyx: Object.freeze(new PolymeshTestnet()),
3105+
pearl: Object.freeze(new PearlTestnet()),
30903106
phrs: Object.freeze(new PharosTestnet()),
30913107
ctc: Object.freeze(new CreditcoinTestnet()),
30923108
hypeevm: Object.freeze(new HypeEVMTestnet()),

modules/statics/src/utxo.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ 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 = [
147+
...UtxoCoin.DEFAULT_FEATURES,
148+
CoinFeature.MULTISIG,
149+
CoinFeature.BULK_TRANSACTION,
150+
CoinFeature.DISTRIBUTED_CUSTODY,
151+
];
146152
export const utxoCoins: Readonly<BaseCoin>[] = [
147153
utxo(
148154
'8d6e08d5-399f-414f-8430-6ceca1798cbf',
@@ -320,6 +326,28 @@ export const utxoCoins: Readonly<BaseCoin>[] = [
320326
BaseUnit.ZEC,
321327
ZEC_FEATURES
322328
),
329+
utxo(
330+
'4518a5b9-00d3-476e-bc40-d3f87eb82250',
331+
'pearl',
332+
'Pearl',
333+
Networks.main.pearl,
334+
UnderlyingAsset.PEARL,
335+
BaseUnit.BTC,
336+
PEARL_FEATURES,
337+
'',
338+
'PEARL'
339+
),
340+
utxo(
341+
'5d88723a-7e86-43c7-9fb1-f4cee7abc48f',
342+
'tpearl',
343+
'Testnet Pearl',
344+
Networks.test.pearl,
345+
UnderlyingAsset.PEARL,
346+
BaseUnit.BTC,
347+
PEARL_FEATURES,
348+
'',
349+
'TPEARL'
350+
),
323351
utxo(
324352
'c93a9160-458f-4a31-bea0-4a93ae8b1d2d',
325353
'doge',

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',

modules/utxo-bin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@bitgo/unspents": "^0.51.7",
3232
"@bitgo/utxo-core": "^1.39.4",
3333
"@bitgo/utxo-lib": "^11.24.1",
34-
"@bitgo/wasm-utxo": "^4.21.1",
34+
"@bitgo/wasm-utxo": "^4.27.0",
3535
"@noble/curves": "1.8.1",
3636
"archy": "^1.0.0",
3737
"bech32": "^2.0.0",

modules/utxo-bin/src/args/parseNetwork.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const networkOrder = [
3333
utxolib.networks.dogecoin,
3434
utxolib.networks.ecash,
3535
utxolib.networks.litecoin,
36+
utxolib.networks.pearl,
3637
utxolib.networks.zcash,
3738
];
3839

0 commit comments

Comments
 (0)