AuraClient
The thin RPC + Anchor client — constructor, properties, and transaction sending.
AuraClient is a thin wrapper around a Solana Connection and the Anchor
Program. It holds no per-instruction logic — instruction building lives in the
instructions namespace and account reads in
accounts. The client's job is to provide the
program, the coder, and a way to send transactions.
Constructor
import { Connection } from "@solana/web3.js";
import { AuraClient, AURA_PROGRAM_ID } from "@aura-protocol/sdk-ts";
// Defaults to the devnet AURA program id.
const client = new AuraClient({
connection: new Connection("https://api.devnet.solana.com", "confirmed"),
});
// Override the program id (e.g. localnet) and confirm options.
const localClient = new AuraClient({
connection: new Connection("http://localhost:8899", "confirmed"),
programId: myLocalProgramId,
confirmOptions: { commitment: "confirmed", skipPreflight: false },
});AuraClientOptions:
| Option | Type | Required | Description |
|---|---|---|---|
connection | Connection | ✓ | Solana RPC connection. |
programId | PublicKey | — | Program id override. Defaults to AURA_PROGRAM_ID. |
confirmOptions | ConfirmOptions | — | Anchor confirm options. |
Properties
| Property | Type | Description |
|---|---|---|
connection | Connection | The underlying RPC connection. |
programId | PublicKey | The program id in use. |
confirmOptions | ConfirmOptions | Resolved confirm options. |
provider | AnchorProvider | Read-only provider. Its wallet cannot sign — it throws if asked. |
program | Program<AuraCore> | Anchor program used by every instruction builder. |
coder | BorshInstructionCoder | Decodes raw instruction data (see below). |
The provider never signs
The client builds a read-only provider so it can never accidentally sign with
an unexpected key. You always pass an explicit Signer to sendInstructions
and to every send* helper.
Sending transactions
sendInstructions packs one or more instructions into a single transaction,
signs with the payer (plus any extra signers), and sends it. It returns the
signature immediately — it does not wait for confirmation, so await
confirmation yourself if you need to read state right after.
import BN from "bn.js";
import { instructions } from "@aura-protocol/sdk-ts";
const now = new BN(Math.floor(Date.now() / 1000));
// Compose multiple instructions into one transaction.
const pauseIx = await instructions.execution.pauseExecution(client, {
accounts: { owner: owner.publicKey, treasury },
args: { paused: true, now },
});
const cancelIx = await instructions.execution.cancelPending(client, {
accounts: { owner: owner.publicKey, treasury, dwalletState: null },
args: { now },
});
const signature = await client.sendInstructions(owner, [pauseIx, cancelIx]);| Parameter | Type | Description |
|---|---|---|
payer | Signer | Fee payer and primary signer. |
instructions | TransactionInstruction[] | Instructions to include. |
extraSigners | Signer[] | Additional signers (optional). |
options | SendOptions | e.g. { skipPreflight: true } (optional). |
sendInstruction(payer, instruction, extraSigners?, options?) is the
single-instruction convenience form.
Confirm before reading state
sendInstructions returns before the validator processes the transaction. To
assert on-chain state immediately afterwards, confirm against the blockhash
(see the Examples page) or fetch with a short retry.
Decoding instruction data
The Borsh coder decodes raw instruction data back into a name + arguments — useful for inspecting transactions or building explorers.
const ix = await instructions.treasury.createTreasury(client, input);
const decoded = client.coder.decode(ix.data);
console.log(decoded?.name); // "create_treasury"