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

NameTypeRequiredDescription
contractIdstringYThe Id of the contract, found in your dashboard
enableLoggingbooleanNWhether or not to show console logging. Useful for development.
onWalletChangeWalletChangeFunctionNOptional function to handle wallet change. See below for function signature
loggerLoggerFunctionNOptional 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
});

What’s Next