Class: Provider
@fuel-ts/account.Provider
A provider for connecting to a node
Properties
cache
• Optional
cache: MemoryCache
Defined in
packages/account/src/providers/provider.ts:339
operations
• operations: Object
Type declaration
Name | Type |
---|---|
dryRun | (variables : Exact <{ encodedTransactions : string | string [] ; utxoValidation? : InputMaybe <boolean > }>, options? : unknown ) => Promise <GqlDryRunMutation > |
estimateGasPrice | (variables : Exact <{ blockHorizon : string }>, options? : unknown ) => Promise <GqlEstimateGasPriceQuery > |
estimatePredicates | (variables : Exact <{ encodedTransaction : string }>, options? : unknown ) => Promise <GqlEstimatePredicatesQuery > |
getBalance | (variables : Exact <{ assetId : string ; owner : string }>, options? : unknown ) => Promise <GqlGetBalanceQuery > |
getBalances | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; filter : GqlBalanceFilterInput ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetBalancesQuery > |
getBlock | (variables? : Exact <{ blockId? : InputMaybe <string > ; height? : InputMaybe <string > }>, options? : unknown ) => Promise <GqlGetBlockQuery > |
getBlockWithTransactions | (variables? : Exact <{ blockHeight? : InputMaybe <string > ; blockId? : InputMaybe <string > }>, options? : unknown ) => Promise <GqlGetBlockWithTransactionsQuery > |
getBlocks | (variables? : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetBlocksQuery > |
getChain | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetChainQuery > |
getCoin | (variables : Exact <{ coinId : string }>, options? : unknown ) => Promise <GqlGetCoinQuery > |
getCoins | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; filter : GqlCoinFilterInput ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetCoinsQuery > |
getCoinsToSpend | (variables : Exact <{ excludedIds? : InputMaybe <GqlExcludeInput > ; owner : string ; queryPerAsset : GqlSpendQueryElementInput | GqlSpendQueryElementInput [] }>, options? : unknown ) => Promise <GqlGetCoinsToSpendQuery > |
getContract | (variables : Exact <{ contractId : string }>, options? : unknown ) => Promise <GqlGetContractQuery > |
getContractBalance | (variables : Exact <{ asset : string ; contract : string }>, options? : unknown ) => Promise <GqlGetContractBalanceQuery > |
getLatestGasPrice | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetLatestGasPriceQuery > |
getMessageByNonce | (variables : Exact <{ nonce : string }>, options? : unknown ) => Promise <GqlGetMessageByNonceQuery > |
getMessageProof | (variables : Exact <{ commitBlockHeight? : InputMaybe <string > ; commitBlockId? : InputMaybe <string > ; nonce : string ; transactionId : string }>, options? : unknown ) => Promise <GqlGetMessageProofQuery > |
getMessageStatus | (variables : Exact <{ nonce : string }>, options? : unknown ) => Promise <GqlGetMessageStatusQuery > |
getMessages | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > ; owner : string }>, options? : unknown ) => Promise <GqlGetMessagesQuery > |
getNodeInfo | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetNodeInfoQuery > |
getRelayedTransactionStatus | (variables : Exact <{ relayedTransactionId : string }>, options? : unknown ) => Promise <GqlGetRelayedTransactionStatusQuery > |
getTransaction | (variables : Exact <{ transactionId : string }>, options? : unknown ) => Promise <GqlGetTransactionQuery > |
getTransactionWithReceipts | (variables : Exact <{ transactionId : string }>, options? : unknown ) => Promise <GqlGetTransactionWithReceiptsQuery > |
getTransactions | (variables? : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetTransactionsQuery > |
getTransactionsByOwner | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > ; owner : string }>, options? : unknown ) => Promise <GqlGetTransactionsByOwnerQuery > |
getVersion | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetVersionQuery > |
produceBlocks | (variables : Exact <{ blocksToProduce : string ; startTimestamp? : InputMaybe <string > }>, options? : unknown ) => Promise <GqlProduceBlocksMutation > |
statusChange | (variables : Exact <{ transactionId : string }>, options? : unknown ) => AsyncIterable <GqlStatusChangeSubscription > |
submit | (variables : Exact <{ encodedTransaction : string }>, options? : unknown ) => Promise <GqlSubmitMutation > |
submitAndAwait | (variables : Exact <{ encodedTransaction : string }>, options? : unknown ) => AsyncIterable <GqlSubmitAndAwaitSubscription > |
Defined in
packages/account/src/providers/provider.ts:338
options
• options: ProviderOptions
Defined in
packages/account/src/providers/provider.ts:349
url
• url: string
GraphQL endpoint of the Fuel node
Defined in
packages/account/src/providers/provider.ts:384
chainInfoCache
▪ Private
Static
chainInfoCache: ChainInfoCache
= {}
Defined in
packages/account/src/providers/provider.ts:346
nodeInfoCache
▪ Private
Static
nodeInfoCache: NodeInfoCache
= {}
Defined in
packages/account/src/providers/provider.ts:347
Methods
call
▸ call(transactionRequestLike
, utxoValidation?
): 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.
Parameters
Name | Type | Description |
---|---|---|
transactionRequestLike | TransactionRequestLike | The transaction request object. |
utxoValidation | ProviderCallParams | Additional provider call parameters. |
Returns
Promise
<CallResult
>
A promise that resolves to the call result object.
Defined in
packages/account/src/providers/provider.ts:697
connect
▸ connect(url
, options?
): Promise
<void
>
Updates the URL for the provider and fetches the consensus parameters for the new URL, if needed.
Parameters
Name | Type |
---|---|
url | string |
options? | ProviderOptions |
Returns
Promise
<void
>
Defined in
packages/account/src/providers/provider.ts:455
createOperations
▸ createOperations(): Object
Create GraphQL client and set operations.
Returns
Object
The operation SDK object
Name | Type |
---|---|
dryRun | (variables : Exact <{ encodedTransactions : string | string [] ; utxoValidation? : InputMaybe <boolean > }>, options? : unknown ) => Promise <GqlDryRunMutation > |
estimateGasPrice | (variables : Exact <{ blockHorizon : string }>, options? : unknown ) => Promise <GqlEstimateGasPriceQuery > |
estimatePredicates | (variables : Exact <{ encodedTransaction : string }>, options? : unknown ) => Promise <GqlEstimatePredicatesQuery > |
getBalance | (variables : Exact <{ assetId : string ; owner : string }>, options? : unknown ) => Promise <GqlGetBalanceQuery > |
getBalances | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; filter : GqlBalanceFilterInput ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetBalancesQuery > |
getBlock | (variables? : Exact <{ blockId? : InputMaybe <string > ; height? : InputMaybe <string > }>, options? : unknown ) => Promise <GqlGetBlockQuery > |
getBlockWithTransactions | (variables? : Exact <{ blockHeight? : InputMaybe <string > ; blockId? : InputMaybe <string > }>, options? : unknown ) => Promise <GqlGetBlockWithTransactionsQuery > |
getBlocks | (variables? : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetBlocksQuery > |
getChain | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetChainQuery > |
getCoin | (variables : Exact <{ coinId : string }>, options? : unknown ) => Promise <GqlGetCoinQuery > |
getCoins | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; filter : GqlCoinFilterInput ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetCoinsQuery > |
getCoinsToSpend | (variables : Exact <{ excludedIds? : InputMaybe <GqlExcludeInput > ; owner : string ; queryPerAsset : GqlSpendQueryElementInput | GqlSpendQueryElementInput [] }>, options? : unknown ) => Promise <GqlGetCoinsToSpendQuery > |
getContract | (variables : Exact <{ contractId : string }>, options? : unknown ) => Promise <GqlGetContractQuery > |
getContractBalance | (variables : Exact <{ asset : string ; contract : string }>, options? : unknown ) => Promise <GqlGetContractBalanceQuery > |
getLatestGasPrice | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetLatestGasPriceQuery > |
getMessageByNonce | (variables : Exact <{ nonce : string }>, options? : unknown ) => Promise <GqlGetMessageByNonceQuery > |
getMessageProof | (variables : Exact <{ commitBlockHeight? : InputMaybe <string > ; commitBlockId? : InputMaybe <string > ; nonce : string ; transactionId : string }>, options? : unknown ) => Promise <GqlGetMessageProofQuery > |
getMessageStatus | (variables : Exact <{ nonce : string }>, options? : unknown ) => Promise <GqlGetMessageStatusQuery > |
getMessages | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > ; owner : string }>, options? : unknown ) => Promise <GqlGetMessagesQuery > |
getNodeInfo | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetNodeInfoQuery > |
getRelayedTransactionStatus | (variables : Exact <{ relayedTransactionId : string }>, options? : unknown ) => Promise <GqlGetRelayedTransactionStatusQuery > |
getTransaction | (variables : Exact <{ transactionId : string }>, options? : unknown ) => Promise <GqlGetTransactionQuery > |
getTransactionWithReceipts | (variables : Exact <{ transactionId : string }>, options? : unknown ) => Promise <GqlGetTransactionWithReceiptsQuery > |
getTransactions | (variables? : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > }>, options? : unknown ) => Promise <GqlGetTransactionsQuery > |
getTransactionsByOwner | (variables : Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > ; owner : string }>, options? : unknown ) => Promise <GqlGetTransactionsByOwnerQuery > |
getVersion | (variables? : Exact <{ [key: string] : never ; }>, options? : unknown ) => Promise <GqlGetVersionQuery > |
produceBlocks | (variables : Exact <{ blocksToProduce : string ; startTimestamp? : InputMaybe <string > }>, options? : unknown ) => Promise <GqlProduceBlocksMutation > |
statusChange | (variables : Exact <{ transactionId : string }>, options? : unknown ) => AsyncIterable <GqlStatusChangeSubscription > |
submit | (variables : Exact <{ encodedTransaction : string }>, options? : unknown ) => Promise <GqlSubmitMutation > |
submitAndAwait | (variables : Exact <{ encodedTransaction : string }>, options? : unknown ) => AsyncIterable <GqlSubmitAndAwaitSubscription > |
Defined in
packages/account/src/providers/provider.ts:496
dryRunMultipleTransactions
▸ dryRunMultipleTransactions(transactionRequests
, «destructured»?
): Promise
<CallResult
[]>
Parameters
Name | Type |
---|---|
transactionRequests | TransactionRequest [] |
«destructured» | ProviderCallParams |
Returns
Promise
<CallResult
[]>
Defined in
packages/account/src/providers/provider.ts:910
estimateGasPrice
▸ estimateGasPrice(blockHorizon
): Promise
<BN
>
Parameters
Name | Type |
---|---|
blockHorizon | number |
Returns
Promise
<BN
>
Defined in
packages/account/src/providers/provider.ts:1635
estimateMultipleTxDependencies
▸ 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.
Parameters
Name | Type | Description |
---|---|---|
transactionRequests | TransactionRequest [] | Array of transaction request objects. |
Returns
Promise
<EstimateTxDependenciesReturns
[]>
A promise that resolves to an array of results for each transaction.
Defined in
packages/account/src/providers/provider.ts:837
estimatePredicates
▸ estimatePredicates(transactionRequest
): Promise
<TransactionRequest
>
Verifies whether enough gas is available to complete transaction.
Parameters
Name | Type | Description |
---|---|---|
transactionRequest | TransactionRequest | The transaction request object. |
Returns
Promise
<TransactionRequest
>
A promise that resolves to the estimated transaction request object.
Defined in
packages/account/src/providers/provider.ts:722
estimateTxDependencies
▸ 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.
Parameters
Name | Type | Description |
---|---|---|
transactionRequest | TransactionRequest | The transaction request object. |
Returns
Promise
<EstimateTxDependenciesReturns
>
A promise.
Defined in
packages/account/src/providers/provider.ts:767
estimateTxGasAndFee
▸ estimateTxGasAndFee(params
): Promise
<{ gasLimit
: BN
; gasPrice
: BN
; maxFee
: BN
; maxGas
: BN
; minFee
: BN
; minGas
: BN
}>
Estimates the transaction gas and fee based on the provided transaction request.
Parameters
Name | Type |
---|---|
params | Object |
params.gasPrice? | BN |
params.transactionRequest | TransactionRequest |
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.
Defined in
packages/account/src/providers/provider.ts:936
fetchChain
▸ fetchChain(): Promise
<ChainInfo
>
Fetches the chainInfo
for the given node URL.
Returns
Promise
<ChainInfo
>
ChainInfo object
Defined in
packages/account/src/providers/provider.ts:582
fetchChainAndNodeInfo
▸ fetchChainAndNodeInfo(): Promise
<{ chain
: ChainInfo
; nodeInfo
: NodeInfo
}>
Fetches both the chain and node information, saves it to the cache, and return it.
Returns
Promise
<{ chain
: ChainInfo
; nodeInfo
: NodeInfo
}>
NodeInfo and Chain
Defined in
packages/account/src/providers/provider.ts:467
fetchNode
▸ fetchNode(): Promise
<NodeInfo
>
Returns the chain information.
Returns
Promise
<NodeInfo
>
NodeInfo object
Defined in
packages/account/src/providers/provider.ts:561
getBalance
▸ getBalance(owner
, assetId
): Promise
<BN
>
Returns the balance for the given owner for the given asset ID.
Parameters
Name | Type | Description |
---|---|---|
owner | string | AbstractAddress | 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.
Defined in
packages/account/src/providers/provider.ts:1437
getBalances
▸ getBalances(owner
, paginationArgs?
): Promise
<CoinQuantity
[]>
Returns balances for the given owner.
Parameters
Name | Type | Description |
---|---|---|
owner | string | AbstractAddress | The address to get coins for. |
paginationArgs? | CursorPaginationArgs | Pagination arguments. |
Returns
Promise
<CoinQuantity
[]>
A promise that resolves to the balances.
Defined in
packages/account/src/providers/provider.ts:1457
getBaseAssetId
▸ getBaseAssetId(): string
Returns the base asset ID for the current provider network
Returns
string
the base asset ID
Defined in
packages/account/src/providers/provider.ts:608
getBlock
▸ getBlock(idOrHeight
): Promise
<null
| Block
>
Returns block matching the given ID or height.
Parameters
Name | Type | Description |
---|---|---|
idOrHeight | string | number | ID or height of the block. |
Returns
Promise
<null
| Block
>
A promise that resolves to the block.
Defined in
packages/account/src/providers/provider.ts:1293
getBlockNumber
▸ getBlockNumber(): Promise
<BN
>
Returns the block number.
Returns
Promise
<BN
>
A promise that resolves to the block number
Defined in
packages/account/src/providers/provider.ts:551
getBlockWithTransactions
▸ getBlockWithTransactions(idOrHeight
): Promise
<null
| Block
& { transactions
: Partial
<Omit
<TransactionScript
, "type"
>> & Partial
<Omit
<TransactionCreate
, "type"
>> & Partial
<Omit
<TransactionMint
, "type"
>> & Partial
<Omit
<TransactionUpgrade
, "type"
>> & Partial
<Omit
<TransactionUpload
, "type"
>> & { type
: TransactionType
}[] }>
Returns block matching the given ID or type, including transaction data.
Parameters
Name | Type | Description |
---|---|---|
idOrHeight | string | number | ID or height of the block. |
Returns
Promise
<null
| Block
& { transactions
: Partial
<Omit
<TransactionScript
, "type"
>> & Partial
<Omit
<TransactionCreate
, "type"
>> & Partial
<Omit
<TransactionMint
, "type"
>> & Partial
<Omit
<TransactionUpgrade
, "type"
>> & Partial
<Omit
<TransactionUpload
, "type"
>> & { type
: TransactionType
}[] }>
A promise that resolves to the block.
Defined in
packages/account/src/providers/provider.ts:1347
getBlocks
▸ getBlocks(params
): Promise
<Block
[]>
Returns all the blocks matching the given parameters.
Parameters
Name | Type | Description |
---|---|---|
params | Exact <{ after? : InputMaybe <string > ; before? : InputMaybe <string > ; first? : InputMaybe <number > ; last? : InputMaybe <number > }> | The parameters to query blocks. |
Returns
Promise
<Block
[]>
A promise that resolves to the blocks.
Defined in
packages/account/src/providers/provider.ts:1328
getChain
▸ getChain(): ChainInfo
Returns the cached chainInfo for the current URL.
Returns
Defined in
packages/account/src/providers/provider.ts:408
getChainId
▸ getChainId(): number
Returns the chain ID
Returns
number
A promise that resolves to the chain ID number
Defined in
packages/account/src/providers/provider.ts:596
getCoins
▸ getCoins(owner
, assetId?
, paginationArgs?
): Promise
<Coin
[]>
Returns coins for the given owner.
Parameters
Name | Type | Description |
---|---|---|
owner | string | AbstractAddress | The address to get coins for |
assetId? | BytesLike | The asset ID of coins to get |
paginationArgs? | CursorPaginationArgs | Pagination arguments |
Returns
Promise
<Coin
[]>
Defined in
packages/account/src/providers/provider.ts:1187
getContract
▸ getContract(contractId
): Promise
<null
| ContractResult
>
Get deployed contract with the given ID.
Parameters
Name | Type | Description |
---|---|---|
contractId | string | ID of the contract. |
Returns
Promise
<null
| ContractResult
>
A promise that resolves to the contract.
Defined in
packages/account/src/providers/provider.ts:1402
getContractBalance
▸ getContractBalance(contractId
, assetId
): Promise
<BN
>
Returns the balance for the given contract for the given asset ID.
Parameters
Name | Type | Description |
---|---|---|
contractId | string | AbstractAddress | 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.
Defined in
packages/account/src/providers/provider.ts:1417
getGasConfig
▸ getGasConfig(): Object
Returns some helpful parameters related to gas fees.
Returns
Object
Name | Type |
---|---|
gasCosts | GasCosts |
gasPerByte | BN |
gasPriceFactor | BN |
maxGasPerPredicate | BN |
maxGasPerTx | BN |
Defined in
packages/account/src/providers/provider.ts:436
getLatestGasPrice
▸ getLatestGasPrice(): Promise
<BN
>
Returns
Promise
<BN
>
Defined in
packages/account/src/providers/provider.ts:1630
getMessageByNonce
▸ getMessageByNonce(nonce
): Promise
<null
| GqlMessage
>
Returns Message for given nonce.
Parameters
Name | Type | Description |
---|---|---|
nonce | string | The nonce of the message to retrieve. |
Returns
Promise
<null
| GqlMessage
>
A promise that resolves to the Message object.
Defined in
packages/account/src/providers/provider.ts:1682
getMessageProof
▸ getMessageProof(transactionId
, nonce
, commitBlockId?
, commitBlockHeight?
): Promise
<null
| MessageProof
>
Returns Message Proof for given transaction id and the message id from MessageOut receipt.
Parameters
Name | Type | Description |
---|---|---|
transactionId | string | The transaction to get message from. |
nonce | string | - |
commitBlockId? | string | The commit block id. |
commitBlockHeight? | BN | The commit block height. |
Returns
Promise
<null
| MessageProof
>
A promise that resolves to the message proof.
Defined in
packages/account/src/providers/provider.ts:1524
getMessageStatus
▸ getMessageStatus(nonce
): Promise
<MessageStatus
>
Returns Message Proof for given transaction id and the message id from MessageOut receipt.
Parameters
Name | Type | Description |
---|---|---|
nonce | string | The nonce of the message to get status from. |
Returns
Promise
<MessageStatus
>
A promise that resolves to the message status
Defined in
packages/account/src/providers/provider.ts:1648
getMessages
▸ getMessages(address
, paginationArgs?
): Promise
<Message
[]>
Returns message for the given address.
Parameters
Name | Type | Description |
---|---|---|
address | string | AbstractAddress | The address to get message from. |
paginationArgs? | CursorPaginationArgs | Pagination arguments. |
Returns
Promise
<Message
[]>
A promise that resolves to the messages.
Defined in
packages/account/src/providers/provider.ts:1484
getNode
▸ getNode(): NodeInfo
Returns the cached nodeInfo for the current URL.
Returns
Defined in
packages/account/src/providers/provider.ts:422
getRelayedTransactionStatus
▸ getRelayedTransactionStatus(relayedTransactionId
): Promise
<null
| GqlRelayedTransactionFailed
>
Parameters
Name | Type |
---|---|
relayedTransactionId | string |
Returns
Promise
<null
| GqlRelayedTransactionFailed
>
Defined in
packages/account/src/providers/provider.ts:1692
getResourcesForTransaction
▸ getResourcesForTransaction(owner
, transactionRequestLike
, quantitiesToContract?
): Promise
<{ addedSignatures
: number
; dryRunStatus?
: DryRunStatus
; estimatedPredicates
: TransactionRequestInput
[] ; gasPrice
: BN
; gasUsed
: BN
; maxFee
: BN
; maxGas
: BN
; minFee
: BN
; minGas
: BN
; missingContractIds
: string
[] ; outputVariables
: number
; receipts
: TransactionResultReceipt
[] ; requiredQuantities
: CoinQuantity
[] ; resources
: Resource
[] }>
Parameters
Name | Type | Default value |
---|---|---|
owner | string | AbstractAddress | undefined |
transactionRequestLike | TransactionRequestLike | undefined |
quantitiesToContract | CoinQuantity [] | [] |
Returns
Promise
<{ addedSignatures
: number
; dryRunStatus?
: DryRunStatus
; estimatedPredicates
: TransactionRequestInput
[] ; gasPrice
: BN
; gasUsed
: BN
; maxFee
: BN
; maxGas
: BN
; minFee
: BN
; minGas
: BN
; missingContractIds
: string
[] ; outputVariables
: number
; receipts
: TransactionResultReceipt
[] ; requiredQuantities
: CoinQuantity
[] ; resources
: Resource
[] }>
Defined in
packages/account/src/providers/provider.ts:1151
getResourcesToSpend
▸ getResourcesToSpend(owner
, quantities
, excludedIds?
): Promise
<Resource
[]>
Returns resources for the given owner satisfying the spend query.
Parameters
Name | Type | Description |
---|---|---|
owner | string | AbstractAddress | The address to get resources for. |
quantities | CoinQuantityLike [] | The quantities to get. |
excludedIds? | ExcludeResourcesOption | IDs of excluded resources from the selection. |
Returns
Promise
<Resource
[]>
A promise that resolves to the resources.
Defined in
packages/account/src/providers/provider.ts:1222
getTransaction
▸ getTransaction<TTransactionType
>(transactionId
): Promise
<null
| Transaction
<TTransactionType
>>
Get transaction with the given ID.
Type parameters
Name | Type |
---|---|
TTransactionType | void |
Parameters
Name | Type | Description |
---|---|---|
transactionId | string | ID of the transaction. |
Returns
Promise
<null
| Transaction
<TTransactionType
>>
A promise that resolves to the transaction.
Defined in
packages/account/src/providers/provider.ts:1383
getTransactionCost
▸ getTransactionCost(transactionRequestLike
, tolerance?
): Promise
<TransactionCost
>
Returns a transaction cost to enable user to set gasLimit and also reserve balance amounts on the the transaction.
Parameters
Name | Type | Description |
---|---|---|
transactionRequestLike | TransactionRequestLike | The transaction request object. |
tolerance | TransactionCostParams | The tolerance to add on top of the gasUsed. |
Returns
Promise
<TransactionCost
>
A promise that resolves to the transaction cost object.
Defined in
packages/account/src/providers/provider.ts:1052
getTransactionResponse
▸ getTransactionResponse(transactionId
): Promise
<TransactionResponse
>
Parameters
Name | Type |
---|---|
transactionId | string |
Returns
Promise
<TransactionResponse
>
Defined in
packages/account/src/providers/provider.ts:1672
getVersion
▸ getVersion(): Promise
<string
>
Returns the version of the connected node.
Returns
Promise
<string
>
A promise that resolves to the version string.
Defined in
packages/account/src/providers/provider.ts:539
produceBlocks
▸ produceBlocks(amount
, startTime?
): Promise
<BN
>
Lets you produce blocks with custom timestamps and the block number of the last block produced.
Parameters
Name | Type | Description |
---|---|---|
amount | number | The amount of blocks to produce |
startTime? | number | The UNIX timestamp (milliseconds) to set for the first produced block |
Returns
Promise
<BN
>
A promise that resolves to the block number of the last produced block.
Defined in
packages/account/src/providers/provider.ts:1663
sendTransaction
▸ sendTransaction(transactionRequestLike
, «destructured»?
): 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.
Parameters
Name | Type | Description |
---|---|---|
transactionRequestLike | TransactionRequestLike | The transaction request object. |
«destructured» | ProviderSendTxParams | - |
Returns
Promise
<TransactionResponse
>
A promise that resolves to the transaction response object.
Defined in
packages/account/src/providers/provider.ts:640
simulate
▸ simulate(transactionRequestLike
, «destructured»?
): 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
Parameters
Name | Type | Description |
---|---|---|
transactionRequestLike | TransactionRequestLike | The transaction request object. |
«destructured» | EstimateTransactionParams | - |
Returns
Promise
<CallResult
>
A promise that resolves to the call result object.
Defined in
packages/account/src/providers/provider.ts:1011
clearChainAndNodeCaches
▸ clearChainAndNodeCaches(): void
Returns
void
Defined in
packages/account/src/providers/provider.ts:341
create
▸ create(url
, options?
): Promise
<Provider
>
Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
Parameters
Name | Type | Description |
---|---|---|
url | string | GraphQL endpoint of the Fuel node |
options | ProviderOptions | Additional options for the provider |
Returns
Promise
<Provider
>
Defined in
packages/account/src/providers/provider.ts:399
ensureClientVersionIsSupported
▸ ensureClientVersionIsSupported(nodeInfo
): void
Parameters
Name | Type |
---|---|
nodeInfo | NodeInfo |
Returns
void
Defined in
packages/account/src/providers/provider.ts:479
getFetchFn
▸ getFetchFn(options
): (url
: string
, requestInit?
: RequestInit
, providerOptions?
: Omit
<ProviderOptions
, "fetch"
>) => Promise
<Response
>
Parameters
Name | Type |
---|---|
options | ProviderOptions |
Returns
fn
▸ (url
, requestInit?
, providerOptions?
): Promise
<Response
>
Custom fetch function to use for making requests.
Parameters
Name | Type |
---|---|
url | string |
requestInit? | RequestInit |
providerOptions? | Omit <ProviderOptions , "fetch" > |
Returns
Promise
<Response
>