Skip to content

HotKeysInc/sdk

Repository files navigation

HotkeysSDK

Typescript SDK for HotKeys

All Contributors: 2 Codecov Test Coverage Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict

Usage

npm i hotkeys-sdk

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

Resell a key

import * as hotkeys from "hotkeys-sdk";

const token = new PublicKey("4eepA7KT2ZzyA8Gih94AxVb5uNPXy7d2mPZR6HF2TtZF");

const txId = await hotkeys.sellKey(connection, owner, buyer, token, 0.1);

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

Check access

import * as hotkeys from "hotkeys-sdk";

const tokenExpected = new PublicKey(
	"4eepA7KT2ZzyA8Gih94AxVb5uNPXy7d2mPZR6HF2TtZF"
);

if (await hotkeys.checkAccess(connection, owner, tokenExpected)) {
	console.log("Access granted");
} else {
	console.log("Access denied");
}

Delete / Burn a key

import * as hotkeys from "hotkeys-sdk";

const tokenToDestroy = new PublicKey(
	"61F6P86LKaztWmYyjiPTjf1oqdkhBEYy6Y8FcYVq9o2w"
);

const response = await destroyKey(connection, owner, tokenToDestroy);

console.log("response: ", response);

Development

See .github/CONTRIBUTING.md. Thanks! 💖