pub struct VhtlcScript { /* private fields */ }Expand description
VHTLC Script builder and manager
This struct creates and manages VHTLC scripts with six different spending paths:
- Claim: Receiver reveals preimage (collaborative with server)
- Refund: Collaborative refund (all three parties)
- Refund without Receiver: Sender refunds after locktime (with server)
- Unilateral Claim: Receiver claims after delay (no server needed)
- Unilateral Refund: Collaborative unilateral refund after delay
- Unilateral Refund without Receiver: Sender unilateral refund after both timeouts
Implementations§
Source§impl VhtlcScript
impl VhtlcScript
Sourcepub fn new(options: VhtlcOptions, network: Network) -> Result<Self, VhtlcError>
pub fn new(options: VhtlcOptions, network: Network) -> Result<Self, VhtlcError>
Creates a new VHTLC script with the given options
This will validate the options and build the complete taproot tree with all spending paths.
pub fn taproot_spend_info(&self) -> &TaprootSpendInfo
pub fn script_pubkey(&self) -> ScriptBuf
pub fn address(&self) -> ArkAddress
Sourcepub fn claim_script(&self) -> ScriptBuf
pub fn claim_script(&self) -> ScriptBuf
Creates the claim script where receiver reveals the preimage
Requires: preimage hash verification + receiver signature + server signature
Sourcepub fn refund_script(&self) -> ScriptBuf
pub fn refund_script(&self) -> ScriptBuf
Creates the collaborative refund script
Requires: sender + receiver + server signatures
Sourcepub fn refund_without_receiver_script(&self) -> ScriptBuf
pub fn refund_without_receiver_script(&self) -> ScriptBuf
Creates the refund script when receiver is unavailable
Requires: CLTV timeout + sender + server signatures
Sourcepub fn unilateral_claim_script(&self) -> ScriptBuf
pub fn unilateral_claim_script(&self) -> ScriptBuf
Creates the unilateral claim script (no server cooperation needed)
Requires: preimage hash verification + CSV delay + receiver signature
Sourcepub fn unilateral_refund_script(&self) -> ScriptBuf
pub fn unilateral_refund_script(&self) -> ScriptBuf
Creates the unilateral refund script
Requires: CSV delay + sender + receiver signatures
Sourcepub fn unilateral_refund_without_receiver_script(&self) -> ScriptBuf
pub fn unilateral_refund_without_receiver_script(&self) -> ScriptBuf
Creates the unilateral refund script when receiver is unavailable
Requires: CSV delay + sender signature