Skip to main content

Client SDKs

TypeScript SDKs for building and reading on the Sui rail. They wrap the same contract as the REST API — anything they do, you can also do with plain HTTP.

:::info SDK release status @tbookdev/vault-sdk-sui, @tbookdev/vault-react-sui, and @tbookdev/vault-node are published on the public npm registry — install them with npm install like any other dependency. The REST contract is the normative interface. :::

Packages

PackagePurpose
@tbookdev/vault-sdk-suiSui rail: reads + unsigned PTB builders (rcUSDP vault, XAUa AlphaVault)
@tbookdev/vault-react-suiHeadless React hooks on top of the Sui SDK — see React Hooks
@tbookdev/vault-nodeServer-side: typed API client + webhook verification — see Server SDK

:::note Legacy Solana rail (frozen) The Solana packages (@tbookdev/vault-sdk, @tbookdev/vault-react) are frozen — a 0.1.0 remains on npm from an early release, but they are unmaintained and not part of the publish set; do not use them for new integrations. The rcusdp-sol vault is paused: deposit and redeem builds return 409 vault_paused, while claim and cancel remain open for existing positions. :::

What client SDKs are for

Use @tbookdev/vault-sdk-sui when you build transactions in the browser (or any environment with your own signer) against a connected wallet, rather than through your backend. The SDK produces unsigned transaction bytes — no signing, no React:

import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { getSuiVaultConfig, buildDepositTx } from "@tbookdev/vault-sdk-sui";

const client = new SuiClient({ url: getFullnodeUrl("testnet") });
const vault = getSuiVaultConfig("rcusdp-sui", "testnet");

// Amounts are raw USDC units (6 decimals): 100.00 USDC = 100_000_000n
const { txBytesBase64, message } = await buildDepositTx(client, vault, {
sender: wallet.address,
amount: 100_000_000n,
});
// sign with @mysten/dapp-kit: useSignAndExecuteTransaction({ transaction: txBytesBase64 })

The full builder set covers the rcUSDP lifecycle — buildDepositTx, buildQueueRedeemTx, buildInstantRedeemTx, buildCancelDepositTx, buildClaimTx, buildTransferUsdcTx — plus reads (getUserPosition, getVaultState, getUserRecords) and XAUa AlphaVault helpers (getAlphaVaultConfig, buildSubscribeTx, buildRequestRedemptionTx, buildCancelRequestTx, buildClaimUsdcTx, getAlphaPosition). Transient RPC failures can be wrapped with the exported withRetry helper.

For server-driven integrations (most fintech apps, all omnibus/treasury setups), prefer the REST API — it adds intent tracking, idempotency, and attribution automatically.