SDK overview
Most teams only need the managed Sync client, but we also ship the raw Solana builders for folks who want full control. Use this page to decide which layer fits your job.
Layers at a glance
| Layer | Use when | What you get |
|---|---|---|
@fractalshq/sync | You just want working distribution + claim transactions fast. | REST client + React hooks, cohort helpers, pricing info, and ready-to-sign base64 payloads. |
@fractalshq/jito-distributor-sdk | You need handcrafted instructions or want to audit every PDA. | Type-safe builders for the canonical Jito Merkle distributor program plus utils for PDAs and compute budgets. |
Supporting packages
@fractalshq/auth– Server utilities (Next.js/Express) that mint + verify SIWS cookies so every API call has a wallet context.@fractalshq/auth/react– Client hooks (useTxAuth,TxAuthButton) for prompting a wallet signature once and reusing it everywhere.
Typical integration flow
- Authenticate. Mount the auth middleware or provider so wallets sign in once.
- Create distributions. Call
sync.distributions.create(server) oruseSyncApi().distributions.create(client). You pass IDs; Sync returns{ transaction, summary }. - Let people claim. Either embed the (coming soon) widget or run
sync.claims.prepareto fetch ready-to-sign claim transactions. - List cohorts and templates. Use
sync.cohorts.list()or the matching REST endpoints to power internal dashboards.
Pseudocode
import { SyncClient } from "@fractalshq/sync/core";
import { signAndSend } from "./auth";
const sync = new SyncClient({
baseUrl: process.env.SYNC_BASE_URL!,
apiKey: process.env.SYNC_API_KEY!,
});
const { transaction, summary } = await sync.distributions.create({
cohortId: "core-contributors",
splitTemplateId: "contributors-2025",
mint: "GEOD...",
memo: "fractals:distribution:42:fund",
});
await signAndSend(transaction);
const claim = await sync.claims.prepare({
distributionId: summary.distributionId,
wallet: wallet.publicKey.toBase58(),
});
await signAndSend(claim.transaction);The React hooks mirror the same shape:
const { distributions, claims } = useSyncApi();
const { signAndSend } = useTxAuth();Using @fractalshq/jito-distributor-sdk (low-level)
The npm package is published here: @fractalshq/jito-distributor-sdk .
npm install @fractalshq/jito-distributor-sdkMinimal claim flow (you supply the Merkle proof + amounts from your backend/indexer):
import { AnchorProvider } from "@coral-xyz/anchor";
import { getAssociatedTokenAddress } from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import { MerkleDistributor } from "@fractalshq/jito-distributor-sdk";
const provider = new AnchorProvider(connection, wallet, { commitment: "confirmed" });
const sdk = new MerkleDistributor(provider);
const distributor = new PublicKey("<distributor_pda>");
const mint = new PublicKey("<mint>");
const claimantTokenAccount = await getAssociatedTokenAddress(mint, wallet.publicKey);
await sdk.claim({
claimant: wallet.publicKey,
distributor,
claimantTokenAccount,
amountUnlocked: 300n,
amountLocked: 0n,
proof, // Uint8Array[]
});Debugging tips
- Every response returns a
summary.signatureHint—log it so support can trace issues quickly. - Throw the base64 transaction into any Solana explorer if you want to double-check the instruction order before signing.
- Want to go open-source route? Check out @fractalshq/jito-distributor-sdk for on-chain instruction builders.
Last updated on