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.
Icon Linkid
The unique contract identifier.
• interface: Interface
<JsonAbi
>
The contract's ABI interface.
The provider for interacting with the contract.
▸
buildFunction(
func
): (...
args
:
unknown
[]) =>
FunctionInvocationScope
<
unknown
[],
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. |
fn
A function that creates a FunctionInvocationScope.
▸ (
...args
):
FunctionInvocationScope
<
unknown
[],
any
>
▸ 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. |
A MultiCallInvocationScope instance.