Class: ContractInterface
Implemented by​
Indexable​
â–ª [key: string
]: AsyncContractFunction
| any
Constructors​
constructor​
• new ContractInterface(): ContractInterface
Returns​
Properties​
abi​
• Abstract
abi: Abi
Defined in​
address​
• Abstract
address: string
Defined in​
providerOrAccount​
• Abstract
providerOrAccount: ProviderInterface
| AccountInterface
Defined in​
deployTransactionHash​
• Optional
Abstract
deployTransactionHash: string
Defined in​
functions​
• Readonly
functions: Object
Index signature​
â–ª [name: string
]: AsyncContractFunction
Defined in​
callStatic​
• Readonly
callStatic: Object
Index signature​
â–ª [name: string
]: AsyncContractFunction
Defined in​
populateTransaction​
• Readonly
populateTransaction: Object
Index signature​
â–ª [name: string
]: ContractFunction
Defined in​
estimateFee​
• Readonly
estimateFee: Object
Index signature​
â–ª [name: string
]: ContractFunction
Defined in​
Methods​
attach​
â–¸ attach(address
): void
Saves the address of the contract deployed on network that will be used for interaction
Parameters​
Name | Type | Description |
---|---|---|
address | string | address of the contract |
Returns​
void
Defined in​
connect​
â–¸ connect(providerOrAccount
): void
Attaches to new Provider or Account
Parameters​
Name | Type | Description |
---|---|---|
providerOrAccount | ProviderInterface | AccountInterface | new Provider or Account to attach to |
Returns​
void
Defined in​
deployed​
â–¸ deployed(): Promise
<ContractInterface
>
Resolves when contract is deployed on the network or when no deployment transaction is found
Returns​
Promise
<ContractInterface
>
Promise that resolves when contract is deployed on the network or when no deployment transaction is found
Throws
When deployment fails
Defined in​
call​
â–¸ call(method
, args?
, options?
): Promise
<Result
>
Calls a method on a contract
Parameters​
Name | Type | Description |
---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the call |
options? | CallOptions | optional blockIdentifier |
Returns​
Promise
<Result
>
Result of the call as an array with key value pars
Defined in​
invoke​
â–¸ invoke(method
, args?
, options?
): Promise
<{ transaction_hash
: string
}>
Invokes a method on a contract
Parameters​
Name | Type | Description |
---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the invoke or Calldata |
options? | InvokeOptions |
Returns​
Promise
<{ transaction_hash
: string
}>
Add Transaction Response
Defined in​
estimate​
â–¸ estimate(method
, args?
, options?
): Promise
<EstimateFeeResponse
>
Estimates a method on a contract
Parameters​
Name | Type | Description |
---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the call or Calldata |
options? | Object | optional blockIdentifier |
options.blockIdentifier? | BlockIdentifier | - |
Returns​
Promise
<EstimateFeeResponse
>
Defined in​
populate​
â–¸ populate(method
, args?
): Invocation
Calls a method on a contract
Parameters​
Name | Type | Description |
---|---|---|
method | string | name of the method |
args? | ArgsOrCalldata | Array of the arguments for the call or Calldata |
Returns​
Invocation object
Defined in​
parseEvents​
â–¸ parseEvents(receipt
): ParsedEvents
Parse contract events of a GetTransactionReceiptResponse received from waitForTransaction. Based on contract's abi
Parameters​
Name | Type | Description |
---|---|---|
receipt | GetTransactionReceiptResponse | transaction receipt |
Returns​
Events parsed
Defined in​
isCairo1​
â–¸ isCairo1(): boolean
tells if the contract comes from a Cairo 1 contract
Returns​
boolean
TRUE if the contract comes from a Cairo1 contract
Example
const isCairo1: boolean = myContract.isCairo1();
Defined in​
getVersion​
â–¸ getVersion(): Promise
<ContractVersion
>
Retrieves the version of the contract (cairo version & compiler version)
Returns​
Promise
<ContractVersion
>
Defined in​
typedv2​
â–¸ typedv2<TAbi
>(tAbi
): TypedContractV2
<TAbi
>
Returns a typed instance of ContractV2 based on the supplied ABI.
Type parameters​
Name | Type |
---|---|
TAbi | extends readonly (AbiImpl | AbiFunction | AbiInterface | AbiConstructor | AbiEvent | AbiStruct | AbiEnum )[] |
Parameters​
Name | Type | Description |
---|---|---|
tAbi | TAbi | The ABI (Abstract Binary Interface) of the ContractV2. |
Returns​
TypedContractV2
<TAbi
>
- A typed instance of ContractV2.