Struct Owner

Source
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,

Source

pub fn with_components(network: Network, provider: O, resolver: R) -> Self

Source

pub fn into_components(self) -> (O, R)

Source

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,

Source§

fn clone(&self) -> Owner<R, O, K, U>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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,

Source§

type Target = O

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
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,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
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,

Source§

type Key = K

NB: We need this separate parameter since otherwise we will bloat trait with generics which may be unknown upstream.
Source§

type Descr = RgbDescr<K>

Source§

fn descriptor(&self) -> &Self::Descr

Source§

fn prev_tx(&self, txid: Txid) -> Option<UnsignedTx>

Source§

fn utxo(&self, outpoint: Outpoint) -> Option<(Utxo, ScriptPubkey)>

Source§

fn network(&self) -> Network

Source§

fn next_derivation_index( &mut self, keychain: impl Into<Keychain>, shift: bool, ) -> NormalIndex

Source§

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)

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,

Source§

type Error = ResolverError

Source§

fn has_utxo(&self, outpoint: Outpoint) -> bool

Source§

fn utxos(&self) -> impl Iterator<Item = Outpoint>

Source§

fn update_utxos(&mut self) -> Result<(), Self::Error>

Source§

fn register_seal(&mut self, seal: WTxoSeal)

Source§

fn resolve_seals( &self, seals: impl Iterator<Item = AuthToken>, ) -> impl Iterator<Item = WTxoSeal>

Source§

fn noise_seed(&self) -> Bytes32

Source§

fn next_address(&mut self) -> Address

Source§

fn next_nonce(&mut self) -> u64

Source§

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).
Source§

fn last_block_height(&self) -> Result<u64, Self::Error>

Returns the height of the last known block.
Source§

fn broadcast( &mut self, tx: &Tx, change: Option<(Vout, u32, u32)>, ) -> Result<(), Self::Error>

Broadcasts the transaction, also updating UTXO set accordingly.

Auto Trait Implementations§

§

impl<R, O, K, U> Freeze for Owner<R, O, K, U>
where O: Freeze, R: Freeze,

§

impl<R, O, K, U> RefUnwindSafe for Owner<R, O, K, U>

§

impl<R, O, K, U> Send for Owner<R, O, K, U>
where O: Send, R: Send, K: Send, U: Send,

§

impl<R, O, K, U> Sync for Owner<R, O, K, U>
where O: Sync, R: Sync, K: Sync, U: Sync,

§

impl<R, O, K, U> Unpin for Owner<R, O, K, U>
where O: Unpin, R: Unpin, K: Unpin, U: Unpin,

§

impl<R, O, K, U> UnwindSafe for Owner<R, O, K, U>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<E> ElectrumApi for E
where E: Deref, <E as Deref>::Target: ElectrumApi,

Source§

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>

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>

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>

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>

Gets the raw bytes of block header for height height.
Source§

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>

Estimates the fee required in Bitcoin per kilobyte to confirm a transaction in number blocks.
Source§

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>

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>

Batch version of script_subscribe. Read more
Source§

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>

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>

Returns the balance for a scriptPubKey.
Source§

fn batch_script_get_balance<'s, I>( &self, scripts: I, ) -> Result<Vec<GetBalanceRes>, Error>

Batch version of script_get_balance. Read more
Source§

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>

Batch version of script_get_history. Read more
Source§

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>

Batch version of script_list_unspent. Read more
Source§

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>

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>

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>
where I: IntoIterator + Clone, <I as IntoIterator>::Item: Borrow<&'t Txid>,

Batch version of transaction_get_raw. Read more
Source§

fn batch_block_header_raw<I>(&self, heights: I) -> Result<Vec<Vec<u8>>, Error>
where I: IntoIterator + Clone, <I as IntoIterator>::Item: Borrow<u32>,

Batch version of block_header_raw. Read more
Source§

fn batch_estimate_fee<I>(&self, numbers: I) -> Result<Vec<f64>, Error>

Batch version of estimate_fee. Read more
Source§

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>

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>

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>

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>

Returns the capabilities of the server.
Source§

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>

Gets the block header for height height.
Source§

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>

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>

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>
where I: IntoIterator + Clone, <I as IntoIterator>::Item: Borrow<&'t Txid>,

Batch version of transaction_get. Read more
Source§

fn batch_block_header<I>(&self, heights: I) -> Result<Vec<BlockHeader>, Error>
where I: IntoIterator + Clone, <I as IntoIterator>::Item: Borrow<u32>,

Batch version of block_header. Read more
Source§

fn transaction_broadcast(&self, tx: &Tx) -> Result<Txid, Error>

Broadcasts a transaction to the network.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<R> Rng for R
where R: RngCore + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where 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,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut T)
where T: Fill + ?Sized,

Fill any type implementing Fill with random data Read more
Source§

fn gen<T>(&mut self) -> 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) -> T
where T: SampleUniform, R: SampleRange<T>,

👎Deprecated since 0.9.0: Renamed to random_range
Source§

fn gen_bool(&mut self, p: f64) -> bool

👎Deprecated since 0.9.0: Renamed to random_bool
Alias for Rng::random_bool.
Source§

fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool

👎Deprecated since 0.9.0: Renamed to random_ratio
Source§

impl<T> RngCore for T
where T: DerefMut, <T as Deref>::Target: RngCore,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<R> TryRngCore for R
where R: RngCore + ?Sized,

Source§

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>

Return the next random u32.
Source§

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>

Fill dest entirely with random data.
Source§

fn unwrap_err(self) -> UnwrapErr<Self>
where Self: Sized,

Wrap RNG with the UnwrapErr wrapper.
Source§

fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>

Wrap RNG with the UnwrapMut wrapper.
Source§

fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>
where Self: Sized,

Convert an RngCore to a RngReadAdapter.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> CryptoRng for T
where T: DerefMut, <T as Deref>::Target: CryptoRng,

Source§

impl<R> TryCryptoRng for R
where R: CryptoRng + ?Sized,