Skip to Content
DocsDevelopersSDK overview

SDK overview

High-level entry points for building on Sync. We ship two layers:

  • @fractalshq/jito-distributor-sdk: low-level Solana instruction builders for the Jito merkle distributor program (PDAs, merkle roots, compute budget, funding). Great for power users who want to own every instruction.
  • @fractalshq/sync (planned): the productized SDK that talks to our API, reuses cohorts, and returns ready-to-sign transactions for creation + claims. This is what we sell to partners.

Integration shape

  • Managed auth: use @fractalshq/auth-core on the server to mint/verify SIWS cookies and @fractalshq/auth-react on the client to expose useTxAuth for signature prompts.
  • Universal transaction constructor: call Sync’s REST API or React hooks to request a distribution transaction. We handle merkle trees, PDAs, memos, and compute-budget instructions server-side.
  • Cohorts + splits: @fractalshq/sync lets you reference saved cohorts or upload CSV data inline before constructing the transaction.
  • Claims: use our hosted widget or fetch a claim transaction via the SDK; the API adds Token-2022 wrap/unwrap instructions automatically and subsidizes user gas to ~$0.50.
  • Pricing helpers: each response includes lamport spend + USD approximations so you can show costs before asking for a signature.

Pseudocode (@fractalshq/sync)

import { SyncClient } from "@fractalshq/sync/core"; const sync = new SyncClient({ baseUrl: process.env.NEXT_PUBLIC_SYNC_BASE_URL!, apiKey: process.env.SYNC_API_KEY!, }); // 1. Build and sign a distribution const { transaction, summary } = await sync.distributions.create({ cohortId: "core-contributors", mint: "GEOD...", admin: wallet.publicKey.toBase58(), schedule: { startVestingTs: 1_763_056_306, endVestingTs: 1_763_142_706, clawbackStartTs: 1_763_229_106, }, memo: "fractals:distribution:42:fund", }); await signAndSend(transaction); // 2. Prep a claim const claimTx = await sync.claims.prepare({ distributionId: summary.distributionId, wallet: wallet.publicKey.toBase58(), }); await signAndSend(claimTx.transaction); // 3. Inspect cohorts/splits if you want to render dashboards const cohorts = await sync.cohorts.list({ label: "DePIN" });

Early-look snippets (subject to change)

import { useSyncApi } from "@fractalshq/sync/react"; import { useTxAuth } from "@fractalshq/auth-react"; const { distributions } = useSyncApi(); const { signAndSend } = useTxAuth(); async function createDistribution() { const { transaction, summary } = await distributions.create({ cohortId: "ecosystem-weekly", mint: "GEOD...", memo: "fractals:distribution:23:fund", }); await signAndSend(transaction); console.log(summary.estimatedCostUsd); }
import { useSyncApi } from "@fractalshq/sync/react"; import { useTxAuth } from "@fractalshq/auth-react"; const { claims } = useSyncApi(); const { signAndSend } = useTxAuth(); async function claim({ distributionId }) { const { transaction, expectedAmount } = await claims.prepare({ distributionId }); await signAndSend(transaction); console.log(`Claimed ${expectedAmount}`); }

Under the hood these helpers talk to Sync’s API, which uses the finalized @fractalshq/jito-distributor-sdk to build instructions. If you ever outgrow the managed layer you can drop down and call the low-level SDK directly.

Last updated on