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
});

Feedback

Something not quite right, unclear or can't find what you are looking for? Please let us know at [email protected] and we will get back to you as soon as we can.


What’s Next