Class SDK

Constructors

  • Parameters

    • Optionalnode_address: string
    • Optionalverbosity: Verbosity

    Returns SDK

Methods

  • JS Alias for put_deploy_js_alias.

    This function provides an alternative name for put_deploy_js_alias.

    Parameters

    Returns Promise<PutDeployResult>

  • 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.
    • node_address - An optional node 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>

  • JS Alias for the get_block method to maintain compatibility.

    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_js_alias).

    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 alias for deploying with deserialized parameters.

    Arguments

    • deploy_params - Deploy parameters.
    • session_params - Session parameters.
    • payment_params - Payment parameters.
    • verbosity - An optional verbosity level.
    • node_address - An optional node address.

    Returns

    A result containing PutDeployResult or a JsError.

    Parameters

    Returns Promise<PutDeployResult>

  • Returns void

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

  • Parses balance options from a JsValue.

    Arguments

    • options - A JsValue containing balance options to be parsed.

    Returns

    Parsed balance options as a GetBalanceOptions struct.

    Parameters

    • options: any

    Returns getBalanceOptions

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

  • Parses block options from a JsValue.

    Arguments

    • options - A JsValue containing block options to be parsed.

    Returns

    Parsed block options as a GetBlockOptions struct.

    Parameters

    • options: any

    Returns getBlockOptions

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

  • Parses block transfers options from a JsValue.

    Arguments

    • options - A JsValue containing block transfers options to be parsed.

    Returns

    Parsed block transfers options as a GetBlockTransfersOptions struct.

    Parameters

    • options: any

    Returns getBlockTransfersOptions

  • Asynchronously retrieves the chainspec.

    Arguments

    • verbosity - An optional Verbosity parameter.
    • node_address - An optional node address as a string.

    Returns

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

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalnode_address: string

    Returns Promise<GetChainspecResult>

  • Retrieves deploy information using the provided options.

    Arguments

    • options - An optional GetDeployOptions struct containing retrieval options.

    Returns

    A Result containing either a GetDeployResult or an error.

    Parameters

    Returns Promise<GetDeployResult>

  • Parses deploy options from a JsValue.

    Arguments

    • options - A JsValue containing deploy options to be parsed.

    Returns

    Parsed deploy options as a GetDeployOptions struct.

    Parameters

    • options: any

    Returns getDeployOptions

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

  • Parses dictionary item options from a JsValue.

    Arguments

    • options - A JsValue containing dictionary item options to be parsed.

    Returns

    Parsed dictionary item options as a GetDictionaryItemOptions struct.

    Parameters

    • options: any

    Returns getDictionaryItemOptions

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

  • Parses era summary options from a JsValue.

    Arguments

    • options - A JsValue containing era summary options to be parsed.

    Returns

    Parsed era summary options as a GetEraSummaryOptions struct.

    Parameters

    • options: any

    Returns getEraSummaryOptions

  • Retrieves node status information using the provided options.

    Arguments

    • verbosity - An optional Verbosity level for controlling the output verbosity.
    • node_address - An optional string specifying the node 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
    • Optionalnode_address: string

    Returns Promise<GetNodeStatusResult>

  • Retrieves peers asynchronously.

    Arguments

    • verbosity - Optional verbosity level.
    • node_address - Optional node address.

    Returns

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

    Parameters

    • Optionalverbosity: Verbosity
    • Optionalnode_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>

  • Parses state root hash options from a JsValue.

    Arguments

    • options - A JsValue containing state root hash options to be parsed.

    Returns

    Parsed state root hash options as a GetStateRootHashOptions struct.

    Parameters

    • options: any

    Returns getStateRootHashOptions

  • Retrieves validator changes using the provided options.

    Arguments

    • verbosity - An optional Verbosity level for controlling the output verbosity.
    • node_address - An optional string specifying the node 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
    • Optionalnode_address: string

    Returns Promise<GetValidatorChangesResult>

  • Parameters

    • Optionalnode_address: string

    Returns string

  • 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.
    • node_address - An optional node 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.
    • node_address - An optional string specifying the node 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
    • Optionalnode_address: string

    Returns Promise<ListRpcsResult>

  • JS Alias 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

  • 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.
    • node_address - An optional string specifying the node 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>

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

  • Parses query balance options from a JsValue.

    Arguments

    • options - A JsValue containing query balance options to be parsed.

    Returns

    Parsed query balance options as a QueryBalanceOptions struct.

    Parameters

    • options: any

    Returns queryBalanceOptions

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

  • Parses query global state options from a JsValue.

    Arguments

    • options - A JsValue containing query global state options to be parsed.

    Returns

    Parsed query global state options as a QueryGlobalStateOptions struct.

    Parameters

    • options: any

    Returns queryGlobalStateOptions

  • Parameters

    • Optionalnode_address: string

    Returns void

  • Parameters

    Returns void

  • JS Alias 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

  • 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.
    • maybe_block_id_as_string - An optional block ID as a string.
    • maybe_block_identifier - Optional block identifier.
    • verbosity - Optional verbosity level.
    • node_address - Optional node address.

    Returns

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

    Parameters

    Returns Promise<SpeculativeExecResult>

  • JS Alias 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.
    • maybe_block_id_as_string - An optional block ID as a string.
    • maybe_block_identifier - An optional block identifier.
    • verbosity - The verbosity level for logging (optional).
    • node_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 Alias for get_balance_js_alias.

    Arguments

    • options - An optional GetBalanceOptions struct containing retrieval options.

    Returns

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

    Parameters

    Returns Promise<GetBalanceResult>

  • JS Alias 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).
    • node_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>

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

    Arguments

    • events_url - The URL to monitor for deploy 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>>

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

    Arguments

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

    Returns

    A DeployWatcher instance.

    Parameters

    • events_url: string
    • Optionaltimeout_duration: number

    Returns DeployWatcher