Struct casper_rust_wasm_sdk::SDK

source ·
pub struct SDK { /* private fields */ }

Implementations§

source§

impl SDK

source

pub async fn deploy( &self, deploy_params: DeployStrParams, session_params: SessionStrParams, payment_params: PaymentStrParams, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutDeployResult>, SdkError>

Perform a deploy operation.

§Arguments
  • deploy_params - Deploy parameters.
  • session_params - Session parameters.
  • payment_params - Payment parameters.
  • verbosity - An optional verbosity level.
  • rpc_address - An optional rpc address.
§Returns

A result containing a SuccessResponse<_PutDeployResult> or an SdkError.

source§

impl SDK

source

pub async fn speculative_deploy( &self, deploy_params: DeployStrParams, session_params: SessionStrParams, payment_params: PaymentStrParams, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_SpeculativeExecResult>, SdkError>

👎Deprecated: prefer speculative_transaction

This function allows executing a deploy speculatively.

§Arguments
  • deploy_params - Deployment parameters for the deploy.
  • session_params - Session parameters for the deploy.
  • payment_params - Payment parameters for the deploy.
  • verbosity - Optional verbosity level.
  • rpc_address - Optional rpc address.
§Returns

A Result containing either a SuccessResponse<_SpeculativeExecResult> or a SdkError in case of an error.

source§

impl SDK

source

pub async fn speculative_transfer( &self, amount: &str, target_account: &str, transfer_id: Option<String>, deploy_params: DeployStrParams, payment_params: PaymentStrParams, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_SpeculativeExecResult>, SdkError>

👎Deprecated: prefer speculative_transfer_transaction

Perform a speculative transfer.

§Arguments
  • amount - The amount to transfer.
  • target_account - The target account.
  • transfer_id - An optional transfer ID (defaults to a random number).
  • deploy_params - The deployment parameters.
  • payment_params - The payment parameters.
  • verbosity - The verbosity level for logging (optional).
  • rpc_address - The address of the node to connect to (optional).
§Returns

A Result containing the result a SuccessResponse<_SpeculativeExecResult> or a SdkError in case of an error.

source§

impl SDK

source

pub async fn transfer( &self, amount: &str, target_account: &str, transfer_id: Option<String>, deploy_params: DeployStrParams, payment_params: PaymentStrParams, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutDeployResult>, SdkError>

👎Deprecated: prefer transfer_transaction

Perform a transfer of funds.

§Arguments
  • amount - The amount to transfer.
  • target_account - The target account.
  • transfer_id - An optional transfer ID (defaults to a random number).
  • deploy_params - The deployment parameters.
  • payment_params - The payment parameters.
  • verbosity - The verbosity level for logging (optional).
  • rpc_address - The address of the node to connect to (optional).
§Returns

A Result containing the result a SuccessResponse<_PutDeployResult> of the transfer or a SdkError in case of an error.

source§

impl SDK

source

pub async fn get_account( &self, account_identifier: Option<AccountIdentifier>, account_identifier_as_string: Option<String>, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetAccountResult>, SdkError>

👎Deprecated: prefer ‘get_entity’

Retrieves account information based on the provided options.

§Arguments
  • account_identifier - An optional AccountIdentifier for specifying the account identifier.
  • account_identifier_as_string - An optional string representing the account identifier.
  • maybe_block_identifier - An optional BlockIdentifierInput for specifying a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a SuccessResponse<_GetAccountResult> or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_auction_info( &self, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetAuctionInfoResult>, SdkError>

Retrieves auction information based on the provided options.

§Arguments
  • maybe_block_identifier - An optional BlockIdentifierInput for specifying a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetAuctionInfoResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_balance( &self, state_root_hash: impl ToDigest, purse_uref: GetBalanceInput, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetBalanceResult>, SdkError>

Retrieves balance information based on the provided options.

§Arguments
  • state_root_hash - The state root hash to query for balance information.
  • purse_uref - The purse uref specifying the purse for which to retrieve the balance.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a GetBalanceResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_block( &self, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetBlockResult>, SdkError>

Retrieves block information using the provided options.

§Arguments
  • maybe_block_identifier - An optional BlockIdentifierInput specifying the block identifier.
  • verbosity - An optional Verbosity level for the retrieval.
  • rpc_address - An optional rpc address to target for retrieval.
§Returns

A Result containing either a _GetBlockResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_block_transfers( &self, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetBlockTransfersResult>, SdkError>

Retrieves block transfers information based on the provided options.

§Arguments
  • maybe_block_identifier - An optional BlockIdentifierInput specifying the block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetBlockTransfersResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

Implementations for the SDK struct.

source

pub async fn get_chainspec( &self, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetChainspecResult>, Error>

Asynchronously retrieves the chainspec.

§Arguments
  • verbosity - An optional Verbosity parameter.
  • rpc_address - An optional rpc address as a string.
§Returns

A Result containing either a _GetChainspecResult or a SdkError in case of an error.

source§

impl SDK

source

pub async fn get_deploy( &self, deploy_hash: DeployHash, finalized_approvals: Option<bool>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetDeployResult>, Error>

👎Deprecated: prefer ‘get_transaction’

Retrieves deploy information based on the provided options.

§Arguments
  • deploy_hash - The deploy hash.
  • finalized_approvals - An optional boolean indicating finalized approvals.
  • verbosity - An optional verbosity level.
  • rpc_address - An optional rpc address.
§Returns

A Result containing either a _GetDeployResult or an error.

source§

impl SDK

source

pub async fn get_dictionary_item( &self, state_root_hash: impl ToDigest, dictionary_item_input: DictionaryItemInput, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetDictionaryItemResult>, SdkError>

Retrieves dictionary item information based on the provided options.

§Arguments
  • state_root_hash - A ToDigest implementation for specifying the state root hash.
  • dictionary_item - A DictionaryItemInput enum specifying the dictionary item to retrieve.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetDictionaryItemResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_entity( &self, entity_identifier: Option<EntityIdentifier>, entity_identifier_as_string: Option<String>, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetAddressableEntityResult>, SdkError>

Retrieves account information based on the provided options.

§Arguments
  • entity_identifier - An optional EntityIdentifier for specifying the entity identifier.
  • entity_identifier_as_string - An optional string representing the entity identifier.
  • maybe_block_identifier - An optional BlockIdentifierInput for specifying a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a SuccessResponse<_GetAddressableEntityResult> or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_era_info( &self, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetEraInfoResult>, SdkError>

👎Deprecated: prefer ‘get_era_summary’ as it doesn’t require a switch block
source§

impl SDK

source

pub async fn get_era_summary( &self, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetEraSummaryResult>, SdkError>

Retrieves era summary information based on the provided options.

§Arguments
  • maybe_block_identifier - An optional BlockIdentifierInput for specifying a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetEraSummaryResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_node_status( &self, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetNodeStatusResult>, Error>

Retrieves node status information based on the provided options.

§Arguments
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetNodeStatusResult or an Error in case of an error.

§Errors

Returns an Error if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_peers( &self, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetPeersResult>, Error>

Retrieves peers.

§Arguments
  • verbosity - Optional verbosity level.
  • rpc_address - Optional rpc address.
§Returns

A Result containing SuccessResponse with _GetPeersResult or an Error if an error occurs.

source§

impl SDK

source

pub async fn get_state_root_hash( &self, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetStateRootHashResult>, SdkError>

Retrieves state root hash information based on the provided options.

§Arguments
  • maybe_block_identifier - An optional BlockIdentifierInput for specifying a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetStateRootHashResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn get_transaction( &self, transaction_hash: TransactionHash, finalized_approvals: Option<bool>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetTransactionResult>, Error>

Retrieves transaction information based on the provided options.

§Arguments
  • transaction_hash - The transaction hash.
  • finalized_approvals - An optional boolean indicating finalized approvals.
  • verbosity - An optional verbosity level.
  • rpc_address - An optional rpc address.
§Returns

A Result containing either a _GetTransactionResult or an error.

source§

impl SDK

source

pub async fn get_validator_changes( &self, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetValidatorChangesResult>, Error>

Retrieves validator changes based on the provided options.

§Arguments
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _GetValidatorChangesResult or an Error in case of an error.

§Errors

Returns an Error if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn list_rpcs( &self, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_ListRpcsResult>, Error>

Lists available RPCs based on the provided options.

§Arguments
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _ListRpcsResult or an Error in case of an error.

§Errors

Returns an Error if there is an error during the listing process.

source§

impl SDK

source

pub async fn put_deploy( &self, deploy: Deploy, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutDeployResult>, Error>

Puts a deploy based on the provided options.

§Arguments
  • deploy - The Deploy object to be sent.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _PutDeployResult or an Error in case of an error.

§Errors

Returns an Error if there is an error during the deploy process.

source§

impl SDK

source

pub async fn put_transaction( &self, transaction: Transaction, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutTransactionResult>, Error>

Puts a transaction based on the provided options.

§Arguments
  • transaction - The Transaction object to be sent.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a _PutTransactionResult or an Error in case of an error.

§Errors

Returns an Error if there is an error during the transaction process.

source§

impl SDK

source

pub async fn query_balance( &self, maybe_global_state_identifier: Option<GlobalStateIdentifier>, purse_identifier_as_string: Option<String>, purse_identifier: Option<PurseIdentifier>, state_root_hash: Option<String>, maybe_block_id: Option<String>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_QueryBalanceResult>, SdkError>

Retrieves balance information based on the provided options.

§Arguments
  • maybe_global_state_identifier - An optional GlobalStateIdentifier for specifying global state.
  • purse_identifier_as_string - An optional string representing a purse identifier.
  • purse_identifier - An optional PurseIdentifier.
  • state_root_hash - An optional string representing a state root hash.
  • maybe_block_id - An optional string representing a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a SuccessResponse<_QueryBalanceResult> or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub async fn query_balance_details( &self, maybe_global_state_identifier: Option<GlobalStateIdentifier>, purse_identifier_as_string: Option<String>, purse_identifier: Option<PurseIdentifier>, state_root_hash: Option<String>, maybe_block_id: Option<String>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_QueryBalanceDetailsResult>, SdkError>

Retrieves balance information details based on the provided options.

§Arguments
  • maybe_global_state_identifier - An optional GlobalStateIdentifier for specifying global state.
  • purse_identifier_as_string - An optional string representing a purse identifier.
  • purse_identifier - An optional PurseIdentifier.
  • state_root_hash - An optional string representing a state root hash.
  • maybe_block_id - An optional string representing a block identifier.
  • verbosity - An optional Verbosity level for controlling the output verbosity.
  • rpc_address - An optional string specifying the rpc address to use for the request.
§Returns

A Result containing either a SuccessResponse<_QueryBalanceDetailsResult> or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the retrieval process.

source§

impl SDK

source

pub fn query_global_state_js_alias_params( &self, options: Option<QueryGlobalStateOptions>, ) -> Result<QueryGlobalStateParams, SdkError>

Builds parameters for querying global state based on the provided options.

§Arguments
  • options - An optional QueryGlobalStateOptions struct containing retrieval options.
§Returns

A Result containing either a QueryGlobalStateParams struct or a SdkError in case of an error.

source

pub async fn query_global_state( &self, query_params: QueryGlobalStateParams, ) -> Result<SuccessResponse<_QueryGlobalStateResult>, SdkError>

Retrieves global state information based on the provided parameters.

§Arguments
  • query_params - A QueryGlobalStateParams struct containing query parameters.
§Returns

A Result containing either a SuccessResponse<_QueryGlobalStateResult> or a SdkError in case of an error.

source§

impl SDK

source

pub async fn speculative_exec( &self, transaction: Transaction, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_SpeculativeExecTxnResult>, SdkError>

Perform speculative execution.

§Arguments
  • transaction - The transaction to execute.
  • verbosity - The verbosity level for logging.
  • rpc_address - The address of the node to connect to.
§Returns

A Result containing the result of _SpeculativeExecTxnResult or a SdkError in case of an error.

source§

impl SDK

source

pub async fn speculative_exec_deploy( &self, deploy: Deploy, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_SpeculativeExecResult>, SdkError>

👎Deprecated: prefer speculative_exec_transaction

Perform speculative execution.

§Arguments
  • deploy - The deploy to execute.
  • verbosity - The verbosity level for logging.
  • rpc_address - The address of the node to connect to.
§Returns

A Result containing the result of _SpeculativeExecResult or a SdkError in case of an error.

source§

impl SDK

source

pub async fn speculative_transaction( &self, builder_params: TransactionBuilderParams, transaction_params: TransactionStrParams, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_SpeculativeExecTxnResult>, SdkError>

This function allows executing a transaction speculatively.

§Arguments
  • builder_params - Transaction Builder parameters.
  • transaction_params - Transactionment parameters for the transaction.
  • verbosity - Optional verbosity level.
  • rpc_address - Optional rpc address.
§Returns

A Result containing either a SuccessResponse<_SpeculativeExecTxnResult> or a SdkError in case of an error.

source§

impl SDK

source

pub async fn speculative_transfer_transaction( &self, maybe_source: Option<URef>, target_account: &str, amount: &str, transaction_params: TransactionStrParams, maybe_id: Option<String>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_SpeculativeExecTxnResult>, SdkError>

Perform a speculative transfer transaction.

§Arguments
  • maybe_source - Optional transfer source uref.
  • amount - The amount to transfer.
  • target_account - The target account.
  • transaction_params - The transactionment parameters.
  • maybe_id - An optional transfer ID (defaults to a random number).
  • verbosity - The verbosity level for logging (optional).
  • rpc_address - The address of the node to connect to (optional).
§Returns

A Result containing the result a SuccessResponse<_SpeculativeExecTxnResult> or a SdkError in case of an error.

source§

impl SDK

source

pub async fn transaction( &self, builder_params: TransactionBuilderParams, transaction_params: TransactionStrParams, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutTransactionResult>, SdkError>

Perform a transaction operation.

§Arguments
  • builder_params - Transaction Builder parameters.
  • transaction_params - Transaction parameters.
  • verbosity - An optional verbosity level.
  • rpc_address - An optional rpc address.
§Returns

A result containing a SuccessResponse<_PutTransactionResult> or an SdkError.

source§

impl SDK

source

pub async fn transfer_transaction( &self, maybe_source: Option<URef>, target_account: &str, amount: &str, transaction_params: TransactionStrParams, maybe_id: Option<String>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutTransactionResult>, SdkError>

Perform a transfer transaction of funds.

§Arguments
  • maybe_source - Optional transfer source uref.
  • target_account - The target account.
  • amount - The amount to transfer.
  • transaction_params - The transaction parameters.
  • maybe_id - An optional transfer ID (defaults to a random number).
  • verbosity - The verbosity level for logging (optional).
  • rpc_address - The address of the node to connect to (optional).
§Returns

A Result containing the result a SuccessResponse<_PutTransactionResult> of the transfer or a SdkError in case of an error.

source§

impl SDK

source

pub fn make_deploy( &self, deploy_params: DeployStrParams, session_params: SessionStrParams, payment_params: PaymentStrParams, ) -> Result<Deploy, SdkError>

👎Deprecated: prefer ‘make_transaction’

Creates a deploy using the provided parameters.

§Arguments
  • deploy_params - The deploy parameters.
  • session_params - The session parameters.
  • payment_params - The payment parameters.
§Returns

A Result containing the created Deploy or a SdkError in case of an error.

source§

impl SDK

source

pub fn make_transfer( &self, amount: &str, target_account: &str, transfer_id: Option<String>, deploy_params: DeployStrParams, payment_params: PaymentStrParams, ) -> Result<Deploy, SdkError>

👎Deprecated: prefer ‘make_transfer_transaction’

Creates a transfer deploy with the provided parameters.

§Arguments
  • amount - The transfer amount.
  • target_account - The target account.
  • transfer_id - Optional transfer identifier.
  • deploy_params - The deploy parameters.
  • payment_params - The payment parameters.
§Returns

A Result containing the created Deploy or a SdkError in case of an error.

source§

impl SDK

source

pub fn sign_deploy(&self, deploy: Deploy, secret_key: &str) -> Deploy

👎Deprecated: prefer sign_transaction

Signs a deploy using the provided secret key.

§Arguments
  • deploy - The deploy to sign.
  • secret_key - The secret key for signing.
§Returns

The signed Deploy.

source§

impl SDK

source

pub fn make_transaction( &self, builder_params: TransactionBuilderParams, transaction_params: TransactionStrParams, ) -> Result<Transaction, SdkError>

Creates a transaction using the provided parameters.

§Arguments
  • builder_params - Transaction Builder parameters.
  • transaction_params - The transaction parameters.
§Returns

A Result containing the created Transaction or a SdkError in case of an error.

source§

impl SDK

source

pub fn make_transfer_transaction( &self, maybe_source: Option<URef>, target: &str, amount: &str, transaction_params: TransactionStrParams, maybe_id: Option<String>, ) -> Result<Transaction, SdkError>

Creates a transfer transaction with the provided parameters.

§Arguments
  • maybe_source - Optional transfer source uref.
  • amount - The transfer amount.
  • target - The target account.
  • transaction_params - The transaction parameters.
  • maybe_id - Optional transfer identifier.
§Returns

A Result containing the created Transaction or a SdkError in case of an error.

source§

impl SDK

source

pub fn sign_transaction( &self, transaction: Transaction, secret_key: &str, ) -> Transaction

Signs a transaction using the provided secret key.

§Arguments
  • transaction - The transaction to sign.
  • secret_key - The secret key for signing.
§Returns

The signed Transaction.

source§

impl SDK

source

pub fn watch_deploy( &self, events_url: &str, timeout_duration: Option<u64>, ) -> Watcher

👎Deprecated: prefer ‘watch_transaction’

Creates a new Watcher instance to watch deploys. Legacy alias

§Arguments
  • events_url - The URL to monitor for transaction events.
  • timeout_duration - An optional timeout duration in seconds.
§Returns

A Watcher instance.

source

pub fn watch_transaction( &self, events_url: &str, timeout_duration: Option<u64>, ) -> Watcher

Creates a new Watcher instance to watch deploys.

§Arguments
  • events_url - The URL to monitor for transaction events.
  • timeout_duration - An optional timeout duration in seconds.
§Returns

A Watcher instance.

source

pub async fn wait_deploy( &self, events_url: &str, deploy_hash: &str, timeout_duration: Option<u64>, ) -> Result<EventParseResult, String>

👎Deprecated: prefer ‘wait_transaction’ with transaction

Waits for a deploy event to be processed asynchronously. Legacy alias

§Arguments
  • events_url - The URL to monitor for transaction events.
  • deploy_hash - The deploy hash to wait for.
  • timeout_duration - An optional timeout duration in milliseconds.
§Returns

A Result containing either the processed EventParseResult or an error message.

source

pub async fn wait_transaction( &self, events_url: &str, target_hash: &str, timeout_duration: Option<u64>, ) -> Result<EventParseResult, String>

Alias for wait_deploy Waits for a deploy event to be processed asynchronously.

§Arguments
  • events_url - The URL to monitor for transaction events.
  • target_hash - The transaction hash to wait for.
  • timeout_duration - An optional timeout duration in milliseconds.
§Returns

A Result containing either the processed EventParseResult or an error message

source§

impl SDK

A set of functions for working with smart contract entry points. Alias of sdk.transaction

source

pub async fn call_entrypoint( &self, builder_params: TransactionBuilderParams, transaction_params: TransactionStrParams, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutTransactionResult>, SdkError>

Calls a smart contract entry point with the specified parameters and returns the result.

§Arguments
  • builder_params - Transaction Builder parameters.
  • transaction_params - Transaction parameters.
  • rpc_address - An optional rpc address to send the request to.
§Returns

A Result containing either a _PutTransactionResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the call.

source§

impl SDK

A set of functions for working with smart contract entry points. Alias of sdk.deploy

source

pub async fn call_entrypoint_deploy( &self, deploy_params: DeployStrParams, session_params: SessionStrParams, payment_params: PaymentStrParams, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutDeployResult>, SdkError>

👎Deprecated: prefer ‘call_entrypoint’ with transaction

Calls a smart contract entry point with the specified parameters and returns the result.

§Arguments
  • deploy_params - The deploy parameters.
  • session_params - The session parameters.
  • payment_params - The payment parameters.
  • rpc_address - An optional rpc address to send the request to.
§Returns

A Result containing either a _PutDeployResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the call.

source§

impl SDK

A set of functions for installing smart contracts on the blockchain. Alias of sdk.transaction

source

pub async fn install( &self, transaction_params: TransactionStrParams, transaction_bytes: Bytes, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutTransactionResult>, SdkError>

Installs a smart contract with the specified parameters and returns the result.

§Arguments
  • transaction_params - Transaction parameters.
  • transaction_bytes - Transaction Bytes to install
  • rpc_address - An optional rpc address to send the request to.
§Returns

A Result containing either a _PutTransactionResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the installation.

source§

impl SDK

A set of functions for installing smart contracts on the blockchain. Alias of sdk.deploy

source

pub async fn install_deploy( &self, deploy_params: DeployStrParams, session_params: SessionStrParams, payment_amount: &str, rpc_address: Option<String>, ) -> Result<SuccessResponse<_PutDeployResult>, SdkError>

👎Deprecated: prefer ‘install’ with transaction

Installs a smart contract with the specified parameters and returns the result.

§Arguments
  • deploy_params - The deploy parameters.
  • session_params - The session parameters.
  • payment_amount - The payment amount as a string.
  • rpc_address - An optional rpc address to send the request to.
§Returns

A Result containing either a _PutDeployResult or a SdkError in case of an error.

§Errors

Returns a SdkError if there is an error during the installation.

source§

impl SDK

Alias of sdk.get_dictionary_item

source

pub async fn query_contract_dict( &self, state_root_hash: impl ToDigest, dictionary_item: DictionaryItemInput, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_GetDictionaryItemResult>, SdkError>

Query a contract dictionary item.

§Arguments
  • state_root_hash - State root hash.
  • dictionary_item - Dictionary item input.
  • verbosity - Optional verbosity level.
  • rpc_address - Optional rpc address.
§Returns

A Result containing either a SuccessResponse<_GetDictionaryItemResult> or a SdkError in case of an error.

source§

impl SDK

Alias of sdk.query_global_state

source

pub async fn query_contract_key( &self, entity_identifier: Option<EntityIdentifier>, entity_identifier_as_string: Option<String>, path: PathIdentifierInput, maybe_block_identifier: Option<BlockIdentifierInput>, verbosity: Option<Verbosity>, rpc_address: Option<String>, ) -> Result<SuccessResponse<_QueryGlobalStateResult>, SdkError>

Query a contract key.

§Arguments
  • query_params - Query global state parameters.
§Returns

A Result containing either a SuccessResponse<_GetAddressableEntityResult> or a SdkError in case of an error.

source§

impl SDK

source

pub fn new(rpc_address: Option<String>, verbosity: Option<Verbosity>) -> Self

source

pub fn get_rpc_address(&self, rpc_address: Option<String>) -> String

source

pub fn set_rpc_address( &mut self, rpc_address: Option<String>, ) -> Result<(), String>

source

pub fn get_verbosity(&self, verbosity: Option<Verbosity>) -> Verbosity

source

pub fn set_verbosity( &mut self, verbosity: Option<Verbosity>, ) -> Result<(), String>

Trait Implementations§

source§

impl Default for SDK

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<SDK> for JsValue

source§

fn from(value: SDK) -> Self

Converts to this type from the input type.
source§

impl FromWasmAbi for SDK

§

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
source§

unsafe fn from_abi(js: u32) -> Self

Recover a Self from Self::Abi. Read more
source§

impl IntoWasmAbi for SDK

§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
source§

impl LongRefFromWasmAbi for SDK

§

type Abi = u32

Same as RefFromWasmAbi::Abi
§

type Anchor = RcRef<SDK>

Same as RefFromWasmAbi::Anchor
source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
source§

impl OptionFromWasmAbi for SDK

source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
source§

impl OptionIntoWasmAbi for SDK

source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
source§

impl RefFromWasmAbi for SDK

§

type Abi = u32

The Wasm ABI type references to Self are recovered from.
§

type Anchor = RcRef<SDK>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
source§

impl RefMutFromWasmAbi for SDK

§

type Abi = u32

Same as RefFromWasmAbi::Abi
§

type Anchor = RcRefMut<SDK>

Same as RefFromWasmAbi::Anchor
source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
source§

impl TryFromJsValue for SDK

§

type Error = JsValue

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

fn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl VectorFromWasmAbi for SDK

§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SDK]>

source§

impl VectorIntoJsValue for SDK

source§

impl VectorIntoWasmAbi for SDK

§

type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi

source§

fn vector_into_abi(vector: Box<[SDK]>) -> Self::Abi

source§

impl WasmDescribe for SDK

source§

impl WasmDescribeVector for SDK

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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
source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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

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