@capxul/sdk 0.2.0-alpha.4 → 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.
Files changed (45) hide show
  1. package/README.md +4 -308
  2. package/dist/InMemoryAuthCacheAdapter-BK-B_ERB.mjs +113 -0
  3. package/dist/InMemoryAuthCacheAdapter-BK-B_ERB.mjs.map +1 -0
  4. package/dist/index.d.mts +1263 -0
  5. package/dist/index.d.mts.map +1 -0
  6. package/dist/index.mjs +4740 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/node/index.d.mts +55 -0
  9. package/dist/node/index.d.mts.map +1 -0
  10. package/dist/node/index.mjs +159 -0
  11. package/dist/node/index.mjs.map +1 -0
  12. package/dist/ports/safe-deployment.d.mts +2 -0
  13. package/dist/ports/safe-deployment.mjs +38 -0
  14. package/dist/ports/safe-deployment.mjs.map +1 -0
  15. package/dist/safe-deployment-Vni46k3t.d.mts +137 -0
  16. package/dist/safe-deployment-Vni46k3t.d.mts.map +1 -0
  17. package/dist/signer-oaYGfjDe.d.mts +142 -0
  18. package/dist/signer-oaYGfjDe.d.mts.map +1 -0
  19. package/package.json +37 -70
  20. package/CHANGELOG.md +0 -274
  21. package/LICENSE +0 -44
  22. package/dist/client-CbUeJoM9.d.ts +0 -1335
  23. package/dist/client-UEm2oZbZ.d.cts +0 -1335
  24. package/dist/client.cjs +0 -4042
  25. package/dist/client.d.cts +0 -6
  26. package/dist/client.d.ts +0 -6
  27. package/dist/client.js +0 -4040
  28. package/dist/errors-CwhCWGxm.d.ts +0 -70
  29. package/dist/errors-rqxuUhQP.d.cts +0 -70
  30. package/dist/errors.cjs +0 -35
  31. package/dist/errors.d.cts +0 -2
  32. package/dist/errors.d.ts +0 -2
  33. package/dist/errors.js +0 -31
  34. package/dist/index.cjs +0 -4273
  35. package/dist/index.d.cts +0 -461
  36. package/dist/index.d.ts +0 -461
  37. package/dist/index.js +0 -4234
  38. package/dist/next-action-CTGl8wpy.d.cts +0 -177
  39. package/dist/next-action-CTGl8wpy.d.ts +0 -177
  40. package/dist/types-BD4VAQb5.d.ts +0 -1205
  41. package/dist/types-HlwCIjgQ.d.cts +0 -1205
  42. package/dist/webhooks.cjs +0 -118
  43. package/dist/webhooks.d.cts +0 -33
  44. package/dist/webhooks.d.ts +0 -33
  45. package/dist/webhooks.js +0 -116
package/dist/index.d.ts DELETED
@@ -1,461 +0,0 @@
1
- import { A as AccountProvisionPersonalInput, C as CapxulClient } from './client-CbUeJoM9.js';
2
- export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthBootstrapReason, e as AuthBootstrapToken, f as AuthService, g as AuthSessionStore, B as BrowserCapxulConfig, h as CapxulAuthConfig, i as CapxulConfig, j as CapxulDataClient, k as CapxulFlowFactories, l as CapxulSigningConfig, m as CompleteBootstrapInput, n as CompleteBootstrapResult, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, o as OrgDocumentsClient, p as OrgMembersClient, q as OrgPaymentsClient, r as OrgSafesClient, s as OrgTransfersClient, t as OrgTreasuryClient, u as OrgWithdrawalsClient, v as OrganizationsClient, P as PaymentsClient, S as Session, w as SubAccountsClient, T as TokenTransfer, x as TokenTransferId, y as TokenTransfersClient, z as TokenTransfersListInput, F as TokenTransfersListPage, G as TokenTransfersRetrieveInput, I as TransfersClient, J as TransportRuntime, K as TransportState, V as VerifyOtpResult, N as VirtualAccountsClient, Q as VirtualCardsClient, W as WebhookEndpointCreateResult, R as WebhookEndpointsClient, U as WebhookEventsClient, X as WithdrawalsClient, Y as createCapxulClient, Z as makeHttpTransport, _ as toTokenTransferId } from './client-CbUeJoM9.js';
3
- import * as xstate from 'xstate';
4
- import { C as CapxulError$1, a as CapxulErrorCode$1 } from './errors-CwhCWGxm.js';
5
- export { b as CapxulErrorDetails, c as CapxulErrorEnvelope, d as CapxulResult } from './errors-CwhCWGxm.js';
6
- import { A as Account } from './types-BD4VAQb5.js';
7
- export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as IdentityProfileBase, i as InvoiceDocument, K as KybProfile, j as KybStatus, k as KycProfile, l as KycStatus, m as KycUploadDocument, L as List, M as Member, n as MemberInviteResponse, o as MembershipStatus, p as Money, O as Operation, q as OperationStatus, r as OperationSummary, s as Organization, P as PageInfo, t as Payment, u as PaymentParty, v as PaymentStatus, w as PayrollRunDocument, x as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, y as Scope, z as Settlement, F as SubAccount, G as SubAccountOwnerKind, T as TaxFormDocument, H as TimestampIso, J as Transfer, N as TransferCustody, Q as TransferEndpoint, U as TransferFx, V as TransferStatus, W as Treasury, X as UserIdentifier, Y as VirtualAccount, Z as VirtualAccountOwnerKind, _ as VirtualCard, $ as VirtualCardLimits, a0 as VirtualCardOwnerKind, a1 as WebhookEndpoint, a2 as WebhookEvent, a3 as Withdrawal, a4 as WithdrawalStatus } from './types-BD4VAQb5.js';
8
- import { U as Username, O as OperationId, N as NextAction } from './next-action-CTGl8wpy.js';
9
- export { A as AccountId, a as ApiKeyId, B as BalanceLedgerEntryId, C as CorrelationId, D as DocumentId, E as Email, b as ExternalAccountId, K as KybProfileId, c as KycProfileId, M as MemberId, d as OrganizationId, P as PaymentId, e as PhoneNumber, S as SafeId, f as SubAccountId, T as TransactionIntentId, g as TransferId, h as TreasuryId, V as VirtualAccountId, i as VirtualCardId, W as WebhookEndpointId, j as WebhookEventId, k as WithdrawalId, t as toAccountId, l as toApiKeyId, m as toBalanceLedgerEntryId, n as toDocumentId, o as toEmail, p as toExternalAccountId, q as toKybProfileId, r as toKycProfileId, s as toMemberId, u as toOperationId, v as toOrganizationId, w as toPaymentId, x as toPhoneNumber, y as toSafeId, z as toSubAccountId, F as toTransferId, G as toTreasuryId, H as toUsername, I as toVirtualAccountId, J as toVirtualCardId, L as toWebhookEndpointId, Q as toWebhookEventId, R as toWithdrawalId } from './next-action-CTGl8wpy.js';
10
- import { Account as Account$1 } from 'viem';
11
- export { WebhookVerificationOptions, WebhookVerificationResult, verifyWebhook } from './webhooks.js';
12
-
13
- /**
14
- * Unified error type used across the entire stack: backend, SDK, and frontend.
15
- * One class, one set of codes, one language.
16
- *
17
- * Backend throws CapxulError → withErrorBoundary serializes to ConvexError →
18
- * SDK deserializes back to CapxulError → frontend routes on err.code.
19
- */
20
- type CapxulErrorCode = "NOT_AUTHENTICATED" | "EMAIL_DELIVERY_FAILED" | "API_KEY_INVALID" | "API_KEY_EXPIRED" | "PROFILE_NOT_FOUND" | "SMART_ACCOUNT_MISSING" | "PLAYER_NOT_FOUND" | "ACCOUNT_NOT_FOUND" | "PROVIDER_ERROR" | "INVALID_INPUT" | "ENV_MISSING" | "NOT_IMPLEMENTED" | "VERIFICATION_REQUIRED" | "INSUFFICIENT_BALANCE" | "INVALID_RECIPIENT" | "TRANSACTION_FAILED" | "RATE_LIMITED" | "NETWORK_ERROR" | "PERMISSION_DENIED" | "IDEMPOTENCY_CONFLICT" | "NOT_FOUND" | "OPERATION_CANCELED" | "OPERATION_TIMEOUT" | "ACTION_REQUIRED" | "KYC_REQUIRED" | "POLICY_DENIED" | "SAFE_NOT_READY" | "PROVIDER_UNAVAILABLE" | "PROVIDER_REJECTED" | "RECONCILIATION_FAILED" | "INTERNAL_ERROR" | "QUOTE_EXPIRED" | "QUOTE_NOT_FOUND" | "INDEXER_DELIVERY_TIMEOUT" | "UNKNOWN";
21
- declare class CapxulError extends Error {
22
- readonly code: CapxulErrorCode;
23
- readonly details?: Record<string, unknown>;
24
- readonly correlationId?: string;
25
- readonly layer?: string;
26
- constructor(code: CapxulErrorCode, message: string, options?: {
27
- cause?: unknown;
28
- details?: Record<string, unknown>;
29
- correlationId?: string;
30
- layer?: string;
31
- });
32
- }
33
-
34
- /**
35
- * Provisioning flow errors may originate from two CapxulError surfaces:
36
- * - the SDK-local generic `CapxulError<Codes>` returned by
37
- * `client.accounts.provisionPersonal`
38
- * - the `@repo/config` `CapxulError` produced by the `Errors.xxx()`
39
- * factory family (per `error-handling.md`) used for non-CapxulError
40
- * cause wrapping and the timeout error
41
- *
42
- * Both share `.code`, `.message`, `.details`, and extend `Error`.
43
- */
44
- type ProvisioningFlowError = CapxulError$1 | CapxulError;
45
- type ProvisioningFlowContext = {
46
- readonly input: AccountProvisionPersonalInput | null;
47
- readonly account: Account | null;
48
- readonly error: ProvisioningFlowError | null;
49
- };
50
- type ProvisioningFlowEvent = {
51
- readonly type: "START";
52
- readonly input: AccountProvisionPersonalInput;
53
- };
54
- /**
55
- * Input accepted at machine startup. Optional — when present the
56
- * machine seeds context from it and skips `idle`. When absent the
57
- * machine sits in `idle` and waits for a `START` event.
58
- *
59
- * The `| undefined` half of this union is what lets standalone
60
- * callers write `createActor(machine, { input: undefined })` (or pass
61
- * no input via `{}`), because XState v5's `RequiredActorOptionsKeys`
62
- * computes `undefined extends InputFrom<TLogic> ? never : 'input'`
63
- * and standalone callers need that to resolve to `never`. Invoked-by-
64
- * parent callsites pass the populated `{ input }` shape via
65
- * `invoke.input` and the `context` factory below narrows it.
66
- */
67
- type ProvisioningFlowInput = {
68
- readonly input: AccountProvisionPersonalInput;
69
- } | undefined;
70
- /**
71
- * Output emitted when the machine reaches a top-level final state
72
- * (`done` or `error`). Parents that invoke this machine (e.g.
73
- * onboarding) read this via `event.output` on their `onDone`
74
- * transition and branch with a guard on `event.output.error`.
75
- */
76
- type ProvisioningFlowOutput = {
77
- readonly account: Account;
78
- readonly error?: undefined;
79
- } | {
80
- readonly account?: undefined;
81
- readonly error: ProvisioningFlowError;
82
- };
83
- /**
84
- * Build the provisioning state machine bound to a `CapxulClient`
85
- * instance.
86
- *
87
- * States: `starting -> idle | running -> done | error`. `starting` is
88
- * a transient routing state: if the machine was created with input,
89
- * it goes straight to `running`; otherwise it falls back to `idle`
90
- * and waits for a `START` event. Both `done` and `error` are
91
- * top-level XState v5 `final` states; the machine's root-level
92
- * `output` mapper inspects `context` to produce
93
- * `{ account } | { error }` for the parent's `onDone` event.
94
- *
95
- * Per-state-node `output` is not supported in XState v5 — only the
96
- * machine root has an `output` mapper, which is why this file derives
97
- * the discriminated payload from `context.error` vs `context.account`.
98
- */
99
- declare function createProvisioningMachine(client: CapxulClient): xstate.StateMachine<ProvisioningFlowContext, {
100
- readonly type: "START";
101
- readonly input: AccountProvisionPersonalInput;
102
- }, {
103
- [x: string]: xstate.ActorRefFromLogic<xstate.PromiseActorLogic<Account, {
104
- input: AccountProvisionPersonalInput;
105
- }, xstate.EventObject>> | undefined;
106
- }, {
107
- src: "provisionPersonal";
108
- logic: xstate.PromiseActorLogic<Account, {
109
- input: AccountProvisionPersonalInput;
110
- }, xstate.EventObject>;
111
- id: string | undefined;
112
- }, {
113
- type: "trackWalletCreated";
114
- params: unknown;
115
- } | {
116
- type: "trackSafeCreated";
117
- params: unknown;
118
- }, {
119
- type: "hasInput";
120
- params: unknown;
121
- }, never, "done" | "error" | "idle" | "starting" | "running", string, {
122
- readonly input: AccountProvisionPersonalInput;
123
- }, {
124
- readonly account: Account;
125
- readonly error?: undefined;
126
- } | {
127
- readonly account?: undefined;
128
- readonly error: ProvisioningFlowError;
129
- }, xstate.EventObject, xstate.MetaObject, {
130
- id: "provisioning";
131
- states: {
132
- readonly starting: {};
133
- readonly idle: {};
134
- readonly running: {};
135
- readonly done: {};
136
- readonly error: {};
137
- };
138
- }>;
139
-
140
- /**
141
- * Onboarding flow errors may originate from two CapxulError surfaces:
142
- * - the SDK-local generic `CapxulError<Codes>` returned by
143
- * `client.accounts.provisionPersonal` and constructed for synchronous
144
- * pre-actor rejections (NOT_IMPLEMENTED, INVALID_INPUT)
145
- * - the `@repo/config` `CapxulError` produced by the `Errors.xxx()`
146
- * factory family (per `error-handling.md`) used for non-CapxulError
147
- * cause wrapping and the timeout error
148
- *
149
- * Both share `.code`, `.message`, `.details`, and extend `Error`.
150
- */
151
- type OnboardingFlowError = CapxulError$1 | CapxulError;
152
- /** Subjects supported by the onboarding flow. */
153
- type OnboardingSubjectKind = "account" | "organization";
154
- /**
155
- * Input captured by the "profile" step before Safe provisioning.
156
- *
157
- * For `kind: "organization"`, `organizationName` is required (this lift
158
- * does not implement the org branch — see `error.code = "NOT_IMPLEMENTED"`).
159
- */
160
- type OnboardingProfileInput = {
161
- readonly kind: OnboardingSubjectKind;
162
- readonly username?: Username;
163
- readonly displayName?: string;
164
- readonly country?: string;
165
- readonly organizationName?: string;
166
- readonly signerProvider?: AccountProvisionPersonalInput["signerProvider"];
167
- };
168
- type OnboardingFlowContext = {
169
- readonly input: OnboardingProfileInput | null;
170
- readonly operationId: OperationId | null;
171
- readonly account: Account | null;
172
- readonly error: OnboardingFlowError | null;
173
- };
174
- type OnboardingFlowEvent = {
175
- readonly type: "START_PROVISIONING";
176
- readonly input: OnboardingProfileInput;
177
- } | {
178
- readonly type: "PROCEED";
179
- } | {
180
- readonly type: "RESET";
181
- };
182
- /**
183
- * Build the onboarding state machine bound to a `CapxulClient`
184
- * instance.
185
- *
186
- * States: `profile -> provisioning -> complete` on the happy path,
187
- * with `error` reachable from `profile` (validation rejections) or
188
- * `provisioning` (spawned-machine reported error / outer timeout /
189
- * unhandled child throw). `action_required` is declared for parity
190
- * with the public `OnboardingFlowState` type but is unreachable in
191
- * this lift.
192
- *
193
- * The `provisioning` state invokes a spawned `provisioningMachine`
194
- * (built from `createProvisioningMachine(client)`) rather than the
195
- * `provisionPersonal` actor directly. The child machine reports its
196
- * outcome via its root-level `output` (`{ account } | { error }`),
197
- * which the parent observes on `onDone` and branches on via guards.
198
- */
199
- declare function createOnboardingFlowMachine(client: CapxulClient): xstate.StateMachine<OnboardingFlowContext, {
200
- readonly type: "START_PROVISIONING";
201
- readonly input: OnboardingProfileInput;
202
- } | {
203
- readonly type: "PROCEED";
204
- } | {
205
- readonly type: "RESET";
206
- }, {
207
- [x: string]: xstate.ActorRefFromLogic<xstate.StateMachine<ProvisioningFlowContext, {
208
- readonly type: "START";
209
- readonly input: AccountProvisionPersonalInput;
210
- }, {
211
- [x: string]: xstate.ActorRefFromLogic<xstate.PromiseActorLogic<Account, {
212
- input: AccountProvisionPersonalInput;
213
- }, xstate.EventObject>> | undefined;
214
- }, {
215
- src: "provisionPersonal";
216
- logic: xstate.PromiseActorLogic<Account, {
217
- input: AccountProvisionPersonalInput;
218
- }, xstate.EventObject>;
219
- id: string | undefined;
220
- }, {
221
- type: "trackWalletCreated";
222
- params: unknown;
223
- } | {
224
- type: "trackSafeCreated";
225
- params: unknown;
226
- }, {
227
- type: "hasInput";
228
- params: unknown;
229
- }, never, "done" | "error" | "idle" | "starting" | "running", string, {
230
- readonly input: AccountProvisionPersonalInput;
231
- }, {
232
- readonly account: Account;
233
- readonly error?: undefined;
234
- } | {
235
- readonly account?: undefined;
236
- readonly error: ProvisioningFlowError;
237
- }, xstate.EventObject, xstate.MetaObject, {
238
- id: "provisioning";
239
- states: {
240
- readonly starting: {};
241
- readonly idle: {};
242
- readonly running: {};
243
- readonly done: {};
244
- readonly error: {};
245
- };
246
- }>> | undefined;
247
- }, {
248
- src: "provisioningMachine";
249
- logic: xstate.StateMachine<ProvisioningFlowContext, {
250
- readonly type: "START";
251
- readonly input: AccountProvisionPersonalInput;
252
- }, {
253
- [x: string]: xstate.ActorRefFromLogic<xstate.PromiseActorLogic<Account, {
254
- input: AccountProvisionPersonalInput;
255
- }, xstate.EventObject>> | undefined;
256
- }, {
257
- src: "provisionPersonal";
258
- logic: xstate.PromiseActorLogic<Account, {
259
- input: AccountProvisionPersonalInput;
260
- }, xstate.EventObject>;
261
- id: string | undefined;
262
- }, {
263
- type: "trackWalletCreated";
264
- params: unknown;
265
- } | {
266
- type: "trackSafeCreated";
267
- params: unknown;
268
- }, {
269
- type: "hasInput";
270
- params: unknown;
271
- }, never, "done" | "error" | "idle" | "starting" | "running", string, {
272
- readonly input: AccountProvisionPersonalInput;
273
- }, {
274
- readonly account: Account;
275
- readonly error?: undefined;
276
- } | {
277
- readonly account?: undefined;
278
- readonly error: ProvisioningFlowError;
279
- }, xstate.EventObject, xstate.MetaObject, {
280
- id: "provisioning";
281
- states: {
282
- readonly starting: {};
283
- readonly idle: {};
284
- readonly running: {};
285
- readonly done: {};
286
- readonly error: {};
287
- };
288
- }>;
289
- id: string | undefined;
290
- }, {
291
- type: "assignOperationIdAndInput";
292
- params: unknown;
293
- } | {
294
- type: "assignOrgNotImplemented";
295
- params: unknown;
296
- } | {
297
- type: "assignMissingSigner";
298
- params: unknown;
299
- } | {
300
- type: "trackOrgSubmitted";
301
- params: unknown;
302
- } | {
303
- type: "trackPersonalSubmitted";
304
- params: unknown;
305
- } | {
306
- type: "trackOrgNotImplementedError";
307
- params: unknown;
308
- } | {
309
- type: "trackMissingSignerError";
310
- params: unknown;
311
- } | {
312
- type: "trackWalletCreating";
313
- params: unknown;
314
- } | {
315
- type: "trackOnboardingCompleted";
316
- params: unknown;
317
- } | {
318
- type: "trackProvisioningFailed";
319
- params: unknown;
320
- } | {
321
- type: "assignChildReportedError";
322
- params: unknown;
323
- } | {
324
- type: "assignChildThrown";
325
- params: unknown;
326
- } | {
327
- type: "assignAccountFromChild";
328
- params: unknown;
329
- } | {
330
- type: "resetContext";
331
- params: unknown;
332
- }, {
333
- type: "isOrg";
334
- params: unknown;
335
- } | {
336
- type: "missingSigner";
337
- params: unknown;
338
- } | {
339
- type: "childReportedError";
340
- params: unknown;
341
- }, never, "action_required" | "provisioning" | "error" | "profile" | "complete", string, xstate.NonReducibleUnknown, xstate.NonReducibleUnknown, xstate.EventObject, xstate.MetaObject, {
342
- id: "onboarding";
343
- states: {
344
- readonly profile: {};
345
- readonly provisioning: {};
346
- readonly action_required: {};
347
- readonly complete: {};
348
- readonly error: {};
349
- };
350
- }>;
351
-
352
- /**
353
- * Exhaustive error-code dispatch per CANON.md §4.44.
354
- *
355
- * Given a `CapxulError<Codes>` and a handlers object keyed by `Codes`,
356
- * routes to the matching arm. TypeScript enforces exhaustiveness via
357
- * the mapped-key union: missing a code the method can produce is a
358
- * compile error, and handling a code the method CANNOT produce is a
359
- * compile error (the handler key isn't assignable to `Codes`).
360
- *
361
- * No `default:` arm needed — the compile-time exhaustiveness check is
362
- * the contract.
363
- */
364
- declare function matchError<Codes extends CapxulErrorCode$1, R>(err: CapxulError$1<Codes>, handlers: {
365
- [K in Codes]: (err: CapxulError$1<K>) => R;
366
- }): R;
367
- /**
368
- * Exhaustive resource-status dispatch per CANON.md §4.44.
369
- *
370
- * The generic `T extends { status: string }` lets downstream callers
371
- * pass any discriminated-union resource (Payment, Safe, Transfer,
372
- * Operation, etc.). Handlers are keyed on the literal `status` values
373
- * declared by `T`, so passing a status not in `T["status"]` is a
374
- * compile error.
375
- */
376
- declare function matchStatus<T extends {
377
- status: string;
378
- }, R>(value: T, handlers: {
379
- [K in T["status"]]: (value: Extract<T, {
380
- status: K;
381
- }>) => R;
382
- }): R;
383
- /**
384
- * Exhaustive NextAction.kind dispatch per CANON.md §4.44.
385
- *
386
- * Handlers must cover every `kind` in the union `A`. `A` defaults to
387
- * `NextAction` from `@repo/platform-kernel` — the 8-variant canonical
388
- * union. CANON.md §4.58 adds a 9th variant (`confirm_fx_quote`); once
389
- * the kernel's `NextAction` grows, this helper automatically picks it
390
- * up via the generic default.
391
- *
392
- * Pass `A extends NextAction` explicitly when you need a narrower
393
- * variant subset (e.g. a per-method narrowing that excludes
394
- * `contact_support`).
395
- */
396
- declare function matchAction<A extends NextAction, R>(action: A, handlers: {
397
- [K in A["kind"]]: (action: Extract<A, {
398
- kind: K;
399
- }>) => R;
400
- }): R;
401
-
402
- /**
403
- * Go-style error handling for async calls.
404
- * Returns [error, null] on failure, [null, value] on success.
405
- * Pure utility — no side effects, no reporter.
406
- */
407
- declare function tryCatch<T>(promise: Promise<T>): Promise<[Error, null] | [null, T]>;
408
-
409
- /**
410
- * Convenience constructor for a viem `Account` backed by a raw private
411
- * key — the CLI / server-side signer per CANON.md §4.28.
412
- *
413
- * The SDK accepts `viem.Account` directly; this helper just saves the
414
- * caller an import. For Openfort / MetaMask / other browser signers,
415
- * use `@capxul/sdk-react` (follow-up slice).
416
- *
417
- * @param privateKey `0x`-prefixed 32-byte hex string (64 hex chars).
418
- */
419
- declare function createLocalSigner(privateKey: `0x${string}`): Account$1;
420
-
421
- type SignerProvisionResult = {
422
- readonly signer: Account$1;
423
- readonly safeAddress: `0x${string}`;
424
- };
425
- /**
426
- * Headless signer auto-provisioner.
427
- *
428
- * Generates a fresh viem private-key account and deterministically derives
429
- * the corresponding Safe v1.4.1 address.
430
- *
431
- * No consumer computes `safeAddress` — it is derived internally and
432
- * returned alongside the signer so `AuthService.completeBootstrap`
433
- * can supply it to the backend.
434
- *
435
- * **Key persistence note:** Every call to `provision()` mints a fresh
436
- * private key. The caller MUST persist the returned `signer` (or its
437
- * private key) if the derived `safeAddress` must be recoverable in
438
- * future sessions. The bootstrap flow persists the signer via the
439
- * backend (`signerProvider` row), but direct API consumers are
440
- * responsible for their own key storage.
441
- */
442
- declare class SignerProvisioner {
443
- provision(): SignerProvisionResult;
444
- }
445
-
446
- type PaymentToken = {
447
- readonly address: `0x${string}`;
448
- readonly decimals: number;
449
- readonly symbol: string;
450
- };
451
- /**
452
- * Resolve a currency code to its on-chain payment token metadata.
453
- *
454
- * Currently supports USDC only (USD and USDC codes map to the same
455
- * token). Non-USDC codes return a `NOT_IMPLEMENTED` stub so callers
456
- * can scaffold multi-currency flows before the registry is fully
457
- * populated.
458
- */
459
- declare function resolvePaymentToken(currency: string): PaymentToken;
460
-
461
- export { Account, AccountProvisionPersonalInput, CapxulClient, CapxulError$1 as CapxulError, CapxulErrorCode$1 as CapxulErrorCode, NextAction, type OnboardingFlowContext, type OnboardingFlowError, type OnboardingFlowEvent, type OnboardingProfileInput, type OnboardingSubjectKind, OperationId, type PaymentToken, type ProvisioningFlowContext, type ProvisioningFlowError, type ProvisioningFlowEvent, type ProvisioningFlowInput, type ProvisioningFlowOutput, type SignerProvisionResult, SignerProvisioner, Username, createLocalSigner, createOnboardingFlowMachine, createProvisioningMachine as createProvisioningFlowMachine, matchAction, matchError, matchStatus, resolvePaymentToken, tryCatch };