ClassSDK

Constructors

Methods

account_put_deploy account_put_transaction call_entrypoint call_entrypoint_deploy chain_get_block chain_get_block_transfers chain_get_era_info_by_switch_block chain_get_era_summary chain_get_state_root_hash deploy free get_account get_account_options get_auction_info get_auction_info_options get_balance get_balance_options get_block get_block_options get_block_transfers get_block_transfers_options get_chainspec get_deploy get_deploy_options get_dictionary_item get_dictionary_item_options get_entity get_entity_options get_era_info get_era_info_options get_era_summary get_era_summary_options get_node_status get_peers get_speculative_exec_deploy_options get_speculative_exec_options get_state_root_hash get_state_root_hash_options get_transaction get_transaction_options get_validator_changes getRPCAddress getVerbosity info_get_chainspec info_get_deploy info_get_peers info_get_status info_get_transaction info_get_validator_change install install_deploy list_rpcs make_deploy make_transaction make_transfer make_transfer_transaction put_deploy put_transaction query_balance query_balance_details query_balance_details_options query_balance_options query_contract_dict query_contract_dict_options query_contract_key query_contract_key_options query_global_state query_global_state_options setRPCAddress setVerbosity sign_deploy sign_transaction speculative_deploy speculative_exec speculative_exec_deploy speculative_transaction speculative_transfer speculative_transfer_transaction state_get_account_info state_get_auction_info_js_alias state_get_balance state_get_dictionary_item state_get_entity transaction transfer transfer_transaction waitDeploy waitTransaction watchDeploy watchTransaction

Constructors

Methods

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

    Arguments

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

    Returns

    A Result containing either a PutTransactionResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<PutTransactionResult>

  • 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_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 JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<PutDeployResult>

  • JavaScript Alias for the get_block.

    Arguments

    • options - An optional GetBlockOptions struct containing retrieval options.

    Returns

    A Result containing either a GetBlockResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetBlockResult>

  • Retrieves state root hash information using the provided options (alias for get_state_root_hash).

    Arguments

    • options - An optional GetStateRootHashOptions struct containing retrieval options.

    Returns

    A Result containing either a GetStateRootHashResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetStateRootHashResult>

  • JavaScript function for deploying with deserialized parameters.

    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 PutDeployResult or a JsError.

    Parameters

    Returns Promise<PutDeployResult>

  • Retrieves account information using the provided options.

    This function is an asynchronous JavaScript binding for the Rust get_account method.

    Arguments

    • options - An optional GetAccountOptions struct containing retrieval options, such as:
      • account_identifier: Identifier for the account.
      • account_identifier_as_string: String representation of the account identifier.
      • maybe_block_id_as_string: Optional string representation of the block ID.
      • maybe_block_identifier: Optional BlockIdentifierInput for specifying the block.
      • verbosity: Verbosity level for the output.
      • rpc_address: Address of the node to query.

    Returns

    A Result containing either a GetAccountResult on success or a JsError on failure.

    Errors

    Returns a JsError if there is an error during the retrieval process, such as issues with the provided options or network errors.

    @param {getAccountOptions | undefined} [options]
    @returns {Promise<GetAccountResult

    Parameters

    Returns Promise<GetAccountResult>

  • Retrieves auction information using the provided options.

    Arguments

    • options - An optional GetAuctionInfoOptions struct containing retrieval options.

    Returns

    A Result containing either a GetAuctionInfoResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetAuctionInfoResult>

  • Parses auction info options from a JsValue.

    Arguments

    • options - A JsValue containing auction info options to be parsed.

    Returns

    Result containing parsed auction info options as a GetAuctionInfoOptions struct, or a JsError if deserialization fails.

    Parameters

    • options: any

    Returns getAuctionInfoOptions

  • Retrieves balance information using the provided options.

    Arguments

    • options - An optional GetBalanceOptions struct containing retrieval options.

    Returns

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

    Errors

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

    Parameters

    Returns Promise<GetBalanceResult>

  • Retrieves block information using the provided options.

    Arguments

    • options - An optional GetBlockOptions struct containing retrieval options.

    Returns

    A Result containing either a GetBlockResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetBlockResult>

  • Retrieves block transfers information using the provided options.

    Arguments

    • options - An optional GetBlockTransfersOptions struct containing retrieval options.

    Returns

    A Result containing either a GetBlockTransfersResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetBlockTransfersResult>

  • 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 JsError in case of an error.

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<GetChainspecResult>

  • Retrieves dictionary item information using the provided options.

    Arguments

    • options - An optional GetDictionaryItemOptions struct containing retrieval options.

    Returns

    A Result containing either a GetDictionaryItemResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetDictionaryItemResult>

  • Retrieves entity information using the provided options.

    This function is an asynchronous JavaScript binding for the Rust get_entity method.

    Arguments

    • options - An optional GetEntityOptions struct containing retrieval options, such as:
      • entity_identifier: Identifier for the entity.
      • entity_identifier_as_string: String representation of the entity identifier.
      • maybe_block_id_as_string: Optional string representation of the block ID.
      • maybe_block_identifier: Optional BlockIdentifierInput for specifying the block.
      • verbosity: Verbosity level for the output.
      • rpc_address: Address of the node to query.

    Returns

    A Result containing either a GetAddressableEntityResult on success or a JsError on failure.

    Errors

    Returns a JsError if there is an error during the retrieval process, such as issues with the provided options or network errors.

    @param {getEntityOptions | undefined} [options]
    @returns {Promise<GetAddressableEntityResult

    Parameters

    Returns Promise<GetAddressableEntityResult>

  • Retrieves era summary information using the provided options.

    Arguments

    • options - An optional GetEraSummaryOptions struct containing retrieval options.

    Returns

    A Result containing either a GetEraSummaryResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetEraSummaryResult>

  • Retrieves node status information using 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 a JsError in case of an error.

    Errors

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

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<GetNodeStatusResult>

  • Retrieves peers asynchronously.

    Arguments

    • verbosity - Optional verbosity level.
    • rpc_address - Optional rpc address.

    Returns

    A Result containing GetPeersResult or a JsError if an error occurs.

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<GetPeersResult>

  • Retrieves state root hash information using the provided options.

    Arguments

    • options - An optional GetStateRootHashOptions struct containing retrieval options.

    Returns

    A Result containing either a GetStateRootHashResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<GetStateRootHashResult>

  • Retrieves validator changes using 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 a JsError in case of an error.

    Errors

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

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<GetValidatorChangesResult>

  • 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 JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<PutTransactionResult>

  • 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 JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<PutDeployResult>

  • Lists available RPCs using 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 a JsError in case of an error.

    Errors

    Returns a JsError if there is an error during the listing process.

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<ListRpcsResult>

  • JS function for make_deploy.

    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 JsError in case of an error.

    Parameters

    Returns Deploy

  • JS function for make_transfer.

    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 JsError in case of an error.

    Parameters

    Returns Deploy

  • JS function for make_transfer_transaction.

    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 JsError in case of an error.

    Parameters

    Returns Transaction

  • Puts a deploy using 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 a JsError in case of an error.

    Errors

    Returns a JsError if there is an error during the deploy process.

    Parameters

    Returns Promise<PutDeployResult>

  • Puts a transaction using 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 a JsError in case of an error.

    Errors

    Returns a JsError if there is an error during the transaction process.

    Parameters

    Returns Promise<PutTransactionResult>

  • Retrieves balance information using the provided options.

    Arguments

    • options - An optional QueryBalanceOptions struct containing retrieval options.

    Returns

    A Result containing either a QueryBalanceResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<QueryBalanceResult>

  • Retrieves global state information using the provided options.

    Arguments

    • options - An optional QueryGlobalStateOptions struct containing retrieval options.

    Returns

    A Result containing either a QueryGlobalStateResult or a JsError in case of an error.

    Errors

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

    Parameters

    Returns Promise<QueryGlobalStateResult>

  • JS function for sign_deploy.

    Arguments

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

    Returns

    The signed Deploy.

    Parameters

    • deploy: Deploy
    • secret_key: string

    Returns Deploy

  • JS function for sign_transaction.

    Arguments

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

    Returns

    The signed Transaction.

    Parameters

    Returns 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 SpeculativeExecResult or a JsError in case of an error.

    Parameters

    Returns Promise<SpeculativeExecResult>

  • 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 SpeculativeExecTxnResult or a JsError in case of an error.

    Parameters

    Returns Promise<SpeculativeExecTxnResult>

  • JS function for 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 of the speculative transfer or a JsError in case of an error.

    Parameters

    Returns Promise<SpeculativeExecResult>

  • JS function for speculative transfer transaction.

    Arguments

    • maybe_source - Optional transfer source uref.
    • target_account - The target account.
    • amount - The amount to transfer.
    • maybe_id - An optional transfer ID (defaults to a random number).
    • transaction_params - The transactionment 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 of the speculative transfer or a JsError in case of an error.

    Parameters

    • maybe_source: URef
    • target_account: string
    • amount: string
    • transaction_params: TransactionStrParams
    • Optionalmaybe_id: string
    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<SpeculativeExecTxnResult>

  • JavaScript function for transactioning with deserialized parameters.

    Arguments

    • transaction_params - Transaction parameters.
    • builder_params - Session parameters.
    • verbosity - An optional verbosity level.
    • rpc_address - An optional rpc address.

    Returns

    A result containing PutTransactionResult or a JsError.

    Parameters

    Returns Promise<PutTransactionResult>

  • JS function for transferring 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 of the transfer or a JsError in case of an error.

    Parameters

    Returns Promise<PutDeployResult>

  • JS function for transaction transferring 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 of the transfer or a JsError in case of an error.

    Parameters

    • maybe_source: URef
    • target_account: string
    • amount: string
    • transaction_params: TransactionStrParams
    • Optionalmaybe_id: string
    • Optionalverbosity: Verbosity
    • Optionalrpc_address: string

    Returns Promise<PutTransactionResult>

  • Waits for a deploy event to be processed asynchronously (JavaScript-friendly). 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 seconds.

    Returns

    A JavaScript Promise resolving to either the processed EventParseResult or an error message.

    Parameters

    • events_url: string
    • deploy_hash: string
    • Optionaltimeout_duration: number

    Returns Promise<Promise<any>>

  • Waits for a deploy event to be processed asynchronously (JavaScript-friendly).

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

    Returns

    A JavaScript Promise resolving to either the processed EventParseResult or an error message.

    Parameters

    • events_url: string
    • target_hash: string
    • Optionaltimeout_duration: number

    Returns Promise<Promise<any>>

  • Creates a new Watcher instance to watch deploys (JavaScript-friendly). Legacy alias

    Arguments

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

    Returns

    A Watcher instance.

    Parameters

    • events_url: string
    • Optionaltimeout_duration: number

    Returns Watcher

  • Creates a new Watcher instance to watch deploys (JavaScript-friendly).

    Arguments

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

    Returns

    A Watcher instance.

    Parameters

    • events_url: string
    • Optionaltimeout_duration: number

    Returns Watcher