npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fractalshq/sync

v0.1.2

Published

Fractals Sync SDK: shared types, server client, React hooks, and widgets

Downloads

408

Readme

@fractalshq/sync

Fractals Sync is the all-in-one SDK for the distribution platform. The default @fractalshq/sync export points to v2, and v1 is still available via explicit subpaths.

@fractalshq/sync          // default v2 surface (claims + tx build only)
@fractalshq/sync/v2       // public v2 surface (claims + tx build only)
@fractalshq/sync/v2/core  // v2 core helpers (build tx + list claims)
@fractalshq/sync/v2/react // v2 React hooks (useClaims, useClaimTransaction)
@fractalshq/sync/v1/core     // shared types + helpers (pure TS)
@fractalshq/sync/v1/server   // Node/Next client that talks to /api/v1
@fractalshq/sync/v1/react    // hooks that assume AuthProvider + wallet context
@fractalshq/sync/v1/widgets  // drop-in UI with its own provider stack

Legacy v1 aliases (mapped to v1): @fractalshq/sync/core, @fractalshq/sync/server, @fractalshq/sync/react, @fractalshq/sync/widgets.

Layout

packages/sync/
├── src/
│   ├── v1/
│   │   ├── core/      // typed constants, schemas, memo builders
│   │   ├── server/    // moved from @fractalshq/distribution-server
│   │   ├── react/     // hooks + helpers (will absorb old distribution-client work)
│   │   └── widgets/   // claim panels, buttons, etc.
│   └── v2/            // public v2 API surface (claims + tx build)
└── package.json   // exports map for subpaths

V2 (public claims surface)

V2 is intentionally tiny and public-facing. It only exposes:

  • GET /api/v2/claims?wallet=<pubkey> (claimable + claimed)
  • POST /api/v2/claims/[id]/create-transaction (build claim tx)

Core usage

import { listClaims, buildClaimTransaction } from "@fractalshq/sync/v2/core";

const claims = await listClaims(wallet);
const tx = await buildClaimTransaction({
  distributionId,
  claimant: wallet,
});

React usage

import { useClaims, useClaimTransaction } from "@fractalshq/sync/v2/react";

const claimsQuery = useClaims(wallet);
const buildTx = useClaimTransaction();
buildTx.mutateAsync({ distributionId, claimant: wallet });

UI-only flow (bring your own signer)

V2 is build-only: it returns a transaction payload and you wire signing/sending yourself. Show the signature optimistically, then rely on eventual consistency for history.

import { useClaimTransaction } from "@fractalshq/sync/v2/react";

const buildTx = useClaimTransaction();

async function handleClaim(item: { distributorId: string }, wallet: string) {
  const payload = await buildTx.mutateAsync({
    distributionId: item.distributorId,
    claimant: wallet,
  });

  // App-owned: build a Transaction from payload.transaction (base64) or payload.instructions.
  const tx = buildTransactionFromPayload(payload);
  const signed = await signTransaction(tx);
  const signature = await connection.sendRawTransaction(signed.serialize());

  // UI-owned: optimistic link + pending state until the next refresh.
  setOptimisticSignature(signature);
}

Notes:

  • Default base path is https://sync.fractals.fun/api/v2 (override via NEXT_PUBLIC_SYNC_V2_PATH).
  • For other environments, set NEXT_PUBLIC_SYNC_V2_PATH to an absolute /api/v2 base URL.
  • V2 requests are credentials: "omit" for public CORS mode.
  • If wallet is omitted, useClaims falls back to the Solana wallet adapter context (@solana/wallet-adapter-react).

See docs/distro-sdk.md and docs/distribution-sdk-auth-facts.md for the full design notes / TODOs.