For the complete documentation index, see llms.txt. This page is also available as Markdown.

Install the SDK

bun add @sonicsvm/northstar-sdk @solana/web3.js
# or
npm install @sonicsvm/northstar-sdk @solana/web3.js

The SDK is a thin TypeScript wrapper around the Portal program plus a few helpers for session lifecycle, account delegation, and ER endpoint routing. It pairs with @solana/web3.js for the underlying transaction primitives.

Requirements

  • Node 20+ or Bun 1.2+ — the SDK ships ESM only.

  • A funded keypair on devnet — sessions are anchored on L1, so the owner needs SOL for the OpenSession + Delegate transactions. Get devnet SOL via solana airdrop or a faucet.

  • A local checkout of @solana/web3.js's peer dep — the SDK lists it as a peer, not a direct dep, to let your project pin its own version.

Verify the install

Quickest sanity check — open a session against devnet:

import { NorthStarSDK } from "@sonicsvm/northstar-sdk";
import { Connection, Keypair } from "@solana/web3.js";

const sdk = new NorthStarSDK({
  portalProgramId: "74iiMCqFw1afWyp3tdh9pUqfRfCRq7gfdC2YZoNGpovt",
  customEndpoints: {
    solana: new Connection("https://api.devnet.sonic.game"),
    ephemeralRollup: new Connection("https://ephemeral.devnet.sonic.game"),
  },
});

const owner = Keypair.generate();
console.log(`Owner: ${owner.publicKey.toBase58()}`);

If that imports without error, you're ready for Hello World.

Next steps

  • Hello World — open a session, run a transaction inside it, settle back.

  • Recipes — common patterns for agents, oracles, orderbooks.

  • Concepts — what's actually happening under the hood.

Last updated