Contracts can make read and write calls to StarkNet through a provided signer, allow users to transform Cairo values, like
BigNumber and to pass their own transformers, similar to
To create a new contract instance, you need the contract's abi, address, and a provider or account.
new starknet.Contract(abi, address, providerOrAccount)
To change the address of the connected account:
To change the provider or account:
- contract.abi => Abi
The ABI the contract was constructed with.
- contract.address => string
The address the contract was constructed/connected with.
- contract.providerOrAccount => ProviderInterface | AccountInterface
Provider or account that is used to interact with the network.
- contract.deployTransactionHash => string | null
If the Contract object is the result of a ContractFactory deployment, this is the transaction that was used to deploy the contract.
- contract.attach(address) => void
Saves the address of the contract deployed on network that will be used for interaction.
address is the address of the contract.
- contract.connect(providerOrAccount) => void
Attaches to new Provider or Account
- contract.deployed() => Promise < Contract >
If the Contract object is the result of a ContractFactory deployment, this method will wait for the transaction to be resolved.
- contract.call(method, args, options) => Promise < Result >
Calls a method on a contract.
- contract.invoke(method, args, options) => Promise < InvokeFunctionResponse >
Invokes a method on a contract.
- contract.estimate(method, args, options) => Promise < any >
Estimates a method on a contract.
- contract.populate(method, args, options) => Invocation
Populate a method on a contract.