Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Nightly /
Provider

@fuel-ts/account v0.94.5 • Docs


Icon LinkClass: Provider

A provider for connecting to a node

Icon LinkProperties

Icon Linkcache?

Icon InfoCircle

optional cache: ResourceCache

Icon LinkDefined in

packages/account/src/providers/provider.ts:412 Icon Link


Icon Linkoperations

Icon InfoCircle

operations: SdkOperations

Icon LinkDefined in

packages/account/src/providers/provider.ts:411 Icon Link


Icon Linkoptions

Icon InfoCircle

options: ProviderOptions

Icon LinkDefined in

packages/account/src/providers/provider.ts:425 Icon Link


Icon Linkurl

Icon InfoCircle

url: string

GraphQL endpoint of the Fuel node

Icon LinkDefined in

packages/account/src/providers/provider.ts:461 Icon Link

Icon LinkMethods

Icon Linkconnect()

Icon InfoCircle

connect(url, options?): Promise<void>

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

Icon LinkParameters

• url: string

The URL to connect to.

• options?: ProviderOptions

Additional options for the provider.

Icon LinkReturns

Promise<void>

Icon LinkDefined in

packages/account/src/providers/provider.ts:577 Icon Link


Icon LinkdryRun()

Icon InfoCircle

dryRun(transactionRequestLike, sendTransactionParams): Promise<CallResult >

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.

Icon LinkParameters

• transactionRequestLike: TransactionRequestLike

The transaction request object.

• sendTransactionParams: ProviderCallParams = {}

The provider call parameters (optional).

Icon LinkReturns

Promise<CallResult >

A promise that resolves to the call result object.

Icon LinkDefined in

packages/account/src/providers/provider.ts:861 Icon Link


Icon LinkdryRunMultipleTransactions()

Icon InfoCircle

dryRunMultipleTransactions(transactionRequests, sendTransactionParams): Promise<CallResult []>

Dry runs multiple transactions.

Icon LinkParameters

• transactionRequests: TransactionRequest []

Array of transaction request objects.

• sendTransactionParams: ProviderCallParams = {}

The provider call parameters (optional).

Icon LinkReturns

Promise<CallResult []>

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

Icon LinkDefined in

packages/account/src/providers/provider.ts:1083 Icon Link


Icon LinkestimateGasPrice()

Icon InfoCircle

estimateGasPrice(blockHorizon): Promise<BN>

Returns the estimate gas price for the given block horizon.

Icon LinkParameters

• blockHorizon: number

The block horizon to estimate gas price for.

Icon LinkReturns

Promise<BN>

A promise that resolves to the estimated gas price.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1869 Icon Link


Icon LinkestimateMultipleTxDependencies()

Icon InfoCircle

estimateMultipleTxDependencies(transactionRequests): Promise<EstimateTxDependenciesReturns []>

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.

Icon LinkParameters

• transactionRequests: TransactionRequest []

Array of transaction request objects.

Icon LinkReturns

Promise<EstimateTxDependenciesReturns []>

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

Icon LinkDefined in

packages/account/src/providers/provider.ts:1002 Icon Link


Icon LinkestimatePredicates()

Icon InfoCircle

estimatePredicates<T>(transactionRequest): Promise<T>

Verifies whether enough gas is available to complete transaction.

Icon LinkType Parameters

• T extends TransactionRequest

The type of the transaction request object.

Icon LinkParameters

• transactionRequest: T

The transaction request object.

Icon LinkReturns

Promise<T>

A promise that resolves to the estimated transaction request object.

Icon LinkDefined in

packages/account/src/providers/provider.ts:888 Icon Link


Icon LinkestimateTxDependencies()

Icon InfoCircle

estimateTxDependencies(transactionRequest): Promise<EstimateTxDependenciesReturns >

Will dryRun a transaction and check for missing dependencies.

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

Icon LinkParameters

• transactionRequest: TransactionRequest

The transaction request object.

Icon LinkReturns

Promise<EstimateTxDependenciesReturns >

A promise that resolves to the estimate transaction dependencies.

Icon LinkDefined in

packages/account/src/providers/provider.ts:932 Icon Link


Icon LinkestimateTxGasAndFee()

Icon InfoCircle

estimateTxGasAndFee(params): Promise<object>

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

Icon LinkParameters

• params

• params.gasPrice?: BN

• params.transactionRequest: TransactionRequest

Icon LinkReturns

Promise<object>

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

Icon LinkgasLimit

Icon InfoCircle

gasLimit: BN

Icon LinkgasPrice

Icon InfoCircle

gasPrice: BN

Icon LinkmaxFee

Icon InfoCircle

maxFee: BN

Icon LinkmaxGas

Icon InfoCircle

maxGas: BN

Icon LinkminFee

Icon InfoCircle

minFee: BN

Icon LinkminGas

Icon InfoCircle

minGas: BN

Icon LinkDefined in

packages/account/src/providers/provider.ts:1109 Icon Link


Icon LinkfetchChain()

Icon InfoCircle

fetchChain(): Promise<ChainInfo >

Returns the chain information for the current provider network.

Icon LinkReturns

Promise<ChainInfo >

a promise that resolves to the chain information.

Icon LinkDefined in

packages/account/src/providers/provider.ts:735 Icon Link


Icon LinkfetchChainAndNodeInfo()

Icon InfoCircle

fetchChainAndNodeInfo(): Promise<object>

Return the chain and node information.

Icon LinkReturns

Promise<object>

A promise that resolves to the Chain and NodeInfo.

Icon Linkchain

Icon InfoCircle

chain: ChainInfo

Icon LinknodeInfo

Icon InfoCircle

nodeInfo: NodeInfo

Icon LinkDefined in

packages/account/src/providers/provider.ts:589 Icon Link


Icon LinkfetchNode()

Icon InfoCircle

fetchNode(): Promise<NodeInfo >

Returns the node information for the current provider network.

Icon LinkReturns

Promise<NodeInfo >

a promise that resolves to the node information.

Icon LinkDefined in

packages/account/src/providers/provider.ts:714 Icon Link


Icon LinkgetBalance()

Icon InfoCircle

getBalance(owner, assetId): Promise<BN>

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

Icon LinkParameters

• owner: string | AbstractAddress

The address to get coins for.

• assetId: BytesLike

The asset ID of coins to get.

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1656 Icon Link


Icon LinkgetBalances()

Icon InfoCircle

getBalances(owner): Promise<GetBalancesResponse >

Returns balances for the given owner.

Icon LinkParameters

• owner: string | AbstractAddress

The address to get coins for.

Icon LinkReturns

Promise<GetBalancesResponse >

A promise that resolves to the balances.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1676 Icon Link


Icon LinkgetBaseAssetId()

Icon InfoCircle

getBaseAssetId(): string

Returns the base asset ID for the current provider network.

Icon LinkReturns

string

the base asset ID.

Icon LinkDefined in

packages/account/src/providers/provider.ts:762 Icon Link


Icon LinkgetBlobs()

Icon InfoCircle

getBlobs(blobIds): Promise<string[]>

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

Icon LinkParameters

• blobIds: string[]

blobIds to check.

Icon LinkReturns

Promise<string[]>

  • A promise that resolves to an array of blobIds that exist on chain.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1417 Icon Link


Icon LinkgetBlock()

Icon InfoCircle

getBlock(idOrHeight): Promise<null | Block >

Returns block matching the given ID or height.

Icon LinkParameters

• idOrHeight: string | number

ID or height of the block.

Icon LinkReturns

Promise<null | Block >

A promise that resolves to the block or null.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1436 Icon Link


Icon LinkgetBlockNumber()

Icon InfoCircle

getBlockNumber(): Promise<BN>

Returns the latest block number.

Icon LinkReturns

Promise<BN>

A promise that resolves to the latest block number.

Icon LinkDefined in

packages/account/src/providers/provider.ts:704 Icon Link


Icon LinkgetBlockWithTransactions()

Icon InfoCircle

getBlockWithTransactions(idOrHeight): Promise<null | Block & object>

Returns block matching the given ID or type, including transaction data.

Icon LinkParameters

• idOrHeight: string | number

ID or height of the block.

Icon LinkReturns

Promise<null | Block & object>

A promise that resolves to the block.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1516 Icon Link


Icon LinkgetBlocks()

Icon InfoCircle

getBlocks(params?): Promise<GetBlocksResponse >

Returns all the blocks matching the given parameters.

Icon LinkParameters

• params?: CursorPaginationArgs

The parameters to query blocks.

Icon LinkReturns

Promise<GetBlocksResponse >

A promise that resolves to the blocks.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1480 Icon Link


Icon LinkgetChain()

Icon InfoCircle

getChain(): ChainInfo

Returns the cached chainInfo for the current URL.

Icon LinkReturns

ChainInfo

the chain information configuration.

Icon LinkDefined in

packages/account/src/providers/provider.ts:525 Icon Link


Icon LinkgetChainId()

Icon InfoCircle

getChainId(): number

Returns the chain ID for the current provider network.

Icon LinkReturns

number

A promise that resolves to the chain ID number.

Icon LinkDefined in

packages/account/src/providers/provider.ts:750 Icon Link


Icon LinkgetCoins()

Icon InfoCircle

getCoins(owner, assetId?, paginationArgs?): Promise<GetCoinsResponse >

Returns coins for the given owner.

Icon LinkParameters

• owner: string | AbstractAddress

The address to get coins for.

• assetId?: BytesLike

The asset ID of coins to get (optional).

• paginationArgs?: CursorPaginationArgs

Pagination arguments (optional).

Icon LinkReturns

Promise<GetCoinsResponse >

A promise that resolves to the coins.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1310 Icon Link


Icon LinkgetContract()

Icon InfoCircle

getContract(contractId): Promise<null | ContractResult >

Get deployed contract with the given ID.

Icon LinkParameters

• contractId: string

ID of the contract.

Icon LinkReturns

Promise<null | ContractResult >

A promise that resolves to the contract.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1621 Icon Link


Icon LinkgetContractBalance()

Icon InfoCircle

getContractBalance(contractId, assetId): Promise<BN>

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

Icon LinkParameters

• contractId: string | AbstractAddress

The contract ID to get the balance for.

• assetId: BytesLike

The asset ID of coins to get.

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1636 Icon Link


Icon LinkgetGasConfig()

Icon InfoCircle

getGasConfig(): object

Returns some helpful parameters related to gas fees.

Icon LinkReturns

object

Icon LinkgasCosts

Icon InfoCircle

gasCosts: GasCosts

Icon LinkgasPerByte

Icon InfoCircle

gasPerByte: BN

Icon LinkgasPriceFactor

Icon InfoCircle

gasPriceFactor: BN

Icon LinkmaxGasPerPredicate

Icon InfoCircle

maxGasPerPredicate: BN

Icon LinkmaxGasPerTx

Icon InfoCircle

maxGasPerTx: BN

Icon LinkDefined in

packages/account/src/providers/provider.ts:555 Icon Link


Icon LinkgetLatestGasPrice()

Icon InfoCircle

getLatestGasPrice(): Promise<BN>

Get the latest gas price from the node.

Icon LinkReturns

Promise<BN>

A promise that resolves to the latest gas price.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1858 Icon Link


Icon LinkgetMessageByNonce()

Icon InfoCircle

getMessageByNonce(nonce): Promise<null | Message >

Returns Message for given nonce.

Icon LinkParameters

• nonce: string

The nonce of the message to retrieve.

Icon LinkReturns

Promise<null | Message >

A promise that resolves to the Message object or null.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1922 Icon Link


Icon LinkgetMessageProof()

Icon InfoCircle

getMessageProof(transactionId, nonce, commitBlockId?, commitBlockHeight?): Promise<null | MessageProof >

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

Icon LinkParameters

• transactionId: string

The transaction to get message from.

• nonce: string

• commitBlockId?: string

The commit block id (optional).

• commitBlockHeight?: BN

The commit block height (optional).

Icon LinkReturns

Promise<null | MessageProof >

A promise that resolves to the message proof.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1748 Icon Link


Icon LinkgetMessageStatus()

Icon InfoCircle

getMessageStatus(nonce): Promise<MessageStatus >

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

Icon LinkParameters

• nonce: string

The nonce of the message to get status from.

Icon LinkReturns

Promise<MessageStatus >

A promise that resolves to the message status

Icon LinkDefined in

packages/account/src/providers/provider.ts:1882 Icon Link


Icon LinkgetMessages()

Icon InfoCircle

getMessages(address, paginationArgs?): Promise<GetMessagesResponse >

Returns message for the given address.

Icon LinkParameters

• address: string | AbstractAddress

The address to get message from.

• paginationArgs?: CursorPaginationArgs

Pagination arguments (optional).

Icon LinkReturns

Promise<GetMessagesResponse >

A promise that resolves to the messages.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1703 Icon Link


Icon LinkgetNode()

Icon InfoCircle

getNode(): NodeInfo

Returns the cached nodeInfo for the current URL.

Icon LinkReturns

NodeInfo

the node information configuration.

Icon LinkDefined in

packages/account/src/providers/provider.ts:541 Icon Link


Icon LinkgetRelayedTransactionStatus()

Icon InfoCircle

getRelayedTransactionStatus(relayedTransactionId): Promise<null | GqlRelayedTransactionFailed>

Get the relayed transaction for the given transaction ID.

Icon LinkParameters

• relayedTransactionId: string

The relayed transaction ID to get the response for.

Icon LinkReturns

Promise<null | GqlRelayedTransactionFailed>

A promise that resolves to the relayed transaction.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1954 Icon Link


Icon LinkgetResourcesToSpend()

Icon InfoCircle

getResourcesToSpend(owner, quantities, excludedIds?): Promise<Resource []>

Returns resources for the given owner satisfying the spend query.

Icon LinkParameters

• owner: string | AbstractAddress

The address to get resources for.

• quantities: CoinQuantityLike []

The coin quantities to get.

• excludedIds?: ExcludeResourcesOption

IDs of excluded resources from the selection (optional).

Icon LinkReturns

Promise<Resource []>

A promise that resolves to the resources.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1349 Icon Link


Icon LinkgetTransaction()

Icon InfoCircle

getTransaction<TTransactionType>(transactionId): Promise<null | Transaction<TTransactionType>>

Get transaction with the given ID.

Icon LinkType Parameters

• TTransactionType = void

Icon LinkParameters

• transactionId: string

ID of the transaction.

Icon LinkReturns

Promise<null | Transaction<TTransactionType>>

A promise that resolves to the transaction.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1562 Icon Link


Icon LinkgetTransactionResponse()

Icon InfoCircle

getTransactionResponse(transactionId): Promise<TransactionResponse >

Get the transaction response for the given transaction ID.

Icon LinkParameters

• transactionId: string

The transaction ID to get the response for.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1912 Icon Link


Icon LinkgetTransactions()

Icon InfoCircle

getTransactions(paginationArgs?): Promise<GetTransactionsResponse >

Retrieves transactions based on the provided pagination arguments.

Icon LinkParameters

• paginationArgs?: CursorPaginationArgs

The pagination arguments for retrieving transactions.

Icon LinkReturns

Promise<GetTransactionsResponse >

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

Icon LinkDefined in

packages/account/src/providers/provider.ts:1591 Icon Link


Icon LinkgetVersion()

Icon InfoCircle

getVersion(): Promise<string>

Returns the version of the connected node.

Icon LinkReturns

Promise<string>

A promise that resolves to the version string.

Icon LinkDefined in

packages/account/src/providers/provider.ts:692 Icon Link


Icon LinkproduceBlocks()

Icon InfoCircle

produceBlocks(amount, startTime?): Promise<BN>

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

Icon LinkParameters

• amount: number

The amount of blocks to produce.

• startTime?: number

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

Icon LinkReturns

Promise<BN>

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

Icon LinkDefined in

packages/account/src/providers/provider.ts:1897 Icon Link


Icon LinksendTransaction()

Icon InfoCircle

sendTransaction(transactionRequestLike, sendTransactionParams): Promise<TransactionResponse >

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.

Icon LinkParameters

• transactionRequestLike: TransactionRequestLike

The transaction request object.

• sendTransactionParams: EstimateTransactionParams = {}

The provider send transaction parameters (optional).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response object.

Icon LinkDefined in

packages/account/src/providers/provider.ts:819 Icon Link


Icon Linksimulate()

Icon InfoCircle

simulate(transactionRequestLike, estimateTxParams): Promise<CallResult >

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

Icon LinkParameters

• transactionRequestLike: TransactionRequestLike

The transaction request object.

• estimateTxParams: EstimateTransactionParams = {}

The estimate transaction params (optional).

Icon LinkReturns

Promise<CallResult >

A promise that resolves to the call result object.

Icon LinkDefined in

packages/account/src/providers/provider.ts:1185 Icon Link


Icon Linkcreate()

Icon InfoCircle

static create(url, options): Promise<Provider >

Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.

Icon LinkParameters

• url: string

GraphQL endpoint of the Fuel node

• options: ProviderOptions = {}

Additional options for the provider

Icon LinkReturns

Promise<Provider >

A promise that resolves to a Provider instance.

Icon LinkDefined in

packages/account/src/providers/provider.ts:502 Icon Link