pub struct ZincWallet { /* private fields */ }Expand description
Stateful wallet runtime that owns account wallets and safety state.
Implementations§
Source§impl ZincWallet
impl ZincWallet
Sourcepub fn inscriptions(&self) -> &[Inscription]
pub fn inscriptions(&self) -> &[Inscription]
Return the cached inscriptions currently tracked by the wallet.
Sourcepub fn account_generation(&self) -> u64
pub fn account_generation(&self) -> u64
Return the current account generation counter.
Sourcepub fn active_account_index(&self) -> u32
pub fn active_account_index(&self) -> u32
Return the currently active account index.
Sourcepub fn is_syncing(&self) -> bool
pub fn is_syncing(&self) -> bool
Return whether a sync operation is currently in progress.
Sourcepub fn ordinals_verified(&self) -> bool
pub fn ordinals_verified(&self) -> bool
Return whether ordinals protection data is verified.
Sourcepub fn ordinals_metadata_complete(&self) -> bool
pub fn ordinals_metadata_complete(&self) -> bool
Return whether ordinals metadata refresh completed successfully.
Sourcepub fn is_unified(&self) -> bool
pub fn is_unified(&self) -> bool
Return true when the wallet uses unified addressing.
Sourcepub fn needs_full_scan(&self) -> bool
pub fn needs_full_scan(&self) -> bool
Return true when wallet state indicates a full scan is needed.
Sourcepub fn next_taproot_address(&mut self) -> Result<Address, String>
pub fn next_taproot_address(&mut self) -> Result<Address, String>
Reveal and return the next taproot receive address.
Sourcepub fn peek_taproot_address(&self, index: u32) -> Address
pub fn peek_taproot_address(&self, index: u32) -> Address
Peek a taproot receive address at index without advancing state.
Sourcepub fn get_payment_address(&mut self) -> Result<Address, String>
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.
Sourcepub fn peek_payment_address(&self, index: u32) -> Option<Address>
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.
Sourcepub fn export_changeset(&self) -> Result<ZincPersistence, String>
pub fn export_changeset(&self) -> Result<ZincPersistence, String>
Export a persistence snapshot containing merged loaded+staged changesets.
Sourcepub async fn check_connection(esplora_url: &str) -> bool
pub async fn check_connection(esplora_url: &str) -> bool
Check whether the configured Esplora endpoint is reachable.
Sourcepub fn prepare_requests(&self) -> ZincSyncRequest
pub fn prepare_requests(&self) -> ZincSyncRequest
Build sync requests for taproot/payment wallets.
Sourcepub fn apply_sync(
&mut self,
vault_update: impl Into<Update>,
payment_update: Option<impl Into<Update>>,
) -> Result<Vec<String>, String>
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.
Sourcepub fn reset_sync_state(&mut self) -> Result<(), String>
pub fn reset_sync_state(&mut self) -> Result<(), String>
Rebuild wallet state from current public descriptors, clearing cached sync state.
Sourcepub async fn sync(&mut self, esplora_url: &str) -> Result<Vec<String>, String>
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.
Sourcepub fn collect_active_addresses(&self) -> Vec<String>
pub fn collect_active_addresses(&self) -> Vec<String>
Collect all addresses (Vault + Payment) that currently hold UTXOs. Used for syncing Ordinals.
Sourcepub fn apply_verified_ordinals_update(
&mut self,
inscriptions: Vec<Inscription>,
protected_outpoints: HashSet<OutPoint>,
) -> usize
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.
Sourcepub fn apply_unverified_inscriptions_cache(
&mut self,
inscriptions: Vec<Inscription>,
) -> usize
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.
Sourcepub async fn sync_ordinals_protection(
&mut self,
ord_url: &str,
) -> Result<usize, String>
pub async fn sync_ordinals_protection( &mut self, ord_url: &str, ) -> Result<usize, String>
Refresh only ordinals protection outpoints (no inscription metadata details).
Sourcepub async fn sync_ordinals_metadata(
&mut self,
ord_url: &str,
) -> Result<usize, String>
pub async fn sync_ordinals_metadata( &mut self, ord_url: &str, ) -> Result<usize, String>
Refresh inscription metadata used by UI and PSBT analysis.
Sourcepub async fn sync_ordinals(&mut self, ord_url: &str) -> Result<usize, String>
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.
Sourcepub fn get_raw_balance(&self) -> Balance
pub fn get_raw_balance(&self) -> Balance
Return raw combined BDK balance across taproot and payment wallets.
Sourcepub fn get_balance(&self) -> ZincBalance
pub fn get_balance(&self) -> ZincBalance
Return an ordinals-aware balance view for display and spend checks.
Sourcepub fn create_psbt_tx(
&mut self,
request: &CreatePsbtRequest,
) -> Result<Psbt, ZincError>
pub fn create_psbt_tx( &mut self, request: &CreatePsbtRequest, ) -> Result<Psbt, ZincError>
Create an unsigned PSBT for sending BTC.
Sourcepub fn create_psbt_base64(
&mut self,
request: &CreatePsbtRequest,
) -> Result<String, ZincError>
pub fn create_psbt_base64( &mut self, request: &CreatePsbtRequest, ) -> Result<String, ZincError>
Create an unsigned PSBT for sending BTC and encode it as base64.
Sourcepub fn create_offer(
&mut self,
request: &CreateOfferRequest,
) -> Result<OfferCreateResultV1, ZincError>
pub fn create_offer( &mut self, request: &CreateOfferRequest, ) -> Result<OfferCreateResultV1, ZincError>
Create an ord-compatible buyer offer PSBT and envelope.
Sourcepub fn sign_psbt(
&mut self,
psbt_base64: &str,
options: Option<SignOptions>,
) -> Result<String, String>
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.
Sourcepub fn analyze_psbt(&self, psbt_base64: &str) -> Result<String, String>
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.
Sourcepub async fn broadcast(
&mut self,
signed_psbt_base64: &str,
esplora_url: &str,
) -> Result<String, String>
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.
Sourcepub fn sign_message(
&self,
address: &str,
message: &str,
) -> Result<String, String>
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.
Sourcepub fn get_taproot_public_key(&self, index: u32) -> Result<String, String>
pub fn get_taproot_public_key(&self, index: u32) -> Result<String, String>
Derive the taproot public key for this account at index.
Sourcepub fn get_payment_public_key(&self, index: u32) -> Result<String, String>
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.
Sourcepub fn get_accounts(&self, count: u32) -> Vec<Account>
pub fn get_accounts(&self, count: u32) -> Vec<Account>
Build account summaries for indices [0, count).
Sourcepub fn build_discovery_context(
&self,
start: u32,
count: u32,
) -> Result<DiscoveryContext, String>
pub fn build_discovery_context( &self, start: u32, count: u32, ) -> Result<DiscoveryContext, String>
Build discovery context for accounts in [start, start + count).
Sourcepub async fn discover_active_accounts(
&self,
esplora_url: &str,
count: u32,
gap: u32,
) -> Result<Vec<Account>, String>
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.
Sourcepub async fn discover_active_accounts_range(
&self,
esplora_url: &str,
start: u32,
count: u32,
gap: u32,
) -> Result<Vec<Account>, String>
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).
Sourcepub async fn discover_accounts_with_context(
context: DiscoveryContext,
esplora_url: &str,
gap: u32,
) -> Result<Vec<Account>, String>
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.
Sourcepub fn set_active_account(&mut self, index: u32) -> Result<(), String>
pub fn set_active_account(&mut self, index: u32) -> Result<(), String>
Switch the active account and reset account-scoped runtime state.
Sourcepub fn set_address_scheme(
&mut self,
scheme: AddressScheme,
) -> Result<(), String>
pub fn set_address_scheme( &mut self, scheme: AddressScheme, ) -> Result<(), String>
Switch between unified and dual address schemes.
Source§impl ZincWallet
impl ZincWallet
Sourcepub fn get_transactions(&self, limit: usize) -> Vec<TxItem>
pub fn get_transactions(&self, limit: usize) -> Vec<TxItem>
Return up to limit merged transactions across vault/payment wallets.