AURA
Core

dWallet

Register and manage multi-chain dWallet references for co-signing.

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.

registerDwallet

Register a dWallet reference with the treasury. Required before any cross-chain execution via Ika co-signing.

// Build only
const instruction = await client.registerDwalletInstruction(
  accounts: OwnerTreasuryAccounts,
  args: RegisterDwalletArgs,
);

// Build + send
await client.registerDwallet(
  owner: Signer,
  accounts: OwnerTreasuryAccounts,
  args: RegisterDwalletArgs,
);

Accounts

interface OwnerTreasuryAccounts {
  owner: PublicKey;    // treasury owner — must match the signer
  treasury: PublicKey; // treasury PDA
}

Arguments

interface RegisterDwalletArgs {
  chain: number;                          // target chain (see table below)
  dwalletId: string;                      // unique dWallet ID from Ika
  address: string;                        // native chain address (e.g. 0x…)
  balanceUsd: BN;                         // current balance hint in USD cents
  dwalletAccount: PublicKey | null;       // set for live Ika co-signing
  authorizedUserPubkey: PublicKey | null;
  messageMetadataDigest: number[] | null;
  publicKeyHex: string | null;
  timestamp: BN;
}

Supported Chains

IDChain
0Solana
1Bitcoin
2Ethereum
3Polygon
4Arbitrum
5Optimism

Example

import BN from 'bn.js';

await client.registerDwallet(
  owner,
  { owner: owner.publicKey, treasury },
  {
    chain: 2, // Ethereum
    dwalletId: 'dwallet-abc123',
    address: '0xdeadbeef...',
    balanceUsd: new BN(5_000),
    dwalletAccount: dwalletAccountPDA,
    authorizedUserPubkey: null,
    messageMetadataDigest: null,
    publicKeyHex: null,
    timestamp: new BN(Math.floor(Date.now() / 1000)),
  },
);

refreshDwalletBalance

Refresh the cached dWallet balance by reading it from an on-chain oracle account. The oracle's first 8 bytes are read as a little-endian u64 USD cents value.

// Build only
const instruction = await client.refreshDwalletBalanceInstruction(
  accounts: RefreshDwalletBalanceAccounts,
  chainCode: number,
  now: BNish,
);

// Build + send
await client.refreshDwalletBalance(
  payer: Signer,
  accounts: RefreshDwalletBalanceAccounts,
  chainCode: number,
  now: BNish,
);

Accounts

interface RefreshDwalletBalanceAccounts {
  treasury: PublicKey;      // treasury whose dWallet balance is refreshed
  balanceOracle: PublicKey; // oracle account — first 8 bytes hold the USD cents balance
}

Example

import BN from 'bn.js';

const now = new BN(Math.floor(Date.now() / 1000));

await client.refreshDwalletBalance(
  payer,
  {
    treasury: treasuryPDA,
    balanceOracle: balanceOraclePDA,
  },
  2,   // chain code: Ethereum
  now,
);

On this page