AURA

Quick Start

Install the TypeScript SDK and build against the current AURA program surface.

Install

npm install @aura-protocol/sdk-ts @solana/web3.js bn.js

Current package version in this repo: @aura-protocol/sdk-ts@0.3.1

Connect

import { Connection, Keypair } from "@solana/web3.js";
import { AuraClient, AURA_PROGRAM_ID } from "@aura-protocol/sdk-ts";

// Load your funded devnet keypair.
const keypair = Keypair.fromSecretKey(/* your secret key bytes */);

const client = new AuraClient({
  connection: new Connection("https://api.devnet.solana.com", "confirmed"),
  // programId defaults to AURA_PROGRAM_ID = auraEgX8ZUK3Xr8X81aRfgyTmoyNdsdfL6XfDN8W1ce
  programId: AURA_PROGRAM_ID,
});

Create a treasury

The SDK is functional: account helpers derive PDAs and shape account maps, while generated instruction helpers build or send transactions. CreateTreasuryArgs is a complete IDL type, so its nested PolicyConfigRecord and ProtocolFeesRecord fields must be supplied.

import BN from "bn.js";
import {
  accounts,
  instructions,
  type CreateTreasuryArgs,
} from "@aura-protocol/sdk-ts";

const args: CreateTreasuryArgs = {
  agentId: "my-agent-1",
  aiAuthority: keypair.publicKey,
  createdAt: new BN(Math.floor(Date.now() / 1000)),
  pendingTransactionTtlSecs: new BN(900),
  policyConfig, // full PolicyConfigRecord
  protocolFees, // full ProtocolFeesRecord
};

const { treasury, input } = accounts.createTreasuryInput({
  owner: keypair.publicKey,
  args,
});

const signature = await instructions.treasury.sendCreateTreasury(
  client,
  keypair,
  input,
);

console.log("Treasury PDA:", treasury.toBase58());
console.log("Signature:", signature);

Register a dWallet

Each execution chain needs a registered dWallet before proposals on that chain can move to signing. Use instructions.dwallet.registerDwallet or sendRegisterDwallet; the dWallet ID and native address come from Ika provisioning.

Chain codes are 0=Bitcoin, 1=Ethereum, 2=Solana, 3=Polygon, 4=Arbitrum, 5=Optimism.

Propose and execute

Public proposals are built with instructions.execution.proposeTransaction. Confidential proposals use proposeConfidentialTransaction, then requestPolicyDecryption and confirmPolicyDecryption before execution. Approved proposals continue through executePending and finalizeExecution; chain-bound proposals may also require markSettlementBroadcast and confirmSettlement.

For chain-bound proposals where Ika must sign exact native bytes, the proposal can bind nativeMessageHash and chain-specific replay fields. See dWallet Execution for the full flow.

Read treasury state

const account = await accounts.fetchTreasuryAccount(client, treasury);

console.log("Agent ID:", account.agentId);
console.log("Paused:", account.executionPaused);
console.log("Total transactions:", account.totalTransactions.toString());
console.log("Daily limit:", account.policyConfig.dailyLimitUsd.toString());

Or derive the PDA and fetch by owner + agent ID:

const [pda] = accounts.derive(keypair.publicKey, "my-agent-1");
const account = await accounts.fetchTreasuryAccount(client, pda);

Low-Level Surface

The SDK exposes all 161 program instructions as generated builders grouped by domain:

const ix = await instructions.treasury.createTreasury(client, input);
await client.sendInstructions(keypair, [ix]);

Every program account has a typed fetcher under accounts, every PDA helper is under pda, and error/event helpers are exported from the root package.

Error Handling

Program errors start at code 6000. Use the SDK error parser to recover the program error name and message from thrown RPC/Anchor errors:

import { parseAuraError } from "@aura-protocol/sdk-ts";

try {
  await instructions.execution.sendProposeTransaction(client, keypair, input);
} catch (err) {
  const parsed = parseAuraError(err);
  if (parsed?.name === "PendingTransactionExists") {
    console.log("The treasury pending queue is full — clear or settle a proposal first");
  }
}

Common errors:

CodeNameMeaning
6004PendingTransactionExistsPending proposal queue is full
6005NoPendingTransactionNo proposal to execute or cancel
6006DWalletNotConfiguredNo dWallet registered for the target chain
6015ConfidentialGuardrailsNotConfiguredConfidential path requires ciphertext accounts
6018ExecutionPausedTreasury is paused
6019PendingTransactionExpiredProposal TTL elapsed
6028TimelockNotElapsedDangerous config change timelock still active

What's Next

On this page