pub struct BtcSwapScript {
pub swap_type: SwapType,
pub side: Option<Side>,
pub funding_addrs: Option<Address>,
pub hashlock: Hash,
pub receiver_pubkey: PublicKey,
pub locktime: LockTime,
pub sender_pubkey: PublicKey,
}Expand description
Bitcoin v2 swap script helper.
Fields§
§swap_type: SwapType§side: Option<Side>§funding_addrs: Option<Address>§hashlock: Hash§receiver_pubkey: PublicKey§locktime: LockTime§sender_pubkey: PublicKeyImplementations§
Source§impl BtcSwapScript
impl BtcSwapScript
Sourcepub fn submarine_from_swap_resp(
create_swap_response: &CreateSubmarineResponse,
our_pubkey: PublicKey,
) -> Result<Self, Error>
pub fn submarine_from_swap_resp( create_swap_response: &CreateSubmarineResponse, our_pubkey: PublicKey, ) -> Result<Self, Error>
Create the struct for a submarine swap from boltz create swap response.
pub fn musig_keyagg_cache(&self) -> KeyAggCache
Sourcepub fn reverse_from_swap_resp(
reverse_response: &CreateReverseResponse,
our_pubkey: PublicKey,
) -> Result<Self, Error>
pub fn reverse_from_swap_resp( reverse_response: &CreateReverseResponse, our_pubkey: PublicKey, ) -> Result<Self, Error>
Create the struct for a reverse swap from a boltz create response.
Sourcepub fn chain_from_swap_resp(
side: Side,
chain_swap_details: ChainSwapDetails,
our_pubkey: PublicKey,
) -> Result<Self, Error>
pub fn chain_from_swap_resp( side: Side, chain_swap_details: ChainSwapDetails, our_pubkey: PublicKey, ) -> Result<Self, Error>
Create the struct for a chain swap from a boltz create response.
Sourcepub fn to_address(&self, network: BitcoinChain) -> Result<Address, Error>
pub fn to_address(&self, network: BitcoinChain) -> Result<Address, Error>
Get taproot address for the swap script.
pub fn validate_address( &self, chain: BitcoinChain, address: String, ) -> Result<(), Error>
Sourcepub async fn get_balance<BC: BitcoinClient + ?Sized>(
&self,
bitcoin_client: &BC,
) -> Result<(u64, i64), Error>
pub async fn get_balance<BC: BitcoinClient + ?Sized>( &self, bitcoin_client: &BC, ) -> Result<(u64, i64), Error>
Get the balance of the script
Sourcepub async fn fetch_utxos<BC: BitcoinClient + ?Sized>(
&self,
bitcoin_client: &BC,
) -> Result<Vec<(OutPoint, TxOut)>, Error>
pub async fn fetch_utxos<BC: BitcoinClient + ?Sized>( &self, bitcoin_client: &BC, ) -> Result<Vec<(OutPoint, TxOut)>, Error>
Fetch (utxo,amount) pairs for all utxos of the script_pubkey of this swap.
Sourcepub async fn fetch_lockup_utxo_boltz(
&self,
network: BitcoinChain,
boltz_client: &BoltzApiClientV2,
swap_id: &str,
tx_kind: SwapTxKind,
) -> Result<Option<(OutPoint, TxOut)>, Error>
pub async fn fetch_lockup_utxo_boltz( &self, network: BitcoinChain, boltz_client: &BoltzApiClientV2, swap_id: &str, tx_kind: SwapTxKind, ) -> Result<Option<(OutPoint, TxOut)>, Error>
Fetch utxo for script from BoltzApi
Trait Implementations§
Source§impl Clone for BtcSwapScript
impl Clone for BtcSwapScript
Source§fn clone(&self) -> BtcSwapScript
fn clone(&self) -> BtcSwapScript
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BtcSwapScript
impl Debug for BtcSwapScript
Source§impl PartialEq for BtcSwapScript
impl PartialEq for BtcSwapScript
Source§impl SwapScriptCommon for BtcSwapScript
impl SwapScriptCommon for BtcSwapScript
Source§fn partial_sign(
&self,
keys: &Keypair,
pub_nonce: &str,
transaction_hash: &str,
) -> Result<(PartialSignature, PublicNonce), Error>
fn partial_sign( &self, keys: &Keypair, pub_nonce: &str, transaction_hash: &str, ) -> Result<(PartialSignature, PublicNonce), Error>
Compute the Musig partial signature. This is used to cooperatively settle a Submarine or Chain Swap.
fn swap_type(&self) -> SwapType
impl StructuralPartialEq for BtcSwapScript
Auto Trait Implementations§
impl Freeze for BtcSwapScript
impl RefUnwindSafe for BtcSwapScript
impl Send for BtcSwapScript
impl Sync for BtcSwapScript
impl Unpin for BtcSwapScript
impl UnwindSafe for BtcSwapScript
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)