pub struct Vtxo { /* private fields */ }Expand description
Represents a VTXO in the Ark.
The correctness of the return values of methods on this type is conditional on the VTXO being valid. For invalid VTXOs, the methods should never panic, but can return incorrect values. It is advised to always validate a VTXO upon receipt using Vtxo::validate.
Be mindful of calling Clone on a Vtxo, as they can be of non-negligible size. It is advised to use references where possible or use an std::rc::Rc or std::sync::Arc if needed.
Implementations of PartialEq, Eq, PartialOrd, Ord and Hash are proxied to the implementation on Vtxo::id.
Implementations§
Source§impl Vtxo
impl Vtxo
Sourcepub fn id(&self) -> VtxoId
pub fn id(&self) -> VtxoId
Get the identifier for this Vtxo.
This is the same as Vtxo::point but encoded as a byte array.
Sourcepub fn point(&self) -> OutPoint
pub fn point(&self) -> OutPoint
The outpoint from which to build forfeit or arkoor txs.
This can be an on-chain utxo or an off-chain vtxo.
Sourcepub fn chain_anchor(&self) -> OutPoint
pub fn chain_anchor(&self) -> OutPoint
The UTXO that should be confirmed for this Vtxo to be valid.
It is the very root of the VTXO.
Sourcepub fn policy(&self) -> &VtxoPolicy
pub fn policy(&self) -> &VtxoPolicy
The output policy of this VTXO.
Sourcepub fn policy_type(&self) -> VtxoPolicyKind
pub fn policy_type(&self) -> VtxoPolicyKind
The output policy type of this VTXO.
Sourcepub fn expiry_height(&self) -> BlockHeight
pub fn expiry_height(&self) -> BlockHeight
The expiry height of the Vtxo.
Sourcepub fn server_pubkey(&self) -> PublicKey
pub fn server_pubkey(&self) -> PublicKey
The server pubkey used in arkoor transitions.
Sourcepub fn exit_delta(&self) -> BlockDelta
pub fn exit_delta(&self) -> BlockDelta
The relative timelock block delta used for exits.
Sourcepub fn exit_depth(&self) -> u16
pub fn exit_depth(&self) -> u16
Returns the total exit depth (including OOR depth) of the vtxo.
Sourcepub fn server_htlc_out_payment_hash(&self) -> Option<PaymentHash>
pub fn server_htlc_out_payment_hash(&self) -> Option<PaymentHash>
Get the payment hash if this vtxo is an HTLC send arkoor vtxo.
Sourcepub fn arkoor_pubkey(&self) -> Option<PublicKey>
pub fn arkoor_pubkey(&self) -> Option<PublicKey>
Sourcepub fn past_arkoor_pubkeys(&self) -> impl Iterator<Item = PublicKey> + '_
pub fn past_arkoor_pubkeys(&self) -> impl Iterator<Item = PublicKey> + '_
Iterate over all arkoor pubkeys in the arkoor chain of this vtxo.
This does not include the current arkoor pubkey, for that use Vtxo::arkoor_pubkey.
Sourcepub fn user_pubkey(&self) -> PublicKey
pub fn user_pubkey(&self) -> PublicKey
Returns the user pubkey associated with this Vtxo.
Sourcepub fn output_taproot(&self) -> TaprootSpendInfo
pub fn output_taproot(&self) -> TaprootSpendInfo
The taproot spend info for the output of this Vtxo.
Sourcepub fn output_script_pubkey(&self) -> ScriptBuf
pub fn output_script_pubkey(&self) -> ScriptBuf
The scriptPubkey of the output of this Vtxo.
Sourcepub fn is_fully_signed(&self) -> bool
pub fn is_fully_signed(&self) -> bool
Whether this VTXO is fully signed
It is possible to represent unsigned VTXOs, for which this method will return false.
Sourcepub fn transactions(&self) -> VtxoTxIter<'_> ⓘ
pub fn transactions(&self) -> VtxoTxIter<'_> ⓘ
Iterator that constructs all the exit txs for this Vtxo.
Sourcepub fn claim_satisfaction_weight(&self) -> Weight
pub fn claim_satisfaction_weight(&self) -> Weight
The satisfaction weight required to spend the output when doing a unilateral exit.
Sourcepub fn arkoor_pubkeys(&self) -> HashSet<PublicKey>
pub fn arkoor_pubkeys(&self) -> HashSet<PublicKey>
The set of all arkoor pubkeys present in the arkoor part of the VTXO exit path.
Sourcepub fn validate(
&self,
chain_anchor_tx: &Transaction,
) -> Result<(), VtxoValidationError>
pub fn validate( &self, chain_anchor_tx: &Transaction, ) -> Result<(), VtxoValidationError>
Fully validate this VTXO and its entire transaction chain.
The chain_anchor_tx must be the tx with txid matching
Vtxo::chain_anchor.
Source§impl Vtxo
impl Vtxo
pub fn invalidate_final_sig(&mut self)
Trait Implementations§
Source§impl Ord for Vtxo
impl Ord for Vtxo
Source§impl PartialOrd for Vtxo
impl PartialOrd for Vtxo
Source§impl ProtocolEncoding for Vtxo
impl ProtocolEncoding for Vtxo
Source§fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
Source§fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
Source§fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
Source§fn serialize_hex(&self) -> String
fn serialize_hex(&self) -> String
Source§fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
impl Eq for Vtxo
Auto Trait Implementations§
impl Freeze for Vtxo
impl RefUnwindSafe for Vtxo
impl Send for Vtxo
impl Sync for Vtxo
impl Unpin for Vtxo
impl UnwindSafe for Vtxo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.