Skip to main content
Version: 5.14.1

Class: ContractInterface

Implemented by​

Indexable​

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

Constructors​

constructor​

• new ContractInterface()

Properties​

abi​

• Abstract abi: Abi

Defined in​

src/contract/interface.ts:18


address​

• Abstract address: string

Defined in​

src/contract/interface.ts:20


providerOrAccount​

• Abstract providerOrAccount: ProviderInterface | AccountInterface

Defined in​

src/contract/interface.ts:22


deployTransactionHash​

• Optional Abstract deployTransactionHash: string

Defined in​

src/contract/interface.ts:24


functions​

• Readonly functions: Object

Index signature​

â–ª [name: string]: AsyncContractFunction

Defined in​

src/contract/interface.ts:26


callStatic​

• Readonly callStatic: Object

Index signature​

â–ª [name: string]: AsyncContractFunction

Defined in​

src/contract/interface.ts:28


populateTransaction​

• Readonly populateTransaction: Object

Index signature​

â–ª [name: string]: ContractFunction

Defined in​

src/contract/interface.ts:30


estimateFee​

• Readonly estimateFee: Object

Index signature​

â–ª [name: string]: ContractFunction

Defined in​

src/contract/interface.ts:32

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


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


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


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


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


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


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


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