SDK

Typescript SDK for HotKeys

Installation

npm i hotkeys-sdk

To install the SDK, developers need to run the command "npm i hotkeys-sdk" in the terminal.

Generate a key

import * as hotkeys from "hotkeys-sdk";

const [txId, mintId] = await hotkeys.generateKey(
	connection,
	owner,
	"HK: Plugin",
	"https://raw.githubusercontent.com/HotKeysInc/programs/main/assets/test_metadata.json"
);

console.log("txId: ", txId);
console.log("mintId: ", mintId);

The "generateKey" function generates a new key with a specified name and metadata. The function takes four parameters: connection, owner, name, and metadata. Upon successful execution, the function returns an array of two values: a transaction ID (txId) and a mint ID (mintId).

Resell a key

The "sellKey" function resells a key from one owner to another. The function takes five parameters: connection, owner, buyer, token, and price. Upon successful execution, the function returns a transaction ID (txId).

Check access

The "checkAccess" function checks if a given owner has access to a particular token. The function takes three parameters: connection, owner, and tokenExpected. If the owner has access to the token, the function returns true. If not, the function returns false.

Delete / Burn a key

The "destroyKey" function deletes or burns a key owned by the specified owner. The function takes three parameters: connection, owner, and tokenToDestroy. Upon successful execution, the function returns a response.

Developers can import the hotkeys-sdk module to access these functions and use them to integrate HotKeys into their TypeScript applications.

Last updated