@fuel-ts/program .Contract
Contract
provides a way to interact with the contract program type.
• new Contract(id
, abi
, accountOrProvider
): Contract
Creates an instance of the Contract class.
Name | Type | Description |
---|---|---|
id | string | AbstractAddress | The contract's address. |
abi | JsonAbi | Interface <JsonAbi > | 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
<JsonAbi
>
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.
Name | Type | Description |
---|---|---|
func | FunctionFragment <JsonAbi , string > | 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.
Name | Type | Description |
---|---|---|
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.
Name | Type | Description |
---|---|---|
calls | FunctionInvocationScope <any [], any >[] | An array of FunctionInvocationScopes to execute in a batch. |
MultiCallInvocationScope
<any
>
A MultiCallInvocationScope instance.