@capxul/sdk 1.0.0-alpha.12 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/InMemoryAuthCacheAdapter-v5W-XB5M.mjs +457 -0
- package/dist/InMemoryAuthCacheAdapter-v5W-XB5M.mjs.map +1 -0
- package/dist/index-D0SflScT.d.mts +157 -0
- package/dist/index-D0SflScT.d.mts.map +1 -0
- package/dist/index.d.mts +407 -130
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1411 -187
- 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-DMGB1kEL.d.mts → safe-deployment-ToMPzqwk.d.mts} +4 -5
- package/dist/safe-deployment-ToMPzqwk.d.mts.map +1 -0
- package/dist/{signer-DEMJbpJ2.d.mts → signer-Cp2G98ZK.d.mts} +7 -8
- package/dist/signer-Cp2G98ZK.d.mts.map +1 -0
- package/package.json +8 -8
- package/dist/InMemoryAuthCacheAdapter-EBzKEJmQ.mjs +0 -113
- package/dist/InMemoryAuthCacheAdapter-EBzKEJmQ.mjs.map +0 -1
- package/dist/safe-deployment-DMGB1kEL.d.mts.map +0 -1
- package/dist/signer-DEMJbpJ2.d.mts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as SafeDeploymentEvidence, n as SafeDeploymentConfig } from "./safe-deployment-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
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";
|
|
1
|
+
import { A as SubAccount, C as PublishableKey, D as RunId, E as RoleKey, F as CapxulErrorDetails, I as FailureMode, L as isCapxulError, 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-D0SflScT.mjs";
|
|
2
|
+
import { a as SafeDeploymentEvidence, n as SafeDeploymentConfig } from "./safe-deployment-ToMPzqwk.mjs";
|
|
3
|
+
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-Cp2G98ZK.mjs";
|
|
4
|
+
import { Hex } from "viem";
|
|
6
5
|
import { Context, Effect, Layer, Request } from "effect";
|
|
7
6
|
import { FunctionReference } from "convex/server";
|
|
8
|
-
import { Hex } from "viem";
|
|
9
7
|
import { Schema } from "@effect/schema";
|
|
10
|
-
import { AttachablePaymentDocumentEnvelopeV1, LineItemV1, OnchainEvidence, PaymentDocumentEnvelopeV1, WithdrawalDocumentEnvelopeV1 } from "@capxul/wire";
|
|
11
|
-
import { TelemetryPort } from "@capxul/observability";
|
|
12
8
|
import { Machine } from "@effect/experimental";
|
|
13
9
|
|
|
14
10
|
//#region src/ports/auth-client.d.ts
|
|
@@ -43,8 +39,8 @@ declare class AuthClientError extends AuthClientError_base<{
|
|
|
43
39
|
interface AuthClientPort {
|
|
44
40
|
canSendOtp(input: CanSendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<CanSendOtpStatus, AuthClientError>;
|
|
45
41
|
sendOtp(input: SendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
46
|
-
verifyOtp(input: VerifyOtpInput, options?: AuthClientOperationOptions): Effect.Effect<AuthSession
|
|
47
|
-
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>;
|
|
48
44
|
signOut(options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
49
45
|
/**
|
|
50
46
|
* Fetches a Convex-aud JWT from `/api/auth/convex/token` (W7). Server mints
|
|
@@ -69,6 +65,50 @@ declare class ClockError extends ClockError_base<{
|
|
|
69
65
|
readonly cause: unknown;
|
|
70
66
|
}> {}
|
|
71
67
|
//#endregion
|
|
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
|
+
*/
|
|
84
|
+
interface TelemetryPort {
|
|
85
|
+
readonly emit: (event: TelemetryEvent) => Effect.Effect<void, never>;
|
|
86
|
+
readonly identify: (input: TelemetryIdentifyInput) => Effect.Effect<void, never>;
|
|
87
|
+
readonly group: (input: TelemetryGroupInput) => Effect.Effect<void, never>;
|
|
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;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
72
112
|
//#region src/flows/auth.d.ts
|
|
73
113
|
interface AuthFlowInput {
|
|
74
114
|
readonly otpTtlMs?: number;
|
|
@@ -77,10 +117,10 @@ type AuthFlowState = "idle" | "sending_otp" | "otp_requested" | "verifying" | "a
|
|
|
77
117
|
interface AuthFlowContext {
|
|
78
118
|
readonly state: AuthFlowState;
|
|
79
119
|
readonly email: Email | null;
|
|
80
|
-
readonly session: AuthSession
|
|
120
|
+
readonly session: AuthSession | null;
|
|
81
121
|
readonly otpRequestedAt: EpochMs | null;
|
|
82
122
|
readonly anonDistinctId?: AnonymousDistinctId;
|
|
83
|
-
readonly error: CapxulError
|
|
123
|
+
readonly error: CapxulError | null;
|
|
84
124
|
}
|
|
85
125
|
interface AuthFlowObserver {
|
|
86
126
|
readonly input: AuthFlowInput;
|
|
@@ -108,10 +148,10 @@ declare const EnvError_base: new <A extends Record<string, any> = {}>(args: impo
|
|
|
108
148
|
readonly _tag: "EnvError";
|
|
109
149
|
} & Readonly<A>;
|
|
110
150
|
declare class EnvError extends EnvError_base<{
|
|
111
|
-
readonly publicError: CapxulError
|
|
112
|
-
readonly publicCode?: CapxulErrorCode
|
|
151
|
+
readonly publicError: CapxulError;
|
|
152
|
+
readonly publicCode?: CapxulErrorCode;
|
|
113
153
|
readonly key?: string;
|
|
114
|
-
readonly details?: CapxulErrorDetails
|
|
154
|
+
readonly details?: CapxulErrorDetails;
|
|
115
155
|
readonly cause?: unknown;
|
|
116
156
|
}> {}
|
|
117
157
|
interface EnvPort {
|
|
@@ -133,11 +173,11 @@ declare const TransportError_base: new <A extends Record<string, any> = {}>(args
|
|
|
133
173
|
declare class TransportError extends TransportError_base<{
|
|
134
174
|
readonly operation: TransportOperationKind;
|
|
135
175
|
readonly name: string;
|
|
136
|
-
readonly publicCode: CapxulErrorCode
|
|
137
|
-
readonly publicError: CapxulError
|
|
176
|
+
readonly publicCode: CapxulErrorCode;
|
|
177
|
+
readonly publicError: CapxulError;
|
|
138
178
|
readonly cause: unknown;
|
|
139
179
|
readonly correlationId?: string;
|
|
140
|
-
readonly details?: CapxulErrorDetails
|
|
180
|
+
readonly details?: CapxulErrorDetails;
|
|
141
181
|
}> {}
|
|
142
182
|
interface TransportPort {
|
|
143
183
|
readonly runQuery: <TOutput = unknown, TArgs = unknown>(request: TransportRequest<TArgs>) => Effect.Effect<TOutput, TransportError>;
|
|
@@ -179,9 +219,9 @@ declare const BootstrapError_base: new <A extends Record<string, any> = {}>(args
|
|
|
179
219
|
declare class BootstrapError extends BootstrapError_base<{
|
|
180
220
|
readonly operation: "resolve";
|
|
181
221
|
readonly kind: BootstrapErrorKind;
|
|
182
|
-
readonly publicCode: CapxulErrorCode
|
|
222
|
+
readonly publicCode: CapxulErrorCode;
|
|
183
223
|
readonly cause: unknown;
|
|
184
|
-
readonly details?: CapxulErrorDetails
|
|
224
|
+
readonly details?: CapxulErrorDetails;
|
|
185
225
|
}> {}
|
|
186
226
|
interface BootstrapPort {
|
|
187
227
|
readonly resolve: (input: BootstrapInput) => Effect.Effect<BootstrapResolution, BootstrapError>;
|
|
@@ -225,7 +265,7 @@ type Unsubscribe = () => void;
|
|
|
225
265
|
*
|
|
226
266
|
* @internal-use
|
|
227
267
|
*/
|
|
228
|
-
type Snapshot<T, E = CapxulError
|
|
268
|
+
type Snapshot<T, E = CapxulError> = {
|
|
229
269
|
readonly status: "loading";
|
|
230
270
|
} | {
|
|
231
271
|
readonly status: "ok";
|
|
@@ -241,10 +281,10 @@ declare const ConvexCallError_base: new <A extends Record<string, any> = {}>(arg
|
|
|
241
281
|
} & Readonly<A>;
|
|
242
282
|
declare class ConvexCallError extends ConvexCallError_base<{
|
|
243
283
|
readonly operation: string;
|
|
244
|
-
readonly publicCode: CapxulErrorCode
|
|
245
|
-
readonly publicError: CapxulError
|
|
284
|
+
readonly publicCode: CapxulErrorCode;
|
|
285
|
+
readonly publicError: CapxulError;
|
|
246
286
|
readonly cause: unknown;
|
|
247
|
-
readonly details?: CapxulErrorDetails
|
|
287
|
+
readonly details?: CapxulErrorDetails;
|
|
248
288
|
}> {}
|
|
249
289
|
interface ConvexCallPort {
|
|
250
290
|
query<TArgs extends Record<string, unknown>, TOutput>(fn: FunctionReference<"query", "public", TArgs, TOutput>, args: TArgs): Effect.Effect<TOutput, ConvexCallError>;
|
|
@@ -261,22 +301,22 @@ interface ConvexCallPort {
|
|
|
261
301
|
//#endregion
|
|
262
302
|
//#region src/ports/credentials.d.ts
|
|
263
303
|
type CreateApplicationInput = {
|
|
264
|
-
readonly authUserId: AuthUserId
|
|
304
|
+
readonly authUserId: AuthUserId;
|
|
265
305
|
readonly name: string;
|
|
266
306
|
readonly allowedOrigins: readonly AllowedOrigin[];
|
|
267
307
|
};
|
|
268
308
|
type MintKeyInput = {
|
|
269
309
|
readonly applicationId: AppId;
|
|
270
|
-
readonly authUserId: AuthUserId
|
|
310
|
+
readonly authUserId: AuthUserId;
|
|
271
311
|
};
|
|
272
312
|
type RotateKeyInput = {
|
|
273
313
|
readonly keyId: PublishableKeyId;
|
|
274
|
-
readonly authUserId: AuthUserId
|
|
314
|
+
readonly authUserId: AuthUserId;
|
|
275
315
|
readonly graceMs: DurationMs;
|
|
276
316
|
};
|
|
277
317
|
type RevokeKeyInput = {
|
|
278
318
|
readonly keyId: PublishableKeyId;
|
|
279
|
-
readonly authUserId: AuthUserId
|
|
319
|
+
readonly authUserId: AuthUserId;
|
|
280
320
|
};
|
|
281
321
|
type RotateKeyResult = {
|
|
282
322
|
readonly active: PublishableKeyRecord;
|
|
@@ -287,13 +327,13 @@ declare const CredentialsError_base: new <A extends Record<string, any> = {}>(ar
|
|
|
287
327
|
} & Readonly<A>;
|
|
288
328
|
declare class CredentialsError extends CredentialsError_base<{
|
|
289
329
|
readonly operation: string;
|
|
290
|
-
readonly publicCode: CapxulErrorCode
|
|
291
|
-
readonly publicError: CapxulError
|
|
330
|
+
readonly publicCode: CapxulErrorCode;
|
|
331
|
+
readonly publicError: CapxulError;
|
|
292
332
|
readonly cause: unknown;
|
|
293
|
-
readonly details?: CapxulErrorDetails
|
|
333
|
+
readonly details?: CapxulErrorDetails;
|
|
294
334
|
}> {}
|
|
295
335
|
interface CredentialsPort {
|
|
296
|
-
listApplications(authUserId: AuthUserId
|
|
336
|
+
listApplications(authUserId: AuthUserId): Effect.Effect<readonly DeveloperApplication[], CredentialsError>;
|
|
297
337
|
createApplication(input: CreateApplicationInput): Effect.Effect<DeveloperApplication, CredentialsError>;
|
|
298
338
|
mintPublishableKey(input: MintKeyInput): Effect.Effect<PublishableKeyRecord, CredentialsError>;
|
|
299
339
|
rotatePublishableKey(input: RotateKeyInput): Effect.Effect<RotateKeyResult, CredentialsError>;
|
|
@@ -302,13 +342,13 @@ interface CredentialsPort {
|
|
|
302
342
|
//#endregion
|
|
303
343
|
//#region src/ports/identity.d.ts
|
|
304
344
|
type CreateIdentityInput = {
|
|
305
|
-
readonly authUserId: AuthUserId
|
|
345
|
+
readonly authUserId: AuthUserId;
|
|
306
346
|
readonly email: Email;
|
|
307
347
|
readonly displayName?: string;
|
|
308
348
|
readonly country?: CountryCode;
|
|
309
349
|
};
|
|
310
350
|
type UpdateIdentityInput = {
|
|
311
|
-
readonly authUserId: AuthUserId
|
|
351
|
+
readonly authUserId: AuthUserId;
|
|
312
352
|
readonly displayName?: string;
|
|
313
353
|
readonly country?: CountryCode;
|
|
314
354
|
};
|
|
@@ -321,24 +361,24 @@ type UpdateIdentityInput = {
|
|
|
321
361
|
* flags live on the wire row and are not projected onto the read surface.
|
|
322
362
|
*/
|
|
323
363
|
type CompleteOnboardingIdentityInput = {
|
|
324
|
-
readonly authUserId: AuthUserId
|
|
364
|
+
readonly authUserId: AuthUserId;
|
|
325
365
|
readonly email: Email;
|
|
326
366
|
readonly displayName: string;
|
|
327
367
|
readonly country: CountryCode;
|
|
328
|
-
readonly withdrawalAddress?: Address
|
|
368
|
+
readonly withdrawalAddress?: Address;
|
|
329
369
|
};
|
|
330
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 & {
|
|
331
371
|
readonly _tag: "IdentityError";
|
|
332
372
|
} & Readonly<A>;
|
|
333
373
|
declare class IdentityError extends IdentityError_base<{
|
|
334
374
|
readonly operation: string;
|
|
335
|
-
readonly publicCode: CapxulErrorCode
|
|
336
|
-
readonly publicError: CapxulError
|
|
375
|
+
readonly publicCode: CapxulErrorCode;
|
|
376
|
+
readonly publicError: CapxulError;
|
|
337
377
|
readonly cause: unknown;
|
|
338
|
-
readonly details?: CapxulErrorDetails
|
|
378
|
+
readonly details?: CapxulErrorDetails;
|
|
339
379
|
}> {}
|
|
340
380
|
interface IdentityPort {
|
|
341
|
-
loadByAuthUserId(authUserId: AuthUserId
|
|
381
|
+
loadByAuthUserId(authUserId: AuthUserId): Effect.Effect<Profile$1 | null, IdentityError, never>;
|
|
342
382
|
create(input: CreateIdentityInput): Effect.Effect<Profile$1, IdentityError, never>;
|
|
343
383
|
update(input: UpdateIdentityInput): Effect.Effect<Profile$1, IdentityError, never>;
|
|
344
384
|
/** D-ONBOARD (#669): idempotent upsert that marks the identity onboarded. */
|
|
@@ -347,7 +387,7 @@ interface IdentityPort {
|
|
|
347
387
|
//#endregion
|
|
348
388
|
//#region src/ports/smart-account.d.ts
|
|
349
389
|
type ProvisionInput = {
|
|
350
|
-
readonly authUserId: AuthUserId
|
|
390
|
+
readonly authUserId: AuthUserId;
|
|
351
391
|
readonly chainId: ChainId;
|
|
352
392
|
};
|
|
353
393
|
/**
|
|
@@ -365,9 +405,9 @@ type ProvisionInput = {
|
|
|
365
405
|
* `eth_getUserOperationReceipt(userOpHash)` to re-verify and derive.
|
|
366
406
|
*/
|
|
367
407
|
type ConfirmDeploymentInput = {
|
|
368
|
-
readonly authUserId: AuthUserId
|
|
408
|
+
readonly authUserId: AuthUserId;
|
|
369
409
|
readonly chainId: ChainId;
|
|
370
|
-
readonly safeAddress: Address
|
|
410
|
+
readonly safeAddress: Address;
|
|
371
411
|
readonly evidence: SafeDeploymentEvidence;
|
|
372
412
|
/**
|
|
373
413
|
* Optional live-E2E correlation id. This does not prove deployment; the
|
|
@@ -383,9 +423,9 @@ type ConfirmDeploymentInput = {
|
|
|
383
423
|
* nothing at claim.
|
|
384
424
|
*/
|
|
385
425
|
type ClaimInput = {
|
|
386
|
-
readonly authUserId: AuthUserId
|
|
426
|
+
readonly authUserId: AuthUserId;
|
|
387
427
|
readonly chainId: ChainId;
|
|
388
|
-
readonly signerAddress: Address
|
|
428
|
+
readonly signerAddress: Address;
|
|
389
429
|
readonly telemetryRunId?: RunId;
|
|
390
430
|
};
|
|
391
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 & {
|
|
@@ -393,14 +433,14 @@ declare const SmartAccountError_base: new <A extends Record<string, any> = {}>(a
|
|
|
393
433
|
} & Readonly<A>;
|
|
394
434
|
declare class SmartAccountError extends SmartAccountError_base<{
|
|
395
435
|
readonly operation: string;
|
|
396
|
-
readonly publicCode: CapxulErrorCode
|
|
397
|
-
readonly publicError: CapxulError
|
|
436
|
+
readonly publicCode: CapxulErrorCode;
|
|
437
|
+
readonly publicError: CapxulError;
|
|
398
438
|
readonly cause: unknown;
|
|
399
|
-
readonly details?: CapxulErrorDetails
|
|
439
|
+
readonly details?: CapxulErrorDetails;
|
|
400
440
|
}> {}
|
|
401
441
|
interface SmartAccountPort {
|
|
402
|
-
loadByAuthUserId(authUserId: AuthUserId
|
|
403
|
-
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>;
|
|
404
444
|
provision(input: ProvisionInput): Effect.Effect<SmartAccount$1, SmartAccountError, never>;
|
|
405
445
|
/**
|
|
406
446
|
* Persist on-chain Safe-deployment evidence. The backend re-verifies
|
|
@@ -428,7 +468,7 @@ type ReadAccountBalanceInput = {
|
|
|
428
468
|
};
|
|
429
469
|
type FundFromFaucetInput = {
|
|
430
470
|
readonly chainId: ChainId;
|
|
431
|
-
readonly amount: Money
|
|
471
|
+
readonly amount: Money;
|
|
432
472
|
};
|
|
433
473
|
type FundFromFaucetResult = {
|
|
434
474
|
readonly txHash: string;
|
|
@@ -438,17 +478,17 @@ declare const AccountReadError_base: new <A extends Record<string, any> = {}>(ar
|
|
|
438
478
|
} & Readonly<A>;
|
|
439
479
|
declare class AccountReadError extends AccountReadError_base<{
|
|
440
480
|
readonly operation: string;
|
|
441
|
-
readonly publicCode: CapxulErrorCode
|
|
442
|
-
readonly publicError: CapxulError
|
|
481
|
+
readonly publicCode: CapxulErrorCode;
|
|
482
|
+
readonly publicError: CapxulError;
|
|
443
483
|
readonly cause: unknown;
|
|
444
|
-
readonly details?: CapxulErrorDetails
|
|
484
|
+
readonly details?: CapxulErrorDetails;
|
|
445
485
|
}> {}
|
|
446
486
|
/**
|
|
447
487
|
* Logical Account money read (M2 Slice S1a). Joins the `accounts` row with a
|
|
448
488
|
* live RPC `balanceOf` pull; the adapter lifts wire integers to `Money`.
|
|
449
489
|
*/
|
|
450
490
|
interface AccountReadPort {
|
|
451
|
-
readBalance(input: ReadAccountBalanceInput): Effect.Effect<Account
|
|
491
|
+
readBalance(input: ReadAccountBalanceInput): Effect.Effect<Account, AccountReadError, never>;
|
|
452
492
|
fundFromFaucet(input: FundFromFaucetInput): Effect.Effect<FundFromFaucetResult, AccountReadError, never>;
|
|
453
493
|
}
|
|
454
494
|
//#endregion
|
|
@@ -458,20 +498,20 @@ declare const SubAccountError_base: new <A extends Record<string, any> = {}>(arg
|
|
|
458
498
|
} & Readonly<A>;
|
|
459
499
|
declare class SubAccountError extends SubAccountError_base<{
|
|
460
500
|
readonly operation: string;
|
|
461
|
-
readonly publicCode: CapxulErrorCode
|
|
462
|
-
readonly publicError: CapxulError
|
|
501
|
+
readonly publicCode: CapxulErrorCode;
|
|
502
|
+
readonly publicError: CapxulError;
|
|
463
503
|
readonly cause: unknown;
|
|
464
|
-
readonly details?: CapxulErrorDetails
|
|
504
|
+
readonly details?: CapxulErrorDetails;
|
|
465
505
|
}> {}
|
|
466
506
|
type CreateSubAccountInput = {
|
|
467
507
|
readonly accountId: AccountId;
|
|
468
508
|
readonly name: string;
|
|
469
509
|
};
|
|
470
510
|
type SubAccountIdInput = {
|
|
471
|
-
readonly subAccountId: SubAccountId
|
|
511
|
+
readonly subAccountId: SubAccountId;
|
|
472
512
|
};
|
|
473
513
|
type RenameSubAccountInput = {
|
|
474
|
-
readonly subAccountId: SubAccountId
|
|
514
|
+
readonly subAccountId: SubAccountId;
|
|
475
515
|
readonly name: string;
|
|
476
516
|
};
|
|
477
517
|
/**
|
|
@@ -480,7 +520,7 @@ type RenameSubAccountInput = {
|
|
|
480
520
|
* specific sub-account, addressed by its `SubAccountId` (canon
|
|
481
521
|
* `account-balance-model.md` §5, §12).
|
|
482
522
|
*/
|
|
483
|
-
type TransferEndpoint = "main" | SubAccountId
|
|
523
|
+
type TransferEndpoint = "main" | SubAccountId;
|
|
484
524
|
/**
|
|
485
525
|
* Move money between two of the SAME Account's balances (canon §12). The
|
|
486
526
|
* backend resolves the Account from auth (v1 = one Account per user), so the
|
|
@@ -491,7 +531,7 @@ type TransferEndpoint = "main" | SubAccountId$1;
|
|
|
491
531
|
type TransferInput = {
|
|
492
532
|
readonly from: TransferEndpoint;
|
|
493
533
|
readonly to: TransferEndpoint;
|
|
494
|
-
readonly amount: Money
|
|
534
|
+
readonly amount: Money;
|
|
495
535
|
};
|
|
496
536
|
/**
|
|
497
537
|
* Result of a `transfer`: the recomputed `available` (`balanceOf − Σ`), plus
|
|
@@ -499,17 +539,17 @@ type TransferInput = {
|
|
|
499
539
|
* has no stored row, so its slot is `null`.
|
|
500
540
|
*/
|
|
501
541
|
type TransferResult = {
|
|
502
|
-
readonly available: Money
|
|
503
|
-
readonly from: SubAccount
|
|
504
|
-
readonly to: SubAccount
|
|
542
|
+
readonly available: Money;
|
|
543
|
+
readonly from: SubAccount | null;
|
|
544
|
+
readonly to: SubAccount | null;
|
|
505
545
|
};
|
|
506
546
|
interface SubAccountPort {
|
|
507
|
-
create(input: CreateSubAccountInput): Effect.Effect<SubAccount
|
|
508
|
-
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>;
|
|
509
549
|
list(input: {
|
|
510
550
|
readonly accountId: AccountId;
|
|
511
|
-
}): Effect.Effect<readonly SubAccount
|
|
512
|
-
rename(input: RenameSubAccountInput): Effect.Effect<SubAccount
|
|
551
|
+
}): Effect.Effect<readonly SubAccount[], SubAccountError, never>;
|
|
552
|
+
rename(input: RenameSubAccountInput): Effect.Effect<SubAccount, SubAccountError, never>;
|
|
513
553
|
delete(input: SubAccountIdInput): Effect.Effect<void, SubAccountError, never>;
|
|
514
554
|
transfer(input: TransferInput): Effect.Effect<TransferResult, SubAccountError, never>;
|
|
515
555
|
}
|
|
@@ -572,7 +612,7 @@ interface FlowPorts {
|
|
|
572
612
|
* convention, flow-shape composites stay co-located with their flow.
|
|
573
613
|
*/
|
|
574
614
|
interface ExternalSigner {
|
|
575
|
-
readonly address: Address
|
|
615
|
+
readonly address: Address;
|
|
576
616
|
readonly signedProof: string;
|
|
577
617
|
}
|
|
578
618
|
//#endregion
|
|
@@ -634,7 +674,7 @@ type ProvisioningPhase = {
|
|
|
634
674
|
} | {
|
|
635
675
|
readonly status: "failed";
|
|
636
676
|
readonly at: ProvisioningFailureStep;
|
|
637
|
-
readonly error: CapxulError
|
|
677
|
+
readonly error: CapxulError;
|
|
638
678
|
};
|
|
639
679
|
//#endregion
|
|
640
680
|
//#region src/client/account-lifecycle.d.ts
|
|
@@ -651,10 +691,247 @@ type AccountLifecycle = {
|
|
|
651
691
|
} | {
|
|
652
692
|
readonly status: "failed";
|
|
653
693
|
readonly at: AccountSetupStep;
|
|
654
|
-
readonly error: CapxulError
|
|
694
|
+
readonly error: CapxulError;
|
|
655
695
|
};
|
|
656
696
|
declare function isSettingUpLifecycle(lifecycle: AccountLifecycle): boolean;
|
|
657
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
|
|
658
935
|
//#region src/client/financial-ops.d.ts
|
|
659
936
|
type ActorReference = {
|
|
660
937
|
readonly kind: "personal";
|
|
@@ -1511,7 +1788,7 @@ type AccountStatus = {
|
|
|
1511
1788
|
readonly requirement: AccountRequirement;
|
|
1512
1789
|
readonly chainId: number;
|
|
1513
1790
|
readonly source: AccountProviderSource;
|
|
1514
|
-
readonly signerAddress: Address
|
|
1791
|
+
readonly signerAddress: Address;
|
|
1515
1792
|
} | {
|
|
1516
1793
|
readonly status: "accountPrepared";
|
|
1517
1794
|
readonly requirement: AccountRequirement;
|
|
@@ -1590,7 +1867,7 @@ interface AccountInternalSurface {
|
|
|
1590
1867
|
interface AccountsMethods {
|
|
1591
1868
|
read(options?: {
|
|
1592
1869
|
readonly signal?: AbortSignal;
|
|
1593
|
-
}): Promise<CapxulResult<Account
|
|
1870
|
+
}): Promise<CapxulResult<Account>>;
|
|
1594
1871
|
}
|
|
1595
1872
|
/**
|
|
1596
1873
|
* Faucet surface (dev-only). Deliberately OFF the public `AccountsMethods`;
|
|
@@ -1598,7 +1875,7 @@ interface AccountsMethods {
|
|
|
1598
1875
|
* The reference CLI uses it behind a test-env gate — consumers never see `fund`.
|
|
1599
1876
|
*/
|
|
1600
1877
|
interface AccountsFaucetMethods {
|
|
1601
|
-
fund(amount: Money
|
|
1878
|
+
fund(amount: Money, options?: {
|
|
1602
1879
|
readonly signal?: AbortSignal;
|
|
1603
1880
|
}): Promise<CapxulResult<{
|
|
1604
1881
|
readonly txHash: string;
|
|
@@ -1613,12 +1890,12 @@ interface AccountsFaucetMethods {
|
|
|
1613
1890
|
* (handle/email/payee/org) compared in the same ref space as the role's set.
|
|
1614
1891
|
* Comparison is case-insensitive over the raw string value either way.
|
|
1615
1892
|
*/
|
|
1616
|
-
type SpendGateRecipients = "anyone" | readonly (Address
|
|
1893
|
+
type SpendGateRecipients = "anyone" | readonly (Address | string)[];
|
|
1617
1894
|
type SpendGateSubAccountScope = {
|
|
1618
1895
|
readonly scope: "all";
|
|
1619
1896
|
} | {
|
|
1620
1897
|
readonly scope: "only";
|
|
1621
|
-
readonly subAccountIds: readonly SubAccountId
|
|
1898
|
+
readonly subAccountIds: readonly SubAccountId[];
|
|
1622
1899
|
};
|
|
1623
1900
|
//#endregion
|
|
1624
1901
|
//#region src/ports/org.d.ts
|
|
@@ -1630,48 +1907,48 @@ type SpendGateSubAccountScope = {
|
|
|
1630
1907
|
* internally and enforces the real validated recipient on the gate.
|
|
1631
1908
|
*/
|
|
1632
1909
|
type OrgSpendShape = {
|
|
1633
|
-
readonly from: SubAccountId
|
|
1634
|
-
readonly to: Address
|
|
1635
|
-
readonly amount: Money
|
|
1910
|
+
readonly from: SubAccountId;
|
|
1911
|
+
readonly to: Address;
|
|
1912
|
+
readonly amount: Money;
|
|
1636
1913
|
};
|
|
1637
1914
|
type CreateOrgPortInput = {
|
|
1638
1915
|
readonly input: CreateOrgInput;
|
|
1639
1916
|
};
|
|
1640
1917
|
type ReadOrgTreasuryInput = {
|
|
1641
|
-
readonly orgId: OrgId
|
|
1918
|
+
readonly orgId: OrgId;
|
|
1642
1919
|
};
|
|
1643
1920
|
type ListOrgsInput = Record<never, never>;
|
|
1644
1921
|
type ListOrgRolesInput = {
|
|
1645
|
-
readonly orgId: OrgId
|
|
1922
|
+
readonly orgId: OrgId;
|
|
1646
1923
|
};
|
|
1647
1924
|
type ListOrgMembersInput = {
|
|
1648
|
-
readonly orgId: OrgId
|
|
1925
|
+
readonly orgId: OrgId;
|
|
1649
1926
|
};
|
|
1650
1927
|
type InviteOrgMemberInput = {
|
|
1651
|
-
readonly orgId: OrgId
|
|
1928
|
+
readonly orgId: OrgId;
|
|
1652
1929
|
readonly input: InviteMemberInput;
|
|
1653
1930
|
};
|
|
1654
1931
|
type ResendOrgInviteTokenInput = {
|
|
1655
|
-
readonly orgId: OrgId
|
|
1932
|
+
readonly orgId: OrgId;
|
|
1656
1933
|
readonly email: string;
|
|
1657
1934
|
};
|
|
1658
1935
|
type DetectPendingOrgInvitationsInput = Record<never, never>;
|
|
1659
1936
|
type DetectPendingOrgInvitationsResult$1 = {
|
|
1660
|
-
readonly matched: readonly OrgId
|
|
1937
|
+
readonly matched: readonly OrgId[];
|
|
1661
1938
|
};
|
|
1662
1939
|
type DeployOrgRolesInput = {
|
|
1663
|
-
readonly orgId: OrgId
|
|
1940
|
+
readonly orgId: OrgId;
|
|
1664
1941
|
};
|
|
1665
1942
|
type OrgRolesDeploymentResult = {
|
|
1666
|
-
readonly orgId: OrgId
|
|
1943
|
+
readonly orgId: OrgId;
|
|
1667
1944
|
readonly roles: readonly RoleView[];
|
|
1668
1945
|
};
|
|
1669
1946
|
type GrantOrgRoleInput = {
|
|
1670
|
-
readonly orgId: OrgId
|
|
1947
|
+
readonly orgId: OrgId;
|
|
1671
1948
|
readonly input: AssignRoleInput;
|
|
1672
1949
|
};
|
|
1673
1950
|
type RevokeOrgRoleInput = {
|
|
1674
|
-
readonly orgId: OrgId
|
|
1951
|
+
readonly orgId: OrgId;
|
|
1675
1952
|
readonly input: RemoveMemberInput;
|
|
1676
1953
|
};
|
|
1677
1954
|
type OrgSpendAuthority = {
|
|
@@ -1685,7 +1962,7 @@ type OrgSpendAuthority = {
|
|
|
1685
1962
|
readonly role?: string;
|
|
1686
1963
|
};
|
|
1687
1964
|
type ReadOrgSpendAuthorityInput = {
|
|
1688
|
-
readonly orgId: OrgId
|
|
1965
|
+
readonly orgId: OrgId;
|
|
1689
1966
|
readonly input: OrgSpendShape;
|
|
1690
1967
|
readonly amountRaw: string;
|
|
1691
1968
|
};
|
|
@@ -1694,10 +1971,10 @@ declare const OrgError_base: new <A extends Record<string, any> = {}>(args: impo
|
|
|
1694
1971
|
} & Readonly<A>;
|
|
1695
1972
|
declare class OrgError extends OrgError_base<{
|
|
1696
1973
|
readonly operation: string;
|
|
1697
|
-
readonly publicCode: CapxulErrorCode
|
|
1698
|
-
readonly publicError: CapxulError
|
|
1974
|
+
readonly publicCode: CapxulErrorCode;
|
|
1975
|
+
readonly publicError: CapxulError;
|
|
1699
1976
|
readonly cause: unknown;
|
|
1700
|
-
readonly details?: CapxulErrorDetails
|
|
1977
|
+
readonly details?: CapxulErrorDetails;
|
|
1701
1978
|
}> {}
|
|
1702
1979
|
/**
|
|
1703
1980
|
* Live org seam. `createOrg` runs the SDK-orchestrated deploy (D10) and returns
|
|
@@ -1707,7 +1984,7 @@ declare class OrgError extends OrgError_base<{
|
|
|
1707
1984
|
*/
|
|
1708
1985
|
interface OrgPort {
|
|
1709
1986
|
createOrg(input: CreateOrgPortInput): Effect.Effect<OrgView, OrgError, never>;
|
|
1710
|
-
readTreasury(input: ReadOrgTreasuryInput): Effect.Effect<Account
|
|
1987
|
+
readTreasury(input: ReadOrgTreasuryInput): Effect.Effect<Account, OrgError, never>;
|
|
1711
1988
|
listOrgs(input: ListOrgsInput): Effect.Effect<readonly OrgView[], OrgError, never>;
|
|
1712
1989
|
listRoles(input: ListOrgRolesInput): Effect.Effect<readonly RoleView[], OrgError, never>;
|
|
1713
1990
|
listMembers(input: ListOrgMembersInput): Effect.Effect<readonly MemberView[], OrgError, never>;
|
|
@@ -1722,13 +1999,13 @@ interface OrgRolesDeploymentPort {
|
|
|
1722
1999
|
revokeRole(input: RevokeOrgRoleInput): Effect.Effect<void, OrgError, never>;
|
|
1723
2000
|
}
|
|
1724
2001
|
type SubmitOrgSpendViaPaymentsInput = {
|
|
1725
|
-
readonly orgId: OrgId
|
|
2002
|
+
readonly orgId: OrgId;
|
|
1726
2003
|
readonly input: OrgSpendViaPaymentsInput;
|
|
1727
2004
|
readonly amountRaw: string;
|
|
1728
2005
|
readonly authority: OrgSpendAuthority;
|
|
1729
2006
|
};
|
|
1730
2007
|
type SubmitOrgBatchPayrollInput = {
|
|
1731
|
-
readonly orgId: OrgId
|
|
2008
|
+
readonly orgId: OrgId;
|
|
1732
2009
|
readonly from: OrgSpendViaPaymentsInput["from"];
|
|
1733
2010
|
readonly runs: readonly {
|
|
1734
2011
|
readonly run: OrgPayrollRun;
|
|
@@ -1768,18 +2045,18 @@ type MemberStatus = "pending" | "pending_safe" | "pending_grant" | "active" | "r
|
|
|
1768
2045
|
* brand.
|
|
1769
2046
|
*/
|
|
1770
2047
|
type OrgView = {
|
|
1771
|
-
readonly id: OrgId
|
|
2048
|
+
readonly id: OrgId;
|
|
1772
2049
|
readonly name: string;
|
|
1773
2050
|
readonly handle: string;
|
|
1774
|
-
readonly safeAddress: Address
|
|
2051
|
+
readonly safeAddress: Address; /** The viewing member's own role label within this org. */
|
|
1775
2052
|
readonly role: string; /** The Org treasury — the real M2 Account over the Org Safe (D3). */
|
|
1776
|
-
readonly treasury: Account
|
|
2053
|
+
readonly treasury: Account;
|
|
1777
2054
|
};
|
|
1778
2055
|
interface OrganizationAccount {
|
|
1779
2056
|
readonly id: string;
|
|
1780
2057
|
readonly address: string | null;
|
|
1781
|
-
readonly balance: Money
|
|
1782
|
-
readonly available: Money
|
|
2058
|
+
readonly balance: Money;
|
|
2059
|
+
readonly available: Money;
|
|
1783
2060
|
}
|
|
1784
2061
|
interface OrganizationAuditLogItem {
|
|
1785
2062
|
readonly id: string;
|
|
@@ -1797,12 +2074,12 @@ interface OrganizationAuditLogItem {
|
|
|
1797
2074
|
* yet provisioned a personal Safe). `email` is the universal entry point (D8).
|
|
1798
2075
|
*/
|
|
1799
2076
|
type MemberView = {
|
|
1800
|
-
readonly orgId: OrgId
|
|
2077
|
+
readonly orgId: OrgId;
|
|
1801
2078
|
readonly email: Email;
|
|
1802
2079
|
readonly name: string | null; /** Member-identity key (D7). `null` until the invitee provisions a Safe. */
|
|
1803
|
-
readonly personalSafeAddress: Address
|
|
2080
|
+
readonly personalSafeAddress: Address | null; /** The member's role label (maps deterministically to the on-chain `roleKey`, D9). */
|
|
1804
2081
|
readonly role: string;
|
|
1805
|
-
readonly roleKey: RoleKey
|
|
2082
|
+
readonly roleKey: RoleKey | null;
|
|
1806
2083
|
readonly status: MemberStatus;
|
|
1807
2084
|
readonly grantTxHash: string | null;
|
|
1808
2085
|
readonly revokeTxHash: string | null;
|
|
@@ -1814,9 +2091,9 @@ type MemberView = {
|
|
|
1814
2091
|
* (the Owner role).
|
|
1815
2092
|
*/
|
|
1816
2093
|
type RoleSpendCap = {
|
|
1817
|
-
readonly perTx?: Money
|
|
1818
|
-
readonly perDay?: Money
|
|
1819
|
-
readonly toRecipients?: "anyone" | readonly Address
|
|
2094
|
+
readonly perTx?: Money;
|
|
2095
|
+
readonly perDay?: Money;
|
|
2096
|
+
readonly toRecipients?: "anyone" | readonly Address[];
|
|
1820
2097
|
};
|
|
1821
2098
|
/**
|
|
1822
2099
|
* The Capxul-owned Role DSL definition (D4). `label` becomes the sticky
|
|
@@ -1828,7 +2105,7 @@ type RoleDefinition = {
|
|
|
1828
2105
|
readonly label: string;
|
|
1829
2106
|
readonly spend?: RoleSpendCap;
|
|
1830
2107
|
readonly subAccounts?: {
|
|
1831
|
-
readonly scope: "all" | readonly SubAccountId
|
|
2108
|
+
readonly scope: "all" | readonly SubAccountId[];
|
|
1832
2109
|
};
|
|
1833
2110
|
readonly canManageMembers?: boolean;
|
|
1834
2111
|
readonly canManageRoles?: boolean;
|
|
@@ -1839,9 +2116,9 @@ type RoleDefinition = {
|
|
|
1839
2116
|
* is the full Role DSL entry.
|
|
1840
2117
|
*/
|
|
1841
2118
|
type RoleView = {
|
|
1842
|
-
readonly orgId: OrgId
|
|
2119
|
+
readonly orgId: OrgId;
|
|
1843
2120
|
readonly label: string;
|
|
1844
|
-
readonly roleKey: RoleKey
|
|
2121
|
+
readonly roleKey: RoleKey;
|
|
1845
2122
|
readonly definition: RoleDefinition;
|
|
1846
2123
|
};
|
|
1847
2124
|
/** Built-in role templates that seed a new Org at creation (D6). */
|
|
@@ -1879,7 +2156,7 @@ type ResendInviteTokenInput = {
|
|
|
1879
2156
|
* mirror.
|
|
1880
2157
|
*/
|
|
1881
2158
|
type RemoveMemberInput = {
|
|
1882
|
-
readonly memberSafeAddress: Address
|
|
2159
|
+
readonly memberSafeAddress: Address;
|
|
1883
2160
|
};
|
|
1884
2161
|
/**
|
|
1885
2162
|
* Input to `org(orgId).assignRole` (S3, D7/D9). Keyed on the member's personal
|
|
@@ -1887,7 +2164,7 @@ type RemoveMemberInput = {
|
|
|
1887
2164
|
* label maps deterministically to the on-chain `roleKey`.
|
|
1888
2165
|
*/
|
|
1889
2166
|
type AssignRoleInput = {
|
|
1890
|
-
readonly memberSafeAddress: Address
|
|
2167
|
+
readonly memberSafeAddress: Address;
|
|
1891
2168
|
readonly role: string;
|
|
1892
2169
|
};
|
|
1893
2170
|
/**
|
|
@@ -1900,9 +2177,9 @@ type AssignRoleInput = {
|
|
|
1900
2177
|
* `from` is the Level-2 sub-account envelope the spend draws from (D5).
|
|
1901
2178
|
*/
|
|
1902
2179
|
type OrgSpendViaPaymentsInput = {
|
|
1903
|
-
readonly from: SubAccountId
|
|
2180
|
+
readonly from: SubAccountId; /** Validated recipient ref (handle/email/payee/org) — never a raw address. */
|
|
1904
2181
|
readonly to: Ref;
|
|
1905
|
-
readonly amount: Money
|
|
2182
|
+
readonly amount: Money; /** Full EIP-712 payment document; hashed + stored, committed on-chain. */
|
|
1906
2183
|
readonly document?: PaymentDocumentEnvelopeV1;
|
|
1907
2184
|
readonly timing?: PaymentTiming;
|
|
1908
2185
|
readonly paymentType?: PaymentType;
|
|
@@ -1914,7 +2191,7 @@ type OrgSpendViaPaymentsInput = {
|
|
|
1914
2191
|
*/
|
|
1915
2192
|
type OrgPayrollRun = {
|
|
1916
2193
|
/** Validated recipient ref (handle/email/payee/org) — never a raw address. */readonly to: Ref;
|
|
1917
|
-
readonly amount: Money
|
|
2194
|
+
readonly amount: Money;
|
|
1918
2195
|
readonly timing?: PaymentTiming; /** The payslip — an EIP-712 payment document, committed by `documentHash`. */
|
|
1919
2196
|
readonly payslip?: PaymentDocumentEnvelopeV1;
|
|
1920
2197
|
};
|
|
@@ -1926,11 +2203,11 @@ type OrgPayrollRun = {
|
|
|
1926
2203
|
* run.
|
|
1927
2204
|
*/
|
|
1928
2205
|
type OrgBatchPayrollInput = {
|
|
1929
|
-
readonly from: SubAccountId
|
|
2206
|
+
readonly from: SubAccountId;
|
|
1930
2207
|
readonly runs: readonly OrgPayrollRun[];
|
|
1931
2208
|
};
|
|
1932
2209
|
type DetectPendingOrgInvitationsResult = {
|
|
1933
|
-
readonly matched: readonly OrgId
|
|
2210
|
+
readonly matched: readonly OrgId[];
|
|
1934
2211
|
};
|
|
1935
2212
|
/**
|
|
1936
2213
|
* Entity-scoped Org method bundle, returned by `capxul.org(orgId)`. Every
|
|
@@ -1941,7 +2218,7 @@ type DetectPendingOrgInvitationsResult = {
|
|
|
1941
2218
|
interface PayrollRosterLine {
|
|
1942
2219
|
readonly id: string;
|
|
1943
2220
|
readonly employee: Ref;
|
|
1944
|
-
readonly amount: Money
|
|
2221
|
+
readonly amount: Money;
|
|
1945
2222
|
readonly timing: PaymentTiming;
|
|
1946
2223
|
readonly status: "active" | "paused" | "ended";
|
|
1947
2224
|
}
|
|
@@ -1951,12 +2228,12 @@ interface PayrollPayslipTemplate {
|
|
|
1951
2228
|
}
|
|
1952
2229
|
interface PayrollRosterAddInput {
|
|
1953
2230
|
readonly employee: Ref;
|
|
1954
|
-
readonly amount: Money
|
|
2231
|
+
readonly amount: Money;
|
|
1955
2232
|
readonly timing: PaymentTiming;
|
|
1956
2233
|
readonly payslipTemplate?: PaymentDocumentEnvelopeV1 | PayrollPayslipTemplate;
|
|
1957
2234
|
}
|
|
1958
2235
|
interface PayrollRunInput {
|
|
1959
|
-
readonly from: SubAccountId
|
|
2236
|
+
readonly from: SubAccountId;
|
|
1960
2237
|
readonly period: string;
|
|
1961
2238
|
}
|
|
1962
2239
|
interface PayrollMethods {
|
|
@@ -1982,7 +2259,7 @@ interface OrgScopedMethods extends ActorRelationshipMethods {
|
|
|
1982
2259
|
/** The Org treasury — the real M2 Account over the Org Safe (D3). */
|
|
1983
2260
|
treasury(options?: {
|
|
1984
2261
|
readonly signal?: AbortSignal;
|
|
1985
|
-
}): Promise<CapxulResult<Account
|
|
2262
|
+
}): Promise<CapxulResult<Account>>;
|
|
1986
2263
|
readonly account: {
|
|
1987
2264
|
get(options?: {
|
|
1988
2265
|
readonly signal?: AbortSignal;
|
|
@@ -2046,7 +2323,7 @@ interface OrgMethods {
|
|
|
2046
2323
|
}): Promise<CapxulResult<OrgView>>;
|
|
2047
2324
|
readonly orgs: OrgsMethod;
|
|
2048
2325
|
/** Resolve the entity-scoped bundle for a specific Org (D13). */
|
|
2049
|
-
org(orgId: OrgId
|
|
2326
|
+
org(orgId: OrgId): OrgScopedMethods;
|
|
2050
2327
|
}
|
|
2051
2328
|
//#endregion
|
|
2052
2329
|
//#region src/client/current-user.d.ts
|
|
@@ -2088,17 +2365,17 @@ interface SubAccountsMethods {
|
|
|
2088
2365
|
readonly name: string;
|
|
2089
2366
|
}, options?: {
|
|
2090
2367
|
readonly signal?: AbortSignal;
|
|
2091
|
-
}): Promise<CapxulResult<SubAccount
|
|
2092
|
-
get(subAccountId: SubAccountId
|
|
2368
|
+
}): Promise<CapxulResult<SubAccount>>;
|
|
2369
|
+
get(subAccountId: SubAccountId, options?: {
|
|
2093
2370
|
readonly signal?: AbortSignal;
|
|
2094
|
-
}): Promise<CapxulResult<SubAccount
|
|
2371
|
+
}): Promise<CapxulResult<SubAccount | null>>;
|
|
2095
2372
|
list(accountId: AccountId, options?: {
|
|
2096
2373
|
readonly signal?: AbortSignal;
|
|
2097
|
-
}): Promise<CapxulResult<readonly SubAccount
|
|
2098
|
-
rename(subAccountId: SubAccountId
|
|
2374
|
+
}): Promise<CapxulResult<readonly SubAccount[]>>;
|
|
2375
|
+
rename(subAccountId: SubAccountId, name: string, options?: {
|
|
2099
2376
|
readonly signal?: AbortSignal;
|
|
2100
|
-
}): Promise<CapxulResult<SubAccount
|
|
2101
|
-
delete(subAccountId: SubAccountId
|
|
2377
|
+
}): Promise<CapxulResult<SubAccount>>;
|
|
2378
|
+
delete(subAccountId: SubAccountId, options?: {
|
|
2102
2379
|
readonly signal?: AbortSignal;
|
|
2103
2380
|
}): Promise<CapxulResult<void>>;
|
|
2104
2381
|
transfer(input: TransferInput, options?: {
|