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

packages/program/src/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

packages/program/src/contract.ts:33 Icon Link


Icon Linkfunctions

functions: InvokeFunctions = {}

A collection of functions available on the contract.

Icon LinkDefined in

packages/program/src/contract.ts:38 Icon Link


Icon Linkid

id: AbstractAddress

The unique contract identifier.

Icon LinkImplementation of

AbstractContract .id

Icon LinkDefined in

packages/program/src/contract.ts:18 Icon Link


Icon Linkinterface

interface: Interface<JsonAbi>

The contract's ABI interface.

Icon LinkImplementation of

AbstractContract .interface

Icon LinkDefined in

packages/program/src/contract.ts:28 Icon Link


Icon Linkprovider

provider: Provider

The provider for interacting with the contract.

Icon LinkImplementation of

AbstractContract .provider

Icon LinkDefined in

packages/program/src/contract.ts:23 Icon Link

Icon LinkMethods

Icon LinkbuildFunction

buildFunction(func): (...args: unknown[]) => FunctionInvocationScope <unknown[], 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

fn

A function that creates a FunctionInvocationScope.

▸ (...args): FunctionInvocationScope <unknown[], any>

Icon LinkParameters

NameType
...argsunknown[]

Icon LinkReturns

FunctionInvocationScope <unknown[], any>

Icon LinkDefined in

packages/program/src/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

packages/program/src/contract.ts:112 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

packages/program/src/contract.ts:101 Icon Link