KNS implementer kit

window.kasware

Inscribe a .kas name with KasWare

Vendor docs: buildScript (KRC-20 page also covers KNS). Chrome extension + Android APK. Not iOS. Do not call requestAccounts() on page load.

Open the working page. It never asks for a seed.

Connect

const accounts = await window.kasware.requestAccounts();
const address = accounts[0];
// quiet resume: getAccounts()

Create example.kas

const payload = JSON.stringify({ op: "create", p: "domain", v: "example" });

const { script, p2shAddress } = await window.kasware.buildScript({
  type: "KNS",
  data: payload,
});

const entries = await window.kasware.getUtxoEntries();
const [address] = await window.kasware.getAccounts();

const fee = "kaspa:qyp4nvaq3pdq7609z09fvdgwtc9c7rg07fuw5zgeee7xpr085de59eseqfcmynn";
const priceKas = 35; // 5+ graphemes

const { commitIds, revealIds } = await window.kasware.submitCommitReveal(
  {
    priorityEntries: [],
    entries,
    outputs: [{ address: p2shAddress, amount: 1 }],
    changeAddress: address,
    priorityFee: 0.01,
  },
  {
    outputs: [{ address: fee, amount: priceKas }],
    changeAddress: address,
    priorityFee: 0.02,
  },
  script,
  "mainnet"
);
// revealIds[0] is the inscription tx. Id is usually `${revealIds[0]}i0`.

Amounts in submitCommitReveal are KAS, not sompi. buildScript is safe (no popup). Reveal requires approval.

Transfer

{"op":"transfer","p":"domain","id":"<inscriptionId>","to":"kaspa:q…"}

Same type: "KNS". Sender must be the current owner.

Check first

await fetch("https://api.knsdomains.org/mainnet/api/v1/domains/check", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ domainNames: ["example.kas"], address }),
});

If available is false, do not inscribe. A losing reveal still pays the fee.