Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link

Icon LinkClass: 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

Icon LinkDefined in

Icon LinkProperties

Icon Linkaccount

account: null | Account
The account associated with the contract, if available.

Icon LinkImplementation of

Icon LinkDefined in


Icon Linkfunctions

functions: InvokeFunctions = {}
A collection of functions available on the contract.

Icon LinkDefined in


Icon Linkid

The unique contract identifier.

Icon LinkImplementation of

Icon LinkDefined in


Icon Linkinterface

interface: Interface<JsonAbi>
The contract's ABI interface.

Icon LinkImplementation of

Icon LinkDefined in


Icon Linkprovider

provider: Provider
The provider for interacting with the contract.

Icon LinkImplementation of

Icon LinkDefined in

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


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


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

A MultiCallInvocationScope instance.

Icon LinkDefined in