Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link

Icon LinkClass: Contract

@fuel-ts/program .Contract

Contract provides a way to interact with the contract program type.

Icon LinkImplements

Icon LinkConstructors

Icon Linkconstructor

new Contract(id, abi, accountOrProvider): Contract

Creates an instance of the Contract class.

Icon LinkParameters

NameTypeDescription
idstring | AbstractAddress The contract's address.
abiJsonAbi | Interface<JsonAbi>The contract's ABI (JSON ABI or Interface instance).
accountOrProviderProvider | Account The account or provider for interaction.

Icon LinkReturns

Contract

Icon LinkDefined in

contract.ts:47 Icon Link

Icon LinkProperties

Icon Linkaccount

account: null | Account

The account associated with the contract, if available.

Icon LinkImplementation of

AbstractContract .account

Icon LinkDefined in

contract.ts:33 Icon Link


Icon Linkfunctions

functions: InvokeFunctions = {}

A collection of functions available on the contract.

Icon LinkDefined in

contract.ts:38 Icon Link


Icon Linkid

id: AbstractAddress

The unique contract identifier.

Icon LinkImplementation of

AbstractContract .id

Icon LinkDefined in

contract.ts:18 Icon Link


Icon Linkinterface

interface: Interface<JsonAbi>

The contract's ABI interface.

Icon LinkImplementation of

AbstractContract .interface

Icon LinkDefined in

contract.ts:28 Icon Link


Icon Linkprovider

provider: Provider

The provider for interacting with the contract.

Icon LinkImplementation of

AbstractContract .provider

Icon LinkDefined in

contract.ts:23 Icon Link

Icon LinkMethods

Icon LinkbuildFunction

buildFunction(func): InvokeFunction <any[], any>

Build a function invocation scope for the provided function fragment.

Icon LinkParameters

NameTypeDescription
funcFunctionFragment<JsonAbi, string>The function fragment to build a scope for.

Icon LinkReturns

InvokeFunction <any[], any>

A function that creates a FunctionInvocationScope.

Icon LinkDefined in

contract.ts:91 Icon Link


Icon LinkgetBalance

getBalance(assetId): Promise<BN>

Get the balance for a given asset ID for this contract.

Icon LinkParameters

NameTypeDescription
assetIdBytesLike The specified asset ID.

Icon LinkReturns

Promise<BN>

The balance of the contract for the specified asset.

Icon LinkDefined in

contract.ts:122 Icon Link


Icon LinkmultiCall

multiCall(calls): MultiCallInvocationScope <any>

Create a multi-call invocation scope for the provided function invocation scopes.

Icon LinkParameters

NameTypeDescription
callsFunctionInvocationScope <any[], any>[]An array of FunctionInvocationScopes to execute in a batch.

Icon LinkReturns

MultiCallInvocationScope <any>

A MultiCallInvocationScope instance.

Icon LinkDefined in

contract.ts:111 Icon Link