Skip to content
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
4 changes: 4 additions & 0 deletions packages/wasm-utxo/js/coinName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const coinNames = [
"tltc",
"zec",
"tzec",
"pearl",
"tpearl",
] as const;

export type CoinName = (typeof coinNames)[number];
Expand Down Expand Up @@ -50,6 +52,8 @@ export function getMainnet(name: CoinName): CoinName {
return "ltc";
case "tzec":
return "zec";
case "tpearl":
return "pearl";
default:
return name;
}
Expand Down
16 changes: 10 additions & 6 deletions packages/wasm-utxo/js/testutils/AcidTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ export class AcidTest {
// Filter inputs based on network support
const inputs: Input[] = inputScriptTypes
.filter((scriptType) => {
// p2shP2pk is always supported (single-sig replay protection)
if (scriptType === "p2shP2pk") return true;
// p2shP2pk requires legacy (P2SH) support
if (scriptType === "p2shP2pk") return supportsScriptType(coin, "p2sh");

// Map input script types to output script types for support check
if (scriptType === "p2trMusig2KeyPath" || scriptType === "p2trMusig2ScriptPath") {
Expand All @@ -206,11 +206,15 @@ export class AcidTest {
value: BigInt(900 + index * 100), // Deterministic amounts
}));

// Test other wallet output (with derivation info)
outputs.push({ scriptType: "p2sh", value: BigInt(800), walletKeys: otherWalletKeys });
// Test other wallet output (with derivation info) — only on legacy-supporting networks
if (supportsScriptType(coin, "p2sh")) {
outputs.push({ scriptType: "p2sh", value: BigInt(800), walletKeys: otherWalletKeys });
}

// Test non-wallet output (no derivation info)
outputs.push({ scriptType: "p2sh", value: BigInt(700), walletKeys: null });
// Test non-wallet output (no derivation info) — only on legacy-supporting networks
if (supportsScriptType(coin, "p2sh")) {
outputs.push({ scriptType: "p2sh", value: BigInt(700), walletKeys: null });
}

// Test OP_RETURN output
outputs.push({ opReturn: "setec astronomy", value: BigInt(0) });
Expand Down
12 changes: 12 additions & 0 deletions packages/wasm-utxo/src/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ pub const DASH_TEST: Base58CheckCodec = Base58CheckCodec::new(0x8c, 0x13);
pub const ZCASH: Base58CheckCodec = Base58CheckCodec::new(0x1cb8, 0x1cbd);
pub const ZCASH_TEST: Base58CheckCodec = Base58CheckCodec::new(0x1d25, 0x1cba);

// Pearl — Bech32m ONLY (no P2PKH/P2SH exist on this chain, Taproot-only)
// HRPs from: https://github.com/pearl-research-labs/pearl/blob/v1.1.6/node/chaincfg/params.go
// Verified on live regtest node (pearld 1.0.2, coins-sandbox PR #898).
// Bech32Codec handles v0 (bech32) and v1+ (bech32m / BIP-350) automatically.
pub const PEARL_BECH32: Bech32Codec = Bech32Codec::new("prl");
pub const PEARL_TEST_BECH32: Bech32Codec = Bech32Codec::new("tprl");
// Regtest HRP used only in test fixtures; not needed in production code.
#[cfg(test)]
pub const PEARL_REGTEST_BECH32: Bech32Codec = Bech32Codec::new("rprl");

/// Convert output script to address string (convenience wrapper)
pub fn from_output_script(script: &Script, codec: &dyn AddressCodec) -> Result<String> {
codec.encode(script)
Expand Down Expand Up @@ -487,6 +497,8 @@ mod tests {
"litecoinTest.json" => vec![&LITECOIN_TEST, &LITECOIN_TEST_BECH32],
"zcash.json" => vec![&ZCASH],
"zcashTest.json" => vec![&ZCASH_TEST],
// Pearl uses regtest HRP "rprl" in fixtures (captured from live regtest node)
"pearl.json" => vec![&PEARL_REGTEST_BECH32 as &dyn AddressCodec],
_ => panic!("Unknown fixture file: {}", filename),
}
}
Expand Down
Loading
Loading