@fuel-ts/account v0.95.0 • Docs
A provider for connecting to a node
optional
cache:ResourceCache
packages/account/src/providers/provider.ts:404
operations:
SdkOperations
packages/account/src/providers/provider.ts:403
options:
ProviderOptions
packages/account/src/providers/provider.ts:421
connect(
url
,options
?):Promise
<void
>
Updates the URL for the provider and fetches the consensus parameters for the new URL, if needed.
• url: string
The URL to connect to.
• options?: ProviderOptions
Additional options for the provider.
Promise
<void
>
packages/account/src/providers/provider.ts:589
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.
• transactionRequestLike: TransactionRequestLike
The transaction request object.
• sendTransactionParams: ProviderCallParams
= {}
The provider call parameters (optional).
Promise
<CallResult
>
A promise that resolves to the call result object.
packages/account/src/providers/provider.ts:901
dryRunMultipleTransactions(
transactionRequests
,sendTransactionParams
):Promise
<CallResult
[]>
Dry runs multiple transactions.
• transactionRequests: TransactionRequest
[]
Array of transaction request objects.
• sendTransactionParams: ProviderCallParams
= {}
The provider call parameters (optional).
Promise
<CallResult
[]>
A promise that resolves to an array of results for each transaction call.
packages/account/src/providers/provider.ts:1123
estimateGasPrice(
blockHorizon
):Promise
<BN
>
Returns the estimate gas price for the given block horizon.
• blockHorizon: number
The block horizon to estimate gas price for.
Promise
<BN
>
A promise that resolves to the estimated gas price.
packages/account/src/providers/provider.ts:1917
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.
• transactionRequests: TransactionRequest
[]
Array of transaction request objects.
Promise
<EstimateTxDependenciesReturns
[]>
A promise that resolves to an array of results for each transaction.
packages/account/src/providers/provider.ts:1042
estimatePredicates<
T
>(transactionRequest
):Promise
<T
>
Verifies whether enough gas is available to complete transaction.
• T extends TransactionRequest
The type of the transaction request object.
• transactionRequest: T
The transaction request object.
Promise
<T
>
A promise that resolves to the estimated transaction request object.
packages/account/src/providers/provider.ts:928
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.
• transactionRequest: TransactionRequest
The transaction request object.
Promise
<EstimateTxDependenciesReturns
>
A promise that resolves to the estimate transaction dependencies.
packages/account/src/providers/provider.ts:972
estimateTxGasAndFee(
params
):Promise
<object
>
Estimates the transaction gas and fee based on the provided transaction request.
• params
• params.gasPrice?: BN
• params.transactionRequest: TransactionRequest
Promise
<object
>
An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
gasLimit:
BN
gasPrice:
BN
maxFee:
BN
maxGas:
BN
minFee:
BN
minGas:
BN
packages/account/src/providers/provider.ts:1149
fetchChain():
Promise
<ChainInfo
>
Returns the chain information for the current provider network.
Promise
<ChainInfo
>
a promise that resolves to the chain information.
packages/account/src/providers/provider.ts:775
fetchChainAndNodeInfo():
Promise
<object
>
Return the chain and node information.
Promise
<object
>
A promise that resolves to the Chain and NodeInfo.
chain:
ChainInfo
nodeInfo:
NodeInfo
packages/account/src/providers/provider.ts:606
fetchNode():
Promise
<NodeInfo
>
Returns the node information for the current provider network.
Promise
<NodeInfo
>
a promise that resolves to the node information.
packages/account/src/providers/provider.ts:754
getAddressType(
id
):Promise
<"Blob"
|"Account"
|"Contract"
|"Transaction"
>
• id: string
Promise
<"Blob"
| "Account"
| "Contract"
| "Transaction"
>
packages/account/src/providers/provider.ts:1972
getBalance(
owner
,assetId
):Promise
<BN
>
Returns the balance for the given owner for the given asset ID.
• owner: string
| AbstractAddress
The address to get coins for.
• assetId: BytesLike
The asset ID of coins to get.
Promise
<BN
>
A promise that resolves to the balance.
packages/account/src/providers/provider.ts:1704
getBalances(
owner
):Promise
<GetBalancesResponse
>
Returns balances for the given owner.
• owner: string
| AbstractAddress
The address to get coins for.
Promise
<GetBalancesResponse
>
A promise that resolves to the balances.
packages/account/src/providers/provider.ts:1724
getBaseAssetId():
string
Returns the base asset ID for the current provider network.
string
the base asset ID.
packages/account/src/providers/provider.ts:802
getBlobs(
blobIds
):Promise
<string
[]>
Returns an array of blobIds that exist on chain, for a given array of blobIds.
• blobIds: string
[]
blobIds to check.
Promise
<string
[]>
packages/account/src/providers/provider.ts:1457
getBlock(
idOrHeight
):Promise
<null
|Block
>
Returns block matching the given ID or height.
• idOrHeight: string
| number
ID or height of the block.
Promise
<null
| Block
>
A promise that resolves to the block or null.
packages/account/src/providers/provider.ts:1476
getBlockNumber():
Promise
<BN
>
Returns the latest block number.
Promise
<BN
>
A promise that resolves to the latest block number.
packages/account/src/providers/provider.ts:740
getBlockWithTransactions(
idOrHeight
):Promise
<null
|Block
&object
>
Returns block matching the given ID or type, including transaction data.
• idOrHeight: string
| number
ID or height of the block.
Promise
<null
| Block
& object
>
A promise that resolves to the block.
packages/account/src/providers/provider.ts:1559
getBlocks(
params
?):Promise
<GetBlocksResponse
>
Returns all the blocks matching the given parameters.
• params?: CursorPaginationArgs
The parameters to query blocks.
Promise
<GetBlocksResponse
>
A promise that resolves to the blocks.
packages/account/src/providers/provider.ts:1523
getChain():
ChainInfo
Returns the cached chainInfo for the current URL.
the chain information configuration.
packages/account/src/providers/provider.ts:537
getChainId():
number
Returns the chain ID for the current provider network.
number
A promise that resolves to the chain ID number.
packages/account/src/providers/provider.ts:790
getCoins(
owner
,assetId
?,paginationArgs
?):Promise
<GetCoinsResponse
>
Returns coins for the given owner.
• owner: string
| AbstractAddress
The address to get coins for.
• assetId?: BytesLike
The asset ID of coins to get (optional).
• paginationArgs?: CursorPaginationArgs
Pagination arguments (optional).
Promise
<GetCoinsResponse
>
A promise that resolves to the coins.
packages/account/src/providers/provider.ts:1350
getContract(
contractId
):Promise
<null
|ContractResult
>
Get deployed contract with the given ID.
• contractId: string
ID of the contract.
Promise
<null
| ContractResult
>
A promise that resolves to the contract.
packages/account/src/providers/provider.ts:1669
getContractBalance(
contractId
,assetId
):Promise
<BN
>
Returns the balance for the given contract for the given asset ID.
• contractId: string
| AbstractAddress
The contract ID to get the balance for.
• assetId: BytesLike
The asset ID of coins to get.
Promise
<BN
>
A promise that resolves to the balance.
packages/account/src/providers/provider.ts:1684
getGasConfig():
object
Returns some helpful parameters related to gas fees.
object
gasCosts:
GasCosts
gasPerByte:
BN
gasPriceFactor:
BN
maxGasPerPredicate:
BN
maxGasPerTx:
BN
packages/account/src/providers/provider.ts:567
getLatestGasPrice():
Promise
<BN
>
Get the latest gas price from the node.
Promise
<BN
>
A promise that resolves to the latest gas price.
packages/account/src/providers/provider.ts:1906
getMessageByNonce(
nonce
):Promise
<null
|Message
>
Returns Message for given nonce.
• nonce: string
The nonce of the message to retrieve.
Promise
<null
| Message
>
A promise that resolves to the Message object or null.
packages/account/src/providers/provider.ts:2009
getMessageProof(
transactionId
,nonce
,commitBlockId
?,commitBlockHeight
?):Promise
<null
|MessageProof
>
Returns Message Proof for given transaction id and the message id from MessageOut receipt.
• transactionId: string
The transaction to get message from.
• nonce: string
• commitBlockId?: string
The commit block id (optional).
• commitBlockHeight?: BN
The commit block height (optional).
Promise
<null
| MessageProof
>
A promise that resolves to the message proof.
packages/account/src/providers/provider.ts:1796
getMessageStatus(
nonce
):Promise
<MessageStatus
>
Returns Message Proof for given transaction id and the message id from MessageOut receipt.
• nonce: string
The nonce of the message to get status from.
Promise
<MessageStatus
>
A promise that resolves to the message status
packages/account/src/providers/provider.ts:1930
getMessages(
address
,paginationArgs
?):Promise
<GetMessagesResponse
>
Returns message for the given address.
• address: string
| AbstractAddress
The address to get message from.
• paginationArgs?: CursorPaginationArgs
Pagination arguments (optional).
Promise
<GetMessagesResponse
>
A promise that resolves to the messages.
packages/account/src/providers/provider.ts:1751
getNode():
NodeInfo
Returns the cached nodeInfo for the current URL.
the node information configuration.
packages/account/src/providers/provider.ts:553
getRelayedTransactionStatus(
relayedTransactionId
):Promise
<null
|GqlRelayedTransactionFailed
>
Get the relayed transaction for the given transaction ID.
• relayedTransactionId: string
The relayed transaction ID to get the response for.
Promise
<null
| GqlRelayedTransactionFailed
>
A promise that resolves to the relayed transaction.
packages/account/src/providers/provider.ts:2041
getResourcesToSpend(
owner
,quantities
,excludedIds
?):Promise
<Resource
[]>
Returns resources for the given owner satisfying the spend query.
• 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).
Promise
<Resource
[]>
A promise that resolves to the resources.
packages/account/src/providers/provider.ts:1389
getTransaction<
TTransactionType
>(transactionId
):Promise
<null
|Transaction
<TTransactionType
>>
Get transaction with the given ID.
• TTransactionType = void
• transactionId: string
ID of the transaction.
Promise
<null
| Transaction
<TTransactionType
>>
A promise that resolves to the transaction.
packages/account/src/providers/provider.ts:1605
getTransactionResponse(
transactionId
):Promise
<TransactionResponse
>
Get the transaction response for the given transaction ID.
• transactionId: string
The transaction ID to get the response for.
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
packages/account/src/providers/provider.ts:1999
getTransactions(
paginationArgs
?):Promise
<GetTransactionsResponse
>
Retrieves transactions based on the provided pagination arguments.
• paginationArgs?: CursorPaginationArgs
The pagination arguments for retrieving transactions.
Promise
<GetTransactionsResponse
>
A promise that resolves to an object containing the retrieved transactions and pagination information.
packages/account/src/providers/provider.ts:1634
getVersion():
Promise
<string
>
Returns the version of the connected node.
Promise
<string
>
A promise that resolves to the version string.
packages/account/src/providers/provider.ts:728
isUserAccount(
id
):Promise
<boolean
>
Check if the given ID is an account.
• id: string
The ID to check.
Promise
<boolean
>
A promise that resolves to the result of the check.
packages/account/src/providers/provider.ts:1959
produceBlocks(
amount
,startTime
?):Promise
<BN
>
Lets you produce blocks with custom timestamps and the block number of the last block produced.
• amount: number
The amount of blocks to produce.
• startTime?: number
The UNIX timestamp (milliseconds) to set for the first produced block (optional).
Promise
<BN
>
A promise that resolves to the block number of the last produced block.
packages/account/src/providers/provider.ts:1945
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.
• transactionRequestLike: TransactionRequestLike
The transaction request object.
• sendTransactionParams: EstimateTransactionParams
= {}
The provider send transaction parameters (optional).
Promise
<TransactionResponse
>
A promise that resolves to the transaction response object.
packages/account/src/providers/provider.ts:859
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
• transactionRequestLike: TransactionRequestLike
The transaction request object.
• estimateTxParams: EstimateTransactionParams
= {}
The estimate transaction params (optional).
Promise
<CallResult
>
A promise that resolves to the call result object.
packages/account/src/providers/provider.ts:1225
static
create(url
,options
):Promise
<Provider
>
Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
• url: string
GraphQL endpoint of the Fuel node
• options: ProviderOptions
= {}
Additional options for the provider
Promise
<Provider
>
A promise that resolves to a Provider instance.