@capxul/sdk-react 0.1.0-alpha.9 → 0.2.0-alpha.4
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/CHANGELOG.md +119 -0
- package/README.md +33 -39
- package/dist/index.cjs +603 -83
- package/dist/index.d.cts +154 -119
- package/dist/index.d.ts +154 -119
- package/dist/index.js +598 -84
- package/dist/proof/index.cjs +21 -13
- package/dist/proof/index.js +18 -10
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { QueryClient, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { HttpTransport, TransportState, BrowserCapxulConfig, AuthSessionStore, AccountId, OrganizationId, ApiKeyId, BalanceLedgerEntryId, ExternalAccountId, MemberId, Account, ApiKey, BalanceLedgerEntry, DocumentId, Document, ExternalAccount, KycProfile, CapxulError as CapxulError$1, Member, OperationId, Operation, Organization, PaymentId, Payment, SafeId, Safe, SubAccountId, SubAccount, TokenTransfer, TransferId, Transfer, Treasury, VirtualAccountId, VirtualAccount, VirtualCardId, VirtualCard, WebhookEndpointId, WebhookEndpoint, WebhookEventId, WebhookEvent, WithdrawalId, Withdrawal, List, MembershipStatus, TokenTransfersListInput, TokenTransfersListPage, MemberInviteResponse, Session, AuthBootstrapToken, AuthBootstrapReason } from '@capxul/sdk';
|
|
3
|
+
export { BrowserCapxulConfig, OnboardingFlowContext, OnboardingFlowEvent, ProvisioningFlowContext, ProvisioningFlowEvent } from '@capxul/sdk';
|
|
4
|
+
import { QueryClient, UseQueryResult, UseMutationResult } from '@tanstack/react-query';
|
|
6
5
|
import { CapxulClient } from '@capxul/sdk/client';
|
|
7
6
|
import { CapxulError } from '@capxul/sdk/errors';
|
|
7
|
+
import { Account as Account$1 } from 'viem';
|
|
8
8
|
import * as xstate from 'xstate';
|
|
9
9
|
|
|
10
10
|
type CapxulClientProviderProps = {
|
|
@@ -71,7 +71,7 @@ declare function useCapxulStatus(): TransportState;
|
|
|
71
71
|
* `useCapxulStatus()` can subscribe to its lifecycle state machine.
|
|
72
72
|
*
|
|
73
73
|
* The provider also builds a `ConvexReactClient`-backed data client
|
|
74
|
-
* for the `build-time-urls` arm and feeds it as `config.
|
|
74
|
+
* for the `build-time-urls` arm and feeds it as `config._data` so the
|
|
75
75
|
* SDK domain methods (`me.get`, `accounts.retrieve`, ...) and the
|
|
76
76
|
* React hooks built on top can run authenticated reads against live
|
|
77
77
|
* Convex. The auth lifecycle threads through the optional
|
|
@@ -164,12 +164,10 @@ type QueryResult<T> = {
|
|
|
164
164
|
/**
|
|
165
165
|
* Per-resource singular read hooks — 21 total.
|
|
166
166
|
*
|
|
167
|
-
* Catalogued in the reset hook proof matrix.
|
|
168
|
-
*
|
|
169
|
-
* `
|
|
170
|
-
*
|
|
171
|
-
* 30s `staleTime` matching the `CapxulProvider` default. The
|
|
172
|
-
* remaining 19 hooks plus `useOperation()` still return
|
|
167
|
+
* Catalogued in the reset hook proof matrix. TanStack Query-backed
|
|
168
|
+
* hooks return `UseQueryResult<T, CapxulError>` and route through
|
|
169
|
+
* public `@capxul/sdk` reads with a 30s `staleTime` matching the
|
|
170
|
+
* `CapxulProvider` default. Hooks not yet migrated still return
|
|
173
171
|
* `QueryResult<T>` per the reset transport contract — per-hook
|
|
174
172
|
* migration is the rollout pattern; later tasks lift each in turn.
|
|
175
173
|
* `useOperation()` routes through `operations.retrieve()` so harness
|
|
@@ -238,8 +236,8 @@ declare function useMe(): UseQueryResult<Account, CapxulError$1>;
|
|
|
238
236
|
* 1.8) — per-hook migration is the rollout pattern.
|
|
239
237
|
*/
|
|
240
238
|
declare function useAccount(accountId?: AccountId): QueryResult<Account>;
|
|
241
|
-
declare function useOrganization(
|
|
242
|
-
declare function useMember(
|
|
239
|
+
declare function useOrganization(organizationId: OrganizationId): UseQueryResult<Organization, CapxulError$1>;
|
|
240
|
+
declare function useMember(args: UseMemberArgs): UseQueryResult<Member, CapxulError$1>;
|
|
243
241
|
/**
|
|
244
242
|
* Live; status advances as the indexer reconciles the on-chain
|
|
245
243
|
* deployment. Consumers pattern-match on `data.status` via
|
|
@@ -251,13 +249,12 @@ declare function useMember(_args: UseMemberArgs): QueryResult<Member>;
|
|
|
251
249
|
* stub so onboarding can subscribe to Safe deploy progress.
|
|
252
250
|
*/
|
|
253
251
|
declare function useSafe(safeId: SafeId): QueryResult<Safe>;
|
|
254
|
-
declare function useTreasury(
|
|
252
|
+
declare function useTreasury(organizationId: OrganizationId): UseQueryResult<Treasury, CapxulError$1>;
|
|
255
253
|
/**
|
|
256
254
|
* Org-admin lens only — the hook NEVER returns `secret`.
|
|
257
255
|
*/
|
|
258
256
|
declare function useApiKey(_args: UseApiKeyArgs): QueryResult<ApiKey>;
|
|
259
257
|
declare function useKycProfile(_accountId: AccountId): QueryResult<KycProfile>;
|
|
260
|
-
declare function useKybProfile(_organizationId: OrganizationId): QueryResult<KybProfile>;
|
|
261
258
|
/**
|
|
262
259
|
* Withdrawals v1 W1 (#464) — wired through the SDK.
|
|
263
260
|
*
|
|
@@ -270,10 +267,22 @@ declare function useKybProfile(_organizationId: OrganizationId): QueryResult<Kyb
|
|
|
270
267
|
* differ but the wire shape is identical.
|
|
271
268
|
*/
|
|
272
269
|
declare function useExternalAccount(args: UseExternalAccountArgs): QueryResult<ExternalAccount>;
|
|
273
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Funds v1 PR-2b (#421) — wired through `capxul.subAccounts.retrieve`.
|
|
272
|
+
*
|
|
273
|
+
* The top-level `subAccounts.retrieve` resolves to the same Convex
|
|
274
|
+
* query handler as `accounts.subAccounts.retrieve` /
|
|
275
|
+
* `organizations.subAccounts.retrieve`; visibility is gated server-side
|
|
276
|
+
* (canon §sub_account read contract — cross-scope reads surface as
|
|
277
|
+
* `NOT_FOUND` rather than a distinct permission code). The SDK has
|
|
278
|
+
* already branded the wire shape via `tryBrandSubAccount`, so the hook
|
|
279
|
+
* receives a fully-branded `SubAccount` (`SubAccountId`, `Money`,
|
|
280
|
+
* `TimestampIso`).
|
|
281
|
+
*/
|
|
282
|
+
declare function useSubAccount(subAccountId: SubAccountId): QueryResult<SubAccount>;
|
|
274
283
|
declare function useVirtualAccount(_virtualAccountId: VirtualAccountId): QueryResult<VirtualAccount>;
|
|
275
284
|
declare function useVirtualCard(_virtualCardId: VirtualCardId): QueryResult<VirtualCard>;
|
|
276
|
-
declare function usePayment(
|
|
285
|
+
declare function usePayment(paymentId: PaymentId): UseQueryResult<Payment, CapxulError$1>;
|
|
277
286
|
declare function useTransfer(_transferId: TransferId): QueryResult<Transfer>;
|
|
278
287
|
type UseTokenTransferArgs = {
|
|
279
288
|
readonly txHash: string;
|
|
@@ -295,7 +304,7 @@ declare function useTokenTransfer(args: UseTokenTransferArgs): QueryResult<Token
|
|
|
295
304
|
* Immutable once written; `live` semantically only for late
|
|
296
305
|
* `paymentId` / `transferId` attachment per Doc 02 §"balance_ledger".
|
|
297
306
|
*/
|
|
298
|
-
declare function useBalanceLedgerEntry(
|
|
307
|
+
declare function useBalanceLedgerEntry(args: UseBalanceLedgerEntryArgs): QueryResult<BalanceLedgerEntry>;
|
|
299
308
|
declare function useDocument(_documentId: DocumentId): QueryResult<Document>;
|
|
300
309
|
/**
|
|
301
310
|
* Withdrawals v1 slice 1 (#440) — wired through `capxul.withdrawals.retrieve`.
|
|
@@ -318,10 +327,10 @@ declare function useWebhookEvent(_eventId: WebhookEventId): QueryResult<WebhookE
|
|
|
318
327
|
/**
|
|
319
328
|
* Per-resource list read hooks — 17 total.
|
|
320
329
|
*
|
|
321
|
-
* Catalogued in Doc 08 §3.
|
|
322
|
-
* `
|
|
323
|
-
*
|
|
324
|
-
*
|
|
330
|
+
* Catalogued in Doc 08 §3. TanStack Query-backed hooks return
|
|
331
|
+
* `UseQueryResult<List<T>, CapxulError>` and route through public
|
|
332
|
+
* `@capxul/sdk` reads. Hooks not yet migrated still return
|
|
333
|
+
* `QueryResult<List<T>>` per CANON.md §4.29.
|
|
325
334
|
*
|
|
326
335
|
* Argument shapes follow sdk-surface.md §3b:
|
|
327
336
|
* - Cursor-paginated lists take `{ limit?, cursor? }` filters per
|
|
@@ -379,8 +388,11 @@ type OrgDocumentsFilters = OrgScopedFilters & {
|
|
|
379
388
|
* "My orgs" — returns every organization the authenticated caller
|
|
380
389
|
* is a member of, with the co-member lens per row.
|
|
381
390
|
*/
|
|
382
|
-
declare function useOrganizations():
|
|
383
|
-
|
|
391
|
+
declare function useOrganizations(filters?: PaginationFilters): UseQueryResult<List<Organization>, CapxulError$1>;
|
|
392
|
+
type MembersFilters = {
|
|
393
|
+
readonly status?: MembershipStatus | "all";
|
|
394
|
+
};
|
|
395
|
+
declare function useMembers(organizationId: OrganizationId, filters?: MembersFilters): UseQueryResult<List<Member>, CapxulError$1>;
|
|
384
396
|
/**
|
|
385
397
|
* Withdrawals v1 W1 (#464) — wired through the SDK.
|
|
386
398
|
*
|
|
@@ -392,14 +404,31 @@ declare function useMembers(_organizationId: OrganizationId): QueryResult<List<M
|
|
|
392
404
|
* `pending_verification` rows visible (D5).
|
|
393
405
|
*/
|
|
394
406
|
declare function useExternalAccounts(args: OwnerRef): QueryResult<List<ExternalAccount>>;
|
|
395
|
-
|
|
407
|
+
/**
|
|
408
|
+
* Funds v1 PR-2b (#421) — wired through the SDK.
|
|
409
|
+
*
|
|
410
|
+
* Branches on `args.ownerKind`: `account` scope reads through
|
|
411
|
+
* `capxul.accounts.subAccounts.list({ accountId })`; `organization`
|
|
412
|
+
* scope reads through `capxul.organizations.subAccounts.list({
|
|
413
|
+
* organizationId })`. Both resolve to the same Convex domain (server
|
|
414
|
+
* derives the writer scope per Pattern A — see `sdk.md`). The SDK
|
|
415
|
+
* has already branded each row via `tryBrandSubAccount`, so consumers
|
|
416
|
+
* receive `List<SubAccount>` with `SubAccountId`, `Money`, and
|
|
417
|
+
* `TimestampIso` in place.
|
|
418
|
+
*
|
|
419
|
+
* Note: `OwnerRef` admits only `"account" | "organization"`. A
|
|
420
|
+
* `sub_account` owner is a type error at the call site — not a runtime
|
|
421
|
+
* not-supported branch — because there is no `listChildSubAccounts`
|
|
422
|
+
* backend endpoint.
|
|
423
|
+
*/
|
|
424
|
+
declare function useSubAccounts(args: OwnerRef): QueryResult<List<SubAccount>>;
|
|
396
425
|
declare function useVirtualAccounts(_filters?: VirtualAccountsFilters): QueryResult<List<VirtualAccount>>;
|
|
397
426
|
declare function useVirtualCards(_filters?: VirtualCardsFilters): QueryResult<List<VirtualCard>>;
|
|
398
427
|
/**
|
|
399
428
|
* Personal-scope payments feed (cursor-paginated per §4.16). Org-scope
|
|
400
429
|
* payments live on `useOrgPayments` per §4.30 (Shape A).
|
|
401
430
|
*/
|
|
402
|
-
declare function usePayments(
|
|
431
|
+
declare function usePayments(filters?: PaymentsFilters): UseQueryResult<List<Payment>, CapxulError$1>;
|
|
403
432
|
declare function useOrgPayments(_args: OrgScopedFilters): QueryResult<List<Payment>>;
|
|
404
433
|
declare function useTransfers(_filters?: TransfersFilters): QueryResult<List<Transfer>>;
|
|
405
434
|
declare function useOrgTransfers(_args: OrgScopedFilters): QueryResult<List<Transfer>>;
|
|
@@ -418,7 +447,9 @@ declare function useTokenTransfers(filters?: TokenTransfersListInput): QueryResu
|
|
|
418
447
|
* Append-only per-owner balance-delta feed. Live for late
|
|
419
448
|
* `paymentId` / `transferId` attachment per Doc 02.
|
|
420
449
|
*/
|
|
421
|
-
declare function useBalanceLedger(
|
|
450
|
+
declare function useBalanceLedger(args: OwnerScopedFilters): QueryResult<List<BalanceLedgerEntry>>;
|
|
451
|
+
declare function useAccountBalanceLedger(accountId: AccountId, filters?: PaginationFilters): QueryResult<List<BalanceLedgerEntry>>;
|
|
452
|
+
declare function useOrgBalanceLedger(args: OrgScopedFilters): QueryResult<List<BalanceLedgerEntry>>;
|
|
422
453
|
/**
|
|
423
454
|
* Personal-scope documents. `filters.type` narrows the polymorphic
|
|
424
455
|
* `Document` union to a single variant (invoice, payroll_run,
|
|
@@ -446,13 +477,45 @@ declare function useApiKeys(_organizationId: OrganizationId): QueryResult<List<A
|
|
|
446
477
|
declare function useWebhookEndpoints(): QueryResult<List<WebhookEndpoint>>;
|
|
447
478
|
|
|
448
479
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
480
|
+
* Org-scoped member mutation hooks — TanStack `useMutation` wrappers.
|
|
481
|
+
*
|
|
482
|
+
* Slice 5 (#627): invite, accept, updateRole, revoke, remove, resend.
|
|
483
|
+
* Each hook returns the standard `{ mutate, mutateAsync, isPending, error, data }`
|
|
484
|
+
* shape so consumers can fire-and-forget or await + handle errors.
|
|
452
485
|
*/
|
|
453
|
-
|
|
454
|
-
|
|
486
|
+
|
|
487
|
+
type InviteMemberArgs = {
|
|
488
|
+
readonly organizationId: OrganizationId;
|
|
489
|
+
readonly email: string;
|
|
490
|
+
readonly role: Member["role"];
|
|
491
|
+
};
|
|
492
|
+
type AcceptInvitationArgs = {
|
|
493
|
+
readonly token: string;
|
|
494
|
+
};
|
|
495
|
+
type UpdateMemberRoleArgs = {
|
|
496
|
+
readonly organizationId: OrganizationId;
|
|
497
|
+
readonly memberId: MemberId;
|
|
498
|
+
readonly role: Member["role"];
|
|
499
|
+
};
|
|
500
|
+
type RevokeMemberArgs = {
|
|
501
|
+
readonly organizationId: OrganizationId;
|
|
502
|
+
readonly memberId: MemberId;
|
|
503
|
+
};
|
|
504
|
+
type RemoveMemberArgs = {
|
|
505
|
+
readonly organizationId: OrganizationId;
|
|
506
|
+
readonly memberId: MemberId;
|
|
507
|
+
};
|
|
508
|
+
type ResendInvitationArgs = {
|
|
509
|
+
readonly organizationId: OrganizationId;
|
|
510
|
+
readonly memberId: MemberId;
|
|
455
511
|
};
|
|
512
|
+
declare function useInviteMember(): UseMutationResult<MemberInviteResponse, CapxulError$1, InviteMemberArgs>;
|
|
513
|
+
declare function useAcceptInvitation(): UseMutationResult<Member, CapxulError$1, AcceptInvitationArgs>;
|
|
514
|
+
declare function useUpdateMemberRole(): UseMutationResult<Member, CapxulError$1, UpdateMemberRoleArgs>;
|
|
515
|
+
declare function useRevokeMember(): UseMutationResult<Member, CapxulError$1, RevokeMemberArgs>;
|
|
516
|
+
declare function useRemoveMember(): UseMutationResult<void, CapxulError$1, RemoveMemberArgs>;
|
|
517
|
+
declare function useResendInvitation(): UseMutationResult<MemberInviteResponse, CapxulError$1, ResendInvitationArgs>;
|
|
518
|
+
|
|
456
519
|
/**
|
|
457
520
|
* Public Capxul username. 3–30 chars, letter-first, lowercased,
|
|
458
521
|
* remaining chars from `[a-z0-9_-]` (per `CANON.md` §4.54 and
|
|
@@ -465,86 +528,62 @@ type Username = string & {
|
|
|
465
528
|
readonly __capxulUsernameBrand: "Username";
|
|
466
529
|
};
|
|
467
530
|
|
|
468
|
-
|
|
469
|
-
readonly
|
|
470
|
-
readonly
|
|
531
|
+
type User = {
|
|
532
|
+
readonly account: Account;
|
|
533
|
+
readonly username: Username;
|
|
534
|
+
readonly safe: Safe;
|
|
535
|
+
readonly session: Session;
|
|
536
|
+
};
|
|
537
|
+
type AuthState = "idle" | "sendingOtp" | "awaitingOtp" | "bootstrapRequired" | "provisioningSigner" | "bootstrapping" | "authenticated" | "error";
|
|
538
|
+
type BootstrapContinuation = {
|
|
539
|
+
readonly bootstrapToken: AuthBootstrapToken;
|
|
540
|
+
readonly email: string;
|
|
541
|
+
readonly reason: AuthBootstrapReason;
|
|
542
|
+
readonly username?: Username;
|
|
543
|
+
readonly session: Session;
|
|
471
544
|
};
|
|
472
|
-
|
|
473
|
-
readonly
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
readonly type: "RESET";
|
|
495
|
-
} | {
|
|
496
|
-
readonly type: "SIGN_OUT";
|
|
497
|
-
}, {
|
|
498
|
-
[x: string]: xstate.ActorRefFromLogic<xstate.PromiseActorLogic<void, void, xstate.EventObject>> | xstate.ActorRefFromLogic<xstate.PromiseActorLogic<_capxul_sdk.CompleteBootstrapResult, {
|
|
499
|
-
bootstrapToken: _capxul_sdk.AuthBootstrapToken;
|
|
500
|
-
username: Username;
|
|
501
|
-
signerProvider: _capxul_sdk.LocalPrivateKeySignerProvider;
|
|
502
|
-
}, xstate.EventObject>> | xstate.ActorRefFromLogic<xstate.PromiseActorLogic<void, {
|
|
503
|
-
email: Email;
|
|
504
|
-
}, xstate.EventObject>> | xstate.ActorRefFromLogic<xstate.PromiseActorLogic<_capxul_sdk.VerifyOtpResult, {
|
|
505
|
-
email: Email;
|
|
506
|
-
code: string;
|
|
507
|
-
}, xstate.EventObject>> | undefined;
|
|
508
|
-
}, "email" | "error" | "bootstrap_required" | "authenticated" | "sending_otp" | "otp_requested" | "signing_out" | "verifying_otp" | "completing_bootstrap", string, xstate.NonReducibleUnknown, xstate.MetaObject, {
|
|
509
|
-
id: "authBootstrap";
|
|
510
|
-
states: {
|
|
511
|
-
readonly email: {};
|
|
512
|
-
readonly sending_otp: {};
|
|
513
|
-
readonly otp_requested: {};
|
|
514
|
-
readonly verifying_otp: {};
|
|
515
|
-
readonly bootstrap_required: {};
|
|
516
|
-
readonly completing_bootstrap: {};
|
|
517
|
-
readonly authenticated: {};
|
|
518
|
-
readonly signing_out: {};
|
|
519
|
-
readonly error: {};
|
|
520
|
-
};
|
|
521
|
-
}>;
|
|
522
|
-
readonly send: (event: {
|
|
523
|
-
readonly type: "ENTER_EMAIL";
|
|
524
|
-
readonly email: Email;
|
|
525
|
-
} | {
|
|
526
|
-
readonly type: "REQUEST_OTP";
|
|
527
|
-
} | {
|
|
528
|
-
readonly type: "ENTER_OTP";
|
|
529
|
-
readonly code: string;
|
|
530
|
-
} | {
|
|
531
|
-
readonly type: "VERIFY_OTP";
|
|
532
|
-
} | {
|
|
533
|
-
readonly type: "ENTER_USERNAME";
|
|
534
|
-
readonly username: Username;
|
|
535
|
-
} | {
|
|
536
|
-
readonly type: "ENTER_SIGNER_PROVIDER";
|
|
537
|
-
readonly signerProvider: _capxul_sdk.LocalPrivateKeySignerProvider;
|
|
538
|
-
} | {
|
|
539
|
-
readonly type: "COMPLETE_BOOTSTRAP";
|
|
540
|
-
} | {
|
|
541
|
-
readonly type: "BACK";
|
|
542
|
-
} | {
|
|
543
|
-
readonly type: "RESET";
|
|
544
|
-
} | {
|
|
545
|
-
readonly type: "SIGN_OUT";
|
|
546
|
-
}) => void;
|
|
545
|
+
type AuthVerifyResult = {
|
|
546
|
+
readonly kind: "existing_member";
|
|
547
|
+
readonly session: Session;
|
|
548
|
+
readonly user: User;
|
|
549
|
+
} | {
|
|
550
|
+
readonly kind: "bootstrap_required";
|
|
551
|
+
readonly session: Session;
|
|
552
|
+
readonly bootstrap: BootstrapContinuation;
|
|
553
|
+
};
|
|
554
|
+
type UseAuthResult = {
|
|
555
|
+
readonly state: AuthState;
|
|
556
|
+
readonly user: User | null;
|
|
557
|
+
readonly bootstrap: BootstrapContinuation | null;
|
|
558
|
+
readonly error: Error | null;
|
|
559
|
+
readonly signIn: (email: string) => Promise<void>;
|
|
560
|
+
readonly verifyOtp: (email: string, otp: string) => Promise<AuthVerifyResult>;
|
|
561
|
+
readonly completeBootstrap: (username: Username, signer?: Account$1) => Promise<User>;
|
|
562
|
+
readonly signOut: () => Promise<void>;
|
|
563
|
+
};
|
|
564
|
+
type UseAuthOptions = {
|
|
565
|
+
/** Optional external signer to use during bootstrap instead of auto-provisioning. */
|
|
566
|
+
readonly signer?: Account$1;
|
|
547
567
|
};
|
|
568
|
+
/**
|
|
569
|
+
* Canonical auth hook.
|
|
570
|
+
*
|
|
571
|
+
* Reactive state (`state`, `user`, `error`) is suitable for UI
|
|
572
|
+
* observers; `signIn`, `verifyOtp`, and `signOut` return promises so
|
|
573
|
+
* the reference CLI can drive the flow imperatively.
|
|
574
|
+
*
|
|
575
|
+
* OTP verification is intentionally branch-explicit: existing members
|
|
576
|
+
* authenticate immediately, while first-run or incomplete accounts stop
|
|
577
|
+
* at `bootstrapRequired` until the caller chooses a username and calls
|
|
578
|
+
* `completeBootstrap()`.
|
|
579
|
+
*
|
|
580
|
+
* `completeBootstrap()` auto-provisions a fresh local-private-key signer
|
|
581
|
+
* via `SignerProvisioner` unless the caller passes or configures an
|
|
582
|
+
* explicit signer. Test harnesses use that override to keep the actor's
|
|
583
|
+
* signer stable across later dogfooding operations.
|
|
584
|
+
*/
|
|
585
|
+
declare function useAuth(options?: UseAuthOptions): UseAuthResult;
|
|
586
|
+
|
|
548
587
|
declare function useOnboardingFlow(): {
|
|
549
588
|
readonly snapshot: xstate.MachineSnapshot<any, any, any, any, any, any, any, any>;
|
|
550
589
|
readonly send: (event: any) => void;
|
|
@@ -591,8 +630,6 @@ type CapxulConnectorSession = {
|
|
|
591
630
|
readonly connectorId: string;
|
|
592
631
|
readonly connectorKind: CapxulConnectorKind;
|
|
593
632
|
readonly signerAddress: string;
|
|
594
|
-
readonly safeAddress?: string;
|
|
595
|
-
readonly signerProvider?: LocalPrivateKeySignerProvider;
|
|
596
633
|
};
|
|
597
634
|
type CapxulConnector = {
|
|
598
635
|
readonly id: string;
|
|
@@ -608,7 +645,6 @@ type InjectedConnectorOptions = {
|
|
|
608
645
|
};
|
|
609
646
|
type LocalPrivateKeyConnectorOptions = {
|
|
610
647
|
readonly privateKey: `0x${string}`;
|
|
611
|
-
readonly safeAddress: string;
|
|
612
648
|
readonly id?: string;
|
|
613
649
|
readonly name?: string;
|
|
614
650
|
};
|
|
@@ -625,14 +661,13 @@ declare function injectedConnector(options?: InjectedConnectorOptions): CapxulCo
|
|
|
625
661
|
/**
|
|
626
662
|
* Resolve a signer from a local private key (dev / e2e harness path).
|
|
627
663
|
*
|
|
628
|
-
* Validates the private key shape (`0x` + 64 hex chars)
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
* key with no I/O.
|
|
664
|
+
* Validates the private key shape (`0x` + 64 hex chars) synchronously
|
|
665
|
+
* at factory time so misconfig surfaces before any UI flow advances.
|
|
666
|
+
* Per-call `connect()` is pure computation — `privateKeyToAccount`
|
|
667
|
+
* derives the address from the key with no I/O.
|
|
633
668
|
*
|
|
634
669
|
* Throws `Errors.invalidInput(...)` on bad inputs.
|
|
635
670
|
*/
|
|
636
671
|
declare function localPrivateKeyConnector(options: LocalPrivateKeyConnectorOptions): CapxulConnector;
|
|
637
672
|
|
|
638
|
-
export { CapxulClientProvider, type CapxulClientProviderProps, type CapxulConnector, type CapxulConnectorKind, type CapxulConnectorSession, CapxulProvider, type CapxulProviderProps, CapxulTransportProvider, type CapxulTransportProviderProps, type DocumentsFilters, type InjectedConnectorOptions, type LocalPrivateKeyConnectorOptions, type OrgDocumentsFilters, type OrgScopedFilters, type OwnerRef, type OwnerScopedFilters, type PaginationFilters, type PaymentsFilters, type QueryResult, type TransfersFilters, type UseApiKeyArgs, type UseBalanceLedgerEntryArgs, type UseExternalAccountArgs, type UseMemberArgs, type UseTokenTransferArgs, type VirtualAccountsFilters, type VirtualCardsFilters, type WithdrawalsFilters, createCapxulConfig, injectedConnector, localPrivateKeyConnector, useAccount, useApiKey, useApiKeys,
|
|
673
|
+
export { type AuthState, type AuthVerifyResult, type BootstrapContinuation, CapxulClientProvider, type CapxulClientProviderProps, type CapxulConnector, type CapxulConnectorKind, type CapxulConnectorSession, CapxulProvider, type CapxulProviderProps, CapxulTransportProvider, type CapxulTransportProviderProps, type DocumentsFilters, type InjectedConnectorOptions, type LocalPrivateKeyConnectorOptions, type OrgDocumentsFilters, type OrgScopedFilters, type OwnerRef, type OwnerScopedFilters, type PaginationFilters, type PaymentsFilters, type QueryResult, type TransfersFilters, type UseApiKeyArgs, type UseAuthOptions, type UseAuthResult, type UseBalanceLedgerEntryArgs, type UseExternalAccountArgs, type UseMemberArgs, type UseTokenTransferArgs, type User, type VirtualAccountsFilters, type VirtualCardsFilters, type WithdrawalsFilters, createCapxulConfig, injectedConnector, localPrivateKeyConnector, useAcceptInvitation, useAccount, useAccountBalanceLedger, useApiKey, useApiKeys, useAuth, useBalanceLedger, useBalanceLedgerEntry, useCapxul, useCapxulStatus, useDocument, useDocuments, useExternalAccount, useExternalAccounts, useInviteMember, useKycProfile, useMe, useMember, useMembers, useOnboardingFlow, useOperation, useOrgBalanceLedger, useOrgDocuments, useOrgPayments, useOrgTransfers, useOrgWithdrawals, useOrganization, useOrganizations, usePayment, usePayments, useProvisioningFlow, useRemoveMember, useResendInvitation, useRevokeMember, useSafe, useSubAccount, useSubAccounts, useTokenTransfer, useTokenTransfers, useTransfer, useTransfers, useTreasury, useUpdateMemberRole, useVirtualAccount, useVirtualAccounts, useVirtualCard, useVirtualCards, useWebhookEndpoint, useWebhookEndpoints, useWebhookEvent, useWithdrawal, useWithdrawals };
|