Skip to content

Commit 7951015

Browse files
OttoAllmendingerllm-git
andcommitted
feat(wasm-utxo): export sighash and consensus branch getters
Export `get_sighash_fork_id` and `get_zec_consensus_branch_id` from the bitgo_psbt module for external use. Add `as_str` method to `ScriptType` enum for string representation. Co-authored-by: llm-git <llm-git@ttll.de>
1 parent beca735 commit 7951015

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

packages/wasm-utxo/src/fixed_script_wallet/bitgo_psbt/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ pub mod zcash_psbt;
1717
use crate::Network;
1818
pub use dash_psbt::DashBitGoPsbt;
1919
use miniscript::bitcoin::{psbt::Psbt, secp256k1, CompressedPublicKey, Txid};
20-
pub use propkv::{find_kv, BitGoKeyValue, ProprietaryKeySubtype, WasmUtxoVersionInfo, BITGO};
21-
pub use sighash::validate_sighash_type;
20+
pub use propkv::{
21+
find_kv, get_zec_consensus_branch_id, BitGoKeyValue, ProprietaryKeySubtype,
22+
WasmUtxoVersionInfo, BITGO,
23+
};
24+
pub use sighash::{get_sighash_fork_id, validate_sighash_type};
2225
pub use zcash_psbt::{
2326
decode_zcash_transaction_meta, ZcashBitGoPsbt, ZcashTransactionMeta,
2427
ZCASH_SAPLING_VERSION_GROUP_ID,

packages/wasm-utxo/src/fixed_script_wallet/bitgo_psbt/psbt_wallet_input.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,19 @@ impl InputScriptType {
803803
}
804804
}
805805
}
806+
807+
pub fn as_str(self) -> &'static str {
808+
match self {
809+
Self::P2shP2pk => "p2shP2pk",
810+
Self::P2sh => "p2sh",
811+
Self::P2shP2wsh => "p2shP2wsh",
812+
Self::P2wsh => "p2wsh",
813+
Self::P2trLegacy => "p2trLegacy",
814+
Self::P2trMusig2KeyPath => "p2trMusig2",
815+
Self::P2trMusig2ScriptPath => "p2trMusig2Script",
816+
Self::P2mr => "p2mr",
817+
}
818+
}
806819
}
807820

808821
/// Parsed input from a PSBT transaction

0 commit comments

Comments
 (0)