Trait farcaster_core::transaction::Lockable
source · pub trait Lockable<Addr, Tx, Px, Out, Amt, Ti, Ms, Pk, Si>: Transaction<Px, Out, Amt> + Broadcastable<Tx> + Linkable<Out> + Witnessable<Ms, Pk, Si> {
fn initialize(
prev: &impl Fundable<Tx, Out, Addr, Pk>,
lock: DataLock<Ti, Pk>,
target_amount: Amt
) -> Result<Self, Error>
where
Self: Sized;
fn verify_template(&self, lock: DataLock<Ti, Pk>) -> Result<(), Error>;
fn verify_target_amount(&self, target_amount: Amt) -> Result<(), Error>
where
Amt: PartialEq,
{ ... }
fn get_label(&self) -> TxLabel { ... }
}Expand description
Represent a lockable transaction such as the lock (b) transaction that consumes the funding (a) transaction and creates the scripts used by buy (c) and cancel (d) transactions.
Required Methods§
sourcefn initialize(
prev: &impl Fundable<Tx, Out, Addr, Pk>,
lock: DataLock<Ti, Pk>,
target_amount: Amt
) -> Result<Self, Error>where
Self: Sized,
fn initialize(
prev: &impl Fundable<Tx, Out, Addr, Pk>,
lock: DataLock<Ti, Pk>,
target_amount: Amt
) -> Result<Self, Error>where
Self: Sized,
Creates a new lock (b) transaction based on the funding (a) transaction and the data
needed for creating the lock primitive (i.e. the timelock and the keys). Return a new lock (b) transaction.
This correspond to the “creator” and initial “updater” roles in BIP 174. Creates a new transaction and fill the inputs and outputs data.
Target Amount
The target amount is used to set the value of the output, the fee strategy is latter validated against the freshly created transaction to ensure that fee is valid for the transaction. The initialization must return an error if the amount is insufficient.
Provided Methods§
Implementors§
impl Lockable<Address, Transaction, PartiallySignedTransaction, MetadataOutput, Amount, CSVTimelock, Hash, PublicKey, Signature> for Tx<Lock>
experimental only.