@capxul/sdk 2.6.0 → 2.7.0

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.
@@ -168,7 +168,7 @@ const CAPXUL_ERROR_CODES = [
168
168
  * code rename forces this set to move with it) stops the two sides of the wire
169
169
  * from drifting and silently splitting one outcome across two streams.
170
170
  */
171
- const EXPECTED_OPERATION_OUTCOMES = new Set([
171
+ const EXPECTED_OPERATION_OUTCOMES = /* @__PURE__ */ new Set([
172
172
  "INVALID_INPUT",
173
173
  "NOT_AUTHENTICATED",
174
174
  "SMART_ACCOUNT_MISSING",
@@ -1,4 +1,4 @@
1
- import { A as toPartyId, B as Errors, G as failureFingerprint, H as CHAIN_UPSTREAMS, K as isFailureMode, M as toPayrollRunId, P as toRoleKey, R as CapxulError, S as toCurrencyCode, U as FAILURE_MODES$1, V as isCapxulError, W as chainCauseProperties, b as toChainId, c as BYTES32_RE, d as WEI_RE, f as ZERO_BYTES32, h as toAddress, j as toPayrollGroupId, k as toOrgId, l as EVM_ADDRESS_RE$1, m as toAccountId, n as BrowserAuthCacheAdapter, s as APP_ID_RE, t as InMemoryAuthCacheAdapter, u as SUPPORTED_CURRENCY_CODES, v as toAuthUserId, w as toEmail, x as toCountryCode, y as toBudgetId, z as EXPECTED_OPERATION_OUTCOMES } from "./InMemoryAuthCacheAdapter-VZBv1fOH.mjs";
1
+ import { A as toPartyId, B as Errors, G as failureFingerprint, H as CHAIN_UPSTREAMS, K as isFailureMode, M as toPayrollRunId, P as toRoleKey, R as CapxulError, S as toCurrencyCode, U as FAILURE_MODES$1, V as isCapxulError, W as chainCauseProperties, b as toChainId, c as BYTES32_RE, d as WEI_RE, f as ZERO_BYTES32, h as toAddress, j as toPayrollGroupId, k as toOrgId, l as EVM_ADDRESS_RE$1, m as toAccountId, n as BrowserAuthCacheAdapter, s as APP_ID_RE, t as InMemoryAuthCacheAdapter, u as SUPPORTED_CURRENCY_CODES, v as toAuthUserId, w as toEmail, x as toCountryCode, y as toBudgetId, z as EXPECTED_OPERATION_OUTCOMES } from "./InMemoryAuthCacheAdapter-B6PHyzCN.mjs";
2
2
  import { concat, encodeAbiParameters, encodeFunctionData, encodePacked, formatUnits, getContractAddress, keccak256, padHex, parseUnits, recoverAddress, stringToHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature } from "viem";
3
3
  import { Context, Data, Deferred, Duration, Effect, Exit, Fiber, Layer, Queue, Ref, Result, Schema, SchemaGetter, Scope } from "effect";
4
4
  import { makeFunctionReference } from "convex/server";
@@ -512,22 +512,24 @@ function buildCapxulSafeInitializer(owner) {
512
512
  functionName: "enableModules",
513
513
  args: [[SAFE_4337_MODULE]]
514
514
  });
515
+ const enableModulesByteLen = BigInt((enableModulesCall.length - 2) / 2);
516
+ const multiSendPayload = encodePacked([
517
+ "uint8",
518
+ "address",
519
+ "uint256",
520
+ "uint256",
521
+ "bytes"
522
+ ], [
523
+ 1,
524
+ SAFE_MODULE_SETUP,
525
+ 0n,
526
+ enableModulesByteLen,
527
+ enableModulesCall
528
+ ]);
515
529
  const setupData = encodeFunctionData({
516
530
  abi: multiSendAbi,
517
531
  functionName: "multiSend",
518
- args: [encodePacked([
519
- "uint8",
520
- "address",
521
- "uint256",
522
- "uint256",
523
- "bytes"
524
- ], [
525
- 1,
526
- SAFE_MODULE_SETUP,
527
- 0n,
528
- BigInt((enableModulesCall.length - 2) / 2),
529
- enableModulesCall
530
- ])]
532
+ args: [multiSendPayload]
531
533
  });
532
534
  return encodeFunctionData({
533
535
  abi: safeSetupAbi,
@@ -597,11 +599,13 @@ function deriveCapxulSafeAddressForOwner(input) {
597
599
  email: input.email,
598
600
  namespace: input.namespace
599
601
  });
602
+ const salt = keccak256(encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce]));
603
+ const deploymentCode = concat([SAFE_PROXY_CREATION_CODE, encodeAbiParameters([{ type: "uint256" }], [BigInt(SAFE_L2_SINGLETON)])]);
600
604
  return getContractAddress({
601
605
  opcode: "CREATE2",
602
606
  from: SAFE_PROXY_FACTORY,
603
- salt: keccak256(encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce])),
604
- bytecodeHash: keccak256(concat([SAFE_PROXY_CREATION_CODE, encodeAbiParameters([{ type: "uint256" }], [BigInt(SAFE_L2_SINGLETON)])]))
607
+ salt,
608
+ bytecodeHash: keccak256(deploymentCode)
605
609
  }).toLowerCase();
606
610
  }
607
611
  /**
@@ -3387,10 +3391,11 @@ const boot = (spec, options = {}) => Effect.gen(function* () {
3387
3391
  const outcome = spec.transition(state, event);
3388
3392
  if ("refused" in outcome) return Effect.succeed(state);
3389
3393
  return Ref.set(cell, outcome.next).pipe(Effect.tap(() => {
3390
- return emit(applied(state, outcome.next, event, cursor.slot, cursor.epoch, {
3394
+ const record = applied(state, outcome.next, event, cursor.slot, cursor.epoch, {
3391
3395
  invocation: cursor.invocation,
3392
3396
  startedAt: cursor.startedAt
3393
- })).pipe(Effect.andThen(Effect.sync(() => {
3397
+ });
3398
+ return emit(record).pipe(Effect.andThen(Effect.sync(() => {
3394
3399
  notify(outcome.next);
3395
3400
  })));
3396
3401
  }), Effect.as(outcome.next));
@@ -4490,7 +4495,7 @@ const moneyExecutionContract = {
4490
4495
  };
4491
4496
  //#endregion
4492
4497
  //#region package.json
4493
- var version = "2.6.0";
4498
+ var version = "2.7.0";
4494
4499
  //#endregion
4495
4500
  //#region src/telemetry/stack-frame-parser.ts
4496
4501
  /**
@@ -4882,6 +4887,8 @@ function postHogExceptionProperties(failure, properties) {
4882
4887
  $exception_message: message,
4883
4888
  $exception_level: "error",
4884
4889
  $exception_fingerprint: failureFingerprint(failure.errorKind, isFailureMode(mode) ? mode : void 0, failure.operation),
4890
+ $issue_name: issueName(failure, isFailureMode(mode) ? mode : void 0),
4891
+ $issue_description: failure.detail?.chain_provider_message ?? message,
4885
4892
  $exception_list: [{
4886
4893
  type: failure.errorKind,
4887
4894
  value: message,
@@ -4905,6 +4912,13 @@ function postHogExceptionProperties(failure, properties) {
4905
4912
  }]
4906
4913
  };
4907
4914
  }
4915
+ function issueName(failure, mode) {
4916
+ const upstream = failure.detail?.chain_upstream;
4917
+ const method = failure.detail?.chain_method;
4918
+ const cause = mode === void 0 ? "" : `: ${mode}`;
4919
+ const where = typeof upstream !== "string" ? "" : ` on ${upstream}${typeof method === "string" ? ` during ${method}` : ""}`;
4920
+ return `${failure.errorKind}${cause}${where} (${failure.operation})`;
4921
+ }
4908
4922
  const MAX_EVIDENCE_TEXT = 4e3;
4909
4923
  const MAX_CAUSE_DEPTH = 8;
4910
4924
  function evidenceText(value) {
@@ -5379,7 +5393,7 @@ const paymentAttemptReleases = /* @__PURE__ */ new Set();
5379
5393
  let paymentAttemptPagehideInstalled = false;
5380
5394
  function randomPaymentRequestKey() {
5381
5395
  try {
5382
- return `pay_${Array.from(crypto.getRandomValues(new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
5396
+ return `pay_${Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
5383
5397
  } catch (cause) {
5384
5398
  throw Errors.providerError("sdk", "paymentRequestKey", cause);
5385
5399
  }
@@ -5585,7 +5599,8 @@ function makeFinancialOpsMethods(deps) {
5585
5599
  };
5586
5600
  let requestKey;
5587
5601
  try {
5588
- requestKey = await paymentRequestKeyLifecycle(`personal-pay:${requestKeyScope}:${deps.actor.authSession()?.authUserId ?? "signed-out"}`, input, input.requestKey);
5602
+ const actorId = deps.actor.authSession()?.authUserId ?? "signed-out";
5603
+ requestKey = await paymentRequestKeyLifecycle(`personal-pay:${requestKeyScope}:${actorId}`, input, input.requestKey);
5589
5604
  } catch (cause) {
5590
5605
  return {
5591
5606
  ok: false,
@@ -7039,7 +7054,7 @@ const SHA256_K = [
7039
7054
  function sha256Hex(input) {
7040
7055
  const padded = padSha256Message(new TextEncoder().encode(input));
7041
7056
  const view = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
7042
- const words = new Uint32Array(64);
7057
+ const words = /* @__PURE__ */ new Uint32Array(64);
7043
7058
  let h0 = SHA256_INITIAL_HASH[0];
7044
7059
  let h1 = SHA256_INITIAL_HASH[1];
7045
7060
  let h2 = SHA256_INITIAL_HASH[2];
@@ -7843,7 +7858,7 @@ function clearAuthCacheEffect(authCache) {
7843
7858
  return authCache.clearSession.pipe(Effect.mapError((cause) => Errors.providerError("auth-cache", "clearSession", cause)), Effect.andThen(authCache.clearJwt.pipe(Effect.mapError((cause) => Errors.providerError("auth-cache", "clearJwt", cause)))));
7844
7859
  }
7845
7860
  function cryptoRandomId() {
7846
- const bytes = new Uint8Array(8);
7861
+ const bytes = /* @__PURE__ */ new Uint8Array(8);
7847
7862
  if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.getRandomValues === "function") globalThis.crypto.getRandomValues(bytes);
7848
7863
  else for (let i = 0; i < bytes.length; i++) bytes[i] = Math.floor(Math.random() * 256);
7849
7864
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
@@ -9292,7 +9307,7 @@ const organizationPaymentExecutionUnavailable = () => Promise.resolve({
9292
9307
  const holdingsContract = { current: makeFunctionReference(CAPXUL_FUNCTIONS["holdings/actions"].current) };
9293
9308
  //#endregion
9294
9309
  //#region src/domain/money/primary-holding.ts
9295
- const CURRENCY_BY_TOKEN_SYMBOL = new Map([["USDX", toCurrencyCode("USD")]]);
9310
+ const CURRENCY_BY_TOKEN_SYMBOL = /* @__PURE__ */ new Map([["USDX", toCurrencyCode("USD")]]);
9296
9311
  /**
9297
9312
  * The designated display asset: the payable row holding the most money, or
9298
9313
  * `null` when no row is payable.
package/dist/index.d.mts CHANGED
@@ -1,9 +1,8 @@
1
- import { B as OrgId, C as Address, N as CountryCode, O as AuthSession, S as AccountId, U as PayrollGroupId, V as PartyId, W as PayrollRunId, Y as RoleKey, a as SignerStatusStore, at as CapxulErrorDetails, c as AccountProviderSource, ct as isCapxulError, d as eip1193AccountProvider, dt as ChainUpstream, et as toAddress, f as localPrivateKeyAccountProvider, ft as FAILURE_MODES, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, lt as CHAIN_UPSTREAMS, m as Profile, mt as RevertSummary, n as CapxulSigner, nt as CAPXUL_ERROR_CODES, o as injectedWalletSigner, ot as Errors, p as CapxulResult, pt as FailureMode, r as Eip1193RequestProvider, rt as CapxulError, s as AccountProvider, t as CapxulDigestSigner, tt as toCountryCode, u as Eip1193Provider, ut as ChainCause, x as Account, z as Money } from "./signer-tokSaxrJ.mjs";
2
- import { $ as OrganizationPaymentsMethods, $n as IdentityState, $t as MeMethods, A as OrgView, An as AccountSetupStep, At as ActivityFilter, B as PayrollGroupInput, Bn as SubmittedPermissionExecution, Bt as ActivitySummaryTotal, C as DetectPendingOrgInvitationsResult, Cn as RecipientResolutionKind, Ct as AddressBookMethods, D as OrgMethods, Dn as TargetsMethods, Dt as ActivityAnnotation, E as MemberView, En as TargetReference, Et as InboxMethods, F as RoleSpendCap, Fn as OrgLifecycle, Ft as ActivityPage, G as PayrollRun, Gn as RequestStatus, Gt as DestinationKind, H as PayrollGroupsMethods, Hn as PAYMENT_DIRECTIONS, Ht as DepositInstructions, I as RoleView, In as OrgSetupStep, It as ActivityRange, J as PayrollRuns, Jt as DestinationRail, K as PayrollRunItemInput, Kn as CAPXUL_PAYMENTS_V2_ADDRESS, Kt as DestinationListInput, L as AuthorizeRunInput, Ln as ActorRef, Lt as ActivityReference, M as OrganizationAuditLogItem, Mn as IdentityMethods, Mt as ActivityKind, N as ResendInviteTokenInput, Nn as SmartAccountMethods, Nt as ActivityListParams, O as OrgScopedMethods, On as fingerprintPaymentIntent, Ot as ActivityAnnotationInput, P as RoleDefinition, Pn as AuthMethods, Pt as ActivityMethods, Q as OrganizationPaymentItemInput, Qn as IdentityEvent, Qt as HandlesMethods, R as PayrollEngagementTerms, Rn as CurrentHoldings, Rt as ActivitySummary, S as CreateOrgInput, Sn as RecipientResolution, St as AddressBookLabelInput, T as MemberStatus, Tn as ResolvedTarget, Tt as InboxItem, U as PayrollMethods, Un as PAYMENT_STATUSES, Ut as Destination, V as PayrollGroupMember, Vn as InboxStatus, Vt as ActorReference, W as PayrollOptions, Wn as PaymentStatus$1, Wt as DestinationAddInput, X as OrganizationPaymentBatchInput, Xn as TelemetryPort, Xt as DestinationsMethods, Y as PayrollTermsUnit, Yt as DestinationRemoveInput, Z as OrganizationPaymentInput, Zn as Destination$1, Zt as FinancialOpsMethods, _ as SystemMethods, _n as PaymentStatus, _t as ActorRequest, a as SdkFailureObservation, an as OfframpStatus, ar as isRestoring, at as PermissionReplaceInput, b as CurrentUserContext, bn as PaymentsMethods, bt as AddressBookAddInput, c as PostHogObservabilityOptions, cn as Payment, ct as Budget, d as CreateCapxulClientInput, dn as PaymentDocumentKind, dt as OrgMeOptions, en as MeProfile, er as OrgLane, et as PermissionAssignInput, f as IdentityProfileDetails, fn as PaymentDocumentRef, ft as AccountsMethods, g as Holding, gn as PaymentMoney, gt as ActorRelationshipMethods, h as HoldingsMethods, hn as PaymentDocumentsMethods, ht as ActorProfileMethods, i as ObservationDelivery, in as OfframpQuoteInput, ir as isClaimed, it as PermissionOptions, j as OrganizationAccount, jn as isSettingUpLifecycle, jt as ActivityItem, k as OrgTemplate, kn as AccountLifecycle, kt as ActivityDetail, l as postHogObservability, ln as PaymentActivityEvidence, lt as OrgMe, m as IdentityRuntimeSendResult, mn as PaymentDocumentVerification, mt as ActorProfile, n as ObservationAdapter, nn as OfframpMethods, nr as StateLabel, nt as PermissionCreateInput, o as HostObservability, on as Payee, or as IdentityTransition, ot as PermissionRevokeInput, p as IdentityRuntime, pn as PaymentDocumentRender, pt as AccountMethods, q as PayrollRunStatus, qt as DestinationPayload, r as ObservationContext, rn as OfframpQuote, rr as destination, rt as PermissionMethods, s as PostHogObservabilityClient, sn as PayeesMethods, sr as InvocationControls, st as PermissionReadResult, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as MovementActivityEvidence, tr as Readiness, tt as PermissionChangeInput, u as CapxulClient, un as PaymentDirection, ut as OrgMeMethod, v as SystemHealth, vn as PaymentTiming, vt as ActorRequestIssueInput, w as InviteMemberInput, wn as Ref, wt as InboxApproveInput, x as CurrentUserMethods, xn as PaymentsPayInput, xt as AddressBookEntry, y as MediaMethods, yn as PaymentType, yt as ActorRequestsMethods, z as PayrollGroup, zn as Permission, zt as ActivitySummaryParams } from "./observation-Desw1A8U.mjs";
1
+ import { B as OrgId, C as Address, N as CountryCode, O as AuthSession, S as AccountId, U as PayrollGroupId, V as PartyId, W as PayrollRunId, Y as RoleKey, a as SignerStatusStore, at as CapxulErrorDetails, c as AccountProviderSource, ct as isCapxulError, d as eip1193AccountProvider, dt as ChainUpstream, et as toAddress, f as localPrivateKeyAccountProvider, ft as FAILURE_MODES, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, lt as CHAIN_UPSTREAMS, m as Profile, mt as RevertSummary, n as CapxulSigner, nt as CAPXUL_ERROR_CODES, o as injectedWalletSigner, ot as Errors, p as CapxulResult, pt as FailureMode, r as Eip1193RequestProvider, rt as CapxulError, s as AccountProvider, t as CapxulDigestSigner, tt as toCountryCode, u as Eip1193Provider, ut as ChainCause, x as Account, z as Money } from "./signer-BMRxwX13.mjs";
2
+ import { $ as OrganizationPaymentsMethods, $n as IdentityState, $t as MeMethods, A as OrgView, An as AccountSetupStep, At as ActivityFilter, B as PayrollGroupInput, Bn as SubmittedPermissionExecution, Bt as ActivitySummaryTotal, C as DetectPendingOrgInvitationsResult, Cn as RecipientResolutionKind, Ct as AddressBookMethods, D as OrgMethods, Dn as TargetsMethods, Dt as ActivityAnnotation, E as MemberView, En as TargetReference, Et as InboxMethods, F as RoleSpendCap, Fn as OrgLifecycle, Ft as ActivityPage, G as PayrollRun, Gn as RequestStatus, Gt as DestinationKind, H as PayrollGroupsMethods, Hn as PAYMENT_DIRECTIONS, Ht as DepositInstructions, I as RoleView, In as OrgSetupStep, It as ActivityRange, J as PayrollRuns, Jt as DestinationRail, K as PayrollRunItemInput, Kn as CAPXUL_PAYMENTS_V2_ADDRESS, Kt as DestinationListInput, L as AuthorizeRunInput, Ln as ActorRef, Lt as ActivityReference, M as OrganizationAuditLogItem, Mn as IdentityMethods, Mt as ActivityKind, N as ResendInviteTokenInput, Nn as SmartAccountMethods, Nt as ActivityListParams, O as OrgScopedMethods, On as fingerprintPaymentIntent, Ot as ActivityAnnotationInput, P as RoleDefinition, Pn as AuthMethods, Pt as ActivityMethods, Q as OrganizationPaymentItemInput, Qn as IdentityEvent, Qt as HandlesMethods, R as PayrollEngagementTerms, Rn as CurrentHoldings, Rt as ActivitySummary, S as CreateOrgInput, Sn as RecipientResolution, St as AddressBookLabelInput, T as MemberStatus, Tn as ResolvedTarget, Tt as InboxItem, U as PayrollMethods, Un as PAYMENT_STATUSES, Ut as Destination, V as PayrollGroupMember, Vn as InboxStatus, Vt as ActorReference, W as PayrollOptions, Wn as PaymentStatus$1, Wt as DestinationAddInput, X as OrganizationPaymentBatchInput, Xn as TelemetryPort, Xt as DestinationsMethods, Y as PayrollTermsUnit, Yt as DestinationRemoveInput, Z as OrganizationPaymentInput, Zn as Destination$1, Zt as FinancialOpsMethods, _ as SystemMethods, _n as PaymentStatus, _t as ActorRequest, a as SdkFailureObservation, an as OfframpStatus, ar as isRestoring, at as PermissionReplaceInput, b as CurrentUserContext, bn as PaymentsMethods, bt as AddressBookAddInput, c as PostHogObservabilityOptions, cn as Payment, ct as Budget, d as CreateCapxulClientInput, dn as PaymentDocumentKind, dt as OrgMeOptions, en as MeProfile, er as OrgLane, et as PermissionAssignInput, f as IdentityProfileDetails, fn as PaymentDocumentRef, ft as AccountsMethods, g as Holding, gn as PaymentMoney, gt as ActorRelationshipMethods, h as HoldingsMethods, hn as PaymentDocumentsMethods, ht as ActorProfileMethods, i as ObservationDelivery, in as OfframpQuoteInput, ir as isClaimed, it as PermissionOptions, j as OrganizationAccount, jn as isSettingUpLifecycle, jt as ActivityItem, k as OrgTemplate, kn as AccountLifecycle, kt as ActivityDetail, l as postHogObservability, ln as PaymentActivityEvidence, lt as OrgMe, m as IdentityRuntimeSendResult, mn as PaymentDocumentVerification, mt as ActorProfile, n as ObservationAdapter, nn as OfframpMethods, nr as StateLabel, nt as PermissionCreateInput, o as HostObservability, on as Payee, or as IdentityTransition, ot as PermissionRevokeInput, p as IdentityRuntime, pn as PaymentDocumentRender, pt as AccountMethods, q as PayrollRunStatus, qt as DestinationPayload, r as ObservationContext, rn as OfframpQuote, rr as destination, rt as PermissionMethods, s as PostHogObservabilityClient, sn as PayeesMethods, sr as InvocationControls, st as PermissionReadResult, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as MovementActivityEvidence, tr as Readiness, tt as PermissionChangeInput, u as CapxulClient, un as PaymentDirection, ut as OrgMeMethod, v as SystemHealth, vn as PaymentTiming, vt as ActorRequestIssueInput, w as InviteMemberInput, wn as Ref, wt as InboxApproveInput, x as CurrentUserMethods, xn as PaymentsPayInput, xt as AddressBookEntry, y as MediaMethods, yn as PaymentType, yt as ActorRequestsMethods, z as PayrollGroup, zn as Permission, zt as ActivitySummaryParams } from "./observation-BMW_idMZ.mjs";
3
3
  import { Hex } from "viem";
4
4
  import { Context, Effect, Layer } from "effect";
5
5
  import { FunctionReference } from "convex/server";
6
-
7
6
  //#region src/domain/activity/phase.d.ts
8
7
  interface ActivityPhase {
9
8
  /** The row is in a final state. No subsequent status change occurs. */
@@ -127,7 +126,8 @@ declare function openfortEmbeddedSignerFromWallet(input: {
127
126
  * and verifies recovery before the backend submits.
128
127
  */
129
128
  type OpenfortEmbeddedSigner = CapxulSigner & {
130
- /** Drop cached `getAddress()` so the next read hits the embedded wallet again. */readonly resetAddressCache: () => void;
129
+ /** Drop cached `getAddress()` so the next read hits the embedded wallet again. */
130
+ readonly resetAddressCache: () => void;
131
131
  };
132
132
  declare function openfortEmbeddedSigner(input: OpenfortEmbeddedSignerInput): OpenfortEmbeddedSigner;
133
133
  /**
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as postHogFailureObservation, B as injectedWalletSigner, C as fingerprintPaymentIntent, D as failureEvidenceProps, E as failureDetail, F as isSettingUpLifecycle, G as PAYMENT_DIRECTIONS, H as OBSERVATION_CONTEXT_HEADER, I as formatTraceparent, J as BootstrapEnvelope, K as PAYMENT_STATUSES, L as copyInvocationObservation, M as captureExceptionSync, N as version, O as observationContextProps, P as fromWei, Q as BASE_SEPOLIA_CHAIN_ID, R as readInvocationObservation, S as AuthClientPortTag, T as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, U as encodeObservationContextHeader, V as signerFailure, W as sanitizeObservationContext, X as CAPXUL_PAYMENTS_V2_ADDRESS, Y as EngineeringTelemetryBootstrapPolicy, Z as normalizeBindingEmail, _ as ClockPortTag, a as TelemetryPortTag, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, et as destination, f as IdentityPortTag, g as ClockError, h as convexCallErrorFromCapxul, i as PostHogTelemetryLayer, j as captureException, k as observeFailedResult, l as AccountReadPortTag, m as ConvexCallPortTag, n as postHogProductTelemetry, nt as isRestoring, p as identityErrorFromCapxul, q as CAPXUL_FUNCTIONS, r as detectAuthCacheAdapter, s as SmartAccountPortTag, t as assembleCapxulClient, tt as isClaimed, u as accountReadErrorFromCapxul, v as BootstrapPortTag, w as toWei, x as AuthClientError, y as bootstrapErrorFromCapxul, z as causeChain } from "./create-capxul-client-BuEjwJS6.mjs";
2
- import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, H as CHAIN_UPSTREAMS, I as decodeConvexError, L as CAPXUL_ERROR_CODES, N as toPublishableKey, O as toKycTier, P as toRoleKey, R as CapxulError, S as toCurrencyCode, T as toEpochMs, U as FAILURE_MODES, V as isCapxulError, b as toChainId, g as toAllowedOrigin, h as toAddress, k as toOrgId, m as toAccountId, o as AuthCachePortTag, p as currencySymbolFor, v as toAuthUserId, w as toEmail, x as toCountryCode } from "./InMemoryAuthCacheAdapter-VZBv1fOH.mjs";
1
+ import { A as postHogFailureObservation, B as injectedWalletSigner, C as fingerprintPaymentIntent, D as failureEvidenceProps, E as failureDetail, F as isSettingUpLifecycle, G as PAYMENT_DIRECTIONS, H as OBSERVATION_CONTEXT_HEADER, I as formatTraceparent, J as BootstrapEnvelope, K as PAYMENT_STATUSES, L as copyInvocationObservation, M as captureExceptionSync, N as version, O as observationContextProps, P as fromWei, Q as BASE_SEPOLIA_CHAIN_ID, R as readInvocationObservation, S as AuthClientPortTag, T as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, U as encodeObservationContextHeader, V as signerFailure, W as sanitizeObservationContext, X as CAPXUL_PAYMENTS_V2_ADDRESS, Y as EngineeringTelemetryBootstrapPolicy, Z as normalizeBindingEmail, _ as ClockPortTag, a as TelemetryPortTag, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, et as destination, f as IdentityPortTag, g as ClockError, h as convexCallErrorFromCapxul, i as PostHogTelemetryLayer, j as captureException, k as observeFailedResult, l as AccountReadPortTag, m as ConvexCallPortTag, n as postHogProductTelemetry, nt as isRestoring, p as identityErrorFromCapxul, q as CAPXUL_FUNCTIONS, r as detectAuthCacheAdapter, s as SmartAccountPortTag, t as assembleCapxulClient, tt as isClaimed, u as accountReadErrorFromCapxul, v as BootstrapPortTag, w as toWei, x as AuthClientError, y as bootstrapErrorFromCapxul, z as causeChain } from "./create-capxul-client-DNYuHQGS.mjs";
2
+ import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, H as CHAIN_UPSTREAMS, I as decodeConvexError, L as CAPXUL_ERROR_CODES, N as toPublishableKey, O as toKycTier, P as toRoleKey, R as CapxulError, S as toCurrencyCode, T as toEpochMs, U as FAILURE_MODES, V as isCapxulError, b as toChainId, g as toAllowedOrigin, h as toAddress, k as toOrgId, m as toAccountId, o as AuthCachePortTag, p as currencySymbolFor, v as toAuthUserId, w as toEmail, x as toCountryCode } from "./InMemoryAuthCacheAdapter-B6PHyzCN.mjs";
3
3
  import { keccak256, recoverAddress, stringToHex } from "viem";
4
4
  import { Cause, Context, Data, Duration, Effect, Exit, Layer, Result, Schedule, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
5
5
  import { getFunctionName, makeFunctionReference } from "convex/server";
@@ -445,7 +445,7 @@ const postHogOtlpEndpoints = (host) => {
445
445
  };
446
446
  };
447
447
  const ENGINEERING_CAPXUL_ENV_SET = new Set(ENGINEERING_CAPXUL_ENVS);
448
- const ENGINEERING_PRODUCERS = new Set(["browser", "server"]);
448
+ const ENGINEERING_PRODUCERS = /* @__PURE__ */ new Set(["browser", "server"]);
449
449
  const PUBLIC_POSTHOG_AUTHORIZATION = /^Bearer phc_[A-Za-z0-9_-]{1,191}$/u;
450
450
  const SAFE_RESOURCE_VALUE = /^[A-Za-z0-9][A-Za-z0-9._+@/-]{0,127}$/u;
451
451
  const validateEngineeringTelemetryConfig = (config) => {
@@ -566,7 +566,7 @@ function authSessionFromBetterAuth$1(token, user) {
566
566
  authUserId: toAuthUserId(user.id),
567
567
  email: toEmail(user.email),
568
568
  token: toSessionToken(token),
569
- expiresAt: toEpochMs(Date.now() + 10080 * 60 * 1e3)
569
+ expiresAt: toEpochMs(Date.now() + 6048e5)
570
570
  };
571
571
  }
572
572
  async function safeJson$1(res) {
@@ -957,7 +957,7 @@ function authSessionFromBetterAuth(token, user) {
957
957
  authUserId: toAuthUserId(user.id),
958
958
  email: toEmail(user.email),
959
959
  token: toSessionToken(token),
960
- expiresAt: toEpochMs(Date.now() + 10080 * 60 * 1e3)
960
+ expiresAt: toEpochMs(Date.now() + 6048e5)
961
961
  };
962
962
  }
963
963
  async function safeJson(res) {
@@ -1271,7 +1271,7 @@ const DEFAULT_RETRY = {
1271
1271
  baseDelayMs: 400
1272
1272
  };
1273
1273
  /** Request-side statuses a proxy or backend returns while momentarily unable to serve. */
1274
- const TRANSIENT_HTTP_STATUSES = new Set([
1274
+ const TRANSIENT_HTTP_STATUSES = /* @__PURE__ */ new Set([
1275
1275
  408,
1276
1276
  425,
1277
1277
  429
@@ -1421,7 +1421,7 @@ function SystemClockLayer() {
1421
1421
  //#endregion
1422
1422
  //#region src/adapters/convex-call/ConvexCallAdapter.ts
1423
1423
  /** Exact floor-first allowlist; every additional handler must migrate its validator first. */
1424
- const OBSERVED_CONVEX_ACTIONS = new Set([
1424
+ const OBSERVED_CONVEX_ACTIONS = /* @__PURE__ */ new Set([
1425
1425
  "smartAccount/actions:claim",
1426
1426
  "org/actions:prepareFounderAccount",
1427
1427
  "org/actions:prepareBootstrap",
@@ -1429,12 +1429,12 @@ const OBSERVED_CONVEX_ACTIONS = new Set([
1429
1429
  "org/actions:resumeBootstrapSubmission",
1430
1430
  "org/actions:confirmBootstrap"
1431
1431
  ]);
1432
- const OBSERVED_CONVEX_QUERIES = new Set([
1432
+ const OBSERVED_CONVEX_QUERIES = /* @__PURE__ */ new Set([
1433
1433
  "identity/queries:loadByAuthUserId",
1434
1434
  "smartAccount/queries:loadByAuthUserId",
1435
1435
  "org/lifecycle:load"
1436
1436
  ]);
1437
- const OBSERVED_CONVEX_MUTATIONS = new Set([
1437
+ const OBSERVED_CONVEX_MUTATIONS = /* @__PURE__ */ new Set([
1438
1438
  "identity/mutations:create",
1439
1439
  "identity/mutations:update",
1440
1440
  "identity/mutations:completeOnboarding",
@@ -1558,7 +1558,7 @@ function mapToCapxulError(operation, err) {
1558
1558
  function mapToConvexCallError(operation, err) {
1559
1559
  return convexCallErrorFromCapxul(operation, mapToCapxulError(operation, err));
1560
1560
  }
1561
- const TRANSPORT_ERROR_CODES = new Set([
1561
+ const TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
1562
1562
  "EAI_AGAIN",
1563
1563
  "ECONNREFUSED",
1564
1564
  "ECONNRESET",
@@ -2308,7 +2308,7 @@ function clearStaleOpenfortBrowserStorage(publishableKey) {
2308
2308
  * tagging them `stale-openfort-cache` would delete the triage signal the tag
2309
2309
  * exists to carry.
2310
2310
  */
2311
- const STALE_USER_ERROR_CODES = new Set(["USER_NOT_FOUND"]);
2311
+ const STALE_USER_ERROR_CODES = /* @__PURE__ */ new Set(["USER_NOT_FOUND"]);
2312
2312
  /**
2313
2313
  * The one predicate that opens the heal. It reads the Openfort error code and
2314
2314
  * never the message text (ADR-0023 R4). It walks the cause chain the way
@@ -2606,7 +2606,8 @@ function postHogObservability(client, options = {}) {
2606
2606
  if (client === null || client === void 0) return inactive;
2607
2607
  try {
2608
2608
  if (!(typeof options.enabled === "function" ? options.enabled() : options.enabled ?? true)) return inactive;
2609
- const sanitized = sanitizeObservationContext(typeof options.context === "function" ? options.context() : options.context);
2609
+ const rawContext = typeof options.context === "function" ? options.context() : options.context;
2610
+ const sanitized = sanitizeObservationContext(rawContext);
2610
2611
  const context = sanitized === void 0 ? void 0 : Object.freeze({ ...sanitized });
2611
2612
  return Object.freeze({
2612
2613
  active: true,
@@ -1,7 +1,6 @@
1
- import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-tokSaxrJ.mjs";
1
+ import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-BMRxwX13.mjs";
2
2
  import { Hex } from "viem";
3
3
  import { Effect, FileSystem, Layer, Path } from "effect";
4
-
5
4
  //#region src/adapters/auth-cache/FileSystemAuthCacheAdapter.d.ts
6
5
  type FileSystemRuntime = FileSystem.FileSystem | Path.Path;
7
6
  declare class FileSystemAuthCacheAdapter implements AuthCachePort {
@@ -1,4 +1,4 @@
1
- import { a as AuthCacheError, h as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-VZBv1fOH.mjs";
1
+ import { a as AuthCacheError, h as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-B6PHyzCN.mjs";
2
2
  import { Effect, FileSystem, Layer, Path } from "effect";
3
3
  import { privateKeyToAccount } from "viem/accounts";
4
4
  import * as os from "node:os";
@@ -1,8 +1,7 @@
1
- import { $ as WeiAmount, A as BlockNumber, B as OrgId, C as Address$1, D as AppId, E as AnonymousDistinctId, F as DocumentHash, G as PermissionAssignmentId, H as PaymentCommandId, I as DurationMs, J as PublishableKey, K as PermissionId, L as Email, M as ChainId, N as CountryCode, O as AuthSession, P as CurrencyCode, Q as TxHash, R as EpochMs, T as AllowedOrigin, U as PayrollGroupId, V as PartyId, W as PayrollRunId, X as SessionToken, Y as RoleKey, Z as SmartAccount, a as SignerStatusStore, at as CapxulErrorDetails, b as CachedJwt, c as AccountProviderSource, g as SmartAccount$1, h as Session$1, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile$1, n as CapxulSigner, p as CapxulResult, pt as FailureMode, q as Profile, rt as CapxulError, st as Failure, v as AuthCachePort, w as AllowanceKey, x as Account$1, z as Money } from "./signer-tokSaxrJ.mjs";
1
+ import { $ as WeiAmount, A as BlockNumber, B as OrgId, C as Address$1, D as AppId, E as AnonymousDistinctId, F as DocumentHash, G as PermissionAssignmentId, H as PaymentCommandId, I as DurationMs, J as PublishableKey, K as PermissionId, L as Email, M as ChainId, N as CountryCode, O as AuthSession, P as CurrencyCode, Q as TxHash, R as EpochMs, T as AllowedOrigin, U as PayrollGroupId, V as PartyId, W as PayrollRunId, X as SessionToken, Y as RoleKey, Z as SmartAccount, a as SignerStatusStore, at as CapxulErrorDetails, b as CachedJwt, c as AccountProviderSource, g as SmartAccount$1, h as Session$1, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile$1, n as CapxulSigner, p as CapxulResult, pt as FailureMode, q as Profile, rt as CapxulError, st as Failure, v as AuthCachePort, w as AllowanceKey, x as Account$1, z as Money } from "./signer-BMRxwX13.mjs";
2
2
  import { Address, Hex } from "viem";
3
3
  import { Context, Effect, Layer, Schema, Scope, Tracer } from "effect";
4
4
  import { FunctionReference } from "convex/server";
5
-
6
5
  //#region src/domain/machine/shell.d.ts
7
6
  declare const INVOCATION_PARENT_SPAN: unique symbol;
8
7
  interface InvocationControls {
@@ -38,7 +37,8 @@ type IdentityTransition = (RecordBase & {
38
37
  readonly outcome: "failed" | "cancelled";
39
38
  readonly state: string;
40
39
  readonly error_code: CapxulErrorCode;
41
- readonly refusal_code?: never; /** The typed failure behind `error_code`, with its `CapxulError` when the port gave one. */
40
+ readonly refusal_code?: never;
41
+ /** The typed failure behind `error_code`, with its `CapxulError` when the port gave one. */
42
42
  readonly failure?: Failure;
43
43
  });
44
44
  declare class ActorFailure<Reason extends CapxulErrorCode> extends Error {
@@ -337,7 +337,7 @@ type VerifyOtpInput = {
337
337
  type GetConvexJwtOptions = AuthClientOperationOptions & {
338
338
  readonly forceRefresh?: boolean;
339
339
  };
340
- declare const AuthClientError_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 & {
340
+ declare const AuthClientError_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 & {
341
341
  readonly _tag: "AuthClientError";
342
342
  } & Readonly<A>;
343
343
  declare class AuthClientError extends AuthClientError_base<{
@@ -366,7 +366,7 @@ interface ClockPort {
366
366
  readonly now: Effect.Effect<EpochMs, ClockError>;
367
367
  readonly sleep: (duration: DurationMs) => Effect.Effect<void, ClockError>;
368
368
  }
369
- declare const ClockError_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 & {
369
+ declare const ClockError_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 & {
370
370
  readonly _tag: "ClockError";
371
371
  } & Readonly<A>;
372
372
  declare class ClockError extends ClockError_base<{
@@ -668,7 +668,7 @@ type BootstrapResolution = {
668
668
  readonly engineeringTelemetry?: EngineeringTelemetryBootstrapPolicyV1;
669
669
  };
670
670
  type BootstrapErrorKind = "notAuthenticated" | "network" | "provider" | "malformedBody" | "invalidInput" | "rateLimited";
671
- 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 & {
671
+ 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 & {
672
672
  readonly _tag: "BootstrapError";
673
673
  } & Readonly<A>;
674
674
  declare class BootstrapError extends BootstrapError_base<{
@@ -719,7 +719,7 @@ type Snapshot<T, E = CapxulError> = {
719
719
  readonly status: "error";
720
720
  readonly error: E;
721
721
  };
722
- declare const ConvexCallError_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 & {
722
+ declare const ConvexCallError_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 & {
723
723
  readonly _tag: "ConvexCallError";
724
724
  } & Readonly<A>;
725
725
  declare class ConvexCallError extends ConvexCallError_base<{
@@ -767,10 +767,11 @@ type CompleteOnboardingIdentityInput = {
767
767
  readonly email: Email;
768
768
  readonly displayName: string;
769
769
  readonly country: CountryCode;
770
- readonly withdrawalAddress?: Address$1; /** #1062: optional globally-unique handle — store-when-present, backend-normalized. */
770
+ readonly withdrawalAddress?: Address$1;
771
+ /** #1062: optional globally-unique handle — store-when-present, backend-normalized. */
771
772
  readonly username?: string;
772
773
  };
773
- 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 & {
774
+ 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 & {
774
775
  readonly _tag: "IdentityError";
775
776
  } & Readonly<A>;
776
777
  declare class IdentityError extends IdentityError_base<{
@@ -826,7 +827,8 @@ type SafeDeploymentEvidence = {
826
827
  };
827
828
  type ProvisionInput = {
828
829
  readonly authUserId: AuthUserId;
829
- readonly chainId: ChainId; /** Verified session email. The backend reads the same value from BetterAuth. */
830
+ readonly chainId: ChainId;
831
+ /** Verified session email. The backend reads the same value from BetterAuth. */
830
832
  readonly email: Email;
831
833
  };
832
834
  /**
@@ -860,7 +862,7 @@ type ClaimInput = {
860
862
  readonly chainId: ChainId;
861
863
  readonly signerAddress: Address$1;
862
864
  };
863
- 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 & {
865
+ 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 & {
864
866
  readonly _tag: "SmartAccountError";
865
867
  } & Readonly<A>;
866
868
  declare class SmartAccountError extends SmartAccountError_base<{
@@ -905,7 +907,7 @@ type FundFromFaucetInput = {
905
907
  type FundFromFaucetResult = {
906
908
  readonly txHash: string;
907
909
  };
908
- declare const AccountReadError_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 & {
910
+ declare const AccountReadError_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 & {
909
911
  readonly _tag: "AccountReadError";
910
912
  } & Readonly<A>;
911
913
  declare class AccountReadError extends AccountReadError_base<{
@@ -967,14 +969,17 @@ type OrgLifecycle = {
967
969
  type StartOrResumeOrganizationInput = {
968
970
  readonly name: string;
969
971
  readonly handle: string;
970
- readonly country: string; /** #1064: optional onboarding-collected description + size bucket. */
972
+ readonly country: string;
973
+ /** #1064: optional onboarding-collected description + size bucket. */
971
974
  readonly bio?: string;
972
- readonly size?: string; /** @internal Safe trace/correlation carriage owned by the identity flow. */
975
+ readonly size?: string;
976
+ /** @internal Safe trace/correlation carriage owned by the identity flow. */
973
977
  readonly observationContext?: WireObservationContext;
974
978
  };
975
979
  type OrganizationSetupStepInput = {
976
980
  readonly orgId: OrgId;
977
- readonly signal?: AbortSignal; /** @internal Safe trace/correlation carriage owned by the identity flow. */
981
+ readonly signal?: AbortSignal;
982
+ /** @internal Safe trace/correlation carriage owned by the identity flow. */
978
983
  readonly observationContext?: WireObservationContext;
979
984
  /**
980
985
  * @internal #1655: milliseconds the identity flow waited before this
@@ -986,7 +991,8 @@ type OrganizationSetupStepInput = {
986
991
  type RecordOrganizationSetupFailureInput = {
987
992
  readonly orgId: OrgId;
988
993
  readonly error: CapxulError;
989
- readonly retryable: boolean; /** @internal Safe trace/correlation carriage owned by the identity flow. */
994
+ readonly retryable: boolean;
995
+ /** @internal Safe trace/correlation carriage owned by the identity flow. */
990
996
  readonly observationContext?: WireObservationContext;
991
997
  };
992
998
  /**
@@ -1432,7 +1438,8 @@ type ActivityItem = {
1432
1438
  readonly kind: "payment";
1433
1439
  readonly id: string;
1434
1440
  readonly ledgerKind: "Payment" | "Payout" | "Deposit";
1435
- readonly status: PaymentStatus; /** What the payment is FOR. On the list row so a title needs no second read. */
1441
+ readonly status: PaymentStatus;
1442
+ /** What the payment is FOR. On the list row so a title needs no second read. */
1436
1443
  readonly paymentType: PaymentType;
1437
1444
  readonly amount: PaymentMoney;
1438
1445
  readonly direction: PaymentDirection;
@@ -1448,7 +1455,8 @@ type ActivityItem = {
1448
1455
  readonly id: string;
1449
1456
  readonly classification: "movement_only_outflow";
1450
1457
  readonly amount: PaymentMoney;
1451
- readonly direction: PaymentDirection; /** Short-form counterparty address today. */
1458
+ readonly direction: PaymentDirection;
1459
+ /** Short-form counterparty address today. */
1452
1460
  readonly counterpartyLabel: string;
1453
1461
  readonly receipt: {
1454
1462
  readonly chainId: number;
@@ -1948,7 +1956,7 @@ type DetectPendingOrgInvitationsInput = Record<never, never>;
1948
1956
  type DetectPendingOrgInvitationsResult$1 = {
1949
1957
  readonly matched: readonly OrgId[];
1950
1958
  };
1951
- 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 & {
1959
+ 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 & {
1952
1960
  readonly _tag: "OrgError";
1953
1961
  } & Readonly<A>;
1954
1962
  declare class OrgError extends OrgError_base<{
@@ -2215,11 +2223,15 @@ type OrgView = {
2215
2223
  readonly id: OrgId;
2216
2224
  readonly name: string;
2217
2225
  readonly handle: string;
2218
- readonly safeAddress: Address$1; /** The viewing member's own role label within this org. */
2219
- readonly role: string; /** The Organization treasury Account. */
2220
- readonly treasury: Account$1; /** #1064: onboarding-collected description + size bucket; null when unset. */
2226
+ readonly safeAddress: Address$1;
2227
+ /** The viewing member's own role label within this org. */
2228
+ readonly role: string;
2229
+ /** The Organization treasury Account. */
2230
+ readonly treasury: Account$1;
2231
+ /** #1064: onboarding-collected description + size bucket; null when unset. */
2221
2232
  readonly bio: string | null;
2222
- readonly size: string | null; /** #1061 / ADR-0014: logo serving URL resolved at read time; null when unset. */
2233
+ readonly size: string | null;
2234
+ /** #1061 / ADR-0014: logo serving URL resolved at read time; null when unset. */
2223
2235
  readonly logoUrl: string | null;
2224
2236
  };
2225
2237
  interface OrganizationAccount {
@@ -2245,8 +2257,10 @@ interface OrganizationAuditLogItem {
2245
2257
  type MemberView = {
2246
2258
  readonly orgId: OrgId;
2247
2259
  readonly email: Email;
2248
- readonly name: string | null; /** Member identity key. `null` until the invitee provisions a Safe. */
2249
- readonly personalSafeAddress: Address$1 | null; /** The member role label maps to the on-chain `roleKey`. */
2260
+ readonly name: string | null;
2261
+ /** Member identity key. `null` until the invitee provisions a Safe. */
2262
+ readonly personalSafeAddress: Address$1 | null;
2263
+ /** The member role label maps to the on-chain `roleKey`. */
2250
2264
  readonly role: string;
2251
2265
  readonly roleKey: RoleKey | null;
2252
2266
  readonly status: MemberStatus;
@@ -2628,8 +2642,10 @@ interface CapxulClient {
2628
2642
  * Dev-only faucet bundle (production-surface-policy.md). `fund` lives here,
2629
2643
  * NOT on the public `client.accounts` surface.
2630
2644
  */
2631
- readonly accounts: AccountsFaucetMethods; /** Quarantined Reference-harness evidence; never a product Organization method. */
2632
- readonly organizationSetup: OrganizationSetupProofMethods; /** Product telemetry projection for internal composition and test harnesses. */
2645
+ readonly accounts: AccountsFaucetMethods;
2646
+ /** Quarantined Reference-harness evidence; never a product Organization method. */
2647
+ readonly organizationSetup: OrganizationSetupProofMethods;
2648
+ /** Product telemetry projection for internal composition and test harnesses. */
2633
2649
  readonly telemetry?: TelemetryPort;
2634
2650
  readonly close?: () => Promise<void>;
2635
2651
  };
@@ -1,6 +1,5 @@
1
1
  import { Account, Hex } from "viem";
2
2
  import { Context, Effect } from "effect";
3
-
4
3
  //#region ../errors/src/chain-cause.d.ts
5
4
  /**
6
5
  * Why an operation failed — the one flat vocabulary. The first four are the
@@ -9,7 +8,33 @@ import { Context, Effect } from "effect";
9
8
  * (the SDK's `$exception` projection, the observability schema) and the type
10
9
  * can never drift apart.
11
10
  */
12
- declare const FAILURE_MODES: readonly [/** OTP cookies live on `localhost:PORT` but OpenFort hits the Convex host. */"auth-origin-mismatch", /** An old `userId` in scoped storage makes the SDK skip re-auth → 401. */"stale-openfort-cache", /** The selected app/deployment origin is not allowlisted → 401. */"app-env-allowlist", /** Sandboxed/headless browser with no Web Crypto. */"no-secure-context", /** One upstream answered HTTP 429 or JSON-RPC -32005. Retryable. */"rate-limited", /** No answer inside the budget. Retryable. */"timeout", /** HTTP 5xx, a connection failure, or a malformed envelope. Retryable. */"upstream-down", /** Simulation or execution reverted; `chain.revert` names it when decodable. */"revert", /** A balance pre-flight shortfall or a decoded `ERC20InsufficientBalance`. */"insufficient-balance", /** A decoded `ERC20InsufficientAllowance`. */"insufficient-allowance", /** The bundler's validation refused the operation (AA2x/AA3x); its text is carried. */"rejected", /** The gateway refused the token. */"unauthorized", /** No cause could be determined. */"unknown"];
11
+ declare const FAILURE_MODES: readonly [
12
+ /** OTP cookies live on `localhost:PORT` but OpenFort hits the Convex host. */
13
+ "auth-origin-mismatch",
14
+ /** An old `userId` in scoped storage makes the SDK skip re-auth → 401. */
15
+ "stale-openfort-cache",
16
+ /** The selected app/deployment origin is not allowlisted → 401. */
17
+ "app-env-allowlist",
18
+ /** Sandboxed/headless browser with no Web Crypto. */
19
+ "no-secure-context",
20
+ /** One upstream answered HTTP 429 or JSON-RPC -32005. Retryable. */
21
+ "rate-limited",
22
+ /** No answer inside the budget. Retryable. */
23
+ "timeout",
24
+ /** HTTP 5xx, a connection failure, or a malformed envelope. Retryable. */
25
+ "upstream-down",
26
+ /** Simulation or execution reverted; `chain.revert` names it when decodable. */
27
+ "revert",
28
+ /** A balance pre-flight shortfall or a decoded `ERC20InsufficientBalance`. */
29
+ "insufficient-balance",
30
+ /** A decoded `ERC20InsufficientAllowance`. */
31
+ "insufficient-allowance",
32
+ /** The bundler's validation refused the operation (AA2x/AA3x); its text is carried. */
33
+ "rejected",
34
+ /** The gateway refused the token. */
35
+ "unauthorized",
36
+ /** No cause could be determined. */
37
+ "unknown"];
13
38
  type FailureMode = (typeof FAILURE_MODES)[number];
14
39
  /** Who answered. `alto` is the bundler; `gateway` is the AA gateway's own logic. */
15
40
  declare const CHAIN_UPSTREAMS: readonly ["alchemy", "infura", "public", "alto", "gateway"];
@@ -90,8 +115,10 @@ declare const Errors: {
90
115
  readonly accountNotFound: (accountId?: string) => CapxulError;
91
116
  readonly providerError: (provider: string, operation: string, cause: unknown, opts?: {
92
117
  readonly failure_mode?: FailureMode;
93
- readonly httpStatus?: number; /** Extra evidence for the operator (response body, edge error code). */
94
- readonly details?: Readonly<Record<string, unknown>>; /** The structured chain-path cause; sets `mode` and `details.failure_mode` too. */
118
+ readonly httpStatus?: number;
119
+ /** Extra evidence for the operator (response body, edge error code). */
120
+ readonly details?: Readonly<Record<string, unknown>>;
121
+ /** The structured chain-path cause; sets `mode` and `details.failure_mode` too. */
95
122
  readonly chain?: ChainCause;
96
123
  }) => CapxulError;
97
124
  readonly capabilityUnavailable: (provider: string, operation: string) => CapxulError;
@@ -310,7 +337,7 @@ interface CachedJwt {
310
337
  readonly token: JwtToken;
311
338
  readonly expEpochSeconds: EpochSeconds;
312
339
  }
313
- declare const AuthCacheError_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 & {
340
+ declare const AuthCacheError_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 & {
314
341
  readonly _tag: "AuthCacheError";
315
342
  } & Readonly<A>;
316
343
  declare class AuthCacheError extends AuthCacheError_base<{
@@ -1,6 +1,5 @@
1
- import { Jn as TelemetryGroupInput, Yn as TelemetryIdentifyInput, n as ObservationAdapter, or as IdentityTransition, qn as TelemetryEvent, u as CapxulClient } from "../observation-Desw1A8U.mjs";
1
+ import { Jn as TelemetryGroupInput, Yn as TelemetryIdentifyInput, n as ObservationAdapter, or as IdentityTransition, qn as TelemetryEvent, u as CapxulClient } from "../observation-BMW_idMZ.mjs";
2
2
  import { Effect, Layer } from "effect";
3
-
4
3
  //#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
5
4
  type RecordingTelemetryOperation = {
6
5
  readonly type: "emit";
@@ -1,5 +1,5 @@
1
- import { $ as deriveCapxulSafeAddress, P as fromWei, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, h as convexCallErrorFromCapxul, o as redactTelemetryEvent, p as identityErrorFromCapxul, t as assembleCapxulClient, u as accountReadErrorFromCapxul, w as toWei, y as bootstrapErrorFromCapxul } from "../create-capxul-client-BuEjwJS6.mjs";
2
- import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, N as toPublishableKey, O as toKycTier, R as CapxulError, T as toEpochMs, _ as toAppId, b as toChainId, g as toAllowedOrigin, h as toAddress, m as toAccountId, t as InMemoryAuthCacheAdapter, v as toAuthUserId, w as toEmail, x as toCountryCode } from "../InMemoryAuthCacheAdapter-VZBv1fOH.mjs";
1
+ import { $ as deriveCapxulSafeAddress, P as fromWei, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, h as convexCallErrorFromCapxul, o as redactTelemetryEvent, p as identityErrorFromCapxul, t as assembleCapxulClient, u as accountReadErrorFromCapxul, w as toWei, y as bootstrapErrorFromCapxul } from "../create-capxul-client-DNYuHQGS.mjs";
2
+ import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, N as toPublishableKey, O as toKycTier, R as CapxulError, T as toEpochMs, _ as toAppId, b as toChainId, g as toAllowedOrigin, h as toAddress, m as toAccountId, t as InMemoryAuthCacheAdapter, v as toAuthUserId, w as toEmail, x as toCountryCode } from "../InMemoryAuthCacheAdapter-B6PHyzCN.mjs";
3
3
  import { keccak256 } from "viem";
4
4
  import { Effect, Result, Semaphore } from "effect";
5
5
  import { getFunctionName } from "convex/server";
@@ -155,9 +155,9 @@ var ManualClockUnderTest = class {
155
155
  };
156
156
  //#endregion
157
157
  //#region src/testing/auth-client/InMemoryAuthClientAdapter.ts
158
- const DEFAULT_OTP_TTL_MS = toDurationMs(300 * 1e3);
159
- const DEFAULT_SESSION_TTL_MS = toDurationMs(1440 * 60 * 1e3);
160
- const DEFAULT_JWT_TTL_MS = toDurationMs(900 * 1e3);
158
+ const DEFAULT_OTP_TTL_MS = toDurationMs(3e5);
159
+ const DEFAULT_SESSION_TTL_MS = toDurationMs(864e5);
160
+ const DEFAULT_JWT_TTL_MS = toDurationMs(9e5);
161
161
  /**
162
162
  * Hermetic OTP + session state machine implementing `AuthClientPort`. Wires
163
163
  * through `AuthCachePort` for persistence (clause A11) and `ClockPort`
@@ -608,7 +608,7 @@ function cloneProfileOrNull(profile) {
608
608
  }
609
609
  //#endregion
610
610
  //#region src/testing/smart-account/smart-account-derivation.ts
611
- const SUPPORTED_CHAIN_IDS = new Set([84532, 8453]);
611
+ const SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([84532, 8453]);
612
612
  toAddress("0xa6b71e26c5e0845f74c812102ca7114b6a896ab2");
613
613
  keccak256("0x");
614
614
  function isSupportedSmartAccountChain(chainId) {
@@ -870,18 +870,19 @@ function createCapxulTestClient(options = {}) {
870
870
  });
871
871
  const identity = new InMemoryIdentityAdapter({ clock });
872
872
  const telemetry = new RecordingTelemetryAdapter();
873
+ const ports = {
874
+ authClient: authClientPortFromPromiseAdapter(authClient),
875
+ authCache,
876
+ identity,
877
+ smartAccount: new InMemorySmartAccountAdapter({ clock }),
878
+ accountRead: new InMemoryAccountReadAdapter({ rawBalance: "0" }),
879
+ bootstrap: new BootstrapStubAdapter({ script: { resolutions: /* @__PURE__ */ new Map([[`${toPublishableKey("cap_pk_test_0123456789ABCDEFGHJKMNPQRSTVWXYZ")}::${toAllowedOrigin("https://example.test")}`, TEST_BOOTSTRAP]]) } }),
880
+ clock,
881
+ telemetry,
882
+ convexCall: new ConvexCallStubAdapter({ script: {} })
883
+ };
873
884
  const client = assembleCapxulClient({
874
- ports: {
875
- authClient: authClientPortFromPromiseAdapter(authClient),
876
- authCache,
877
- identity,
878
- smartAccount: new InMemorySmartAccountAdapter({ clock }),
879
- accountRead: new InMemoryAccountReadAdapter({ rawBalance: "0" }),
880
- bootstrap: new BootstrapStubAdapter({ script: { resolutions: new Map([[`${toPublishableKey("cap_pk_test_0123456789ABCDEFGHJKMNPQRSTVWXYZ")}::${toAllowedOrigin("https://example.test")}`, TEST_BOOTSTRAP]]) } }),
881
- clock,
882
- telemetry,
883
- convexCall: new ConvexCallStubAdapter({ script: {} })
884
- },
885
+ ports,
885
886
  bootstrap: TEST_BOOTSTRAP,
886
887
  authCache,
887
888
  requirement: options.requirement ?? "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -39,24 +39,25 @@
39
39
  "devDependencies": {
40
40
  "@effect/vitest": "4.0.0-beta.105",
41
41
  "@typescript/native": "npm:typescript@7.0.2",
42
- "@vitest/coverage-v8": "4.1.7",
42
+ "@vitest/coverage-v8": "4.1.11",
43
43
  "fast-check": "^3.23.2",
44
44
  "permissionless": "0.3.4",
45
45
  "posthog-js": "^1.418.10",
46
46
  "typescript": "npm:@typescript/typescript6@6.0.2",
47
- "vite-plus": "0.1.23",
48
- "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23",
47
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
48
+ "vite-plus": "0.3.0",
49
+ "vitest": "4.1.11",
50
+ "@capxul/config": "0.2.1",
51
+ "@capxul/wire": "0.5.1",
49
52
  "@capxul/errors": "0.0.2",
50
- "@capxul/observability": "2.6.0",
51
53
  "@capxul/typescript-config": "0.0.0",
52
- "@capxul/wire": "0.5.1",
53
- "@capxul/config": "0.2.1",
54
- "@capxul/types": "0.2.1"
54
+ "@capxul/types": "0.2.1",
55
+ "@capxul/observability": "2.7.0"
55
56
  },
56
57
  "_permissionlessPinReason": "permissionless.toSafeSmartAccount is pinned to 0.3.4 for live Safe deployment E2E. Counterfactual address fixtures captured 2026-05-17 in packages/backend/convex/_shared/__tests__/counterfactual.test.ts and packages/config/tests/safe.test.ts must be re-verified before upgrading.",
57
58
  "scripts": {
58
59
  "check-types": "vp exec ../../node_modules/@typescript/native/bin/tsc -p tsconfig.json --noEmit",
59
- "lint": "vp exec oxlint -c ../../.oxlintrc.json . --deny-warnings",
60
+ "lint": "vp lint -c ../../.oxlintrc.json . --deny-warnings",
60
61
  "build": "vp pack",
61
62
  "_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205). `test:coverage:full` keeps the script form because it composes 5 reporters at invocation time.",
62
63
  "test:coverage:full": "CAPXUL_FAST_CHECK_NUM_RUNS=50 vp test run --coverage --coverage.reporter=text --coverage.reporter=json-summary --coverage.reporter=json --coverage.reporter=html --coverage.reporter=clover",