Trait OnchainWallet

Source
pub trait OnchainWallet: MaybeSend + MaybeSync {
Show 15 methods // Required methods fn transactions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<WalletTx>, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn transactions_by_tx_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<Txid, WalletTx>, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn asset_utxos<'life0, 'life1, 'async_trait>( &'life0 self, asset: &'life1 AssetId, ) -> Pin<Box<dyn Future<Output = Result<Vec<WalletTxOut>, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn build_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fee_rate_sats_per_kvb: Option<f32>, recipient_address: &'life1 str, asset_id: &'life2 str, amount_sat: u64, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn build_drain_tx<'life0, 'life1, 'async_trait>( &'life0 self, fee_rate_sats_per_kvb: Option<f32>, recipient_address: &'life1 str, enforce_amount_sat: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn build_tx_or_drain_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fee_rate_sats_per_kvb: Option<f32>, recipient_address: &'life1 str, asset_id: &'life2 str, amount_sat: u64, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn sign_pset<'life0, 'async_trait>( &'life0 self, pset: PartiallySignedTransaction, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn next_unused_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Address, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn next_unused_change_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Address, PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn tip<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn pubkey(&self) -> Result<String>; fn fingerprint(&self) -> Result<String>; fn sign_message(&self, msg: &str) -> Result<String>; fn check_message( &self, message: &str, pubkey: &str, signature: &str, ) -> Result<bool>; fn full_scan<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PaymentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}

Required Methods§

Source

fn transactions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<WalletTx>, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all transactions in the wallet

Source

fn transactions_by_tx_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<Txid, WalletTx>, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all transactions in the wallet mapped by tx id

Source

fn asset_utxos<'life0, 'life1, 'async_trait>( &'life0 self, asset: &'life1 AssetId, ) -> Pin<Box<dyn Future<Output = Result<Vec<WalletTxOut>, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all utxos in the wallet for a given asset

Source

fn build_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fee_rate_sats_per_kvb: Option<f32>, recipient_address: &'life1 str, asset_id: &'life2 str, amount_sat: u64, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Build a transaction to send funds to a recipient

Source

fn build_drain_tx<'life0, 'life1, 'async_trait>( &'life0 self, fee_rate_sats_per_kvb: Option<f32>, recipient_address: &'life1 str, enforce_amount_sat: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Builds a drain tx.

§Arguments
  • fee_rate_sats_per_kvb: custom drain tx feerate
  • recipient_address: drain tx recipient
  • enforce_amount_sat: if set, the drain tx will only be built if the amount transferred is this amount, otherwise it will fail with a validation error
Source

fn build_tx_or_drain_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, fee_rate_sats_per_kvb: Option<f32>, recipient_address: &'life1 str, asset_id: &'life2 str, amount_sat: u64, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Build a transaction to send funds to a recipient. If building a transaction results in an InsufficientFunds error, attempt to build a drain transaction validating that the amount_sat matches the drain output.

Source

fn sign_pset<'life0, 'async_trait>( &'life0 self, pset: PartiallySignedTransaction, ) -> Pin<Box<dyn Future<Output = Result<Transaction, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sign a partially signed transaction

Source

fn next_unused_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Address, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the next unused address in the wallet

Source

fn next_unused_change_address<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Address, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the next unused change address in the wallet

Source

fn tip<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current tip of the blockchain the wallet is aware of

Source

fn pubkey(&self) -> Result<String>

Get the public key of the wallet

Source

fn fingerprint(&self) -> Result<String>

Get the fingerprint of the wallet

Source

fn sign_message(&self, msg: &str) -> Result<String>

Sign given message with the wallet private key. Returns a zbase encoded signature.

Source

fn check_message( &self, message: &str, pubkey: &str, signature: &str, ) -> Result<bool>

Check whether given message was signed by the given pubkey and the signature (zbase encoded) is valid.

Source

fn full_scan<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Perform a full scan of the wallet

Implementors§