SHILDO Docs / SDK

SDK

Integrate confidential payments with a small JavaScript surface. The demo wallet uses the same Supabase backed ledger API documented below.

Installation

npm install @shildo/sdk
# or
pnpm add @shildo/sdk

Quick start

import { createShildoClient } from "@shildo/sdk";

const shildo = createShildoClient({
  network: "base-sepolia",
  apiKey: process.env.SHILDO_API_KEY,
});

const intent = await shildo.createIntent({
  asset: "USDC",
  amount: "100.00",
  recipient: "0xabc1234567890123456789012345678901234567890",
  shielded: true,
  memo: "Invoice 1042",
});

const receipt = await shildo.submitIntent(intent);
console.log(receipt.txHash, receipt.blockNumber);

Client configuration

OptionTypeDescription
networkstringbase, base-sepolia, ethereum, solana-devnet
apiKeystringServer side prover API key
rpcUrlstringOptional custom Base RPC
timeoutMsnumberProof submission timeout (default 30000)

Demo wallet Supabase API

The open source wallet at /access calls Supabase RPC functions directly through access-db.js. You can replicate this pattern for prototypes.

register_wallet

const { data, error } = await supabase.rpc("register_wallet", {
  p_address: "0x...",
  p_seed_hash: sha256Hex(normalizedSeedPhrase),
});
// Returns { id, address }
// Credits 5 ETH, 1000 USDC, 1000 SHILDO, 1 BTC
// Writes 4 is_credit transactions from treasury

process_transfer

const { data, error } = await supabase.rpc("process_transfer", {
  p_from_address: sender,
  p_to_address: recipient,
  p_asset: "usdc",
  p_amount: 25.5,
  p_memo: "Payment for services",
  p_is_shielded: true,
});
// Returns { id, tx_hash, block_number, is_shielded }

Validation rules

  • Addresses must match ^0x[a-f0-9]{40}$
  • Asset must be eth, usdc, shld, or btc
  • Amount must be positive
  • Sender and recipient must differ
  • Sender balance must cover amount

Database schema (demo)

TablePurpose
walletsRegistered addresses and seed hashes
balancesPer wallet asset amounts
transactionsPublic ledger rows with shield flag
chain_stateSimulated latest block counter

Run supabase/schema.sql in the Supabase SQL editor to initialize. See the wallet banner if schema is missing.

Shield flag

Set shielded: true in SDK calls or p_is_shielded: true in RPC calls. The ledger stores is_shielded on the transaction row and moves memos into shielded_memo when shielded.

Events (production SDK)

shildo.on("intent.sealed", (e) => { /* commitment id */ });
shildo.on("proof.verified", (e) => { /* tx hash on Base */ });
shildo.on("delivery.completed", (e) => { /* destination tx */ });
shildo.on("delivery.failed", (e) => { /* retry or refund */ });

Error codes

CodeMeaning
INSUFFICIENT_BALANCESender lacks asset amount
INVALID_RECIPIENTMalformed address
PROOF_REJECTEDVerifier reverted on Base
ROUTE_UNAVAILABLENo relayer liquidity for path