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
});
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.
Updated about 1 year ago
What’s Next