PDA Derivation
Derive treasury and authority program-derived addresses off-chain.
Pre-alpha — not production ready
@aura-protocol/sdk-ts targets Solana devnet only. APIs may change without notice. Do not use for real funds until a stable release and audit are published.
All AURA PDAs can be derived off-chain — synchronously and cheaply. The SDK
exports standalone helper functions and AuraClient exposes equivalent
instance methods.
Standalone Helpers
import {
deriveTreasuryAddress,
deriveDwalletCpiAuthorityAddress,
deriveEncryptCpiAuthorityAddress,
deriveEncryptEventAuthorityAddress,
AURA_PROGRAM_ID,
ENCRYPT_DEVNET_PROGRAM_ID,
DWALLET_DEVNET_PROGRAM_ID,
} from '@aura-protocol/sdk-ts';deriveTreasuryAddress
Derives the treasury PDA for a given owner and agent ID.
Seeds: [b"treasury", owner, agentId]
function deriveTreasuryAddress(
owner: PublicKey,
agentId: string,
programId?: PublicKey,
): [PublicKey, number]const [treasury, bump] = deriveTreasuryAddress(ownerPublicKey, 'agent-prod-1');
console.log('Treasury PDA:', treasury.toBase58());
// Via client instance (uses client's programId automatically)
const [treasury2] = client.deriveTreasuryAddress(ownerPublicKey, 'agent-prod-1');deriveDwalletCpiAuthorityAddress
PDA used as the CPI authority for dWallet cross-program calls.
Seeds: [b"__ika_cpi_authority"]
function deriveDwalletCpiAuthorityAddress(programId?: PublicKey): [PublicKey, number]const [dwalletAuthority] = deriveDwalletCpiAuthorityAddress();
// Via client instance
const [dwalletAuthority2] = client.deriveDwalletCpiAuthority();deriveEncryptCpiAuthorityAddress
PDA used as the CPI authority for Encrypt cross-program calls.
Seeds: [b"__encrypt_cpi_authority"]
function deriveEncryptCpiAuthorityAddress(programId?: PublicKey): [PublicKey, number]const [encryptAuthority] = deriveEncryptCpiAuthorityAddress();
// Via client instance
const [encryptAuthority2] = client.deriveEncryptCpiAuthority();deriveEncryptEventAuthorityAddress
Derives the Encrypt program's event authority PDA.
Seeds: [b"__event_authority"] — scoped to the Encrypt program, not AURA.
function deriveEncryptEventAuthorityAddress(
encryptProgramId: PublicKey,
): [PublicKey, number]import { ENCRYPT_DEVNET_PROGRAM_ID } from '@aura-protocol/sdk-ts';
const [eventAuthority] = deriveEncryptEventAuthorityAddress(ENCRYPT_DEVNET_PROGRAM_ID);
// Via client instance
const [eventAuthority2] = client.deriveEncryptEventAuthority(ENCRYPT_DEVNET_PROGRAM_ID);Additional PDA Helpers
The SDK also exports helpers for auxiliary accounts:
import {
derivePolicySimulationAddress, // [b"policy_simulation", treasury, simulationId]
derivePolicyReceiptAddress, // [b"policy_receipt", treasury, proposalId]
deriveBudgetEnvelopeAddress, // [b"budget_envelope", treasury, envelopeId]
deriveExposureGroupAddress, // [b"exposure_group", authority, groupId]
deriveOperatorRoleAddress, // [b"operator_role", treasury, operator]
deriveExternalLivenessAddress, // [b"external_liveness", treasury]
derivePolicyAttestationAddress, // [b"policy_attestation", treasury, attester, version]
deriveBatchProposalAddress, // [b"batch_proposal", treasury, batchId]
deriveInvariantReportAddress, // [b"invariant_report", treasury, reportId]
deriveMessageApprovalAddress, // dWallet MessageApproval PDA
} from '@aura-protocol/sdk-ts';Program Constants
import {
AURA_PROGRAM_ID, // AURA Anchor program (devnet)
ENCRYPT_DEVNET_PROGRAM_ID, // Ika Encrypt FHE program (devnet)
DWALLET_DEVNET_PROGRAM_ID, // Ika dWallet program (devnet)
} from '@aura-protocol/sdk-ts';Batching Derivations
All derivations are synchronous — batch freely before any async RPC calls:
const agentIds = ['agent-1', 'agent-2', 'agent-3'];
const pdas = agentIds.map((id) => {
const [pda] = deriveTreasuryAddress(owner, id);
return { id, pda };
});
// Fetch all in parallel
const accounts = await Promise.all(
pdas.map(({ pda }) => client.getTreasuryAccountNullable(pda)),
);