pub struct Owner<R, O, K = XpubDerivable, U = MemUtxos>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,{ /* private fields */ }Expand description
Owner structure represents a holder of an RGB wallet, which keeps information of the wallet
descriptor and UTXO set. It doesn’t know anything about RGB contracts, though (and that’s why
it is not a full wallet) and is used as a component implementing WalletProvider inside
[rgbstd::RgbWallet] and crate::RgbRuntime.
Implementations§
Source§impl<R, O, K, U> Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
impl<R, O, K, U> Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
pub fn with_components(network: Network, provider: O, resolver: R) -> Self
pub fn into_components(self) -> (O, R)
pub fn network(&self) -> Network
Trait Implementations§
Source§impl<R, O, K, U> Clone for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly + Clone,
O: OwnerProvider<Key = K, UtxoSet = U> + Clone,
R: Resolver + Clone,
U: UtxoSet + Clone,
impl<R, O, K, U> Clone for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly + Clone,
O: OwnerProvider<Key = K, UtxoSet = U> + Clone,
R: Resolver + Clone,
U: UtxoSet + Clone,
Source§impl<R, O, K, U> Deref for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
impl<R, O, K, U> Deref for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
Source§impl<R, O, K, U> DerefMut for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
impl<R, O, K, U> DerefMut for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
Source§impl<R, O, K, U> PsbtConstructor for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
impl<R, O, K, U> PsbtConstructor for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
Source§type Key = K
type Key = K
NB: We need this separate parameter since otherwise we will bloat trait with generics which
may be unknown upstream.
type Descr = RgbDescr<K>
fn descriptor(&self) -> &Self::Descr
fn prev_tx(&self, txid: Txid) -> Option<UnsignedTx>
fn utxo(&self, outpoint: Outpoint) -> Option<(Utxo, ScriptPubkey)>
fn network(&self) -> Network
fn next_derivation_index( &mut self, keychain: impl Into<Keychain>, shift: bool, ) -> NormalIndex
fn construct_psbt( &mut self, coins: impl IntoIterator<Item = Outpoint>, beneficiaries: impl IntoIterator<Item = Beneficiary>, params: TxParams, ) -> Result<(Psbt, PsbtMeta), ConstructionError>
Source§fn after_construct_psbt(&mut self, _psbt: &Psbt, _meta: &PsbtMeta)
fn after_construct_psbt(&mut self, _psbt: &Psbt, _meta: &PsbtMeta)
A hook which is called by the default
Self::construct_psbt before returning the newly
constructed PSBT to the caller.Source§impl<R, O, K, U> WalletProvider for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
impl<R, O, K, U> WalletProvider for Owner<R, O, K, U>where
K: DeriveSet<Legacy = K, Compr = K, XOnly = K> + DeriveLegacy + DeriveCompr + DeriveXOnly,
O: OwnerProvider<Key = K, UtxoSet = U>,
R: Resolver,
U: UtxoSet,
type Error = ResolverError
fn has_utxo(&self, outpoint: Outpoint) -> bool
fn utxos(&self) -> impl Iterator<Item = Outpoint>
fn update_utxos(&mut self) -> Result<(), Self::Error>
fn register_seal(&mut self, seal: WTxoSeal)
fn resolve_seals( &self, seals: impl Iterator<Item = AuthToken>, ) -> impl Iterator<Item = WTxoSeal>
fn noise_seed(&self) -> Bytes32
fn next_address(&mut self) -> Address
fn next_nonce(&mut self) -> u64
Source§fn txid_resolver(&self) -> impl Fn(Txid) -> Result<WitnessStatus, Self::Error>
fn txid_resolver(&self) -> impl Fn(Txid) -> Result<WitnessStatus, Self::Error>
Returns a closure which can retrieve a witness status of an arbitrary transaction id
(including the ones that are not related to the wallet).
Auto Trait Implementations§
impl<R, O, K, U> Freeze for Owner<R, O, K, U>
impl<R, O, K, U> RefUnwindSafe for Owner<R, O, K, U>
impl<R, O, K, U> Send for Owner<R, O, K, U>
impl<R, O, K, U> Sync for Owner<R, O, K, U>
impl<R, O, K, U> Unpin for Owner<R, O, K, U>
impl<R, O, K, U> UnwindSafe for Owner<R, O, K, U>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<E> ElectrumApi for E
impl<E> ElectrumApi for E
Source§fn raw_call(
&self,
method_name: &str,
params: impl IntoIterator<Item = Param>,
) -> Result<Value, Error>
fn raw_call( &self, method_name: &str, params: impl IntoIterator<Item = Param>, ) -> Result<Value, Error>
Executes the requested API call returning the raw answer.
Source§fn batch_call(&self, batch: &Batch) -> Result<Vec<Value>, Error>
fn batch_call(&self, batch: &Batch) -> Result<Vec<Value>, Error>
Execute a queue of calls stored in a
Batch struct. Returns
Ok() only if all of the calls are successful. The order of the JSON Values returned
reflects the order in which the calls were made on the Batch struct.Source§fn block_headers_subscribe_raw(&self) -> Result<RawHeaderNotification, Error>
fn block_headers_subscribe_raw(&self) -> Result<RawHeaderNotification, Error>
Subscribes to notifications for new block headers, by sending a
blockchain.headers.subscribe call and
returns the current tip as raw bytes instead of deserializing them.Source§fn block_headers_pop_raw(&self) -> Result<Option<RawHeaderNotification>, Error>
fn block_headers_pop_raw(&self) -> Result<Option<RawHeaderNotification>, Error>
Tries to pop one queued notification for a new block header that we might have received.
Returns a the header in raw bytes if a notification is found in the queue, None otherwise.
Source§fn block_header_raw(&self, height: usize) -> Result<Vec<u8>, Error>
fn block_header_raw(&self, height: usize) -> Result<Vec<u8>, Error>
Gets the raw bytes of block header for height
height.Source§fn block_headers(
&self,
start_height: usize,
count: usize,
) -> Result<GetHeadersRes, Error>
fn block_headers( &self, start_height: usize, count: usize, ) -> Result<GetHeadersRes, Error>
Tries to fetch
count block headers starting from start_height.Source§fn estimate_fee(&self, number: usize) -> Result<f64, Error>
fn estimate_fee(&self, number: usize) -> Result<f64, Error>
Estimates the fee required in Bitcoin per kilobyte to confirm a transaction in
number blocks.Source§fn relay_fee(&self) -> Result<f64, Error>
fn relay_fee(&self) -> Result<f64, Error>
Returns the minimum accepted fee by the server’s node in Bitcoin, not Satoshi.
Source§fn script_subscribe(
&self,
script: &ScriptPubkey,
) -> Result<Option<Hex32Bytes>, Error>
fn script_subscribe( &self, script: &ScriptPubkey, ) -> Result<Option<Hex32Bytes>, Error>
Subscribes to notifications for activity on a specific scriptPubKey. Read more
Source§fn batch_script_subscribe<'s, I>(
&self,
scripts: I,
) -> Result<Vec<Option<Hex32Bytes>>, Error>
fn batch_script_subscribe<'s, I>( &self, scripts: I, ) -> Result<Vec<Option<Hex32Bytes>>, Error>
Batch version of
script_subscribe. Read moreSource§fn script_unsubscribe(&self, script: &ScriptPubkey) -> Result<bool, Error>
fn script_unsubscribe(&self, script: &ScriptPubkey) -> Result<bool, Error>
Subscribes to notifications for activity on a specific scriptPubKey. Read more
Source§fn script_pop(&self, script: &ScriptPubkey) -> Result<Option<Hex32Bytes>, Error>
fn script_pop(&self, script: &ScriptPubkey) -> Result<Option<Hex32Bytes>, Error>
Tries to pop one queued notification for a requested script. Returns
None if there are no items in the queue.Source§fn script_get_balance(
&self,
script: &ScriptPubkey,
) -> Result<GetBalanceRes, Error>
fn script_get_balance( &self, script: &ScriptPubkey, ) -> Result<GetBalanceRes, Error>
Returns the balance for a scriptPubKey.
Source§fn batch_script_get_balance<'s, I>(
&self,
scripts: I,
) -> Result<Vec<GetBalanceRes>, Error>
fn batch_script_get_balance<'s, I>( &self, scripts: I, ) -> Result<Vec<GetBalanceRes>, Error>
Batch version of
script_get_balance. Read moreSource§fn script_get_history(
&self,
script: &ScriptPubkey,
) -> Result<Vec<GetHistoryRes>, Error>
fn script_get_history( &self, script: &ScriptPubkey, ) -> Result<Vec<GetHistoryRes>, Error>
Returns the history for a scriptPubKey
Source§fn batch_script_get_history<'s, I>(
&self,
scripts: I,
) -> Result<Vec<Vec<GetHistoryRes>>, Error>
fn batch_script_get_history<'s, I>( &self, scripts: I, ) -> Result<Vec<Vec<GetHistoryRes>>, Error>
Batch version of
script_get_history. Read moreSource§fn script_list_unspent(
&self,
script: &ScriptPubkey,
) -> Result<Vec<ListUnspentRes>, Error>
fn script_list_unspent( &self, script: &ScriptPubkey, ) -> Result<Vec<ListUnspentRes>, Error>
Returns the list of unspent outputs for a scriptPubKey
Source§fn batch_script_list_unspent<'s, I>(
&self,
scripts: I,
) -> Result<Vec<Vec<ListUnspentRes>>, Error>
fn batch_script_list_unspent<'s, I>( &self, scripts: I, ) -> Result<Vec<Vec<ListUnspentRes>>, Error>
Batch version of
script_list_unspent. Read moreSource§fn script_get_mempool(
&self,
script: &ScriptPubkey,
) -> Result<Vec<GetMempoolRes>, Error>
fn script_get_mempool( &self, script: &ScriptPubkey, ) -> Result<Vec<GetMempoolRes>, Error>
Return the unconfirmed transactions of a script hash. Read more
Source§fn transaction_get_verbose(&self, txid: &Txid) -> Result<Option<TxRes>, Error>
fn transaction_get_verbose(&self, txid: &Txid) -> Result<Option<TxRes>, Error>
Gets the transaction with
txid, including additional verbose details returned by Butcoin Core. Returns an error if not found.Source§fn transaction_get_raw(&self, txid: &Txid) -> Result<Option<Vec<u8>>, Error>
fn transaction_get_raw(&self, txid: &Txid) -> Result<Option<Vec<u8>>, Error>
Gets the raw bytes of a transaction with
txid. Returns an error if not found.Source§fn batch_transaction_get_raw<'t, I>(
&self,
txids: I,
) -> Result<Vec<Vec<u8>>, Error>
fn batch_transaction_get_raw<'t, I>( &self, txids: I, ) -> Result<Vec<Vec<u8>>, Error>
Batch version of
transaction_get_raw. Read moreSource§fn batch_block_header_raw<I>(&self, heights: I) -> Result<Vec<Vec<u8>>, Error>
fn batch_block_header_raw<I>(&self, heights: I) -> Result<Vec<Vec<u8>>, Error>
Batch version of
block_header_raw. Read moreSource§fn batch_estimate_fee<I>(&self, numbers: I) -> Result<Vec<f64>, Error>
fn batch_estimate_fee<I>(&self, numbers: I) -> Result<Vec<f64>, Error>
Batch version of
estimate_fee. Read moreSource§fn transaction_broadcast_raw(&self, raw_tx: &[u8]) -> Result<Txid, Error>
fn transaction_broadcast_raw(&self, raw_tx: &[u8]) -> Result<Txid, Error>
Broadcasts the raw bytes of a transaction to the network.
Source§fn transaction_get_merkle(
&self,
txid: &Txid,
height: usize,
) -> Result<GetMerkleRes, Error>
fn transaction_get_merkle( &self, txid: &Txid, height: usize, ) -> Result<GetMerkleRes, Error>
Returns the merkle path for the transaction
txid confirmed in the block at height.Source§fn txid_from_pos(&self, height: usize, tx_pos: usize) -> Result<Txid, Error>
fn txid_from_pos(&self, height: usize, tx_pos: usize) -> Result<Txid, Error>
Returns a transaction hash, given a block
height and a tx_pos in the block.Source§fn txid_from_pos_with_merkle(
&self,
height: usize,
tx_pos: usize,
) -> Result<TxidFromPosRes, Error>
fn txid_from_pos_with_merkle( &self, height: usize, tx_pos: usize, ) -> Result<TxidFromPosRes, Error>
Returns a transaction hash and a merkle path, given a block
height and a tx_pos in the
block.Source§fn server_features(&self) -> Result<ServerFeaturesRes, Error>
fn server_features(&self) -> Result<ServerFeaturesRes, Error>
Returns the capabilities of the server.
Source§fn ping(&self) -> Result<(), Error>
fn ping(&self) -> Result<(), Error>
Pings the server. This method can also be used as a “dummy” call to trigger the processing
of incoming block header or script notifications.
Source§fn block_header(&self, height: usize) -> Result<BlockHeader, Error>
fn block_header(&self, height: usize) -> Result<BlockHeader, Error>
Gets the block header for height
height.Source§fn block_headers_subscribe(&self) -> Result<HeaderNotification, Error>
fn block_headers_subscribe(&self) -> Result<HeaderNotification, Error>
Subscribes to notifications for new block headers, by sending a
blockchain.headers.subscribe call.Source§fn block_headers_pop(&self) -> Result<Option<HeaderNotification>, Error>
fn block_headers_pop(&self) -> Result<Option<HeaderNotification>, Error>
Tries to pop one queued notification for a new block header that we might have received.
Returns
None if there are no items in the queue.Source§fn transaction_get(&self, txid: &Txid) -> Result<Option<Tx>, Error>
fn transaction_get(&self, txid: &Txid) -> Result<Option<Tx>, Error>
Gets the transaction with
txid. Returns an error if not found.Source§fn batch_transaction_get<'t, I>(&self, txids: I) -> Result<Vec<Tx>, Error>
fn batch_transaction_get<'t, I>(&self, txids: I) -> Result<Vec<Tx>, Error>
Batch version of
transaction_get. Read moreSource§fn batch_block_header<I>(&self, heights: I) -> Result<Vec<BlockHeader>, Error>
fn batch_block_header<I>(&self, heights: I) -> Result<Vec<BlockHeader>, Error>
Batch version of
block_header. Read moreSource§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random to avoid conflict with the new gen keyword in Rust 2024.Alias for
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_rangeAlias for
Rng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore to a RngReadAdapter.