Constructor()
The constructor
for the Contract class accepts contract configuration. The easiest way to get started with the constructor is copy and paste the code snippet generated in "Developers" tab on the contracts page.
Constructor options
Name | Type | Required | Description |
---|---|---|---|
contractId | string | Y | The Id of the contract, found in your dashboard |
enableLogging | boolean | N | Whether or not to show console logging. Useful for development. |
onWalletChange | WalletChangeFunction | N | Optional function to handle wallet change. See below for function signature |
logger | LoggerFunction | N | Optional custom logging function. See below for function signature. Used when enableLogging = true |
Constructor option types
type WalletChangeFunction = (isValid: boolean) => void
type LoggerFunction = (method: string, message: string, isFatal: boolean, data?: any) => void
Example usage
const { Contract } = HyperMint;
const contract = new Contract({
contractId: '51b7b5d1-7ef4-4ca8-b0b4-c0be32a11f24',
enableLogging: true
});
Updated 8 months ago
What’s Next