Skip to main content

ZincWallet

Struct ZincWallet 

Source
pub struct ZincWallet { /* private fields */ }
Expand description

Stateful wallet runtime that owns account wallets and safety state.

Implementations§

Source§

impl ZincWallet

Source

pub fn inscriptions(&self) -> &[Inscription]

Return the cached inscriptions currently tracked by the wallet.

Source

pub fn account_generation(&self) -> u64

Return the current account generation counter.

Source

pub fn active_account_index(&self) -> u32

Return the currently active account index.

Source

pub fn is_syncing(&self) -> bool

Return whether a sync operation is currently in progress.

Source

pub fn ordinals_verified(&self) -> bool

Return whether ordinals protection data is verified.

Source

pub fn ordinals_metadata_complete(&self) -> bool

Return whether ordinals metadata refresh completed successfully.

Source

pub fn is_unified(&self) -> bool

Return true when the wallet uses unified addressing.

Source

pub fn needs_full_scan(&self) -> bool

Return true when wallet state indicates a full scan is needed.

Source

pub fn next_taproot_address(&mut self) -> Result<Address, String>

Reveal and return the next taproot receive address.

Source

pub fn peek_taproot_address(&self, index: u32) -> Address

Peek a taproot receive address at index without advancing state.

Source

pub fn get_payment_address(&mut self) -> Result<Address, String>

Reveal and return the next payment address in dual mode.

In unified mode this returns the next taproot address.

Source

pub fn peek_payment_address(&self, index: u32) -> Option<Address>

Peek a payment receive address at index.

In unified mode this resolves to the taproot branch.

Source

pub fn export_changeset(&self) -> Result<ZincPersistence, String>

Export a persistence snapshot containing merged loaded+staged changesets.

Source

pub async fn check_connection(esplora_url: &str) -> bool

Check whether the configured Esplora endpoint is reachable.

Source

pub fn prepare_requests(&self) -> ZincSyncRequest

Build sync requests for taproot/payment wallets.

Source

pub fn apply_sync( &mut self, vault_update: impl Into<Update>, payment_update: Option<impl Into<Update>>, ) -> Result<Vec<String>, String>

Apply taproot/payment updates and return merged event strings.

Source

pub fn reset_sync_state(&mut self) -> Result<(), String>

Rebuild wallet state from current public descriptors, clearing cached sync state.

Source

pub async fn sync(&mut self, esplora_url: &str) -> Result<Vec<String>, String>

Run a full sync against Esplora for taproot and optional payment wallets.

Source

pub fn collect_active_addresses(&self) -> Vec<String>

Collect all addresses (Vault + Payment) that currently hold UTXOs. Used for syncing Ordinals.

Source

pub fn apply_verified_ordinals_update( &mut self, inscriptions: Vec<Inscription>, protected_outpoints: HashSet<OutPoint>, ) -> usize

Update the wallet’s internal inscription state. Call this AFTER fetching inscriptions successfully.

Source

pub fn apply_unverified_inscriptions_cache( &mut self, inscriptions: Vec<Inscription>, ) -> usize

Apply cached inscription metadata from an untrusted caller boundary.

This method updates metadata for UI rendering but intentionally does not mark the wallet’s ordinals protection state as verified.

Source

pub async fn sync_ordinals_protection( &mut self, ord_url: &str, ) -> Result<usize, String>

Refresh only ordinals protection outpoints (no inscription metadata details).

Source

pub async fn sync_ordinals_metadata( &mut self, ord_url: &str, ) -> Result<usize, String>

Refresh inscription metadata used by UI and PSBT analysis.

Source

pub async fn sync_ordinals(&mut self, ord_url: &str) -> Result<usize, String>

Sync Ordinals (Inscriptions) to build the Shield logic. This keeps the legacy behavior by running protection and metadata refresh.

Source

pub fn get_raw_balance(&self) -> Balance

Return raw combined BDK balance across taproot and payment wallets.

Source

pub fn get_balance(&self) -> ZincBalance

Return an ordinals-aware balance view for display and spend checks.

Source

pub fn create_psbt_tx( &mut self, request: &CreatePsbtRequest, ) -> Result<Psbt, ZincError>

Create an unsigned PSBT for sending BTC.

Source

pub fn create_psbt_base64( &mut self, request: &CreatePsbtRequest, ) -> Result<String, ZincError>

Create an unsigned PSBT for sending BTC and encode it as base64.

Source

pub fn create_offer( &mut self, request: &CreateOfferRequest, ) -> Result<OfferCreateResultV1, ZincError>

Create an ord-compatible buyer offer PSBT and envelope.

Source

pub fn sign_psbt( &mut self, psbt_base64: &str, options: Option<SignOptions>, ) -> Result<String, String>

Sign a PSBT using the wallet’s internal keys. Returns the signed PSBT as base64.

Source

pub fn analyze_psbt(&self, psbt_base64: &str) -> Result<String, String>

Analyzes a PSBT for Ordinal Shield protection. Returns a JSON string containing the AnalysisResult.

Source

pub async fn broadcast( &mut self, signed_psbt_base64: &str, esplora_url: &str, ) -> Result<String, String>

Broadcast a signed PSBT to the network. Returns the transaction ID (txid) as a hex string.

Source

pub fn sign_message( &self, address: &str, message: &str, ) -> Result<String, String>

Sign a message with the private key corresponding to the given address. Supports both Vault (Taproot) and Payment (SegWit) addresses.

Source

pub fn get_taproot_public_key(&self, index: u32) -> Result<String, String>

Derive the taproot public key for this account at index.

Source

pub fn get_payment_public_key(&self, index: u32) -> Result<String, String>

Derive the payment public key for this account at index.

In unified mode this uses the same key family as taproot.

Source

pub fn get_accounts(&self, count: u32) -> Vec<Account>

Build account summaries for indices [0, count).

Source

pub fn build_discovery_context( &self, start: u32, count: u32, ) -> Result<DiscoveryContext, String>

Build discovery context for accounts in [start, start + count).

Source

pub async fn discover_active_accounts( &self, esplora_url: &str, count: u32, gap: u32, ) -> Result<Vec<Account>, String>

Discover active accounts from index 0 up to count.

Source

pub async fn discover_active_accounts_range( &self, esplora_url: &str, start: u32, count: u32, gap: u32, ) -> Result<Vec<Account>, String>

Discover active accounts in [start, start + count).

Source

pub async fn discover_accounts_with_context( context: DiscoveryContext, esplora_url: &str, gap: u32, ) -> Result<Vec<Account>, String>

Discover active accounts using a pre-built discovery context.

Source

pub fn set_active_account(&mut self, index: u32) -> Result<(), String>

Switch the active account and reset account-scoped runtime state.

Source

pub fn set_address_scheme( &mut self, scheme: AddressScheme, ) -> Result<(), String>

Switch between unified and dual address schemes.

Source§

impl ZincWallet

Source

pub fn get_transactions(&self, limit: usize) -> Vec<TxItem>

Return up to limit merged transactions across vault/payment wallets.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more