@fuel-ts/program v0.97.0 • Docs
Contract
provides a way to interact with the contract program type.
new Contract(
id
,abi
,accountOrProvider
):Contract
Creates an instance of the Contract class.
• id: string
| AbstractAddress
The contract's address.
• abi: JsonAbi
| Interface
The contract's ABI (JSON ABI or Interface instance).
• accountOrProvider: Provider
| Account
The account or provider for interaction.
account:
null
|Account
The account associated with the contract, if available.
functions:
InvokeFunctions
={}
A collection of functions available on the contract.
id:
AbstractAddress
The unique contract identifier.
interface:
Interface
The contract's ABI interface.
provider:
Provider
The provider for interacting with the contract.
buildFunction(
func
):InvokeFunction
<any
[],any
>
Build a function invocation scope for the provided function fragment.
• func: FunctionFragment
The function fragment to build a scope for.
InvokeFunction
<any
[], any
>
A function that creates a FunctionInvocationScope.
getBalance(
assetId
):Promise
<BN
>
Get the balance for a given asset ID for this contract.
• assetId: BytesLike
The specified asset ID.
Promise
<BN
>
The balance of the contract for the specified asset.
multiCall(
calls
):MultiCallInvocationScope
<any
>
Create a multi-call invocation scope for the provided function invocation scopes.
• calls: FunctionInvocationScope
<any
[], any
>[]
An array of FunctionInvocationScopes to execute in a batch.
MultiCallInvocationScope
<any
>
A MultiCallInvocationScope instance.