@fuel-ts/program .Contract
Contract
provides a way to interact with the contract program type.
• new Contract(id
, abi
, accountOrProvider
)
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. |
packages/program/src/contract.ts:49
• account: null
| Account
The account associated with the contract, if available.
packages/program/src/contract.ts:35
• functions: InvokeFunctions
= {}
A collection of functions available on the contract.
packages/program/src/contract.ts:40
• id: AbstractAddress
The unique contract identifier.
packages/program/src/contract.ts:20
• interface: Interface
<JsonAbi
>
The contract's ABI interface.
packages/program/src/contract.ts:30
• provider: Provider
The provider for interacting with the contract.
packages/program/src/contract.ts:25
▸ 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
>
Name | Type |
---|---|
...args | unknown [] |
FunctionInvocationScope
<unknown
[], any
>
packages/program/src/contract.ts:93
▸ 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.
packages/program/src/contract.ts:114
▸ 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.