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