pub enum VtxoPolicy {
Pubkey(PubkeyVtxoPolicy),
ServerHtlcSend(ServerHtlcSendVtxoPolicy),
ServerHtlcRecv(ServerHtlcRecvVtxoPolicy),
}Expand description
The output policy of the VTXO.
Variants§
Pubkey(PubkeyVtxoPolicy)
Standard VTXO output protected with a public key.
This can be the result of either:
- a board
- a round
- an arkoor tx
- change from a LN payment
ServerHtlcSend(ServerHtlcSendVtxoPolicy)
A VTXO that represents an HTLC with the Ark server to send money.
ServerHtlcRecv(ServerHtlcRecvVtxoPolicy)
A VTXO that represents an HTLC with the Ark server to receive money.
Implementations§
Source§impl VtxoPolicy
impl VtxoPolicy
pub fn new_pubkey(user_pubkey: PublicKey) -> Self
pub fn new_server_htlc_send( user_pubkey: PublicKey, payment_hash: PaymentHash, htlc_expiry: BlockHeight, ) -> Self
Sourcepub fn new_server_htlc_recv(
user_pubkey: PublicKey,
payment_hash: PaymentHash,
htlc_expiry: BlockHeight,
htlc_expiry_delta: BlockDelta,
) -> Self
pub fn new_server_htlc_recv( user_pubkey: PublicKey, payment_hash: PaymentHash, htlc_expiry: BlockHeight, htlc_expiry_delta: BlockDelta, ) -> Self
Creates a new htlc from server to client
- user_pubkey: A public key owned by the client
- payment_hash: The payment hash, the client can claim the HTLC by revealing the corresponding pre-image
- htlc_expiry: An absolute blockheight at which the HTLC expires
- htlc_expiry_delta: A safety margin for the server. If the user
tries to exit after time-out the server will have at-least
htlc_expiry_deltablocks to claim the payment
pub fn as_pubkey(&self) -> Option<&PubkeyVtxoPolicy>
pub fn as_server_htlc_send(&self) -> Option<&ServerHtlcSendVtxoPolicy>
pub fn as_server_htlc_recv(&self) -> Option<&ServerHtlcRecvVtxoPolicy>
Sourcepub fn policy_type(&self) -> VtxoPolicyKind
pub fn policy_type(&self) -> VtxoPolicyKind
The policy type id.
Sourcepub fn is_arkoor_compatible(&self) -> bool
pub fn is_arkoor_compatible(&self) -> bool
Whether a Vtxo with this output can be spend in an arkoor tx.
Sourcepub fn arkoor_pubkey(&self) -> Option<PublicKey>
pub fn arkoor_pubkey(&self) -> Option<PublicKey>
The public key used to cosign arkoor txs spending a Vtxo with this output. This will return None if VtxoPolicy::is_arkoor_compatible returns false.
Sourcepub fn user_pubkey(&self) -> PublicKey
pub fn user_pubkey(&self) -> PublicKey
Returns the user pubkey associated with a Vtxo with this output.
Sourcepub fn user_exit_clause(&self, exit_delta: BlockDelta) -> ScriptBuf
pub fn user_exit_clause(&self, exit_delta: BlockDelta) -> ScriptBuf
Generates a script based on the exit conditions for a given policy type.
Depending on the specific policy variant, this function produces an appropriate script
that implements the user exit clause. The exit clause enforces specific rules for exiting
the contract or completing a transaction based on the provided exit_delta parameter.
Trait Implementations§
Source§impl Clone for VtxoPolicy
impl Clone for VtxoPolicy
Source§fn clone(&self) -> VtxoPolicy
fn clone(&self) -> VtxoPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more