⌘K

Icon SunFilledIcon MoonStars
Predicate

Icon LinkClass: Predicate<ARGS>

@fuel-ts/predicate .Predicate

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

Icon LinkType parameters

NameType
ARGSextends InputValue[]

Icon LinkHierarchy

Icon LinkImplements

  • AbstractPredicate

Icon LinkConstructors

Icon Linkconstructor

new Predicate<ARGS>(bytes, provider, jsonAbi?, configurableConstants?): Predicate <ARGS>

Creates an instance of the Predicate class.

Icon LinkType parameters

NameType
ARGSextends InputValue[]

Icon LinkParameters

NameTypeDescription
bytesBytesLike The bytes of the predicate.
providerProvider The provider used to interact with the blockchain.
jsonAbi?JsonAbiThe JSON ABI of the predicate.
configurableConstants?ObjectOptional configurable constants for the predicate.

Icon LinkReturns

Predicate <ARGS>

Icon LinkOverrides

Account .constructor

Icon LinkDefined in

predicate/src/predicate.ts:47 Icon Link

Icon LinkProperties

Icon Link_provider

Protected Optional _provider: Provider

The provider used to interact with the network.

Icon LinkInherited from

Account ._provider

Icon LinkDefined in

wallet/dist/account.d.ts:18


Icon Linkaddress

Readonly address: AbstractAddress

The address associated with the account.

Icon LinkImplementation of

AbstractPredicate.address

Icon LinkInherited from

Account .address

Icon LinkDefined in

wallet/dist/account.d.ts:14


Icon Linkbytes

bytes: Uint8Array

Icon LinkImplementation of

AbstractPredicate.bytes

Icon LinkDefined in

predicate/src/predicate.ts:34 Icon Link


Icon Linkinterface

Optional interface: Interface<JsonAbi>

Icon LinkDefined in

predicate/src/predicate.ts:37 Icon Link


Icon LinkpredicateArgs

predicateArgs: ARGS

Icon LinkDefined in

predicate/src/predicate.ts:36 Icon Link


Icon LinkpredicateData

predicateData: Uint8Array

Icon LinkImplementation of

AbstractPredicate.predicateData

Icon LinkDefined in

predicate/src/predicate.ts:35 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

wallet/dist/account.d.ts:33

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

wallet/dist/account.d.ts:39

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

Account .connect

Icon LinkDefined in

wallet/dist/account.d.ts:46


Icon LinkcreateTransfer

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

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

Icon LinkParameters

NameTypeDefault valueDescription
destinationAbstractAddress 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 LinkOverrides

Account .createTransfer

Icon LinkDefined in

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

Account .fund

Icon LinkDefined in

wallet/dist/account.d.ts:89


Icon LinkgetBalance

getBalance(assetId?): Promise<BN>

Retrieves the balance of the account for the given asset.

Icon LinkParameters

NameTypeDescription
assetId?BytesLikeThe asset ID to check the balance for.

Icon LinkReturns

Promise<BN>

A promise that resolves to the balance amount.

Icon LinkInherited from

Account .getBalance

Icon LinkDefined in

wallet/dist/account.d.ts:74


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

wallet/dist/account.d.ts:80


Icon LinkgetCoins

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

Retrieves coins owned by the account.

Icon LinkParameters

NameTypeDescription
assetId?BytesLikeThe asset ID of the coins to retrieve.

Icon LinkReturns

Promise<Coin []>

A promise that resolves to an array of Coins.

Icon LinkInherited from

Account .getCoins

Icon LinkDefined in

wallet/dist/account.d.ts:61


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

wallet/dist/account.d.ts:67


Icon LinkgetPredicateData

getPredicateData(policiesLength): Uint8Array

Icon LinkParameters

NameType
policiesLengthnumber

Icon LinkReturns

Uint8Array

Icon LinkDefined in

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

Account .getResourcesToSpend

Icon LinkDefined in

wallet/dist/account.d.ts:54


Icon LinkpopulateTransactionPredicateData

populateTransactionPredicateData(transactionRequestLike): TransactionRequest

Populates the transaction data with predicate data.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request-like object.

Icon LinkReturns

TransactionRequest

The transaction request with predicate data.

Icon LinkDefined in

predicate/src/predicate.ts:71 Icon Link


Icon LinksendTransaction

sendTransaction(transactionRequestLike, options?): Promise<TransactionResponse >

Sends a transaction with the populated predicate data.

Icon LinkParameters

NameTypeDescription
transactionRequestLikeTransactionRequestLike The transaction request-like object.
options?Pick<ProviderSendTxParams , "awaitExecution">-

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkOverrides

Account .sendTransaction

Icon LinkDefined in

predicate/src/predicate.ts:115 Icon Link


Icon LinksetData

setData<T>(...args): Predicate <ARGS>

Sets data for the predicate.

Icon LinkType parameters

NameType
Textends InputValue[]

Icon LinkParameters

NameTypeDescription
...argsTArguments for the predicate function.

Icon LinkReturns

Predicate <ARGS>

The Predicate instance with updated predicate data.

Icon LinkDefined in

predicate/src/predicate.ts:140 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

predicate/src/predicate.ts:129 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?BytesLikeThe asset ID of the coins to transfer.
txParams?TxParamsType The transaction parameters (gasLimit, gasPrice, maturity).

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .transfer

Icon LinkDefined in

wallet/dist/account.d.ts:117


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?BytesLikeThe asset ID of the coins to transfer.
txParams?TxParamsType The optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .transferToContract

Icon LinkDefined in

wallet/dist/account.d.ts:135


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.
txParams?TxParamsType The optional transaction parameters.

Icon LinkReturns

Promise<TransactionResponse >

A promise that resolves to the transaction response.

Icon LinkInherited from

Account .withdrawToBaseLayer

Icon LinkDefined in

wallet/dist/account.d.ts:152


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

predicate/src/predicate.ts:176 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

predicate/src/predicate.ts:216 Icon Link