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β
Name | Type | Default value | Description |
---|---|---|---|
abi | Abi | undefined | Abi of the contract object |
address | string | undefined | (optional) - address to connect to |
providerOrAccount | ProviderInterface | AccountInterface | defaultProvider | (optional) - Provider or Account to attach to |
Defined inβ
Propertiesβ
abiβ
β’ abi: Abi
Implementation ofβ
Defined inβ
addressβ
β’ address: string
Implementation ofβ
Defined inβ
providerOrAccountβ
β’ providerOrAccount: ProviderInterface
| AccountInterface
Implementation ofβ
ContractInterface.providerOrAccount
Defined inβ
deployTransactionHashβ
β’ Optional
deployTransactionHash: string
Implementation ofβ
ContractInterface.deployTransactionHash
Defined inβ
structsβ
β’ Protected
Readonly
structs: Object
Index signatureβ
βͺ [name: string
]: StructAbi
Defined inβ
functionsβ
β’ Readonly
functions: Object
Index signatureβ
βͺ [name: string
]: AsyncContractFunction
Implementation ofβ
Defined inβ
callStaticβ
β’ Readonly
callStatic: Object
Index signatureβ
βͺ [name: string
]: AsyncContractFunction
Implementation ofβ
Defined inβ
populateTransactionβ
β’ Readonly
populateTransaction: Object
Index signatureβ
βͺ [name: string
]: ContractFunction
Implementation ofβ
ContractInterface.populateTransaction
Defined inβ
estimateFeeβ
β’ Readonly
estimateFee: Object
Index signatureβ
βͺ [name: string
]: ContractFunction
Implementation ofβ
Defined inβ
callDataβ
β’ Private
callData: CallData
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
Implementation ofβ
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
Implementation ofβ
Defined inβ
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β
Defined inβ
callβ
βΈ call(method
, args?
, Β«destructuredΒ»?
): Promise
<Result
>
Calls a method on a contract
Parametersβ
Name | Type | Default value | Description |
---|---|---|---|
method | string | undefined | name of the method |
args | ArgsOrCalldata | [] | 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β
Defined inβ
invokeβ
βΈ invoke(method
, args?
, Β«destructuredΒ»?
): Promise
<InvokeFunctionResponse
>
Invokes a method on a contract
Parametersβ
Name | Type | Default value | Description |
---|---|---|---|
method | string | undefined | name of the method |
args | ArgsOrCalldata | [] | Array of the arguments for the invoke or Calldata |
Β«destructuredΒ» | InvokeOptions | {} |
Returnsβ
Promise
<InvokeFunctionResponse
>
Add Transaction Response
Implementation ofβ
Defined inβ
estimateβ
βΈ estimate(method
, args?
): Promise
<EstimateFeeResponse
>
Estimates a method on a contract
Parametersβ
Name | Type | Default value | Description |
---|---|---|---|
method | string | undefined | name of the method |
args | ArgsOrCalldata | [] | Array of the arguments for the call or Calldata |
Returnsβ
Promise
<EstimateFeeResponse
>
Implementation ofβ
Defined inβ
populateβ
βΈ populate(method
, args?
): Call
Calls a method on a contract
Parametersβ
Name | Type | Default value | Description |
---|---|---|---|
method | string | undefined | name of the method |
args | RawArgs | [] | Array of the arguments for the call or Calldata |
Returnsβ
Invocation object
Implementation ofβ
Defined inβ
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