Class: ContractInterface
Implemented by
Indexable
▪ [key: string]: AsyncContractFunction | any
Constructors
constructor
• new ContractInterface(): ContractInterface
Returns
Properties
abi
• Abstract abi: Abi
Defined in
address
• Abstract address: string
Defined in
providerOrAccount
• Abstract providerOrAccount: ProviderOrAccount
Defined in
classHash
• Optional Abstract classHash: string
Defined in
functions
• Readonly functions: Object
Index signature
▪ [name: string]: AsyncContractFunction
Defined in
callStatic
• Readonly callStatic: Object
Index signature
▪ [name: string]: AsyncContractFunction
Defined in
populateTransaction
• Readonly populateTransaction: Object
Index signature
▪ [name: string]: ContractFunction
Defined in
estimateFee
• Readonly estimateFee: Object
Index signature
▪ [name: string]: ContractFunction
Defined in
Methods
attach
▸ attach(address, abi?): void
Saves the address of the contract deployed on network that will be used for interaction
Parameters
| Name | Type | Description |
|---|---|---|
address | string | address of the contract |
abi? | Abi | optional new abi to use with the contract |
Returns
void
Defined in
isDeployed
▸ isDeployed(): Promise<ContractInterface>
Verifies that the contract is deployed at the configured address
Returns
Promise<ContractInterface>
Promise that resolves when contract is confirmed to exist at the address
Throws
Error if the contract is not deployed at the address
Defined in
call
▸ call(method, args?, options?): Promise<CallResult>
Calls a method on a contract
Parameters
| Name | Type | Description |
|---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the call |
options? | CallOptions | optional blockIdentifier |
Returns
Promise<CallResult>
Result of the call as an array with key value pars
Defined in
invoke
▸ invoke(method, args?, options?): Promise<{ transaction_hash: string }>
Invokes a method on a contract
Parameters
| Name | Type | Description |
|---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the invoke or Calldata |
options? | ExecuteOptions |
Returns
Promise<{ transaction_hash: string }>
Add Transaction Response
Defined in
estimate
▸ estimate(method, args?, options?): Promise<EstimateFeeResponseOverhead>
Estimates a method on a contract
Parameters
| Name | Type | Description |
|---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the call or Calldata |
options? | Object | optional blockIdentifier |
options.blockIdentifier? | BlockIdentifier | - |
Returns
Promise<EstimateFeeResponseOverhead>
Defined in
populate
▸ populate(method, args?): Invocation
Calls a method on a contract
Parameters
| Name | Type | Description |
|---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the call or Calldata |
Returns
Invocation object
Defined in
parseEvents
▸ parseEvents(receipt): ParsedEvents
Parse contract events of a GetTransactionReceiptResponse received from waitForTransaction. Based on contract's abi
Parameters
| Name | Type | Description |
|---|---|---|
receipt | GetTransactionReceiptResponse | transaction receipt |
Returns
Events parsed
Defined in
isCairo1
▸ isCairo1(): boolean
tells if the contract comes from a Cairo 1 contract
Returns
boolean
TRUE if the contract comes from a Cairo1 contract
Example
const isCairo1: boolean = myContract.isCairo1();
Defined in
getVersion
▸ getVersion(): Promise<ContractVersion>
Retrieves the version of the contract (cairo version & compiler version)
Returns
Promise<ContractVersion>
Defined in
typedv2
▸ typedv2<TAbi>(tAbi): TypedContractV2<TAbi>
Returns a typed instance of ContractV2 based on the supplied ABI.
Type parameters
| Name | Type |
|---|---|
TAbi | extends readonly (AbiImpl | AbiFunction | AbiInterface | AbiConstructor | AbiEvent | AbiStruct | AbiEnum)[] |
Parameters
| Name | Type | Description |
|---|---|---|
tAbi | TAbi | The ABI (Abstract Binary Interface) of the ContractV2. |
Returns
TypedContractV2<TAbi>
- A typed instance of ContractV2.