Contracts
Here is a list of contracts utilities.
awaitContractDeployed()
Utility function to wait for a contract to be deployed. It checks the contract deployment status every interval
milliseconds.
Parameters
- checkDeployment: A function that checks the contract deployment status.
- maxAttempts: Maximum number of checks. If the contract is not deployed after
maxAttempts
, an error is thrown. - interval: Interval between checks in milliseconds.
useOpenedContract()
Contains an opened contract instance whenever it is possible.
Parameters
- contract: A contract or a ref to a contract to open.
Returns
A ComputedRef
to the opened contract. May be null
if the contract is not available yet or if TonClient
is not initialized yet.
See Also
OpenedContract
TonClient
Example
import { ref, computed } from 'vue'
import { useOpenedContract } from '@d0rich/vueton'
import { MyContract } from 'path/to/contracts'
const contract = ref<MyContract | null>(null)
const openedContract = useOpenedContract(contract)
contract.value.getCrucialData()
useContractAsync()
Waits for a contract to be opened. Might be useful with useOpenedContract
.
Parameters
- contract: A ref to a contract.
Returns
An opened contract object unwrapped from the ref.