@capxul/sdk 4.2.0-rc.1 → 4.2.0-rc.3

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,11 +1,11 @@
1
1
  {
2
2
  "source": {
3
- "commit": "efa1ae30674425e4db92020bfad513fb6cf36011",
4
- "tree": "91f805524a7c7b53e6c28cf484b549b0c1dbd9dd",
3
+ "commit": "4547e113caca6cf936b489dda3c22c68ea2f30d8",
4
+ "tree": "6ccaeaf77b6d8fef28eacd312d0b884a383c502f",
5
5
  "branch": "codex/programme-rc",
6
6
  "repository": "https://github.com/Xelmar-tech/infrastructure",
7
7
  "lockfileSha256": "5870f53b72706d103220c1bcf733cb4fb71196aea32a9cfbdc277d73cc959264"
8
8
  },
9
9
  "name": "@capxul/sdk",
10
- "version": "4.2.0-rc.1"
10
+ "version": "4.2.0-rc.3"
11
11
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as signerFailure, B as isRestoring, C as normalizeExceptionErrorKind, E as safeExceptionLabel, F as CAPXUL_OPERATIONS, I as isCapxulOperation, L as normalizeCapxulOperation, M as PAYMENT_DIRECTIONS, N as PAYMENT_STATUSES, O as isSettingUpLifecycle, R as destination, S as SDK_VERSION, T as projectSdkException, _ as fingerprintPaymentIntent, b as failureDetail, d as embeddedSigner, f as openfortEmbeddedSigner, g as devPrivateKeySigner, h as deriveDevPrivateKey, j as resolveFailureMode, k as injectedWalletSigner, m as openfortEmbeddedWalletPort, p as openfortEmbeddedSignerFromWallet, r as postHogObservability, t as createCapxulClient$1, w as normalizeExceptionOperation, x as EXCEPTION_MESSAGE, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as isClaimed } from "./production-FgHUndeX.mjs";
1
+ import { A as signerFailure, B as isRestoring, C as normalizeExceptionErrorKind, E as safeExceptionLabel, F as CAPXUL_OPERATIONS, I as isCapxulOperation, L as normalizeCapxulOperation, M as PAYMENT_DIRECTIONS, N as PAYMENT_STATUSES, O as isSettingUpLifecycle, R as destination, S as SDK_VERSION, T as projectSdkException, _ as fingerprintPaymentIntent, b as failureDetail, d as embeddedSigner, f as openfortEmbeddedSigner, g as devPrivateKeySigner, h as deriveDevPrivateKey, j as resolveFailureMode, k as injectedWalletSigner, m as openfortEmbeddedWalletPort, p as openfortEmbeddedSignerFromWallet, r as postHogObservability, t as createCapxulClient$1, w as normalizeExceptionOperation, x as EXCEPTION_MESSAGE, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as isClaimed } from "./production-2bwmvmWd.mjs";
2
2
  import { L as toCountryCode, O as assetIdFor, R as toCurrencyCode, U as toHandle, ct as CHAIN_UPSTREAMS, h as CAPXUL_PAYMENTS_V2_ADDRESS, it as CapxulError, j as toAddress, k as currencySymbolFor, lt as FAILURE_MODES, ot as Errors, q as toPartyId, rt as CAPXUL_ERROR_CODES, st as isCapxulError, tt as HANDLE_RE, w as EVM_ADDRESS_RE, y as configuredMoneyAssetById } from "./OAuthBearerAuthClient-BrbXrndM.mjs";
3
3
  import { formatUnits } from "viem";
4
4
  import { Effect } from "effect";
@@ -5451,7 +5451,7 @@ const moneyExecutionContract = {
5451
5451
  };
5452
5452
  //#endregion
5453
5453
  //#region package.json
5454
- var version = "4.2.0-rc.1";
5454
+ var version = "4.2.0-rc.3";
5455
5455
  //#endregion
5456
5456
  //#region src/telemetry/exception-projection.ts
5457
5457
  /** Fixed fallback for failures that have no safe message. */
@@ -11363,14 +11363,66 @@ function organizationWrongState(currentState, validStates) {
11363
11363
  function requestCancelled(options) {
11364
11364
  return options?.signal?.aborted === true;
11365
11365
  }
11366
+ function accountInFlight(state) {
11367
+ return state.phase === "authenticated" && (state.account.at === "deriving" || state.account.at === "claiming");
11368
+ }
11369
+ function settledAccount(deps, options) {
11370
+ return new Promise((resolve) => {
11371
+ let done = false;
11372
+ let unsubscribe = null;
11373
+ const onAbort = () => finish({
11374
+ ok: false,
11375
+ error: Errors.cancelled({ operation: CAPXUL_OPERATIONS.onboarding.completeOrganization })
11376
+ });
11377
+ const finish = (result) => {
11378
+ if (done) return;
11379
+ done = true;
11380
+ unsubscribe?.();
11381
+ options?.signal?.removeEventListener("abort", onAbort);
11382
+ resolve(result);
11383
+ };
11384
+ if (options?.signal?.aborted) {
11385
+ onAbort();
11386
+ return;
11387
+ }
11388
+ options?.signal?.addEventListener("abort", onAbort, { once: true });
11389
+ const stop = deps.subscribeIdentity((state) => {
11390
+ if (!accountInFlight(state)) finish({
11391
+ ok: true,
11392
+ value: state
11393
+ });
11394
+ });
11395
+ if (done) {
11396
+ stop();
11397
+ return;
11398
+ }
11399
+ unsubscribe = stop;
11400
+ const current = deps.snapshotIdentity();
11401
+ if (!accountInFlight(current)) finish({
11402
+ ok: true,
11403
+ value: current
11404
+ });
11405
+ });
11406
+ }
11366
11407
  async function reachClaimedAccount(deps, options) {
11367
11408
  let state = deps.snapshotIdentity();
11409
+ if (accountInFlight(state)) {
11410
+ const settled = await settledAccount(deps, options);
11411
+ if (!settled.ok) return settled;
11412
+ state = settled.value;
11413
+ }
11368
11414
  if (state.phase !== "authenticated" || state.account.at === "unknown") {
11369
11415
  const ensured = await deps.sendIdentity({ _tag: "EnsureAccount" }, options);
11370
11416
  if (!ensured.ok) return ensured;
11371
11417
  state = ensured.value;
11372
11418
  }
11373
11419
  if (state.phase !== "authenticated") return organizationWrongState(state.phase, ["authenticated:claimed"]);
11420
+ if (accountInFlight(state)) {
11421
+ const settled = await settledAccount(deps, options);
11422
+ if (!settled.ok) return settled;
11423
+ state = settled.value;
11424
+ if (state.phase !== "authenticated") return organizationWrongState(state.phase, ["authenticated:claimed"]);
11425
+ }
11374
11426
  if (state.account.at !== "claimed") {
11375
11427
  const event = state.account.at === "failed" ? { _tag: "RetryAccount" } : state.account.at === "counterfactual" ? { _tag: "ClaimAccount" } : { _tag: "EnsureAccount" };
11376
11428
  const claimed = await deps.sendIdentity(event, options);
@@ -13170,6 +13222,7 @@ function assembleCapxulClient(input) {
13170
13222
  ensureAccount: account._internal.ensureReady,
13171
13223
  getLifecycle: account.getLifecycle,
13172
13224
  snapshotIdentity: actor.snapshot,
13225
+ subscribeIdentity: actor.subscribe,
13173
13226
  sendIdentity: (event, options) => runCapxulEffect(askIdentity(actor, event, options), options, CAPXUL_OPERATIONS._internal.identity.send, effectRunner.runPromise)
13174
13227
  });
13175
13228
  const system = makeSystemMethods({ convexCall: input.ports.convexCall });
@@ -1,4 +1,4 @@
1
- import { D as fromWei, P as redactTelemetryEvent, a as smartAccountErrorFromCapxul, c as identityErrorFromCapxul, i as assembleCapxulClient, l as convexCallErrorFromCapxul, n as createCapxulClientWithSignerControls, o as accountReadErrorFromCapxul, s as wireChainId, u as bootstrapErrorFromCapxul, v as toWei } from "../production-FgHUndeX.mjs";
1
+ import { D as fromWei, P as redactTelemetryEvent, a as smartAccountErrorFromCapxul, c as identityErrorFromCapxul, i as assembleCapxulClient, l as convexCallErrorFromCapxul, n as createCapxulClientWithSignerControls, o as accountReadErrorFromCapxul, s as wireChainId, u as bootstrapErrorFromCapxul, v as toWei } from "../production-2bwmvmWd.mjs";
2
2
  import { A as toAccountId, B as toEmail, G as toKycTier, H as toEpochSeconds, I as toChainId, L as toCountryCode, M as toAllowedOrigin, N as toAppId, P as toAuthUserId, Q as toSessionToken, U as toHandle, V as toEpochMs, W as toJwtToken, X as toPublishableKey, d as authClientPortFromPromiseAdapter, et as validateHandle, it as CapxulError, j as toAddress, n as readClockNow, ot as Errors, r as InMemoryAuthCacheAdapter, v as deriveCapxulSafeAddress, z as toDurationMs } from "../OAuthBearerAuthClient-BrbXrndM.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": "4.2.0-rc.1",
3
+ "version": "4.2.0-rc.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -49,10 +49,10 @@
49
49
  "vitest": "4.1.11",
50
50
  "@capxul/config": "0.3.0",
51
51
  "@capxul/errors": "0.3.0",
52
+ "@capxul/observability": "4.2.0-rc.3",
52
53
  "@capxul/types": "0.3.0",
53
- "@capxul/observability": "4.2.0-rc.1",
54
- "@capxul/wire": "0.7.0",
55
- "@capxul/typescript-config": "0.0.0"
54
+ "@capxul/typescript-config": "0.0.0",
55
+ "@capxul/wire": "0.7.0"
56
56
  },
57
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.",
58
58
  "scripts": {