Skip to main content
Version: Next

Class: ContractInterface

Implemented by

Indexable

[key: string]: AsyncContractFunction | any

Constructors

constructor

new ContractInterface()

Properties

abi

Abstract abi: Abi

Defined in

src/contract/interface.ts:24


address

Abstract address: string

Defined in

src/contract/interface.ts:26


providerOrAccount

Abstract providerOrAccount: ProviderInterface | AccountInterface

Defined in

src/contract/interface.ts:28


deployTransactionHash

Optional Abstract deployTransactionHash: string

Defined in

src/contract/interface.ts:30


functions

Readonly functions: Object

Index signature

[name: string]: AsyncContractFunction

Defined in

src/contract/interface.ts:32


callStatic

Readonly callStatic: Object

Index signature

[name: string]: AsyncContractFunction

Defined in

src/contract/interface.ts:34


populateTransaction

Readonly populateTransaction: Object

Index signature

[name: string]: ContractFunction

Defined in

src/contract/interface.ts:36


estimateFee

Readonly estimateFee: Object

Index signature

[name: string]: ContractFunction

Defined in

src/contract/interface.ts:38

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:47


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:54


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:62


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:72


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:86


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:99


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:114


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:122


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:133


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:135