For the complete documentation index, see llms.txt. This page is also available as Markdown.

Kastle SDK

To integrate with your dapp with Kastle Wallet by Kastle SDK, follow the steps below. These step-by-step instructions, along with code snippets, will guide you through connecting the wallet and interact with the wallet.

Install Kastle SDK

npm i @forbole/kastle-sdk

Detect Kastle

Check whether Kastle is installed or not

import * as sdk from "@forbole/kastle-sdk";

const isInstalled = await sdk.isWalletInstalled();

Interact with Kastle

import * as sdk from "@forbole/kastle-sdk";

await sdk.switchNetwork("testnet-10");
const connected = await sdk.connect();
const txId = await sdk.sendKaspa("<receipt-address>", sdk.kaspaWasm.kaspaToSompi("1")!);

Operate commit reveal script

import * as sdk from "@forbole/kastle-sdk";

// KRC20 transfer
const publicKey = await sdk.getPublicKey();
const protocol = "kasplex";
const action = `{"p":"krc-20","op":"transfer","tick":"kasp","amt":"100000000","to":<reciept-address>"}`;
const script = sdk.buildRevealCommitScript(publicKey, protocol, action);
const { commitTxId, revealTxId, error } = await sdk.doCommitReveal(
  script, {
    revealPriorityFee: sdk.kaspaWasm.kaspaToSompi("1")
});

Sign PSKT

Send PSKT

Last updated