Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Account

Icon LinkClass: Account

@fuel-ts/account .Account

Account provides an abstraction for interacting with accounts or wallets on the network.

Icon LinkHierarchy

Icon LinkConstructors

Icon Linkconstructor

new Account(address, provider?, connector?): Account

Creates a new Account instance.

Icon LinkParameters

NameTypeDescription
addressstring | AbstractAddress The address of the account.
provider?Provider A Provider instance (optional).
connector?FuelConnector -

Icon LinkReturns

Account

Icon LinkOverrides

AbstractAccount .constructor

Icon LinkDefined in

packages/account/src/account.ts:62 Icon Link

Icon LinkProperties

Icon Link_connector

Protected Optional _connector: FuelConnector

Icon LinkDefined in

packages/account/src/account.ts:54 Icon Link


Icon Link_provider

Protected Optional _provider: Provider

The provider used to interact with the network.

Icon LinkDefined in

packages/account/src/account.ts:52 Icon Link


Icon Linkaddress

Readonly address: AbstractAddress

The address associated with the account.

Icon LinkOverrides

AbstractAccount .address

Icon LinkDefined in

packages/account/src/account.ts:47 Icon Link

Icon LinkAccessors

Icon Linkprovider

get provider(): Provider

The provider used to interact with the network.

Throws

FuelError if the provider is not set.

Icon LinkReturns

Provider

A Provider instance.

Icon LinkOverrides

AbstractAccount.provider

Icon LinkDefined in

packages/account/src/account.ts:76 Icon Link

set provider(provider): void

Sets the provider for the account.

Icon LinkParameters

NameTypeDescription
providerProvider A Provider instance.

Icon LinkReturns

void

Icon LinkOverrides

AbstractAccount.provider

Icon LinkDefined in

packages/account/src/account.ts:89 Icon Link

Icon LinkMethods

Icon Linkconnect

connect(provider): Provider

Changes the provider connection for the account.

Icon LinkParameters

NameTypeDescription
providerProvider A Provider instance.

Icon LinkReturns

Provider

The updated Provider instance.

Icon LinkDefined in

packages/account/src/account.ts:99 Icon Link


Icon LinkcreateTransfer

createTransfer(destination, amount, assetId?, txParams?): Promise<TransactionRequest >

A helper that creates a transfer transaction request and returns it.

Icon LinkParameters

NameTypeDefault valueDescription
destinationstring | AbstractAddress undefinedThe address of the destination.
amountBigNumberishundefinedThe amount of coins to transfer.
assetIdBytesLike BaseAssetIdThe asset ID of the coins to transfer.
txParamsTxParamsType {}The transaction parameters (gasLimit, gasPrice, maturity).

Icon LinkReturns

Promise<TransactionRequest >

A promise that resolves to the prepared transaction request.

Icon LinkDefined in

packages/account/src/account.ts:319 Icon Link


Icon Linkfund

fund<T>(request, coinQuantities, fee): Promise<void>

Adds resources to the transaction enough to fund it.

Icon LinkType parameters

NameType
Textends TransactionRequest

Icon LinkParameters

NameTypeDescription
requestTThe transaction request.
coinQuantitiesCoinQuantity []The coin quantities required to execute the transaction.
feeBNThe estimated transaction fee.

Icon LinkReturns

Promise<void>

A promise that resolves when the resources are added to the transaction.

Icon LinkOverrides

AbstractAccount .fund

Icon LinkDefined in

packages/account/src/account.ts:240 Icon Link


Icon LinkgetBalance

getBalance(assetId?): Promise<BN>

Retrieves the balance of the account for the given asset.

Icon LinkParameters

NameTypeDefault valueDescription
assetIdBytesLike BaseAssetIdThe asset ID to check the balance for.

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance amount.

Icon LinkDefined in

packages/account/src/account.ts:193 Icon Link


Icon LinkgetBalances

getBalances(): Promise<CoinQuantity []>

Retrieves all the balances for the account.

Icon LinkReturns

Promise<CoinQuantity []>

A promise that resolves to an array of Coins and their quantities.

Icon LinkDefined in

packages/account/src/account.ts:203 Icon Link


Icon LinkgetCoins

getCoins(assetId?): Promise<Coin []>

Retrieves coins owned by the account.

Icon LinkParameters

NameTypeDescription
assetId?BytesLike The asset ID of the coins to retrieve.

Icon LinkReturns

Promise<Coin []>

A promise that resolves to an array of Coins.

Icon LinkDefined in

packages/account/src/account.ts:124 Icon Link


Icon LinkgetMessages

getMessages(): Promise<Message []>

Retrieves messages owned by the account.

Icon LinkReturns

Promise<Message []>

A promise that resolves to an array of Messages.

Icon LinkDefined in

packages/account/src/account.ts:158 Icon Link


Icon LinkgetResourcesToSpend

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

Retrieves resources satisfying the spend query for the account.

Icon LinkParameters

NameTypeDescription
quantitiesCoinQuantityLike []IDs of coins to exclude.
excludedIds?ExcludeResourcesOptionIDs of resources to be excluded from the query.

Icon LinkReturns

Promise<Resource []>

A promise that resolves to an array of Resources.

Icon LinkOverrides

AbstractAccount .getResourcesToSpend

Icon LinkDefined in

packages/account/src/account.ts:111 Icon Link


Icon LinksendTransaction

sendTransaction(transactionRequestLike, «destructured»?): Promise<TransactionResponse >

Sends a transaction to the network.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request to be sent.
«destructured»ProviderSendTxParams -

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkOverrides

AbstractAccount .sendTransaction

Icon LinkDefined in

packages/account/src/account.ts:533 Icon Link


Icon LinksignMessage

signMessage(message): Promise<string>

Icon LinkParameters

NameType
messagestring

Icon LinkReturns

Promise<string>

Icon LinkDefined in

packages/account/src/account.ts:504 Icon Link


Icon LinksignTransaction

signTransaction(transactionRequestLike): Promise<string>

Signs a transaction with the wallet's private key.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request to sign.

Icon LinkReturns

Promise<string>

A promise that resolves to the signature of the transaction.

Icon LinkDefined in

packages/account/src/account.ts:517 Icon Link


Icon LinksimulateTransaction

simulateTransaction(transactionRequestLike, «destructured»?): Promise<CallResult >

Simulates a transaction.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request to be simulated.
«destructured»EstimateTransactionParams -

Icon LinkReturns

Promise<CallResult >

A promise that resolves to the call result.

Icon LinkOverrides

AbstractAccount .simulateTransaction

Icon LinkDefined in

packages/account/src/account.ts:558 Icon Link


Icon Linktransfer

transfer(destination, amount, assetId?, txParams?): Promise<TransactionResponse >

Transfers coins to a destination address.

Icon LinkParameters

NameTypeDefault valueDescription
destinationstring | AbstractAddress undefinedThe address of the destination.
amountBigNumberishundefinedThe amount of coins to transfer.
assetIdBytesLike BaseAssetIdThe asset ID of the coins to transfer.
txParamsTxParamsType {}The transaction parameters (gasLimit, gasPrice, maturity).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkDefined in

packages/account/src/account.ts:365 Icon Link


Icon LinktransferToContract

transferToContract(contractId, amount, assetId?, txParams?): Promise<TransactionResponse >

Transfers coins to a contract address.

Icon LinkParameters

NameTypeDefault valueDescription
contractIdstring | AbstractAddress undefinedThe address of the contract.
amountBigNumberishundefinedThe amount of coins to transfer.
assetIdBytesLike BaseAssetIdThe asset ID of the coins to transfer.
txParamsTxParamsType {}The optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkDefined in

packages/account/src/account.ts:394 Icon Link


Icon LinkvalidateGas

validateGas(«destructured»): void

Icon LinkParameters

NameType
«destructured»Object
› gasLimitBN
› gasPriceBN
› gasUsedBN
› minGasPriceBN

Icon LinkReturns

void

Icon LinkDefined in

packages/account/src/account.ts:569 Icon Link


Icon LinkwithdrawToBaseLayer

withdrawToBaseLayer(recipient, amount, txParams?): Promise<TransactionResponse >

Withdraws an amount of the base asset to the base chain.

Icon LinkParameters

NameTypeDescription
recipientstring | AbstractAddress Address of the recipient on the base chain.
amountBigNumberishAmount of base asset.
txParamsTxParamsType The optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkDefined in

packages/account/src/account.ts:456 Icon Link