Skip to main content
Version: 5.19.5

Class: Contract

Not used at the moment

Implements​

Indexable​

β–ͺ [key: string]: AsyncContractFunction | any

Constructors​

constructor​

β€’ new Contract(abi, address, providerOrAccount?)

Contract class to handle contract methods

Parameters​

NameTypeDefault valueDescription
abiAbiundefinedAbi of the contract object
addressstringundefined(optional) - address to connect to
providerOrAccountProviderInterface | AccountInterfacedefaultProvider(optional) - Provider or Account to attach to

Defined in​

src/contract/default.ts:156

Properties​

abi​

β€’ abi: Abi

Implementation of​

ContractInterface.abi

Defined in​

src/contract/default.ts:125


address​

β€’ address: string

Implementation of​

ContractInterface.address

Defined in​

src/contract/default.ts:127


providerOrAccount​

β€’ providerOrAccount: ProviderInterface | AccountInterface

Implementation of​

ContractInterface.providerOrAccount

Defined in​

src/contract/default.ts:129


deployTransactionHash​

β€’ Optional deployTransactionHash: string

Implementation of​

ContractInterface.deployTransactionHash

Defined in​

src/contract/default.ts:131


structs​

β€’ Protected Readonly structs: Object

Index signature​

β–ͺ [name: string]: StructAbi

Defined in​

src/contract/default.ts:133


events​

β€’ Protected Readonly events: AbiEvents

Defined in​

src/contract/default.ts:135


functions​

β€’ Readonly functions: Object

Index signature​

β–ͺ [name: string]: AsyncContractFunction

Implementation of​

ContractInterface.functions

Defined in​

src/contract/default.ts:137


callStatic​

β€’ Readonly callStatic: Object

Index signature​

β–ͺ [name: string]: AsyncContractFunction

Implementation of​

ContractInterface.callStatic

Defined in​

src/contract/default.ts:139


populateTransaction​

β€’ Readonly populateTransaction: Object

Index signature​

β–ͺ [name: string]: ContractFunction

Implementation of​

ContractInterface.populateTransaction

Defined in​

src/contract/default.ts:141


estimateFee​

β€’ Readonly estimateFee: Object

Index signature​

β–ͺ [name: string]: ContractFunction

Implementation of​

ContractInterface.estimateFee

Defined in​

src/contract/default.ts:143


callData​

β€’ Private callData: CallData

Defined in​

src/contract/default.ts:147

Methods​

attach​

β–Έ 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

Implementation of​

ContractInterface.attach

Defined in​

src/contract/default.ts:212


connect​

β–Έ connect(providerOrAccount): void

Attaches to new Provider or Account

Parameters​

NameTypeDescription
providerOrAccountProviderInterface | AccountInterfacenew Provider or Account to attach to

Returns​

void

Implementation of​

ContractInterface.connect

Defined in​

src/contract/default.ts:216


deployed​

β–Έ deployed(): Promise<Contract>

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

Throws

When deployment fails

Returns​

Promise<Contract>

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

Implementation of​

ContractInterface.deployed

Defined in​

src/contract/default.ts:220


call​

β–Έ call(method, args?, Β«destructuredΒ»?): Promise<Result>

Calls a method on a contract

Parameters​

NameTypeDefault valueDescription
methodstringundefinedname of the method
argsArgsOrCalldata[]Array of the arguments for the call
Β«destructuredΒ»CallOptions{}optional blockIdentifier

Returns​

Promise<Result>

Result of the call as an array with key value pars

Implementation of​

ContractInterface.call

Defined in​

src/contract/default.ts:228


invoke​

β–Έ invoke(method, args?, Β«destructuredΒ»?): Promise<InvokeFunctionResponse>

Invokes a method on a contract

Parameters​

NameTypeDefault valueDescription
methodstringundefinedname of the method
argsArgsOrCalldata[]Array of the arguments for the invoke or Calldata
Β«destructuredΒ»InvokeOptions{}

Returns​

Promise<InvokeFunctionResponse>

Add Transaction Response

Implementation of​

ContractInterface.invoke

Defined in​

src/contract/default.ts:270


estimate​

β–Έ estimate(method, args?): Promise<EstimateFeeResponse>

Estimates a method on a contract

Parameters​

NameTypeDefault valueDescription
methodstringundefinedname of the method
argsArgsOrCalldata[]Array of the arguments for the call or Calldata

Returns​

Promise<EstimateFeeResponse>

Implementation of​

ContractInterface.estimate

Defined in​

src/contract/default.ts:314


populate​

β–Έ populate(method, args?): Call

Calls a method on a contract

Parameters​

NameTypeDefault valueDescription
methodstringundefinedname of the method
argsRawArgs[]Array of the arguments for the call or Calldata

Returns​

Call

Invocation object

Implementation of​

ContractInterface.populate

Defined in​

src/contract/default.ts:328


parseEvents​

β–Έ 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

Implementation of​

ContractInterface.parseEvents

Defined in​

src/contract/default.ts:337


isCairo1​

β–Έ 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

Implementation of​

ContractInterface.isCairo1

Defined in​

src/contract/default.ts:349


typed​

β–Έ typed<TAbi>(tAbi): TypedContract<TAbi>

Type parameters​

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

Parameters​

NameType
tAbiTAbi

Returns​

TypedContract<TAbi>

Implementation of​

ContractInterface.typed

Defined in​

src/contract/default.ts:353