AURA

Accounts

Typed fetchers for every program account, plus the treasury input helper.

The accounts namespace decodes on-chain data into fully typed records. Every one of the program's 32 account types has two fetchers:

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

// Throws if the account does not exist.
const treasury = await accounts.fetchTreasuryAccount(client, address);

// Returns null instead of throwing.
const maybe = await accounts.fetchTreasuryAccountNullable(client, address);

The decoded record types are generated from the IDL (IdlAccounts<AuraCore>), so fields like owner: PublicKey, agentId: string, and dailyLimitUsd: BN are typed exactly as the program stores them.

Reading state

import { accounts, deriveTreasuryAddress } from "@aura-protocol/sdk-ts";

const [treasury] = deriveTreasuryAddress(owner.publicKey, "agent-prod-1");

const state = await accounts.fetchTreasuryAccount(client, treasury);
console.log(state.agentId, state.agentState, state.executionPaused);
console.log("daily limit:", state.policyConfig.dailyLimitUsd.toString());

// Sidecar accounts live at their own PDAs.
const [analytics] = pda.deriveTreasuryAnalyticsAddress(treasury);
const stats = await accounts.fetchTreasuryAnalyticsAccountNullable(client, analytics);

The treasury input helper

createTreasuryInput is a convenience that derives the treasury PDA and shapes the full create_treasury account set for you:

const { treasury, input } = accounts.createTreasuryInput({
  owner: owner.publicKey,
  args: createTreasuryArgs,
  // treasury?: PublicKey  — optional override; derived if omitted
});

await instructions.treasury.sendCreateTreasury(client, owner, input);

It returns { treasury, input } where input is ready to pass straight to the createTreasury builder.

Account → fetcher → PDA reference

Each account is fetched with fetch<Name> / fetch<Name>Nullable and its address is derived with the linked PDA helper.

AccountFetcherPDA helper
TreasuryAccountfetchTreasuryAccountderiveTreasuryAddress(owner, agentId)
TreasuryAnalyticsAccountfetchTreasuryAnalyticsAccountderiveTreasuryAnalyticsAddress(treasury)
ConfidentialGuardrailsAccountfetchConfidentialGuardrailsAccountderiveConfidentialGuardrailsAddress(treasury)
DWalletAccountfetchDWalletAccountderiveDwalletStateAddress(treasury, chain)
ScheduledIntentfetchScheduledIntentderiveScheduledIntentAddress(treasury, intentId)
ConditionalProposalfetchConditionalProposalderiveConditionalProposalAddress(treasury, proposalId)
BatchProposalAccountfetchBatchProposalAccountderiveBatchProposalAddress(treasury, batchId)
PolicyReceiptAccountfetchPolicyReceiptAccountderivePolicyReceiptAddress(treasury, proposalId)
PolicySimulationResultAccountfetchPolicySimulationResultAccountderivePolicySimulationAddress(treasury, simulationId)
PolicyAttestationAccountfetchPolicyAttestationAccountderivePolicyAttestationAddress(treasury, attester, policyVersion)
PolicyHistoryAccountfetchPolicyHistoryAccountderivePolicyHistoryAddress(treasury)
PolicyCanaryAccountfetchPolicyCanaryAccountderivePolicyCanaryAddress(treasury)
PolicyCheckResultfetchPolicyCheckResultderivePolicyCheckAddress(treasury, caller)
PolicyTemplatefetchPolicyTemplatederivePolicyTemplateAddress(owner, templateId)
TrustIdentityAccountfetchTrustIdentityAccountderiveTrustIdentityAddress(treasury)
InvariantReportAccountfetchInvariantReportAccountderiveInvariantReportAddress(treasury, reportId)
BudgetEnvelopeAccountfetchBudgetEnvelopeAccountderiveBudgetEnvelopeAddress(treasury, envelopeId)
ExposureGroupAccountfetchExposureGroupAccountderiveExposureGroupAddress(authority, groupId)
OperatorRoleAccountfetchOperatorRoleAccountderiveOperatorRoleAddress(treasury, operator)
SessionKeyAccountfetchSessionKeyAccountderiveSessionKeyAddress(treasury, sessionKey)
ExternalLivenessAccountfetchExternalLivenessAccountderiveExternalLivenessAddress(treasury)
HealthScoreAccountfetchHealthScoreAccountderiveHealthScoreAddress(treasury)
SnapshotAccountfetchSnapshotAccountderiveSnapshotAddress(treasury, snapshotIndex)
ActivityLogAccountfetchActivityLogAccountderiveActivityLogAddress(treasury)
AddressListAccountfetchAddressListAccountderiveAddressListAddress(treasury)
SwarmPoolAccountfetchSwarmPoolAccountderiveSwarmPoolAddress(swarmId)
FeeVaultAccountfetchFeeVaultAccountderiveFeeVaultAddress(treasury)
FeeScheduleAccountfetchFeeScheduleAccountderiveFeeScheduleAddress(treasury)
BillingTemplatefetchBillingTemplatederiveBillingTemplateAddress(owner, templateId)
ChainProfileAccountfetchChainProfileAccountderiveChainProfileAddress(chainCode)
ProtocolConfigAccountfetchProtocolConfigAccountderiveProtocolConfigAddress()
ComplianceOracleAccountfetchComplianceOracleAccountexternal oracle (address provided by integrator)

Record types are exported too — e.g. import the AuraCore IDL type and use IdlAccounts<AuraCore>["treasuryAccount"], or rely on the inferred return type of each fetcher.

On this page