Sdk

Struct Sdk 

Source
pub struct Sdk {
    pub network: Network,
    /* private fields */
}
Expand description

Dash Platform SDK

This is the main entry point for interacting with Dash Platform. It can be initialized in two modes:

  • Normal: Connects to a remote Dash Platform node.
  • Mock: Uses a mock implementation of Dash Platform.

Recommended method of initialization is to use SdkBuilder. There are also some helper methods:

§Thread safety

Sdk is thread safe and can be shared between threads. It uses internal locking when needed.

It is also safe to clone the Sdk.

§Examples

See tests/ for examples of using the SDK.

Fields§

§network: Network

The network that the sdk is configured for (Dash (mainnet), Testnet, Devnet, Regtest)

Implementations§

Source§

impl Sdk

Source

pub async fn start_instant_send_lock_stream( &self, from_block_hash: Vec<u8>, address: &Address, ) -> Result<Streaming<TransactionsWithProofsResponse>, Error>

Starts the stream to listen for instant send lock messages

Source

pub async fn wait_for_asset_lock_proof_for_transaction( &self, stream: Streaming<TransactionsWithProofsResponse>, transaction: &Transaction, time_out: Option<Duration>, ) -> Result<AssetLockProof, Error>

Waits for a response for the asset lock proof

Source§

impl Sdk

Source

pub async fn sync_address_balances<P: AddressProvider>( &self, provider: &mut P, config: Option<AddressSyncConfig>, last_sync_timestamp: Option<u64>, ) -> Result<AddressSyncResult, Error>

Synchronize address balances using privacy-preserving trunk/branch chunk queries with incremental block-based catch-up.

This method discovers address balances for addresses supplied by the provider, using an iterative query process that fetches chunks of the address tree rather than individual addresses. This provides privacy by making it unclear which specific addresses are being queried.

After the tree scan, incremental catch-up fetches balance changes from the checkpoint height to chain tip so the result is as fresh as possible.

On subsequent calls, pass AddressSyncResult::new_sync_timestamp as last_sync_timestamp so the function can decide whether a full tree rescan is needed or incremental-only catch-up suffices. The provider should implement AddressProvider::last_sync_height (returning the stored AddressSyncResult::new_sync_height) and AddressProvider::current_balances to supply state from the previous sync.

§Arguments
  • provider: An implementation of AddressProvider that supplies addresses and handles callbacks when addresses are found or proven absent.
  • config: Optional configuration; uses defaults if None.
  • last_sync_timestamp: Optional block time (Unix seconds) from the previous sync’s AddressSyncResult::new_sync_timestamp. Pass None to always perform a full tree scan.
§Returns
  • Ok(AddressSyncResult): Contains found addresses with balances/nonces, absent addresses, new_sync_height and new_sync_timestamp to store for the next call.
  • Err(Error): If the sync fails after exhausting retries.
§Example
use dash_sdk::{Sdk, platform::address_sync::{AddressProvider, AddressSyncConfig}};

// First sync — full tree scan + catch-up (no timestamp)
let result = sdk.sync_address_balances(&mut wallet, None, None).await?;
let saved_height = result.new_sync_height;       // → provider.last_sync_height()
let saved_timestamp = result.new_sync_timestamp;  // → last_sync_timestamp param

// Subsequent sync — incremental only if within threshold
let result = sdk.sync_address_balances(&mut wallet, None, Some(saved_timestamp)).await?;
Source§

impl Sdk

Source

pub async fn create_contact_request<F, Fut, G, Gut, H, Hut>( &self, input: ContactRequestInput, ecdh_provider: EcdhProvider<F, Fut, G, Gut>, get_extended_public_key: H, ) -> Result<ContactRequestResult, Error>
where F: FnOnce(&IdentityPublicKey, u32) -> Fut, Fut: Future<Output = Result<SecretKey, Error>>, G: FnOnce(&PublicKey) -> Gut, Gut: Future<Output = Result<[u8; 32], Error>>, H: FnOnce(u32) -> Hut, Hut: Future<Output = Result<Vec<u8>, Error>>,

Create a contact request document

This creates a local contact request document according to DIP-15 specification. The document is not yet submitted to the platform. This method automatically handles ECDH key derivation and encryption of the extended public key and account label.

§Arguments
  • input - The contact request input containing sender/recipient information and unencrypted data
  • ecdh_provider - Provider for ECDH key exchange (client-side or SDK-side)
  • get_extended_public_key - Async function to retrieve the extended public key to share with recipient
    • Parameters: (account_reference: u32)
    • Returns: The unencrypted extended public key bytes (typically 78 bytes)
§Returns

Returns a ContactRequestResult containing the created document

§Errors

Returns an error if:

  • The DashPay contract cannot be fetched
  • The contactRequest document type is not found
  • The sender or recipient doesn’t have the required encryption keys
  • ECDH encryption fails
  • The shared secret, private key, or extended public key cannot be retrieved
Source

pub async fn send_contact_request<S: Signer<IdentityPublicKey>, F, Fut, G, Gut, H, Hut>( &self, input: SendContactRequestInput<S>, ecdh_provider: EcdhProvider<F, Fut, G, Gut>, get_extended_public_key: H, ) -> Result<SendContactRequestResult, Error>
where F: FnOnce(&IdentityPublicKey, u32) -> Fut, Fut: Future<Output = Result<SecretKey, Error>>, G: FnOnce(&PublicKey) -> Gut, Gut: Future<Output = Result<[u8; 32], Error>>, H: FnOnce(u32) -> Hut, Hut: Future<Output = Result<Vec<u8>, Error>>,

Send a contact request to the platform

This creates a contact request document with automatic ECDH encryption and submits it to the platform as a state transition.

§Arguments
  • input - The send contact request input containing document data, key, and signer
  • ecdh_provider - Provider for ECDH key exchange (client-side or SDK-side)
  • get_extended_public_key - Async function to retrieve the extended public key to share with recipient
    • Parameters: (account_reference: u32)
    • Returns: The unencrypted extended public key bytes (typically 78 bytes)
§Returns

Returns a SendContactRequestResult containing the submitted document

§Errors

Returns an error if:

  • Document creation fails (including ECDH encryption)
  • State transition submission fails
Source§

impl Sdk

Source

pub async fn fetch_sent_contact_requests( &self, identity_id: Identifier, limit: Option<u32>, ) -> Result<ContactRequestDocuments, Error>

Fetch all contact requests sent by a specific identity

This queries the DashPay contract for contactRequest documents where the given identity is the owner (sender).

§Arguments
  • identity_id - The identity ID of the sender
  • limit - Maximum number of contact requests to fetch (default: 100)
§Returns

Returns a map of document IDs to optional contact request documents

Source

pub async fn fetch_received_contact_requests( &self, identity_id: Identifier, limit: Option<u32>, ) -> Result<ContactRequestDocuments, Error>

Fetch all contact requests received by a specific identity

This queries the DashPay contract for contactRequest documents where the given identity is the recipient (toUserId field).

§Arguments
  • identity_id - The identity ID of the recipient
  • limit - Maximum number of contact requests to fetch (default: 100)
§Returns

Returns a map of document IDs to optional contact request documents

Source

pub async fn fetch_all_contact_requests_for_identity( &self, identity: &Identity, limit: Option<u32>, ) -> Result<(ContactRequestDocuments, ContactRequestDocuments), Error>

Fetch all contact requests for a specific identity (both sent and received)

This is a convenience method that fetches both sent and received contact requests for a given identity.

§Arguments
  • identity - The identity to fetch contact requests for
  • limit - Maximum number of contact requests to fetch per query (default: 100)
§Returns

Returns a tuple of (sent_requests, received_requests)

Source§

impl Sdk

Source

pub async fn document_create<S: Signer<IdentityPublicKey>>( &self, create_document_transition_builder: DocumentCreateTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DocumentCreateResult, Error>

Creates a new document on the platform.

This method broadcasts a document creation transition to add a new document to the specified data contract. The result contains the created document.

§Arguments
  • create_document_transition_builder - Builder containing document creation parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DocumentCreateResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Document validation fails
Source§

impl Sdk

Source

pub async fn document_delete<S: Signer<IdentityPublicKey>>( &self, delete_document_transition_builder: DocumentDeleteTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DocumentDeleteResult, Error>

Deletes an existing document from the platform.

This method broadcasts a document deletion transition to permanently remove a document from the platform. The result confirms the deletion.

§Arguments
  • delete_document_transition_builder - Builder containing document deletion parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DocumentDeleteResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Document not found or already deleted
  • Insufficient permissions to delete the document
Source§

impl Sdk

Source

pub async fn document_purchase<S: Signer<IdentityPublicKey>>( &self, purchase_document_transition_builder: DocumentPurchaseTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DocumentPurchaseResult, Error>

Purchases a document from its current owner.

This method broadcasts a document purchase transition to buy a document at its set price and transfer ownership to the purchaser. The result contains the purchased document with updated ownership.

§Arguments
  • purchase_document_transition_builder - Builder containing purchase parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DocumentPurchaseResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Document not found or not for sale
  • Insufficient funds to complete the purchase
  • Price mismatch (document price changed)
  • Invalid purchaser identity
Source§

impl Sdk

Source

pub async fn document_replace<S: Signer<IdentityPublicKey>>( &self, replace_document_transition_builder: DocumentReplaceTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DocumentReplaceResult, Error>

Replaces an existing document on the platform.

This method broadcasts a document replacement transition to update an existing document with new data. The result contains the updated document.

§Arguments
  • replace_document_transition_builder - Builder containing document replacement parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DocumentReplaceResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Document validation fails
  • Document not found or revision mismatch
Source§

impl Sdk

Source

pub async fn document_set_price<S: Signer<IdentityPublicKey>>( &self, set_price_document_transition_builder: DocumentSetPriceTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DocumentSetPriceResult, Error>

Sets the price for a document on the platform.

This method broadcasts a document price update transition to set or change the price of an existing document. The result contains the updated document.

§Arguments
  • set_price_document_transition_builder - Builder containing price update parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DocumentSetPriceResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Document not found
  • Insufficient permissions to set price
  • Invalid price value
Source§

impl Sdk

Source

pub async fn document_transfer<S: Signer<IdentityPublicKey>>( &self, transfer_document_transition_builder: DocumentTransferTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DocumentTransferResult, Error>

Transfers ownership of a document to another identity.

This method broadcasts a document transfer transition to change the ownership of an existing document to a new identity. The result contains the transferred document.

§Arguments
  • transfer_document_transition_builder - Builder containing transfer parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DocumentTransferResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Document not found
  • Insufficient permissions to transfer the document
  • Invalid recipient identity
Source§

impl Sdk

Source

pub async fn get_contested_dpns_normalized_usernames( &self, limit: Option<u32>, start_after: Option<String>, ) -> Result<Vec<String>, Error>

Get all contested DPNS usernames

§Arguments
  • limit - Maximum number of results to return
  • start_after - Optional name to start after (for pagination)
§Returns

Returns a list of contested DPNS usernames

Source

pub async fn get_contested_dpns_vote_state( &self, label: &str, limit: Option<u32>, ) -> Result<Contenders, Error>

Get the vote state for a contested DPNS username

§Arguments
  • label - The username label to check (e.g., “alice”)
  • limit - Maximum number of contenders to return
§Returns

Returns the contenders and their vote counts for the username

Source

pub async fn get_contested_dpns_voters_for_identity( &self, label: &str, contestant_id: Identifier, limit: Option<u32>, ) -> Result<(), Error>

Get voters who voted for a specific identity for a contested DPNS username

§Arguments
  • label - The username label (e.g., “alice”)
  • contestant_id - The identity ID of the contestant
  • limit - Maximum number of voters to return
§Returns

Returns the list of masternode voters who voted for this contestant

Source

pub async fn get_contested_dpns_identity_votes( &self, identity_id: Identifier, limit: Option<u32>, offset: Option<u16>, ) -> Result<Vec<ContestedDpnsUsername>, Error>

Get all contested DPNS usernames that an identity has voted on

§Arguments
  • identity_id - The identity ID (typically a masternode ProTxHash)
  • limit - Maximum number of votes to return
  • offset - Offset for pagination
§Returns

Returns the list of contested DPNS usernames this identity has voted on

Source

pub async fn get_contested_dpns_usernames_by_identity( &self, identity_id: Identifier, limit: Option<u32>, ) -> Result<Vec<ContestedDpnsUsername>, Error>

Get all contested DPNS usernames where an identity is a contender

§Arguments
  • identity_id - The identity ID to search for
  • limit - Maximum number of results to return
§Returns

Returns the list of contested DPNS usernames where this identity is competing

Source

pub async fn get_contested_non_resolved_usernames( &self, limit: Option<u32>, ) -> Result<BTreeMap<String, ContestInfo>, Error>

Get contested usernames that are not yet resolved

This method fetches all currently contested DPNS usernames that haven’t been resolved yet. It gets current contests and returns the contenders and end time for each unresolved name.

§Arguments
  • limit - Maximum number of results to return
§Returns

Returns a map of contested but unresolved DPNS usernames to their contest info (contenders and end time)

Source

pub async fn get_non_resolved_dpns_contests_for_identity( &self, identity_id: Identifier, limit: Option<u32>, ) -> Result<BTreeMap<String, ContestInfo>, Error>

Get non-resolved DPNS contests for a specific identity

This method fetches all currently contested DPNS usernames that haven’t been resolved yet and filters them to only include contests where the specified identity is a contender.

§Arguments
  • identity_id - The identity ID to filter contests for
  • limit - Maximum number of results to return
§Returns

Returns a map of contested but unresolved DPNS usernames (where the identity is a contender) to their contenders

Source

pub async fn get_current_dpns_contests( &self, start_time: Option<TimestampMillis>, end_time: Option<TimestampMillis>, limit: Option<u16>, ) -> Result<BTreeMap<String, TimestampMillis>, Error>

Get current DPNS contests (active vote polls)

This method fetches all currently active DPNS username contests by querying vote polls by their end date. It automatically paginates through all results if there are more than the limit.

§Arguments
  • start_time - Optional start time to filter contests (in milliseconds)
  • end_time - Optional end time to filter contests (in milliseconds)
  • limit - Maximum number of results per query (defaults to 100)
§Returns

Returns a map of contested DPNS names to their end timestamps

Source§

impl Sdk

Source

pub async fn get_dpns_usernames_by_identity( &self, identity_id: Identifier, limit: Option<u32>, ) -> Result<Vec<DpnsUsername>, Error>

Get DPNS usernames owned by a specific identity

This searches for domains where the identity is listed in records.identity. Note: This does not search for domains owned by the identity (no index on $ownerId)

§Arguments
  • identity_id - The identity ID to search for
  • limit - Maximum number of results to return (default: 10)
§Returns

Returns a list of DPNS usernames associated with the identity

Source

pub async fn check_dpns_name_availability( &self, label: &str, ) -> Result<bool, Error>

Check if a DPNS username is available

§Arguments
  • label - The username label to check (e.g., “alice”)
§Returns

Returns true if the username is available, false if it’s taken

Source

pub async fn resolve_dpns_name_to_identity( &self, name: &str, ) -> Result<Option<Identifier>, Error>

Resolve a DPNS name to an identity ID

§Arguments
  • name - The full domain name (e.g., “alice.dash”) or just the label (e.g., “alice”)
§Returns

Returns the identity ID associated with the domain, or None if not found

Source

pub async fn search_dpns_names( &self, prefix: &str, limit: Option<u32>, ) -> Result<Vec<DpnsUsername>, Error>

Search for DPNS names that start with a given prefix

§Arguments
  • prefix - The prefix to search for (e.g., “ali” to find “alice”, “alicia”, etc.)
  • limit - Maximum number of results to return (default: 10)
§Returns

Returns a list of DPNS usernames that match the prefix

Source§

impl Sdk

Source

pub async fn register_dpns_name<S: Signer<IdentityPublicKey>>( &self, input: RegisterDpnsNameInput<S>, ) -> Result<RegisterDpnsNameResult, Error>

Register a DPNS username in a single operation

This method handles both the preorder and domain registration steps automatically. It generates the necessary entropy, creates both documents, and submits them in order.

§Arguments
  • input - The registration input containing label, identity, public key, and signer
§Returns

Returns a RegisterDpnsNameResult containing both created documents and the full domain name

§Errors

Returns an error if:

  • The DPNS contract cannot be fetched
  • Document types are not found in the contract
  • Document creation or submission fails
Source

pub async fn is_dpns_name_available(&self, label: &str) -> Result<bool, Error>

Check if a DPNS name is available

§Arguments
  • label - The username label to check (e.g., “alice”)
§Returns

Returns true if the name is available, false if it’s taken

Source

pub async fn resolve_dpns_name( &self, name: &str, ) -> Result<Option<Identifier>, Error>

Resolve a DPNS name to an identity ID

§Arguments
  • name - The full domain name (e.g., “alice.dash”) or just the label (e.g., “alice”)
§Returns

Returns the identity ID associated with the domain, or None if not found

Source§

impl Sdk

Source

pub async fn sync_nullifiers<P: NullifierProvider>( &self, provider: &P, config: Option<NullifierSyncConfig>, last_sync: Option<NullifierSyncCheckpoint>, ) -> Result<NullifierSyncResult, Error>

Synchronize nullifier statuses with incremental catch-up support.

This is the main entry point for nullifier synchronization. It handles both full tree scans and incremental block-based catch-up, depending on the parameters.

On subsequent calls, construct a NullifierSyncCheckpoint from the previous NullifierSyncResult::new_sync_height and NullifierSyncResult::new_sync_timestamp so the function can decide whether a full tree rescan is needed or incremental-only catch-up suffices.

§Arguments
  • provider: An implementation of NullifierProvider that supplies nullifier keys.
  • config: Optional configuration; uses defaults if None.
  • last_sync: Optional checkpoint from the previous sync. Pass None to always perform a full tree scan.
§Returns
  • Ok(NullifierSyncResult): Contains found (spent) and absent (unspent) nullifiers, new_sync_height and new_sync_timestamp to store for the next call.
  • Err(Error): If the sync fails after exhausting retries.
§Example
use dash_sdk::Sdk;
use dash_sdk::platform::nullifier_sync::NullifierSyncCheckpoint;

let sdk = Sdk::new(/* ... */);
let nullifiers: Vec<[u8; 32]> = vec![/* known nullifiers */];

// First call — full scan
let result = sdk.sync_nullifiers(&nullifiers, None, None).await?;
let checkpoint = NullifierSyncCheckpoint {
    height: result.new_sync_height,
    timestamp: result.new_sync_timestamp,
};

// Next call — incremental only if within threshold
let result = sdk.sync_nullifiers(&nullifiers, None, Some(checkpoint)).await?;
Source§

impl Sdk

Source

pub async fn token_burn<S: Signer<IdentityPublicKey>>( &self, burn_tokens_transition_builder: TokenBurnTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<BurnResult, Error>

Burns tokens to permanently remove them from circulation.

This method broadcasts a burn transition to destroy a specified amount of tokens. The result varies based on token configuration:

  • Standard tokens return the owner’s remaining balance
  • Tokens with history tracking return documents
  • Group-managed tokens include group power and action status
§Arguments
  • burn_tokens_transition_builder - Builder containing burn parameters including amount
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a BurnResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Insufficient token balance for burning
Source§

impl Sdk

Source

pub async fn token_claim<S: Signer<IdentityPublicKey>>( &self, claim_tokens_transition_builder: TokenClaimTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<ClaimResult, Error>

Claims tokens for a specific identity.

This method broadcasts a claim transition to acquire ownership of tokens that have been allocated or made available for claiming. The result includes a document that records the claim details.

§Arguments
  • claim_tokens_transition_builder - Builder containing claim parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a ClaimResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • A group action result is missing the expected document
Source§

impl Sdk

Source

pub async fn token_update_contract_token_configuration<S: Signer<IdentityPublicKey>>( &self, config_update_transition_builder: TokenConfigUpdateTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<ConfigUpdateResult, Error>

Updates the configuration of a token contract.

This method broadcasts a configuration update transition to modify token settings such as minting rules, transfer restrictions, or other contract parameters. The result always includes a document with the updated configuration details.

§Arguments
  • config_update_transition_builder - Builder containing configuration update parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a ConfigUpdateResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • A group action result is missing the expected document
Source§

impl Sdk

Source

pub async fn token_destroy_frozen_funds<S: Signer<IdentityPublicKey>>( &self, destroy_frozen_funds_transition_builder: TokenDestroyFrozenFundsTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DestroyFrozenFundsResult, Error>

Destroys frozen tokens permanently.

This method broadcasts a destroy frozen funds transition to permanently remove frozen tokens from circulation. This operation always maintains a historical record of the destruction.

§Arguments
  • destroy_frozen_funds_transition_builder - Builder containing destruction parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DestroyFrozenFundsResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
Source§

impl Sdk

Source

pub async fn token_purchase<S: Signer<IdentityPublicKey>>( &self, purchase_tokens_transition_builder: TokenDirectPurchaseTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<DirectPurchaseResult, Error>

Purchases tokens directly at the configured price.

This method broadcasts a direct purchase transition to buy tokens at the price set by the token owner. The purchase uses platform credits as payment. The result varies based on token configuration:

  • Standard tokens return the purchaser’s new balance
  • Tokens with history tracking return documents
  • Group-managed tokens include group power information
§Arguments
  • purchase_tokens_transition_builder - Builder containing purchase parameters including amount
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a DirectPurchaseResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • Insufficient credits for the purchase
Source§

impl Sdk

Source

pub async fn token_emergency_action<S: Signer<IdentityPublicKey>>( &self, emergency_action_transition_builder: TokenEmergencyActionTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<EmergencyActionResult, Error>

Executes an emergency action on a token contract.

This method broadcasts an emergency action transition for critical token management operations that require group authorization. Emergency actions are typically used for scenarios like halting trading, recovering from critical bugs, or other urgent interventions.

§Arguments
  • emergency_action_transition_builder - Builder containing emergency action parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing an EmergencyActionResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
  • The group authorization is insufficient
Source§

impl Sdk

Source

pub async fn token_freeze<S: Signer<IdentityPublicKey>>( &self, freeze_tokens_transition_builder: TokenFreezeTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<FreezeResult, Error>

Freezes tokens for a specific identity.

This method broadcasts a freeze transition to temporarily lock tokens, preventing their transfer until they are unfrozen. The result varies based on token configuration:

  • Standard tokens return identity info
  • Tokens with history tracking return documents
  • Group-managed tokens include group power information
§Arguments
  • freeze_tokens_transition_builder - Builder containing freeze parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a FreezeResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
Source§

impl Sdk

Source

pub async fn token_mint<S: Signer<IdentityPublicKey>>( &self, mint_tokens_transition_builder: TokenMintTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<MintResult, Error>

Mints new tokens according to the token’s configuration.

This method broadcasts a mint transition to create new tokens and allocate them to the specified recipient. The result varies based on token configuration:

  • Standard tokens return the recipient’s new balance
  • Tokens with history tracking return documents
  • Group-managed tokens include group power and action status
§Arguments
  • mint_tokens_transition_builder - Builder containing mint parameters including amount and recipient
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a MintResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
Source§

impl Sdk

Source

pub async fn token_set_price_for_direct_purchase<S: Signer<IdentityPublicKey>>( &self, set_price_transition_builder: TokenChangeDirectPurchasePriceTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<SetPriceResult, Error>

Sets or updates the pricing schedule for direct token purchases.

This method broadcasts a set price transition to define how tokens can be purchased directly. The pricing schedule can include fixed prices or dynamic pricing rules. The result varies based on token configuration:

  • Standard tokens return the pricing schedule
  • Tokens with history tracking return documents
  • Group-managed tokens include group power and action status
§Arguments
  • set_price_transition_builder - Builder containing pricing parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a SetPriceResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
Source§

impl Sdk

Source

pub async fn token_transfer<S: Signer<IdentityPublicKey>>( &self, transfer_tokens_transition_builder: TokenTransferTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<TransferResult, Error>

Transfers tokens from one identity to another.

This method broadcasts a transfer transition to move tokens between identities. The result varies based on token configuration:

  • Standard tokens return updated balances for the affected identities
  • Tokens with history tracking return documents
  • Group-managed tokens include group power information
§Arguments
  • transfer_tokens_transition_builder - Builder containing transfer parameters including recipient and amount
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing a TransferResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
Source§

impl Sdk

Source

pub async fn token_unfreeze_identity<S: Signer<IdentityPublicKey>>( &self, unfreeze_tokens_transition_builder: TokenUnfreezeTransitionBuilder, signing_key: &IdentityPublicKey, signer: &S, ) -> Result<UnfreezeResult, Error>

Unfreezes tokens for a specific identity.

This method broadcasts an unfreeze transition to restore transfer capabilities for previously frozen tokens. The result varies based on token configuration:

  • Standard tokens return identity info
  • Tokens with history tracking return documents
  • Group-managed tokens include group power information
§Arguments
  • unfreeze_tokens_transition_builder - Builder containing unfreeze parameters
  • signing_key - The identity public key for signing the transition
  • signer - Implementation of the Signer trait for cryptographic signing
§Returns

Returns a Result containing an UnfreezeResult on success, or an Error on failure.

§Errors

This function will return an error if:

  • The transition signing fails
  • Broadcasting the transition fails
  • The proof verification returns an unexpected result type
Source§

impl Sdk

Source

pub fn new_mock() -> Self

Initialize Dash Platform SDK in mock mode.

This is a helper method that uses SdkBuilder to initialize the SDK in mock mode.

See also SdkBuilder.

Source

pub fn verify_response_metadata( &self, method_name: &str, metadata: &ResponseMetadata, ) -> Result<(), Error>

Verify response metadata against the current state of the SDK.

Source

pub fn context_provider(&self) -> Option<impl ContextProvider>

Return ContextProvider used by the SDK.

Source

pub fn mock(&mut self) -> MutexGuard<'_, MockDashPlatformSdk>

Returns a mutable reference to the MockDashPlatformSdk instance.

Use returned object to configure mock responses with methods like expect_fetch.

§Panics

Panics when:

  • the self instance is not a Mock variant,
  • the self instance is in use by another thread.
Source

pub async fn get_identity_nonce( &self, identity_id: Identifier, bump_first: bool, settings: Option<PutSettings>, ) -> Result<IdentityNonce, Error>

Get or fetch identity nonce, querying Platform when stale or absent. Treats a missing nonce as 0 before applying the optional bump; on first interaction this may return 0 or 1 depending on bump_first. Does not verify identity existence.

Source

pub async fn get_identity_contract_nonce( &self, identity_id: Identifier, contract_id: Identifier, bump_first: bool, settings: Option<PutSettings>, ) -> Result<IdentityNonce, Error>

Get or fetch identity-contract nonce, querying Platform when stale or absent. Treats a missing nonce as 0 before applying the optional bump; on first interaction this may return 0 or 1 depending on bump_first. Does not verify identity or contract existence.

Source

pub async fn refresh_identity_nonce(&self, identity_id: &Identifier)

Marks identity nonce cache entries as stale so they are re-fetched from Platform on the next call to [get_identity_nonce] or [get_identity_contract_nonce].

Source

pub fn version<'v>(&self) -> &'v PlatformVersion

Return Dash Platform version information used by this SDK.

This is the version configured in SdkBuilder. Useful whenever you need to provide PlatformVersion to other SDK and DPP methods.

Source

pub fn prove(&self) -> bool

Indicate if the sdk should request and verify proofs.

Source

pub fn set_context_provider<C: ContextProvider + 'static>( &self, context_provider: C, )

Set the ContextProvider to use.

ContextProvider is used to access state information, like data contracts and quorum public keys.

Note that this will overwrite any previous context provider.

Source

pub fn cancelled(&self) -> WaitForCancellationFuture<'_>

Returns a future that resolves when the Sdk is cancelled (e.g. shutdown was requested).

Source

pub fn shutdown(&self)

Request shutdown of the Sdk and all related operations.

Source

pub fn address_list(&self) -> &AddressList

Return the DapiClient address list

Trait Implementations§

Source§

impl Clone for Sdk

Source§

fn clone(&self) -> Self

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 DapiRequestExecutor for Sdk

Source§

fn execute<'life0, 'async_trait, R>( &'life0 self, request: R, settings: RequestSettings, ) -> Pin<Box<dyn Future<Output = ExecutionResult<R::Response, DapiClientError>> + Send + 'async_trait>>
where R: 'async_trait + TransportRequest, Self: 'async_trait, 'life0: 'async_trait,

Execute request using this DAPI client.
Source§

impl Debug for Sdk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ShieldFromAssetLock for Sdk

Source§

fn shield_from_asset_lock<'life0, 'life1, 'async_trait>( &'life0 self, asset_lock_proof: AssetLockProof, asset_lock_proof_private_key: &'life1 [u8], bundle: OrchardBundleParams, value_balance: u64, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Shield funds from an L1 asset lock into the shielded pool. The asset lock proof proves ownership of L1 funds, and the ECDSA signature binds those funds to this specific Orchard bundle.
Source§

impl<S: Signer<PlatformAddress>> ShieldFunds<S> for Sdk

Source§

fn shield_funds<'life0, 'life1, 'async_trait>( &'life0 self, inputs: BTreeMap<PlatformAddress, Credits>, bundle: OrchardBundleParams, amount: u64, fee_strategy: AddressFundsFeeStrategy, signer: &'life1 S, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Shield funds from platform addresses into the shielded pool. Address nonces are fetched automatically.
Source§

fn shield_funds_with_nonce<'life0, 'life1, 'async_trait>( &'life0 self, inputs: BTreeMap<PlatformAddress, (AddressNonce, Credits)>, bundle: OrchardBundleParams, amount: u64, fee_strategy: AddressFundsFeeStrategy, signer: &'life1 S, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Shield funds with explicitly provided address nonces.
Source§

impl<S: Signer<PlatformAddress>> TransferAddressFunds<S> for Sdk

Source§

fn transfer_address_funds<'life0, 'life1, 'async_trait>( &'life0 self, inputs: BTreeMap<PlatformAddress, Credits>, outputs: BTreeMap<PlatformAddress, Credits>, fee_strategy: AddressFundsFeeStrategy, signer: &'life1 S, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<AddressInfos, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcast address funds transfer (nonces looked up automatically) and return refreshed balances.
Source§

fn transfer_address_funds_with_nonce<'life0, 'life1, 'async_trait>( &'life0 self, inputs: BTreeMap<PlatformAddress, (AddressNonce, Credits)>, outputs: BTreeMap<PlatformAddress, Credits>, fee_strategy: AddressFundsFeeStrategy, signer: &'life1 S, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<AddressInfos, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcast address funds transfer with explicitly provided address nonces. Read more
Source§

impl TransferShielded for Sdk

Source§

fn transfer_shielded<'life0, 'async_trait>( &'life0 self, bundle: OrchardBundleParams, value_balance: u64, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transfer funds within the shielded pool. Authentication is via Orchard spend authorization signatures in the bundle actions.
Source§

impl UnshieldFunds for Sdk

Source§

fn unshield_funds<'life0, 'async_trait>( &'life0 self, output_address: PlatformAddress, unshielding_amount: u64, bundle: OrchardBundleParams, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unshield funds from the shielded pool to a platform address. Authentication is via Orchard spend authorization signatures in the bundle actions.
Source§

impl<S: Signer<PlatformAddress>> WithdrawAddressFunds<S> for Sdk

Source§

fn withdraw_address_funds<'life0, 'life1, 'async_trait>( &'life0 self, inputs: BTreeMap<PlatformAddress, Credits>, change_output: Option<(PlatformAddress, Credits)>, fee_strategy: AddressFundsFeeStrategy, core_fee_per_byte: u32, pooling: Pooling, output_script: CoreScript, signer: &'life1 S, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<AddressInfos, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Withdraws address balances (nonces fetched automatically).
Source§

fn withdraw_address_funds_with_nonce<'life0, 'life1, 'async_trait>( &'life0 self, inputs: BTreeMap<PlatformAddress, (AddressNonce, Credits)>, change_output: Option<(PlatformAddress, Credits)>, fee_strategy: AddressFundsFeeStrategy, core_fee_per_byte: u32, pooling: Pooling, output_script: CoreScript, signer: &'life1 S, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<AddressInfos, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Withdraws address balances with explicitly provided nonces. Read more
Source§

impl WithdrawShielded for Sdk

Source§

fn withdraw_shielded<'life0, 'async_trait>( &'life0 self, unshielding_amount: u64, bundle: OrchardBundleParams, core_fee_per_byte: u32, pooling: Pooling, output_script: CoreScript, settings: Option<PutSettings>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Withdraw funds from the shielded pool to a Core address. Authentication is via Orchard spend authorization signatures in the bundle actions.

Auto Trait Implementations§

§

impl !Freeze for Sdk

§

impl !RefUnwindSafe for Sdk

§

impl Send for Sdk

§

impl Sync for Sdk

§

impl Unpin for Sdk

§

impl !UnwindSafe for Sdk

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
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> CostsExt for T

§

fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>
where Self: Sized,

Wraps any value into a CostContext object with provided costs.
§

fn wrap_fn_cost( self, f: impl FnOnce(&Self) -> OperationCost, ) -> CostContext<Self>
where Self: Sized,

Wraps any value into CostContext object with costs computed using the value getting wrapped.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, U> IntoOnNetwork<U> for T
where U: FromOnNetwork<T>,

§

fn into_on_network(self, network: Network) -> U

Calls U::from_on_network(self).

Source§

impl<T, U> IntoPlatformVersioned<U> for T

Source§

fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U

Performs the conversion.
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
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
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. 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.
§

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

§

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

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

fn try_from_versioned( value: U, _grove_version: &GroveVersion, ) -> Result<T, <T as TryFromVersioned<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<T, U> TryIntoPlatformVersioned<U> for T

Source§

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

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

fn try_into_platform_versioned( self, platform_version: &PlatformVersion, ) -> Result<U, <U as TryFromPlatformVersioned<T>>::Error>

Performs the conversion.
§

impl<T, U> TryIntoVersioned<U> for T
where U: TryFromVersioned<T>,

§

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

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

fn try_into_versioned( self, grove_version: &GroveVersion, ) -> Result<U, <U as TryFromVersioned<T>>::Error>

Performs the conversion.
§

impl<T, U> TryIntoWithBlockHashLookup<U> for T
where U: TryFromWithBlockHashLookup<T>,

§

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

§

fn try_into_with_block_hash_lookup<F>( self, block_hash_lookup: F, network: Network, ) -> Result<U, <T as TryIntoWithBlockHashLookup<U>>::Error>
where F: Fn(&BlockHash) -> Option<u32>,

Converts self into T, using a block hash lookup function.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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