A provider for connecting to a node

Properties

cache?: ResourceCache
operations: SdkOperations
options: ProviderOptions = ...

Methods

  • Returns Promise<void>

  • Updates the URL for the provider and fetches the consensus parameters for the new URL, if needed.

    Parameters

    • url: string

      The URL to connect to.

    • Optionaloptions: ProviderOptions

      Additional options for the provider.

    Returns Promise<void>

  • Executes a transaction without actually submitting it to the chain.

    If the transaction is missing any dependencies, the transaction will be mutated and those dependencies will be added.

    Parameters

    Returns Promise<CallResult>

    A promise that resolves to the call result object.

  • Dry runs multiple transactions.

    Parameters

    Returns Promise<CallResult[]>

    A promise that resolves to an array of results for each transaction call.

  • Returns the estimate gas price for the given block horizon.

    Parameters

    • blockHorizon: number

      The block horizon to estimate gas price for.

    Returns Promise<BN>

    A promise that resolves to the estimated gas price.

  • Dry runs multiple transactions and checks for missing dependencies in batches.

    Transactions are dry run in batches. After each dry run, transactions requiring further modifications are identified. The method iteratively updates these transactions and performs subsequent dry runs until all dependencies for each transaction are satisfied.

    Parameters

    Returns Promise<EstimateTxDependenciesReturns[]>

    A promise that resolves to an array of results for each transaction.

  • Verifies whether enough gas is available to complete transaction.

    Type Parameters

    Parameters

    • transactionRequest: T

      The transaction request object.

    Returns Promise<T>

    A promise that resolves to the estimated transaction request object.

  • Will dryRun a transaction and check for missing dependencies.

    If there are missing variable outputs, addVariableOutputs is called on the transaction.

    Parameters

    Returns Promise<EstimateTxDependenciesReturns>

    A promise that resolves to the estimate transaction dependencies.

  • Estimates the transaction gas and fee based on the provided transaction request.

    Parameters

    Returns Promise<{
        gasLimit: BN;
        gasPrice: BN;
        maxFee: BN;
        maxGas: BN;
        minFee: BN;
        minGas: BN;
    }>

    An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.

  • Returns the chain information for the current provider network.

    Returns Promise<ChainInfo>

    a promise that resolves to the chain information.

  • Return the chain and node information.

    Parameters

    • ignoreCache: boolean = false

      If true, ignores the cache and re-fetch configs.

    Returns Promise<{
        chain: ChainInfo;
        nodeInfo: NodeInfo;
    }>

    A promise that resolves to the Chain and NodeInfo.

  • Returns the node information for the current provider network.

    Returns Promise<NodeInfo>

    a promise that resolves to the node information.

  • Parameters

    • id: string

    Returns Promise<
        | "Blob"
        | "Account"
        | "Contract"
        | "Transaction">

  • Returns the balance for the given owner for the given asset ID.

    Parameters

    • owner: string | Address

      The address to get coins for.

    • assetId: BytesLike

      The asset ID of coins to get.

    Returns Promise<BN>

    A promise that resolves to the balance.

  • Returns balances for the given owner.

    Parameters

    • owner: string | Address

      The address to get coins for.

    Returns Promise<GetBalancesResponse>

    A promise that resolves to the balances.

  • Returns the base asset ID for the current provider network.

    Returns Promise<string>

    the base asset ID.

  • Returns an array of blobIds that exist on chain, for a given array of blobIds.

    Parameters

    • blobIds: string[]

      blobIds to check.

    Returns Promise<string[]>

    • A promise that resolves to an array of blobIds that exist on chain.
  • Returns block matching the given ID or height.

    Parameters

    • idOrHeight: string | number

      ID or height of the block.

    Returns Promise<null | Block>

    A promise that resolves to the block or null.

  • Returns the latest block number.

    Returns Promise<BN>

    A promise that resolves to the latest block number.

  • Returns all the blocks matching the given parameters.

    Parameters

    • Optionalparams: CursorPaginationArgs

      The parameters to query blocks.

    Returns Promise<GetBlocksResponse>

    A promise that resolves to the blocks.

  • Returns the chainInfo for the current network.

    Returns Promise<ChainInfo>

    the chain information configuration.

  • Returns the chain ID for the current provider network.

    Returns Promise<number>

    A promise that resolves to the chain ID number.

  • Returns coins for the given owner.

    Parameters

    • owner: string | Address

      The address to get coins for.

    • OptionalassetId: BytesLike

      The asset ID of coins to get (optional).

    • OptionalpaginationArgs: CursorPaginationArgs

      Pagination arguments (optional).

    Returns Promise<GetCoinsResponse>

    A promise that resolves to the coins.

  • Get deployed contract with the given ID.

    Parameters

    • contractId: string

      ID of the contract.

    Returns Promise<null | ContractResult>

    A promise that resolves to the contract.

  • Returns the balance for the given contract for the given asset ID.

    Parameters

    • contractId: string | Address

      The contract ID to get the balance for.

    • assetId: BytesLike

      The asset ID of coins to get.

    Returns Promise<BN>

    A promise that resolves to the balance.

  • Returns some helpful parameters related to gas fees.

    Returns Promise<{
        gasCosts: GasCosts;
        gasPerByte: BN;
        gasPriceFactor: BN;
        maxGasPerPredicate: BN;
        maxGasPerTx: BN;
    }>

  • Get the latest gas price from the node.

    Returns Promise<BN>

    A promise that resolves to the latest gas price.

  • Returns Message for given nonce.

    Parameters

    • nonce: string

      The nonce of the message to retrieve.

    Returns Promise<null | Message>

    A promise that resolves to the Message object or null.

  • Returns Message Proof for given transaction id and the message id from MessageOut receipt.

    Parameters

    • transactionId: string

      The transaction to get message from.

    • nonce: string
    • OptionalcommitBlockId: string

      The commit block id (optional).

    • OptionalcommitBlockHeight: BN

      The commit block height (optional).

    Returns Promise<null | MessageProof>

    A promise that resolves to the message proof.

  • Returns Message Proof for given transaction id and the message id from MessageOut receipt.

    Parameters

    • nonce: string

      The nonce of the message to get status from.

    Returns Promise<MessageStatus>

    A promise that resolves to the message status

  • Returns message for the given address.

    Parameters

    • address: string | Address

      The address to get message from.

    • OptionalpaginationArgs: CursorPaginationArgs

      Pagination arguments (optional).

    Returns Promise<GetMessagesResponse>

    A promise that resolves to the messages.

  • Returns the nodeInfo for the current network.

    Returns Promise<NodeInfo>

    the node information configuration.

  • Get the relayed transaction for the given transaction ID.

    Parameters

    • relayedTransactionId: string

      The relayed transaction ID to get the response for.

    Returns Promise<null | GqlRelayedTransactionFailed>

    A promise that resolves to the relayed transaction.

  • Returns resources for the given owner satisfying the spend query.

    Parameters

    • owner: string | Address

      The address to get resources for.

    • quantities: CoinQuantityLike[]

      The coin quantities to get.

    • OptionalexcludedIds: ExcludeResourcesOption

      IDs of excluded resources from the selection (optional).

    Returns Promise<Resource[]>

    A promise that resolves to the resources.

  • Get transaction with the given ID.

    Type Parameters

    • TTransactionType = void

    Parameters

    • transactionId: string

      ID of the transaction.

    Returns Promise<null | Transaction<TTransactionType>>

    A promise that resolves to the transaction.

  • Get the transaction response for the given transaction ID.

    Parameters

    • transactionId: string

      The transaction ID to get the response for.

    Returns Promise<TransactionResponse>

    A promise that resolves to the transaction response.

  • Retrieves transactions based on the provided pagination arguments.

    Parameters

    • OptionalpaginationArgs: CursorPaginationArgs

      The pagination arguments for retrieving transactions.

    Returns Promise<GetTransactionsResponse>

    A promise that resolves to an object containing the retrieved transactions and pagination information.

  • Returns the version of the connected node.

    Returns Promise<string>

    A promise that resolves to the version string.

  • Initialize Provider async stuff

    Returns Promise<Provider>

  • Check if the given ID is an account.

    Parameters

    • id: string

      The ID to check.

    Returns Promise<boolean>

    A promise that resolves to the result of the check.

  • Lets you produce blocks with custom timestamps and the block number of the last block produced.

    Parameters

    • amount: number

      The amount of blocks to produce.

    • OptionalstartTime: number

      The UNIX timestamp (milliseconds) to set for the first produced block (optional).

    Returns Promise<BN>

    A promise that resolves to the block number of the last produced block.

  • Submits a transaction to the chain to be executed.

    If the transaction is missing any dependencies, the transaction will be mutated and those dependencies will be added.

    Parameters

    Returns Promise<TransactionResponse>

    A promise that resolves to the transaction response object.

  • Executes a signed transaction without applying the states changes on the chain.

    If the transaction is missing any dependencies, the transaction will be mutated and those dependencies will be added

    Parameters

    Returns Promise<CallResult>

    A promise that resolves to the call result object.