Skip to main content
Version: 5.24.3

Class: ContractInterface

Implemented by​

Indexable​

â–ª [key: string]: AsyncContractFunction | any

Constructors​

constructor​

• new ContractInterface()

Properties​

abi​

• Abstract abi: Abi

Defined in​

src/contract/interface.ts:25


address​

• Abstract address: string

Defined in​

src/contract/interface.ts:27


providerOrAccount​

• Abstract providerOrAccount: ProviderInterface | AccountInterface

Defined in​

src/contract/interface.ts:29


deployTransactionHash​

• Optional Abstract deployTransactionHash: string

Defined in​

src/contract/interface.ts:31


functions​

• Readonly functions: Object

Index signature​

â–ª [name: string]: AsyncContractFunction

Defined in​

src/contract/interface.ts:33


callStatic​

• Readonly callStatic: Object

Index signature​

â–ª [name: string]: AsyncContractFunction

Defined in​

src/contract/interface.ts:35


populateTransaction​

• Readonly populateTransaction: Object

Index signature​

â–ª [name: string]: ContractFunction

Defined in​

src/contract/interface.ts:37


estimateFee​

• Readonly estimateFee: Object

Index signature​

â–ª [name: string]: ContractFunction

Defined in​

src/contract/interface.ts:39

Methods​

attach​

â–¸ Abstract attach(address): void

Saves the address of the contract deployed on network that will be used for interaction

Parameters​

NameTypeDescription
addressstringaddress of the contract

Returns​

void

Defined in​

src/contract/interface.ts:48


connect​

â–¸ Abstract connect(providerOrAccount): void

Attaches to new Provider or Account

Parameters​

NameTypeDescription
providerOrAccountProviderInterface | AccountInterfacenew Provider or Account to attach to

Returns​

void

Defined in​

src/contract/interface.ts:55


deployed​

â–¸ Abstract deployed(): Promise<ContractInterface>

Resolves when contract is deployed on the network or when no deployment transaction is found

Throws

When deployment fails

Returns​

Promise<ContractInterface>

Promise that resolves when contract is deployed on the network or when no deployment transaction is found

Defined in​

src/contract/interface.ts:63


call​

â–¸ Abstract call(method, args?, options?): Promise<Result>

Calls a method on a contract

Parameters​

NameTypeDescription
methodstringname of the method
args?ArgsOrCalldataArray of the arguments for the call
options?CallOptionsoptional blockIdentifier

Returns​

Promise<Result>

Result of the call as an array with key value pars

Defined in​

src/contract/interface.ts:73


invoke​

â–¸ Abstract invoke(method, args?, options?): Promise<InvokeFunctionResponse>

Invokes a method on a contract

Parameters​

NameTypeDescription
methodstringname of the method
args?ArgsOrCalldataArray of the arguments for the invoke or Calldata
options?InvokeOptions

Returns​

Promise<InvokeFunctionResponse>

Add Transaction Response

Defined in​

src/contract/interface.ts:87


estimate​

â–¸ Abstract estimate(method, args?, options?): Promise<EstimateFeeResponse>

Estimates a method on a contract

Parameters​

NameTypeDescription
methodstringname of the method
args?ArgsOrCalldataArray of the arguments for the call or Calldata
options?Objectoptional blockIdentifier
options.blockIdentifier?BlockIdentifier-

Returns​

Promise<EstimateFeeResponse>

Defined in​

src/contract/interface.ts:100


populate​

â–¸ Abstract populate(method, args?): Invocation

Calls a method on a contract

Parameters​

NameTypeDescription
methodstringname of the method
args?ArgsOrCalldataArray of the arguments for the call or Calldata

Returns​

Invocation

Invocation object

Defined in​

src/contract/interface.ts:115


parseEvents​

â–¸ Abstract parseEvents(receipt): ParsedEvents

Parse contract events of a GetTransactionReceiptResponse received from waitForTransaction. Based on contract's abi

Parameters​

NameTypeDescription
receiptGetTransactionReceiptResponsetransaction receipt

Returns​

ParsedEvents

Events parsed

Defined in​

src/contract/interface.ts:123


isCairo1​

â–¸ Abstract isCairo1(): boolean

tells if the contract comes from a Cairo 1 contract

Example

const isCairo1: boolean = myContract.isCairo1();

Returns​

boolean

TRUE if the contract comes from a Cairo1 contract

Defined in​

src/contract/interface.ts:134


getVersion​

â–¸ Abstract getVersion(): Promise<ContractVersion>

Retrieves the version of the contract (cairo version & compiler version)

Returns​

Promise<ContractVersion>

Defined in​

src/contract/interface.ts:139


typed​

â–¸ Abstract typed<TAbi>(tAbi): TypedContract<TAbi>

Type parameters​

NameType
TAbiextends readonly (AbiFunction | AbiEvent | AbiStruct | AbiEnum)[]

Parameters​

NameType
tAbiTAbi

Returns​

TypedContract<TAbi>

Defined in​

src/contract/interface.ts:141