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

Quick Start

This guide walks through the full setup: creating an organization, adding a user, granting policies, and creating a wallet — everything you need before executing transactions.

Prerequisites

npm install tweetnacl

Setup helpers

const nacl = require("tweetnacl");
const { randomUUID } = require("crypto");

const WAAS_BASE_URL = "https://api.hinkal.io";

function bytesToHex(bytes) {
  return Buffer.from(bytes).toString("hex");
}

function normalizeRoutePath(path) {
  const withSlash = path.startsWith("/") ? path : `/${path}`;
  return withSlash.length > 1 ? withSlash.replace(/\/+$/, "") : withSlash;
}

// Must match the server's route pattern exactly, e.g. "POST /waas/create-wallet"
function buildActionBinding(method, routePath) {
  return `${method.toUpperCase()} ${normalizeRoutePath(routePath)}`;
}

function buildXStamp(binding, params, keypair) {
  const canonical = JSON.stringify([binding, Object.entries(params)]);
  const sigBytes = nacl.sign.detached(Buffer.from(canonical, "utf8"), keypair.secretKey);
  const stamp = {
    publicKey: bytesToHex(keypair.publicKey),
    signature: bytesToHex(sigBytes),
  };
  return Buffer.from(JSON.stringify(stamp)).toString("base64url");
}

async function post(path, body, keypair) {
  const bodyWithNonce = { ...body, nonce: randomUUID() };
  const binding = buildActionBinding("POST", path);
  const res = await fetch(`${WAAS_BASE_URL}${path}`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Stamp": buildXStamp(binding, bodyWithNonce, keypair),
    },
    body: JSON.stringify(bodyWithNonce),
  });
  return res.json();
}
1

Step 1 — Generate keypairs

The root keypair belongs to the organization administrator. The user keypair belongs to the end user.

2

Step 2 — Create an organization

The root keypair signs this request. The signing public key becomes the root user's identifier.

3

Step 3 — Create a user

Root creates a user by registering the user's public key.

4

Step 4 — Grant policies

Policies define what actions a user is allowed to perform. Grant CREATE_WALLET and SIGN_TRANSACTION before the user can create wallets or execute transactions.

5

Step 5 — Create a wallet

The user signs this request with their own keypair. The response contains EVM, Tron, and Solana addresses.

6

Step 6 — Execute a transaction

Once the wallet is set up, execute transactions using the user's keypair.

POST /waas/public-to-public performs a deposit-and-withdraw: it deposits tokens into Hinkal and immediately schedules the withdrawal to the recipient. The response includes both a txHash (the deposit transaction) and a scheduleId for polling the withdrawal status.

7

Step 7 — Poll withdrawal status

Use the scheduleId to track when the withdrawal reaches the recipient on-chain. Poll until status is completed or failed.

For private transactions, use /waas/public-to-private, /waas/private-to-public, or /waas/private-to-private with the same request shape.