@fractalshq/sync 0.0.11 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +37 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,6 +7,9 @@ Fractals Sync is the all-in-one SDK for the distribution platform. It ships as a
7
7
  @fractalshq/sync/server // Node/Next client that talks to /api/v1
8
8
  @fractalshq/sync/react // hooks that assume AuthProvider + wallet context
9
9
  @fractalshq/sync/widgets // drop-in UI with its own provider stack
10
+ @fractalshq/sync/v2 // public v2 surface (claims + tx build only)
11
+ @fractalshq/sync/v2/core // v2 core helpers (build tx + list claims)
12
+ @fractalshq/sync/v2/react // v2 React hooks (useClaims, useClaimTransaction)
10
13
  ```
11
14
 
12
15
  ## Layout
@@ -18,7 +21,41 @@ packages/sync/
18
21
  │ ├── server/ // moved from @fractalshq/distribution-server
19
22
  │ ├── react/ // hooks + helpers (will absorb old distribution-client work)
20
23
  │ └── widgets/ // claim panels, buttons, etc.
24
+ │ └── v2/ // public v2 API surface (claims + tx build)
21
25
  └── package.json // exports map for subpaths
22
26
  ```
23
27
 
28
+ ## V2 (public claims surface)
29
+
30
+ V2 is intentionally tiny and public-facing. It only exposes:
31
+
32
+ - `GET /api/v2/claims?wallet=<pubkey>` (claimable + claimed)
33
+ - `POST /api/v2/claims/[id]/create-transaction` (build claim tx)
34
+
35
+ ### Core usage
36
+
37
+ ```ts
38
+ import { listClaims, buildClaimTransaction } from "@fractalshq/sync/v2/core";
39
+
40
+ const claims = await listClaims(wallet);
41
+ const tx = await buildClaimTransaction({
42
+ distributionId,
43
+ claimant: wallet,
44
+ });
45
+ ```
46
+
47
+ ### React usage
48
+
49
+ ```tsx
50
+ import { useClaims, useClaimTransaction } from "@fractalshq/sync/v2/react";
51
+
52
+ const claimsQuery = useClaims(wallet);
53
+ const buildTx = useClaimTransaction();
54
+ buildTx.mutateAsync({ distributionId, claimant: wallet });
55
+ ```
56
+
57
+ Notes:
58
+ - Default base path is `/api/v2` (override via `NEXT_PUBLIC_SYNC_V2_PATH`).
59
+ - V2 requests are `credentials: "omit"` for public CORS mode.
60
+
24
61
  See `docs/distro-sdk.md` and `docs/distribution-sdk-auth-facts.md` for the full design notes / TODOs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fractalshq/sync",
3
- "version": "0.0.11",
3
+ "version": "0.1.0",
4
4
  "description": "Fractals Sync SDK: shared types, server client, React hooks, and widgets",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",