Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link

Icon LinkClass: Predicate<TInputData>

@fuel-ts/account .Predicate

Predicate provides methods to populate transaction data with predicate information and sending transactions with them.

Icon LinkType parameters

NameType
TInputDataextends InputValue[]

Icon LinkHierarchy

Icon LinkConstructors

Icon Linkconstructor

new Predicate<TInputData>(«destructured»): Predicate <TInputData>

Creates an instance of the Predicate class.

Icon LinkType parameters

NameType
TInputDataextends InputValue[]

Icon LinkParameters

NameType
«destructured»PredicateParams <TInputData>

Icon LinkReturns

Predicate <TInputData>

Icon LinkOverrides

Account .constructor

Icon LinkDefined in

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

Icon LinkProperties

Icon Link_connector

Protected Optional _connector: FuelConnector

The connector for use with external wallets

Icon LinkInherited from

Account ._connector

Icon LinkDefined in

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


Icon Link_provider

Protected Optional _provider: Provider

The provider used to interact with the network.

Icon LinkInherited from

Account ._provider

Icon LinkDefined in

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


Icon Linkaddress

Readonly address: AbstractAddress

The address associated with the account.

Icon LinkInherited from

Account .address

Icon LinkDefined in

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


Icon Linkbytes

bytes: Uint8Array

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:39 Icon Link


Icon Linkinterface

Optional interface: Interface<JsonAbi>

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:41 Icon Link


Icon LinkpredicateData

predicateData: TInputData

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:40 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 LinkInherited from

Account.provider

Icon LinkDefined in

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

set provider(provider): void

Sets the provider for the account.

Icon LinkParameters

NameTypeDescription
providerProvider A Provider instance.

Icon LinkReturns

void

Icon LinkInherited from

Account.provider

Icon LinkDefined in

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

Icon LinkMethods

Icon LinkaddBatchTransfer

addBatchTransfer(request, transferParams): ScriptTransactionRequest

Adds multiple transfers to a script transaction request.

Icon LinkParameters

NameTypeDescription
requestScriptTransactionRequest The script transaction request to add transfers to.
transferParamsTransferParams []An array of TransferParams objects representing the transfers to be made.

Icon LinkReturns

ScriptTransactionRequest

The updated script transaction request.

Icon LinkInherited from

Account .addBatchTransfer

Icon LinkDefined in

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


Icon LinkaddTransfer

addTransfer(request, transferParams): ScriptTransactionRequest

Adds a transfer to the given transaction request.

Icon LinkParameters

NameTypeDescription
requestScriptTransactionRequest The script transaction request to add transfers to.
transferParamsTransferParams The object representing the transfer to be made.

Icon LinkReturns

ScriptTransactionRequest

The updated transaction request with the added transfer.

Icon LinkInherited from

Account .addTransfer

Icon LinkDefined in

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


Icon LinkbatchTransfer

batchTransfer(transferParams, txParams?): Promise<TransactionResponse >

Transfers multiple amounts of a token to multiple recipients.

Icon LinkParameters

NameTypeDescription
transferParamsTransferParams []An array of TransferParams objects representing the transfers to be made.
txParamsTxParamsType Optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to a TransactionResponse object representing the transaction result.

Icon LinkInherited from

Account .batchTransfer

Icon LinkDefined in

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


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 LinkInherited from

Account .connect

Icon LinkDefined in

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


Icon LinkcreateTransfer

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

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

Icon LinkParameters

NameTypeDescription
destinationstring | AbstractAddress The address of the destination.
amountBigNumberishThe amount of coins to transfer.
assetId?BytesLike The asset ID of the coins to transfer (optional).
txParamsTxParamsType The transaction parameters (optional).

Icon LinkReturns

Promise<TransactionRequest >

A promise that resolves to the prepared transaction request.

Icon LinkInherited from

Account .createTransfer

Icon LinkDefined in

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


Icon Linkfund

fund<T>(request, params): Promise<T>

Funds a transaction request by adding the necessary resources.

Icon LinkType parameters

NameTypeDescription
Textends TransactionRequest The type of the TransactionRequest.

Icon LinkParameters

NameTypeDescription
requestTThe transaction request to fund.
paramsEstimatedTxParams The estimated transaction parameters.

Icon LinkReturns

Promise<T>

A promise that resolves to the funded transaction request.

Icon LinkInherited from

Account .fund

Icon LinkDefined in

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


Icon LinkgetBalance

getBalance(assetId?): Promise<BN>

Retrieves the balance of the account for the given asset.

Icon LinkParameters

NameTypeDescription
assetId?BytesLike The asset ID to check the balance for (optional).

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance amount.

Icon LinkInherited from

Account .getBalance

Icon LinkDefined in

packages/account/src/account.ts:216 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 LinkInherited from

Account .getBalances

Icon LinkDefined in

packages/account/src/account.ts:227 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 (optional).

Icon LinkReturns

Promise<Coin []>

A promise that resolves to an array of Coins.

Icon LinkInherited from

Account .getCoins

Icon LinkDefined in

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


Icon LinkgetIndexFromPlaceholderWitness

getIndexFromPlaceholderWitness(request): number

Returns the index of the witness placeholder that was added to this predicate. If no witness placeholder was added, it returns -1.

Icon LinkParameters

NameTypeDescription
requestTransactionRequest The transaction request.

Icon LinkReturns

number

The index of the witness placeholder, or -1 if there is no witness placeholder.

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:252 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 LinkInherited from

Account .getMessages

Icon LinkDefined in

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


Icon LinkgetPredicateData

getPredicateData(): Uint8Array

Icon LinkReturns

Uint8Array

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:127 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

Account .getResourcesToSpend

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:183 Icon Link


Icon LinkpopulateTransactionPredicateData

populateTransactionPredicateData<T>(transactionRequestLike): T

Populates the transaction data with predicate data.

Icon LinkType parameters

NameType
Textends TransactionRequest

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request-like object.

Icon LinkReturns

T

The transaction request with predicate data.

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:80 Icon Link


Icon LinksendTransaction

sendTransaction(transactionRequestLike): Promise<TransactionResponse >

Sends a transaction with the populated predicate data.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request-like object.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkOverrides

Account .sendTransaction

Icon LinkDefined in

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


Icon LinksignTransaction

signTransaction(transactionRequestLike): Promise<string>

Signs a transaction from the account via the connector..

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request to sign.

Icon LinkReturns

Promise<string>

A promise that resolves to the signature of the transaction.

Icon LinkInherited from

Account .signTransaction

Icon LinkDefined in

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


Icon LinksimulateTransaction

simulateTransaction(transactionRequestLike): Promise<CallResult >

Simulates a transaction with the populated predicate data.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request-like object.

Icon LinkReturns

Promise<CallResult >

A promise that resolves to the call result.

Icon LinkOverrides

Account .simulateTransaction

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:122 Icon Link


Icon Linktransfer

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

Transfers coins to a destination address.

Icon LinkParameters

NameTypeDescription
destinationstring | AbstractAddress The address of the destination.
amountBigNumberishThe amount of coins to transfer.
assetId?BytesLike The asset ID of the coins to transfer (optional).
txParamsTxParamsType The transaction parameters (optional).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .transfer

Icon LinkDefined in

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


Icon LinktransferToContract

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

Transfers coins to a contract address.

Icon LinkParameters

NameTypeDescription
contractIdstring | AbstractAddress The address of the contract.
amountBigNumberishThe amount of coins to transfer.
assetId?BytesLike The asset ID of the coins to transfer (optional).
txParamsTxParamsType The transaction parameters (optional).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .transferToContract

Icon LinkDefined in

packages/account/src/account.ts:475 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 transaction parameters (optional).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .withdrawToBaseLayer

Icon LinkDefined in

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


Icon LinkprocessPredicateData

processPredicateData(bytes, jsonAbi?, configurableConstants?): Object

Processes the predicate data and returns the altered bytecode and interface.

Icon LinkParameters

NameTypeDescription
bytesBytesLike The bytes of the predicate.
jsonAbi?JsonAbiThe JSON ABI of the predicate.
configurableConstants?ObjectOptional configurable constants for the predicate.

Icon LinkReturns

Object

An object containing the new predicate bytes and interface.

NameType
predicateBytesUint8Array
predicateInterfaceundefined | Interface<JsonAbi>

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:144 Icon Link


Icon LinksetConfigurableConstants

setConfigurableConstants(bytes, configurableConstants, abiInterface?): Uint8Array

Sets the configurable constants for the predicate.

Icon LinkParameters

NameTypeDescription
bytesUint8ArrayThe bytes of the predicate.
configurableConstantsObjectConfigurable constants to be set.
abiInterface?Interface<JsonAbi>The ABI interface of the predicate.

Icon LinkReturns

Uint8Array

The mutated bytes with the configurable constants set.

Icon LinkDefined in

packages/account/src/predicate/predicate.ts:207 Icon Link