@kasplex/kiwi-web
Advanced tools
+51
-12
| import { Wasm } from "./index"; | ||
| import { Krc20Data } from './types/interface'; | ||
| import { Krc20Data, EncodablePayload } from './types/interface'; | ||
| declare class KRC20 { | ||
| static executeCommit(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint): Promise<string | undefined>; | ||
| static executeReveal(privateKey: Wasm.PrivateKey, data: Krc20Data, commitTxid: string): Promise<string | undefined>; | ||
| static executeReveal(privateKey: Wasm.PrivateKey, data: Krc20Data, commitTxid: string, payload?: EncodablePayload): Promise<string | undefined>; | ||
| private static isHexString; | ||
| private static normalizePayload; | ||
| /** | ||
@@ -14,4 +16,41 @@ * Executes a KRC20 operation. | ||
| */ | ||
| static executeOperation(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static executeOperation(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
| * Executes a direct KRC20 payload transaction. | ||
| * | ||
| * This is different from executeOperation/mint/transfer/deploy: | ||
| * - executeOperation uses the original P2SH commit-reveal flow. | ||
| * - executePayloadOperation creates a normal Kaspa transaction with the KRC20 JSON in tx payload. | ||
| * | ||
| * If payload is not provided, the KRC20 data itself will be used as the transaction payload. | ||
| * This keeps the payload in the standard KRC20 JSON shape: | ||
| * { p: "krc-20", op: "mint" | "transfer" | "deploy", ... } | ||
| * | ||
| * If you pass a custom payload, that custom payload will be written instead. | ||
| * Be careful: custom wrapped payload may not be recognized by a standard KRC20 indexer. | ||
| */ | ||
| static executePayloadOperation(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
| * Mints KRC20 by direct transaction payload. | ||
| * | ||
| * Default payload: data itself. | ||
| * Optional custom payload: pass payload as the 4th arg. | ||
| */ | ||
| static mintByPayload(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
| * Transfers KRC20 by direct transaction payload. | ||
| * | ||
| * Required fields: to, amt. | ||
| * Default payload: data itself. | ||
| * Optional custom payload: pass payload as the 4th arg. | ||
| */ | ||
| static transferByPayload(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
| * Deploys KRC20 by direct transaction payload. | ||
| * | ||
| * Default payload: data itself. | ||
| * Optional custom payload: pass payload as the 4th arg. | ||
| */ | ||
| static deployByPayload(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
| * Gets the script public key from a transaction output. | ||
@@ -30,3 +69,3 @@ * .param txOutput - The transaction output. | ||
| */ | ||
| static mint(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static mint(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
@@ -39,3 +78,3 @@ * Deploys a new KRC20 token contract. | ||
| */ | ||
| static deploy(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static deploy(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
@@ -48,3 +87,3 @@ * Transfers KRC20 tokens to another address. | ||
| */ | ||
| static transfer(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static transfer(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
@@ -57,3 +96,3 @@ * Lists KRC20 token details. | ||
| */ | ||
| static list(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint): Promise<string | undefined>; | ||
| static list(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| /** | ||
@@ -69,3 +108,3 @@ * Signs a transaction. | ||
| */ | ||
| static sendTransaction(privateKey: Wasm.PrivateKey, data: Krc20Data, hash: string, amount: bigint, payload?: string): Promise<string>; | ||
| static sendTransaction(privateKey: Wasm.PrivateKey, data: Krc20Data, hash: string, amount: bigint, payload: EncodablePayload): Promise<string>; | ||
| /** | ||
@@ -119,7 +158,7 @@ * Sends KRC20 tokens to another address. | ||
| private static createP2SHAddress; | ||
| static issue(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static burn(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static blacklist(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static chown(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: Wasm.HexString | Uint8Array): Promise<string | undefined>; | ||
| static issue(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| static burn(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| static blacklist(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| static chown(privateKey: Wasm.PrivateKey, data: Krc20Data, fee?: bigint, payload?: EncodablePayload): Promise<string | undefined>; | ||
| } | ||
| export { KRC20 }; |
@@ -25,2 +25,3 @@ import { Wasm } from "../index"; | ||
| ca?: string; | ||
| memo?: string; | ||
| } | ||
@@ -35,1 +36,5 @@ export interface addressList { | ||
| } | ||
| export interface Krc20DataV2 extends Krc20Data { | ||
| payload: string; | ||
| } | ||
| export type EncodablePayload = string | Wasm.HexString | Uint8Array | Record<string, unknown> | Array<unknown> | number | boolean | null | undefined; |
@@ -38,2 +38,3 @@ import { Wasm } from "../index"; | ||
| ca?: string; | ||
| memo?: string; | ||
| }; | ||
@@ -40,0 +41,0 @@ declare function getScriptLockTime(oneHourInSeconds?: number): bigint; |
+6
-1
| { | ||
| "name": "@kasplex/kiwi-web", | ||
| "version": "1.0.20", | ||
| "version": "1.0.21", | ||
| "type": "module", | ||
@@ -40,2 +40,7 @@ "sideEffects": false, | ||
| "license": "ISC", | ||
| "pnpm": { | ||
| "overrides": { | ||
| "minimatch": "^10.2.3" | ||
| } | ||
| }, | ||
| "devDependencies": { | ||
@@ -42,0 +47,0 @@ "@types/node": "^22.14.1", |
+1
-1
@@ -51,3 +51,3 @@ # Kasplex Wallet SDK for web - Kiwi | ||
| await rpc.connect() | ||
| ``` | ||
| ``` | ||
@@ -54,0 +54,0 @@ 2. **Generate a new wallet**: |
Sorry, the diff of this file is too big to display
12458310
0.04%37746
0.29%