Contracts
Contract connection and interaction utilities.
Overview
A Contract object is a meta-class, which communicates with a deployed smart contract on the blockchain and provides a simple JavaScript interface to call methods, send transactions, and query historic logs.
Smart contracts only exist on the Quai account based ledger. They are not deployable on the UTXO based Qi ledger.
Usage
In practice, the contract utilities are used to connect, read, and call state changing functions on the Quai Ledger. The contract class can be used to interact with any type of contract (Solidity or SolidityX) on any zone chain in the network.
Connect to a Contract
In order to interact with a contract in any read-only capacity, you must “connect” to it using a Provider. You’ll also need to pass the contract’s deployed address and the contract’s ABI.
Call Read Methods
Connecting a simple remote node provider to your contract will allow you to read-only methods.
Call State Changing Methods
If you want to execute a contract state-changing operation, you’ll need to pass a Signer to the contract.
Was this page helpful?