@capxul/sdk 1.2.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as AuthUserId, F as Money, G as toAddress, H as SubAccount, I as OrgId, J as CapxulErrorCode, K as toCountryCode, Q as isCapxulError, T as AuthSession, U as SubAccountId, Y as CapxulErrorDetails, Z as FailureMode, a as AccountProvider, b as AccountId, c as Eip1193Provider, d as CapxulResult, f as Profile, i as injectedWalletSigner, k as CountryCode, l as eip1193AccountProvider, m as SmartAccount, n as CapxulSigner, o as AccountProviderSource, p as Session, q as CapxulError, r as Eip1193RequestProvider, s as AccountRequirement, t as CapxulDigestSigner, u as localPrivateKeyAccountProvider, x as Address, y as Account, z as RoleKey } from "./signer-DgWAmtmi.mjs";
2
- import { $ as InsightsSummary, $t as OrgSetupStep, A as PayrollRosterLine, At as PaymentMoney, B as ActorProfileMethods, Bt as RecipientResolutionKind, C as OrgTemplate, Ct as PayeesMethods, D as PayrollMethods, Dt as PaymentDocumentRender, E as OrganizationAuditLogItem, Et as PaymentDocumentRef, F as RoleSpendCap, Ft as PaymentsMethods, G as AddressBookAddInput, Gt as TargetsMethods, H as ActorRequest, Ht as Ref, I as RoleView, It as PaymentsPayInput, J as AddressBookMethods, Jt as isSettingUpLifecycle, K as AddressBookEntry, Kt as AccountLifecycle, L as AccountsMethods, Lt as PaymentsPayoutInput, M as RemoveMemberInput, Mt as PaymentStatus, N as ResendInviteTokenInput, Nt as PaymentTiming, O as PayrollPayslipTemplate, Ot as PaymentDocumentVerification, P as RoleDefinition, Pt as PaymentType, Q as InsightsMethods, Qt as OrgLifecycle, R as AccountMethods, Rt as PaymentsWithdrawInput, S as OrgSpendViaPaymentsInput, St as Payee, T as OrganizationAccount, Tt as PaymentDocumentKind, U as ActorRequestIssueInput, Ut as ResolvedTarget, V as ActorRelationshipMethods, Vt as ReconciliationEntry, W as ActorRequestsMethods, Wt as TargetReference, X as InboxItem, Xt as SmartAccountMethods, Y as InboxApproveInput, Yt as IdentityMethods, Z as InboxMethods, Zt as AuthMethods, _ as MemberView, _n as InvocationControls, _t as MeProfile, a as IdentityRuntimeSendResult, at as DepositInstructions, b as OrgPayrollRun, bt as OfframpQuoteInput, c as SystemHealth, cn as TelemetryPort, ct as DestinationKind, d as CurrentUserMethods, dn as IdentityState, dt as DestinationRail, en as TransferEndpoint, et as ActivityItem, f as AssignRoleInput, fn as OrgLane, ft as DestinationRemoveInput, g as MemberStatus, gn as IdentityTransition, gt as MeMethods, h as InviteMemberInput, hn as destination, ht as HandlesMethods, i as IdentityRuntime, in as CapxulEnv, it as ActorReference, j as PayrollRunInput, jt as PaymentSettlementInput, k as PayrollRosterAddInput, kt as PaymentDocumentsMethods, l as MediaMethods, ln as Destination$1, lt as DestinationListInput, m as DetectPendingOrgInvitationsResult, mn as StateLabel, mt as FinancialOpsMethods, n as CreateCapxulClientInput, nn as TransferResult, nt as ActivityMethods, o as SubAccountsMethods, ot as Destination, p as CreateOrgInput, pn as Readiness, pt as DestinationsMethods, q as AddressBookLabelInput, qt as AccountSetupStep, r as IdentityProfileDetails, rn as WireObservationContext, rt as ActivityPage, s as SystemMethods, st as DestinationAddInput, t as CapxulClient, tn as TransferInput, tt as ActivityListParams, u as CurrentUserContext, un as IdentityEvent, ut as DestinationPayload, v as OrgBatchPayrollInput, vt as OfframpMethods, w as OrgView, wt as Payment, x as OrgScopedMethods, xt as OfframpStatus, y as OrgMethods, yt as OfframpQuote, z as ActorProfile, zt as RecipientResolution } from "./create-capxul-client-BxTtXho7.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-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";
3
3
  import { Hex } from "viem";
4
4
  import { Context, Effect, Layer } from "effect";
5
5
  import { FunctionReference } from "convex/server";
@@ -207,5 +207,4 @@ declare function captureException(telemetry: TelemetryPort, error: unknown, cont
207
207
  */
208
208
  declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
209
209
  //#endregion
210
- export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityItem, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActorProfile, type ActorProfileMethods, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AssignRoleInput, type AuthMethods, type AuthSession, type AuthUserId, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulResult, type CapxulSigner, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, 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, type Eip1193Provider, type Eip1193RequestProvider, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, 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 InsightsMethods, type InsightsSummary, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgBatchPayrollInput, type OrgId, type OrgLane, type OrgLifecycle, type OrgMethods, type OrgPayrollRun, type OrgScopedMethods, type OrgSetupStep, type OrgSpendViaPaymentsInput, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type Payee, type PayeesMethods, type Payment, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentSettlementInput, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type PaymentsPayoutInput, type PaymentsWithdrawInput, type PayrollMethods, type PayrollPayslipTemplate, type PayrollRosterAddInput, type PayrollRosterLine, type PayrollRunInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Readiness, type RecipientResolution, type RecipientResolutionKind, type ReconciliationEntry, type Ref, type RemoveMemberInput, type ResendInviteTokenInput, type ResolvedTarget, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubAccount, type SubAccountId, type SubAccountsMethods, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, type TransferEndpoint, type TransferInput, type TransferResult, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, injectedWalletSigner, isCapxulError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
211
- //# sourceMappingURL=index.d.mts.map
210
+ export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityAnnotationInput, type ActivityDetail, type ActivityItem, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityReference, type ActorProfile, type ActorProfileMethods, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AuthMethods, type AuthSession, type AuthUserId, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulResult, type CapxulSigner, 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, type Eip1193Provider, type Eip1193RequestProvider, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, 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 MovementAnnotation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, type Payee, type PayeesMethods, type Payment, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Readiness, type RecipientResolution, type RecipientResolutionKind, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, injectedWalletSigner, isCapxulError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as version, B as readInvocationObservation, C as convexCallErrorFromCapxul, D as bootstrapErrorFromCapxul, E as BootstrapPortTag, F as BootstrapEnvelope, H as captureExceptionSync, I as EngineeringTelemetryBootstrapPolicy, K as destination, L as isSettingUpLifecycle, M as encodeObservationContextHeader, N as sanitizeObservationContext, O as authClientPortFromPromiseAdapter, P as CAPXUL_FUNCTIONS, R as formatTraceparent, S as ConvexCallPortTag, T as ClockPortTag, U as normalizeBindingEmail, V as captureException, W as BASE_SEPOLIA_CHAIN_ID, _ as accountReadErrorFromCapxul, a as observeFailedResult, b as IdentityPortTag, c as PostHogTelemetryLayer, d as SmartAccountPortTag, f as smartAccountErrorFromCapxul, g as AccountReadPortTag, h as fromWei, i as observationContextProps, j as OBSERVATION_CONTEXT_HEADER, k as AuthClientPortTag, l as TelemetryPortTag, m as subAccountErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as SubAccountPortTag, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as detectAuthCacheAdapter, t as assembleCapxulClient, v as toWei, w as ClockError, x as identityErrorFromCapxul, y as wireChainId, z as copyInvocationObservation } from "./create-capxul-client-BTnlLLag.mjs";
2
- import { A as decodeConvexError, C as toJwtToken, D as toRoleKey, E as toPublishableKey, N as Errors, O as toSessionToken, P as isCapxulError, S as toEpochSeconds, T as toOrgId, _ as toCountryCode, b as toEmail, d as toAccountId, f as toAddress, g as toChainId, h as toAuthUserId, j as CapxulError, k as toSubAccountId, o as AuthCachePortTag, p as toAllowedOrigin, v as toCurrencyCode, w as toKycTier, x as toEpochMs, y as toDurationMs } from "./InMemoryAuthCacheAdapter-Dr1sEd9y.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-oqLlUkzI.mjs";
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";
5
5
  import { getFunctionName, makeFunctionReference } from "convex/server";
@@ -1264,7 +1264,6 @@ function SystemClockLayer() {
1264
1264
  //#region src/adapters/convex-call/ConvexCallAdapter.ts
1265
1265
  /** Exact floor-first allowlist; every additional handler must migrate its validator first. */
1266
1266
  const OBSERVED_CONVEX_ACTIONS = new Set([
1267
- "subAccount/actions:transfer",
1268
1267
  "smartAccount/actions:claim",
1269
1268
  "org/actions:prepareFounderAccount",
1270
1269
  "org/actions:prepareBootstrap",
@@ -1465,7 +1464,7 @@ function identityErrorFromUnknown(operation, cause) {
1465
1464
  }
1466
1465
  //#endregion
1467
1466
  //#region src/adapters/account-read/ConvexAccountAdapter.ts
1468
- const DEFAULT_FUNCTIONS$4 = {
1467
+ const DEFAULT_FUNCTIONS$3 = {
1469
1468
  readBalance: makeFunctionReference(CAPXUL_FUNCTIONS["account/actions"].readBalance),
1470
1469
  faucetMint: makeFunctionReference(CAPXUL_FUNCTIONS["account/actions"].faucetMint)
1471
1470
  };
@@ -1474,7 +1473,7 @@ var ConvexAccountAdapter = class {
1474
1473
  #fns;
1475
1474
  constructor(deps) {
1476
1475
  this.#convex = deps.convex;
1477
- this.#fns = deps.functions ?? DEFAULT_FUNCTIONS$4;
1476
+ this.#fns = deps.functions ?? DEFAULT_FUNCTIONS$3;
1478
1477
  }
1479
1478
  readBalance(input) {
1480
1479
  return this.#convex.action(this.#fns.readBalance, { chainId: wireChainId(input.chainId) }).pipe(Effect.mapError((error) => accountReadErrorFromCapxul("readBalance", error.publicError, error)), Effect.flatMap((wire) => brandAccountEffect("readBalance", wire)), Effect.catchDefect((cause) => Effect.fail(accountReadErrorFromUnknown("readBalance", cause))));
@@ -1513,92 +1512,6 @@ function accountReadErrorFromUnknown(operation, cause) {
1513
1512
  return accountReadErrorFromCapxul(operation, Errors.providerError("convex", operation, cause), cause);
1514
1513
  }
1515
1514
  //#endregion
1516
- //#region src/adapters/sub-account/ConvexSubAccountAdapter.ts
1517
- const DEFAULT_FUNCTIONS$3 = {
1518
- create: makeFunctionReference(CAPXUL_FUNCTIONS["subAccount/mutations"].create),
1519
- get: makeFunctionReference(CAPXUL_FUNCTIONS["subAccount/queries"].get),
1520
- list: makeFunctionReference(CAPXUL_FUNCTIONS["subAccount/queries"].list),
1521
- rename: makeFunctionReference(CAPXUL_FUNCTIONS["subAccount/mutations"].rename),
1522
- remove: makeFunctionReference(CAPXUL_FUNCTIONS["subAccount/mutations"].remove),
1523
- transfer: makeFunctionReference(CAPXUL_FUNCTIONS["subAccount/actions"].transfer)
1524
- };
1525
- var ConvexSubAccountAdapter = class {
1526
- #convex;
1527
- #fns;
1528
- #chainId;
1529
- constructor(deps) {
1530
- this.#convex = deps.convex;
1531
- this.#chainId = deps.chainId;
1532
- this.#fns = deps.functions ?? DEFAULT_FUNCTIONS$3;
1533
- }
1534
- create(input) {
1535
- return this.#runMutation("create", this.#fns.create, {
1536
- accountId: input.accountId,
1537
- name: input.name
1538
- });
1539
- }
1540
- get(input) {
1541
- return this.#runQuery("get", this.#fns.get, { subAccountId: input.subAccountId }, (wire) => wire === null ? null : brandSubAccount(wire));
1542
- }
1543
- list(input) {
1544
- return this.#runQuery("list", this.#fns.list, { accountId: input.accountId }, (wires) => wires.map((wire) => brandSubAccount(wire)));
1545
- }
1546
- rename(input) {
1547
- return this.#runMutation("rename", this.#fns.rename, {
1548
- subAccountId: input.subAccountId,
1549
- name: input.name
1550
- });
1551
- }
1552
- delete(input) {
1553
- const operation = "delete";
1554
- return this.#convex.mutation(this.#fns.remove, { subAccountId: input.subAccountId }).pipe(Effect.mapError((error) => subAccountErrorFromCapxul(operation, error.publicError, error)), Effect.asVoid, Effect.catchDefect((cause) => Effect.fail(subAccountErrorFromUnknown(operation, cause))));
1555
- }
1556
- transfer(input) {
1557
- const operation = "transfer";
1558
- return Effect.suspend(() => {
1559
- const rawAmount = toWei(input.amount);
1560
- return this.#convex.action(this.#fns.transfer, copyInvocationObservation(input, {
1561
- chainId: this.#chainId,
1562
- from: input.from,
1563
- to: input.to,
1564
- rawAmount
1565
- }));
1566
- }).pipe(Effect.mapError((error) => subAccountErrorFromCapxul(operation, error.publicError, error)), Effect.map((wire) => brandTransferResult(wire)), Effect.catchDefect((cause) => Effect.fail(subAccountErrorFromUnknown(operation, cause))));
1567
- }
1568
- #runMutation(operation, ref, args) {
1569
- return this.#convex.mutation(ref, args).pipe(Effect.mapError((error) => subAccountErrorFromCapxul(operation, error.publicError, error)), Effect.map((wire) => brandSubAccount(wire)), Effect.catchDefect((cause) => Effect.fail(subAccountErrorFromUnknown(operation, cause))));
1570
- }
1571
- #runQuery(operation, ref, args, map) {
1572
- return this.#convex.query(ref, args).pipe(Effect.mapError((error) => subAccountErrorFromCapxul(operation, error.publicError, error)), Effect.map(map), Effect.catchDefect((cause) => Effect.fail(subAccountErrorFromUnknown(operation, cause))));
1573
- }
1574
- };
1575
- function ConvexSubAccountLayer(chainId) {
1576
- return Layer.effect(SubAccountPortTag, Effect.map(ConvexCallPortTag, (convex) => new ConvexSubAccountAdapter({
1577
- convex,
1578
- chainId
1579
- })));
1580
- }
1581
- function brandTransferResult(wire) {
1582
- return {
1583
- available: fromWei(wire.availableRaw, wire.decimals, wire.currency),
1584
- from: wire.from === null ? null : brandSubAccount(wire.from),
1585
- to: wire.to === null ? null : brandSubAccount(wire.to)
1586
- };
1587
- }
1588
- function brandSubAccount(wire) {
1589
- return {
1590
- id: toSubAccountId(wire.subAccountId),
1591
- accountId: toAccountId(wire.accountId),
1592
- name: wire.name,
1593
- balance: fromWei(wire.rawBalance, wire.decimals, wire.currency),
1594
- createdAt: toEpochMs(wire.createdAt)
1595
- };
1596
- }
1597
- function subAccountErrorFromUnknown(operation, cause) {
1598
- if (cause instanceof CapxulError) return subAccountErrorFromCapxul(operation, cause);
1599
- return subAccountErrorFromCapxul(operation, Errors.providerError("convex", operation, cause), cause);
1600
- }
1601
- //#endregion
1602
1515
  //#region src/adapters/smart-account/ConvexSmartAccountAdapter.ts
1603
1516
  const DEFAULT_FUNCTIONS$2 = {
1604
1517
  loadByAuthUserId: makeFunctionReference(CAPXUL_FUNCTIONS["smartAccount/queries"].loadByAuthUserId),
@@ -1695,8 +1608,6 @@ function orgErrorFromCapxul(operation, error, cause = error) {
1695
1608
  });
1696
1609
  }
1697
1610
  var OrgPortTag = class extends Context.Service()("@capxul/sdk/ports/OrgPort") {};
1698
- Context.Service()("@capxul/sdk/ports/OrgRolesDeploymentPort");
1699
- Context.Service()("@capxul/sdk/ports/OrgSpendPort");
1700
1611
  //#endregion
1701
1612
  //#region src/adapters/org/parse.ts
1702
1613
  /**
@@ -1768,7 +1679,6 @@ function parseRoleDefinition(json) {
1768
1679
  ...raw.spend.perDay === void 0 ? {} : { perDay: parseRoleMoney(raw.spend.perDay, "perDay") },
1769
1680
  ...raw.spend.toRecipients === void 0 ? {} : { toRecipients: parseRoleRecipients(raw.spend.toRecipients) }
1770
1681
  } },
1771
- ...raw.subAccounts === void 0 ? {} : { subAccounts: parseRoleSubAccounts(raw.subAccounts) },
1772
1682
  ...typeof raw.canManageMembers === "boolean" ? { canManageMembers: raw.canManageMembers } : {},
1773
1683
  ...typeof raw.canManageRoles === "boolean" ? { canManageRoles: raw.canManageRoles } : {}
1774
1684
  };
@@ -1789,14 +1699,6 @@ function parseRoleRecipients(raw) {
1789
1699
  return toAddress(recipient);
1790
1700
  });
1791
1701
  }
1792
- function parseRoleSubAccounts(raw) {
1793
- if (raw.scope === "all") return { scope: "all" };
1794
- if (!Array.isArray(raw.scope)) throw new Error("Invalid role definition: subAccounts.scope must be \"all\" or an array");
1795
- return { scope: raw.scope.map((subAccountId) => {
1796
- if (typeof subAccountId !== "string") throw new Error("Invalid role definition: subAccounts.scope must be \"all\" or an array");
1797
- return toSubAccountId(subAccountId);
1798
- }) };
1799
- }
1800
1702
  /** Strip the `org_` prefix + non-alphanumerics so the body re-seeds `account_`. */
1801
1703
  function orgIdBody(orgId) {
1802
1704
  const underscore = orgId.indexOf("_");
@@ -2505,7 +2407,6 @@ const collectProductionFlowPorts = Effect.gen(function* () {
2505
2407
  identity: yield* IdentityPortTag,
2506
2408
  smartAccount: yield* SmartAccountPortTag,
2507
2409
  accountRead: yield* AccountReadPortTag,
2508
- subAccount: yield* SubAccountPortTag,
2509
2410
  bootstrap,
2510
2411
  clock,
2511
2412
  telemetry: yield* TelemetryPortTag,
@@ -2542,10 +2443,6 @@ function makeProductionAdapterLayerEntries(input) {
2542
2443
  name: "accountRead",
2543
2444
  layer: ConvexAccountLayer()
2544
2445
  },
2545
- {
2546
- name: "subAccount",
2547
- layer: ConvexSubAccountLayer(input.chainId)
2548
- },
2549
2446
  {
2550
2447
  name: "clock",
2551
2448
  layer: SystemClockLayer()
@@ -2578,7 +2475,7 @@ function mergeProductionAdapterLayers(entries) {
2578
2475
  }).reduce((current, layer) => Layer.merge(current, layer), Layer.empty);
2579
2476
  }
2580
2477
  function isConvexDependentLayer(name) {
2581
- return name === "identity" || name === "smartAccount" || name === "accountRead" || name === "subAccount" || name === "org";
2478
+ return name === "identity" || name === "smartAccount" || name === "accountRead" || name === "org";
2582
2479
  }
2583
2480
  function productionBootstrapPortLayer(bootstrap) {
2584
2481
  return Layer.succeed(BootstrapPortTag, bootstrap);
@@ -3016,6 +2913,4 @@ async function createCapxulClient(input) {
3016
2913
  return createCapxulClient$1(input);
3017
2914
  }
3018
2915
  //#endregion
3019
- export { CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CapxulError, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, injectedWalletSigner, isCapxulError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
3020
-
3021
- //# sourceMappingURL=index.mjs.map
2916
+ export { CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CapxulError, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, injectedWalletSigner, isCapxulError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
@@ -1,4 +1,4 @@
1
- import { T as AuthSession, _ as AuthCachePortTag, g as AuthCachePort, h as AuthCacheError, n as CapxulSigner, v as CachedJwt } from "../signer-DgWAmtmi.mjs";
1
+ import { E as AuthSession, _ as AuthCachePortTag, g as AuthCachePort, h as AuthCacheError, n as CapxulSigner, v as CachedJwt } from "../signer-ZijoFiUs.mjs";
2
2
  import { Hex } from "viem";
3
3
  import { Effect, FileSystem, Layer, Path } from "effect";
4
4
 
@@ -48,5 +48,4 @@ declare function localPrivateKeySigner(input: {
48
48
  */
49
49
  declare function detectNodeAuthCacheAdapter(options?: DetectNodeAuthCacheAdapterOptions): AuthCachePort;
50
50
  //#endregion
51
- export { DetectNodeAuthCacheAdapterOptions, FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner };
52
- //# sourceMappingURL=index.d.mts.map
51
+ export { DetectNodeAuthCacheAdapterOptions, FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner };
@@ -1,4 +1,4 @@
1
- import { a as AuthCacheError, f as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-Dr1sEd9y.mjs";
1
+ import { a as AuthCacheError, i as parseCachedJwt, m as toAddress, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-Rc8tCtml.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";
@@ -154,5 +154,3 @@ function resolveDefaultAuthCachePath(resolveHomeDirectory) {
154
154
  }
155
155
  //#endregion
156
156
  export { FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner };
157
-
158
- //# sourceMappingURL=index.mjs.map
@@ -2,7 +2,7 @@ import { Account, Hex } from "viem";
2
2
  import { Context, Effect } from "effect";
3
3
 
4
4
  //#region ../errors/src/errors.d.ts
5
- declare const CAPXUL_ERROR_CODES: readonly ["NOT_AUTHENTICATED", "EMAIL_DELIVERY_FAILED", "PROFILE_NOT_FOUND", "SMART_ACCOUNT_MISSING", "PLAYER_NOT_FOUND", "ACCOUNT_NOT_FOUND", "PROVIDER_ERROR", "INVALID_INPUT", "ENV_MISSING", "NOT_IMPLEMENTED", "VERIFICATION_REQUIRED", "INSUFFICIENT_BALANCE", "INVALID_RECIPIENT", "ROLE_PERMISSION_DENIED", "TRANSACTION_FAILED", "RATE_LIMITED", "NETWORK_ERROR", "UNKNOWN", "OTP_EXPIRED", "SIGNER_REJECTED", "CANCELLED", "WRONG_STATE", "STALE_EPOCH", "SUPERSEDED", "WORK_DIED", "ACTOR_STOPPED"];
5
+ declare const CAPXUL_ERROR_CODES: readonly ["NOT_AUTHENTICATED", "EMAIL_DELIVERY_FAILED", "PROFILE_NOT_FOUND", "SMART_ACCOUNT_MISSING", "PLAYER_NOT_FOUND", "ACCOUNT_NOT_FOUND", "PROVIDER_ERROR", "CAPABILITY_UNAVAILABLE", "INVALID_INPUT", "ENV_MISSING", "NOT_IMPLEMENTED", "VERIFICATION_REQUIRED", "INSUFFICIENT_BALANCE", "INVALID_RECIPIENT", "ROLE_PERMISSION_DENIED", "TRANSACTION_FAILED", "RATE_LIMITED", "NETWORK_ERROR", "UNKNOWN", "OTP_EXPIRED", "SIGNER_REJECTED", "CANCELLED", "WRONG_STATE", "STALE_EPOCH", "SUPERSEDED", "WORK_DIED", "ACTOR_STOPPED"];
6
6
  type CapxulErrorCode = (typeof CAPXUL_ERROR_CODES)[number];
7
7
  /**
8
8
  * Why an auth/provider call failed — a flat CAUSE enum. The *where* (which
@@ -61,7 +61,7 @@ type Brand<T, B extends string> = T & {
61
61
  };
62
62
  //#endregion
63
63
  //#region ../types/src/index.d.ts
64
- type Address = Brand<string, "Address">;
64
+ type Address$1 = Brand<string, "Address">;
65
65
  type Email = Brand<string, "Email">;
66
66
  type Profile$1 = {
67
67
  readonly authUserId: AuthUserId;
@@ -69,7 +69,7 @@ type Profile$1 = {
69
69
  readonly displayName: string | null;
70
70
  readonly country: CountryCode | null;
71
71
  readonly onboarded: boolean;
72
- readonly withdrawalAddress: Address | null;
72
+ readonly withdrawalAddress: Address$1 | null;
73
73
  readonly username: string | null;
74
74
  readonly imageUrl: string | null;
75
75
  readonly kycTier: KycTier;
@@ -78,8 +78,8 @@ type Profile$1 = {
78
78
  };
79
79
  type SmartAccount$1 = {
80
80
  readonly authUserId: AuthUserId;
81
- readonly signerAddress: Address | null;
82
- readonly smartAccountAddress: Address;
81
+ readonly signerAddress: Address$1 | null;
82
+ readonly smartAccountAddress: Address$1;
83
83
  readonly chainId: ChainId;
84
84
  readonly deployedAt: EpochMs | null;
85
85
  readonly claimedAt: EpochMs | null;
@@ -95,18 +95,13 @@ type Account$1 = {
95
95
  readonly balance: Money;
96
96
  readonly available: Money;
97
97
  };
98
- /** Named bucket partitioning a logical Account (canon §9). */
99
- type SubAccount = {
100
- readonly id: SubAccountId;
101
- readonly accountId: AccountId;
102
- readonly name: string;
103
- readonly balance: Money;
104
- readonly createdAt: EpochMs;
105
- };
106
98
  type AuthUserId = Brand<string, "AuthUserId">;
107
99
  type AnonymousDistinctId = Brand<string, "AnonymousDistinctId">;
108
100
  type AccountId = Brand<string, "AccountId">;
109
- type SubAccountId = Brand<string, "SubAccountId">;
101
+ type MovementId = Brand<string, "MovementId">;
102
+ type PermissionId = Brand<string, "PermissionId">;
103
+ type PermissionAssignmentId = Brand<string, "PermissionAssignmentId">;
104
+ type PaymentCommandId = Brand<string, "PaymentCommandId">;
110
105
  type OrgId = Brand<string, "OrgId">;
111
106
  type AppId = Brand<string, "AppId">;
112
107
  type AllowedOrigin = Brand<string, "AllowedOrigin">;
@@ -121,7 +116,9 @@ type CountryCode = Brand<string, "CountryCode">;
121
116
  type CurrencyCode = Brand<SupportedCurrencyCode, "CurrencyCode">;
122
117
  type KycTier = Brand<0 | 1 | 2 | 3, "KycTier">;
123
118
  type BlockNumber = Brand<number, "BlockNumber">;
119
+ type WeiAmount = Brand<string, "WeiAmount">;
124
120
  type RoleKey = Brand<string, "RoleKey">;
121
+ type AllowanceKey = Brand<string, "AllowanceKey">;
125
122
  type SessionToken = Brand<string, "SessionToken">;
126
123
  type JwtToken = Brand<string, "JwtToken">;
127
124
  type AuthSession = {
@@ -152,7 +149,7 @@ declare const SUPPORTED_CURRENCIES: readonly [{
152
149
  readonly name: "Ugandan Shilling";
153
150
  }];
154
151
  type SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number]["code"];
155
- declare function toAddress(raw: unknown): Address;
152
+ declare function toAddress(raw: unknown): Address$1;
156
153
  declare function toCountryCode(raw: unknown): CountryCode;
157
154
  //#endregion
158
155
  //#region src/ports/auth-cache.d.ts
@@ -246,7 +243,7 @@ interface AccountProvider {
246
243
  *
247
244
  * Custom providers MUST honor this contract.
248
245
  */
249
- getAddress(): Promise<CapxulResult<Address>>;
246
+ getAddress(): Promise<CapxulResult<Address$1>>;
250
247
  getDeployAccount(): Promise<CapxulResult<Account>>;
251
248
  }
252
249
  interface Eip1193Provider {
@@ -278,7 +275,7 @@ interface CapxulSigner extends CapxulDigestSigner {
278
275
  */
279
276
  readonly source: AccountProviderSource;
280
277
  /** Owner EOA address — the Safe's single owner. */
281
- getAddress(): Promise<Address>;
278
+ getAddress(): Promise<Address$1>;
282
279
  }
283
280
  /** Minimal EIP-1193 surface an injected browser wallet exposes. */
284
281
  interface Eip1193RequestProvider {
@@ -296,5 +293,4 @@ interface Eip1193RequestProvider {
296
293
  */
297
294
  declare function injectedWalletSigner(provider: Eip1193RequestProvider): CapxulSigner;
298
295
  //#endregion
299
- export { CurrencyCode as A, SessionToken as B, AnonymousDistinctId as C, BlockNumber as D, AuthUserId as E, Money as F, toAddress as G, SubAccount as H, OrgId as I, CapxulErrorCode as J, toCountryCode as K, Profile$1 as L, DurationMs as M, Email as N, ChainId as O, EpochMs as P, isCapxulError as Q, PublishableKey as R, AllowedOrigin as S, AuthSession as T, SubAccountId as U, SmartAccount$1 as V, TxHash as W, Failure as X, CapxulErrorDetails as Y, FailureMode as Z, AuthCachePortTag as _, AccountProvider as a, AccountId as b, Eip1193Provider as c, CapxulResult as d, Profile as f, AuthCachePort as g, AuthCacheError as h, injectedWalletSigner as i, DocumentHash as j, CountryCode as k, eip1193AccountProvider as l, SmartAccount as m, CapxulSigner as n, AccountProviderSource as o, Session as p, CapxulError as q, Eip1193RequestProvider as r, AccountRequirement as s, CapxulDigestSigner as t, localPrivateKeyAccountProvider as u, CachedJwt as v, AppId as w, Address as x, Account$1 as y, RoleKey as z };
300
- //# sourceMappingURL=signer-DgWAmtmi.d.mts.map
296
+ export { CapxulErrorDetails as $, CountryCode as A, PermissionAssignmentId as B, AllowedOrigin as C, AuthUserId as D, AuthSession as E, EpochMs as F, SessionToken as G, Profile$1 as H, Money as I, WeiAmount as J, SmartAccount$1 as K, MovementId as L, DocumentHash as M, DurationMs as N, BlockNumber as O, Email as P, CapxulErrorCode as Q, OrgId as R, AllowanceKey as S, AppId as T, PublishableKey as U, PermissionId as V, RoleKey as W, toCountryCode as X, toAddress as Y, CapxulError as Z, AuthCachePortTag as _, AccountProvider as a, AccountId as b, Eip1193Provider as c, CapxulResult as d, Failure as et, Profile as f, AuthCachePort as g, AuthCacheError as h, injectedWalletSigner as i, CurrencyCode as j, ChainId as k, eip1193AccountProvider as l, SmartAccount as m, CapxulSigner as n, isCapxulError as nt, AccountProviderSource as o, Session as p, TxHash as q, Eip1193RequestProvider as r, AccountRequirement as s, CapxulDigestSigner as t, FailureMode as tt, localPrivateKeyAccountProvider as u, CachedJwt as v, AnonymousDistinctId as w, Address$1 as x, Account$1 as y, PaymentCommandId as z };
@@ -1,4 +1,4 @@
1
- import { an as TelemetryEvent, gn as IdentityTransition, on as TelemetryGroupInput, sn as TelemetryIdentifyInput, t as CapxulClient } from "../create-capxul-client-BxTtXho7.mjs";
1
+ import { _n as IdentityTransition, an as TelemetryEvent, on as TelemetryGroupInput, sn as TelemetryIdentifyInput, t as CapxulClient } from "../create-capxul-client-BklYjuYQ.mjs";
2
2
  import { Effect, Layer } from "effect";
3
3
 
4
4
  //#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
@@ -50,5 +50,4 @@ interface CapxulTestObservation {
50
50
  */
51
51
  declare function createCapxulTestClient(options?: CreateCapxulTestClientOptions): CapxulTestClient;
52
52
  //#endregion
53
- export { CapxulTestClient, CapxulTestClock, CapxulTestObservation, CreateCapxulTestClientOptions, SeedTestIdentityInput, createCapxulTestClient };
54
- //# sourceMappingURL=index.d.mts.map
53
+ export { CapxulTestClient, CapxulTestClock, CapxulTestObservation, CreateCapxulTestClientOptions, SeedTestIdentityInput, createCapxulTestClient };
@@ -1,5 +1,5 @@
1
- import { C as convexCallErrorFromCapxul, D as bootstrapErrorFromCapxul, G as deriveCapxulSafeAddress, O as authClientPortFromPromiseAdapter, _ as accountReadErrorFromCapxul, f as smartAccountErrorFromCapxul, h as fromWei, m as subAccountErrorFromCapxul, t as assembleCapxulClient, u as redactTelemetryEvent, v as toWei, x as identityErrorFromCapxul, y as wireChainId } from "../create-capxul-client-BTnlLLag.mjs";
2
- import { C as toJwtToken, E as toPublishableKey, N as Errors, O as toSessionToken, S as toEpochSeconds, _ as toCountryCode, b as toEmail, d as toAccountId, f as toAddress, g as toChainId, h as toAuthUserId, j as CapxulError, k as toSubAccountId, m as toAppId, p as toAllowedOrigin, t as InMemoryAuthCacheAdapter, v as toCurrencyCode, w as toKycTier, x as toEpochMs, y as toDurationMs } from "../InMemoryAuthCacheAdapter-Dr1sEd9y.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-oqLlUkzI.mjs";
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";
5
5
  import { getFunctionName } from "convex/server";
@@ -618,7 +618,7 @@ function isSupportedSmartAccountChain(chainId) {
618
618
  //#region src/testing/smart-account/InMemorySmartAccountAdapter.ts
619
619
  /**
620
620
  * Hermetic backend stand-in (PRD #462 / derivation v2): `provision` derives
621
- * the Safe from the identity email alone via the REAL canonical derivation
621
+ * the Safe from the authenticated email via the REAL canonical derivation
622
622
  * (`deriveCapxulSafeAddress({ email })` — owner is the pinned bootstrap
623
623
  * constant). No signer exists at provision; `claim` installs the signer and
624
624
  * marks the row deployed, mirroring the backend's one-userOp claim lane.
@@ -626,12 +626,10 @@ function isSupportedSmartAccountChain(chainId) {
626
626
  var InMemorySmartAccountAdapter = class {
627
627
  #accounts = /* @__PURE__ */ new Map();
628
628
  #clock;
629
- #identity;
630
629
  #failures;
631
630
  #provisionMutex = Semaphore.makeUnsafe(1);
632
631
  constructor(deps) {
633
632
  this.#clock = deps.clock;
634
- this.#identity = deps.identity;
635
633
  this.#failures = deps.failures;
636
634
  }
637
635
  loadByAuthUserId(authUserId) {
@@ -654,15 +652,13 @@ var InMemorySmartAccountAdapter = class {
654
652
  const self = this;
655
653
  return Effect.gen(function* () {
656
654
  if (!isSupportedSmartAccountChain(input.chainId)) return yield* fail("provision", Errors.invalidInput("chainId", `unsupported chainId ${String(input.chainId)}`));
657
- const identity = yield* self.#identity.loadByAuthUserId(input.authUserId).pipe(Effect.mapError((error) => smartAccountErrorFromCapxul("provision.identity", error.publicError, error)));
658
- if (identity === null) return yield* fail("provision", Errors.profileNotFound(String(input.authUserId)));
659
655
  const existing = self.#accounts.get(input.authUserId);
660
656
  if (existing !== void 0) return cloneSmartAccount(existing);
661
657
  const now = yield* self.#now("provision.clock");
662
658
  const account = {
663
659
  authUserId: input.authUserId,
664
660
  signerAddress: null,
665
- smartAccountAddress: toAddress(deriveCapxulSafeAddress({ email: identity.email })),
661
+ smartAccountAddress: toAddress(deriveCapxulSafeAddress({ email: input.email })),
666
662
  chainId: input.chainId,
667
663
  deployedAt: null,
668
664
  claimedAt: null,
@@ -743,134 +739,6 @@ function cloneSmartAccountOrNull(account) {
743
739
  return account === null ? null : cloneSmartAccount(account);
744
740
  }
745
741
  //#endregion
746
- //#region src/testing/sub-account/InMemorySubAccountAdapter.ts
747
- var InMemorySubAccountAdapter = class {
748
- #rows = /* @__PURE__ */ new Map();
749
- #failures;
750
- #balanceOfRaw;
751
- #created;
752
- constructor(deps = {}) {
753
- this.#failures = deps.failures ?? {};
754
- this.#balanceOfRaw = deps.balanceOfRaw ?? "0";
755
- for (const row of deps.seed ?? []) this.#rows.set(row.id, row);
756
- this.#created = this.#rows.size;
757
- }
758
- create(input) {
759
- const failure = this.#failures.create;
760
- if (failure !== void 0) return Effect.fail(subAccountErrorFromCapxul("create", failure));
761
- this.#created += 1;
762
- const id = toSubAccountId(`subaccount_test${String(this.#created)}`);
763
- const row = {
764
- id,
765
- accountId: input.accountId,
766
- name: input.name,
767
- balance: {
768
- currency: toCurrencyCode("USD"),
769
- value: "0",
770
- decimals: 6
771
- },
772
- createdAt: toEpochMs(Date.now())
773
- };
774
- this.#rows.set(id, row);
775
- return Effect.succeed(row);
776
- }
777
- get(input) {
778
- return Effect.succeed(this.#rows.get(input.subAccountId) ?? null);
779
- }
780
- list(input) {
781
- const accountId = input.accountId;
782
- return Effect.succeed([...this.#rows.values()].filter((row) => row.accountId === accountId));
783
- }
784
- rename(input) {
785
- const existing = this.#rows.get(input.subAccountId);
786
- if (existing === void 0) return Effect.fail(subAccountErrorFromCapxul("rename", Errors.accountNotFound(input.subAccountId)));
787
- const next = {
788
- ...existing,
789
- name: input.name
790
- };
791
- this.#rows.set(input.subAccountId, next);
792
- return Effect.succeed(next);
793
- }
794
- delete(input) {
795
- const existing = this.#rows.get(input.subAccountId);
796
- if (existing === void 0) return Effect.fail(subAccountErrorFromCapxul("delete", Errors.accountNotFound(input.subAccountId)));
797
- if (Number(existing.balance.value) !== 0) return Effect.fail(subAccountErrorFromCapxul("delete", Errors.invalidInput("subAccountId", "delete requires zero balance")));
798
- this.#rows.delete(input.subAccountId);
799
- return Effect.succeed(void 0);
800
- }
801
- transfer(input) {
802
- const decimals = input.amount.decimals;
803
- const invalid = (field, reason) => Effect.fail(subAccountErrorFromCapxul("transfer", Errors.invalidInput(field, reason)));
804
- let rawAmount;
805
- try {
806
- rawAmount = BigInt(toWei(input.amount));
807
- } catch {
808
- return invalid("amount", "must be a decimal money string");
809
- }
810
- if (rawAmount <= 0n) return invalid("amount", "must be positive");
811
- if (input.from === input.to) return invalid("transfer", "from and to must differ");
812
- const fromRow = input.from === "main" ? null : this.#rows.get(input.from) ?? "missing";
813
- if (fromRow === "missing") return invalid("subAccountId", "unknown sub-account");
814
- const toRow = input.to === "main" ? null : this.#rows.get(input.to) ?? "missing";
815
- if (toRow === "missing") return invalid("subAccountId", "unknown sub-account");
816
- const safeRaw = BigInt(this.#balanceOfRaw);
817
- const subTotalRaw = this.#sumSubAccountRaws(decimals);
818
- if (input.from === "main") {
819
- const availableRaw = safeRaw - subTotalRaw;
820
- if (availableRaw < rawAmount) return Effect.fail(subAccountErrorFromCapxul("transfer", Errors.insufficientBalance("main", maxRaw(availableRaw), rawAmount.toString(10))));
821
- } else if (fromRow !== null) {
822
- const fromRaw = BigInt(toWei({
823
- value: fromRow.balance.value,
824
- decimals
825
- }));
826
- if (fromRaw < rawAmount) return Effect.fail(subAccountErrorFromCapxul("transfer", Errors.insufficientBalance(fromRow.name, fromRaw.toString(10), rawAmount.toString(10))));
827
- }
828
- let nextFrom = null;
829
- let nextTo = null;
830
- if (fromRow !== null) {
831
- const fromRaw = BigInt(toWei({
832
- value: fromRow.balance.value,
833
- decimals
834
- }));
835
- nextFrom = this.#patchBalance(fromRow, (fromRaw - rawAmount).toString(10), decimals);
836
- }
837
- if (toRow !== null) {
838
- const toRaw = BigInt(toWei({
839
- value: toRow.balance.value,
840
- decimals
841
- }));
842
- nextTo = this.#patchBalance(toRow, (toRaw + rawAmount).toString(10), decimals);
843
- }
844
- const available = fromWei(maxRaw(safeRaw - this.#sumSubAccountRaws(decimals)), decimals, input.amount.currency);
845
- return Effect.succeed({
846
- available,
847
- from: nextFrom,
848
- to: nextTo
849
- });
850
- }
851
- #sumSubAccountRaws(decimals) {
852
- let total = 0n;
853
- for (const row of this.#rows.values()) total += BigInt(toWei({
854
- value: row.balance.value,
855
- decimals
856
- }));
857
- return total;
858
- }
859
- #patchBalance(row, rawBalance, decimals) {
860
- const balance = fromWei(rawBalance, decimals, row.balance.currency);
861
- const next = {
862
- ...row,
863
- balance
864
- };
865
- this.#rows.set(row.id, next);
866
- return next;
867
- }
868
- };
869
- /** Floor a (possibly negative) base-unit raw to a non-negative base-10 string. */
870
- function maxRaw(raw) {
871
- return (raw < 0n ? 0n : raw).toString(10);
872
- }
873
- //#endregion
874
742
  //#region src/testing/telemetry/RecordingTelemetryAdapter.ts
875
743
  var RecordingTelemetryAdapter = class {
876
744
  #events = [];
@@ -1007,12 +875,8 @@ function createCapxulTestClient(options = {}) {
1007
875
  authClient: authClientPortFromPromiseAdapter(authClient),
1008
876
  authCache,
1009
877
  identity,
1010
- smartAccount: new InMemorySmartAccountAdapter({
1011
- clock,
1012
- identity
1013
- }),
878
+ smartAccount: new InMemorySmartAccountAdapter({ clock }),
1014
879
  accountRead: new InMemoryAccountReadAdapter({ rawBalance: "0" }),
1015
- subAccount: new InMemorySubAccountAdapter(),
1016
880
  bootstrap: new BootstrapStubAdapter({ script: { resolutions: new Map([[`${toPublishableKey("cap_pk_test_0123456789ABCDEFGHJKMNPQRSTVWXYZ")}::${toAllowedOrigin("https://example.test")}`, TEST_BOOTSTRAP]]) } }),
1017
881
  clock,
1018
882
  telemetry,
@@ -1064,5 +928,3 @@ function createCapxulTestClient(options = {}) {
1064
928
  }
1065
929
  //#endregion
1066
930
  export { createCapxulTestClient };
1067
-
1068
- //# sourceMappingURL=index.mjs.map