@fractalshq/sync 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @fractalshq/sync
2
+
3
+ Fractals Sync is the all-in-one SDK for the distribution platform. It ships as a single package with subpath exports so integrators can pick only what they need:
4
+
5
+ ```
6
+ @fractalshq/sync/core // shared types + helpers (pure TS)
7
+ @fractalshq/sync/server // Node/Next client that talks to /api/v1
8
+ @fractalshq/sync/react // hooks that assume AuthProvider + wallet context
9
+ @fractalshq/sync/widgets // drop-in UI with its own provider stack
10
+ ```
11
+
12
+ ## Layout
13
+
14
+ ```
15
+ packages/sync/
16
+ ├── src/
17
+ │ ├── core/ // typed constants, schemas, memo builders
18
+ │ ├── server/ // moved from @fractalshq/distribution-server
19
+ │ ├── react/ // hooks + helpers (will absorb old distribution-client work)
20
+ │ └── widgets/ // claim panels, buttons, etc.
21
+ └── package.json // exports map for subpaths
22
+ ```
23
+
24
+ See `docs/distro-sdk.md` and `docs/distribution-sdk-auth-facts.md` for the full design notes / TODOs.
@@ -0,0 +1,136 @@
1
+ type DistributionStatus = "draft" | "committed" | "clawed_back" | "hidden";
2
+ interface Distribution {
3
+ id: string;
4
+ orgId: string;
5
+ projectId: string;
6
+ mint: string;
7
+ status: DistributionStatus;
8
+ createdAt: string;
9
+ updatedAt?: string;
10
+ totalUnlocked?: string;
11
+ totalLocked?: string;
12
+ }
13
+ interface ClaimAllocation {
14
+ distributorId: string;
15
+ claimant: string;
16
+ amountUnlocked: string;
17
+ amountLocked?: string;
18
+ proof?: string[];
19
+ idx?: number;
20
+ }
21
+ interface ClaimTransactionInstruction {
22
+ programId: string;
23
+ keys: Array<{
24
+ pubkey: string;
25
+ isSigner: boolean;
26
+ isWritable: boolean;
27
+ }>;
28
+ data: string;
29
+ }
30
+ interface ClaimTransactionRequest {
31
+ distributionId: string;
32
+ claimant: string;
33
+ index?: number;
34
+ proof?: string[];
35
+ unlockedAmount?: number;
36
+ lockedAmount?: number;
37
+ mint?: string;
38
+ distributorPda?: string;
39
+ rpcEndpoint?: string;
40
+ }
41
+ interface ClaimTransactionResponse {
42
+ label: string;
43
+ instructions: ClaimTransactionInstruction[];
44
+ transaction?: string;
45
+ }
46
+ interface ClaimCommitRequest {
47
+ distributionId: string;
48
+ signature: string;
49
+ }
50
+ interface ClaimableDistribution {
51
+ distributorId: string;
52
+ distributorName?: string;
53
+ tokenMint: string;
54
+ tokenSymbol?: string;
55
+ owedAmount: string;
56
+ status: "claimable" | "vesting" | "locked";
57
+ fees?: {
58
+ fixedFee?: string;
59
+ solFee?: string;
60
+ };
61
+ }
62
+
63
+ interface ListDistributionsRequest {
64
+ orgId?: string;
65
+ status?: DistributionStatus;
66
+ mint?: string;
67
+ limit?: number;
68
+ cursor?: string;
69
+ }
70
+ interface ListDistributionsResponse {
71
+ items: Distribution[];
72
+ nextCursor: string | null;
73
+ }
74
+ interface CreateDistributionRequest {
75
+ projectId: string;
76
+ mint: string;
77
+ title?: string;
78
+ version?: number;
79
+ recipients: Array<{
80
+ address: string;
81
+ shareBps: number;
82
+ }>;
83
+ amountUi: number;
84
+ rpcEndpoint?: string;
85
+ }
86
+ interface CreateDistributionResponse {
87
+ distributorId: string;
88
+ status: DistributionStatus;
89
+ }
90
+ interface CommitDistributionRequest {
91
+ fundVaultSignature?: string;
92
+ transaction?: string;
93
+ signature?: string;
94
+ exportJson?: unknown;
95
+ [key: string]: unknown;
96
+ }
97
+ interface CommitDistributionResponse {
98
+ distributorId: string;
99
+ rootHex: string;
100
+ vaultAta: string;
101
+ onchainTxSignature: string;
102
+ committedAt: string;
103
+ }
104
+ type BuildClaimTransactionRequest = ClaimTransactionRequest;
105
+ type BuildClaimTransactionResponse = ClaimTransactionResponse;
106
+ interface CommitClaimRequest {
107
+ distributionId: string;
108
+ signature?: string;
109
+ transaction?: string;
110
+ signedTransactionBase64?: string;
111
+ claimantPubkey?: string;
112
+ [key: string]: unknown;
113
+ }
114
+ interface CommitClaimResponse {
115
+ ok: boolean;
116
+ }
117
+ interface ClaimableResponse {
118
+ wallet: string;
119
+ claimable: ClaimableDistribution[];
120
+ }
121
+ interface ClaimHistoryItem {
122
+ distributorId: string;
123
+ signature: string;
124
+ claimedAmount: string;
125
+ claimedAt: string;
126
+ }
127
+ interface ClaimHistoryResponse {
128
+ items: ClaimHistoryItem[];
129
+ nextCursor: string | null;
130
+ }
131
+ interface HealthResponse {
132
+ status: string;
133
+ timestamp: string;
134
+ }
135
+
136
+ export type { BuildClaimTransactionRequest as B, ClaimAllocation as C, DistributionStatus as D, HealthResponse as H, ListDistributionsRequest as L, Distribution as a, ClaimTransactionInstruction as b, ClaimTransactionRequest as c, ClaimTransactionResponse as d, ClaimCommitRequest as e, ClaimableDistribution as f, ListDistributionsResponse as g, CreateDistributionRequest as h, CreateDistributionResponse as i, CommitDistributionRequest as j, CommitDistributionResponse as k, BuildClaimTransactionResponse as l, CommitClaimRequest as m, CommitClaimResponse as n, ClaimableResponse as o, ClaimHistoryItem as p, ClaimHistoryResponse as q };
@@ -0,0 +1,136 @@
1
+ type DistributionStatus = "draft" | "committed" | "clawed_back" | "hidden";
2
+ interface Distribution {
3
+ id: string;
4
+ orgId: string;
5
+ projectId: string;
6
+ mint: string;
7
+ status: DistributionStatus;
8
+ createdAt: string;
9
+ updatedAt?: string;
10
+ totalUnlocked?: string;
11
+ totalLocked?: string;
12
+ }
13
+ interface ClaimAllocation {
14
+ distributorId: string;
15
+ claimant: string;
16
+ amountUnlocked: string;
17
+ amountLocked?: string;
18
+ proof?: string[];
19
+ idx?: number;
20
+ }
21
+ interface ClaimTransactionInstruction {
22
+ programId: string;
23
+ keys: Array<{
24
+ pubkey: string;
25
+ isSigner: boolean;
26
+ isWritable: boolean;
27
+ }>;
28
+ data: string;
29
+ }
30
+ interface ClaimTransactionRequest {
31
+ distributionId: string;
32
+ claimant: string;
33
+ index?: number;
34
+ proof?: string[];
35
+ unlockedAmount?: number;
36
+ lockedAmount?: number;
37
+ mint?: string;
38
+ distributorPda?: string;
39
+ rpcEndpoint?: string;
40
+ }
41
+ interface ClaimTransactionResponse {
42
+ label: string;
43
+ instructions: ClaimTransactionInstruction[];
44
+ transaction?: string;
45
+ }
46
+ interface ClaimCommitRequest {
47
+ distributionId: string;
48
+ signature: string;
49
+ }
50
+ interface ClaimableDistribution {
51
+ distributorId: string;
52
+ distributorName?: string;
53
+ tokenMint: string;
54
+ tokenSymbol?: string;
55
+ owedAmount: string;
56
+ status: "claimable" | "vesting" | "locked";
57
+ fees?: {
58
+ fixedFee?: string;
59
+ solFee?: string;
60
+ };
61
+ }
62
+
63
+ interface ListDistributionsRequest {
64
+ orgId?: string;
65
+ status?: DistributionStatus;
66
+ mint?: string;
67
+ limit?: number;
68
+ cursor?: string;
69
+ }
70
+ interface ListDistributionsResponse {
71
+ items: Distribution[];
72
+ nextCursor: string | null;
73
+ }
74
+ interface CreateDistributionRequest {
75
+ projectId: string;
76
+ mint: string;
77
+ title?: string;
78
+ version?: number;
79
+ recipients: Array<{
80
+ address: string;
81
+ shareBps: number;
82
+ }>;
83
+ amountUi: number;
84
+ rpcEndpoint?: string;
85
+ }
86
+ interface CreateDistributionResponse {
87
+ distributorId: string;
88
+ status: DistributionStatus;
89
+ }
90
+ interface CommitDistributionRequest {
91
+ fundVaultSignature?: string;
92
+ transaction?: string;
93
+ signature?: string;
94
+ exportJson?: unknown;
95
+ [key: string]: unknown;
96
+ }
97
+ interface CommitDistributionResponse {
98
+ distributorId: string;
99
+ rootHex: string;
100
+ vaultAta: string;
101
+ onchainTxSignature: string;
102
+ committedAt: string;
103
+ }
104
+ type BuildClaimTransactionRequest = ClaimTransactionRequest;
105
+ type BuildClaimTransactionResponse = ClaimTransactionResponse;
106
+ interface CommitClaimRequest {
107
+ distributionId: string;
108
+ signature?: string;
109
+ transaction?: string;
110
+ signedTransactionBase64?: string;
111
+ claimantPubkey?: string;
112
+ [key: string]: unknown;
113
+ }
114
+ interface CommitClaimResponse {
115
+ ok: boolean;
116
+ }
117
+ interface ClaimableResponse {
118
+ wallet: string;
119
+ claimable: ClaimableDistribution[];
120
+ }
121
+ interface ClaimHistoryItem {
122
+ distributorId: string;
123
+ signature: string;
124
+ claimedAmount: string;
125
+ claimedAt: string;
126
+ }
127
+ interface ClaimHistoryResponse {
128
+ items: ClaimHistoryItem[];
129
+ nextCursor: string | null;
130
+ }
131
+ interface HealthResponse {
132
+ status: string;
133
+ timestamp: string;
134
+ }
135
+
136
+ export type { BuildClaimTransactionRequest as B, ClaimAllocation as C, DistributionStatus as D, HealthResponse as H, ListDistributionsRequest as L, Distribution as a, ClaimTransactionInstruction as b, ClaimTransactionRequest as c, ClaimTransactionResponse as d, ClaimCommitRequest as e, ClaimableDistribution as f, ListDistributionsResponse as g, CreateDistributionRequest as h, CreateDistributionResponse as i, CommitDistributionRequest as j, CommitDistributionResponse as k, BuildClaimTransactionResponse as l, CommitClaimRequest as m, CommitClaimResponse as n, ClaimableResponse as o, ClaimHistoryItem as p, ClaimHistoryResponse as q };
@@ -0,0 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ export {
22
+ __spreadValues,
23
+ __spreadProps
24
+ };