@capxul/sdk-react 0.2.0-alpha.3 → 0.2.0-alpha.5
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/dist/index.d.mts +259 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +524 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +37 -75
- package/CHANGELOG.md +0 -283
- package/LICENSE +0 -44
- package/README.md +0 -193
- package/dist/index.cjs +0 -1147
- package/dist/index.d.cts +0 -740
- package/dist/index.d.ts +0 -740
- package/dist/index.js +0 -1086
- package/dist/proof/index.cjs +0 -12785
- package/dist/proof/index.d.cts +0 -753
- package/dist/proof/index.d.ts +0 -753
- package/dist/proof/index.js +0 -12758
package/package.json
CHANGED
|
@@ -1,92 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk-react",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"homepage": "https://capxul.com",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/Xelmar-tech/Capxul.git",
|
|
12
|
-
"directory": "packages/sdk-react"
|
|
13
|
-
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/Xelmar-tech/Capxul/issues"
|
|
16
|
-
},
|
|
17
|
-
"author": "Capxul (Xelmar Tech Ltd.)",
|
|
18
|
-
"keywords": [
|
|
19
|
-
"capxul",
|
|
20
|
-
"sdk",
|
|
21
|
-
"react",
|
|
22
|
-
"hooks",
|
|
23
|
-
"stablecoin",
|
|
24
|
-
"payments",
|
|
25
|
-
"typescript"
|
|
3
|
+
"version": "0.2.0-alpha.5",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist",
|
|
6
|
+
"package.json",
|
|
7
|
+
"README.md"
|
|
26
8
|
],
|
|
9
|
+
"type": "module",
|
|
27
10
|
"exports": {
|
|
28
11
|
".": {
|
|
29
|
-
"types": "./dist/index.d.
|
|
30
|
-
"import": "./dist/index.
|
|
31
|
-
"require": "./dist/index.cjs"
|
|
32
|
-
},
|
|
33
|
-
"./proof": {
|
|
34
|
-
"types": "./dist/proof/index.d.ts",
|
|
35
|
-
"import": "./dist/proof/index.js",
|
|
36
|
-
"require": "./dist/proof/index.cjs"
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
37
14
|
}
|
|
38
15
|
},
|
|
39
|
-
"files": [
|
|
40
|
-
"dist",
|
|
41
|
-
"README.md",
|
|
42
|
-
"LICENSE",
|
|
43
|
-
"CHANGELOG.md"
|
|
44
|
-
],
|
|
45
16
|
"publishConfig": {
|
|
46
17
|
"access": "public"
|
|
47
18
|
},
|
|
48
19
|
"dependencies": {
|
|
49
|
-
"@capxul/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"@tanstack/react-query": "^5",
|
|
53
|
-
"@xstate/react": "^5",
|
|
54
|
-
"convex": ">=1.0.0",
|
|
55
|
-
"react": ">=18.2.0 <20",
|
|
56
|
-
"viem": ">=2.0.0"
|
|
20
|
+
"@capxul/config": "0.0.0",
|
|
21
|
+
"@capxul/sdk": "0.2.0-alpha.5",
|
|
22
|
+
"@capxul/types": "0.0.0"
|
|
57
23
|
},
|
|
58
24
|
"devDependencies": {
|
|
59
|
-
"@tanstack/react-query": "^5",
|
|
25
|
+
"@tanstack/react-query": "^5.66.9",
|
|
26
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
60
27
|
"@testing-library/react": "^16.3.2",
|
|
61
|
-
"@
|
|
62
|
-
"@types/
|
|
63
|
-
"@types/react": "19.
|
|
64
|
-
"@
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"vitest": "^4.1.2",
|
|
73
|
-
"@repo/config": "0.0.0",
|
|
74
|
-
"@repo/observability": "0.0.0",
|
|
75
|
-
"@repo/platform-kernel": "0.0.0",
|
|
76
|
-
"@repo/typescript-config": "0.0.0"
|
|
28
|
+
"@types/jsdom": "^28.0.3",
|
|
29
|
+
"@types/react": "^19.2.15",
|
|
30
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
31
|
+
"@vitest/coverage-v8": "4.1.7",
|
|
32
|
+
"ink": "^7.0.3",
|
|
33
|
+
"ink-testing-library": "^4.0.0",
|
|
34
|
+
"jsdom": "^29.1.1",
|
|
35
|
+
"react": "^19.2.6",
|
|
36
|
+
"react-dom": "^19.2.6",
|
|
37
|
+
"react-test-renderer": "^19.2.6",
|
|
38
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23"
|
|
77
39
|
},
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"
|
|
84
|
-
"proof:plan": "tsx ops/proof/plan-cli.ts",
|
|
85
|
-
"proof:react-headless": "vitest run ops/proof/react-headless.test.tsx",
|
|
86
|
-
"test": "vitest run",
|
|
87
|
-
"test:types": "vitest run --typecheck"
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@tanstack/react-query": "^5.66.9",
|
|
42
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22.12.0"
|
|
88
46
|
},
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
47
|
+
"scripts": {
|
|
48
|
+
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
49
|
+
"lint": "oxlint -c ../../.oxlintrc.json . --deny-warnings",
|
|
50
|
+
"build": "vp pack",
|
|
51
|
+
"_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205).",
|
|
52
|
+
"test:e2e": "vp test run --config vitest.e2e.config.ts"
|
|
53
|
+
}
|
|
92
54
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
# @capxul/sdk-react
|
|
2
|
-
|
|
3
|
-
## 0.2.0-alpha.3
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [5b99a9b]
|
|
8
|
-
- @capxul/sdk@0.2.0-alpha.3
|
|
9
|
-
|
|
10
|
-
## 0.2.0-alpha.2
|
|
11
|
-
|
|
12
|
-
### Minor Changes
|
|
13
|
-
|
|
14
|
-
- 995383f: Epic 660: Unified auth surface
|
|
15
|
-
- Introduces AuthService promise-based auth API replacing the imperative capxul.auth.\* tuple interface
|
|
16
|
-
- Adds SignerProvisioner for deterministic Safe v1.4.1 address derivation from viem signers
|
|
17
|
-
- Adds useAuth() React hook with reactive state + promise-based methods
|
|
18
|
-
- Deprecates useAuthFlow and useAuthBootstrapFlow in favor of useAuth()
|
|
19
|
-
- Migrates reference CLI auth commands (send-otp, verify-otp, signout) to useAuth()
|
|
20
|
-
- Migrates test surfaces: walkthroughs, type tests, e2e harness signup, lazy-dx provider
|
|
21
|
-
- Adds @repo/safe-derive workspace package for Safe address derivation utilities
|
|
22
|
-
- Aligns CapxulConfig.data to \_data with internal SDK transport ownership (Epic 652)
|
|
23
|
-
- Pins esbuild to 0.25.12 to fix binary-version skew in fresh worktrees
|
|
24
|
-
|
|
25
|
-
- 2ef4ee3: Reshape the organizations members surface around a single Membership entity
|
|
26
|
-
with a status lifecycle (`pending | active | revoked | expired`).
|
|
27
|
-
- Replaces the prior invitation/membership split (which produced a phantom
|
|
28
|
-
`MemberInvitation` type that never compiled) with a single `Member` type
|
|
29
|
-
exposing `status`, `email`, `acceptedAt`, `expiresAt`, and `resentCount`.
|
|
30
|
-
- New methods on `organizations.members.*`: `accept(token)`, `revoke(memberId)`,
|
|
31
|
-
`resend(memberId)`. `invite()` now returns a `MemberInviteResponse`
|
|
32
|
-
containing the raw invite token (returned once).
|
|
33
|
-
- Auto-accepts pending invitations on first sign-in for the matching email
|
|
34
|
-
via a BetterAuth post-signup hook.
|
|
35
|
-
- Nightly Convex cron expires overdue pending invitations.
|
|
36
|
-
|
|
37
|
-
Public type changes:
|
|
38
|
-
- Removed: `MemberInvitation` (was never exported; type didn't compile).
|
|
39
|
-
- Added: `MembershipStatus`, `MemberInviteResponse`.
|
|
40
|
-
- Updated: `Member` shape — see SDK reference for the full delta.
|
|
41
|
-
|
|
42
|
-
React hooks:
|
|
43
|
-
- New: `useAcceptInvitation`, `useRevokeMember`, `useResendInvitation`.
|
|
44
|
-
- Updated: `useInviteMember` returns `MemberInviteResponse` (was returning a
|
|
45
|
-
type that didn't exist).
|
|
46
|
-
|
|
47
|
-
Reference CLI:
|
|
48
|
-
- New commands: `org members invite`, `org members list`, `org members retrieve`,
|
|
49
|
-
`org members accept`, `org members updateRole`, `org members revoke`,
|
|
50
|
-
`org members remove`, `org members resend`.
|
|
51
|
-
|
|
52
|
-
- c7146bf: **Transport ownership (#656):** The SDK now owns construction of the
|
|
53
|
-
authenticated `ConvexHttpClient`. Consumers no longer wire `data` manually
|
|
54
|
-
or provide `auth.createDataClient`. After `verifyOtp` exchanges a Convex
|
|
55
|
-
JWT, the SDK builds the default data client internally via
|
|
56
|
-
`createDefaultDataClient` and stores it on `config._data`.
|
|
57
|
-
- `CapxulConfig.data` renamed to `_data` (internal test seam).
|
|
58
|
-
- `CapxulAuthConfig.createDataClient` removed from public types.
|
|
59
|
-
- `convex` moved from `peerDependencies` to `dependencies`.
|
|
60
|
-
|
|
61
|
-
### Patch Changes
|
|
62
|
-
|
|
63
|
-
- d252aa7: Widen the published React peer dependency to `>=18.2.0 <20` so React 18 consumers, including the Ink reference proof app, can install the alpha SDK without peer conflicts.
|
|
64
|
-
- Updated dependencies [995383f]
|
|
65
|
-
- Updated dependencies [2ef4ee3]
|
|
66
|
-
- Updated dependencies [c7146bf]
|
|
67
|
-
- @capxul/sdk@0.2.0-alpha.2
|
|
68
|
-
|
|
69
|
-
## 0.2.0-alpha.1
|
|
70
|
-
|
|
71
|
-
### Minor Changes
|
|
72
|
-
|
|
73
|
-
- **Transport ownership (#656):** Remove the `auth.createDataClient`
|
|
74
|
-
callback from `CapxulProvider`. The React provider now passes its
|
|
75
|
-
singleton data client via `CapxulConfig._data` and lets the SDK own
|
|
76
|
-
runtime construction after OTP verification.
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- Updated dependencies
|
|
81
|
-
- @capxul/sdk@0.2.0-alpha.1
|
|
82
|
-
|
|
83
|
-
## 0.1.0-alpha.12
|
|
84
|
-
|
|
85
|
-
### Minor Changes
|
|
86
|
-
|
|
87
|
-
- Publish the post-alpha.11 SDK and React SDK surface: funds v1 sub-account
|
|
88
|
-
runtime coverage, React hook wiring, payments list support, and the latest
|
|
89
|
-
generated Convex API snapshots used by current alpha consumers.
|
|
90
|
-
|
|
91
|
-
Note: alpha.10 and alpha.11 were intermediate runner artifacts from the
|
|
92
|
-
prior release pipeline (manual `package.json` bumps that were never folded
|
|
93
|
-
back into the repo). alpha.12 reconciles `package.json`, the changesets
|
|
94
|
-
state, and npm to a single consistent version.
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- Updated dependencies
|
|
99
|
-
- @capxul/sdk@0.1.0-alpha.12
|
|
100
|
-
|
|
101
|
-
## 0.1.0-alpha.9
|
|
102
|
-
|
|
103
|
-
### Minor Changes
|
|
104
|
-
|
|
105
|
-
- Add the canonical auth bootstrap flow.
|
|
106
|
-
|
|
107
|
-
`verifyOtp()` now resolves a verified email session into either an
|
|
108
|
-
`existing_member` identity or a `bootstrap_required` continuation. New and
|
|
109
|
-
incomplete members continue through `completeBootstrap()`, which validates a
|
|
110
|
-
server-issued bootstrap token, claims the username, provisions the account/Safe
|
|
111
|
-
through the backend bootstrap path, and returns the authenticated product
|
|
112
|
-
identity. The React SDK adds `useAuthBootstrapFlow()` as the typed first-run
|
|
113
|
-
flow wrapper.
|
|
114
|
-
|
|
115
|
-
### Patch Changes
|
|
116
|
-
|
|
117
|
-
- Updated dependencies
|
|
118
|
-
- @capxul/sdk@0.1.0-alpha.9
|
|
119
|
-
|
|
120
|
-
## 0.1.0-alpha.8
|
|
121
|
-
|
|
122
|
-
### Minor Changes
|
|
123
|
-
|
|
124
|
-
- 3af04a9: Public `<CapxulProvider>` now wires authenticated Convex reads end-to-end (#487, closes #484).
|
|
125
|
-
|
|
126
|
-
The `build-time-urls` arm of `BrowserCapxulConfig` now causes the provider to internally instantiate a `ConvexReactClient`, wrap it as a `CapxulDataClient`, and feed it as `config.data` into `createCapxulClient`. The existing `auth.createDataClient` callback is wired to the same singleton so a `verifyOtp` call refreshes the data client's auth header without churning the WebSocket. The provider also wraps `client.auth.signOut` so the data client survives sign-out — post-signout reads return typed backend `NOT_AUTHENTICATED` instead of the SDK's `NOT_IMPLEMENTED` stub (closes the #474 friction as a side-effect).
|
|
127
|
-
|
|
128
|
-
New optional `sessionStore?: AuthSessionStore` prop lets browser apps opt into `localStorage`-backed persistence and Node consumers (CLIs, e2e harnesses) opt into file-backed persistence. Defaults to in-memory.
|
|
129
|
-
|
|
130
|
-
This closes the architectural gap that made the React hook surface (`useMe`, `useAccount`, `useSafe`, ...) impossible to exercise end-to-end through the public provider — previously `config.data` was never populated, so every authenticated read short-circuited to `NOT_IMPLEMENTED`. The Ink reference CLI (`apps/reference-cli/`) is rebuilt on top of the public provider as proof: 17/17 agent-driver assertions pass against live alpha-3 Convex, including a dev-OTP authenticated round-trip that mints a real session via `AUTH_DEV_OTP=00000` and exercises three distinct hook end-states (`NOT_AUTHENTICATED`, `PROFILE_NOT_FOUND`, post-signout `NOT_AUTHENTICATED`).
|
|
131
|
-
|
|
132
|
-
- 57203a4: Withdrawals v1 W2 (#465) — public surface tightening + org-scope create
|
|
133
|
-
- `WithdrawalsCreateInput.destination` no longer accepts `kind`. The
|
|
134
|
-
backend now resolves the `external_account` row by FK and infers
|
|
135
|
-
the kind + rail server-side. Anything that doesn't route to
|
|
136
|
-
`chain_wallet` (or is chain_wallet but non-EVM in slice 1) returns
|
|
137
|
-
`VERIFICATION_REQUIRED` with `details.rail` + `details.currentKind`.
|
|
138
|
-
- `organizations.withdrawals.create` is now a real mutation (no
|
|
139
|
-
longer a `NOT_IMPLEMENTED` stub). Returns the `processing` row
|
|
140
|
-
only — Safe + Zodiac submission orchestration ships in W3+.
|
|
141
|
-
- `Errors.verificationRequired({ rail, currentKind })` factory
|
|
142
|
-
added; the `VERIFICATION_REQUIRED` code now broadens to cover
|
|
143
|
-
both KYC tier gates and unsupported withdrawal rails.
|
|
144
|
-
|
|
145
|
-
**Migration:** Remove `destination.kind` from any
|
|
146
|
-
`capxul.withdrawals.create({ destination: { kind, externalAccountId } })`
|
|
147
|
-
call sites. Pass only `externalAccountId`.
|
|
148
|
-
|
|
149
|
-
### Patch Changes
|
|
150
|
-
|
|
151
|
-
- Updated dependencies [57203a4]
|
|
152
|
-
- @capxul/sdk@0.1.0-alpha.8
|
|
153
|
-
|
|
154
|
-
## 0.1.0-alpha.4
|
|
155
|
-
|
|
156
|
-
### Minor Changes
|
|
157
|
-
|
|
158
|
-
- Post-alpha hardening — WAVE 1 + WAVE 2 cumulative
|
|
159
|
-
|
|
160
|
-
**WAVE 1 (merged 2026-05-03 12:44Z):**
|
|
161
|
-
- S2 story 1: wire onboarding readback hooks (#469) — `me.update`, `accounts.retrieve`, `accounts.update`, `useAccount`, `useSafe`
|
|
162
|
-
- S3 phase 1: Ink reference CLI scaffold + `auth+me` end-to-end against live alpha-3 Convex (#470). Stickiness gate (D3) fired.
|
|
163
|
-
- S5: split `CapxulProvider` into public single-input `BrowserCapxulConfig` + test-only `CapxulTestProvider` from `@capxul/sdk-react/proof` (#473). Q1 lock honored. 7 type-level provider-shape guards including `@ts-expect-error` against test-provider leaking to public barrel.
|
|
164
|
-
|
|
165
|
-
**WAVE 2 (merged 2026-05-03 12:54-13:16Z):**
|
|
166
|
-
- S3 phase 2: per-domain CLI commands closing #458 (#476) — `account retrieve/update`, `safe retrieve`, `payment retrieve`, `withdrawal retrieve/list`. 12/12 agent-driver tests pass.
|
|
167
|
-
- S2 story 2: `capxul.tokenTransfers.*` non-canonical SDK namespace (#479) — Option A per #477 (canon-aligned `transfers.*` shape deferred to alpha.5+ pending backend canon work). New `useTokenTransfers` + `useTokenTransfer` hooks; new `getByTxLogIndex` backend query. Hook proof matrix length unchanged at 41 (non-canonical hooks deliberately excluded).
|
|
168
|
-
|
|
169
|
-
**S1 (#456) closed no-op** — alpha publish infrastructure (tsup, lazy-DX, transport state machine, npm metadata, READMEs, CHANGELOG, changesets, OIDC release workflow) physically merged into `api-first` via PRs #449-#452 earlier the same day; the slice merge produced 0 file changes per clean-room probe.
|
|
170
|
-
|
|
171
|
-
**Friction issues filed for alpha.4+ polish:**
|
|
172
|
-
- #474 — `me.get` returns `NOT_IMPLEMENTED` when `config.data` is undefined; should be `NOT_AUTHENTICATED`.
|
|
173
|
-
- #475 — `@capxul/sdk/headless` slim entry point excludes xstate flow machines + brand constructors (1.6 MB → much smaller).
|
|
174
|
-
- #477 / #478 — `transfers.*` / `balanceLedger.*` / `treasury` canon-shape alignment with indexer feed.
|
|
175
|
-
- #471 — Vercel-capxul-web preview-deploy systemic failure on api-first base (separate from epic).
|
|
176
|
-
|
|
177
|
-
### Patch Changes
|
|
178
|
-
|
|
179
|
-
- Updated dependencies
|
|
180
|
-
- @capxul/sdk@0.1.0-alpha.4
|
|
181
|
-
|
|
182
|
-
## 0.1.0-alpha.3
|
|
183
|
-
|
|
184
|
-
### Patch Changes
|
|
185
|
-
|
|
186
|
-
- Re-export `tryCatch` from `@capxul/sdk`.
|
|
187
|
-
|
|
188
|
-
`tryCatch` is referenced in `packages/sdk/README.md` (live on npm at
|
|
189
|
-
`0.1.0-alpha.2`) and in `.claude/rules/sdk.md` as the canonical
|
|
190
|
-
async-error helper for SDK operations:
|
|
191
|
-
|
|
192
|
-
```ts
|
|
193
|
-
import { tryCatch } from "@capxul/sdk";
|
|
194
|
-
|
|
195
|
-
const [err, payment] = await tryCatch(capxul.payments.create({ ... }));
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
The helper lives at `@repo/observability/try-catch.ts` and is bundled
|
|
199
|
-
into the SDK dist via tsup `noExternal`, but it was never re-exported
|
|
200
|
-
from `packages/sdk/src/index.ts`. Consumers following the README example
|
|
201
|
-
hit `Module '"@capxul/sdk"' has no exported member 'tryCatch'.` at
|
|
202
|
-
import time.
|
|
203
|
-
|
|
204
|
-
Caught during alpha.2 spike-install verification (REVIEW.html, "What's
|
|
205
|
-
not proven" row 6). One-line public-export addition; no runtime change.
|
|
206
|
-
|
|
207
|
-
- Updated dependencies
|
|
208
|
-
- @capxul/sdk@0.1.0-alpha.3
|
|
209
|
-
|
|
210
|
-
## 0.1.0-alpha.2
|
|
211
|
-
|
|
212
|
-
### Patch Changes
|
|
213
|
-
|
|
214
|
-
- Add `convex` as a peer dependency.
|
|
215
|
-
|
|
216
|
-
`@capxul/sdk`'s bundled `_generated/api` snapshot calls
|
|
217
|
-
`anyApi` / `componentsGeneric` from `convex/server` at runtime — they
|
|
218
|
-
are not just types — and tsup correctly externalizes `convex` /
|
|
219
|
-
`convex/server` / `convex/react` so the consumer's own Convex install
|
|
220
|
-
is reused. The peer was missing from the published manifest, so
|
|
221
|
-
`require('@capxul/sdk')` failed with `Cannot find module 'convex/server'`
|
|
222
|
-
in any spike that hadn't already installed `convex`.
|
|
223
|
-
|
|
224
|
-
`@capxul/sdk-react` mirrors the peer because its bundle re-exports
|
|
225
|
-
flow-machine constructors from `@capxul/sdk` and may transitively
|
|
226
|
-
pull in the same module.
|
|
227
|
-
|
|
228
|
-
Caught during alpha.1 spike-install verification.
|
|
229
|
-
|
|
230
|
-
- Updated dependencies
|
|
231
|
-
- @capxul/sdk@0.1.0-alpha.2
|
|
232
|
-
|
|
233
|
-
## 0.1.0-alpha.1
|
|
234
|
-
|
|
235
|
-
### Patch Changes
|
|
236
|
-
|
|
237
|
-
- Move workspace `@repo/*` packages from `dependencies` to
|
|
238
|
-
`devDependencies` so the published `package.json` doesn't list them
|
|
239
|
-
as runtime deps. The tsup pipeline bundles every `@repo/*` import
|
|
240
|
-
inline (`noExternal`), so the published code has zero references to
|
|
241
|
-
those packages — but until now the published `package.json` still
|
|
242
|
-
declared them, and `npm install @capxul/sdk@0.1.0-alpha.0` failed
|
|
243
|
-
trying to resolve `@repo/api-contract@0.0.0` etc. on the public
|
|
244
|
-
registry.
|
|
245
|
-
|
|
246
|
-
`@capxul/sdk-react` keeps `@capxul/sdk` as a runtime dep — that one
|
|
247
|
-
is published.
|
|
248
|
-
|
|
249
|
-
No public surface changes. Pure publish-metadata correction caught
|
|
250
|
-
during alpha.0 spike-install verification.
|
|
251
|
-
|
|
252
|
-
- Updated dependencies
|
|
253
|
-
- @capxul/sdk@0.1.0-alpha.1
|
|
254
|
-
|
|
255
|
-
Changelog managed by [changesets](https://github.com/changesets/changesets) —
|
|
256
|
-
see `.changeset/README.md` for the operator workflow.
|
|
257
|
-
|
|
258
|
-
## 0.1.0-alpha.0
|
|
259
|
-
|
|
260
|
-
### Minor Changes
|
|
261
|
-
|
|
262
|
-
- Initial alpha publish.
|
|
263
|
-
|
|
264
|
-
`@capxul/sdk` ships the headless TypeScript client for Capxul's
|
|
265
|
-
`/v1/*` HTTP contract — auth, me, accounts, payments, organizations,
|
|
266
|
-
withdrawals, documents, and three XState v5 flow machines. Errors
|
|
267
|
-
are typed `CapxulError` instances with narrowed `code` unions per
|
|
268
|
-
method; `tryCatch` returns the canonical `[error, data]` tuple.
|
|
269
|
-
|
|
270
|
-
`@capxul/sdk-react` ships the React provider and hooks. The lazy-DX
|
|
271
|
-
`<CapxulProvider publishableKey="cap_pk_…">` mounts synchronously
|
|
272
|
-
and bootstraps runtime URLs through `/v1/client/bootstrap` on the
|
|
273
|
-
first SDK call. `useCapxulStatus()` exposes the canonical 5-state
|
|
274
|
-
transport lifecycle through `useSyncExternalStore`. Read hooks
|
|
275
|
-
return the canonical `QueryResult<T>` three-state discriminated
|
|
276
|
-
union (loading / data / error) — never throws on "still loading".
|
|
277
|
-
|
|
278
|
-
See each package's `README.md` for the public surface.
|
|
279
|
-
|
|
280
|
-
### Patch Changes
|
|
281
|
-
|
|
282
|
-
- Updated dependencies
|
|
283
|
-
- @capxul/sdk@0.1.0-alpha.0
|
package/LICENSE
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2026 Xelmar Tech Ltd. ("Capxul"). All rights reserved.
|
|
2
|
-
|
|
3
|
-
This software ("@capxul/sdk-react", the "Software") is proprietary to
|
|
4
|
-
Capxul. The Software is licensed, not sold, and is made available
|
|
5
|
-
solely to registered Capxul customers under the Capxul Terms of
|
|
6
|
-
Service or a separate written commercial agreement between Capxul and
|
|
7
|
-
the licensee.
|
|
8
|
-
|
|
9
|
-
Two-layer trust
|
|
10
|
-
---------------
|
|
11
|
-
Capxul's value-bearing on-chain logic — Safe v1.4.1, ERC-4337 modules,
|
|
12
|
-
and any contract that custodies, transfers, or signs over user funds —
|
|
13
|
-
is open source under permissive licenses and is published in a
|
|
14
|
-
separate, auditable repository. See:
|
|
15
|
-
|
|
16
|
-
https://github.com/Xelmar-tech/Capxul
|
|
17
|
-
|
|
18
|
-
The orchestration layer in this package — React provider, hooks,
|
|
19
|
-
state-machine wiring, integration glue, and any code that translates
|
|
20
|
-
customer intent into transactions or routes data between subsystems —
|
|
21
|
-
is the proprietary product of Capxul and is governed by this license.
|
|
22
|
-
|
|
23
|
-
Customers of the Capxul platform may use this Software solely:
|
|
24
|
-
(a) to access Capxul's hosted services they have contracted for,
|
|
25
|
-
(b) within the scope of their active subscription or trial, and
|
|
26
|
-
(c) in accordance with the Capxul Terms of Service.
|
|
27
|
-
|
|
28
|
-
Without limiting the foregoing, you may NOT:
|
|
29
|
-
(i) redistribute, sublicense, sell, lease, or rent the Software,
|
|
30
|
-
(ii) reverse-engineer, decompile, or disassemble the Software,
|
|
31
|
-
except to the limited extent applicable mandatory law
|
|
32
|
-
permits, and
|
|
33
|
-
(iii) remove or alter copyright, trademark, or other proprietary
|
|
34
|
-
notices in the Software.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
37
|
-
OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
|
38
|
-
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT
|
|
39
|
-
SHALL CAPXUL OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES, OR
|
|
40
|
-
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
|
|
41
|
-
ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
42
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
43
|
-
|
|
44
|
-
Contact: legal@capxul.com
|
package/README.md
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
# @capxul/sdk-react
|
|
2
|
-
|
|
3
|
-
React provider + hooks for Capxul. Wraps [`@capxul/sdk`](https://www.npmjs.com/package/@capxul/sdk)
|
|
4
|
-
in a synchronously-mounting provider with lazy bootstrap and a
|
|
5
|
-
discriminated-union return shape on every read hook.
|
|
6
|
-
|
|
7
|
-
> **Alpha — `0.x` is pre-release.** APIs can change between alpha
|
|
8
|
-
> versions. Pin to an exact version and read the changelog before
|
|
9
|
-
> upgrading.
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm add @capxul/sdk @capxul/sdk-react react @tanstack/react-query
|
|
15
|
-
# or: npm install @capxul/sdk @capxul/sdk-react react @tanstack/react-query
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Peer requirements:
|
|
19
|
-
|
|
20
|
-
- React `>= 19.0.0`
|
|
21
|
-
- `@tanstack/react-query` `^5`
|
|
22
|
-
- `@xstate/react` `^5` (only if you use the flow hooks)
|
|
23
|
-
|
|
24
|
-
## Two-layer trust
|
|
25
|
-
|
|
26
|
-
This package is the **orchestration** half of Capxul's two-layer
|
|
27
|
-
architecture. Funds are custodied by audited, open-source Safe v1.4.1
|
|
28
|
-
contracts published in the [Capxul GitHub repo](https://github.com/Xelmar-tech/Capxul/tree/main/packages/contracts).
|
|
29
|
-
The React glue here is proprietary — see [`LICENSE`](./LICENSE).
|
|
30
|
-
|
|
31
|
-
## Quickstart
|
|
32
|
-
|
|
33
|
-
Wrap your app once with `CapxulProvider`. Pass a publishable key
|
|
34
|
-
(`cap_pk_live_…` / `cap_pk_test_…`). The provider mounts synchronously
|
|
35
|
-
— no Suspense gate, no async-mount stall — and lazily bootstraps the
|
|
36
|
-
runtime URLs from `/v1/client/bootstrap` on the first SDK call:
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
import { CapxulProvider } from "@capxul/sdk-react";
|
|
40
|
-
|
|
41
|
-
export default function RootLayout({ children }) {
|
|
42
|
-
return (
|
|
43
|
-
<CapxulProvider
|
|
44
|
-
config={{
|
|
45
|
-
mode: "publishable-key",
|
|
46
|
-
publishableKey: process.env.NEXT_PUBLIC_CAPXUL_PUBLISHABLE_KEY!,
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
{children}
|
|
50
|
-
</CapxulProvider>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Inside the tree, read identity with `useMe()`. The hook collapses the
|
|
56
|
-
multi-step lifecycle (not-bootstrapped, bootstrapping, no-session,
|
|
57
|
-
no-data, live) into three states the consumer cares about:
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
import { useMe } from "@capxul/sdk-react";
|
|
61
|
-
|
|
62
|
-
function Header() {
|
|
63
|
-
const me = useMe();
|
|
64
|
-
|
|
65
|
-
if (me.isPending) return <span>Loading…</span>;
|
|
66
|
-
if (me.isError) return <span>Couldn't load profile.</span>;
|
|
67
|
-
return <span>Hi, {me.data.username}</span>;
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Drive an OTP sign-in flow with `useAuthFlow()` — a
|
|
72
|
-
[`useActor`](https://stately.ai/docs/xstate-react#useactor) observer
|
|
73
|
-
over the canonical XState v5 machine in `@capxul/sdk`:
|
|
74
|
-
|
|
75
|
-
```tsx
|
|
76
|
-
import { useAuthFlow } from "@capxul/sdk-react";
|
|
77
|
-
import { toEmail } from "@capxul/sdk";
|
|
78
|
-
|
|
79
|
-
function SignIn() {
|
|
80
|
-
const { snapshot, send } = useAuthFlow();
|
|
81
|
-
|
|
82
|
-
if (snapshot.matches("idle")) {
|
|
83
|
-
return (
|
|
84
|
-
<button
|
|
85
|
-
onClick={() =>
|
|
86
|
-
send({ type: "REQUEST_OTP", email: toEmail("alice@example.com") })
|
|
87
|
-
}
|
|
88
|
-
>
|
|
89
|
-
Send code
|
|
90
|
-
</button>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
// … handle "sending_otp", "otp_requested", "verifying", "authenticated"
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Lifecycle observability — `useCapxulStatus()`
|
|
98
|
-
|
|
99
|
-
Need a status indicator or a gate UI? Subscribe to the underlying
|
|
100
|
-
transport state machine:
|
|
101
|
-
|
|
102
|
-
```tsx
|
|
103
|
-
import { useCapxulStatus } from "@capxul/sdk-react";
|
|
104
|
-
|
|
105
|
-
function Banner() {
|
|
106
|
-
const status = useCapxulStatus();
|
|
107
|
-
|
|
108
|
-
switch (status.status) {
|
|
109
|
-
case "idle": // no network call yet
|
|
110
|
-
case "bootstrapping": // /v1/client/bootstrap in flight
|
|
111
|
-
return <Spinner />;
|
|
112
|
-
case "ready": // bootstrapped, no session
|
|
113
|
-
case "authenticated": // bootstrapped + session live
|
|
114
|
-
return null;
|
|
115
|
-
case "error":
|
|
116
|
-
return <ErrorBanner error={status.error} />;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
`useCapxulStatus()` is a thin
|
|
122
|
-
[`useSyncExternalStore`](https://react.dev/reference/react/useSyncExternalStore)
|
|
123
|
-
subscription against the transport singleton — only the components
|
|
124
|
-
that actually call it re-render when state changes. The provider
|
|
125
|
-
itself never re-renders.
|
|
126
|
-
|
|
127
|
-
## Publishable-key proof status
|
|
128
|
-
|
|
129
|
-
The publishable-key path is runtime-proven where the repo can run it
|
|
130
|
-
without secrets:
|
|
131
|
-
|
|
132
|
-
| Surface | Runtime proof | Expected safe signal |
|
|
133
|
-
|---|---|---|
|
|
134
|
-
| Provider + `useMe()` | `corepack pnpm --filter @capxul/sdk-react check-types` plus the headless proof tests under `packages/sdk-react/ops/proof` | provider reaches `useCapxulStatus().status === "ready"` after one bootstrap request |
|
|
135
|
-
| Reference CLI mock | `corepack pnpm --filter @capxul/reference-cli build && node apps/reference-cli/dist/cli.js bootstrap probe --mock --json` | `ok:true`, `mode:"publishable-key"`, `bootstrapRequests:1`, `authRequests:1`, `keyLengthClass:"provided"` |
|
|
136
|
-
| Reference CLI live | same command without `--mock`, with `CAPXUL_REF_PUBLISHABLE_KEY` and optional `CAPXUL_REF_BOOTSTRAP_URL` set locally | success only when the key/origin/runtime are valid; otherwise sanitized SDK error JSON |
|
|
137
|
-
|
|
138
|
-
Do not paste or commit publishable keys, session tokens, Convex JWTs,
|
|
139
|
-
cookies, or provider payloads. Proof output reports only
|
|
140
|
-
`keyLengthClass`.
|
|
141
|
-
|
|
142
|
-
## Hooks catalogue
|
|
143
|
-
|
|
144
|
-
| Surface | Hook |
|
|
145
|
-
|---|---|
|
|
146
|
-
| Imperative client | `useCapxul()` |
|
|
147
|
-
| Identity | `useMe`, `useAccount` |
|
|
148
|
-
| Organizations | `useOrganization`, `useOrganizations`, `useMember`, `useMembers` |
|
|
149
|
-
| Payments | `usePayment`, `usePayments`, `useOrgPayments` |
|
|
150
|
-
| Transfers | `useTransfer`, `useTransfers`, `useOrgTransfers` |
|
|
151
|
-
| Withdrawals | `useWithdrawal`, `useWithdrawals`, `useOrgWithdrawals` |
|
|
152
|
-
| Documents | `useDocument`, `useDocuments`, `useOrgDocuments` |
|
|
153
|
-
| Sub-accounts / virtual | `useSubAccount`, `useSubAccounts`, `useVirtualAccount`, `useVirtualAccounts`, `useVirtualCard`, `useVirtualCards` |
|
|
154
|
-
| Settings | `useApiKey`, `useApiKeys`, `useWebhookEndpoint`, `useWebhookEndpoints`, `useWebhookEvent`, `useExternalAccount`, `useExternalAccounts`, `useBalanceLedgerEntry`, `useBalanceLedger` |
|
|
155
|
-
| KYC / KYB | `useKycProfile` |
|
|
156
|
-
| Treasury | `useTreasury`, `useSafe` |
|
|
157
|
-
| Operations | `useOperation` (correlation join key per CANON.md §3.3) |
|
|
158
|
-
| Lifecycle | `useCapxulStatus` |
|
|
159
|
-
| Flows | `useAuthFlow`, `useOnboardingFlow`, `useProvisioningFlow` |
|
|
160
|
-
|
|
161
|
-
Most "not-yet-implemented" verticals return a `QueryResult<T>` in the
|
|
162
|
-
`error` state with `code: "NOT_IMPLEMENTED"` — they compile, render
|
|
163
|
-
without crashing, and surface a clear runtime signal.
|
|
164
|
-
|
|
165
|
-
## Three-state read shape (`QueryResult<T>`)
|
|
166
|
-
|
|
167
|
-
Read hooks return a discriminated union:
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
type QueryResult<T> =
|
|
171
|
-
| { readonly status: "loading" }
|
|
172
|
-
| { readonly status: "data"; readonly data: T }
|
|
173
|
-
| { readonly status: "error"; readonly error: CapxulError };
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Hooks **never throw** for a "still loading" condition. Pattern-match
|
|
177
|
-
on `status`. (`useMe()` is the first hook migrated to TanStack Query
|
|
178
|
-
— it returns `UseQueryResult<Account, CapxulError>` for now; the
|
|
179
|
-
remaining hooks lift to that shape over time.)
|
|
180
|
-
|
|
181
|
-
## Server / CLI consumers
|
|
182
|
-
|
|
183
|
-
`@capxul/sdk-react` is browser-only. For server, CLI, and harness
|
|
184
|
-
code, build a `CapxulClient` directly with `createCapxulClient` from
|
|
185
|
-
`@capxul/sdk` — no provider, no React. See that package's README.
|
|
186
|
-
|
|
187
|
-
## License
|
|
188
|
-
|
|
189
|
-
Proprietary — see [`LICENSE`](./LICENSE). The orchestration code in
|
|
190
|
-
this package is governed by the Capxul Terms of Service. The
|
|
191
|
-
value-bearing custody contracts are open source.
|
|
192
|
-
|
|
193
|
-
Contact: [legal@capxul.com](mailto:legal@capxul.com)
|