@adunai/sdk · build pattern.

For protocol builders deploying contracts on Adunai's substrate. Wallets, remittance, identity products, marketplaces, savings products, infrastructure tooling. OAuth-shaped grant flow on the substrate, read/write to protocol primitives, payments routing, attestation issuance for registered attesters.

Install

shellnpm
# Phase 0: in-repo (npm publication lands with the Phase 1 public release)
git clone <protocol repo> && cd sdk && pnpm install

Peer dependencies: viem ^2.x. Node 18+ or any modern bundler. TypeScript types ship with the package; no @types install needed.

Initialize

typescriptinit
import { Adunai } from "@adunai/sdk";

const adunai = new Adunai({
  network: "base",         // or "base-sepolia" for Phase 0 testnet
  rpc:     "https://sepolia.base.org",
});

Sign in · signIn()

Initiate the OAuth-shaped grant flow. The user reviews scopes in their aID client (or any compatible identity client) and approves or denies the grant. Returns a typed Grant object on approval.

typescriptsignIn
const grant = await adunai.signIn({
  clientId: "com.nimba.app",
  scopes: [
    "identity:handle",
    "attestation:kyc-tier-2",
    "attestation:residency",
  ],
});

console.log(grant.handle);  // @aminata
console.log(grant.did);     // did:adunai:0x4a3b...c9d2
console.log(grant.scopes);  // ["identity:handle", "attestation:kyc-tier-2", "attestation:residency"]

The grant is recorded on-chain via SelectiveDisclosure. Scopes are encoded as a Merkle-friendly bitmap; on-chain storage is constant per grant regardless of scope count.

Read attestations · attestations(did)

Once a grant is approved, read the granted attestations for the user's DID.

typescriptattestations
const claims = await adunai.attestations(grant.did);

claims.kyc;        // { tier: 2, issuer: "0x...", validUntil: 1735689600 }
claims.residency;  // { country: "GH", issuer: "0x...", validUntil: ... }
claims.employment; // (only present if scope was granted)

Payments · pay()

Route a stablecoin payment through PaymentsRouter. The router handles asset-whitelist enforcement, fee splitting (if configured), and handle resolution.

typescriptpay
const receipt = await adunai.pay({
  from:   grant.did,
  to:     "@kofi.business",         // handle, DID, or address
  asset:  "USDC",
  amount: "42.50",
});

receipt.txHash;        // 0x...
receipt.basescan;      // https://basescan.org/tx/...

Issue attestations · for registered attesters

If your project is registered in AttesterRegistry for an attestation type, issue signed attestations via issue(). Registration is a separate step — see the builder hub.

typescriptissue (attesters only)
const attestation = await adunai.issue({
  subject: "did:adunai:0x4a3b...c9d2",
  type:    "attestation:kyc-tier-2",
  payload: { tier: 2, jurisdiction: "NG" },
  validUntil: 1735689600,
});
§

Attesters are accredited, not allowlisted. Registration in AttesterRegistry is open but requires a verification step. The Foundation does not gatekeep accreditation; it provides a structured registry with public criteria. See /governance for the Charter §8.1 governance gates.

Walkthrough · build a wallet

Coming in Pass 5. The wallet-builder walkthrough covers handle creation, attestation onboarding, payments UX, group savings, and the aID-recovery handoff.

§

Pass 5 expansion. Full API reference (every method, every type), recipes (KYC + employment compose, multi-attester verify, custodial vs self-custody, abandonment + reclaim), and the wallet-builder walkthrough land alongside the audit close and mainnet deployment.

Phase 0 · Base Sepolia testnet