@capxul/sdk 2.0.1 → 2.0.2

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.
@@ -1,4 +1,4 @@
1
- import { $ as CapxulErrorDetails, A as CountryCode, B as PermissionAssignmentId, C as AllowedOrigin, D as AuthUserId, E as AuthSession, F as EpochMs, G as SessionToken, H as Profile, I as Money, J as WeiAmount, K as SmartAccount, L as MovementId, M as DocumentHash, N as DurationMs, O as BlockNumber, P as Email, Q as CapxulErrorCode, R as OrgId, S as AllowanceKey, T as AppId, U as PublishableKey, V as PermissionId, W as RoleKey, Z as CapxulError, d as CapxulResult, et as Failure, f as Profile$1, g as AuthCachePort, j as CurrencyCode, k as ChainId, m as SmartAccount$1, n as CapxulSigner, o as AccountProviderSource, p as Session$1, q as TxHash, s as AccountRequirement, tt as FailureMode, v as CachedJwt, w as AnonymousDistinctId, x as Address$1, y as Account$1, z as PaymentCommandId } from "./signer-ZijoFiUs.mjs";
1
+ import { $ as CapxulErrorDetails, A as CountryCode, B as PermissionAssignmentId, C as AllowedOrigin, D as AuthUserId, E as AuthSession, F as EpochMs, G as SessionToken, H as Profile, I as Money, J as WeiAmount, K as SmartAccount, L as MovementId, M as DocumentHash, N as DurationMs, O as BlockNumber, P as Email, Q as CapxulErrorCode, R as OrgId, S as AllowanceKey, T as AppId, U as PublishableKey, V as PermissionId, W as RoleKey, Z as CapxulError, d as CapxulResult, et as Failure, f as Profile$1, g as AuthCachePort, j as CurrencyCode, k as ChainId, m as SmartAccount$1, n as CapxulSigner, o as AccountProviderSource, p as Session$1, q as TxHash, s as AccountRequirement, tt as FailureMode, v as CachedJwt, w as AnonymousDistinctId, x as Address$1, y as Account$1, z as PaymentCommandId } from "./signer-CeH3ULzn.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";
@@ -2091,6 +2091,7 @@ async function runPortEffect(effect, controls, operation = "port", runPromise =
2091
2091
  }
2092
2092
  /** Map machine-internal failure state onto the public SDK error vocabulary. */
2093
2093
  function publicIdentityFailure(failure) {
2094
+ if (failure.error !== void 0) return failure.error;
2094
2095
  return new CapxulError(failure.code === "WORK_DIED" ? "UNKNOWN" : failure.code, failure.message, {
2095
2096
  ...failure.mode === void 0 ? {} : { details: { failure_mode: failure.mode } },
2096
2097
  layer: "identity"
@@ -4402,7 +4403,7 @@ function makeAccountMethods(deps) {
4402
4403
  const state = result._tag === "Failure" ? deps.actor.snapshot() : result.success;
4403
4404
  if (result._tag === "Failure" && state.phase === "authenticated" && state.account.at === "failed" && state.account.failure.code === result.failure.reason) return {
4404
4405
  ok: false,
4405
- error: state.account.step === "deploy" && state.account.failure.code === "PROVIDER_ERROR" ? Errors.providerError("signer", "getAddress", state.account.failure.message) : publicIdentityFailure(state.account.failure)
4406
+ error: publicIdentityFailure(state.account.failure)
4406
4407
  };
4407
4408
  if (result._tag === "Failure") return {
4408
4409
  ok: false,
@@ -4414,7 +4415,7 @@ function makeAccountMethods(deps) {
4414
4415
  };
4415
4416
  if (state.phase === "authenticated" && state.account.at === "failed") return {
4416
4417
  ok: false,
4417
- error: state.account.step === "deploy" && state.account.failure.code === "PROVIDER_ERROR" ? Errors.providerError("signer", "getAddress", state.account.failure.message) : publicIdentityFailure(state.account.failure)
4418
+ error: publicIdentityFailure(state.account.failure)
4418
4419
  };
4419
4420
  return {
4420
4421
  ok: true,
@@ -4605,7 +4606,7 @@ function makeAccountMethods(deps) {
4605
4606
  }
4606
4607
  //#endregion
4607
4608
  //#region package.json
4608
- var version = "2.0.1";
4609
+ var version = "2.0.2";
4609
4610
  //#endregion
4610
4611
  //#region src/ports/auth-client.ts
4611
4612
  var AuthClientError = class extends Data.TaggedError("AuthClientError") {};
@@ -4950,7 +4951,20 @@ const OrganizationCreationFailedProps = Schema.Struct({
4950
4951
  attempt_number: AttemptNumberSchema,
4951
4952
  stage: OnboardingStageSchema,
4952
4953
  error_code: Schema.String,
4953
- retryable: Schema.Boolean
4954
+ retryable: Schema.Boolean,
4955
+ failure_reason: Schema.optional(Schema.Literals([
4956
+ "deterministic_address_mismatch",
4957
+ "receipt_provider_unavailable",
4958
+ "receipt_mismatch",
4959
+ "block_provider_unavailable",
4960
+ "authority_event_mismatch",
4961
+ "allowance_timestamp_mismatch",
4962
+ "receipt_identity_unavailable",
4963
+ "receipt_identity_mismatch",
4964
+ "contract_code_unavailable",
4965
+ "contract_state_mismatch",
4966
+ "permission_projection_mismatch"
4967
+ ]))
4954
4968
  });
4955
4969
  const OnboardingIntentSchema = Schema.Literals(["personal", "organization"]);
4956
4970
  const OnboardingIntentSelectedProps = Schema.Struct({
@@ -5584,7 +5598,8 @@ const failureOf = (error) => {
5584
5598
  return {
5585
5599
  code: error.code,
5586
5600
  message: error.message,
5587
- ...typeof mode === "string" ? { mode } : {}
5601
+ ...typeof mode === "string" ? { mode } : {},
5602
+ error
5588
5603
  };
5589
5604
  }
5590
5605
  if (typeof error === "object" && error !== null && "publicError" in error) return failureOf(error.publicError);
@@ -5612,7 +5627,7 @@ const modelSession = (session) => ({
5612
5627
  });
5613
5628
  const claimAccount = (input, authUserId, signer) => call("smart-account.claim", Effect.tryPromise({
5614
5629
  try: () => signer.getAddress(),
5615
- catch: () => new CapxulError("PROVIDER_ERROR", "Provider error: signer getAddress")
5630
+ catch: (cause) => cause instanceof CapxulError ? cause : Errors.providerError("openfort", "getAddress", cause, { failure_mode: "unknown" })
5616
5631
  }).pipe(Effect.flatMap((signerAddress) => input.ports.smartAccount.claim({
5617
5632
  authUserId: toAuthUserId(authUserId),
5618
5633
  chainId: toChainId(input.chainId),
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as CapxulErrorDetails, A as CountryCode, D as AuthUserId, E as AuthSession, I as Money, Q as CapxulErrorCode, R as OrgId, W as RoleKey, X as toCountryCode, Y as toAddress, Z as CapxulError, a as AccountProvider, b as AccountId, c as Eip1193Provider, d as CapxulResult, f as Profile, i as injectedWalletSigner, l as eip1193AccountProvider, m as SmartAccount, n as CapxulSigner, nt as isCapxulError, o as AccountProviderSource, p as Session, r as Eip1193RequestProvider, s as AccountRequirement, t as CapxulDigestSigner, tt as FailureMode, u as localPrivateKeyAccountProvider, x as Address, y as Account } from "./signer-ZijoFiUs.mjs";
2
- import { $ as InboxMethods, $t as WireObservationContext, A as OrganizationPaymentsMethods, At as PaymentDocumentRender, B as AccountMethods, Bt as RecipientResolutionKind, C as ResendInviteTokenInput, Ct as OfframpQuoteInput, D as OrganizationPaymentBatchInput, Dt as Payment, E as RoleView, Et as PayeesMethods, F as PermissionOptions, Ft as PaymentTiming, G as ActorRequestIssueInput, Gt as AccountLifecycle, H as ActorProfileMethods, Ht as ResolvedTarget, I as PermissionReplaceInput, It as PaymentType, J as AddressBookEntry, Jt as IdentityMethods, K as ActorRequestsMethods, Kt as AccountSetupStep, L as PermissionRevokeInput, Lt as PaymentsMethods, M as PermissionChangeInput, Mt as PaymentDocumentsMethods, N as PermissionCreateInput, Nt as PaymentMoney, O as OrganizationPaymentInput, Ot as PaymentDocumentKind, P as PermissionMethods, Pt as PaymentStatus, Q as InboxItem, Qt as OrgSetupStep, R as PermissionReadResult, Rt as PaymentsPayInput, S as OrganizationAuditLogItem, St as OfframpQuote, T as RoleSpendCap, Tt as Payee, U as ActorRelationshipMethods, Ut as TargetReference, V as ActorProfile, Vt as Ref, W as ActorRequest, Wt as TargetsMethods, X as AddressBookMethods, Xt as AuthMethods, Y as AddressBookLabelInput, Yt as SmartAccountMethods, Z as InboxApproveInput, Zt as OrgLifecycle, _ as OrgMethods, _n as IdentityTransition, _t as FinancialOpsMethods, a as IdentityRuntimeSendResult, at as ActivityPage, b as OrgView, bt as MeProfile, c as SystemHealth, cn as TelemetryPort, ct as DepositInstructions, d as CurrentUserMethods, dn as IdentityEvent, dt as DestinationKind, en as CurrentHoldings, et as ActivityAnnotationInput, f as CreateOrgInput, fn as IdentityState, ft as DestinationListInput, g as MemberView, gn as destination, gt as DestinationsMethods, h as MemberStatus, hn as StateLabel, ht as DestinationRemoveInput, i as IdentityRuntime, in as CapxulEnv, it as ActivityMethods, j as PermissionAssignInput, jt as PaymentDocumentVerification, k as OrganizationPaymentItemInput, kt as PaymentDocumentRef, l as MediaMethods, ln as CAPXUL_PAYMENTS_V2_ADDRESS, lt as Destination, m as InviteMemberInput, mn as Readiness, mt as DestinationRail, n as CreateCapxulClientInput, nn as Permission, nt as ActivityItem, o as HoldingsMethods, ot as ActivityReference, p as DetectPendingOrgInvitationsResult, pn as OrgLane, pt as DestinationPayload, q as AddressBookAddInput, qt as isSettingUpLifecycle, r as IdentityProfileDetails, rn as SubmittedPermissionExecution, rt as ActivityListParams, s as SystemMethods, st as ActorReference, t as CapxulClient, tn as MovementAnnotation, tt as ActivityDetail, u as CurrentUserContext, un as Destination$1, ut as DestinationAddInput, v as OrgScopedMethods, vn as InvocationControls, vt as HandlesMethods, w as RoleDefinition, wt as OfframpStatus, x as OrganizationAccount, xt as OfframpMethods, y as OrgTemplate, yt as MeMethods, z as AccountsMethods, zt as RecipientResolution } from "./create-capxul-client-BklYjuYQ.mjs";
1
+ import { $ as CapxulErrorDetails, A as CountryCode, D as AuthUserId, E as AuthSession, I as Money, Q as CapxulErrorCode, R as OrgId, W as RoleKey, X as toCountryCode, Y as toAddress, Z as CapxulError, a as AccountProvider, b as AccountId, c as Eip1193Provider, d as CapxulResult, f as Profile, i as injectedWalletSigner, l as eip1193AccountProvider, m as SmartAccount, n as CapxulSigner, nt as isCapxulError, o as AccountProviderSource, p as Session, r as Eip1193RequestProvider, s as AccountRequirement, t as CapxulDigestSigner, tt as FailureMode, u as localPrivateKeyAccountProvider, x as Address, y as Account } from "./signer-CeH3ULzn.mjs";
2
+ import { $ as InboxMethods, $t as WireObservationContext, A as OrganizationPaymentsMethods, At as PaymentDocumentRender, B as AccountMethods, Bt as RecipientResolutionKind, C as ResendInviteTokenInput, Ct as OfframpQuoteInput, D as OrganizationPaymentBatchInput, Dt as Payment, E as RoleView, Et as PayeesMethods, F as PermissionOptions, Ft as PaymentTiming, G as ActorRequestIssueInput, Gt as AccountLifecycle, H as ActorProfileMethods, Ht as ResolvedTarget, I as PermissionReplaceInput, It as PaymentType, J as AddressBookEntry, Jt as IdentityMethods, K as ActorRequestsMethods, Kt as AccountSetupStep, L as PermissionRevokeInput, Lt as PaymentsMethods, M as PermissionChangeInput, Mt as PaymentDocumentsMethods, N as PermissionCreateInput, Nt as PaymentMoney, O as OrganizationPaymentInput, Ot as PaymentDocumentKind, P as PermissionMethods, Pt as PaymentStatus, Q as InboxItem, Qt as OrgSetupStep, R as PermissionReadResult, Rt as PaymentsPayInput, S as OrganizationAuditLogItem, St as OfframpQuote, T as RoleSpendCap, Tt as Payee, U as ActorRelationshipMethods, Ut as TargetReference, V as ActorProfile, Vt as Ref, W as ActorRequest, Wt as TargetsMethods, X as AddressBookMethods, Xt as AuthMethods, Y as AddressBookLabelInput, Yt as SmartAccountMethods, Z as InboxApproveInput, Zt as OrgLifecycle, _ as OrgMethods, _n as IdentityTransition, _t as FinancialOpsMethods, a as IdentityRuntimeSendResult, at as ActivityPage, b as OrgView, bt as MeProfile, c as SystemHealth, cn as TelemetryPort, ct as DepositInstructions, d as CurrentUserMethods, dn as IdentityEvent, dt as DestinationKind, en as CurrentHoldings, et as ActivityAnnotationInput, f as CreateOrgInput, fn as IdentityState, ft as DestinationListInput, g as MemberView, gn as destination, gt as DestinationsMethods, h as MemberStatus, hn as StateLabel, ht as DestinationRemoveInput, i as IdentityRuntime, in as CapxulEnv, it as ActivityMethods, j as PermissionAssignInput, jt as PaymentDocumentVerification, k as OrganizationPaymentItemInput, kt as PaymentDocumentRef, l as MediaMethods, ln as CAPXUL_PAYMENTS_V2_ADDRESS, lt as Destination, m as InviteMemberInput, mn as Readiness, mt as DestinationRail, n as CreateCapxulClientInput, nn as Permission, nt as ActivityItem, o as HoldingsMethods, ot as ActivityReference, p as DetectPendingOrgInvitationsResult, pn as OrgLane, pt as DestinationPayload, q as AddressBookAddInput, qt as isSettingUpLifecycle, r as IdentityProfileDetails, rn as SubmittedPermissionExecution, rt as ActivityListParams, s as SystemMethods, st as ActorReference, t as CapxulClient, tn as MovementAnnotation, tt as ActivityDetail, u as CurrentUserContext, un as Destination$1, ut as DestinationAddInput, v as OrgScopedMethods, vn as InvocationControls, vt as HandlesMethods, w as RoleDefinition, wt as OfframpStatus, x as OrganizationAccount, xt as OfframpMethods, y as OrgTemplate, yt as MeMethods, z as AccountsMethods, zt as RecipientResolution } from "./create-capxul-client-BixUOzdC.mjs";
3
3
  import { Hex } from "viem";
4
4
  import { Context, Effect, Layer } from "effect";
5
5
  import { FunctionReference } from "convex/server";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as encodeObservationContextHeader, B as captureExceptionSync, C as BootstrapPortTag, D as version, E as AuthClientPortTag, F as isSettingUpLifecycle, G as destination, H as normalizeBindingEmail, I as formatTraceparent, L as copyInvocationObservation, M as CAPXUL_FUNCTIONS, N as BootstrapEnvelope, O as fromWei, P as EngineeringTelemetryBootstrapPolicy, R as readInvocationObservation, S as ClockPortTag, T as authClientPortFromPromiseAdapter, U as BASE_SEPOLIA_CHAIN_ID, V as CAPXUL_PAYMENTS_V2_ADDRESS, _ as IdentityPortTag, a as observeFailedResult, b as convexCallErrorFromCapxul, c as PostHogTelemetryLayer, d as SmartAccountPortTag, f as smartAccountErrorFromCapxul, g as wireChainId, h as toWei, i as observationContextProps, j as sanitizeObservationContext, k as OBSERVATION_CONTEXT_HEADER, l as TelemetryPortTag, m as accountReadErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as AccountReadPortTag, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as detectAuthCacheAdapter, t as assembleCapxulClient, v as identityErrorFromCapxul, w as bootstrapErrorFromCapxul, x as ClockError, y as ConvexCallPortTag, z as captureException } from "./create-capxul-client-oqLlUkzI.mjs";
1
+ import { A as encodeObservationContextHeader, B as captureExceptionSync, C as BootstrapPortTag, D as version, E as AuthClientPortTag, F as isSettingUpLifecycle, G as destination, H as normalizeBindingEmail, I as formatTraceparent, L as copyInvocationObservation, M as CAPXUL_FUNCTIONS, N as BootstrapEnvelope, O as fromWei, P as EngineeringTelemetryBootstrapPolicy, R as readInvocationObservation, S as ClockPortTag, T as authClientPortFromPromiseAdapter, U as BASE_SEPOLIA_CHAIN_ID, V as CAPXUL_PAYMENTS_V2_ADDRESS, _ as IdentityPortTag, a as observeFailedResult, b as convexCallErrorFromCapxul, c as PostHogTelemetryLayer, d as SmartAccountPortTag, f as smartAccountErrorFromCapxul, g as wireChainId, h as toWei, i as observationContextProps, j as sanitizeObservationContext, k as OBSERVATION_CONTEXT_HEADER, l as TelemetryPortTag, m as accountReadErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as AccountReadPortTag, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as detectAuthCacheAdapter, t as assembleCapxulClient, v as identityErrorFromCapxul, w as bootstrapErrorFromCapxul, x as ClockError, y as ConvexCallPortTag, z as captureException } from "./create-capxul-client-DZh_Ymsf.mjs";
2
2
  import { A as toSessionToken, C as toEpochMs, D as toOrgId, E as toKycTier, F as isCapxulError, M as CapxulError, O as toPublishableKey, P as Errors, S as toEmail, T as toJwtToken, _ as toAuthUserId, b as toCurrencyCode, h as toAllowedOrigin, j as decodeConvexError, k as toRoleKey, m as toAddress, o as AuthCachePortTag, p as toAccountId, v as toChainId, w as toEpochSeconds, x as toDurationMs, y as toCountryCode } from "./InMemoryAuthCacheAdapter-Rc8tCtml.mjs";
3
3
  import { keccak256, recoverAddress, stringToHex } from "viem";
4
4
  import { Cause, Context, Data, Effect, Exit, Layer, Result, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
@@ -1,4 +1,4 @@
1
- import { E as AuthSession, _ as AuthCachePortTag, g as AuthCachePort, h as AuthCacheError, n as CapxulSigner, v as CachedJwt } from "../signer-ZijoFiUs.mjs";
1
+ import { E as AuthSession, _ as AuthCachePortTag, g as AuthCachePort, h as AuthCacheError, n as CapxulSigner, v as CachedJwt } from "../signer-CeH3ULzn.mjs";
2
2
  import { Hex } from "viem";
3
3
  import { Effect, FileSystem, Layer, Path } from "effect";
4
4
 
@@ -31,6 +31,7 @@ interface Failure {
31
31
  readonly code: CapxulErrorCode;
32
32
  readonly message: string;
33
33
  readonly mode?: FailureMode;
34
+ readonly error?: CapxulError;
34
35
  }
35
36
  type CapxulErrorDetails = Record<string, unknown>;
36
37
  type CapxulErrorOptions = {
@@ -1,4 +1,4 @@
1
- import { _n as IdentityTransition, an as TelemetryEvent, on as TelemetryGroupInput, sn as TelemetryIdentifyInput, t as CapxulClient } from "../create-capxul-client-BklYjuYQ.mjs";
1
+ import { _n as IdentityTransition, an as TelemetryEvent, on as TelemetryGroupInput, sn as TelemetryIdentifyInput, t as CapxulClient } from "../create-capxul-client-BixUOzdC.mjs";
2
2
  import { Effect, Layer } from "effect";
3
3
 
4
4
  //#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
@@ -1,4 +1,4 @@
1
- import { O as fromWei, T as authClientPortFromPromiseAdapter, W as deriveCapxulSafeAddress, b as convexCallErrorFromCapxul, f as smartAccountErrorFromCapxul, g as wireChainId, h as toWei, m as accountReadErrorFromCapxul, t as assembleCapxulClient, u as redactTelemetryEvent, v as identityErrorFromCapxul, w as bootstrapErrorFromCapxul } from "../create-capxul-client-oqLlUkzI.mjs";
1
+ import { O as fromWei, T as authClientPortFromPromiseAdapter, W as deriveCapxulSafeAddress, b as convexCallErrorFromCapxul, f as smartAccountErrorFromCapxul, g as wireChainId, h as toWei, m as accountReadErrorFromCapxul, t as assembleCapxulClient, u as redactTelemetryEvent, v as identityErrorFromCapxul, w as bootstrapErrorFromCapxul } from "../create-capxul-client-DZh_Ymsf.mjs";
2
2
  import { A as toSessionToken, C as toEpochMs, E as toKycTier, M as CapxulError, O as toPublishableKey, P as Errors, S as toEmail, T as toJwtToken, _ as toAuthUserId, g as toAppId, h as toAllowedOrigin, m as toAddress, p as toAccountId, t as InMemoryAuthCacheAdapter, v as toChainId, w as toEpochSeconds, x as toDurationMs, y as toCountryCode } from "../InMemoryAuthCacheAdapter-Rc8tCtml.mjs";
3
3
  import { keccak256 } from "viem";
4
4
  import { Effect, Result, Semaphore } from "effect";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -48,10 +48,10 @@
48
48
  "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23",
49
49
  "@capxul/config": "0.1.1",
50
50
  "@capxul/errors": "0.0.1",
51
+ "@capxul/observability": "2.0.2",
51
52
  "@capxul/typescript-config": "0.0.0",
52
- "@capxul/observability": "2.0.1",
53
- "@capxul/wire": "0.1.0",
54
- "@capxul/types": "0.1.0"
53
+ "@capxul/types": "0.1.0",
54
+ "@capxul/wire": "0.1.0"
55
55
  },
56
56
  "_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
57
  "scripts": {