Class: Contract
Interface for interacting with Starknet smart contracts
Provides methods for calling contract functions, estimating fees, and managing contract state. Supports both read-only calls and state-changing invocations.
Remarks
The interface provides multiple ways to interact with contracts:
- Direct method calls for convenience
- Generic call/invoke methods for flexibility
- Fee estimation and transaction population
- Event parsing and contract validation
Implements
Indexable
▪ [key: string]: AsyncContractFunction | any
Constructors
constructor
• new Contract(options): Contract
Parameters
| Name | Type | Description |
|---|---|---|
options | ContractOptions | abi: Abi of the contract object (required) - address: address to connect to (required) - providerOrAccount?: Provider or Account to attach to (fallback to defaultProvider) - parseRequest?: compile and validate arguments (optional, default true) - parseResponse?: Parse elements of the response array and structuring them into response object (optional, default true) - parser?: Abi parser (optional, default createAbiParser(options.abi)) |
Returns
Defined in
Properties
abi
• abi: Abi
Contract ABI (Application Binary Interface)
Implementation of
Defined in
address
• address: string
Contract address on Starknet
Implementation of
Defined in
providerOrAccount
• providerOrAccount: ProviderOrAccount
Provider for read operations or Account for write operations
Implementation of
ContractInterface.providerOrAccount
Defined in
classHash
• Optional classHash: string
Optional contract class hash for optimization
Implementation of
Defined in
parseRequest
• parseRequest: boolean
Defined in
parseResponse
• parseResponse: boolean
Defined in
structs
• Private structs: Object
Index signature
▪ [name: string]: AbiStruct
Defined in
events
• Private events: AbiEvents
Defined in
functions
• Readonly functions: Object
Contract methods that return promises (async operations)
Index signature
▪ [name: string]: AsyncContractFunction
Implementation of
Defined in
callStatic
• Readonly callStatic: Object
Contract methods for read-only calls (state queries)