The PRISM Protocol SDK packages everything you need to integrate the credit engine and AMM into your application: Anchor IDLs, deployed program addresses, PDA derivation helpers, math constants, error types, and TypeScript types generated from the on-chain programs.If you have ever wired an Anchor program by hand — copying an IDL into your repo, hard-coding program IDs, redefining PDA seeds in three places — the SDK eliminates that surface. It is the same module set the official PRISM frontend uses, packaged for reuse.
bun add prismprotocol-sdk @coral-xyz/anchor @solana/web3.js @solana/spl-token
PRISM is built on Anchor 0.30.1 and Solana Web3.js 1.x. The SDK declares these as peer dependencies so your app pins one shared version across all Solana modules.
✅ Server scripts, indexers, oracles, setup tooling
Browser (modern)
✅ Wallet-adapter integrations, Next.js, Vite
React Native
⚠️ Works for read paths; signing requires a wallet adapter that supports your platform
Cloudflare Workers / Edge
⚠️ Works for read paths; some Anchor utilities pull Buffer polyfills
The SDK is published as ES modules with TypeScript type definitions. CommonJS consumers should use a bundler that handles dual packages (Next.js, Vite, esbuild, tsup all work out of the box).
These resolve to the deployed devnet addresses and override automatically when you set NEXT_PUBLIC_PRISM_CORE_PROGRAM_ID / NEXT_PUBLIC_PRISM_AMM_PROGRAM_ID environment variables.
import { prismCoreIdl, // Full Anchor IDL for prism_core prismAmmIdl, // Full Anchor IDL for prism_amm} from 'prismprotocol-sdk';
Pass these directly to new Program(idl, provider) to instantiate a typed Anchor program client. The IDLs are kept in lockstep with the deployed programs.
Anchor wraps program errors in a structured object. Use the SDK’s decodeAnchorError helper to surface a typed enum value plus a human-readable message:
import { decodeAnchorError } from 'prismprotocol-sdk';try { await core.methods.deposit(kind, amount).accounts({ /* ... */ }).rpc();} catch (raw) { const decoded = decodeAnchorError(raw); if (decoded?.kind === 'core' && decoded.error === 'TrancheWipedNoDepositsAllowed') { // direct user to a different tranche } else { throw raw; }}
The SDK is designed for tree-shaking. Only the helpers you import end up in your bundle:
// ✅ Only ~5 KB of PDA helpers + types in your bundleimport { getVaultPda, getTranchePda, TrancheKind } from 'prismprotocol-sdk';// ⚠️ Pulls the full IDL JSON (~80 KB) — fine for app code, avoid in shared libsimport { prismCoreIdl } from 'prismprotocol-sdk';
The IDLs are intentionally separate entry points so a “read PDAs only” usage stays small.
The SDK is versioned alongside the deployed Anchor programs. The mapping is:
Change
SDK version bump
Program redeploy with new ID
Major (0.x → 1.x)
New instruction or account field
Minor (1.0 → 1.1)
Bug fix in a helper, doc fix
Patch (1.0.0 → 1.0.1)
Breaking change to IDL layout
Major
PRISM is currently a hackathon-stage devnet build. Pin the SDK to an exact version in package.json (no ^ or ~) until mainnet ships and a stable release line is published.
When the SDK transitions from devnet to mainnet, the migration guide will live at docs/migration/<from>-to-<to>.md. Breaking changes always come with a codemod or a search/replace mapping.