@capxul/sdk 4.20.0-beta.3 → 4.20.0-beta.5

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.
@@ -310,10 +310,27 @@ type Money = {
310
310
  };
311
311
  type Account$1 = {
312
312
  readonly id: AccountId;
313
+ readonly balances: readonly AccountPosition[];
314
+ /** Fiat valuation of `balances`. Never a token quantity. */
313
315
  readonly balance: Money;
314
316
  readonly available: Money;
315
317
  };
318
+ /**
319
+ * One asset position on an Account. `asset` is the identity; `symbol` and
320
+ * `decimals` are display metadata. `balance` and `available` are major-unit
321
+ * decimal strings at `decimals`, never a fiat `Money`.
322
+ */
323
+ type AccountPosition = {
324
+ readonly asset: AssetId;
325
+ readonly symbol: string;
326
+ readonly decimals: number;
327
+ readonly balance: string;
328
+ readonly available: string;
329
+ };
316
330
  type AuthUserId = Brand<string, "AuthUserId">;
331
+ /** Public native connection identifiers; never bearer credentials. */
332
+ type ClientRequestId = Brand<string, "ClientRequestId">;
333
+ type ClientGrantId = Brand<string, "ClientGrantId">;
317
334
  type AnonymousDistinctId = Brand<string, "AnonymousDistinctId">;
318
335
  type AccountId = Brand<string, "AccountId">;
319
336
  type PartyId = Brand<string, "PartyId">;
@@ -625,4 +642,4 @@ interface OAuthBearerAuthClientInput {
625
642
  */
626
643
  declare function oauthBearerAuthClient(input: OAuthBearerAuthClientInput): AuthClientPort;
627
644
  //#endregion
628
- export { PayrollGroupId as $, AllowanceKey as A, ChainId as B, AuthCachePort as C, ChainCause as Ct, Account$1 as D, RevertSummary as Dt, CAPXUL_PAYMENTS_V2_ADDRESS as E, FailureMode as Et, AssetId as F, EVM_ADDRESS_RE as G, CurrencyCode as H, AuthSession as I, Handle as J, Email as K, AuthUserId as L, AnonymousDistinctId as M, AppId as N, AccountId as O, AssetAmount as P, PaymentCommandId as Q, BlockNumber as R, AuthCacheError as S, CHAIN_UPSTREAMS as St, CachedJwt as T, FAILURE_MODES as Tt, DocumentHash as U, CountryCode as V, DurationMs as W, OrgId as X, Money as Y, PartyId as Z, Session as _, CapxulErrorCode as _t, Eip1193RequestProvider as a, RoleKey as at, AuthClientPort as b, Failure as bt, injectedWalletSigner as c, TesterKind as ct, AccountRequirement as d, toAddress as dt, PayrollRunId as et, Eip1193Provider as f, toCountryCode as ft, Profile as g, CapxulError as gt, CapxulResult as h, CAPXUL_ERROR_CODES as ht, CapxulSigner as i, PublishableKey as it, AllowedOrigin as j, Address$1 as k, AccountProvider as l, TxHash as lt, localPrivateKeyAccountProvider as m, toPartyId as mt, oauthBearerAuthClient as n, PermissionId as nt, SignerStatus as o, SessionToken as ot, eip1193AccountProvider as p, toHandle as pt, EpochMs as q, CapxulDigestSigner as r, Profile$1 as rt, SignerStatusStore as s, SmartAccount$1 as st, OAuthBearerAuthClientInput as t, PermissionAssignmentId as tt, AccountProviderSource as u, WeiAmount as ut, SmartAccount as v, CapxulErrorDetails as vt, AuthCachePortTag as w, ChainUpstream as wt, CanSendOtpStatus as x, isCapxulError as xt, ClockPort as y, Errors as yt, BudgetId as z };
645
+ export { OrgId as $, Address$1 as A, RevertSummary as At, BudgetId as B, AuthCachePort as C, Failure as Ct, Account$1 as D, ChainUpstream as Dt, CAPXUL_PAYMENTS_V2_ADDRESS as E, ChainCause as Et, AssetAmount as F, CurrencyCode as G, ClientGrantId as H, AssetId as I, EVM_ADDRESS_RE as J, DocumentHash as K, AuthSession as L, AllowedOrigin as M, AnonymousDistinctId as N, AccountId as O, FAILURE_MODES as Ot, AppId as P, Money as Q, AuthUserId as R, AuthCacheError as S, Errors as St, CachedJwt as T, CHAIN_UPSTREAMS as Tt, ClientRequestId as U, ChainId as V, CountryCode as W, EpochMs as X, Email as Y, Handle as Z, Session as _, toPartyId as _t, Eip1193RequestProvider as a, PermissionId as at, AuthClientPort as b, CapxulErrorCode as bt, injectedWalletSigner as c, RoleKey as ct, AccountRequirement as d, TesterKind as dt, PartyId as et, Eip1193Provider as f, TxHash as ft, Profile as g, toHandle as gt, CapxulResult as h, toCountryCode as ht, CapxulSigner as i, PermissionAssignmentId as it, AllowanceKey as j, AccountPosition as k, FailureMode as kt, AccountProvider as l, SessionToken as lt, localPrivateKeyAccountProvider as m, toAddress as mt, oauthBearerAuthClient as n, PayrollGroupId as nt, SignerStatus as o, Profile$1 as ot, eip1193AccountProvider as p, WeiAmount as pt, DurationMs as q, CapxulDigestSigner as r, PayrollRunId as rt, SignerStatusStore as s, PublishableKey as st, OAuthBearerAuthClientInput as t, PaymentCommandId as tt, AccountProviderSource as u, SmartAccount$1 as ut, SmartAccount as v, CAPXUL_ERROR_CODES as vt, AuthCachePortTag as w, isCapxulError as wt, CanSendOtpStatus as x, CapxulErrorDetails as xt, ClockPort as y, CapxulError as yt, BlockNumber as z };
@@ -1081,18 +1081,9 @@ const USDX_ASSET = {
1081
1081
  tokenAddress: USDX_ADDRESS_BASE_SEPOLIA,
1082
1082
  deploymentStartBlock: USDX_DEPLOYMENT_START_BLOCK,
1083
1083
  decimals: 6,
1084
- source: "settlement"
1084
+ source: "legacy"
1085
1085
  };
1086
- /**
1087
- * The settlement tier: rows the exact-transfer path and the Movement scanner
1088
- * admit, each carrying the legacy `currency` projection those readers expect.
1089
- * Adding an owned test asset here would put candidate liquidity on the
1090
- * money-write path, so M03's rows go to the candidate tier below instead.
1091
- */
1092
- const CONFIGURED_MONEY_ASSETS = [{
1093
- ...USDX_ASSET,
1094
- currency: USDX_ASSET.peg
1095
- }];
1086
+ ({ ...USDX_ASSET }), USDX_ASSET.peg;
1096
1087
  /**
1097
1088
  * The candidate tier: five owned test assets, every field read back from Base
1098
1089
  * Sepolia after the deployment that created it (chain 84532, blocks
@@ -1164,12 +1155,25 @@ const SYNTHETIC_TEST_ASSETS = [
1164
1155
  ];
1165
1156
  toChainId(84532);
1166
1157
  /**
1158
+ * The settlement tier: the owned test assets admitted to the exact-transfer
1159
+ * path and to the treasury reads. USDC, USDT and WETH are equal assets. There
1160
+ * is no default token and no successor to USDX; USDX survives only in
1161
+ * `LEGACY_MONEY_ASSETS` and is not a current treasury row.
1162
+ */
1163
+ const SETTLEMENT_ASSET_SYMBOLS = [
1164
+ "USDC",
1165
+ "USDT",
1166
+ "WETH"
1167
+ ];
1168
+ const CONFIGURED_MONEY_ASSETS = SYNTHETIC_TEST_ASSETS.filter((asset) => SETTLEMENT_ASSET_SYMBOLS.includes(asset.symbol));
1169
+ /**
1167
1170
  * Every known asset in ONE identity space. The tiers above declare admission;
1168
1171
  * this is the only list an identity resolves against, so an asset is never
1169
1172
  * two different things depending on which list a caller happened to read.
1170
1173
  */
1171
- const MONEY_ASSET_REGISTRY = [...CONFIGURED_MONEY_ASSETS, ...SYNTHETIC_TEST_ASSETS];
1174
+ const MONEY_ASSET_REGISTRY = [USDX_ASSET, ...SYNTHETIC_TEST_ASSETS];
1172
1175
  CONFIGURED_MONEY_ASSETS.map((asset) => asset.tokenAddress.toLowerCase());
1176
+ USDX_ADDRESS_BASE_SEPOLIA.toLowerCase();
1173
1177
  /** The registry row for `assetId` across every tier, or `null`. */
1174
1178
  function configuredMoneyAssetById(assetId) {
1175
1179
  const canonical = toAssetId(assetId);
@@ -2485,4 +2489,4 @@ function readExchange(body) {
2485
2489
  };
2486
2490
  }
2487
2491
  //#endregion
2488
- export { toPartyId as $, SUPPORTED_CURRENCY_CODES as A, toAuthUserId as B, ASSET_ID_RE as C, isChainUpstream as Ct, COUNTRY_CODE_RE as D, isCredentialField as Dt, CLIENT_REQUEST_ID_RE as E, containsSensitiveMaterial as Et, toAccountId as F, toDurationMs as G, toChainId as H, toAddress as I, toEpochSeconds as J, toEmail as K, toAllowedOrigin as L, ZERO_BYTES32 as M, assetIdFor as N, EMAIL_RE as O, redactSecrets as Ot, currencySymbolFor as P, toOrgId as Q, toAppId as R, APP_ID_RE as S, failureFingerprint as St, CLIENT_GRANT_ID_RE as T, revertSummaryText as Tt, toCountryCode as U, toBudgetId as V, toCurrencyCode as W, toJwtToken as X, toHandle as Y, toKycTier as Z, normalizeBindingEmail as _, FAILURE_MODES as _t, parseAuthSession as a, toTesterKind as at, configuredMoneyAssetById as b, chainEvidenceLabel as bt, AuthCachePortTag as c, validateHandle as ct, authClientPortFromPromiseAdapter as d, CAPXUL_ERROR_CODES as dt, toPayrollGroupId as et, AuthClientError as f, CapxulError as ft, CAPXUL_PAYMENTS_V2_ADDRESS as g, CHAIN_UPSTREAMS as gt, orgRoleKeyForLabel as h, isCapxulError as ht, BrowserAuthCacheAdapter as i, toSessionToken as it, WEI_RE as j, EVM_ADDRESS_RE as k, redactUrlSecrets as kt, SystemClockLayer as l, HANDLE_RE as lt, ADMIN_ROLE_LABEL as m, Errors as mt, readClockNow as n, toPublishableKey as nt, parseCachedJwt as o, toTxHash as ot, AuthClientPortTag as p, EXPECTED_OPERATION_OUTCOMES as pt, toEpochMs as q, InMemoryAuthCacheAdapter as r, toRoleKey as rt, AuthCacheError as s, toWeiAmount as st, oauthBearerAuthClient as t, toPayrollRunId as tt, ClockPortTag as u, decodeConvexError as ut, BASE_SEPOLIA_CHAIN_ID as v, boundedResponseHeaders as vt, BYTES32_RE as w, isFailureMode as wt, ACCOUNT_ID_RE as x, decodeChainCause as xt, deriveCapxulSafeAddress as y, chainCauseProperties as yt, toAssetId as z };
2492
+ export { toOrgId as $, EVM_ADDRESS_RE as A, redactUrlSecrets as At, toAssetId as B, APP_ID_RE as C, failureFingerprint as Ct, CLIENT_REQUEST_ID_RE as D, containsSensitiveMaterial as Dt, CLIENT_GRANT_ID_RE as E, revertSummaryText as Et, currencySymbolFor as F, toCurrencyCode as G, toBudgetId as H, toAccountId as I, toEpochMs as J, toDurationMs as K, toAddress as L, WEI_RE as M, ZERO_BYTES32 as N, COUNTRY_CODE_RE as O, isCredentialField as Ot, assetIdFor as P, toKycTier as Q, toAllowedOrigin as R, ACCOUNT_ID_RE as S, decodeChainCause as St, BYTES32_RE as T, isFailureMode as Tt, toChainId as U, toAuthUserId as V, toCountryCode as W, toHandle as X, toEpochSeconds as Y, toJwtToken as Z, normalizeBindingEmail as _, CHAIN_UPSTREAMS as _t, parseAuthSession as a, toSessionToken as at, CONFIGURED_MONEY_ASSETS as b, chainCauseProperties as bt, AuthCachePortTag as c, toWeiAmount as ct, authClientPortFromPromiseAdapter as d, decodeConvexError as dt, toPartyId as et, AuthClientError as f, CAPXUL_ERROR_CODES as ft, CAPXUL_PAYMENTS_V2_ADDRESS as g, isCapxulError as gt, orgRoleKeyForLabel as h, Errors as ht, BrowserAuthCacheAdapter as i, toRoleKey as it, SUPPORTED_CURRENCY_CODES as j, EMAIL_RE as k, redactSecrets as kt, SystemClockLayer as l, validateHandle as lt, ADMIN_ROLE_LABEL as m, EXPECTED_OPERATION_OUTCOMES as mt, readClockNow as n, toPayrollRunId as nt, parseCachedJwt as o, toTesterKind as ot, AuthClientPortTag as p, CapxulError as pt, toEmail as q, InMemoryAuthCacheAdapter as r, toPublishableKey as rt, AuthCacheError as s, toTxHash as st, oauthBearerAuthClient as t, toPayrollGroupId as tt, ClockPortTag as u, HANDLE_RE as ut, BASE_SEPOLIA_CHAIN_ID as v, FAILURE_MODES as vt, ASSET_ID_RE as w, isChainUpstream as wt, configuredMoneyAssetById as x, chainEvidenceLabel as xt, deriveCapxulSafeAddress as y, boundedResponseHeaders as yt, toAppId as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as PayrollGroupId, B as ChainId, Ct as ChainCause, D as Account, Dt as RevertSummary, E as CAPXUL_PAYMENTS_V2_ADDRESS, Et as FailureMode, F as AssetId, G as EVM_ADDRESS_RE, H as CurrencyCode, I as AuthSession, J as Handle, L as AuthUserId, O as AccountId, P as AssetAmount, St as CHAIN_UPSTREAMS, Tt as FAILURE_MODES, V as CountryCode, X as OrgId, Y as Money, Z as PartyId, _ as Session, _t as CapxulErrorCode, a as Eip1193RequestProvider, at as RoleKey, c as injectedWalletSigner, ct as TesterKind, d as AccountRequirement, dt as toAddress, et as PayrollRunId, f as Eip1193Provider, ft as toCountryCode, g as Profile, gt as CapxulError, h as CapxulResult, ht as CAPXUL_ERROR_CODES, i as CapxulSigner, k as Address, l as AccountProvider, m as localPrivateKeyAccountProvider, mt as toPartyId, o as SignerStatus, p as eip1193AccountProvider, pt as toHandle, r as CapxulDigestSigner, s as SignerStatusStore, u as AccountProviderSource, v as SmartAccount, vt as CapxulErrorDetails, wt as ChainUpstream, xt as isCapxulError, yt as Errors, z as BudgetId } from "./OAuthBearerAuthClient-C-ip-z8M.mjs";
2
- import { $ as OrganizationPaymentBatchInput, $n as RequestStatus, $t as Destination, A as OrgScopedMethods, An as Ref, At as AddressBookAddInput, B as AuthorizeRunOptions, Bn as SmartAccountMethods, Bt as ActivityFilter, C as CurrentUserMethods, Cn as PaymentMoney, Ct as AccountMethods, D as MemberStatus, Dn as PaymentsMethods, Dt as ActorRequest, E as InviteMemberInput, En as PaymentType, Et as ActorRelationshipMethods, F as ResendInviteTokenInput, Fn as AccountLifecycle, Ft as InboxItem, G as PayrollGroupsMethods, Gn as ActorRef, Gt as ActivityPage, H as PayrollGroup, Hn as OrgLifecycle, Ht as ActivityKind, I as RoleDefinition, In as AccountSetupStep, It as InboxMethods, J as PayrollRun, Jn as SubmittedPermissionExecution, Jt as ActivitySummary, K as PayrollMethods, Kn as CurrentHoldings, Kt as ActivityRange, L as RoleSpendCap, Ln as isSettingUpLifecycle, Lt as ActivityAnnotation, M as OrgView, Mn as TargetReference, Mt as AddressBookLabelInput, N as OrganizationAccount, Nn as TargetsMethods, Nt as AddressBookMethods, O as MemberView, On as PaymentsPayInput, Ot as ActorRequestIssueInput, P as OrganizationAuditLogItem, Pn as fingerprintPaymentIntent, Pt as InboxApproveInput, Q as PayrollTermsUnit, Qn as PaymentStatus$1, Qt as DepositInstructions, R as RoleView, Rn as CompleteProfileInput, Rt as ActivityAnnotationInput, S as CurrentUserContext, Sn as PaymentDocumentsMethods, St as ReadyAccountLifecycle, T as DetectPendingOrgInvitationsResult, Tn as PaymentTiming, Tt as ActorProfileMethods, U as PayrollGroupInput, Un as OrgSetupStep, Ut as ActivityListParams, V as PayrollEngagementTerms, Vn as AuthMethods, Vt as ActivityItem, W as PayrollGroupMember, Wn as PayoutAddress, Wt as ActivityMethods, X as PayrollRunStatus, Xn as PAYMENT_DIRECTIONS, Xt as ActivitySummaryTotal, Y as PayrollRunItemInput, Yn as InboxStatus, Yt as ActivitySummaryParams, Z as PayrollRuns, Zn as PAYMENT_STATUSES, Zt as ActorReference, _ as HoldingsMethods, _n as PaymentDirection, _t as OnboardingMethods, a as ObservationContext, an as DestinationRemoveInput, ar as IdentityEvent, at as PermissionCreateInput, b as SystemHealth, bn as PaymentDocumentRender, bt as PersonOnboarding, c as HostObservability, cn as MeMethods, cr as Readiness, ct as PermissionReplaceInput, d as postHogObservability, dn as OfframpMethods, dr as isClaimed, dt as Budget, en as DestinationAddInput, et as OrganizationPaymentInput, f as CapxulClient, fn as OfframpQuote, fr as isRestoring, ft as OrgMe, g as IdentityRuntimeSendResult, gn as PaymentActivityEvidence, gt as CompletedPersonProfile, h as IdentityRuntime, hn as Payment, ht as AccountsMethods, i as ObservationAdapter, in as DestinationRail, ir as Destination$1, it as PermissionChangeInput, j as OrgTemplate, jn as ResolvedTarget, jt as AddressBookEntry, k as OrgMethods, kn as RecipientResolution, kt as ActorRequestsMethods, l as PostHogObservabilityClient, ln as MeProfile, lr as StateLabel, lt as PermissionRevokeInput, m as IdentityProfileDetails, mn as OfframpStatus, mr as InvocationControls, mt as OrgMeOptions, nn as DestinationListInput, nt as OrganizationPaymentsMethods, o as ObservationDelivery, on as DestinationsMethods, or as IdentityState, ot as PermissionMethods, p as CreateCapxulClientInput, pn as OfframpQuoteInput, pr as IdentityTransition, pt as OrgMeMethod, q as PayrollOptions, qn as Permission, qt as ActivityReference, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as DestinationPayload, rr as TelemetryPort, rt as PermissionAssignInput, s as SdkFailureObservation, sn as FinancialOpsMethods, sr as OrgLane, st as PermissionOptions, t as CapxulClientInput, tn as DestinationKind, tt as OrganizationPaymentItemInput, u as PostHogObservabilityOptions, un as MovementActivityEvidence, ur as destination, ut as PermissionReadResult, v as Holding, vn as PaymentDocumentKind, vt as OrganizationOnboarding, w as CreateOrgInput, wn as PaymentStatus, wt as ActorProfile, x as MediaMethods, xn as PaymentDocumentVerification, xt as PersonOnboardingInput, y as SystemMethods, yn as PaymentDocumentRef, yt as OrganizationOnboardingInput, z as AuthorizeRunInput, zn as IdentityMethods, zt as ActivityDetail } from "./production-CJwxgI8u.mjs";
1
+ import { $ as OrgId, A as Address, At as RevertSummary, B as BudgetId, D as Account, Dt as ChainUpstream, E as CAPXUL_PAYMENTS_V2_ADDRESS, Et as ChainCause, F as AssetAmount, G as CurrencyCode, I as AssetId, J as EVM_ADDRESS_RE, L as AuthSession, O as AccountId, Ot as FAILURE_MODES, Q as Money, R as AuthUserId, St as Errors, Tt as CHAIN_UPSTREAMS, V as ChainId, W as CountryCode, Z as Handle, _ as Session, _t as toPartyId, a as Eip1193RequestProvider, bt as CapxulErrorCode, c as injectedWalletSigner, ct as RoleKey, d as AccountRequirement, dt as TesterKind, et as PartyId, f as Eip1193Provider, g as Profile, gt as toHandle, h as CapxulResult, ht as toCountryCode, i as CapxulSigner, kt as FailureMode, l as AccountProvider, m as localPrivateKeyAccountProvider, mt as toAddress, nt as PayrollGroupId, o as SignerStatus, p as eip1193AccountProvider, r as CapxulDigestSigner, rt as PayrollRunId, s as SignerStatusStore, u as AccountProviderSource, v as SmartAccount, vt as CAPXUL_ERROR_CODES, wt as isCapxulError, xt as CapxulErrorDetails, yt as CapxulError } from "./OAuthBearerAuthClient-BAxoi3SD.mjs";
2
+ import { $ as OrganizationPaymentBatchInput, $n as PAYMENT_DIRECTIONS, $t as Destination, A as OrgScopedMethods, An as Ref, At as AddressBookAddInput, B as AuthorizeRunOptions, Bn as SmartAccountMethods, Bt as ActivityFilter, C as CurrentUserMethods, Cn as PaymentMoney, Ct as AccountMethods, D as MemberStatus, Dn as PaymentsMethods, Dt as ActorRequest, E as InviteMemberInput, En as PaymentType, Et as ActorRelationshipMethods, F as ResendInviteTokenInput, Fn as AccountLifecycle, Ft as InboxItem, G as PayrollGroupsMethods, Gn as OrgSetupStep, Gt as ActivityPage, H as PayrollGroup, Hn as AccountSetupPolicy, Ht as ActivityKind, I as RoleDefinition, In as AccountSetupStep, It as InboxMethods, J as PayrollRun, Jn as ActorRef, Jt as ActivitySummary, K as PayrollMethods, Kn as PayoutAddress, Kt as ActivityRange, L as RoleSpendCap, Ln as isSettingUpLifecycle, Lt as ActivityAnnotation, M as OrgView, Mn as TargetReference, Mt as AddressBookLabelInput, N as OrganizationAccount, Nn as TargetsMethods, Nt as AddressBookMethods, O as MemberView, On as PaymentsPayInput, Ot as ActorRequestIssueInput, P as OrganizationAuditLogItem, Pn as fingerprintPaymentIntent, Pt as InboxApproveInput, Q as PayrollTermsUnit, Qn as InboxStatus, Qt as DepositInstructions, R as RoleView, Rn as CompleteProfileInput, Rt as ActivityAnnotationInput, S as CurrentUserContext, Sn as PaymentDocumentsMethods, St as ReadyAccountLifecycle, T as DetectPendingOrgInvitationsResult, Tn as PaymentTiming, Tt as ActorProfileMethods, U as PayrollGroupInput, Un as ClientRequests, Ut as ActivityListParams, V as PayrollEngagementTerms, Vn as AuthMethods, Vt as ActivityItem, W as PayrollGroupMember, Wn as OrgLifecycle, Wt as ActivityMethods, X as PayrollRunStatus, Xn as Permission, Xt as ActivitySummaryTotal, Y as PayrollRunItemInput, Yn as CurrentHoldings, Yt as ActivitySummaryParams, Z as PayrollRuns, Zn as SubmittedPermissionExecution, Zt as ActorReference, _ as HoldingsMethods, _n as PaymentDirection, _r as InvocationControls, _t as OnboardingMethods, a as ObservationContext, an as DestinationRemoveInput, at as PermissionCreateInput, b as SystemHealth, bn as PaymentDocumentRender, bt as PersonOnboarding, c as HostObservability, cn as MeMethods, cr as IdentityEvent, ct as PermissionReplaceInput, d as postHogObservability, dn as OfframpMethods, dr as Readiness, dt as Budget, en as DestinationAddInput, er as PAYMENT_STATUSES, et as OrganizationPaymentInput, f as CapxulClient, fn as OfframpQuote, fr as StateLabel, ft as OrgMe, g as IdentityRuntimeSendResult, gn as PaymentActivityEvidence, gr as IdentityTransition, gt as CompletedPersonProfile, h as IdentityRuntime, hn as Payment, hr as isRestoring, ht as AccountsMethods, i as ObservationAdapter, in as DestinationRail, it as PermissionChangeInput, j as OrgTemplate, jn as ResolvedTarget, jt as AddressBookEntry, k as OrgMethods, kn as RecipientResolution, kt as ActorRequestsMethods, l as PostHogObservabilityClient, ln as MeProfile, lr as IdentityState, lt as PermissionRevokeInput, m as IdentityProfileDetails, mn as OfframpStatus, mr as isClaimed, mt as OrgMeOptions, nn as DestinationListInput, nr as RequestStatus, nt as OrganizationPaymentsMethods, o as ObservationDelivery, on as DestinationsMethods, or as TelemetryPort, ot as PermissionMethods, p as CreateCapxulClientInput, pn as OfframpQuoteInput, pr as destination, pt as OrgMeMethod, q as PayrollOptions, qn as ClientRequestView, qt as ActivityReference, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as DestinationPayload, rt as PermissionAssignInput, s as SdkFailureObservation, sn as FinancialOpsMethods, sr as Destination$1, st as PermissionOptions, t as CapxulClientInput, tn as DestinationKind, tr as PaymentStatus$1, tt as OrganizationPaymentItemInput, u as PostHogObservabilityOptions, un as MovementActivityEvidence, ur as OrgLane, ut as PermissionReadResult, v as Holding, vn as PaymentDocumentKind, vt as OrganizationOnboarding, w as CreateOrgInput, wn as PaymentStatus, wt as ActorProfile, x as MediaMethods, xn as PaymentDocumentVerification, xt as PersonOnboardingInput, y as SystemMethods, yn as PaymentDocumentRef, yt as OrganizationOnboardingInput, z as AuthorizeRunInput, zn as IdentityMethods, zt as ActivityDetail } from "./production-DAhaxUik.mjs";
3
3
  import { Hex } from "viem";
4
4
  import { Effect, Layer } from "effect";
5
5
  //#region ../errors/src/index.d.ts
@@ -8,14 +8,14 @@ declare const HANDLE_RE: RegExp;
8
8
  //#endregion
9
9
  //#region ../config/src/tokens.d.ts
10
10
  /**
11
- * Where a registry row's liquidity comes from. `settlement` is the tier the
12
- * exact-transfer path and the Movement scanner read;
13
- * `synthetic-test-liquidity` marks an owned fixture whose balances and rates
14
- * are authored inputs, never market or provider data. Every row states its
15
- * tier, so a row that reaches a caller through the registry always carries
16
- * that fact with it.
11
+ * Where a registry row's liquidity comes from. `synthetic-test-liquidity`
12
+ * marks an owned fixture whose balances and rates are authored inputs, never
13
+ * market or provider data. `legacy` marks the preserved USDX rail, which the
14
+ * live write path still settles until the named-asset writer replaces it.
15
+ * Admission which rows a treasury read returns is `CONFIGURED_MONEY_ASSETS`,
16
+ * not this field; an owned fixture is a settlement asset.
17
17
  */
18
- type AssetSource = "settlement" | "synthetic-test-liquidity";
18
+ type AssetSource = "synthetic-test-liquidity" | "legacy";
19
19
  /** Canonical metadata. A missing peg does not imply a missing market price. */
20
20
  interface AssetMetadata {
21
21
  readonly assetId: AssetId;
@@ -98,6 +98,26 @@ declare const CAPXUL_OPERATIONS: {
98
98
  readonly createOrg: "createOrg";
99
99
  readonly orgs: "orgs";
100
100
  };
101
+ /** AUTH A3 (#2073): the SDK facade over the native continuation endpoints. */
102
+ readonly clientRequests: {
103
+ readonly decide: "clientRequests.decide";
104
+ readonly read: "clientRequests.read";
105
+ };
106
+ /** AUTH A2 (#2072): the native client authorization issuer and its browser
107
+ * continuation. One name per durable transition the endpoints can fail on. */
108
+ readonly clientAuthorization: {
109
+ readonly acceptRequest: "clientAuthorization.acceptRequest";
110
+ readonly cancelRequest: "clientAuthorization.cancelRequest";
111
+ readonly consumeRequest: "clientAuthorization.consumeRequest";
112
+ readonly denyRequest: "clientAuthorization.denyRequest";
113
+ readonly invalidateContext: "clientAuthorization.invalidateContext";
114
+ readonly markConsented: "clientAuthorization.markConsented";
115
+ readonly readMetadata: "clientAuthorization.readMetadata";
116
+ readonly revokeGrant: "clientAuthorization.revokeGrant";
117
+ readonly rotateGrant: "clientAuthorization.rotateGrant";
118
+ readonly startRequest: "clientAuthorization.startRequest";
119
+ readonly sweepExpired: "clientAuthorization.sweepExpired";
120
+ };
101
121
  readonly credentials: {
102
122
  readonly bootstrapClient: "credentials.bootstrapClient";
103
123
  readonly mintQuickstartKey: "credentials.mintQuickstartKey";
@@ -517,6 +537,19 @@ interface Valuation<T extends AssetAmount | Money = AssetAmount | Money> {
517
537
  /** Sum exact fixed-point values. Missing rates never contribute zero. */
518
538
  declare function valueIn<T extends AssetAmount | Money>(amounts: readonly T[], displayCurrency: CurrencyCode, rates?: RateSource): Valuation<T>;
519
539
  //#endregion
540
+ //#region src/domain/money/account-positions.d.ts
541
+ /**
542
+ * The fiat currency a position is denominated in: the registry peg of its
543
+ * asset, or `null` when that asset carries no peg (ADR-0028 R3/R4).
544
+ *
545
+ * A consumer must denominate a token amount in the position's OWN peg. The
546
+ * Account's `available.currency` is the display currency of a multi-asset
547
+ * VALUATION (ADR-0028 R6). It is `"USD"` for every Account regardless of what
548
+ * is held, so reading it as a position's denomination labels a token with the
549
+ * headline's fiat — the false identity this cut removes.
550
+ */
551
+ declare function positionPeg(asset: AssetId): CurrencyCode | null;
552
+ //#endregion
520
553
  //#region src/domain/money/format-money.d.ts
521
554
  /**
522
555
  * `Money` and the wire-shaped money the activity surface carries
@@ -650,4 +683,4 @@ declare function captureException(telemetry: TelemetryPort, error: unknown, cont
650
683
  */
651
684
  declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
652
685
  //#endregion
653
- export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityAnnotation, type ActivityAnnotationInput, type ActivityDetail, type ActivityFilter, type ActivityItem, type ActivityKind, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityPhase, type ActivityRange, type ActivityReference, type ActivitySummary, type ActivitySummaryParams, type ActivitySummaryTotal, type ActorProfile, type ActorProfileMethods, type ActorRef, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AssetAmount, type AssetId, type AssetMetadata, type AuthMethods, type AuthSession, type AuthUserId, type AuthorizeRunInput, type AuthorizeRunOptions, type Budget, type BudgetId, CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulOperation, type CapxulResult, type CapxulSigner, type ChainCause, type ChainUpstream, type CompleteProfileInput, type CompletedPersonProfile, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, EVM_ADDRESS_RE, type Eip1193Provider, type Eip1193RequestProvider, Errors, FAILURE_MODES, type FailureMode, type FinancialOpsMethods, HANDLE_RE, type Handle, type HandledErrorReportContext, type Holding, type HoldingsMethods, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxItem, type InboxMethods, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementActivityEvidence, type NormalizedCapxulOperation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OnboardingMethods, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMe, type OrgMeMethod, type OrgMeOptions, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationOnboarding, type OrganizationOnboardingInput, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, PEG_RATES, type PartyId, type Payment, type PaymentActivityEvidence, type PaymentDirection, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type PayoutAddress, type PayrollEngagementTerms, type PayrollGroup, type PayrollGroupId, type PayrollGroupInput, type PayrollGroupMember, type PayrollGroupsMethods, type PayrollMethods, type PayrollOptions, type PayrollRun, type PayrollRunId, type PayrollRunItemInput, type PayrollRunStatus, type PayrollRuns, type PayrollTermsUnit, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PersonOnboarding, type PersonOnboardingInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Rate, type RateSource, type Readiness, type ReadyAccountLifecycle, type RecipientResolution, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RevertSummary, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, type TesterKind, type Valuation, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress, toHandle, toPartyId, valueIn };
686
+ export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupPolicy, type AccountSetupStep, type AccountsMethods, type ActivityAnnotation, type ActivityAnnotationInput, type ActivityDetail, type ActivityFilter, type ActivityItem, type ActivityKind, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityPhase, type ActivityRange, type ActivityReference, type ActivitySummary, type ActivitySummaryParams, type ActivitySummaryTotal, type ActorProfile, type ActorProfileMethods, type ActorRef, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AssetAmount, type AssetId, type AssetMetadata, type AuthMethods, type AuthSession, type AuthUserId, type AuthorizeRunInput, type AuthorizeRunOptions, type Budget, type BudgetId, CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulOperation, type CapxulResult, type CapxulSigner, type ChainCause, type ChainUpstream, type ClientRequestView, type ClientRequests, type CompleteProfileInput, type CompletedPersonProfile, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, EVM_ADDRESS_RE, type Eip1193Provider, type Eip1193RequestProvider, Errors, FAILURE_MODES, type FailureMode, type FinancialOpsMethods, HANDLE_RE, type Handle, type HandledErrorReportContext, type Holding, type HoldingsMethods, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxItem, type InboxMethods, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementActivityEvidence, type NormalizedCapxulOperation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OnboardingMethods, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMe, type OrgMeMethod, type OrgMeOptions, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationOnboarding, type OrganizationOnboardingInput, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, PEG_RATES, type PartyId, type Payment, type PaymentActivityEvidence, type PaymentDirection, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type PayoutAddress, type PayrollEngagementTerms, type PayrollGroup, type PayrollGroupId, type PayrollGroupInput, type PayrollGroupMember, type PayrollGroupsMethods, type PayrollMethods, type PayrollOptions, type PayrollRun, type PayrollRunId, type PayrollRunItemInput, type PayrollRunStatus, type PayrollRuns, type PayrollTermsUnit, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PersonOnboarding, type PersonOnboardingInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Rate, type RateSource, type Readiness, type ReadyAccountLifecycle, type RecipientResolution, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RevertSummary, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, type TesterKind, type Valuation, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, positionPeg, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress, toHandle, toPartyId, valueIn };
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
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-M4dWz5g4.mjs";
2
- import { $ as toPartyId, I as toAddress, N as assetIdFor, P as currencySymbolFor, U as toCountryCode, W as toCurrencyCode, Y as toHandle, _t as FAILURE_MODES, b as configuredMoneyAssetById, dt as CAPXUL_ERROR_CODES, ft as CapxulError, g as CAPXUL_PAYMENTS_V2_ADDRESS, gt as CHAIN_UPSTREAMS, ht as isCapxulError, k as EVM_ADDRESS_RE, lt as HANDLE_RE, mt as Errors } from "./OAuthBearerAuthClient-DWkofxdZ.mjs";
3
- import { formatUnits } from "viem";
1
+ import { A as resolveFailureMode, B as valueIn, C as normalizeExceptionErrorKind, D as isSettingUpLifecycle, E as safeExceptionLabel, F as isCapxulOperation, G as isMoneyParseError, H as assetSymbolFor, I as normalizeCapxulOperation, J as isClaimed, K as parseMoney, M as PAYMENT_STATUSES, O as injectedWalletSigner, P as CAPXUL_OPERATIONS, R as positionPeg, S as SDK_VERSION, T as projectSdkException, U as formatAssetAmount, W as parseAssetAmount, Y as isRestoring, _ as fingerprintPaymentIntent, b as failureDetail, d as embeddedSigner, f as openfortEmbeddedSigner, g as devPrivateKeySigner, h as deriveDevPrivateKey, j as PAYMENT_DIRECTIONS, k as signerFailure, m as openfortEmbeddedWalletPort, p as openfortEmbeddedSignerFromWallet, q as destination, r as postHogObservability, t as createCapxulClient$1, w as normalizeExceptionOperation, x as EXCEPTION_MESSAGE, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as PEG_RATES } from "./production-q0kwUWcj.mjs";
2
+ import { A as EVM_ADDRESS_RE, F as currencySymbolFor, G as toCurrencyCode, L as toAddress, W as toCountryCode, X as toHandle, _t as CHAIN_UPSTREAMS, et as toPartyId, ft as CAPXUL_ERROR_CODES, g as CAPXUL_PAYMENTS_V2_ADDRESS, gt as isCapxulError, ht as Errors, pt as CapxulError, ut as HANDLE_RE, vt as FAILURE_MODES } from "./OAuthBearerAuthClient-BqQz-bnO.mjs";
4
3
  import { Effect } from "effect";
5
4
  import { privateKeyToAccount } from "viem/accounts";
6
5
  //#region src/domain/activity/phase.ts
@@ -86,153 +85,6 @@ function inboxPhase(status) {
86
85
  }
87
86
  }
88
87
  //#endregion
89
- //#region src/domain/money/parse-money.ts
90
- /**
91
- * ADR-0023 R1: the reason is a closed code and the ONLY failure vocabulary —
92
- * the consuming app maps each code to its own sentence. The SDK ships no
93
- * English for user-text failure.
94
- */
95
- function isMoneyParseError(value) {
96
- return "kind" in value;
97
- }
98
- const AMOUNT_PATTERN = /^(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?$/;
99
- const ZERO_PATTERN = /^0+(?:\.0+)?$/;
100
- function parseMoney(input, asset) {
101
- const parsed = parseDecimalInput(input, asset.decimals, 24);
102
- return "kind" in parsed ? parsed : {
103
- currency: asset.currency,
104
- value: parsed.value,
105
- decimals: asset.decimals
106
- };
107
- }
108
- /** Shared input grammar. Callers retain their own amount size limits. */
109
- function parseDecimalInput(input, decimals, maximumLength) {
110
- if (!Number.isInteger(decimals) || decimals < 0) throw Errors.invalidInput("asset.decimals", "must be a non-negative integer");
111
- const value = input.trim();
112
- if (value.length === 0) return {
113
- kind: "error",
114
- reason: "required"
115
- };
116
- if (value.length > maximumLength) return {
117
- kind: "error",
118
- reason: "too-long"
119
- };
120
- const negative = value.startsWith("-");
121
- const unsigned = negative ? value.slice(1) : value;
122
- if (!AMOUNT_PATTERN.test(unsigned)) return {
123
- kind: "error",
124
- reason: "invalid-format"
125
- };
126
- if (negative) return {
127
- kind: "error",
128
- reason: "non-positive"
129
- };
130
- const normalized = unsigned.replaceAll(",", "");
131
- const fraction = normalized.split(".")[1];
132
- if (fraction !== void 0 && fraction.length > decimals) return {
133
- kind: "error",
134
- reason: "too-many-decimals"
135
- };
136
- if (ZERO_PATTERN.test(normalized)) return {
137
- kind: "error",
138
- reason: "non-positive"
139
- };
140
- return { value: normalized };
141
- }
142
- //#endregion
143
- //#region src/domain/money/asset-amount.ts
144
- /** Exact scaling. This rejects excess precision instead of rounding it. */
145
- function toRaw(amount, asset) {
146
- validateMetadata(asset);
147
- if (amount.asset !== asset.assetId) throw Errors.invalidInput("amount.asset", "must match the selected asset on its chain");
148
- return decimalToRaw(amount.value, asset.decimals);
149
- }
150
- function parseAssetAmount(input, asset) {
151
- validateMetadata(asset);
152
- const parsed = parseDecimalInput(input, asset.decimals, 100);
153
- return "kind" in parsed ? parsed : {
154
- asset: asset.assetId,
155
- value: parsed.value.replace(/^0+(?=\d)/, "")
156
- };
157
- }
158
- /** Display the full quantity. Only fiat formatting rounds for display. */
159
- function formatAssetAmount(amount) {
160
- const asset = requireAsset(amount.asset);
161
- const [integer = "0", fraction] = formatUnits(toRaw(amount, asset), asset.decimals).split(".");
162
- return `${integer.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}${fraction === void 0 ? "" : `.${fraction}`} ${asset.symbol}`;
163
- }
164
- function assetSymbolFor(asset) {
165
- return requireAsset(asset).symbol;
166
- }
167
- function requireAsset(id) {
168
- const asset = configuredMoneyAssetById(id);
169
- if (asset === null) throw Errors.invalidInput("amount.asset", "is not a registered asset");
170
- return asset;
171
- }
172
- function decimalToRaw(value, decimals) {
173
- validatePrecision(decimals);
174
- if (!/^\d+(?:\.\d+)?$/.test(value) || value.trim() !== value || value.length > 512) throw Errors.invalidInput("amount.value", "must be a non-negative decimal string of at most 512 characters");
175
- const [integer = "0", fraction = ""] = value.split(".");
176
- if (fraction.length > decimals) throw Errors.invalidInput("amount.value", "fraction exceeds asset precision");
177
- return BigInt(integer) * 10n ** BigInt(decimals) + BigInt(fraction.padEnd(decimals, "0") || "0");
178
- }
179
- function validatePrecision(decimals) {
180
- if (!Number.isInteger(decimals) || decimals < 0 || decimals > 255) throw Errors.invalidInput("decimals", "must be an integer from 0 to 255");
181
- }
182
- function validateMetadata(asset) {
183
- validatePrecision(asset.decimals);
184
- if (asset.assetId !== assetIdFor(asset.chainId, asset.tokenAddress)) throw Errors.invalidInput("amount.asset", "metadata must match its chain and token");
185
- }
186
- //#endregion
187
- //#region src/domain/money/valuation.ts
188
- const PEG_RATES = (source, into) => (typeof source === "string" ? source : source.peg) === into ? {
189
- value: "1",
190
- decimals: 0
191
- } : null;
192
- /** Sum exact fixed-point values. Missing rates never contribute zero. */
193
- function valueIn(amounts, displayCurrency, rates = PEG_RATES) {
194
- const currency = toCurrencyCode(displayCurrency);
195
- const counted = [];
196
- const unrated = [];
197
- let sum = 0n;
198
- let scale = 0;
199
- for (const amount of amounts) {
200
- let source;
201
- let raw;
202
- let decimals;
203
- if ("asset" in amount) {
204
- source = requireAsset(amount.asset);
205
- raw = toRaw(amount, source);
206
- decimals = source.decimals;
207
- } else {
208
- source = toCurrencyCode(amount.currency);
209
- raw = decimalToRaw(amount.value, amount.decimals);
210
- decimals = amount.decimals;
211
- }
212
- const rate = rates(source, currency);
213
- if (rate === null) {
214
- unrated.push(amount);
215
- continue;
216
- }
217
- validatePrecision(rate.decimals);
218
- if (!/^\d+$/.test(rate.value) || rate.value.trim() !== rate.value || rate.value.length > 256 || BigInt(rate.value) <= 0n) throw Errors.invalidInput("rate.value", "must be a positive fixed-point integer");
219
- const termScale = decimals + rate.decimals;
220
- const nextScale = Math.max(scale, termScale);
221
- sum = sum * 10n ** BigInt(nextScale - scale) + raw * BigInt(rate.value) * 10n ** BigInt(nextScale - termScale);
222
- scale = nextScale;
223
- counted.push(amount);
224
- }
225
- return {
226
- total: counted.length === 0 ? null : {
227
- currency,
228
- value: formatUnits(sum, scale),
229
- decimals: scale
230
- },
231
- counted,
232
- unrated
233
- };
234
- }
235
- //#endregion
236
88
  //#region src/domain/money/format-money.ts
237
89
  function formatMoney(money, options = {}) {
238
90
  if (!Number.isInteger(money.decimals) || money.decimals < 0) throw Errors.invalidInput("money.decimals", "must be a non-negative integer");
@@ -496,4 +348,4 @@ function captureExceptionSync(telemetry, error, context) {
496
348
  } catch {}
497
349
  }
498
350
  //#endregion
499
- export { CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, CapxulError, EVM_ADDRESS_RE, Errors, FAILURE_MODES, HANDLE_RE, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, PEG_RATES, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress, toHandle, toPartyId, valueIn };
351
+ export { CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, CapxulError, EVM_ADDRESS_RE, Errors, FAILURE_MODES, HANDLE_RE, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, PEG_RATES, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, positionPeg, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress, toHandle, toPartyId, valueIn };
@@ -1,4 +1,4 @@
1
- import { C as AuthCachePort, I as AuthSession, S as AuthCacheError, T as CachedJwt, i as CapxulSigner, n as oauthBearerAuthClient, t as OAuthBearerAuthClientInput, w as AuthCachePortTag } from "../OAuthBearerAuthClient-C-ip-z8M.mjs";
1
+ import { C as AuthCachePort, L as AuthSession, S as AuthCacheError, T as CachedJwt, i as CapxulSigner, n as oauthBearerAuthClient, t as OAuthBearerAuthClientInput, w as AuthCachePortTag } from "../OAuthBearerAuthClient-BAxoi3SD.mjs";
2
2
  import { Hex } from "viem";
3
3
  import { Effect, FileSystem, Layer, Path } from "effect";
4
4
  //#region src/adapters/auth-cache/FileSystemAuthCacheAdapter.d.ts
@@ -1,4 +1,4 @@
1
- import { I as toAddress, a as parseAuthSession, c as AuthCachePortTag, i as BrowserAuthCacheAdapter, o as parseCachedJwt, r as InMemoryAuthCacheAdapter, s as AuthCacheError, t as oauthBearerAuthClient } from "../OAuthBearerAuthClient-DWkofxdZ.mjs";
1
+ import { L as toAddress, a as parseAuthSession, c as AuthCachePortTag, i as BrowserAuthCacheAdapter, o as parseCachedJwt, r as InMemoryAuthCacheAdapter, s as AuthCacheError, t as oauthBearerAuthClient } from "../OAuthBearerAuthClient-BqQz-bnO.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";