What your project needs
Create a Reown project ID, allowlist every production origin, and initialize a WalletConnect-compatible SignClient. Kaspire supports Android 11–16 and iOS / iPadOS 18 or later. Both apps can keep Kaspa Layer 1 plus approved Kasplex and Igra L2 namespaces active in the same session.
- A Reown project ID with your website origins allowlisted
- WalletConnect v2 using the
irnrelay - A copyable raw WalletConnect URI for iOS, including iPad desktop browsing mode
- A dedicated HTTPS App Link QR code for pairing a desktop dApp with Android
- The explicit Kaspire Android intent with the verified HTTPS fallback
npm install @walletconnect/sign-clientThe project ID is public application configuration. Pairing URIs are secrets and must never be logged, persisted, placed in analytics, or sent to unrelated services.
Initialize and connect
import SignClient from "@walletconnect/sign-client";
const signClient = await SignClient.init({
projectId: import.meta.env.VITE_REOWN_PROJECT_ID,
metadata: {
name: "Example Kaspa dApp",
description: "Connect to Kaspire",
url: window.location.origin,
icons: [window.location.origin + "/icon.png"]
}
});Request only the methods your dApp really uses. A sign-in-only integration should request only kaspa_getAccounts and kaspa_signPersonal.
const { uri, approval } = await signClient.connect({
requiredNamespaces: {
kaspa: {
chains: ["kaspa:mainnet"],
methods: [
"kaspa_getAccounts",
"kaspa_signPersonal",
"kaspa_sendTransaction"
],
events: ["accountsChanged"]
}
}
});
if (!uri) throw new Error("WalletConnect did not return a pairing URI");
const { userAgent, platform, maxTouchPoints } = navigator;
const isAndroid = /Android/i.test(userAgent);
const isIOS = /iPhone|iPad|iPod/i.test(userAgent) ||
(platform === "MacIntel" && maxTouchPoints > 1);
// Keep this approval waiter while the browser is in the background.
const settled = approval();
try {
if (isIOS && !isAndroid) {
showIosPairing(uri); // Raw wc: text, kept in memory; no redirect.
} else {
showAndroidPairing(uri, isAndroid); // App Link / QR, below.
}
const session = await settled;
showConnectedSession(session); // Validate approved chains, methods and accounts.
} finally {
clearPairingUI(); // Remove the URI on success, rejection or expiry.
}A single WalletConnect v2 session may contain Kaspa Mainnet and Kasplex, Igra, or both L2 networks. Kaspire keeps every approved namespace active simultaneously and routes each request by its CAIP-2 chainId; an L2 request does not disconnect the L1 account. Add eip155:202555 (Kasplex) or eip155:38833 (Igra) in the eip155 namespace only if needed. Put non-essential capabilities in optionalNamespaces and check what the wallet actually granted before requesting a method.
Pair manually on iPhone and iPad
On Android, a dApp can open Kaspire using an intent or an App Link. On iOS, the installed Kaspire PWA does not open automatically from a dApp. Show the raw WalletConnect v2 wc: URI in your dApp instead. Do not send it to an Android launch link or to the iOS installation page. Use a separate Install on iOS link without a pairing query for users who don't have Kaspire.
- Show the URI and a Copy connection URI button. Use a labeled, read-only text field with selection as a fallback when clipboard access fails. Keep the URI only in memory and copy it only on a user gesture.
- Wait for pairing, not for the clipboard. After copying, show an indeterminate progress bar and keep the original
approval()promise pending. Offer “Show connection URI again” using the same URI. - Have the user open Kaspire from the Home Screen. Unlock it, choose Pair dApp → Pair Manually, paste the URI, tap Pair dApp, review the dApp and approve the connection. Wait for Kaspire's confirmation, then return to the same dApp tab.
- Complete the connection only when the session settles. Use the approved account in the session; an extra account request can stall if the wallet has already been backgrounded. Clear the URI on completion, rejection or expiry. Generate a new one only for a new connection attempt.
// Framework-neutral UI hooks. Render the URI as text, not markup.
function showIosPairing(uri) {
const { field, copyButton, showWaiting, showCopyHelp } =
renderIosPairingDialog(); // A labeled, read-only textarea and a Copy button
field.value = uri;
field.readOnly = true;
field.onfocus = () => field.select();
copyButton.onclick = async () => {
try {
await navigator.clipboard.writeText(uri);
// Announce the change and show an indeterminate <progress>.
// "Show connection URI again" reveals the same URI.
showWaiting("Waiting for Kaspire to confirm the connection");
} catch {
showCopyHelp("Touch and hold the URI, select all, and copy it.");
}
};
}In GothDAG, copy the URI and the pairing prompt changes to a progress bar that waits for Kaspire to confirm the encrypted session. If the dApp uses a login signature, prompt for that separately after the user returns: pairing is not authentication or a payment.
Expand a step to see the original GothDAG code. These are excerpts, with unrelated branches and configuration omitted.
Generate the URI and wait for approval
The SignClient exposes the raw URI to the UI. iOS stores it in component state and leaves the launch URL empty.
const { uri, approval } = await client.connect({
requiredNamespaces: {
kaspa: {
chains: [chainId],
methods: kaspireWalletConnectMethods,
events,
},
},
optionalNamespaces: {
kaspa: {
chains: [chainId],
methods: kaspireOptionalWalletConnectMethods,
events,
},
},
});
if (!uri) throw new Error("Kaspire pairing URI was not created.");
// …
onPairingUri?.({ uri, appLink, intentLink });
pendingPairings += 1;
pendingEpoch += 1;
try {
activeSession = await approval();
} finally {
pendingPairings -= 1;
}
// Settlement already contains the wallet-approved account. A second getter
// blocks mobile handoff while the wallet is suspended. Server login still
// requires its separate, verified KIP-5 signature; this is not authentication.
if (!usableSession(activeSession)) throw new Error("Kaspire returned an invalid or incomplete approved session.");
const address = sessionAddress(activeSession);
activeSessionAddress = address;
emitState({ session: activeSession, address });
return { session: activeSession, address };const mode = kaspirePairingMode(window.navigator);
const isAndroid = mode === "android";
if (mode === "ios") {
setPairingUri(uri);
setKaspireAction({ active: true, title: "Connect Kaspire on this iPhone or iPad",
message: "Copy the connection URI below. Open the installed Kaspire PWA from your Home Screen, unlock it, then choose Pair dApp → Pair Manually. Paste the URI, tap Pair dApp and approve GothDAG. Wait for the connection confirmation, then return here. For the separate free login signature, reopen Kaspire when prompted.", launchUrl: "" });
setMessage("Copy the connection URI and pair it in the installed Kaspire PWA. No QR scan is needed on this device.");
return;
}Copy the URI and show pairing progress
Copying switches the prompt to an indeterminate progress bar. The same URI can be shown again without starting another session.
async function copyPairingUri() {
if (!pairingUri) return;
try {
await window.navigator.clipboard.writeText(pairingUri);
setPairingCopyMessage("Connection URI copied. Open Kaspire from your Home Screen and paste it in Pair dApp.");
setPairingProcessing(true);
} catch {
setPairingCopyMessage("Clipboard access is unavailable. Touch and hold the URI below, select all and copy it manually.");
}
}
// …
{pairingUri && pairingProcessing ? <div role="status" aria-live="polite">
<progress aria-label="Waiting for Kaspire connection" />
<p>Waiting for Kaspire to confirm the encrypted connection. Open the installed PWA, paste the copied URI and approve GothDAG. Keep this tab open; it continues automatically when the connection is ready.</p>
<button type="button" onClick={() => setPairingProcessing(false)}>SHOW CONNECTION URI AGAIN</button>
</div> : pairingUri ? <>
<button type="button" onClick={copyPairingUri}>COPY CONNECTION URI</button>
<label className="kaspirePairingLabel" htmlFor="kaspire-pairing-uri">WalletConnect v2 connection URI</label>
<textarea id="kaspire-pairing-uri" className="kaspirePairingUri" readOnly value={pairingUri}
rows={3} spellCheck={false} autoCapitalize="off" autoCorrect="off" onFocus={event => event.target.select()} />
{pairingCopyMessage ? <p role="status">{pairingCopyMessage}</p> : null}
<span>This connection URI is temporary. If it expires, start a new connection. Do not share it publicly.</span>
</> : null}Ask for a separate login signature
After the dApp tab is visible again, GothDAG gets a fresh server challenge. The approved WalletConnect session is not the login credential.
await waitForVisiblePage();
await new Promise((resolve) => window.setTimeout(resolve, 350));
if (requestId !== authRequestRef.current) return;
setMessage("Confirm the free GothDAG login signature in your wallet.");
const challengeResponse = await fetch("/api/auth", {
method: "POST", headers: { "content-type": "application/json" },
body: JSON.stringify({ action: "challenge", address }),
});
const challenge = await challengeResponse.json();
if (requestId !== authRequestRef.current) return;
if (!challengeResponse.ok) throw new Error(challenge.error || "Login challenge failed.");
const signed = await signWithKaspire(challenge.message, address, connectedWallet);
if (requestId !== authRequestRef.current) return;
const signature = typeof signed === "string" ? signed : signed?.signature;
if (!signature) throw new Error("The wallet returned no login signature.");
const verifyResponse = await fetch("/api/auth", {
method: "POST", headers: { "content-type": "application/json" },
body: JSON.stringify({ action: "verify", address, nonce: challenge.nonce, signature }),
});
const verified = await verifyResponse.json();
if (!verifyResponse.ok) throw new Error(verified.error || "Login signature could not be verified.");
if (requestId !== authRequestRef.current) return;
setMessage(`${connectedWallet} authenticated. No payment was made.`);Send the request and show the approval dialog
The request stays pending while the user switches apps. The approval dialog and progress indicator reflect the existing request, not a second payment.
const prompt = prompts[method];
const iosPwa = kaspirePairingMode(window.navigator) === "ios";
const notice = paymentNotice || (iosPwa && kaspireTransactionMethods.has(method)
? createKaspirePaymentNotice("Kaspire App") : null);
const ownsNotice = notice && !paymentNotice;
const actionId = `${method}:${Date.now()}:${Math.random().toString(36).slice(2)}`;
if (prompt && !notice) {
window.dispatchEvent(
new CustomEvent("gothdag:kaspireAction", {
detail: { active: true, actionId, launchUrl: iosPwa ? "" : wakeLink, ...prompt,
...(iosPwa ? { message: `${prompt.message} On this iPhone or iPad, switch to the installed Kaspire PWA from your Home Screen. Keep it open for approval, then return here.` } : {}) },
}),
);
}
try {
pendingRequests += 1;
pendingEpoch += 1;
const topic = activeSession.topic;
// Recover a stale iOS socket BEFORE publishing, never by replaying payment.
await resumeRelay(client);
if (!usableSession(activeSession) || activeSession.topic !== topic) {
throw new Error("Kaspire session changed before the request was sent. Reconnect the intended wallet.");
}
notice?.awaitingApproval(method);
const pendingRequest = client.request({
topic,
chainId,
expiry: 5 * 60,
request: { method, params },
});
wakeKaspireForPendingRequest(method, transportHint);
const result = await pendingRequest;
notice?.walletFinished();const failed = notice.phase === "error";
const confirming = notice.phase === "confirming";
const preparing = notice.phase === "preparing";
const title = failed ? (notice.cancelled ? "Wallet request cancelled" : "Payment needs attention")
: confirming ? "Waiting for payment confirmation"
: preparing ? "Preparing your payment" : returned ? "Waiting for Kaspire" : "Approve in your Kaspire PWA";
const status = confirming ? "The wallet step has finished. GothDAG is checking your payment on-chain."
: preparing ? "GothDAG is preparing this payment. No extra wallet action is needed yet."
: returned ? "You are back in GothDAG. We are still waiting for Kaspire to finish and return the transaction result. If approval is still pending, switch back to Kaspire to complete it."
: "Open the installed Kaspire PWA from your Home Screen. Review and approve the requested transaction, then return to this GothDAG tab.";
return createPortal(<div className="gameModalOverlay kaspirePaymentOverlay">
<section className="gameModal kaspirePaymentModal" role="dialog" aria-modal="true"
aria-labelledby="kaspire-payment-title" aria-describedby="kaspire-payment-description"
data-phase={notice.phase} data-returned={returned ? "true" : "false"}>
<p className="nftEyebrow">Kaspire · iOS PWA</p>
<h2 id="kaspire-payment-title">{title}</h2>
<p id="kaspire-payment-description" role="status" aria-live="polite">{failed ? notice.message : status}</p>
// …
<div className="kaspirePaymentProgress" role="progressbar" aria-label={confirming ? "Checking payment confirmation" : "Waiting for wallet response"} aria-busy="true"><span /></div>Restore the dialog and relay on return
The popup responds to the tab becoming visible again, and the same SignClient restores its transport without replaying the RPC.
useEffect(() => {
if (!key) return;
let left = document.visibilityState === "hidden";
setReturned(false);
function visibility() {
if (document.visibilityState === "hidden") { left = true;return; }
if (left) { setReturned(true);setHidden(""); }
}
function pageshow(event) {
if (event.persisted) { setReturned(true);setHidden(""); }
}
document.addEventListener("visibilitychange", visibility);
window.addEventListener("pageshow", pageshow);
return () => {
document.removeEventListener("visibilitychange", visibility);
window.removeEventListener("pageshow", pageshow);
};
}, [key]);const resume = () => {
if (listenersInstalled !== client || activeTransport !== "mobile") return;
if (document.visibilityState === "visible") resumeRelay(client).catch(() => {});
};
document.addEventListener("visibilitychange", resume);
window.addEventListener("pageshow", (event) => { if (event.persisted) resume(); });return function recover(client, { pending = false, epoch = 0 } = {}) {
const relay = client?.core?.relayer;
if (!relay) return Promise.resolve();
if (running) return running;
if (relay === lastRelay && epoch === lastEpoch && now() - lastAttempt < cooldownMs) return Promise.resolve();
if (relay.connected && !pending) return Promise.resolve();
lastRelay = relay;
lastEpoch = epoch;
lastAttempt = now();
let timer;
// Deferring also captures a synchronous SDK failure. The existing request
// promises/IDs, session and subscription stores remain the same objects.
const work = Promise.resolve().then(() => relay.connected
? relay.restartTransport()
: relay.transportOpen());
const bounded = Promise.race([work, new Promise((_, reject) => {
timer = setTimeout(() => reject(new Error("The encrypted wallet connection could not resume. Keep this tab open and try returning from Kaspire again.")), timeoutMs);
})]).finally(() => { clearTimeout(timer); });
running = bounded;
// A UI deadline does not cancel the SDK operation. Never start overlapping
// reconnects while the old one may still complete and replace its socket.
work.then(() => { if (running === bounded) running = undefined; },
() => { if (running === bounded) running = undefined; });
return running;Wait for on-chain payment confirmation
The payment intent is checked against chain data. Only a verified confirmation closes the pending payment notice as successful.
if(!submitted)onSubmitted?.(intent);
notice?.confirming();
const confirmed = await waitForVerifiedPayment(
address,
intent.id,
undefined,
transactionIdMissing ? 60_000 : 10 * 60 * 1000,
transactionIdMissing
? "The wallet returned no transaction ID and no matching on-chain payment was found within 60 seconds."
: undefined,
);
notice?.success();
return confirmed;
// …
while (Date.now() - startedAt < timeoutMs) {
try {
intent = await verifyPaymentIntent(address, intentId);
if(intent.cancelledAt){const error=new Error('This ritual payment was cancelled. No artifacts were consumed. Any payment confirmed later is returned to Reward Center.');error.code='RITUAL_PAYMENT_CANCELLED';throw error;}
lastError = undefined;
onUpdate?.(intent);
if (intent.status === "CONFIRMED" || intent.status === "CONSUMED") {
notice?.success();return intent;
}
} catch (error) {
if(error.code==='RITUAL_PAYMENT_CANCELLED')throw error;
lastError = error;
}
await new Promise((resolve) => window.setTimeout(resolve, 5000));
}Keep the original request pending during app switching
Publish one request on the approved WalletConnect topic, then direct the user to the installed PWA. There is no automatic handoff or return on iOS. The dApp's dialog only explains the status: Kaspire owns the actual review and approval. Use a labeled dialog that manages keyboard focus, a polite live status, and an indeterminate progress bar rather than a percentage that the dApp cannot know.
- Preparing your payment. Create the payment intent and disable duplicate payment actions. No wallet action is needed yet.
- Approve in your Kaspire PWA. Show instructions and an indeterminate progress bar while the wallet request is outstanding. Ask the user to switch manually, unlock and review the request, then return to the same tab. For KRC-20 and KRC-721, keep Kaspire open through the commit and reveal steps.
- Waiting for Kaspire. If the user returns before the result arrives, keep waiting on the same request. An accessible status update can explain that they may need to switch back and finish approval. Hiding the dialog is not a cancellation.
- Waiting for payment confirmation. After a transaction result, check the original intent on-chain. A transaction ID or completed wallet review is not final payment confirmation. Close the notice when verified; on rejection or uncertainty show the outcome and a way to check the original payment, not a second payment button.
// One outstanding request per payment intent. Never call this on resume.
async function requestIosPayment(session, intent, address) {
const chainId = "kaspa:mainnet";
const method = "kaspa_sendTransaction";
const namespace = session.namespaces.kaspa;
if (!namespace?.chains?.includes(chainId) ||
!namespace.methods?.includes(method)) {
throw new Error("The Kaspire session did not grant this payment method.");
}
// Reject duplicate dispatch for this intent. Reconcile pending payments
// instead of starting another request after switching apps or on timeout.
await markOutstandingOnce(intent.id);
showApprovalNotice("Approve in your Kaspire PWA");
try {
const result = await signClient.request({
topic: session.topic, chainId, expiry: 5 * 60,
request: { method, params: {
to: intent.recipient,
amountSompi: intent.amountSompi, // exact base-10 integer string
from: address // full Kaspa address approved for this session
} }
});
const txId = typeof result === "string" ? result : result?.transactionId;
showConfirming("Waiting for payment confirmation");
// Match the exact intent against chain data on your backend.
// If the ID is missing, reconcile the original intent; do not pay again.
await verifyOriginalIntent(intent.id, txId);
closePaymentNotice();
} catch (error) {
showPaymentStatus(intent.id, error); // rejection or check original payment
}
}On visibilitychange when the tab is visible and on pageshow after a back/forward-cache restore, check the relay on the same SignClient. GothDAG uses a single recovery in flight: it reopens a disconnected transport or restarts an apparently connected but stale transport for pending work. Keep the original topic, request, and waiter. A timeout, relay reconnect, or app switch must not dispatch another transaction. After a reload, recover the original intent before accepting a new payment.
For a KIP-5 signature, use the same manual switch and waiting pattern. Verify the signature server-side against the original nonce; there is no on-chain confirmation step for a message. See the GothDAG code excerpts for the actual approval dialog and relay recovery.
Use an Android App Link for desktop QR pairing
Kaspire accepts WalletConnect v2 pairings. However, a generic WalletConnect modal commonly puts the raw wc: URI in its QR code or sends the user to Reown's wallet-selection screen after scanning.
Kaspire is not currently registered in the Reown WalletGuide. The generic picker can therefore offer MetaMask and other listed wallets without showing Kaspire, even when Kaspire is installed. This is expected and does not indicate an installation problem.
https://kaspire.kaslab.space/kaspire/wc?uri=<URL-ENCODED-WALLETCONNECT-URI>Provide a dedicated Connect with Kaspire button. On desktop, encode this complete HTTPS link in your QR code. On Android, open the explicit intent://wc URL shown in the quick start so the installed app wins; keep the verified HTTPS link as its browser fallback. Never encode only the raw wc: URI in the Kaspire QR code.
function showAndroidPairing(uri, isAndroid) {
const appLink =
"https://kaspire.kaslab.space/kaspire/wc?uri=" +
encodeURIComponent(uri);
const intent =
"intent://wc?uri=" + encodeURIComponent(uri) +
"#Intent;scheme=kaspire;package=space.kaspire.wallet;" +
"S.browser_fallback_url=" + encodeURIComponent(appLink) + ";end";
if (isAndroid) window.location.assign(intent);
else renderKaspireQrCode(appLink);
}If Kaspire is not installed, Android opens the HTTPS fallback page instead. That page links to the current official APK. After installation, the user should return to the dApp and generate a new pairing QR code.
If your dApp also supports other WalletConnect wallets, expose a separate Other WalletConnect wallets action for the generic Reown modal.
https://kaspire.kaslab.space/kaspire/wc?uri=<encoded wc: URI>The legacy kaslab.space/kaspire/wc route remains accepted for existing integrations. New integrations should always use the canonical Kaspire subdomain.
Restore the selected account
Kaspire publishes the account as CAIP-10: kaspa:mainnet:q.... RPC results return the normal full address kaspa:q....
A selected address may be the first address of a BIP-44 account, such as m/44'/111111'/1'/0/0, or an address-index subwallet such as m/44'/111111'/0'/0/2. Treat the returned Kaspa address as the authoritative opaque account identifier. Never infer or request a derivation path, and update your UI when Kaspire emits accountsChanged.
const sessions = signClient.session.getAll();
const session = sessions.find(
item => item.namespaces.kaspa?.accounts?.length
);
const caip10 = session?.namespaces.kaspa.accounts[0];
// kaspa:mainnet:q...
const address = caip10
? "kaspa:" + caip10.split(":").slice(2).join(":")
: null;const accounts = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_getAccounts",
params: {}
}
});
// ["kaspa:q..."]signClient.on("session_event", ({ params }) => {
if (params.event.name === "accountsChanged") {
const accounts = params.event.data;
// Update the selected account in your application.
}
});
signClient.on("session_delete", ({ topic }) => {
// Clear local UI state for this topic.
});Supported JSON-RPC requests
kaspa_getAccountsReturns the approved full Kaspa address.
kaspa_getNetworkReturns the active Kaspa network identifier.
kaspa_switchNetworkSwitches to an approved Kaspa or L2 network, or rejects clearly when it was not approved.
kaspa_getBalanceReturns the selected account balance normalized to KAS units.
kaspa_getPublicKeyReturns the signing public key for authentication and provider verification.
kaspa_signPersonalCreates a user-approved KIP-5 personal-message signature.
kaspa_signAuthSigns a reviewed, domain-bound authentication challenge.
kaspa_sendTransactionBuilds, reviews, signs, and broadcasts a native KAS payment.
kaspa_sendKrc20Executes the complete KRC-20 commit/reveal transfer flow.
kaspa_sendKrc721Verifies ownership and executes a reviewed KRC-721 commit/reveal transfer to a recipient or marketplace escrow.
kaspa_sendKcc20Validates and executes a typed KCC20 covenant transfer.
kaspa_signPsktSigns selected inputs of a fully reviewed Kaspa SafeJSON transaction.
kaspa_signVaultTransactionSigns only a native Rust policy-approved vault create or DMS heartbeat transaction.
KIP-5 sign-in
const message = [
"Sign in to Example dApp",
"Domain: example.com",
"Address: " + address,
"Nonce: " + serverNonce,
"Issued At: " + new Date().toISOString(),
"Expiration Time: " + expiresAt
].join("\n");
const signature = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_signPersonal",
params: { address, message }
}
});Generate the nonce on your server, bind it to the intended domain and address, verify the KIP-5 signature server-side, and consume the nonce exactly once.
Native KAS
const transactionId = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_sendTransaction",
params: {
from: address,
to: "kaspa:q...",
amountSompi: "100000000"
}
}
});KRC-20
const result = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_sendKrc20",
params: {
from: address,
to: "kaspa:q...",
ticker: "SOULS",
amount: "100000000"
}
}
});
// result:
// {
// ticker, amount,
// commitTransactionId, revealTransactionId,
// commitFeeSompi, revealFeeSompi
// }Commit and reveal require two authorization steps. Keep the request pending while Kaspire waits for the commit output. A delayed reveal can be resumed safely inside Kaspire.
KRC-721 NFT and escrow transfers
const result = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_sendKrc721",
params: {
from: address,
to: "kaspa:q...", // recipient or marketplace escrow
ticker: "KASPUNKS",
tokenId: "42"
}
}
});
// result:
// {
// ticker, tokenId,
// commitTransactionId, revealTransactionId,
// commitFeeSompi, revealFeeSompi
// }Kaspire checks that the approved account currently holds the exact ticker and token ID before creating the commit. The recipient may be a normal wallet or a marketplace escrow address. The native Rust core constructs the canonical KRC-721 payload and the response returns both transaction IDs and both network fees.
KCC20
const result = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_sendKcc20",
params: {
from: address,
to: "kaspa:q...",
covenantId: "64 lowercase hexadecimal characters",
amount: "100000000"
}
}
});
// result:
// {
// transactionId, covenantId, ticker, amount,
// feeSompi, mass, validation: "toccata-node"
// }Identify KCC20 assets by their complete covenant ID—not by ticker. Kaspire accepts only a verified balance with a complete live-cell mapping and reconstructs the covenant transition locally before signing.
Generic PSKT: marketplaces, KRC-721, KNS and covenants
const signedTxJson = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_signPskt",
params: {
txJsonString: draft.txJson,
options: {
signInputs: [
{ index: 0, sighashType: 1 } // SIGHASH_ALL
]
}
}
}
});
// Kaspire returns the signed SafeJSON string.
// Your dApp finalizes or combines the PSKT and decides when to broadcast.Use kaspa_signPskt when your dApp has already constructed a Kaspa transaction and needs Kaspire to sign only specified inputs. This method is dApp-independent: no KaspaCom-specific, marketplace-specific, or vault-specific cooperation is required. It supports transaction versions 0 and 1 and sighash values 1, 2,4, 129, 130, and132.
Kaspire's native Rust core parses the SafeJSON and every embedded UTXO, rejects duplicate outpoints and inconsistent fields, calculates the fee and wallet net effect, and binds all inputs, outputs, payload, covenant bindings and selected sighashes to the approval. The wallet displays every output and warns for partial signatures, non-standard scripts, and mutable sighashes. It signs only the requested inputs and never broadcasts automatically.
Kaspire guarantees that the displayed transaction is the one signed. It cannot certify your dApp's marketplace price, royalty policy, listing semantics, or covenant intent. Reown's verified domain is anti-phishing context, not a substitute for user review.
Vault policy transactions
const result = await signClient.request({
topic: session.topic,
chainId: "kaspa:mainnet",
request: {
method: "kaspa_signVaultTransaction",
params: {
txJsonString: draft.txJson,
signInputIndexes: [0, 1],
redeemScript: draft.redeemScript
}
}
});
// result: { signedTxJson, profile, reviewHash }
// Creation profiles use signInputIndexes: [0] and redeemScript: "".
// Heartbeats must use exactly [0, 1] and the covenant redeem script.This is an optional stricter profile for the version-2 KasLab time-lock create, DMS create, and DMS heartbeat flows. Other dApps should use kaspa_signPskt; they do not need a dedicated Kaspire policy.
Amounts, addresses, and responses
- Send integer strings, never floating-point values. One KAS is
100000000sompi. - KRC-20 and KCC20 amounts are exact raw token units before applying token decimals.
- KRC-721
tokenIdvalues are exact case-sensitive strings; do not parse them as numbers. - Recipient and optional
fromvalues must be fullkaspa:q...Mainnet addresses. - If supplied,
frommust exactly match the account approved for the session. - Do not treat human-readable ticker or metadata as asset identity. Use the covenant ID for KCC20.
Handle rejection without retry loops
4001User rejected the request-32600Duplicate or malformed request-32601Unsupported method or chain-32602Invalid session account-32000Request failed safely in Kaspire5000Session proposal rejected6000Session disconnectedNever automatically resubmit a rejected payment or signature. Show a clear status, let the user correct the request, and require a new deliberate action.
Production checklist
- Allowlist every legitimate production origin in Reown.
- Request the minimum methods required by the current flow.
- Never log or persist a
wc:pairing URI. - Percent-encode the entire URI exactly once in the Android App Link; show it raw and copyable on iOS.
- Use a server nonce with expiry and one-time consumption for login.
- Verify KIP-5 signatures on the server before creating a session.
- Represent every amount as a base-10 integer string.
- Bind UI state to the WalletConnect topic and approved account.
- Clear local connection state on session deletion or expiry.
- Track the original request across app switches. Verify the payment on-chain before treating the intent as paid.
Test the unhappy paths
Begin with a low-value Mainnet wallet. Test approval, rejection, app switching, expired pairings, disconnected sessions, insufficient funds, malformed addresses, unsupported methods, duplicate requests, interrupted KRC-20/KRC-721 reveals, and background return to the browser. On iOS, also test the clipboard fallback, returning before approval, reconnecting a stale relay, and confirming a payment without dispatching it twice.
Kaspa does not currently define an official WalletConnect namespace for these methods. The API on this page is Kaspire protocol v2 and should be version-pinned in your integration.

