Skip to main content
Version: 5.14.1

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

Properties​

abi​

β€’ abi: Abi

Implementation of​

ContractInterface.abi

Defined in​

src/contract/default.ts:115


address​

β€’ address: string

Implementation of​

ContractInterface.address

Defined in​

src/contract/default.ts:117


providerOrAccount​

β€’ providerOrAccount: ProviderInterface | AccountInterface

Implementation of​

ContractInterface.providerOrAccount

Defined in​

src/contract/default.ts:119


deployTransactionHash​

β€’ Optional deployTransactionHash: string

Implementation of​

ContractInterface.deployTransactionHash

Defined in​

src/contract/default.ts:121


structs​

β€’ Protected Readonly structs: Object

Index signature​

β–ͺ [name: string]: StructAbi

Defined in​

src/contract/default.ts:123


functions​

β€’ Readonly functions: Object

Index signature​

β–ͺ [name: string]: AsyncContractFunction

Implementation of​

ContractInterface.functions

Defined in​

src/contract/default.ts:125


callStatic​

β€’ Readonly callStatic: Object

Index signature​

β–ͺ [name: string]: AsyncContractFunction

Implementation of​

ContractInterface.callStatic

Defined in​

src/contract/default.ts:127


populateTransaction​

β€’ Readonly populateTransaction: Object

Index signature​

β–ͺ [name: string]: ContractFunction

Implementation of​

ContractInterface.populateTransaction

Defined in​

src/contract/default.ts:129


estimateFee​

β€’ Readonly estimateFee: Object

Index signature​

β–ͺ [name: string]: ContractFunction

Implementation of​

ContractInterface.estimateFee

Defined in​

src/contract/default.ts:131


callData​

β€’ Private callData: CallData

Defined in​

src/contract/default.ts:135

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


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


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


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


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


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


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


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