@fuel-ts/program v0.94.1 • Docs
Class: Contract
Contract
provides a way to interact with the contract program type.
Implements
Constructors
new Contract()
new Contract(
id
,abi
,accountOrProvider
):Contract
Creates an instance of the Contract class.
Parameters
Parameter | Type | Description |
---|---|---|
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. |
Returns
Defined in
contract.ts:47
Properties
Property | Type | Default value | Description | Defined in |
---|---|---|---|---|
account | null | Account | undefined | The account associated with the contract, if available. | contract.ts:33 |
functions | InvokeFunctions | {} | A collection of functions available on the contract. | contract.ts:38 |
id | AbstractAddress | undefined | The unique contract identifier. | contract.ts:18 |
interface | Interface | undefined | The contract's ABI interface. | contract.ts:28 |
provider | Provider | undefined | The provider for interacting with the contract. | contract.ts:23 |
Methods
buildFunction()
buildFunction(
func
):InvokeFunction
<any
[],any
>
Build a function invocation scope for the provided function fragment.
Parameters
Parameter | Type | Description |
---|---|---|
func | FunctionFragment | The function fragment to build a scope for. |
Returns
InvokeFunction
<any
[], any
>
A function that creates a FunctionInvocationScope.
Defined in
contract.ts:91
getBalance()
getBalance(
assetId
):Promise
<BN
>
Get the balance for a given asset ID for this contract.
Parameters
Parameter | Type | Description |
---|---|---|
assetId | BytesLike | The specified asset ID. |
Returns
Promise
<BN
>
The balance of the contract for the specified asset.
Defined in
contract.ts:122
multiCall()
multiCall(
calls
):MultiCallInvocationScope
<any
>
Create a multi-call invocation scope for the provided function invocation scopes.
Parameters
Parameter | Type | Description |
---|---|---|
calls | FunctionInvocationScope <any [], any >[] | An array of FunctionInvocationScopes to execute in a batch. |
Returns
MultiCallInvocationScope
<any
>
A MultiCallInvocationScope instance.
Defined in
contract.ts:111