@capxul/sdk 0.2.0-alpha.5 → 1.0.0-alpha.10
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 +5 -4
- package/dist/InMemoryAuthCacheAdapter-v5W-XB5M.mjs +457 -0
- package/dist/InMemoryAuthCacheAdapter-v5W-XB5M.mjs.map +1 -0
- package/dist/index-CTXgQ_xR.d.mts +158 -0
- package/dist/index-CTXgQ_xR.d.mts.map +1 -0
- package/dist/index.d.mts +1547 -236
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6931 -3697
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.mjs +1 -2
- package/dist/node/index.mjs.map +1 -1
- package/dist/ports/safe-deployment.d.mts +1 -1
- package/dist/{safe-deployment-Vni46k3t.d.mts → safe-deployment-D3k9yndM.d.mts} +4 -5
- package/dist/safe-deployment-D3k9yndM.d.mts.map +1 -0
- package/dist/{signer-oaYGfjDe.d.mts → signer-D9fUJp8o.d.mts} +26 -21
- package/dist/signer-D9fUJp8o.d.mts.map +1 -0
- package/package.json +15 -11
- package/dist/InMemoryAuthCacheAdapter-BK-B_ERB.mjs +0 -113
- package/dist/InMemoryAuthCacheAdapter-BK-B_ERB.mjs.map +0 -1
- package/dist/safe-deployment-Vni46k3t.d.mts.map +0 -1
- package/dist/signer-oaYGfjDe.d.mts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { Machine } from "@effect/experimental";
|
|
5
|
-
import { CapxulError, CapxulErrorCode, CapxulErrorDetails } from "@capxul/config";
|
|
6
|
-
import { Account, Account as Account$1, AccountId, Address, Address as Address$1, AllowedOrigin, AnonymousDistinctId, AppId, AuthSession, AuthSession as AuthSession$1, AuthUserId, AuthUserId as AuthUserId$1, ChainId, CountryCode, DeveloperApplication, DurationMs, Email, EpochMs, Money, Money as Money$1, OrgId, OrgId as OrgId$1, Profile as Profile$1, PublishableKey, PublishableKeyId, PublishableKeyRecord, RoleKey, RoleKey as RoleKey$1, RunId, SessionToken, SmartAccount as SmartAccount$1, SubAccount, SubAccount as SubAccount$1, SubAccountId, SubAccountId as SubAccountId$1 } from "@capxul/types";
|
|
7
|
-
import { TelemetryEvent, TelemetryGroupInput, TelemetryIdentifyInput } from "@capxul/observability";
|
|
1
|
+
import { A as SubAccount, C as PublishableKey, D as RunId, E as RoleKey, F as CapxulErrorDetails, I as FailureMode, N as CapxulError, O as SessionToken, P as CapxulErrorCode, S as Profile$1, T as PublishableKeyRecord, _ as EpochMs, a as AnonymousDistinctId, b as Money, c as AuthUserId, d as CountryCode, f as CurrencyCode, g as Email, h as DurationMs, i as AllowedOrigin, j as SubAccountId, k as SmartAccount$1, m as DocumentHash, n as AccountId, o as AppId, p as DeveloperApplication, r as Address, s as AuthSession, t as Account, u as ChainId, w as PublishableKeyId, x as OrgId } from "./index-CTXgQ_xR.mjs";
|
|
2
|
+
import { a as AccountProvider, c as Eip1193Provider, d as CapxulResult, f as Profile, g as AuthCachePort, i as injectedWalletSigner, l as eip1193AccountProvider, m as SmartAccount, n as CapxulSigner, o as AccountProviderSource, p as Session, r as Eip1193RequestProvider, s as AccountRequirement, t as CapxulDigestSigner, u as localPrivateKeyAccountProvider, v as CachedJwt } from "./signer-D9fUJp8o.mjs";
|
|
3
|
+
import { a as SafeDeploymentEvidence, n as SafeDeploymentConfig } from "./safe-deployment-D3k9yndM.mjs";
|
|
8
4
|
import { Hex } from "viem";
|
|
9
|
-
import {
|
|
5
|
+
import { Context, Effect, Layer, Request } from "effect";
|
|
10
6
|
import { FunctionReference } from "convex/server";
|
|
7
|
+
import { Schema } from "@effect/schema";
|
|
8
|
+
import { Machine } from "@effect/experimental";
|
|
11
9
|
|
|
12
10
|
//#region src/ports/auth-client.d.ts
|
|
13
11
|
type AuthClientOperationOptions = {
|
|
@@ -41,8 +39,8 @@ declare class AuthClientError extends AuthClientError_base<{
|
|
|
41
39
|
interface AuthClientPort {
|
|
42
40
|
canSendOtp(input: CanSendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<CanSendOtpStatus, AuthClientError>;
|
|
43
41
|
sendOtp(input: SendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
44
|
-
verifyOtp(input: VerifyOtpInput, options?: AuthClientOperationOptions): Effect.Effect<AuthSession
|
|
45
|
-
getSession(options?: AuthClientOperationOptions): Effect.Effect<AuthSession
|
|
42
|
+
verifyOtp(input: VerifyOtpInput, options?: AuthClientOperationOptions): Effect.Effect<AuthSession, AuthClientError>;
|
|
43
|
+
getSession(options?: AuthClientOperationOptions): Effect.Effect<AuthSession | null, AuthClientError>;
|
|
46
44
|
signOut(options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
47
45
|
/**
|
|
48
46
|
* Fetches a Convex-aud JWT from `/api/auth/convex/token` (W7). Server mints
|
|
@@ -67,12 +65,48 @@ declare class ClockError extends ClockError_base<{
|
|
|
67
65
|
readonly cause: unknown;
|
|
68
66
|
}> {}
|
|
69
67
|
//#endregion
|
|
70
|
-
//#region src/
|
|
68
|
+
//#region ../observability/src/telemetry-port.d.ts
|
|
69
|
+
/**
|
|
70
|
+
* Context for reporting handled errors via `reportHandledError`.
|
|
71
|
+
* Carries structured metadata extracted from the error context.
|
|
72
|
+
*/
|
|
73
|
+
interface HandledErrorReportContext$1 {
|
|
74
|
+
readonly layer?: string;
|
|
75
|
+
readonly operation?: string;
|
|
76
|
+
readonly failure_mode?: FailureMode;
|
|
77
|
+
readonly provider?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Canonical TelemetryPort interface. Every adapter (production, test, in-memory)
|
|
81
|
+
* implements this contract. All methods return `Effect<void, never>` —
|
|
82
|
+
* fire-and-forget, defects are caught and traced.
|
|
83
|
+
*/
|
|
71
84
|
interface TelemetryPort {
|
|
72
85
|
readonly emit: (event: TelemetryEvent) => Effect.Effect<void, never>;
|
|
73
86
|
readonly identify: (input: TelemetryIdentifyInput) => Effect.Effect<void, never>;
|
|
74
87
|
readonly group: (input: TelemetryGroupInput) => Effect.Effect<void, never>;
|
|
75
88
|
readonly reset: () => Effect.Effect<void, never>;
|
|
89
|
+
readonly reportHandledError?: (error: CapxulError, context?: HandledErrorReportContext$1) => Effect.Effect<void, never>;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../observability/src/index.d.ts
|
|
93
|
+
declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "subaccount_created", "subaccount_renamed", "subaccount_deleted", "subaccount_op_failed", "transfer_requested", "transfer_confirmed", "transfer_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_role_granted", "org_member_active", "org_member_removed", "org_invite_expired", "org_role_grant_failed", "payment_requested", "payment_resolved", "payment_document_attached", "payment_submitted", "payment_settled", "payment_claimed", "payment_cancelled", "payment_redirected", "payment_failed", "stream_created", "stream_claimed", "stream_cancelled", "stream_completed", "stream_failed", "withdrawal_requested", "withdrawal_submitted", "withdrawal_settled", "withdrawal_failed"];
|
|
94
|
+
type TelemetryEventName = (typeof TELEMETRY_EVENT_NAMES)[number];
|
|
95
|
+
type TelemetryProps = Record<string, unknown>;
|
|
96
|
+
type TelemetryEvent = {
|
|
97
|
+
readonly name: TelemetryEventName;
|
|
98
|
+
readonly props?: TelemetryProps | undefined;
|
|
99
|
+
};
|
|
100
|
+
interface TelemetryIdentifyInput {
|
|
101
|
+
readonly distinctId: string;
|
|
102
|
+
readonly anonDistinctId?: AnonymousDistinctId;
|
|
103
|
+
readonly traits?: TelemetryProps;
|
|
104
|
+
readonly properties?: TelemetryProps;
|
|
105
|
+
}
|
|
106
|
+
interface TelemetryGroupInput {
|
|
107
|
+
readonly groupType: string;
|
|
108
|
+
readonly groupKey: string;
|
|
109
|
+
readonly properties?: TelemetryProps;
|
|
76
110
|
}
|
|
77
111
|
//#endregion
|
|
78
112
|
//#region src/flows/auth.d.ts
|
|
@@ -83,7 +117,7 @@ type AuthFlowState = "idle" | "sending_otp" | "otp_requested" | "verifying" | "a
|
|
|
83
117
|
interface AuthFlowContext {
|
|
84
118
|
readonly state: AuthFlowState;
|
|
85
119
|
readonly email: Email | null;
|
|
86
|
-
readonly session: AuthSession
|
|
120
|
+
readonly session: AuthSession | null;
|
|
87
121
|
readonly otpRequestedAt: EpochMs | null;
|
|
88
122
|
readonly anonDistinctId?: AnonymousDistinctId;
|
|
89
123
|
readonly error: CapxulError | null;
|
|
@@ -126,41 +160,6 @@ interface EnvPort {
|
|
|
126
160
|
readonly has: (key: EnvKey) => Effect.Effect<boolean, EnvError, never>;
|
|
127
161
|
}
|
|
128
162
|
//#endregion
|
|
129
|
-
//#region src/ports/evm-signer.d.ts
|
|
130
|
-
type HexString = `0x${string}`;
|
|
131
|
-
type UserOperationRequest = {
|
|
132
|
-
readonly sender: Address$1;
|
|
133
|
-
readonly chainId: ChainId;
|
|
134
|
-
readonly callData: HexString;
|
|
135
|
-
readonly nonce?: HexString;
|
|
136
|
-
readonly maxFeePerGas?: HexString;
|
|
137
|
-
readonly maxPriorityFeePerGas?: HexString;
|
|
138
|
-
readonly callGasLimit?: HexString;
|
|
139
|
-
readonly verificationGasLimit?: HexString;
|
|
140
|
-
readonly preVerificationGas?: HexString;
|
|
141
|
-
readonly paymasterAndData?: HexString;
|
|
142
|
-
};
|
|
143
|
-
type SignedUserOperation = UserOperationRequest & {
|
|
144
|
-
readonly sender: Address$1;
|
|
145
|
-
readonly signature: HexString;
|
|
146
|
-
readonly userOpHash: HexString;
|
|
147
|
-
};
|
|
148
|
-
declare const EvmSignerError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
149
|
-
readonly _tag: "EvmSignerError";
|
|
150
|
-
} & Readonly<A>;
|
|
151
|
-
declare class EvmSignerError extends EvmSignerError_base<{
|
|
152
|
-
readonly publicError: CapxulError;
|
|
153
|
-
readonly publicCode?: CapxulErrorCode;
|
|
154
|
-
readonly operation?: string;
|
|
155
|
-
readonly details?: CapxulErrorDetails;
|
|
156
|
-
readonly cause?: unknown;
|
|
157
|
-
}> {}
|
|
158
|
-
interface EvmSignerPort {
|
|
159
|
-
readonly getAddress: Effect.Effect<Address$1, EvmSignerError, never>;
|
|
160
|
-
readonly signMessage: (message: string | Uint8Array) => Effect.Effect<HexString, EvmSignerError, never>;
|
|
161
|
-
readonly signUserOp: (userOperation: UserOperationRequest) => Effect.Effect<SignedUserOperation, EvmSignerError, never>;
|
|
162
|
-
}
|
|
163
|
-
//#endregion
|
|
164
163
|
//#region src/ports/transport.d.ts
|
|
165
164
|
type TransportOperationKind = "query" | "mutation" | "action";
|
|
166
165
|
type TransportRequest<TArgs = unknown> = {
|
|
@@ -209,6 +208,9 @@ type BootstrapResolution = {
|
|
|
209
208
|
readonly expiresIn: DurationMs;
|
|
210
209
|
readonly authBaseUrl: string;
|
|
211
210
|
readonly convexUrl: string;
|
|
211
|
+
readonly siteBaseUrl: string;
|
|
212
|
+
readonly openfortPublishableKey: string;
|
|
213
|
+
readonly shieldPublishableKey: string;
|
|
212
214
|
};
|
|
213
215
|
type BootstrapErrorKind = "notAuthenticated" | "network" | "provider" | "malformedBody" | "invalidInput" | "rateLimited";
|
|
214
216
|
declare const BootstrapError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
@@ -299,22 +301,22 @@ interface ConvexCallPort {
|
|
|
299
301
|
//#endregion
|
|
300
302
|
//#region src/ports/credentials.d.ts
|
|
301
303
|
type CreateApplicationInput = {
|
|
302
|
-
readonly authUserId: AuthUserId
|
|
304
|
+
readonly authUserId: AuthUserId;
|
|
303
305
|
readonly name: string;
|
|
304
306
|
readonly allowedOrigins: readonly AllowedOrigin[];
|
|
305
307
|
};
|
|
306
308
|
type MintKeyInput = {
|
|
307
309
|
readonly applicationId: AppId;
|
|
308
|
-
readonly authUserId: AuthUserId
|
|
310
|
+
readonly authUserId: AuthUserId;
|
|
309
311
|
};
|
|
310
312
|
type RotateKeyInput = {
|
|
311
313
|
readonly keyId: PublishableKeyId;
|
|
312
|
-
readonly authUserId: AuthUserId
|
|
314
|
+
readonly authUserId: AuthUserId;
|
|
313
315
|
readonly graceMs: DurationMs;
|
|
314
316
|
};
|
|
315
317
|
type RevokeKeyInput = {
|
|
316
318
|
readonly keyId: PublishableKeyId;
|
|
317
|
-
readonly authUserId: AuthUserId
|
|
319
|
+
readonly authUserId: AuthUserId;
|
|
318
320
|
};
|
|
319
321
|
type RotateKeyResult = {
|
|
320
322
|
readonly active: PublishableKeyRecord;
|
|
@@ -331,7 +333,7 @@ declare class CredentialsError extends CredentialsError_base<{
|
|
|
331
333
|
readonly details?: CapxulErrorDetails;
|
|
332
334
|
}> {}
|
|
333
335
|
interface CredentialsPort {
|
|
334
|
-
listApplications(authUserId: AuthUserId
|
|
336
|
+
listApplications(authUserId: AuthUserId): Effect.Effect<readonly DeveloperApplication[], CredentialsError>;
|
|
335
337
|
createApplication(input: CreateApplicationInput): Effect.Effect<DeveloperApplication, CredentialsError>;
|
|
336
338
|
mintPublishableKey(input: MintKeyInput): Effect.Effect<PublishableKeyRecord, CredentialsError>;
|
|
337
339
|
rotatePublishableKey(input: RotateKeyInput): Effect.Effect<RotateKeyResult, CredentialsError>;
|
|
@@ -340,16 +342,31 @@ interface CredentialsPort {
|
|
|
340
342
|
//#endregion
|
|
341
343
|
//#region src/ports/identity.d.ts
|
|
342
344
|
type CreateIdentityInput = {
|
|
343
|
-
readonly authUserId: AuthUserId
|
|
345
|
+
readonly authUserId: AuthUserId;
|
|
344
346
|
readonly email: Email;
|
|
345
347
|
readonly displayName?: string;
|
|
346
348
|
readonly country?: CountryCode;
|
|
347
349
|
};
|
|
348
350
|
type UpdateIdentityInput = {
|
|
349
|
-
readonly authUserId: AuthUserId
|
|
351
|
+
readonly authUserId: AuthUserId;
|
|
350
352
|
readonly displayName?: string;
|
|
351
353
|
readonly country?: CountryCode;
|
|
352
354
|
};
|
|
355
|
+
/**
|
|
356
|
+
* D-ONBOARD (#669) — the onboarding-complete identity write. Composes the
|
|
357
|
+
* existing create/update write into one idempotent upsert that ALSO sets the
|
|
358
|
+
* `onboarded` flag and persists the optional `withdrawalAddress` (the one
|
|
359
|
+
* allowed raw-0x class). `displayName` + `country` are required at onboarding
|
|
360
|
+
* time. The returned `Profile` is the existing branded shape — the onboarding
|
|
361
|
+
* flags live on the wire row and are not projected onto the read surface.
|
|
362
|
+
*/
|
|
363
|
+
type CompleteOnboardingIdentityInput = {
|
|
364
|
+
readonly authUserId: AuthUserId;
|
|
365
|
+
readonly email: Email;
|
|
366
|
+
readonly displayName: string;
|
|
367
|
+
readonly country: CountryCode;
|
|
368
|
+
readonly withdrawalAddress?: Address;
|
|
369
|
+
};
|
|
353
370
|
declare const IdentityError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
354
371
|
readonly _tag: "IdentityError";
|
|
355
372
|
} & Readonly<A>;
|
|
@@ -361,15 +378,16 @@ declare class IdentityError extends IdentityError_base<{
|
|
|
361
378
|
readonly details?: CapxulErrorDetails;
|
|
362
379
|
}> {}
|
|
363
380
|
interface IdentityPort {
|
|
364
|
-
loadByAuthUserId(authUserId: AuthUserId
|
|
381
|
+
loadByAuthUserId(authUserId: AuthUserId): Effect.Effect<Profile$1 | null, IdentityError, never>;
|
|
365
382
|
create(input: CreateIdentityInput): Effect.Effect<Profile$1, IdentityError, never>;
|
|
366
383
|
update(input: UpdateIdentityInput): Effect.Effect<Profile$1, IdentityError, never>;
|
|
384
|
+
/** D-ONBOARD (#669): idempotent upsert that marks the identity onboarded. */
|
|
385
|
+
completeOnboarding(input: CompleteOnboardingIdentityInput): Effect.Effect<Profile$1, IdentityError, never>;
|
|
367
386
|
}
|
|
368
387
|
//#endregion
|
|
369
388
|
//#region src/ports/smart-account.d.ts
|
|
370
389
|
type ProvisionInput = {
|
|
371
|
-
readonly authUserId: AuthUserId
|
|
372
|
-
readonly signerAddress: Address$1;
|
|
390
|
+
readonly authUserId: AuthUserId;
|
|
373
391
|
readonly chainId: ChainId;
|
|
374
392
|
};
|
|
375
393
|
/**
|
|
@@ -387,9 +405,9 @@ type ProvisionInput = {
|
|
|
387
405
|
* `eth_getUserOperationReceipt(userOpHash)` to re-verify and derive.
|
|
388
406
|
*/
|
|
389
407
|
type ConfirmDeploymentInput = {
|
|
390
|
-
readonly authUserId: AuthUserId
|
|
408
|
+
readonly authUserId: AuthUserId;
|
|
391
409
|
readonly chainId: ChainId;
|
|
392
|
-
readonly safeAddress: Address
|
|
410
|
+
readonly safeAddress: Address;
|
|
393
411
|
readonly evidence: SafeDeploymentEvidence;
|
|
394
412
|
/**
|
|
395
413
|
* Optional live-E2E correlation id. This does not prove deployment; the
|
|
@@ -398,41 +416,16 @@ type ConfirmDeploymentInput = {
|
|
|
398
416
|
*/
|
|
399
417
|
readonly telemetryRunId?: RunId;
|
|
400
418
|
};
|
|
401
|
-
/**
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
readonly
|
|
409
|
-
readonly verificationGasLimit: string;
|
|
410
|
-
readonly preVerificationGas: string;
|
|
411
|
-
readonly maxFeePerGas: string;
|
|
412
|
-
readonly maxPriorityFeePerGas: string;
|
|
413
|
-
readonly paymaster: string;
|
|
414
|
-
readonly paymasterVerificationGasLimit: string;
|
|
415
|
-
readonly paymasterPostOpGasLimit: string;
|
|
416
|
-
readonly paymasterData: string;
|
|
417
|
-
};
|
|
418
|
-
/** Input to `SmartAccountPort.deployPrepare` (backend-orchestrated-deploy.md · #289). */
|
|
419
|
-
type DeployPrepareInput = {
|
|
420
|
-
readonly authUserId: AuthUserId$1;
|
|
421
|
-
readonly chainId: ChainId;
|
|
422
|
-
readonly telemetryRunId?: RunId;
|
|
423
|
-
};
|
|
424
|
-
/** Backend-built deployment UserOp + the EIP-712 SafeOp digest the CapxulSigner signs. */
|
|
425
|
-
type DeployPrepareResult = {
|
|
426
|
-
readonly digest: Hex;
|
|
427
|
-
readonly safeAddress: Address$1;
|
|
428
|
-
readonly userOp: DeploymentUserOpFields;
|
|
429
|
-
};
|
|
430
|
-
/** Input to `SmartAccountPort.deploySubmit` — the consumer-signed deployment UserOp. */
|
|
431
|
-
type DeploySubmitInput = {
|
|
432
|
-
readonly authUserId: AuthUserId$1;
|
|
419
|
+
/**
|
|
420
|
+
* Input to `SmartAccountPort.claim` (PRD #462). The authenticated session
|
|
421
|
+
* reports the browser-created signer address; the BACKEND builds and
|
|
422
|
+
* bootstrap-signs the claim userOp (deploy + swapOwner) — the consumer signs
|
|
423
|
+
* nothing at claim.
|
|
424
|
+
*/
|
|
425
|
+
type ClaimInput = {
|
|
426
|
+
readonly authUserId: AuthUserId;
|
|
433
427
|
readonly chainId: ChainId;
|
|
434
|
-
readonly
|
|
435
|
-
readonly signature: Hex;
|
|
428
|
+
readonly signerAddress: Address;
|
|
436
429
|
readonly telemetryRunId?: RunId;
|
|
437
430
|
};
|
|
438
431
|
declare const SmartAccountError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
@@ -446,8 +439,8 @@ declare class SmartAccountError extends SmartAccountError_base<{
|
|
|
446
439
|
readonly details?: CapxulErrorDetails;
|
|
447
440
|
}> {}
|
|
448
441
|
interface SmartAccountPort {
|
|
449
|
-
loadByAuthUserId(authUserId: AuthUserId
|
|
450
|
-
loadBySmartAccountAddress(address: Address
|
|
442
|
+
loadByAuthUserId(authUserId: AuthUserId): Effect.Effect<SmartAccount$1 | null, SmartAccountError, never>;
|
|
443
|
+
loadBySmartAccountAddress(address: Address): Effect.Effect<SmartAccount$1 | null, SmartAccountError, never>;
|
|
451
444
|
provision(input: ProvisionInput): Effect.Effect<SmartAccount$1, SmartAccountError, never>;
|
|
452
445
|
/**
|
|
453
446
|
* Persist on-chain Safe-deployment evidence. The backend re-verifies
|
|
@@ -460,18 +453,13 @@ interface SmartAccountPort {
|
|
|
460
453
|
*/
|
|
461
454
|
confirmDeployment(input: ConfirmDeploymentInput): Effect.Effect<SmartAccount$1, SmartAccountError, never>;
|
|
462
455
|
/**
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
* `
|
|
466
|
-
*
|
|
467
|
-
|
|
468
|
-
deployPrepare(input: DeployPrepareInput): Effect.Effect<DeployPrepareResult, SmartAccountError, never>;
|
|
469
|
-
/**
|
|
470
|
-
* Submit the signed deployment UserOperation through the bundler and confirm
|
|
471
|
-
* `deployedAt` on-chain (absorbing the `confirmDeployment` verify path).
|
|
472
|
-
* Returns the updated `SmartAccount` row.
|
|
456
|
+
* Claim the account (PRD #462): the backend builds, bootstrap-signs, and
|
|
457
|
+
* submits ONE sponsored userOp — deploy (when undeployed) + swapOwner
|
|
458
|
+
* (bootstrap → `signerAddress`). Idempotent; returns the updated row. When
|
|
459
|
+
* another claim is in flight the row comes back with `claimedAt: null` —
|
|
460
|
+
* callers poll lifecycle until the claim lands.
|
|
473
461
|
*/
|
|
474
|
-
|
|
462
|
+
claim(input: ClaimInput): Effect.Effect<SmartAccount$1, SmartAccountError, never>;
|
|
475
463
|
}
|
|
476
464
|
//#endregion
|
|
477
465
|
//#region src/ports/account-read.d.ts
|
|
@@ -480,7 +468,7 @@ type ReadAccountBalanceInput = {
|
|
|
480
468
|
};
|
|
481
469
|
type FundFromFaucetInput = {
|
|
482
470
|
readonly chainId: ChainId;
|
|
483
|
-
readonly amount: Money
|
|
471
|
+
readonly amount: Money;
|
|
484
472
|
};
|
|
485
473
|
type FundFromFaucetResult = {
|
|
486
474
|
readonly txHash: string;
|
|
@@ -500,7 +488,7 @@ declare class AccountReadError extends AccountReadError_base<{
|
|
|
500
488
|
* live RPC `balanceOf` pull; the adapter lifts wire integers to `Money`.
|
|
501
489
|
*/
|
|
502
490
|
interface AccountReadPort {
|
|
503
|
-
readBalance(input: ReadAccountBalanceInput): Effect.Effect<Account
|
|
491
|
+
readBalance(input: ReadAccountBalanceInput): Effect.Effect<Account, AccountReadError, never>;
|
|
504
492
|
fundFromFaucet(input: FundFromFaucetInput): Effect.Effect<FundFromFaucetResult, AccountReadError, never>;
|
|
505
493
|
}
|
|
506
494
|
//#endregion
|
|
@@ -520,10 +508,10 @@ type CreateSubAccountInput = {
|
|
|
520
508
|
readonly name: string;
|
|
521
509
|
};
|
|
522
510
|
type SubAccountIdInput = {
|
|
523
|
-
readonly subAccountId: SubAccountId
|
|
511
|
+
readonly subAccountId: SubAccountId;
|
|
524
512
|
};
|
|
525
513
|
type RenameSubAccountInput = {
|
|
526
|
-
readonly subAccountId: SubAccountId
|
|
514
|
+
readonly subAccountId: SubAccountId;
|
|
527
515
|
readonly name: string;
|
|
528
516
|
};
|
|
529
517
|
/**
|
|
@@ -532,7 +520,7 @@ type RenameSubAccountInput = {
|
|
|
532
520
|
* specific sub-account, addressed by its `SubAccountId` (canon
|
|
533
521
|
* `account-balance-model.md` §5, §12).
|
|
534
522
|
*/
|
|
535
|
-
type TransferEndpoint = "main" | SubAccountId
|
|
523
|
+
type TransferEndpoint = "main" | SubAccountId;
|
|
536
524
|
/**
|
|
537
525
|
* Move money between two of the SAME Account's balances (canon §12). The
|
|
538
526
|
* backend resolves the Account from auth (v1 = one Account per user), so the
|
|
@@ -543,7 +531,7 @@ type TransferEndpoint = "main" | SubAccountId$1;
|
|
|
543
531
|
type TransferInput = {
|
|
544
532
|
readonly from: TransferEndpoint;
|
|
545
533
|
readonly to: TransferEndpoint;
|
|
546
|
-
readonly amount: Money
|
|
534
|
+
readonly amount: Money;
|
|
547
535
|
};
|
|
548
536
|
/**
|
|
549
537
|
* Result of a `transfer`: the recomputed `available` (`balanceOf − Σ`), plus
|
|
@@ -551,27 +539,29 @@ type TransferInput = {
|
|
|
551
539
|
* has no stored row, so its slot is `null`.
|
|
552
540
|
*/
|
|
553
541
|
type TransferResult = {
|
|
554
|
-
readonly available: Money
|
|
555
|
-
readonly from: SubAccount
|
|
556
|
-
readonly to: SubAccount
|
|
542
|
+
readonly available: Money;
|
|
543
|
+
readonly from: SubAccount | null;
|
|
544
|
+
readonly to: SubAccount | null;
|
|
557
545
|
};
|
|
558
546
|
interface SubAccountPort {
|
|
559
|
-
create(input: CreateSubAccountInput): Effect.Effect<SubAccount
|
|
560
|
-
get(input: SubAccountIdInput): Effect.Effect<SubAccount
|
|
547
|
+
create(input: CreateSubAccountInput): Effect.Effect<SubAccount, SubAccountError, never>;
|
|
548
|
+
get(input: SubAccountIdInput): Effect.Effect<SubAccount | null, SubAccountError, never>;
|
|
561
549
|
list(input: {
|
|
562
550
|
readonly accountId: AccountId;
|
|
563
|
-
}): Effect.Effect<readonly SubAccount
|
|
564
|
-
rename(input: RenameSubAccountInput): Effect.Effect<SubAccount
|
|
551
|
+
}): Effect.Effect<readonly SubAccount[], SubAccountError, never>;
|
|
552
|
+
rename(input: RenameSubAccountInput): Effect.Effect<SubAccount, SubAccountError, never>;
|
|
565
553
|
delete(input: SubAccountIdInput): Effect.Effect<void, SubAccountError, never>;
|
|
566
554
|
transfer(input: TransferInput): Effect.Effect<TransferResult, SubAccountError, never>;
|
|
567
555
|
}
|
|
568
556
|
//#endregion
|
|
569
557
|
//#region src/flows/types.d.ts
|
|
570
558
|
/**
|
|
571
|
-
* The full
|
|
559
|
+
* The full 13-port bundle that `assembleCapxulClient` (slice 5) consumes.
|
|
560
|
+
* (Was 15 before the dead local-signer port was retired; the deploy path
|
|
561
|
+
* now signs exclusively through `CapxulSigner`.)
|
|
572
562
|
*
|
|
573
563
|
* Each per-flow factory in slices 2-4 takes a narrowed subset, e.g.
|
|
574
|
-
* `AuthFlowPorts = Pick<FlowPorts, "authClient" | "
|
|
564
|
+
* `AuthFlowPorts = Pick<FlowPorts, "authClient" | "clock" | "telemetry">`.
|
|
575
565
|
* Slice 1 ships only the union; per Q6 each per-flow slice declares its
|
|
576
566
|
* own narrowed `Pick<FlowPorts, ...>` inside its flow file.
|
|
577
567
|
*/
|
|
@@ -584,7 +574,6 @@ interface FlowPorts {
|
|
|
584
574
|
readonly subAccount: SubAccountPort;
|
|
585
575
|
readonly credentials: CredentialsPort;
|
|
586
576
|
readonly bootstrap: BootstrapPort;
|
|
587
|
-
readonly evmSigner: EvmSignerPort;
|
|
588
577
|
readonly clock: ClockPort;
|
|
589
578
|
readonly env: EnvPort;
|
|
590
579
|
readonly telemetry: TelemetryPort;
|
|
@@ -623,7 +612,7 @@ interface FlowPorts {
|
|
|
623
612
|
* convention, flow-shape composites stay co-located with their flow.
|
|
624
613
|
*/
|
|
625
614
|
interface ExternalSigner {
|
|
626
|
-
readonly address: Address
|
|
615
|
+
readonly address: Address;
|
|
627
616
|
readonly signedProof: string;
|
|
628
617
|
}
|
|
629
618
|
//#endregion
|
|
@@ -668,6 +657,1024 @@ interface IdentityMethods {
|
|
|
668
657
|
}): Promise<CapxulResult<Profile | null>>;
|
|
669
658
|
}
|
|
670
659
|
//#endregion
|
|
660
|
+
//#region src/client/account-lane.d.ts
|
|
661
|
+
type ProvisioningFailureStep = "wallet" | "identity" | "provision" | "deploy";
|
|
662
|
+
type ProvisioningPhase = {
|
|
663
|
+
readonly status: "idle";
|
|
664
|
+
} | {
|
|
665
|
+
readonly status: "wallet";
|
|
666
|
+
} | {
|
|
667
|
+
readonly status: "identity";
|
|
668
|
+
} | {
|
|
669
|
+
readonly status: "provision";
|
|
670
|
+
} | {
|
|
671
|
+
readonly status: "deploy";
|
|
672
|
+
} | {
|
|
673
|
+
readonly status: "ready";
|
|
674
|
+
} | {
|
|
675
|
+
readonly status: "failed";
|
|
676
|
+
readonly at: ProvisioningFailureStep;
|
|
677
|
+
readonly error: CapxulError;
|
|
678
|
+
};
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/client/account-lifecycle.d.ts
|
|
681
|
+
type AccountSetupStep = "connecting" | "confirmingIdentity" | "registering" | "activating";
|
|
682
|
+
type AccountLifecycle = {
|
|
683
|
+
readonly status: "loading";
|
|
684
|
+
} | {
|
|
685
|
+
readonly status: "settingUp";
|
|
686
|
+
readonly step: AccountSetupStep;
|
|
687
|
+
} | {
|
|
688
|
+
readonly status: "ready";
|
|
689
|
+
readonly accountId: string;
|
|
690
|
+
readonly canTransact: boolean;
|
|
691
|
+
} | {
|
|
692
|
+
readonly status: "failed";
|
|
693
|
+
readonly at: AccountSetupStep;
|
|
694
|
+
readonly error: CapxulError;
|
|
695
|
+
};
|
|
696
|
+
declare function isSettingUpLifecycle(lifecycle: AccountLifecycle): boolean;
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region ../wire/src/financial-ops.d.ts
|
|
699
|
+
declare const AttachablePaymentDocumentEnvelope: Schema.Union<[Schema.Struct<{
|
|
700
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
701
|
+
version: Schema.Literal<[1]>;
|
|
702
|
+
domain: Schema.Struct<{
|
|
703
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
704
|
+
version: Schema.Literal<["1"]>;
|
|
705
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
706
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
707
|
+
}>;
|
|
708
|
+
primaryType: Schema.Literal<["Memo"]>;
|
|
709
|
+
message: Schema.Struct<{
|
|
710
|
+
kind: Schema.Literal<[0]>;
|
|
711
|
+
reference: typeof Schema.String;
|
|
712
|
+
note: typeof Schema.String;
|
|
713
|
+
issuedAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
714
|
+
}>;
|
|
715
|
+
}>, Schema.Struct<{
|
|
716
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
717
|
+
version: Schema.Literal<[1]>;
|
|
718
|
+
domain: Schema.Struct<{
|
|
719
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
720
|
+
version: Schema.Literal<["1"]>;
|
|
721
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
722
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
723
|
+
}>;
|
|
724
|
+
primaryType: Schema.Literal<["Invoice"]>;
|
|
725
|
+
message: Schema.Struct<{
|
|
726
|
+
kind: Schema.Literal<[1]>;
|
|
727
|
+
invoiceNumber: typeof Schema.String;
|
|
728
|
+
payerRef: typeof Schema.String;
|
|
729
|
+
payeeRef: typeof Schema.String;
|
|
730
|
+
amount: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
731
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
732
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
733
|
+
issuedAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
734
|
+
dueAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
735
|
+
lineItemsHash: Schema.Schema<DocumentHash, string, never>;
|
|
736
|
+
}>;
|
|
737
|
+
}>, Schema.Struct<{
|
|
738
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
739
|
+
version: Schema.Literal<[1]>;
|
|
740
|
+
domain: Schema.Struct<{
|
|
741
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
742
|
+
version: Schema.Literal<["1"]>;
|
|
743
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
744
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
745
|
+
}>;
|
|
746
|
+
primaryType: Schema.Literal<["Payslip"]>;
|
|
747
|
+
message: Schema.Struct<{
|
|
748
|
+
kind: Schema.Literal<[2]>;
|
|
749
|
+
employerRef: typeof Schema.String;
|
|
750
|
+
employeeRef: typeof Schema.String;
|
|
751
|
+
period: typeof Schema.String;
|
|
752
|
+
gross: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
753
|
+
net: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
754
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
755
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
756
|
+
issuedAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
757
|
+
}>;
|
|
758
|
+
}>, Schema.Struct<{
|
|
759
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
760
|
+
version: Schema.Literal<[1]>;
|
|
761
|
+
domain: Schema.Struct<{
|
|
762
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
763
|
+
version: Schema.Literal<["1"]>;
|
|
764
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
765
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
766
|
+
}>;
|
|
767
|
+
primaryType: Schema.Literal<["Receipt"]>;
|
|
768
|
+
message: Schema.Struct<{
|
|
769
|
+
kind: Schema.Literal<[3]>;
|
|
770
|
+
reference: typeof Schema.String;
|
|
771
|
+
amount: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
772
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
773
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
774
|
+
paidAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
775
|
+
note: typeof Schema.String;
|
|
776
|
+
}>;
|
|
777
|
+
}>]>;
|
|
778
|
+
declare const WithdrawalDocumentEnvelope: Schema.Struct<{
|
|
779
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
780
|
+
version: Schema.Literal<[1]>;
|
|
781
|
+
domain: Schema.Struct<{
|
|
782
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
783
|
+
version: Schema.Literal<["1"]>;
|
|
784
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
785
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
786
|
+
}>;
|
|
787
|
+
primaryType: Schema.Literal<["Withdrawal"]>;
|
|
788
|
+
message: Schema.Struct<{
|
|
789
|
+
kind: Schema.Literal<[4]>;
|
|
790
|
+
reference: typeof Schema.String;
|
|
791
|
+
amount: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
792
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
793
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
794
|
+
destChain: Schema.Schema<ChainId, number, never>;
|
|
795
|
+
destAddress: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
796
|
+
settledAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
797
|
+
provider: typeof Schema.String;
|
|
798
|
+
note: typeof Schema.String;
|
|
799
|
+
}>;
|
|
800
|
+
}>;
|
|
801
|
+
declare const PaymentDocumentEnvelope: Schema.Union<[Schema.Union<[Schema.Struct<{
|
|
802
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
803
|
+
version: Schema.Literal<[1]>;
|
|
804
|
+
domain: Schema.Struct<{
|
|
805
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
806
|
+
version: Schema.Literal<["1"]>;
|
|
807
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
808
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
809
|
+
}>;
|
|
810
|
+
primaryType: Schema.Literal<["Memo"]>;
|
|
811
|
+
message: Schema.Struct<{
|
|
812
|
+
kind: Schema.Literal<[0]>;
|
|
813
|
+
reference: typeof Schema.String;
|
|
814
|
+
note: typeof Schema.String;
|
|
815
|
+
issuedAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
816
|
+
}>;
|
|
817
|
+
}>, Schema.Struct<{
|
|
818
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
819
|
+
version: Schema.Literal<[1]>;
|
|
820
|
+
domain: Schema.Struct<{
|
|
821
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
822
|
+
version: Schema.Literal<["1"]>;
|
|
823
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
824
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
825
|
+
}>;
|
|
826
|
+
primaryType: Schema.Literal<["Invoice"]>;
|
|
827
|
+
message: Schema.Struct<{
|
|
828
|
+
kind: Schema.Literal<[1]>;
|
|
829
|
+
invoiceNumber: typeof Schema.String;
|
|
830
|
+
payerRef: typeof Schema.String;
|
|
831
|
+
payeeRef: typeof Schema.String;
|
|
832
|
+
amount: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
833
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
834
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
835
|
+
issuedAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
836
|
+
dueAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
837
|
+
lineItemsHash: Schema.Schema<DocumentHash, string, never>;
|
|
838
|
+
}>;
|
|
839
|
+
}>, Schema.Struct<{
|
|
840
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
841
|
+
version: Schema.Literal<[1]>;
|
|
842
|
+
domain: Schema.Struct<{
|
|
843
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
844
|
+
version: Schema.Literal<["1"]>;
|
|
845
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
846
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
847
|
+
}>;
|
|
848
|
+
primaryType: Schema.Literal<["Payslip"]>;
|
|
849
|
+
message: Schema.Struct<{
|
|
850
|
+
kind: Schema.Literal<[2]>;
|
|
851
|
+
employerRef: typeof Schema.String;
|
|
852
|
+
employeeRef: typeof Schema.String;
|
|
853
|
+
period: typeof Schema.String;
|
|
854
|
+
gross: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
855
|
+
net: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
856
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
857
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
858
|
+
issuedAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
859
|
+
}>;
|
|
860
|
+
}>, Schema.Struct<{
|
|
861
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
862
|
+
version: Schema.Literal<[1]>;
|
|
863
|
+
domain: Schema.Struct<{
|
|
864
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
865
|
+
version: Schema.Literal<["1"]>;
|
|
866
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
867
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
868
|
+
}>;
|
|
869
|
+
primaryType: Schema.Literal<["Receipt"]>;
|
|
870
|
+
message: Schema.Struct<{
|
|
871
|
+
kind: Schema.Literal<[3]>;
|
|
872
|
+
reference: typeof Schema.String;
|
|
873
|
+
amount: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
874
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
875
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
876
|
+
paidAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
877
|
+
note: typeof Schema.String;
|
|
878
|
+
}>;
|
|
879
|
+
}>]>, Schema.Struct<{
|
|
880
|
+
protocol: Schema.Literal<["capxul.payment-document"]>;
|
|
881
|
+
version: Schema.Literal<[1]>;
|
|
882
|
+
domain: Schema.Struct<{
|
|
883
|
+
name: Schema.Literal<["CapxulPayments"]>;
|
|
884
|
+
version: Schema.Literal<["1"]>;
|
|
885
|
+
chainId: Schema.Schema<ChainId, number, never>;
|
|
886
|
+
verifyingContract: Schema.Literal<["0xe740ea65521edc9bef0ea75d30b5334711db99f4"]>;
|
|
887
|
+
}>;
|
|
888
|
+
primaryType: Schema.Literal<["Withdrawal"]>;
|
|
889
|
+
message: Schema.Struct<{
|
|
890
|
+
kind: Schema.Literal<[4]>;
|
|
891
|
+
reference: typeof Schema.String;
|
|
892
|
+
amount: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
893
|
+
currency: Schema.Schema<CurrencyCode, string, never>;
|
|
894
|
+
decimals: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
895
|
+
destChain: Schema.Schema<ChainId, number, never>;
|
|
896
|
+
destAddress: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
897
|
+
settledAt: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
898
|
+
provider: typeof Schema.String;
|
|
899
|
+
note: typeof Schema.String;
|
|
900
|
+
}>;
|
|
901
|
+
}>]>;
|
|
902
|
+
/**
|
|
903
|
+
* #592 invoice line item. `quantity` is a positive integer; `unitMinor` is the
|
|
904
|
+
* per-unit price in integer minor units. The list is canonically hashed by
|
|
905
|
+
* `hashLineItems` (payment-document-hash.ts) into the Invoice `lineItemsHash`,
|
|
906
|
+
* and Σ(quantity × unitMinor) MUST equal the invoice `amount`. The hash binds
|
|
907
|
+
* the documentHash to the exact items; the sum-check makes the items add up to
|
|
908
|
+
* the amount due. See the payment-document spec (canon/mcp/financial-ops.md).
|
|
909
|
+
*/
|
|
910
|
+
declare const LineItem: Schema.Struct<{
|
|
911
|
+
description: typeof Schema.String;
|
|
912
|
+
quantity: Schema.refine<number, Schema.Schema<number, number, never>>;
|
|
913
|
+
unitMinor: Schema.refine<string, Schema.Schema<string, string, never>>;
|
|
914
|
+
}>;
|
|
915
|
+
type AttachablePaymentDocumentEnvelopeV1 = Schema.Schema.Type<typeof AttachablePaymentDocumentEnvelope>;
|
|
916
|
+
type PaymentDocumentEnvelopeV1 = Schema.Schema.Type<typeof PaymentDocumentEnvelope>;
|
|
917
|
+
type WithdrawalDocumentEnvelopeV1 = Schema.Schema.Type<typeof WithdrawalDocumentEnvelope>;
|
|
918
|
+
type LineItemV1 = Schema.Schema.Type<typeof LineItem>;
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region ../wire/src/leak-safety.d.ts
|
|
921
|
+
declare const OnchainEvidenceBrand: unique symbol;
|
|
922
|
+
/**
|
|
923
|
+
* The branded `{ userOpHash, txHash }` pair. On-chain settlement evidence is
|
|
924
|
+
* INTERNAL — it flows on the server-internal channel only, never onto a wire
|
|
925
|
+
* Payment or any MCP tool output. The brand makes "this is internal evidence"
|
|
926
|
+
* a type, so a loose pair can't be passed where a wire field is expected.
|
|
927
|
+
*/
|
|
928
|
+
type OnchainEvidence = {
|
|
929
|
+
readonly userOpHash: string;
|
|
930
|
+
readonly txHash: string;
|
|
931
|
+
} & {
|
|
932
|
+
readonly [OnchainEvidenceBrand]: "OnchainEvidence";
|
|
933
|
+
};
|
|
934
|
+
//#endregion
|
|
935
|
+
//#region src/client/financial-ops.d.ts
|
|
936
|
+
type RecipientResolutionKind = "email" | "org" | "payee";
|
|
937
|
+
type Ref = {
|
|
938
|
+
readonly kind: "handle";
|
|
939
|
+
readonly handle: string;
|
|
940
|
+
} | {
|
|
941
|
+
readonly kind: "email";
|
|
942
|
+
readonly email: string;
|
|
943
|
+
} | {
|
|
944
|
+
readonly kind: "orgHandle";
|
|
945
|
+
readonly orgHandle: string;
|
|
946
|
+
} | {
|
|
947
|
+
readonly kind: "capxulUserId";
|
|
948
|
+
readonly capxulUserId: string;
|
|
949
|
+
} | {
|
|
950
|
+
readonly kind: "payeeId";
|
|
951
|
+
readonly payeeId: string;
|
|
952
|
+
};
|
|
953
|
+
interface MeProfile {
|
|
954
|
+
readonly authUserId: string;
|
|
955
|
+
readonly email: string;
|
|
956
|
+
readonly displayName: string | null;
|
|
957
|
+
}
|
|
958
|
+
interface DepositInstructions {
|
|
959
|
+
readonly accountKind: "personalSafe" | "orgTreasury";
|
|
960
|
+
readonly chainId: number;
|
|
961
|
+
readonly network: "base-sepolia";
|
|
962
|
+
readonly currency: "USD";
|
|
963
|
+
readonly address: string;
|
|
964
|
+
readonly label: string;
|
|
965
|
+
}
|
|
966
|
+
interface RecipientResolution {
|
|
967
|
+
readonly kind: RecipientResolutionKind;
|
|
968
|
+
readonly recipient: string;
|
|
969
|
+
readonly label: string;
|
|
970
|
+
readonly safeAddress: string;
|
|
971
|
+
readonly payeeId?: string;
|
|
972
|
+
readonly orgId?: string;
|
|
973
|
+
readonly handle?: string;
|
|
974
|
+
readonly email?: string;
|
|
975
|
+
}
|
|
976
|
+
interface Payee {
|
|
977
|
+
readonly payeeId: string;
|
|
978
|
+
readonly label: string;
|
|
979
|
+
readonly recipientRef: string;
|
|
980
|
+
readonly handle: string | null;
|
|
981
|
+
readonly destinationKind: "email" | "org" | "payeeHandle";
|
|
982
|
+
readonly safeAddress: string;
|
|
983
|
+
readonly createdAt: number;
|
|
984
|
+
readonly updatedAt: number;
|
|
985
|
+
}
|
|
986
|
+
interface MeMethods {
|
|
987
|
+
get(options?: {
|
|
988
|
+
readonly signal?: AbortSignal;
|
|
989
|
+
}): Promise<CapxulResult<MeProfile>>;
|
|
990
|
+
depositInstructions(options?: {
|
|
991
|
+
readonly signal?: AbortSignal;
|
|
992
|
+
}): Promise<CapxulResult<DepositInstructions>>;
|
|
993
|
+
}
|
|
994
|
+
interface HandlesMethods {
|
|
995
|
+
resolve(handle: string, options?: {
|
|
996
|
+
readonly signal?: AbortSignal;
|
|
997
|
+
}): Promise<CapxulResult<RecipientResolution>>;
|
|
998
|
+
}
|
|
999
|
+
interface PayeesMethods {
|
|
1000
|
+
create(input: {
|
|
1001
|
+
readonly label: string;
|
|
1002
|
+
readonly recipient: string;
|
|
1003
|
+
readonly handle?: string;
|
|
1004
|
+
}, options?: {
|
|
1005
|
+
readonly signal?: AbortSignal;
|
|
1006
|
+
}): Promise<CapxulResult<Payee>>;
|
|
1007
|
+
get(payeeId: string, options?: {
|
|
1008
|
+
readonly signal?: AbortSignal;
|
|
1009
|
+
}): Promise<CapxulResult<Payee | null>>;
|
|
1010
|
+
resolve(recipient: string, options?: {
|
|
1011
|
+
readonly signal?: AbortSignal;
|
|
1012
|
+
}): Promise<CapxulResult<RecipientResolution>>;
|
|
1013
|
+
}
|
|
1014
|
+
interface PaymentMoney {
|
|
1015
|
+
readonly currency: string;
|
|
1016
|
+
readonly value: string;
|
|
1017
|
+
readonly decimals: number;
|
|
1018
|
+
}
|
|
1019
|
+
type PaymentStatus = "pending" | "submitted" | "pending_claim" | "scheduled" | "streaming" | "settled" | "cancelled" | "redirected" | "expired" | "failed";
|
|
1020
|
+
type PaymentType = "unspecified" | "invoice" | "payroll" | "reimbursement";
|
|
1021
|
+
interface PaymentDocumentRef {
|
|
1022
|
+
readonly documentHash: string;
|
|
1023
|
+
readonly kind: "memo" | "invoice" | "payslip" | "receipt" | "withdrawal";
|
|
1024
|
+
readonly title?: string;
|
|
1025
|
+
readonly uri?: string;
|
|
1026
|
+
readonly issuedAt?: number;
|
|
1027
|
+
}
|
|
1028
|
+
type PaymentTiming = {
|
|
1029
|
+
readonly kind: "instant";
|
|
1030
|
+
} | {
|
|
1031
|
+
readonly kind: "scheduled";
|
|
1032
|
+
readonly at: number;
|
|
1033
|
+
} | {
|
|
1034
|
+
readonly kind: "stream";
|
|
1035
|
+
readonly startsAt: number;
|
|
1036
|
+
readonly endsAt: number;
|
|
1037
|
+
readonly cliffAt?: number;
|
|
1038
|
+
};
|
|
1039
|
+
interface Payment {
|
|
1040
|
+
readonly id: string;
|
|
1041
|
+
readonly status: PaymentStatus;
|
|
1042
|
+
readonly amount: PaymentMoney;
|
|
1043
|
+
readonly paymentType: PaymentType;
|
|
1044
|
+
readonly recipient: {
|
|
1045
|
+
readonly kind: "handle" | "email" | "payee" | "capxulUserId" | "me" | "org" | "external_address";
|
|
1046
|
+
readonly label: string;
|
|
1047
|
+
readonly payeeId?: string;
|
|
1048
|
+
};
|
|
1049
|
+
readonly documents: readonly PaymentDocumentRef[];
|
|
1050
|
+
readonly timing: PaymentTiming;
|
|
1051
|
+
readonly released: PaymentMoney;
|
|
1052
|
+
readonly availableToClaim: PaymentMoney;
|
|
1053
|
+
readonly createdAt: number;
|
|
1054
|
+
readonly updatedAt: number;
|
|
1055
|
+
}
|
|
1056
|
+
interface PaymentsPayInput {
|
|
1057
|
+
readonly to: Ref;
|
|
1058
|
+
readonly amount: PaymentMoney;
|
|
1059
|
+
/** Full EIP-712 document envelope; hashed + stored, committed on-chain. */
|
|
1060
|
+
readonly document?: AttachablePaymentDocumentEnvelopeV1;
|
|
1061
|
+
/**
|
|
1062
|
+
* Timing clause (D-SHAPE · #646). Omitted ⇒ `instant` (the G2 direct-send path).
|
|
1063
|
+
* A `scheduled`/`stream` clause turns the payment into a Commitment
|
|
1064
|
+
* (escrow-vest-claim) backed by `CapxulPayments.createCommitment`.
|
|
1065
|
+
*/
|
|
1066
|
+
readonly timing?: PaymentTiming;
|
|
1067
|
+
/**
|
|
1068
|
+
* #592: itemized line items backing an Invoice `document`. The backend asserts
|
|
1069
|
+
* `hashLineItems(lineItems) === document.lineItemsHash` AND `Σ(quantity ×
|
|
1070
|
+
* unitMinor) === document.amount`, then persists the list for itemized render.
|
|
1071
|
+
*/
|
|
1072
|
+
readonly lineItems?: readonly LineItemV1[];
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* B3 withdraw / cash-out input. Stripe-shaped: `to` is the EXTERNAL 0x wallet
|
|
1076
|
+
* (the ONE place the SDK accepts a raw address — the pay lane never does),
|
|
1077
|
+
* `amount` is a Money, `document` is the REQUIRED kind:4 Withdrawal envelope
|
|
1078
|
+
* (carries the audit-visible destAddress). No chain / Safe / token / hash
|
|
1079
|
+
* custody substrate on the input. Returns a leak-safe `Payment` whose recipient
|
|
1080
|
+
* label is the redacted address — never the full 0x.
|
|
1081
|
+
*/
|
|
1082
|
+
interface PaymentsWithdrawInput {
|
|
1083
|
+
readonly to: string;
|
|
1084
|
+
readonly amount: PaymentMoney;
|
|
1085
|
+
readonly document: WithdrawalDocumentEnvelopeV1;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Payout via a saved destination. The caller selects the destination by opaque
|
|
1089
|
+
* id and never re-enters a raw wallet address on this path.
|
|
1090
|
+
*/
|
|
1091
|
+
interface PaymentsPayoutInput {
|
|
1092
|
+
readonly actor?: {
|
|
1093
|
+
readonly kind: "account";
|
|
1094
|
+
} | {
|
|
1095
|
+
readonly kind: "org";
|
|
1096
|
+
readonly orgId: string;
|
|
1097
|
+
};
|
|
1098
|
+
readonly destinationId: string;
|
|
1099
|
+
readonly amount: PaymentMoney;
|
|
1100
|
+
}
|
|
1101
|
+
type DestinationKind = "bank" | "mobile-money" | "wallet";
|
|
1102
|
+
type DestinationPayload = {
|
|
1103
|
+
readonly accountHolderName: string;
|
|
1104
|
+
readonly bankName: string;
|
|
1105
|
+
readonly country: string;
|
|
1106
|
+
readonly currency: string;
|
|
1107
|
+
readonly accountNumberLast4: string;
|
|
1108
|
+
} | {
|
|
1109
|
+
readonly provider: string;
|
|
1110
|
+
readonly country: string;
|
|
1111
|
+
readonly currency: string;
|
|
1112
|
+
readonly phoneNumberLast4: string;
|
|
1113
|
+
} | {
|
|
1114
|
+
readonly network: "base-sepolia";
|
|
1115
|
+
readonly address: string;
|
|
1116
|
+
};
|
|
1117
|
+
interface Destination {
|
|
1118
|
+
readonly id: string;
|
|
1119
|
+
readonly counterpartyId: string;
|
|
1120
|
+
readonly ref: Ref;
|
|
1121
|
+
readonly kind: DestinationKind;
|
|
1122
|
+
readonly label: string | null;
|
|
1123
|
+
readonly payload: DestinationPayload;
|
|
1124
|
+
readonly createdAt: number;
|
|
1125
|
+
readonly updatedAt: number;
|
|
1126
|
+
}
|
|
1127
|
+
interface DestinationAddInput {
|
|
1128
|
+
readonly actor?: {
|
|
1129
|
+
readonly kind: "account";
|
|
1130
|
+
} | {
|
|
1131
|
+
readonly kind: "org";
|
|
1132
|
+
readonly orgId: string;
|
|
1133
|
+
};
|
|
1134
|
+
readonly ref: Ref;
|
|
1135
|
+
readonly kind: DestinationKind;
|
|
1136
|
+
readonly label?: string;
|
|
1137
|
+
readonly payload: DestinationPayload;
|
|
1138
|
+
}
|
|
1139
|
+
interface DestinationListInput {
|
|
1140
|
+
readonly actor?: {
|
|
1141
|
+
readonly kind: "account";
|
|
1142
|
+
} | {
|
|
1143
|
+
readonly kind: "org";
|
|
1144
|
+
readonly orgId: string;
|
|
1145
|
+
};
|
|
1146
|
+
readonly ref: Ref;
|
|
1147
|
+
}
|
|
1148
|
+
interface DestinationRemoveInput {
|
|
1149
|
+
readonly actor?: {
|
|
1150
|
+
readonly kind: "account";
|
|
1151
|
+
} | {
|
|
1152
|
+
readonly kind: "org";
|
|
1153
|
+
readonly orgId: string;
|
|
1154
|
+
};
|
|
1155
|
+
readonly destinationId: string;
|
|
1156
|
+
}
|
|
1157
|
+
interface DestinationsMethods {
|
|
1158
|
+
add(input: DestinationAddInput, options?: {
|
|
1159
|
+
readonly signal?: AbortSignal;
|
|
1160
|
+
}): Promise<CapxulResult<Destination>>;
|
|
1161
|
+
list(input: DestinationListInput, options?: {
|
|
1162
|
+
readonly signal?: AbortSignal;
|
|
1163
|
+
}): Promise<CapxulResult<readonly Destination[]>>;
|
|
1164
|
+
remove(input: DestinationRemoveInput, options?: {
|
|
1165
|
+
readonly signal?: AbortSignal;
|
|
1166
|
+
}): Promise<CapxulResult<{
|
|
1167
|
+
readonly id: string;
|
|
1168
|
+
}>>;
|
|
1169
|
+
}
|
|
1170
|
+
interface PaymentSettlementInput {
|
|
1171
|
+
readonly paymentId: string;
|
|
1172
|
+
readonly evidence: OnchainEvidence;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Host-execution callback recording the on-chain escrow of a commitment
|
|
1176
|
+
* (G3 · #546): `createCommitment` returned `onchainCommitmentId`, escrowing
|
|
1177
|
+
* the total. `onchainCommitmentId` + the userOp/tx hashes are internal evidence,
|
|
1178
|
+
* never on the wire (internal channel only).
|
|
1179
|
+
*/
|
|
1180
|
+
interface CommitmentCreatedInput {
|
|
1181
|
+
readonly paymentId: string;
|
|
1182
|
+
readonly onchainCommitmentId: string;
|
|
1183
|
+
readonly evidence: OnchainEvidence;
|
|
1184
|
+
}
|
|
1185
|
+
/** Host-execution callback recording a recipient-side `claim` (G3 · #546). */
|
|
1186
|
+
interface CommitmentClaimInput {
|
|
1187
|
+
readonly paymentId: string;
|
|
1188
|
+
readonly evidence: OnchainEvidence;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Host-execution callback recording a creator-side `cancel` (G3 · #546):
|
|
1192
|
+
* on-chain the unvested remainder returns to the creator; vested-unclaimed
|
|
1193
|
+
* stays the recipient's. An optional credit-note document is appended.
|
|
1194
|
+
*/
|
|
1195
|
+
interface CommitmentCancelInput {
|
|
1196
|
+
readonly paymentId: string;
|
|
1197
|
+
readonly evidence: OnchainEvidence;
|
|
1198
|
+
readonly document?: PaymentDocumentEnvelopeV1;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Host-execution callback recording a pre-claim `redirect` to a new validated
|
|
1202
|
+
* recipient (G3 · #546). `to` is a validated recipient (handle/email/payee id),
|
|
1203
|
+
* never a raw address.
|
|
1204
|
+
*/
|
|
1205
|
+
interface CommitmentRedirectInput {
|
|
1206
|
+
readonly paymentId: string;
|
|
1207
|
+
readonly to: Ref;
|
|
1208
|
+
readonly evidence: OnchainEvidence;
|
|
1209
|
+
readonly document?: PaymentDocumentEnvelopeV1;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Host-execution callback recording a settled ORG spend/payroll on the ONE
|
|
1213
|
+
* `payments` ledger (D3 · #565). An org spend is a KIND of Payment — it lands a
|
|
1214
|
+
* real `payments` row with `source:"org"` + `orgId` (no parallel `orgSpends`
|
|
1215
|
+
* table, no synthetic client-side fabrication). The signer-side host calls this
|
|
1216
|
+
* AFTER the on-chain Roles-modifier spend settles; `evidence` carries the
|
|
1217
|
+
* internal userOp/tx hashes (never wire fields). `recipient` is the validated
|
|
1218
|
+
* recipient ref label; `recipientSafeAddress` is internal evidence on the row.
|
|
1219
|
+
*/
|
|
1220
|
+
interface OrgPaymentRecordInput {
|
|
1221
|
+
readonly orgId: string;
|
|
1222
|
+
readonly recipientLabel: string;
|
|
1223
|
+
readonly recipientKind?: "handle" | "email" | "payee" | "capxulUserId" | "me" | "org";
|
|
1224
|
+
readonly recipientRef?: string;
|
|
1225
|
+
readonly recipientPayeeId?: string;
|
|
1226
|
+
readonly recipientSafeAddress: string;
|
|
1227
|
+
readonly amount: PaymentMoney;
|
|
1228
|
+
readonly paymentType: PaymentType;
|
|
1229
|
+
readonly document?: PaymentDocumentEnvelopeV1;
|
|
1230
|
+
/** The org Safe the spend debited — bound as the `from` of the settlement transfer. */
|
|
1231
|
+
readonly orgSafeAddress: string;
|
|
1232
|
+
/**
|
|
1233
|
+
* 0-based occurrence among batch runs with the same (recipient, amount), so
|
|
1234
|
+
* each run binds to + de-dupes on its own on-chain `Transfer` (D3 · #565).
|
|
1235
|
+
*/
|
|
1236
|
+
readonly occurrenceIndex: number;
|
|
1237
|
+
readonly evidence: OnchainEvidence;
|
|
1238
|
+
}
|
|
1239
|
+
interface PaymentDocumentVerification {
|
|
1240
|
+
readonly documentHash: string;
|
|
1241
|
+
readonly ok: boolean;
|
|
1242
|
+
readonly derivedHash: string;
|
|
1243
|
+
readonly kind: "memo" | "invoice" | "payslip" | "receipt" | "withdrawal";
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* #577 render-on-demand result. `html` is self-contained user-visible document
|
|
1247
|
+
* HTML (stylesheet + rendered document). The MCP `paymentDocuments.render` tool
|
|
1248
|
+
* exposes only `{documentHash, kind, ok}` to the model and returns `html` in an
|
|
1249
|
+
* audience:["user"] content block (#506 redaction matrix).
|
|
1250
|
+
*/
|
|
1251
|
+
interface PaymentDocumentRender {
|
|
1252
|
+
readonly documentHash: string;
|
|
1253
|
+
readonly ok: boolean;
|
|
1254
|
+
readonly kind: "memo" | "invoice" | "payslip" | "receipt" | "withdrawal";
|
|
1255
|
+
readonly html: string;
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Internal commitment execution reference (G3 · #546). The on-chain
|
|
1259
|
+
* `onchainCommitmentId` is internal evidence (like userOp/tx hashes) — it never
|
|
1260
|
+
* appears on the wire `Payment` or any MCP tool output, but the signer-side host
|
|
1261
|
+
* needs it to build a claim/cancel/redirect UserOp. This is the server-internal
|
|
1262
|
+
* channel that carries it (and the recipient Safe address for an auto-claim
|
|
1263
|
+
* relayer), never a consumer-facing surface.
|
|
1264
|
+
*/
|
|
1265
|
+
interface PaymentCommitmentRef {
|
|
1266
|
+
readonly paymentId: string;
|
|
1267
|
+
readonly onchainCommitmentId: string | null;
|
|
1268
|
+
readonly status: PaymentStatus;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* The host-execution + on-chain-evidence channel for Payments (D2 · #564).
|
|
1272
|
+
* SPLIT OFF the public `PaymentsMethods` so an external builder consuming
|
|
1273
|
+
* `@capxul/sdk` directly never sees the custody substrate. Reached only via
|
|
1274
|
+
* `client.payments._internal` (mirrors `client._internal.*`); the signer-side
|
|
1275
|
+
* host (the dev MCP edge / a self-custody integrator) drives it AFTER executing
|
|
1276
|
+
* a UserOp. Every input carries the `OnchainEvidence` brand — never a wire field.
|
|
1277
|
+
*/
|
|
1278
|
+
interface PaymentsInternalMethods {
|
|
1279
|
+
/** Report on-chain settlement evidence for an instant payment. */
|
|
1280
|
+
markSettled(input: PaymentSettlementInput, options?: {
|
|
1281
|
+
readonly signal?: AbortSignal;
|
|
1282
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1283
|
+
/**
|
|
1284
|
+
* B3: report on-chain settlement evidence for a withdraw/cash-out. The
|
|
1285
|
+
* backend binds the userOp to a matching external `Transfer` before settling.
|
|
1286
|
+
*/
|
|
1287
|
+
markWithdrawalSettled(input: PaymentSettlementInput, options?: {
|
|
1288
|
+
readonly signal?: AbortSignal;
|
|
1289
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Record the on-chain escrow of a commitment after `createCommitment` returns
|
|
1292
|
+
* its `onchainCommitmentId` (G3 · #546).
|
|
1293
|
+
*/
|
|
1294
|
+
markCommitmentCreated(input: CommitmentCreatedInput, options?: {
|
|
1295
|
+
readonly signal?: AbortSignal;
|
|
1296
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Record a settled ORG spend/payroll on the one `payments` ledger
|
|
1299
|
+
* (D3 · #565) — `source:"org"` + `orgId`, read back as a leak-safe Payment.
|
|
1300
|
+
*/
|
|
1301
|
+
recordOrgPayment(input: OrgPaymentRecordInput, options?: {
|
|
1302
|
+
readonly signal?: AbortSignal;
|
|
1303
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1304
|
+
/** Record a recipient-side `claim` after the on-chain claim UserOp settles. */
|
|
1305
|
+
claim(input: CommitmentClaimInput, options?: {
|
|
1306
|
+
readonly signal?: AbortSignal;
|
|
1307
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1308
|
+
/** Record a creator-side `cancel` reclaiming only the unvested remainder. */
|
|
1309
|
+
cancel(input: CommitmentCancelInput, options?: {
|
|
1310
|
+
readonly signal?: AbortSignal;
|
|
1311
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1312
|
+
/** Record a pre-claim `redirect` to a new validated recipient. */
|
|
1313
|
+
redirect(input: CommitmentRedirectInput, options?: {
|
|
1314
|
+
readonly signal?: AbortSignal;
|
|
1315
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1316
|
+
/**
|
|
1317
|
+
* The on-chain commitment reference the signer-side host needs to build a
|
|
1318
|
+
* claim/cancel/redirect UserOp. `onchainCommitmentId` is internal evidence.
|
|
1319
|
+
*/
|
|
1320
|
+
commitmentRef(paymentId: string, options?: {
|
|
1321
|
+
readonly signal?: AbortSignal;
|
|
1322
|
+
}): Promise<CapxulResult<PaymentCommitmentRef | null>>;
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* The PUBLIC, Stripe-shaped Payments surface (D2 · #564). Genus verbs only —
|
|
1326
|
+
* `pay` / `list` / `get`. No `userOpHash` / `txHash` / `onchainCommitmentId` /
|
|
1327
|
+
* `chainId` / `safeAddress`. Host-execution + on-chain evidence live on the
|
|
1328
|
+
* `_internal` channel below; an external builder never touches custody substrate.
|
|
1329
|
+
*/
|
|
1330
|
+
interface PaymentsMethods {
|
|
1331
|
+
pay(input: PaymentsPayInput, options?: {
|
|
1332
|
+
readonly signal?: AbortSignal;
|
|
1333
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1334
|
+
payout(input: PaymentsPayoutInput, options?: {
|
|
1335
|
+
readonly signal?: AbortSignal;
|
|
1336
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1337
|
+
/**
|
|
1338
|
+
* B3 withdraw / cash-out: send USDX from the user's custody Safe to an
|
|
1339
|
+
* external 0x wallet, minting a kind:4 Withdrawal document. Returns a
|
|
1340
|
+
* leak-safe `Payment` (recipient label is the redacted address).
|
|
1341
|
+
*/
|
|
1342
|
+
withdraw(input: PaymentsWithdrawInput, options?: {
|
|
1343
|
+
readonly signal?: AbortSignal;
|
|
1344
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1345
|
+
list(options?: {
|
|
1346
|
+
readonly signal?: AbortSignal;
|
|
1347
|
+
}): Promise<CapxulResult<readonly Payment[]>>;
|
|
1348
|
+
get(paymentId: string, options?: {
|
|
1349
|
+
readonly signal?: AbortSignal;
|
|
1350
|
+
}): Promise<CapxulResult<Payment | null>>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Host-execution + on-chain-evidence channel — off the public surface
|
|
1353
|
+
* (production-surface-policy.md pattern). Self-custody integrators drive this;
|
|
1354
|
+
* a Stripe-shaped consumer never does.
|
|
1355
|
+
*
|
|
1356
|
+
* @internal-use
|
|
1357
|
+
*/
|
|
1358
|
+
readonly _internal: PaymentsInternalMethods;
|
|
1359
|
+
}
|
|
1360
|
+
interface PaymentDocumentsMethods {
|
|
1361
|
+
verify(documentHash: string, options?: {
|
|
1362
|
+
readonly signal?: AbortSignal;
|
|
1363
|
+
}): Promise<CapxulResult<PaymentDocumentVerification>>;
|
|
1364
|
+
/**
|
|
1365
|
+
* #577: render-on-demand. Loads the owner's stored document by `documentHash`,
|
|
1366
|
+
* re-verifies its EIP-712 hash, and renders it to self-contained HTML using the
|
|
1367
|
+
* verified stored line items. Returns `{documentHash, kind, ok, html}`.
|
|
1368
|
+
*/
|
|
1369
|
+
render(documentHash: string, options?: {
|
|
1370
|
+
readonly signal?: AbortSignal;
|
|
1371
|
+
}): Promise<CapxulResult<PaymentDocumentRender>>;
|
|
1372
|
+
}
|
|
1373
|
+
type PaymentRequestStatus = "draft" | "sent" | "viewed" | "paid" | "expired" | "cancelled";
|
|
1374
|
+
interface PaymentRequest {
|
|
1375
|
+
readonly id: string;
|
|
1376
|
+
readonly status: PaymentRequestStatus;
|
|
1377
|
+
readonly amount: PaymentMoney;
|
|
1378
|
+
readonly reference: string;
|
|
1379
|
+
readonly memo: string | null;
|
|
1380
|
+
/** Fixed-amount payment link token (HITL #519: basic, not replay-hardened). */
|
|
1381
|
+
readonly linkToken: string;
|
|
1382
|
+
/** Minimal entitlement (HITL #501): true once paid. */
|
|
1383
|
+
readonly entitlementGranted: boolean;
|
|
1384
|
+
/** The Payment this receivable settled into (set on collect). */
|
|
1385
|
+
readonly settledPaymentId: string | null;
|
|
1386
|
+
/** The receipt document committed for this receivable (set on collect). */
|
|
1387
|
+
readonly receiptDocumentHash: string | null;
|
|
1388
|
+
readonly expiresAt: number | null;
|
|
1389
|
+
readonly createdAt: number;
|
|
1390
|
+
readonly updatedAt: number;
|
|
1391
|
+
}
|
|
1392
|
+
interface ReconciliationEntry {
|
|
1393
|
+
readonly paymentRequestId: string;
|
|
1394
|
+
readonly reference: string;
|
|
1395
|
+
readonly status: "paid" | "exception";
|
|
1396
|
+
readonly settledPaymentId: string | null;
|
|
1397
|
+
readonly receiptDocumentHash: string | null;
|
|
1398
|
+
}
|
|
1399
|
+
interface PaymentRequestsCreateInput {
|
|
1400
|
+
readonly amount: PaymentMoney;
|
|
1401
|
+
readonly reference: string;
|
|
1402
|
+
readonly memo?: string;
|
|
1403
|
+
/** Optional expiry (epoch ms). HITL #519: expiry policy is a basic timestamp. */
|
|
1404
|
+
readonly expiresAt?: number;
|
|
1405
|
+
}
|
|
1406
|
+
interface PaymentRequestsMethods {
|
|
1407
|
+
/** Open a receivable in `draft` with a fixed-amount payment link. */
|
|
1408
|
+
create(input: PaymentRequestsCreateInput, options?: {
|
|
1409
|
+
readonly signal?: AbortSignal;
|
|
1410
|
+
}): Promise<CapxulResult<PaymentRequest>>;
|
|
1411
|
+
markSent(paymentRequestId: string, options?: {
|
|
1412
|
+
readonly signal?: AbortSignal;
|
|
1413
|
+
}): Promise<CapxulResult<PaymentRequest>>;
|
|
1414
|
+
markViewed(paymentRequestId: string, options?: {
|
|
1415
|
+
readonly signal?: AbortSignal;
|
|
1416
|
+
}): Promise<CapxulResult<PaymentRequest>>;
|
|
1417
|
+
cancel(paymentRequestId: string, options?: {
|
|
1418
|
+
readonly signal?: AbortSignal;
|
|
1419
|
+
}): Promise<CapxulResult<PaymentRequest>>;
|
|
1420
|
+
/**
|
|
1421
|
+
* Collect the receivable (HERMETIC until a live inbound path exists): settle
|
|
1422
|
+
* it into the Payment ledger and mint a receipt linked by `documentHash`.
|
|
1423
|
+
*/
|
|
1424
|
+
collect(paymentRequestId: string, options?: {
|
|
1425
|
+
readonly signal?: AbortSignal;
|
|
1426
|
+
}): Promise<CapxulResult<PaymentRequest>>;
|
|
1427
|
+
list(options?: {
|
|
1428
|
+
readonly signal?: AbortSignal;
|
|
1429
|
+
}): Promise<CapxulResult<readonly PaymentRequest[]>>;
|
|
1430
|
+
get(paymentRequestId: string, options?: {
|
|
1431
|
+
readonly signal?: AbortSignal;
|
|
1432
|
+
}): Promise<CapxulResult<PaymentRequest | null>>;
|
|
1433
|
+
getByLink(linkToken: string, options?: {
|
|
1434
|
+
readonly signal?: AbortSignal;
|
|
1435
|
+
}): Promise<CapxulResult<PaymentRequest | null>>;
|
|
1436
|
+
/** Inbound reconciliation: paid / exception status per receivable. */
|
|
1437
|
+
reconcile(options?: {
|
|
1438
|
+
readonly signal?: AbortSignal;
|
|
1439
|
+
}): Promise<CapxulResult<readonly ReconciliationEntry[]>>;
|
|
1440
|
+
}
|
|
1441
|
+
type PaymentDraftStatus = "draft" | "simulated" | "approval_pending" | "approved" | "executed" | "cancelled" | "expired";
|
|
1442
|
+
/** The leak-safe, model-visible draft/approval (#506). */
|
|
1443
|
+
interface PaymentDraft {
|
|
1444
|
+
readonly id: string;
|
|
1445
|
+
readonly status: PaymentDraftStatus;
|
|
1446
|
+
readonly recipient: {
|
|
1447
|
+
readonly kind: string;
|
|
1448
|
+
readonly label: string;
|
|
1449
|
+
};
|
|
1450
|
+
readonly amount: PaymentMoney;
|
|
1451
|
+
readonly documentHash: string | null;
|
|
1452
|
+
/** The canonical-plan binding fingerprint (set at approvals.request). */
|
|
1453
|
+
readonly planHash: string | null;
|
|
1454
|
+
/** The opaque read-model version the draft was simulated against (stale-state). */
|
|
1455
|
+
readonly readModelVersion: string;
|
|
1456
|
+
readonly idempotencyKey: string;
|
|
1457
|
+
readonly policyDecision: "allow" | "deny";
|
|
1458
|
+
readonly expiresAt: number | null;
|
|
1459
|
+
readonly settledPaymentId: string | null;
|
|
1460
|
+
readonly createdAt: number;
|
|
1461
|
+
readonly updatedAt: number;
|
|
1462
|
+
}
|
|
1463
|
+
interface WorkbenchDraftInput {
|
|
1464
|
+
readonly clientId: string;
|
|
1465
|
+
readonly audience: string;
|
|
1466
|
+
readonly scopes: readonly string[];
|
|
1467
|
+
readonly to: Ref;
|
|
1468
|
+
readonly amount: PaymentMoney;
|
|
1469
|
+
readonly document?: PaymentDocumentEnvelopeV1;
|
|
1470
|
+
readonly idempotencyKey: string;
|
|
1471
|
+
/** Untrusted connector/model suggestion blob (default-deny taint). */
|
|
1472
|
+
readonly tainted?: Record<string, unknown>;
|
|
1473
|
+
}
|
|
1474
|
+
interface WorkbenchMintResult {
|
|
1475
|
+
readonly approvalToken: string;
|
|
1476
|
+
readonly planHash: string;
|
|
1477
|
+
readonly expiresAt: number;
|
|
1478
|
+
}
|
|
1479
|
+
interface WorkbenchExecuteInput {
|
|
1480
|
+
readonly draftId: string;
|
|
1481
|
+
readonly clientId: string;
|
|
1482
|
+
readonly approvalToken: string;
|
|
1483
|
+
readonly readModelVersion: string;
|
|
1484
|
+
readonly userOpHash: string;
|
|
1485
|
+
readonly txHash: string;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* The decomposed workbench (G6 · #549). The edge PROPOSES (draft → simulate →
|
|
1489
|
+
* request); the BACKEND mints the one-time plan-bound token via the human's
|
|
1490
|
+
* browser (`mint`); `execute` consumes it. `mint` is the human step — the edge
|
|
1491
|
+
* normally only reaches `request`, then hands the human a browser URL.
|
|
1492
|
+
*/
|
|
1493
|
+
interface WorkbenchMethods {
|
|
1494
|
+
draft(input: WorkbenchDraftInput, options?: {
|
|
1495
|
+
readonly signal?: AbortSignal;
|
|
1496
|
+
}): Promise<CapxulResult<PaymentDraft>>;
|
|
1497
|
+
simulate(draftId: string, options?: {
|
|
1498
|
+
readonly signal?: AbortSignal;
|
|
1499
|
+
}): Promise<CapxulResult<PaymentDraft>>;
|
|
1500
|
+
requestApproval(draftId: string, options?: {
|
|
1501
|
+
readonly signal?: AbortSignal;
|
|
1502
|
+
}): Promise<CapxulResult<PaymentDraft>>;
|
|
1503
|
+
/**
|
|
1504
|
+
* THE HUMAN STEP: mint the one-time approval token (browser/approval app).
|
|
1505
|
+
* F2 (#549): the backend gates minting on a human-origin `capability` the
|
|
1506
|
+
* agent/edge does NOT possess (`CAPXUL_APPROVAL_CAPABILITY`); only the
|
|
1507
|
+
* apps/approve browser app passes it. The edge/SDK lane cannot self-approve.
|
|
1508
|
+
*/
|
|
1509
|
+
mint(draftId: string, capability: string, options?: {
|
|
1510
|
+
readonly signal?: AbortSignal;
|
|
1511
|
+
}): Promise<CapxulResult<WorkbenchMintResult>>;
|
|
1512
|
+
execute(input: WorkbenchExecuteInput, options?: {
|
|
1513
|
+
readonly signal?: AbortSignal;
|
|
1514
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1515
|
+
status(draftId: string, options?: {
|
|
1516
|
+
readonly signal?: AbortSignal;
|
|
1517
|
+
}): Promise<CapxulResult<PaymentDraft | null>>;
|
|
1518
|
+
cancel(draftId: string, options?: {
|
|
1519
|
+
readonly signal?: AbortSignal;
|
|
1520
|
+
}): Promise<CapxulResult<PaymentDraft>>;
|
|
1521
|
+
}
|
|
1522
|
+
interface FinancialOpsMethods {
|
|
1523
|
+
readonly me: MeMethods;
|
|
1524
|
+
readonly handles: HandlesMethods;
|
|
1525
|
+
readonly payees: PayeesMethods;
|
|
1526
|
+
readonly destinations: DestinationsMethods;
|
|
1527
|
+
readonly payments: PaymentsMethods;
|
|
1528
|
+
readonly paymentDocuments: PaymentDocumentsMethods;
|
|
1529
|
+
/** Receivables surface (G5 · #548). */
|
|
1530
|
+
readonly paymentRequests: PaymentRequestsMethods;
|
|
1531
|
+
/** Decomposed workbench + trust substrate (G6 · #549). */
|
|
1532
|
+
readonly workbench: WorkbenchMethods;
|
|
1533
|
+
}
|
|
1534
|
+
//#endregion
|
|
1535
|
+
//#region src/client/actor-scope.d.ts
|
|
1536
|
+
type ActorScopeRef = {
|
|
1537
|
+
readonly kind: "account";
|
|
1538
|
+
} | {
|
|
1539
|
+
readonly kind: "org";
|
|
1540
|
+
readonly orgId: string;
|
|
1541
|
+
};
|
|
1542
|
+
interface ActorProfile {
|
|
1543
|
+
readonly actor: ActorScopeRef;
|
|
1544
|
+
readonly displayName: string | null;
|
|
1545
|
+
readonly email?: string;
|
|
1546
|
+
readonly handle?: string;
|
|
1547
|
+
}
|
|
1548
|
+
interface AddressBookEntry {
|
|
1549
|
+
readonly id: string;
|
|
1550
|
+
readonly ref: Ref;
|
|
1551
|
+
readonly label: string;
|
|
1552
|
+
readonly relationship: readonly ("paid" | "paidBy" | "requested" | "member" | "employee")[];
|
|
1553
|
+
readonly hidden: boolean;
|
|
1554
|
+
}
|
|
1555
|
+
interface AddressBookAddInput {
|
|
1556
|
+
readonly ref: Ref;
|
|
1557
|
+
readonly label?: string;
|
|
1558
|
+
}
|
|
1559
|
+
interface AddressBookLabelInput {
|
|
1560
|
+
readonly entryId: string;
|
|
1561
|
+
readonly label: string;
|
|
1562
|
+
}
|
|
1563
|
+
interface AddressBookMethods {
|
|
1564
|
+
list(options?: {
|
|
1565
|
+
readonly signal?: AbortSignal;
|
|
1566
|
+
}): Promise<CapxulResult<readonly AddressBookEntry[]>>;
|
|
1567
|
+
get(entryId: string, options?: {
|
|
1568
|
+
readonly signal?: AbortSignal;
|
|
1569
|
+
}): Promise<CapxulResult<AddressBookEntry | null>>;
|
|
1570
|
+
add(input: AddressBookAddInput, options?: {
|
|
1571
|
+
readonly signal?: AbortSignal;
|
|
1572
|
+
}): Promise<CapxulResult<AddressBookEntry>>;
|
|
1573
|
+
hide(entryId: string, options?: {
|
|
1574
|
+
readonly signal?: AbortSignal;
|
|
1575
|
+
}): Promise<CapxulResult<AddressBookEntry>>;
|
|
1576
|
+
unhide(entryId: string, options?: {
|
|
1577
|
+
readonly signal?: AbortSignal;
|
|
1578
|
+
}): Promise<CapxulResult<AddressBookEntry>>;
|
|
1579
|
+
label(input: AddressBookLabelInput, options?: {
|
|
1580
|
+
readonly signal?: AbortSignal;
|
|
1581
|
+
}): Promise<CapxulResult<AddressBookEntry>>;
|
|
1582
|
+
}
|
|
1583
|
+
interface ActorRequest {
|
|
1584
|
+
readonly id: string;
|
|
1585
|
+
readonly payer?: Ref;
|
|
1586
|
+
readonly amount: PaymentMoney;
|
|
1587
|
+
readonly reference: string;
|
|
1588
|
+
readonly status: "draft" | "sent" | "viewed" | "pending_settlement" | "paid" | "declined" | "cancelled" | "expired";
|
|
1589
|
+
readonly expiresAt: number | null;
|
|
1590
|
+
}
|
|
1591
|
+
interface ActorRequestIssueInput {
|
|
1592
|
+
readonly payer: Ref;
|
|
1593
|
+
readonly amount: PaymentMoney;
|
|
1594
|
+
readonly reference: string;
|
|
1595
|
+
readonly memo?: string;
|
|
1596
|
+
readonly expiresAt?: number;
|
|
1597
|
+
}
|
|
1598
|
+
interface ActorRequestsMethods {
|
|
1599
|
+
issue(input: ActorRequestIssueInput, options?: {
|
|
1600
|
+
readonly signal?: AbortSignal;
|
|
1601
|
+
}): Promise<CapxulResult<ActorRequest>>;
|
|
1602
|
+
list(options?: {
|
|
1603
|
+
readonly signal?: AbortSignal;
|
|
1604
|
+
}): Promise<CapxulResult<readonly ActorRequest[]>>;
|
|
1605
|
+
get(requestId: string, options?: {
|
|
1606
|
+
readonly signal?: AbortSignal;
|
|
1607
|
+
}): Promise<CapxulResult<ActorRequest | null>>;
|
|
1608
|
+
cancel(requestId: string, options?: {
|
|
1609
|
+
readonly signal?: AbortSignal;
|
|
1610
|
+
}): Promise<CapxulResult<ActorRequest>>;
|
|
1611
|
+
reconcile(options?: {
|
|
1612
|
+
readonly signal?: AbortSignal;
|
|
1613
|
+
}): Promise<CapxulResult<readonly ReconciliationEntry[]>>;
|
|
1614
|
+
}
|
|
1615
|
+
interface InboxItem {
|
|
1616
|
+
readonly id: string;
|
|
1617
|
+
readonly issuer: Ref;
|
|
1618
|
+
readonly amount: PaymentMoney;
|
|
1619
|
+
readonly reference: string;
|
|
1620
|
+
readonly status: "open" | "approved" | "declined" | "paid" | "cancelled" | "expired";
|
|
1621
|
+
}
|
|
1622
|
+
interface InboxApproveInput {
|
|
1623
|
+
readonly requestId: string;
|
|
1624
|
+
readonly timing?: PaymentTiming;
|
|
1625
|
+
}
|
|
1626
|
+
interface InboxMethods {
|
|
1627
|
+
list(options?: {
|
|
1628
|
+
readonly signal?: AbortSignal;
|
|
1629
|
+
}): Promise<CapxulResult<readonly InboxItem[]>>;
|
|
1630
|
+
approve(input: InboxApproveInput, options?: {
|
|
1631
|
+
readonly signal?: AbortSignal;
|
|
1632
|
+
}): Promise<CapxulResult<Payment>>;
|
|
1633
|
+
decline(requestId: string, options?: {
|
|
1634
|
+
readonly signal?: AbortSignal;
|
|
1635
|
+
}): Promise<CapxulResult<InboxItem>>;
|
|
1636
|
+
}
|
|
1637
|
+
interface InsightsSummary {
|
|
1638
|
+
readonly pending: {
|
|
1639
|
+
readonly count: number;
|
|
1640
|
+
readonly total: PaymentMoney;
|
|
1641
|
+
};
|
|
1642
|
+
readonly paidThisMonth: {
|
|
1643
|
+
readonly count: number;
|
|
1644
|
+
readonly total: PaymentMoney;
|
|
1645
|
+
};
|
|
1646
|
+
readonly drafts: {
|
|
1647
|
+
readonly count: number;
|
|
1648
|
+
};
|
|
1649
|
+
readonly reconciliation: {
|
|
1650
|
+
readonly open: number;
|
|
1651
|
+
readonly exceptions: number;
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
interface InsightsMethods {
|
|
1655
|
+
summary(options?: {
|
|
1656
|
+
readonly signal?: AbortSignal;
|
|
1657
|
+
}): Promise<CapxulResult<InsightsSummary>>;
|
|
1658
|
+
history(options?: {
|
|
1659
|
+
readonly signal?: AbortSignal;
|
|
1660
|
+
}): Promise<CapxulResult<readonly Payment[]>>;
|
|
1661
|
+
}
|
|
1662
|
+
interface ActorProfileMethods {
|
|
1663
|
+
get(options?: {
|
|
1664
|
+
readonly signal?: AbortSignal;
|
|
1665
|
+
}): Promise<CapxulResult<ActorProfile>>;
|
|
1666
|
+
depositInstructions(options?: {
|
|
1667
|
+
readonly signal?: AbortSignal;
|
|
1668
|
+
}): Promise<CapxulResult<DepositInstructions>>;
|
|
1669
|
+
}
|
|
1670
|
+
interface ActorRelationshipMethods {
|
|
1671
|
+
readonly addressBook: AddressBookMethods;
|
|
1672
|
+
readonly requests: ActorRequestsMethods;
|
|
1673
|
+
readonly inbox: InboxMethods;
|
|
1674
|
+
readonly insights: InsightsMethods;
|
|
1675
|
+
readonly profile: ActorProfileMethods;
|
|
1676
|
+
}
|
|
1677
|
+
//#endregion
|
|
671
1678
|
//#region src/client/account.d.ts
|
|
672
1679
|
type AccountStatus = {
|
|
673
1680
|
readonly status: "notAuthenticated";
|
|
@@ -680,7 +1687,7 @@ type AccountStatus = {
|
|
|
680
1687
|
readonly requirement: AccountRequirement;
|
|
681
1688
|
readonly chainId: number;
|
|
682
1689
|
readonly source: AccountProviderSource;
|
|
683
|
-
readonly signerAddress: Address
|
|
1690
|
+
readonly signerAddress: Address;
|
|
684
1691
|
} | {
|
|
685
1692
|
readonly status: "accountPrepared";
|
|
686
1693
|
readonly requirement: AccountRequirement;
|
|
@@ -717,21 +1724,14 @@ type AccountStatus = {
|
|
|
717
1724
|
* `accountPrepared` to `accountReady(deployed)`; until then, the type
|
|
718
1725
|
* surface is stable and the runtime fixed-point is documented.
|
|
719
1726
|
*/
|
|
720
|
-
interface AccountMethods {
|
|
721
|
-
/**
|
|
722
|
-
* Read-only status inspection. Safe to call anytime.
|
|
723
|
-
*/
|
|
724
|
-
getStatus(): Promise<CapxulResult<AccountStatus>>;
|
|
1727
|
+
interface AccountMethods extends ActorRelationshipMethods {
|
|
725
1728
|
/**
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
* Per #161, `ensureReady` now advances the ladder upward:
|
|
729
|
-
* - `accountProviderReady → accountReady` via `_internal.account.provision`
|
|
730
|
-
* - `accountPrepared → accountReady(deployed)` via
|
|
731
|
-
* `_internal.account.deploySafe` (when `requirement === "deployed"`
|
|
732
|
-
* and deploy deps are configured).
|
|
1729
|
+
* Post-auth account setup lifecycle — domain vocabulary over the internal
|
|
1730
|
+
* readiness ladder + provisioning lane (#356).
|
|
733
1731
|
*/
|
|
734
|
-
|
|
1732
|
+
getLifecycle(): Promise<CapxulResult<AccountLifecycle>>;
|
|
1733
|
+
/** Resume setup after `failed` and return the updated lifecycle snapshot. */
|
|
1734
|
+
retrySetup(): Promise<CapxulResult<AccountLifecycle>>;
|
|
735
1735
|
/**
|
|
736
1736
|
* Internal advanced surface (#161 · AC1). Reserved for the rebuild's
|
|
737
1737
|
* own `ensureReady` upward transitions and for testing harnesses;
|
|
@@ -752,13 +1752,21 @@ interface AccountMethods {
|
|
|
752
1752
|
interface AccountInternalSurface {
|
|
753
1753
|
provision(): Promise<CapxulResult<SmartAccount$1>>;
|
|
754
1754
|
deploySafe(): Promise<CapxulResult<SmartAccount$1>>;
|
|
1755
|
+
/** @internal-use Substrate readiness ladder — tests and e2e only. */
|
|
1756
|
+
getStatus(): Promise<CapxulResult<AccountStatus>>;
|
|
1757
|
+
/** @internal-use Lane runner — tests and e2e only. */
|
|
1758
|
+
ensureReady(): Promise<CapxulResult<AccountStatus>>;
|
|
1759
|
+
/** @internal-use Provisioning lane phase — tests and e2e only. */
|
|
1760
|
+
getProvisioningPhase(): Promise<CapxulResult<ProvisioningPhase>>;
|
|
1761
|
+
/** @internal-use Lane retry — tests and e2e only. */
|
|
1762
|
+
retryProvisioning(): Promise<CapxulResult<ProvisioningPhase>>;
|
|
755
1763
|
}
|
|
756
1764
|
//#endregion
|
|
757
1765
|
//#region src/client/accounts.d.ts
|
|
758
1766
|
interface AccountsMethods {
|
|
759
1767
|
read(options?: {
|
|
760
1768
|
readonly signal?: AbortSignal;
|
|
761
|
-
}): Promise<CapxulResult<Account
|
|
1769
|
+
}): Promise<CapxulResult<Account>>;
|
|
762
1770
|
}
|
|
763
1771
|
/**
|
|
764
1772
|
* Faucet surface (dev-only). Deliberately OFF the public `AccountsMethods`;
|
|
@@ -766,7 +1774,7 @@ interface AccountsMethods {
|
|
|
766
1774
|
* The reference CLI uses it behind a test-env gate — consumers never see `fund`.
|
|
767
1775
|
*/
|
|
768
1776
|
interface AccountsFaucetMethods {
|
|
769
|
-
fund(amount: Money
|
|
1777
|
+
fund(amount: Money, options?: {
|
|
770
1778
|
readonly signal?: AbortSignal;
|
|
771
1779
|
}): Promise<CapxulResult<{
|
|
772
1780
|
readonly txHash: string;
|
|
@@ -779,17 +1787,17 @@ interface SubAccountsMethods {
|
|
|
779
1787
|
readonly name: string;
|
|
780
1788
|
}, options?: {
|
|
781
1789
|
readonly signal?: AbortSignal;
|
|
782
|
-
}): Promise<CapxulResult<SubAccount
|
|
783
|
-
get(subAccountId: SubAccountId
|
|
1790
|
+
}): Promise<CapxulResult<SubAccount>>;
|
|
1791
|
+
get(subAccountId: SubAccountId, options?: {
|
|
784
1792
|
readonly signal?: AbortSignal;
|
|
785
|
-
}): Promise<CapxulResult<SubAccount
|
|
1793
|
+
}): Promise<CapxulResult<SubAccount | null>>;
|
|
786
1794
|
list(accountId: AccountId, options?: {
|
|
787
1795
|
readonly signal?: AbortSignal;
|
|
788
|
-
}): Promise<CapxulResult<readonly SubAccount
|
|
789
|
-
rename(subAccountId: SubAccountId
|
|
1796
|
+
}): Promise<CapxulResult<readonly SubAccount[]>>;
|
|
1797
|
+
rename(subAccountId: SubAccountId, name: string, options?: {
|
|
790
1798
|
readonly signal?: AbortSignal;
|
|
791
|
-
}): Promise<CapxulResult<SubAccount
|
|
792
|
-
delete(subAccountId: SubAccountId
|
|
1799
|
+
}): Promise<CapxulResult<SubAccount>>;
|
|
1800
|
+
delete(subAccountId: SubAccountId, options?: {
|
|
793
1801
|
readonly signal?: AbortSignal;
|
|
794
1802
|
}): Promise<CapxulResult<void>>;
|
|
795
1803
|
transfer(input: TransferInput, options?: {
|
|
@@ -798,49 +1806,72 @@ interface SubAccountsMethods {
|
|
|
798
1806
|
}
|
|
799
1807
|
//#endregion
|
|
800
1808
|
//#region src/client/org-spend-gate.d.ts
|
|
801
|
-
|
|
1809
|
+
/**
|
|
1810
|
+
* The role's allowed recipients. The address form backs the S4 `spend` path
|
|
1811
|
+
* (recipient is a resolved `Address`); the string form backs the G4
|
|
1812
|
+
* `spendViaPayments` / `batchPayroll` path, whose recipient is a VALIDATED REF
|
|
1813
|
+
* (handle/email/payee/org) compared in the same ref space as the role's set.
|
|
1814
|
+
* Comparison is case-insensitive over the raw string value either way.
|
|
1815
|
+
*/
|
|
1816
|
+
type SpendGateRecipients = "anyone" | readonly (Address | string)[];
|
|
802
1817
|
type SpendGateSubAccountScope = {
|
|
803
1818
|
readonly scope: "all";
|
|
804
1819
|
} | {
|
|
805
1820
|
readonly scope: "only";
|
|
806
|
-
readonly subAccountIds: readonly SubAccountId
|
|
1821
|
+
readonly subAccountIds: readonly SubAccountId[];
|
|
807
1822
|
};
|
|
808
1823
|
//#endregion
|
|
809
1824
|
//#region src/ports/org.d.ts
|
|
1825
|
+
/**
|
|
1826
|
+
* The minimal `{from, to, amount}` spend shape the authority read keys off
|
|
1827
|
+
* (D3 #565). The legacy address-keyed `OrgSpendInput`/`org.spend` lane was
|
|
1828
|
+
* hard-removed when `orgSpends` folded into the one `payments` ledger; the
|
|
1829
|
+
* leak-safe ref-based lane (`spendViaPayments`/`batchPayroll`) constructs this
|
|
1830
|
+
* internally and enforces the real validated recipient on the gate.
|
|
1831
|
+
*/
|
|
1832
|
+
type OrgSpendShape = {
|
|
1833
|
+
readonly from: SubAccountId;
|
|
1834
|
+
readonly to: Address;
|
|
1835
|
+
readonly amount: Money;
|
|
1836
|
+
};
|
|
810
1837
|
type CreateOrgPortInput = {
|
|
811
1838
|
readonly input: CreateOrgInput;
|
|
812
1839
|
};
|
|
813
1840
|
type ReadOrgTreasuryInput = {
|
|
814
|
-
readonly orgId: OrgId
|
|
1841
|
+
readonly orgId: OrgId;
|
|
815
1842
|
};
|
|
816
1843
|
type ListOrgsInput = Record<never, never>;
|
|
817
1844
|
type ListOrgRolesInput = {
|
|
818
|
-
readonly orgId: OrgId
|
|
1845
|
+
readonly orgId: OrgId;
|
|
819
1846
|
};
|
|
820
1847
|
type ListOrgMembersInput = {
|
|
821
|
-
readonly orgId: OrgId
|
|
1848
|
+
readonly orgId: OrgId;
|
|
822
1849
|
};
|
|
823
1850
|
type InviteOrgMemberInput = {
|
|
824
|
-
readonly orgId: OrgId
|
|
1851
|
+
readonly orgId: OrgId;
|
|
825
1852
|
readonly input: InviteMemberInput;
|
|
826
1853
|
};
|
|
1854
|
+
type ResendOrgInviteTokenInput = {
|
|
1855
|
+
readonly orgId: OrgId;
|
|
1856
|
+
readonly email: string;
|
|
1857
|
+
};
|
|
827
1858
|
type DetectPendingOrgInvitationsInput = Record<never, never>;
|
|
828
1859
|
type DetectPendingOrgInvitationsResult$1 = {
|
|
829
|
-
readonly matched: readonly OrgId
|
|
1860
|
+
readonly matched: readonly OrgId[];
|
|
830
1861
|
};
|
|
831
1862
|
type DeployOrgRolesInput = {
|
|
832
|
-
readonly orgId: OrgId
|
|
1863
|
+
readonly orgId: OrgId;
|
|
833
1864
|
};
|
|
834
1865
|
type OrgRolesDeploymentResult = {
|
|
835
|
-
readonly orgId: OrgId
|
|
1866
|
+
readonly orgId: OrgId;
|
|
836
1867
|
readonly roles: readonly RoleView[];
|
|
837
1868
|
};
|
|
838
1869
|
type GrantOrgRoleInput = {
|
|
839
|
-
readonly orgId: OrgId
|
|
1870
|
+
readonly orgId: OrgId;
|
|
840
1871
|
readonly input: AssignRoleInput;
|
|
841
1872
|
};
|
|
842
1873
|
type RevokeOrgRoleInput = {
|
|
843
|
-
readonly orgId: OrgId
|
|
1874
|
+
readonly orgId: OrgId;
|
|
844
1875
|
readonly input: RemoveMemberInput;
|
|
845
1876
|
};
|
|
846
1877
|
type OrgSpendAuthority = {
|
|
@@ -854,16 +1885,10 @@ type OrgSpendAuthority = {
|
|
|
854
1885
|
readonly role?: string;
|
|
855
1886
|
};
|
|
856
1887
|
type ReadOrgSpendAuthorityInput = {
|
|
857
|
-
readonly orgId: OrgId
|
|
858
|
-
readonly input:
|
|
1888
|
+
readonly orgId: OrgId;
|
|
1889
|
+
readonly input: OrgSpendShape;
|
|
859
1890
|
readonly amountRaw: string;
|
|
860
1891
|
};
|
|
861
|
-
type SubmitOrgSpendInput = {
|
|
862
|
-
readonly orgId: OrgId$1;
|
|
863
|
-
readonly input: OrgSpendInput;
|
|
864
|
-
readonly amountRaw: string;
|
|
865
|
-
readonly authority: OrgSpendAuthority;
|
|
866
|
-
};
|
|
867
1892
|
declare const OrgError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
868
1893
|
readonly _tag: "OrgError";
|
|
869
1894
|
} & Readonly<A>;
|
|
@@ -882,11 +1907,13 @@ declare class OrgError extends OrgError_base<{
|
|
|
882
1907
|
*/
|
|
883
1908
|
interface OrgPort {
|
|
884
1909
|
createOrg(input: CreateOrgPortInput): Effect.Effect<OrgView, OrgError, never>;
|
|
885
|
-
readTreasury(input: ReadOrgTreasuryInput): Effect.Effect<Account
|
|
1910
|
+
readTreasury(input: ReadOrgTreasuryInput): Effect.Effect<Account, OrgError, never>;
|
|
886
1911
|
listOrgs(input: ListOrgsInput): Effect.Effect<readonly OrgView[], OrgError, never>;
|
|
887
1912
|
listRoles(input: ListOrgRolesInput): Effect.Effect<readonly RoleView[], OrgError, never>;
|
|
888
1913
|
listMembers(input: ListOrgMembersInput): Effect.Effect<readonly MemberView[], OrgError, never>;
|
|
1914
|
+
pendingMembers?(input: ListOrgMembersInput): Effect.Effect<readonly MemberView[], OrgError, never>;
|
|
889
1915
|
inviteMember(input: InviteOrgMemberInput): Effect.Effect<MemberView, OrgError, never>;
|
|
1916
|
+
resendInviteToken?(input: ResendOrgInviteTokenInput): Effect.Effect<MemberView, OrgError, never>;
|
|
890
1917
|
detectAndAcceptPendingInvitations(input: DetectPendingOrgInvitationsInput): Effect.Effect<DetectPendingOrgInvitationsResult$1, OrgError, never>;
|
|
891
1918
|
}
|
|
892
1919
|
interface OrgRolesDeploymentPort {
|
|
@@ -894,9 +1921,34 @@ interface OrgRolesDeploymentPort {
|
|
|
894
1921
|
grantRole(input: GrantOrgRoleInput): Effect.Effect<MemberView, OrgError, never>;
|
|
895
1922
|
revokeRole(input: RevokeOrgRoleInput): Effect.Effect<void, OrgError, never>;
|
|
896
1923
|
}
|
|
1924
|
+
type SubmitOrgSpendViaPaymentsInput = {
|
|
1925
|
+
readonly orgId: OrgId;
|
|
1926
|
+
readonly input: OrgSpendViaPaymentsInput;
|
|
1927
|
+
readonly amountRaw: string;
|
|
1928
|
+
readonly authority: OrgSpendAuthority;
|
|
1929
|
+
};
|
|
1930
|
+
type SubmitOrgBatchPayrollInput = {
|
|
1931
|
+
readonly orgId: OrgId;
|
|
1932
|
+
readonly from: OrgSpendViaPaymentsInput["from"];
|
|
1933
|
+
readonly runs: readonly {
|
|
1934
|
+
readonly run: OrgPayrollRun;
|
|
1935
|
+
readonly amountRaw: string;
|
|
1936
|
+
}[];
|
|
1937
|
+
readonly authorities: readonly OrgSpendAuthority[];
|
|
1938
|
+
};
|
|
897
1939
|
interface OrgSpendPort {
|
|
898
1940
|
readSpendAuthority(input: ReadOrgSpendAuthorityInput): Effect.Effect<OrgSpendAuthority, OrgError, never>;
|
|
899
|
-
|
|
1941
|
+
/**
|
|
1942
|
+
* Leak-safe org spend (G4 · #547; D3 #565 — the one ledger of record): execute
|
|
1943
|
+
* the spend through the payments engine (Roles modifier → CapxulPayments),
|
|
1944
|
+
* write a real `payments` row (`source:"org"`) and read it back as a `Payment`
|
|
1945
|
+
* — the wire carries no `txHash` / Safe / userOp internals. Optional so a
|
|
1946
|
+
* hermetic adapter without a payments-submit lane still compiles; absent ⇒ the
|
|
1947
|
+
* program falls back to a deterministic hermetic `Payment`.
|
|
1948
|
+
*/
|
|
1949
|
+
submitSpendViaPayments?(input: SubmitOrgSpendViaPaymentsInput): Effect.Effect<Payment, OrgError, never>;
|
|
1950
|
+
/** Leak-safe org payroll batch (G4 · #547): one MultiSend, one Payment per run. */
|
|
1951
|
+
submitBatchPayroll?(input: SubmitOrgBatchPayrollInput): Effect.Effect<readonly Payment[], OrgError, never>;
|
|
900
1952
|
}
|
|
901
1953
|
//#endregion
|
|
902
1954
|
//#region src/client/org.d.ts
|
|
@@ -916,12 +1968,12 @@ type MemberStatus = "pending" | "pending_safe" | "pending_grant" | "active" | "r
|
|
|
916
1968
|
* brand.
|
|
917
1969
|
*/
|
|
918
1970
|
type OrgView = {
|
|
919
|
-
readonly id: OrgId
|
|
1971
|
+
readonly id: OrgId;
|
|
920
1972
|
readonly name: string;
|
|
921
1973
|
readonly handle: string;
|
|
922
|
-
readonly safeAddress: Address
|
|
1974
|
+
readonly safeAddress: Address; /** The viewing member's own role label within this org. */
|
|
923
1975
|
readonly role: string; /** The Org treasury — the real M2 Account over the Org Safe (D3). */
|
|
924
|
-
readonly treasury: Account
|
|
1976
|
+
readonly treasury: Account;
|
|
925
1977
|
};
|
|
926
1978
|
/**
|
|
927
1979
|
* One member of an Org (canon §C1 "Members" — name/email, role, status; D7/D8).
|
|
@@ -930,12 +1982,12 @@ type OrgView = {
|
|
|
930
1982
|
* yet provisioned a personal Safe). `email` is the universal entry point (D8).
|
|
931
1983
|
*/
|
|
932
1984
|
type MemberView = {
|
|
933
|
-
readonly orgId: OrgId
|
|
1985
|
+
readonly orgId: OrgId;
|
|
934
1986
|
readonly email: Email;
|
|
935
1987
|
readonly name: string | null; /** Member-identity key (D7). `null` until the invitee provisions a Safe. */
|
|
936
|
-
readonly personalSafeAddress: Address
|
|
1988
|
+
readonly personalSafeAddress: Address | null; /** The member's role label (maps deterministically to the on-chain `roleKey`, D9). */
|
|
937
1989
|
readonly role: string;
|
|
938
|
-
readonly roleKey: RoleKey
|
|
1990
|
+
readonly roleKey: RoleKey | null;
|
|
939
1991
|
readonly status: MemberStatus;
|
|
940
1992
|
readonly grantTxHash: string | null;
|
|
941
1993
|
readonly revokeTxHash: string | null;
|
|
@@ -947,9 +1999,9 @@ type MemberView = {
|
|
|
947
1999
|
* (the Owner role).
|
|
948
2000
|
*/
|
|
949
2001
|
type RoleSpendCap = {
|
|
950
|
-
readonly perTx?: Money
|
|
951
|
-
readonly perDay?: Money
|
|
952
|
-
readonly toRecipients?: "anyone" | readonly Address
|
|
2002
|
+
readonly perTx?: Money;
|
|
2003
|
+
readonly perDay?: Money;
|
|
2004
|
+
readonly toRecipients?: "anyone" | readonly Address[];
|
|
953
2005
|
};
|
|
954
2006
|
/**
|
|
955
2007
|
* The Capxul-owned Role DSL definition (D4). `label` becomes the sticky
|
|
@@ -961,7 +2013,7 @@ type RoleDefinition = {
|
|
|
961
2013
|
readonly label: string;
|
|
962
2014
|
readonly spend?: RoleSpendCap;
|
|
963
2015
|
readonly subAccounts?: {
|
|
964
|
-
readonly scope: "all" | readonly SubAccountId
|
|
2016
|
+
readonly scope: "all" | readonly SubAccountId[];
|
|
965
2017
|
};
|
|
966
2018
|
readonly canManageMembers?: boolean;
|
|
967
2019
|
readonly canManageRoles?: boolean;
|
|
@@ -972,9 +2024,9 @@ type RoleDefinition = {
|
|
|
972
2024
|
* is the full Role DSL entry.
|
|
973
2025
|
*/
|
|
974
2026
|
type RoleView = {
|
|
975
|
-
readonly orgId: OrgId
|
|
2027
|
+
readonly orgId: OrgId;
|
|
976
2028
|
readonly label: string;
|
|
977
|
-
readonly roleKey: RoleKey
|
|
2029
|
+
readonly roleKey: RoleKey;
|
|
978
2030
|
readonly definition: RoleDefinition;
|
|
979
2031
|
};
|
|
980
2032
|
/** Built-in role templates that seed a new Org at creation (D6). */
|
|
@@ -1003,13 +2055,16 @@ type InviteMemberInput = {
|
|
|
1003
2055
|
readonly email: string;
|
|
1004
2056
|
readonly role: string;
|
|
1005
2057
|
};
|
|
2058
|
+
type ResendInviteTokenInput = {
|
|
2059
|
+
readonly email: string;
|
|
2060
|
+
};
|
|
1006
2061
|
/**
|
|
1007
2062
|
* Input to `org(orgId).removeMember` (S3, D8). Keyed on the member's personal
|
|
1008
2063
|
* Safe address (D7 — Safe-as-identity). Drives the on-chain REVOKE + Convex
|
|
1009
2064
|
* mirror.
|
|
1010
2065
|
*/
|
|
1011
2066
|
type RemoveMemberInput = {
|
|
1012
|
-
readonly memberSafeAddress: Address
|
|
2067
|
+
readonly memberSafeAddress: Address;
|
|
1013
2068
|
};
|
|
1014
2069
|
/**
|
|
1015
2070
|
* Input to `org(orgId).assignRole` (S3, D7/D9). Keyed on the member's personal
|
|
@@ -1017,26 +2072,50 @@ type RemoveMemberInput = {
|
|
|
1017
2072
|
* label maps deterministically to the on-chain `roleKey`.
|
|
1018
2073
|
*/
|
|
1019
2074
|
type AssignRoleInput = {
|
|
1020
|
-
readonly memberSafeAddress: Address
|
|
2075
|
+
readonly memberSafeAddress: Address;
|
|
1021
2076
|
readonly role: string;
|
|
1022
2077
|
};
|
|
1023
2078
|
/**
|
|
1024
|
-
* Input to `org(orgId).
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
2079
|
+
* Input to `org(orgId).spendViaPayments` (G4 · #547). The LEAK-SAFE org spend:
|
|
2080
|
+
* delegates `org.spend` to the payments engine WITH the member's org role
|
|
2081
|
+
* authority and returns a `Payment`, not a `txHash`. `to` is a VALIDATED
|
|
2082
|
+
* recipient ref (handle / email / payee id / org handle) — never a raw
|
|
2083
|
+
* `Address` (the legacy address-keyed `org.spend` lane was hard-removed in D3
|
|
2084
|
+
* #565 when `orgSpends` was folded into the one `payments` ledger).
|
|
2085
|
+
* `from` is the Level-2 sub-account envelope the spend draws from (D5).
|
|
1028
2086
|
*/
|
|
1029
|
-
type
|
|
1030
|
-
/**
|
|
1031
|
-
readonly to:
|
|
1032
|
-
readonly amount: Money
|
|
2087
|
+
type OrgSpendViaPaymentsInput = {
|
|
2088
|
+
readonly from: SubAccountId; /** Validated recipient ref (handle/email/payee/org) — never a raw address. */
|
|
2089
|
+
readonly to: Ref;
|
|
2090
|
+
readonly amount: Money; /** Full EIP-712 payment document; hashed + stored, committed on-chain. */
|
|
2091
|
+
readonly document?: PaymentDocumentEnvelopeV1;
|
|
2092
|
+
readonly timing?: PaymentTiming;
|
|
2093
|
+
readonly paymentType?: PaymentType;
|
|
1033
2094
|
};
|
|
1034
|
-
/**
|
|
1035
|
-
|
|
1036
|
-
|
|
2095
|
+
/**
|
|
2096
|
+
* One run in an `org(orgId).batchPayroll` batch (G4 · #547): a validated
|
|
2097
|
+
* recipient, an amount, and an optional payslip document. Each run is gated
|
|
2098
|
+
* independently against the role's per-tx / per-day / recipient conditions.
|
|
2099
|
+
*/
|
|
2100
|
+
type OrgPayrollRun = {
|
|
2101
|
+
/** Validated recipient ref (handle/email/payee/org) — never a raw address. */readonly to: Ref;
|
|
2102
|
+
readonly amount: Money;
|
|
2103
|
+
readonly timing?: PaymentTiming; /** The payslip — an EIP-712 payment document, committed by `documentHash`. */
|
|
2104
|
+
readonly payslip?: PaymentDocumentEnvelopeV1;
|
|
2105
|
+
};
|
|
2106
|
+
/**
|
|
2107
|
+
* Input to `org(orgId).batchPayroll` (G4 · #547). Pays N employees in one
|
|
2108
|
+
* MultiSend through the Roles modifier; each carries a payslip and settles as
|
|
2109
|
+
* `paymentType = payroll`. Every run is gated; an over-cap run REJECTS the
|
|
2110
|
+
* whole batch (no partial treasury drain). Returns one leak-safe `Payment` per
|
|
2111
|
+
* run.
|
|
2112
|
+
*/
|
|
2113
|
+
type OrgBatchPayrollInput = {
|
|
2114
|
+
readonly from: SubAccountId;
|
|
2115
|
+
readonly runs: readonly OrgPayrollRun[];
|
|
1037
2116
|
};
|
|
1038
2117
|
type DetectPendingOrgInvitationsResult = {
|
|
1039
|
-
readonly matched: readonly OrgId
|
|
2118
|
+
readonly matched: readonly OrgId[];
|
|
1040
2119
|
};
|
|
1041
2120
|
/**
|
|
1042
2121
|
* Entity-scoped Org method bundle, returned by `capxul.org(orgId)`. Every
|
|
@@ -1044,11 +2123,51 @@ type DetectPendingOrgInvitationsResult = {
|
|
|
1044
2123
|
* stateful active context). `treasury()` returns the real M2 `Account` over
|
|
1045
2124
|
* the Org Safe (D3).
|
|
1046
2125
|
*/
|
|
1047
|
-
interface
|
|
2126
|
+
interface PayrollRosterLine {
|
|
2127
|
+
readonly id: string;
|
|
2128
|
+
readonly employee: Ref;
|
|
2129
|
+
readonly amount: Money;
|
|
2130
|
+
readonly timing: PaymentTiming;
|
|
2131
|
+
readonly status: "active" | "paused" | "ended";
|
|
2132
|
+
}
|
|
2133
|
+
interface PayrollPayslipTemplate {
|
|
2134
|
+
readonly title: string;
|
|
2135
|
+
readonly memo?: string;
|
|
2136
|
+
}
|
|
2137
|
+
interface PayrollRosterAddInput {
|
|
2138
|
+
readonly employee: Ref;
|
|
2139
|
+
readonly amount: Money;
|
|
2140
|
+
readonly timing: PaymentTiming;
|
|
2141
|
+
readonly payslipTemplate?: PaymentDocumentEnvelopeV1 | PayrollPayslipTemplate;
|
|
2142
|
+
}
|
|
2143
|
+
interface PayrollRunInput {
|
|
2144
|
+
readonly from: SubAccountId;
|
|
2145
|
+
readonly period: string;
|
|
2146
|
+
}
|
|
2147
|
+
interface PayrollMethods {
|
|
2148
|
+
readonly roster: {
|
|
2149
|
+
add(input: PayrollRosterAddInput, options?: {
|
|
2150
|
+
readonly signal?: AbortSignal;
|
|
2151
|
+
}): Promise<CapxulResult<PayrollRosterLine>>;
|
|
2152
|
+
list(options?: {
|
|
2153
|
+
readonly signal?: AbortSignal;
|
|
2154
|
+
}): Promise<CapxulResult<readonly PayrollRosterLine[]>>;
|
|
2155
|
+
update(rosterLineId: string, input: Partial<PayrollRosterAddInput>, options?: {
|
|
2156
|
+
readonly signal?: AbortSignal;
|
|
2157
|
+
}): Promise<CapxulResult<PayrollRosterLine>>;
|
|
2158
|
+
remove(rosterLineId: string, options?: {
|
|
2159
|
+
readonly signal?: AbortSignal;
|
|
2160
|
+
}): Promise<CapxulResult<PayrollRosterLine>>;
|
|
2161
|
+
};
|
|
2162
|
+
run(input: PayrollRunInput, options?: {
|
|
2163
|
+
readonly signal?: AbortSignal;
|
|
2164
|
+
}): Promise<CapxulResult<readonly Payment[]>>;
|
|
2165
|
+
}
|
|
2166
|
+
interface OrgScopedMethods extends ActorRelationshipMethods {
|
|
1048
2167
|
/** The Org treasury — the real M2 Account over the Org Safe (D3). */
|
|
1049
2168
|
treasury(options?: {
|
|
1050
2169
|
readonly signal?: AbortSignal;
|
|
1051
|
-
}): Promise<CapxulResult<Account
|
|
2170
|
+
}): Promise<CapxulResult<Account>>;
|
|
1052
2171
|
members(options?: {
|
|
1053
2172
|
readonly signal?: AbortSignal;
|
|
1054
2173
|
}): Promise<CapxulResult<readonly MemberView[]>>;
|
|
@@ -1061,15 +2180,38 @@ interface OrgScopedMethods {
|
|
|
1061
2180
|
invite(input: InviteMemberInput, options?: {
|
|
1062
2181
|
readonly signal?: AbortSignal;
|
|
1063
2182
|
}): Promise<CapxulResult<MemberView>>;
|
|
2183
|
+
pendingMembers(options?: {
|
|
2184
|
+
readonly signal?: AbortSignal;
|
|
2185
|
+
}): Promise<CapxulResult<readonly MemberView[]>>;
|
|
2186
|
+
readonly inviteToken: {
|
|
2187
|
+
resend(input: ResendInviteTokenInput, options?: {
|
|
2188
|
+
readonly signal?: AbortSignal;
|
|
2189
|
+
}): Promise<CapxulResult<MemberView>>;
|
|
2190
|
+
};
|
|
1064
2191
|
removeMember(input: RemoveMemberInput, options?: {
|
|
1065
2192
|
readonly signal?: AbortSignal;
|
|
1066
2193
|
}): Promise<CapxulResult<void>>;
|
|
1067
2194
|
assignRole(input: AssignRoleInput, options?: {
|
|
1068
2195
|
readonly signal?: AbortSignal;
|
|
1069
2196
|
}): Promise<CapxulResult<MemberView>>;
|
|
1070
|
-
|
|
2197
|
+
/**
|
|
2198
|
+
* Leak-safe org spend (G4 · #547; D3 #565 — the one ledger of record): execute
|
|
2199
|
+
* the spend through the payments engine with the member's org role authority
|
|
2200
|
+
* and return a `Payment` (no `to: Address`, no `txHash`, no Safe / userOp
|
|
2201
|
+
* internals). Writes a real `payments` row (`source:"org"`).
|
|
2202
|
+
*/
|
|
2203
|
+
spendViaPayments(input: OrgSpendViaPaymentsInput, options?: {
|
|
2204
|
+
readonly signal?: AbortSignal;
|
|
2205
|
+
}): Promise<CapxulResult<Payment>>;
|
|
2206
|
+
/**
|
|
2207
|
+
* Org payroll batch (G4 · #547): pay N employees in one MultiSend through the
|
|
2208
|
+
* Roles modifier, each with a payslip. Every run is gated; an over-cap run
|
|
2209
|
+
* rejects the whole batch. Returns one leak-safe `Payment` per run.
|
|
2210
|
+
*/
|
|
2211
|
+
batchPayroll(input: OrgBatchPayrollInput, options?: {
|
|
1071
2212
|
readonly signal?: AbortSignal;
|
|
1072
|
-
}): Promise<CapxulResult<
|
|
2213
|
+
}): Promise<CapxulResult<readonly Payment[]>>;
|
|
2214
|
+
readonly payroll: PayrollMethods;
|
|
1073
2215
|
}
|
|
1074
2216
|
type OrgsMethod = {
|
|
1075
2217
|
(options?: {
|
|
@@ -1089,7 +2231,52 @@ interface OrgMethods {
|
|
|
1089
2231
|
}): Promise<CapxulResult<OrgView>>;
|
|
1090
2232
|
readonly orgs: OrgsMethod;
|
|
1091
2233
|
/** Resolve the entity-scoped bundle for a specific Org (D13). */
|
|
1092
|
-
org(orgId: OrgId
|
|
2234
|
+
org(orgId: OrgId): OrgScopedMethods;
|
|
2235
|
+
}
|
|
2236
|
+
//#endregion
|
|
2237
|
+
//#region src/client/onboarding.d.ts
|
|
2238
|
+
/**
|
|
2239
|
+
* Input to `capxul.onboarding.completePersonal`. `displayName` + `country`
|
|
2240
|
+
* (ISO-3166, persisted to `identities.country`) are required; `withdrawalAddress`
|
|
2241
|
+
* is the OPTIONAL cash-out destination — a `0x`-prefixed 20-byte address string
|
|
2242
|
+
* (the one allowed raw-0x class), validated + normalized at the boundary.
|
|
2243
|
+
*/
|
|
2244
|
+
type CompletePersonalOnboardingInput = {
|
|
2245
|
+
readonly displayName: string;
|
|
2246
|
+
readonly country: string;
|
|
2247
|
+
readonly withdrawalAddress?: string;
|
|
2248
|
+
};
|
|
2249
|
+
/**
|
|
2250
|
+
* Input to `capxul.onboarding.completeOrganization`. `handle` is the org slug
|
|
2251
|
+
* (`createOrg` requires it); `ownerDisplayName` is the founder's personal
|
|
2252
|
+
* identity profile.
|
|
2253
|
+
*/
|
|
2254
|
+
type CompleteOrganizationOnboardingInput = {
|
|
2255
|
+
readonly organizationName: string;
|
|
2256
|
+
readonly handle: string;
|
|
2257
|
+
readonly country: string;
|
|
2258
|
+
readonly ownerDisplayName: string;
|
|
2259
|
+
};
|
|
2260
|
+
/** Result of `completePersonal` — the post-onboarding readiness snapshot. */
|
|
2261
|
+
type CompletePersonalOnboardingResult = {
|
|
2262
|
+
readonly lifecycle: AccountLifecycle;
|
|
2263
|
+
};
|
|
2264
|
+
/** Result of `completeOrganization` — the created org + readiness snapshot. */
|
|
2265
|
+
type CompleteOrganizationOnboardingResult = {
|
|
2266
|
+
readonly org: OrgView;
|
|
2267
|
+
readonly lifecycle: AccountLifecycle;
|
|
2268
|
+
};
|
|
2269
|
+
/**
|
|
2270
|
+
* Onboarding method bundle, exposed at `client.onboarding`. Exactly two verbs;
|
|
2271
|
+
* the choreography lives in `flows/onboarding.ts`.
|
|
2272
|
+
*/
|
|
2273
|
+
interface OnboardingMethods {
|
|
2274
|
+
completePersonal(input: CompletePersonalOnboardingInput, options?: {
|
|
2275
|
+
readonly signal?: AbortSignal;
|
|
2276
|
+
}): Promise<CapxulResult<CompletePersonalOnboardingResult>>;
|
|
2277
|
+
completeOrganization(input: CompleteOrganizationOnboardingInput, options?: {
|
|
2278
|
+
readonly signal?: AbortSignal;
|
|
2279
|
+
}): Promise<CapxulResult<CompleteOrganizationOnboardingResult>>;
|
|
1093
2280
|
}
|
|
1094
2281
|
//#endregion
|
|
1095
2282
|
//#region src/client/create-capxul-client.d.ts
|
|
@@ -1108,6 +2295,33 @@ interface CapxulClient {
|
|
|
1108
2295
|
* Returns `{ balance, available }` as `Money` — never wei or token units.
|
|
1109
2296
|
*/
|
|
1110
2297
|
readonly accounts: AccountsMethods;
|
|
2298
|
+
readonly me: MeMethods;
|
|
2299
|
+
readonly handles: HandlesMethods;
|
|
2300
|
+
readonly payees: PayeesMethods;
|
|
2301
|
+
readonly destinations: DestinationsMethods;
|
|
2302
|
+
/**
|
|
2303
|
+
* Direct Payments surface (G2 · #545). `pay` records a validated-recipient
|
|
2304
|
+
* payment; `list`/`get` read the ledger; `markSettled` is the host-execution
|
|
2305
|
+
* callback. The MCP `draft → simulate → approve → execute` workbench is G6.
|
|
2306
|
+
*/
|
|
2307
|
+
readonly payments: PaymentsMethods;
|
|
2308
|
+
/** Payment document verification (G2 · #545): re-derive the EIP-712 hash. */
|
|
2309
|
+
readonly paymentDocuments: PaymentDocumentsMethods;
|
|
2310
|
+
/**
|
|
2311
|
+
* Receivables surface (G5 · #548). `create` opens a `PaymentRequest` with a
|
|
2312
|
+
* fixed-amount link; `markSent`/`markViewed`/`cancel` move the funnel;
|
|
2313
|
+
* `collect` settles the receivable into the Payment ledger + mints a receipt
|
|
2314
|
+
* linked by `documentHash`; `list`/`get`/`getByLink`/`reconcile` read it.
|
|
2315
|
+
*/
|
|
2316
|
+
readonly paymentRequests: PaymentRequestsMethods;
|
|
2317
|
+
/**
|
|
2318
|
+
* Decomposed workbench + trust substrate (G6 · #549). The MCP
|
|
2319
|
+
* `draft → simulate → approvals.request → execute` workbench: the edge
|
|
2320
|
+
* PROPOSES, the BACKEND mints a one-time plan-bound approval token via the
|
|
2321
|
+
* human's browser (#510), and `execute` consumes it. Taint / idempotency /
|
|
2322
|
+
* stale-state / scope guards are enforced backend-side.
|
|
2323
|
+
*/
|
|
2324
|
+
readonly workbench: WorkbenchMethods;
|
|
1111
2325
|
/** Sub-account lifecycle (M2 Slice S2a · #267). Transfer lands in S2b. */
|
|
1112
2326
|
readonly subAccounts: SubAccountsMethods;
|
|
1113
2327
|
/**
|
|
@@ -1120,8 +2334,14 @@ interface CapxulClient {
|
|
|
1120
2334
|
readonly createOrg: OrgMethods["createOrg"];
|
|
1121
2335
|
readonly orgs: OrgMethods["orgs"];
|
|
1122
2336
|
readonly org: OrgMethods["org"];
|
|
1123
|
-
/**
|
|
1124
|
-
|
|
2337
|
+
/**
|
|
2338
|
+
* Onboarding domain surface (D-ONBOARD · #669). `completePersonal` /
|
|
2339
|
+
* `completeOrganization` bridge the post-OTP auth → provision bookends:
|
|
2340
|
+
* persist the first identity profile (+ org), then trigger the existing
|
|
2341
|
+
* provisioning lane. Pre-scope — the on-ramp before the D-RELATE actor
|
|
2342
|
+
* scopes. `lifecycle.status` is the single routing source of truth.
|
|
2343
|
+
*/
|
|
2344
|
+
readonly onboarding: OnboardingMethods;
|
|
1125
2345
|
/**
|
|
1126
2346
|
* Internal observation namespace. Consumers MUST NOT drive the actor
|
|
1127
2347
|
* directly — use the method bundles instead.
|
|
@@ -1130,17 +2350,23 @@ interface CapxulClient {
|
|
|
1130
2350
|
*/
|
|
1131
2351
|
readonly _internal: {
|
|
1132
2352
|
readonly authActor: AuthFlowObserver;
|
|
2353
|
+
/**
|
|
2354
|
+
* Resolved bootstrap for this client instance (chain, auth URLs, etc.).
|
|
2355
|
+
* Off the public surface per production-surface-policy.md (#31).
|
|
2356
|
+
*/
|
|
2357
|
+
readonly bootstrap: BootstrapResolution;
|
|
1133
2358
|
/**
|
|
1134
2359
|
* Dev-only faucet bundle (production-surface-policy.md). `fund` lives here,
|
|
1135
2360
|
* NOT on the public `client.accounts` surface.
|
|
1136
2361
|
*/
|
|
1137
|
-
readonly accounts: AccountsFaucetMethods;
|
|
2362
|
+
readonly accounts: AccountsFaucetMethods; /** Telemetry port for error reporting. Used by React hooks to report errors before throwing. */
|
|
2363
|
+
readonly telemetry?: TelemetryPort;
|
|
1138
2364
|
readonly close?: () => Promise<void>;
|
|
1139
2365
|
};
|
|
1140
2366
|
}
|
|
1141
2367
|
interface CreateCapxulClientInput {
|
|
1142
2368
|
/**
|
|
1143
|
-
* The
|
|
2369
|
+
* The 13-port `FlowPorts` bundle. The factory narrows this to the
|
|
1144
2370
|
* 3-port AuthFlow subset (`authClient`, `clock`, `telemetry`) for
|
|
1145
2371
|
* the flow internally, and uses additional ports (`identity`,
|
|
1146
2372
|
* `smartAccount`) for the method bundles.
|
|
@@ -1204,23 +2430,97 @@ interface CreateCapxulClientInput {
|
|
|
1204
2430
|
readonly orgSpendPort?: OrgSpendPort;
|
|
1205
2431
|
readonly orgDeploymentConfig?: SafeDeploymentConfig;
|
|
1206
2432
|
}
|
|
1207
|
-
|
|
2433
|
+
//#endregion
|
|
2434
|
+
//#region src/adapters/auth-cache/BrowserAuthCacheAdapter.d.ts
|
|
2435
|
+
interface BrowserStorageShape {
|
|
2436
|
+
getItem(key: string): string | null;
|
|
2437
|
+
setItem(key: string, value: string): void;
|
|
2438
|
+
removeItem(key: string): void;
|
|
2439
|
+
}
|
|
2440
|
+
//#endregion
|
|
2441
|
+
//#region src/dev-signer.d.ts
|
|
2442
|
+
interface DevPrivateKeySignerInput {
|
|
2443
|
+
/** Dev-only derivation seed (e.g. `VITE_CAPXUL_DEV_SIGNER_SEED`). Throwaway keys only. */
|
|
2444
|
+
readonly seed: string;
|
|
2445
|
+
/** Explicit email — skips the auth-cache lookup (tests, node harnesses). */
|
|
2446
|
+
readonly email?: string;
|
|
2447
|
+
/** Storage holding the cached session. Defaults to browser `localStorage`. */
|
|
2448
|
+
readonly storage?: BrowserStorageShape;
|
|
2449
|
+
}
|
|
2450
|
+
/** Deterministic dev private key for an email under a seed. Exported for probes. */
|
|
2451
|
+
declare function deriveDevPrivateKey(seed: string, email: string): Hex;
|
|
2452
|
+
/**
|
|
2453
|
+
* Browser-safe dev signer. Lazy: the email (and so the key) is resolved at
|
|
2454
|
+
* each `getAddress()` / `signUserOpHash()` from the cached session, so the
|
|
2455
|
+
* same signer instance follows whichever user is signed in.
|
|
2456
|
+
*/
|
|
2457
|
+
declare function devPrivateKeySigner(input: DevPrivateKeySignerInput): CapxulSigner;
|
|
2458
|
+
//#endregion
|
|
2459
|
+
//#region src/adapters/openfort/embedded-wallet-port.d.ts
|
|
2460
|
+
/**
|
|
2461
|
+
* Minimal Openfort embedded-wallet surface for hermetic tests and
|
|
2462
|
+
* `openfortEmbeddedSigner`. Keeps Convex / Shield secrets out of the SDK.
|
|
2463
|
+
*/
|
|
2464
|
+
interface OpenfortEmbeddedWalletPort {
|
|
2465
|
+
/** Owner EOA address — must stay stable for the lifetime of this port. */
|
|
2466
|
+
getAddress(): Promise<string>;
|
|
2467
|
+
/**
|
|
2468
|
+
* Sign a 32-byte SafeOp digest without EIP-191 prefixing (backend-orchestrated
|
|
2469
|
+
* deploy contract).
|
|
2470
|
+
*/
|
|
2471
|
+
signRawDigest(hash: Hex): Promise<Hex>;
|
|
2472
|
+
}
|
|
2473
|
+
/** Openfort `embeddedWallet` subset used by `openfortEmbeddedWalletPort`. */
|
|
2474
|
+
interface OpenfortEmbeddedWalletApi {
|
|
2475
|
+
get(): Promise<{
|
|
2476
|
+
readonly address: string;
|
|
2477
|
+
}>;
|
|
2478
|
+
signMessage(message: string | Uint8Array, options?: {
|
|
2479
|
+
readonly hashMessage?: boolean;
|
|
2480
|
+
readonly arrayifyMessage?: boolean;
|
|
2481
|
+
}): Promise<string>;
|
|
2482
|
+
}
|
|
2483
|
+
declare function openfortEmbeddedWalletPort(input: {
|
|
2484
|
+
readonly embeddedWallet: OpenfortEmbeddedWalletApi;
|
|
2485
|
+
readonly ensureReady?: () => Promise<void>;
|
|
2486
|
+
}): OpenfortEmbeddedWalletPort;
|
|
2487
|
+
//#endregion
|
|
2488
|
+
//#region src/openfort-embedded-signer.d.ts
|
|
2489
|
+
interface OpenfortEmbeddedSignerInput {
|
|
2490
|
+
readonly wallet: OpenfortEmbeddedWalletPort;
|
|
2491
|
+
}
|
|
2492
|
+
/** Browser helper: wrap an initialized Openfort `embeddedWallet` API. */
|
|
2493
|
+
declare function openfortEmbeddedSignerFromWallet(input: {
|
|
2494
|
+
readonly embeddedWallet: OpenfortEmbeddedWalletApi;
|
|
2495
|
+
readonly ensureWalletReady?: () => Promise<void>;
|
|
2496
|
+
}): OpenfortEmbeddedSigner;
|
|
2497
|
+
/**
|
|
2498
|
+
* Browser `CapxulSigner` backed by an Openfort embedded wallet (#335).
|
|
2499
|
+
* Signs the backend's SafeOp digest via raw `signMessage` (no EIP-191 prefix)
|
|
2500
|
+
* and verifies recovery before the backend submits.
|
|
2501
|
+
*/
|
|
2502
|
+
type OpenfortEmbeddedSigner = CapxulSigner & {
|
|
2503
|
+
/** Drop cached `getAddress()` so the next read hits the embedded wallet again. */readonly resetAddressCache: () => void;
|
|
2504
|
+
};
|
|
2505
|
+
declare function openfortEmbeddedSigner(input: OpenfortEmbeddedSignerInput): OpenfortEmbeddedSigner;
|
|
2506
|
+
/**
|
|
2507
|
+
* Canonical name for the embedded-wallet `CapxulSigner` constructor
|
|
2508
|
+
* (backend-orchestrated-deploy.md). The embedded-wallet (passkey / Openfort)
|
|
2509
|
+
* member of the named constructor trio `localPrivateKeySigner` /
|
|
2510
|
+
* `injectedWalletSigner` / `embeddedSigner`. Takes the provider-agnostic
|
|
2511
|
+
* `OpenfortEmbeddedWalletPort` (getAddress + signRawDigest); the Openfort-API
|
|
2512
|
+
* convenience wrapper is `openfortEmbeddedSignerFromWallet`.
|
|
2513
|
+
*/
|
|
2514
|
+
declare const embeddedSigner: typeof openfortEmbeddedSigner;
|
|
1208
2515
|
//#endregion
|
|
1209
2516
|
//#region src/production.d.ts
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
2517
|
+
/**
|
|
2518
|
+
* Consumer-facing `createCapxulClient` input (SDK DX public surface · #326).
|
|
2519
|
+
* The publishable key is the primary input; bootstrap host, invoke timeout,
|
|
2520
|
+
* runtime detection, and auth-cache selection are SDK-owned defaults.
|
|
2521
|
+
*/
|
|
2522
|
+
interface CapxulClientInput {
|
|
1213
2523
|
readonly publishableKey: string;
|
|
1214
|
-
readonly origin?: string;
|
|
1215
|
-
readonly bootstrapBaseUrl?: string;
|
|
1216
|
-
readonly runtime?: ProductionRuntime;
|
|
1217
|
-
readonly authCache?: AuthCachePort;
|
|
1218
|
-
readonly telemetry?: TelemetryPort;
|
|
1219
|
-
readonly evmSigner?: EvmSignerPort;
|
|
1220
|
-
readonly fetch?: typeof fetch;
|
|
1221
|
-
readonly signal?: AbortSignal;
|
|
1222
|
-
readonly otpTtlMs?: number;
|
|
1223
|
-
readonly invokeTimeoutMs?: number;
|
|
1224
2524
|
/**
|
|
1225
2525
|
* Init-time account readiness target (issue #159 · AC4). Threaded into
|
|
1226
2526
|
* `assembleCapxulClient` so `client.account.{getStatus,ensureReady}` reflect
|
|
@@ -1237,27 +2537,38 @@ interface ProductionAdapterInput {
|
|
|
1237
2537
|
* holds an RPC URL, a gas-sponsorship policy, or a bundler.
|
|
1238
2538
|
*/
|
|
1239
2539
|
readonly signer?: CapxulSigner;
|
|
1240
|
-
/**
|
|
1241
|
-
* Optional live Org-deploy lane (canon D10 SDK-orchestrated Org Safe deploy +
|
|
1242
|
-
* D3 RPC treasury). Supplied as a FACTORY rather than a pre-built port because
|
|
1243
|
-
* the live `OrgPort` (`LiveOrgDeploymentAdapter`) talks to the backend
|
|
1244
|
-
* `org.createOrg` mutation through the SAME authenticated Convex seam the rest
|
|
1245
|
-
* of the client uses (`tokenProvider → getConvexJwt → ConvexCallAdapter`),
|
|
1246
|
-
* which only exists AFTER `createProductionAdapters` resolves bootstrap. The
|
|
1247
|
-
* factory receives that resolved `ConvexCallPort` and returns the port; the
|
|
1248
|
-
* CLI deploy-stack builds the factory from the deployer key + RPC (the same
|
|
1249
|
-
* env/signer as `safeDeploymentPort`). When omitted, the hermetic `$0` path
|
|
1250
|
-
* runs (a fresh Org has no on-chain funds).
|
|
1251
|
-
*/
|
|
1252
|
-
readonly orgDeploymentPortFactory?: (convex: ConvexCallPort) => OrgPort & OrgRolesDeploymentPort & OrgSpendPort;
|
|
1253
|
-
readonly orgDeploymentConfig?: SafeDeploymentConfig;
|
|
1254
2540
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
2541
|
+
//#endregion
|
|
2542
|
+
//#region src/client/create-capxul-client-from-production.d.ts
|
|
2543
|
+
/** Consumer-facing factory — accepts only production-meaningful inputs (#326). */
|
|
2544
|
+
declare function createCapxulClient(input: CapxulClientInput): Promise<CapxulResult<CapxulClient>>;
|
|
2545
|
+
//#endregion
|
|
2546
|
+
//#region src/telemetry/capture-exception.d.ts
|
|
2547
|
+
interface HandledErrorReportContext {
|
|
2548
|
+
readonly layer?: string;
|
|
2549
|
+
readonly operation?: string;
|
|
2550
|
+
readonly provider?: string;
|
|
2551
|
+
readonly capxul_error_code?: string;
|
|
2552
|
+
readonly failure_mode?: FailureMode;
|
|
1259
2553
|
}
|
|
1260
|
-
|
|
2554
|
+
/**
|
|
2555
|
+
* Capture an error as a `$exception` event through the telemetry port,
|
|
2556
|
+
* formatted for PostHog Error Tracking.
|
|
2557
|
+
*
|
|
2558
|
+
* Parses stack traces into `$exception_list` format, extracts structured
|
|
2559
|
+
* metadata from CapxulError objects, and supplements with context props.
|
|
2560
|
+
* Fire-and-forget: telemetry defects are silently swallowed.
|
|
2561
|
+
* Returns `Effect<void, never>` for use in Effect pipelines; the underlying
|
|
2562
|
+
* adapter work is synchronous, so callers outside Effect contexts can
|
|
2563
|
+
* use `Effect.runSync`.
|
|
2564
|
+
*/
|
|
2565
|
+
declare function captureException(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): Effect.Effect<void, never>;
|
|
2566
|
+
/**
|
|
2567
|
+
* Synchronous fire-and-forget capture. Runs the Effect inline with
|
|
2568
|
+
* `Effect.runSync` so callers outside an Effect context (e.g. React
|
|
2569
|
+
* hooks before throwing) can report errors without awaiting.
|
|
2570
|
+
*/
|
|
2571
|
+
declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
|
|
1261
2572
|
//#endregion
|
|
1262
|
-
export { type Account, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type
|
|
2573
|
+
export { type Account, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActorProfile, type ActorProfileMethods, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AssignRoleInput, type AuthMethods, type AuthSession, type AuthUserId, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, type CapxulResult, type CapxulSigner, type CompleteOrganizationOnboardingInput, type CompleteOrganizationOnboardingResult, type CompletePersonalOnboardingInput, type CompletePersonalOnboardingResult, type CreateCapxulClientInput, type CreateOrgInput, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, type Eip1193Provider, type Eip1193RequestProvider, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, type IdentityMethods, type InboxApproveInput, type InboxItem, type InboxMethods, type InsightsMethods, type InsightsSummary, type InviteMemberInput, type MeMethods, type MeProfile, type MemberStatus, type MemberView, type Money, type OnboardingMethods, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgBatchPayrollInput, type OrgId, type OrgMethods, type OrgPayrollRun, type OrgScopedMethods, type OrgSpendViaPaymentsInput, type OrgTemplate, type OrgView, type Payee, type PayeesMethods, type Payment, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentDraft, type PaymentDraftStatus, type PaymentMoney, type PaymentRequest, type PaymentRequestStatus, type PaymentRequestsCreateInput, type PaymentRequestsMethods, type PaymentSettlementInput, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type PaymentsPayoutInput, type PaymentsWithdrawInput, type PayrollMethods, type PayrollPayslipTemplate, type PayrollRosterAddInput, type PayrollRosterLine, type PayrollRunInput, type Profile, type RecipientResolution, type RecipientResolutionKind, type ReconciliationEntry, type Ref, type RemoveMemberInput, type ResendInviteTokenInput, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type Session, type SmartAccount, type SmartAccountMethods, type SubAccount, type SubAccountId, type SubAccountsMethods, type TelemetryPort, type TransferEndpoint, type TransferInput, type TransferResult, type WorkbenchDraftInput, type WorkbenchExecuteInput, type WorkbenchMethods, type WorkbenchMintResult, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, injectedWalletSigner, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort };
|
|
1263
2574
|
//# sourceMappingURL=index.d.mts.map
|