pub trait OnchainWallet: Send + Sync {
Show 17 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, 'life1, 'async_trait>(
&'life0 self,
pset: &'life1 mut PartiallySignedTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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;
fn apply_broadcast_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn repair_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, PaymentError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Required Methods§
Sourcefn 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<'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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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_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
Sourcefn 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_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 feeraterecipient_address: drain tx recipientenforce_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
Sourcefn 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 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.
Sourcefn sign_pset<'life0, 'life1, 'async_trait>(
&'life0 self,
pset: &'life1 mut PartiallySignedTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), PaymentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn sign_pset<'life0, 'life1, 'async_trait>(
&'life0 self,
pset: &'life1 mut PartiallySignedTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), PaymentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sign a partially signed transaction
Sourcefn 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_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
Sourcefn 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 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
Sourcefn tip<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = u32> + 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,
Get the current tip of the blockchain the wallet is aware of
Sourcefn fingerprint(&self) -> Result<String>
fn fingerprint(&self) -> Result<String>
Get the fingerprint of the wallet
Sourcefn sign_message(&self, msg: &str) -> Result<String>
fn sign_message(&self, msg: &str) -> Result<String>
Sign given message with the wallet private key. Returns a zbase encoded signature.
Sourcefn check_message(
&self,
message: &str,
pubkey: &str,
signature: &str,
) -> Result<bool>
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.
Sourcefn full_scan<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PaymentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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
Sourcefn apply_broadcast_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn apply_broadcast_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Records a just-broadcast tx so the coins it spends stop being selectable before the next scan sees them; without this a second payment re-selects them and is rejected.
Sourcefn repair_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, PaymentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn repair_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, PaymentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Repairs the cached unspent set locally, with no network access, by re-applying the txs the wallet already holds that spend outputs still listed as unspent.
Returns whether the cache is consistent afterwards. If not, the wallet flags itself so the next scan wipes and rescans.