@capxul/sdk 4.20.0-beta.4 → 4.20.0-beta.6
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/README.md +57 -26
- package/dist/{OAuthBearerAuthClient-DWkofxdZ.mjs → OAuthBearerAuthClient-5ujCTtKE.mjs} +83 -101
- package/dist/{OAuthBearerAuthClient-C-ip-z8M.d.mts → OAuthBearerAuthClient-B7Nbepmu.d.mts} +23 -3
- package/dist/index.d.mts +63 -13
- package/dist/index.mjs +3 -151
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{production-BMfmzwHq.mjs → production-B4NzzuUb.mjs} +5325 -3943
- package/dist/{production-CJwxgI8u.d.mts → production-pLe7MsUo.d.mts} +367 -129
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +25 -16
- package/package.json +6 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as OrgId, A as Address, At as FAILURE_MODES, B as BudgetId, Ct as CapxulErrorDetails, D as Account, Dt as CHAIN_UPSTREAMS, E as CAPXUL_PAYMENTS_V2_ADDRESS, Et as isCapxulError, F as AssetAmount, G as CurrencyCode, I as AssetId, J as EVM_ADDRESS_RE, L as AuthSession, Mt as RevertSummary, O as AccountId, Ot as ChainCause, Q as Money, R as AuthUserId, St as CapxulErrorCode, V as ChainId, W as CountryCode, Z as Handle, _ as Session, _t as toHandle, a as Eip1193RequestProvider, bt as CAPXUL_ERROR_CODES, c as injectedWalletSigner, ct as RoleKey, d as AccountRequirement, dt as TesterKind, et as PartyId, f as Eip1193Provider, g as Profile, gt as toCountryCode, h as CapxulResult, ht as toAddress, i as CapxulSigner, jt as FailureMode, kt as ChainUpstream, l as AccountProvider, m as localPrivateKeyAccountProvider, mt as toAccountId, 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 toOrgId, wt as Errors, xt as CapxulError, yt as toPartyId } from "./OAuthBearerAuthClient-B7Nbepmu.mjs";
|
|
2
|
+
import { $ as PayrollRun, $n as CurrentPolicy, $t as ActivityRange, A as InviteMemberInput, An as PaymentTiming, At as AccountMethods, B as OrganizationAuditLogItem, Bn as AccountLifecycle, Bt as AddressBookMethods, C as SystemHealth, Cn as PaymentActivityEvidence, Cr as StateLabel, Ct as OrganizationOnboarding, D as AssignmentProjection, Dn as PaymentDocumentsMethods, Dr as IdentityTransition, Dt as PersonOnboarding, E as CurrentUserMethods, En as PaymentDocumentRef, Er as isRestoring, Et as OrganizationOnboardingState, F as OrgScopedMethods, Fn as Ref, Ft as ActorRequestIssueInput, G as AuthorizeRunOptions, Gn as SmartAccountMethods, Gt as ActivityAnnotationInput, H as RoleDefinition, Hn as isSettingUpLifecycle, Ht as InboxItem, I as OrgTemplate, In as ResolvedTarget, It as ActorRequestsMethods, J as PayrollGroupInput, Jn as ClientRequests, Jt as ActivityItem, K as PayrollEngagementTerms, Kn as AuthMethods, Kt as ActivityDetail, L as OrgView, Ln as TargetReference, Lt as AddressBookAddInput, M as MemberStatus, Mn as PaymentsMethods, Mt as ActorProfileMethods, N as MemberView, Nn as PaymentsPayInput, Nt as ActorRelationshipMethods, O as CreateOrgInput, On as PaymentMoney, Or as InvocationControls, Ot as PersonOnboardingInput, P as OrgMethods, Pn as RecipientResolution, Pt as ActorRequest, Q as PayrollOptions, Qn as AuthorityRef, Qt as ActivityPage, R as OrganizationAccess, Rn as TargetsMethods, Rt as AddressBookEntry, S as SystemMethods, Sn as Payment, Sr as Readiness, St as OnboardingMethods, T as CurrentUserContext, Tn as PaymentDocumentKind, Tr as isClaimed, Tt as OrganizationOnboardingOptions, U as RoleView, Un as CompleteProfileInput, Ut as InboxMethods, V as ResendInviteTokenInput, Vn as AccountSetupStep, Vt as InboxApproveInput, W as AuthorizeRunInput, Wn as IdentityMethods, Wt as ActivityAnnotation, X as PayrollGroupsMethods, Xn as OrgSetupStep, Xt as ActivityListParams, Y as PayrollGroupMember, Yn as OrgLifecycle, Yt as ActivityKind, Z as PayrollMethods, Zn as PayoutAddress, Zt as ActivityMethods, _ as CreateCapxulClientInput, _n as MovementActivityEvidence, _r as TelemetryPort, _t as OrgMe, a as ObservationContext, an as DepositInstructions, ar as ActorRef, at as OrganizationPaymentInput, b as IdentityRuntimeSendResult, bn as OfframpQuoteInput, br as IdentityState, bt as AccountsMethods, c as HostObservability, cn as DestinationKind, cr as SubmittedPermissionExecution, ct as PermissionAssignInput, d as postHogObservability, dn as DestinationRail, dr as PAYMENT_STATUSES, dt as PermissionMethods, en as ActivityReference, er as ClientRequestView, et as PayrollRunItemInput, f as OpenfortBrowserAuth, fn as DestinationRemoveInput, fr as PaymentStatus$1, ft as PermissionOptions, g as CapxulClient, gn as MeProfile, gt as Budget, h as createOpenfortBrowserSigner, hn as MeMethods, ht as PermissionReadResult, i as ObservationAdapter, in as ActorReference, ir as PaymentDocumentVerification, it as OrganizationPaymentBatchInput, j as MemberIdentityProjection, jn as PaymentType, jt as ActorProfile, k as DetectPendingOrgInvitationsResult, kn as PaymentStatus, kt as ReadyAccountLifecycle, l as PostHogObservabilityClient, ln as DestinationListInput, lr as InboxStatus, lt as PermissionChangeInput, m as OpenfortBrowserSignerBootstrap, mn as FinancialOpsMethods, mt as PermissionRevokeInput, nn as ActivitySummaryParams, nr as PaymentDocumentReadRef, nt as PayrollRuns, o as ObservationDelivery, on as Destination, or as CurrentHoldings, ot as OrganizationPaymentItemInput, p as OpenfortBrowserSigner, pn as DestinationsMethods, pr as RequestStatus, pt as PermissionReplaceInput, q as PayrollGroup, qn as AccountSetupPolicy, qt as ActivityFilter, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as ActivitySummaryTotal, rr as PaymentDocumentRender, rt as PayrollTermsUnit, s as SdkFailureObservation, sn as DestinationAddInput, sr as Permission, st as OrganizationPaymentsMethods, t as CapxulClientInput, tn as ActivitySummary, tr as PaymentDocumentDownload, tt as PayrollRunStatus, u as PostHogObservabilityOptions, un as DestinationPayload, ur as PAYMENT_DIRECTIONS, ut as PermissionCreateInput, v as IdentityProfileDetails, vn as OfframpMethods, vr as Destination$1, vt as OrgMeMethod, w as MediaMethods, wn as PaymentDirection, wr as destination, wt as OrganizationOnboardingInput, x as HoldingsMethods, xn as OfframpStatus, xr as OrgLane, xt as CompletedPersonProfile, y as IdentityRuntime, yn as OfframpQuote, yr as IdentityEvent, yt as OrgMeOptions, z as OrganizationAccount, zn as fingerprintPaymentIntent, zt as AddressBookLabelInput } from "./production-pLe7MsUo.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,13 @@ 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. `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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.
|
|
14
|
+
* Admission — which rows a treasury read returns — is `CONFIGURED_MONEY_ASSETS`,
|
|
15
|
+
* not this field; an owned fixture is a settlement asset.
|
|
17
16
|
*/
|
|
18
|
-
type AssetSource = "
|
|
17
|
+
type AssetSource = "synthetic-test-liquidity";
|
|
19
18
|
/** Canonical metadata. A missing peg does not imply a missing market price. */
|
|
20
19
|
interface AssetMetadata {
|
|
21
20
|
readonly assetId: AssetId;
|
|
@@ -27,6 +26,14 @@ interface AssetMetadata {
|
|
|
27
26
|
readonly deploymentStartBlock: number;
|
|
28
27
|
readonly source: AssetSource;
|
|
29
28
|
}
|
|
29
|
+
/** Public AssetIds for the admitted Base Sepolia test assets. */
|
|
30
|
+
declare const TOKENS: Readonly<{
|
|
31
|
+
BASE_SEPOLIA: Readonly<{
|
|
32
|
+
CAPXUL_TEST_USDC: AssetId;
|
|
33
|
+
CAPXUL_TEST_USDT: AssetId;
|
|
34
|
+
CAPXUL_TEST_WETH: AssetId;
|
|
35
|
+
}>;
|
|
36
|
+
}>;
|
|
30
37
|
//#endregion
|
|
31
38
|
//#region ../observability/src/operations.d.ts
|
|
32
39
|
declare const CAPXUL_OPERATIONS: {
|
|
@@ -98,6 +105,26 @@ declare const CAPXUL_OPERATIONS: {
|
|
|
98
105
|
readonly createOrg: "createOrg";
|
|
99
106
|
readonly orgs: "orgs";
|
|
100
107
|
};
|
|
108
|
+
/** AUTH A3 (#2073): the SDK facade over the native continuation endpoints. */
|
|
109
|
+
readonly clientRequests: {
|
|
110
|
+
readonly decide: "clientRequests.decide";
|
|
111
|
+
readonly read: "clientRequests.read";
|
|
112
|
+
};
|
|
113
|
+
/** AUTH A2 (#2072): the native client authorization issuer and its browser
|
|
114
|
+
* continuation. One name per durable transition the endpoints can fail on. */
|
|
115
|
+
readonly clientAuthorization: {
|
|
116
|
+
readonly acceptRequest: "clientAuthorization.acceptRequest";
|
|
117
|
+
readonly cancelRequest: "clientAuthorization.cancelRequest";
|
|
118
|
+
readonly consumeRequest: "clientAuthorization.consumeRequest";
|
|
119
|
+
readonly denyRequest: "clientAuthorization.denyRequest";
|
|
120
|
+
readonly invalidateContext: "clientAuthorization.invalidateContext";
|
|
121
|
+
readonly markConsented: "clientAuthorization.markConsented";
|
|
122
|
+
readonly readMetadata: "clientAuthorization.readMetadata";
|
|
123
|
+
readonly revokeGrant: "clientAuthorization.revokeGrant";
|
|
124
|
+
readonly rotateGrant: "clientAuthorization.rotateGrant";
|
|
125
|
+
readonly startRequest: "clientAuthorization.startRequest";
|
|
126
|
+
readonly sweepExpired: "clientAuthorization.sweepExpired";
|
|
127
|
+
};
|
|
101
128
|
readonly credentials: {
|
|
102
129
|
readonly bootstrapClient: "credentials.bootstrapClient";
|
|
103
130
|
readonly mintQuickstartKey: "credentials.mintQuickstartKey";
|
|
@@ -137,7 +164,6 @@ declare const CAPXUL_OPERATIONS: {
|
|
|
137
164
|
};
|
|
138
165
|
readonly holdings: {
|
|
139
166
|
readonly current: "holdings.current";
|
|
140
|
-
readonly primary: "holdings.primary";
|
|
141
167
|
};
|
|
142
168
|
readonly indexer: {
|
|
143
169
|
readonly reconcile: "indexer.reconcile";
|
|
@@ -339,6 +365,7 @@ declare const CAPXUL_OPERATIONS: {
|
|
|
339
365
|
readonly submitExecution: "payments.submitExecution";
|
|
340
366
|
};
|
|
341
367
|
readonly paymentDocuments: {
|
|
368
|
+
readonly get: "paymentDocuments.get";
|
|
342
369
|
readonly render: "paymentDocuments.render";
|
|
343
370
|
readonly verify: "paymentDocuments.verify";
|
|
344
371
|
};
|
|
@@ -495,10 +522,13 @@ declare function isMoneyParseError(value: AssetAmount | Money | MoneyParseError)
|
|
|
495
522
|
declare function parseMoney(input: string, asset: Pick<Money, "currency" | "decimals">): Money | MoneyParseError;
|
|
496
523
|
//#endregion
|
|
497
524
|
//#region src/domain/money/asset-amount.d.ts
|
|
525
|
+
/** Exact scaling. This rejects excess precision instead of rounding it. */
|
|
526
|
+
declare function toRaw(amount: AssetAmount, asset: AssetMetadata): bigint;
|
|
498
527
|
declare function parseAssetAmount(input: string, asset: AssetMetadata): AssetAmount | MoneyParseError;
|
|
499
528
|
/** Display the full quantity. Only fiat formatting rounds for display. */
|
|
500
529
|
declare function formatAssetAmount(amount: AssetAmount): string;
|
|
501
530
|
declare function assetSymbolFor(asset: AssetId): string;
|
|
531
|
+
declare function requireAsset(id: AssetId): AssetMetadata;
|
|
502
532
|
//#endregion
|
|
503
533
|
//#region src/domain/money/valuation.d.ts
|
|
504
534
|
interface Rate {
|
|
@@ -508,14 +538,34 @@ interface Rate {
|
|
|
508
538
|
}
|
|
509
539
|
/** Fiat balances use their currency directly, never an invented token identity. */
|
|
510
540
|
type RateSource = (source: AssetMetadata | CurrencyCode, into: CurrencyCode) => Rate | null;
|
|
511
|
-
declare const PEG_RATES: RateSource;
|
|
512
541
|
interface Valuation<T extends AssetAmount | Money = AssetAmount | Money> {
|
|
513
542
|
readonly total: Money | null;
|
|
514
543
|
readonly counted: readonly T[];
|
|
515
544
|
readonly unrated: readonly T[];
|
|
516
545
|
}
|
|
517
546
|
/** Sum exact fixed-point values. Missing rates never contribute zero. */
|
|
518
|
-
declare function valueIn<T extends AssetAmount | Money>(amounts: readonly T[], displayCurrency: CurrencyCode, rates
|
|
547
|
+
declare function valueIn<T extends AssetAmount | Money>(amounts: readonly T[], displayCurrency: CurrencyCode, rates: RateSource): Valuation<T>;
|
|
548
|
+
/** Value all Activity buckets. Compute net before display rounding. */
|
|
549
|
+
declare function valueActivitySummary(totals: readonly ActivitySummaryTotal[], displayCurrency?: CurrencyCode, rates?: RateSource): {
|
|
550
|
+
moneyIn: Money | null;
|
|
551
|
+
moneyOut: Money | null;
|
|
552
|
+
pending: Money | null;
|
|
553
|
+
net: Money | null;
|
|
554
|
+
unrated: ActivitySummaryTotal[];
|
|
555
|
+
};
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/domain/money/account-positions.d.ts
|
|
558
|
+
/**
|
|
559
|
+
* The fiat currency a position is denominated in: the registry peg of its
|
|
560
|
+
* asset, or `null` when that asset carries no peg (ADR-0028 R3/R4).
|
|
561
|
+
*
|
|
562
|
+
* A consumer must denominate a token amount in the position's OWN peg. The
|
|
563
|
+
* Account's `available.currency` is the display currency of a multi-asset
|
|
564
|
+
* VALUATION (ADR-0028 R6). It is `"USD"` for every Account regardless of what
|
|
565
|
+
* is held, so reading it as a position's denomination labels a token with the
|
|
566
|
+
* headline's fiat — the false identity this cut removes.
|
|
567
|
+
*/
|
|
568
|
+
declare function positionPeg(asset: AssetId): CurrencyCode | null;
|
|
519
569
|
//#endregion
|
|
520
570
|
//#region src/domain/money/format-money.d.ts
|
|
521
571
|
/**
|
|
@@ -650,4 +700,4 @@ declare function captureException(telemetry: TelemetryPort, error: unknown, cont
|
|
|
650
700
|
*/
|
|
651
701
|
declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
|
|
652
702
|
//#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
|
|
703
|
+
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 AssignmentProjection, type AuthMethods, type AuthSession, type AuthUserId, type AuthorityRef, 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 CurrentPolicy, 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 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 MemberIdentityProjection, 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 OpenfortBrowserAuth, type OpenfortBrowserSigner, type OpenfortBrowserSignerBootstrap, 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 OrganizationAccess, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationOnboarding, type OrganizationOnboardingInput, type OrganizationOnboardingOptions, type OrganizationOnboardingState, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, type PartyId, type Payment, type PaymentActivityEvidence, type PaymentDirection, type PaymentDocumentDownload, type PaymentDocumentKind, type PaymentDocumentReadRef, 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 RoleView, type SdkFailureObservation, type Session, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, TOKENS, type TargetReference, type TargetsMethods, type TelemetryPort, type TesterKind, type Valuation, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, createOpenfortBrowserSigner, 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, requireAsset, destination as resolveIdentityDestination, toAccountId, toCountryCode, toAddress as toEvmAddress, toHandle, toOrgId, toPartyId, toRaw, valueActivitySummary, valueIn };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import {
|
|
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 requireAsset, H as assetSymbolFor, I as normalizeCapxulOperation, J as parseMoney, K as toRaw, 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, X as isClaimed, Y as destination, Z as isRestoring, _ as openfortEmbeddedWalletPort, b as failureDetail, d as deriveDevPrivateKey, f as devPrivateKeySigner, g as openfortEmbeddedSignerFromWallet, h as openfortEmbeddedSigner, j as PAYMENT_DIRECTIONS, k as signerFailure, m as embeddedSigner, p as createOpenfortBrowserSigner, q as isMoneyParseError, r as postHogObservability, t as createCapxulClient$1, v as fingerprintPaymentIntent, w as normalizeExceptionOperation, x as EXCEPTION_MESSAGE, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as valueActivitySummary } from "./production-B4NzzuUb.mjs";
|
|
2
|
+
import { K as toCountryCode, L as currencySymbolFor, M as EVM_ADDRESS_RE, Q as toHandle, R as toAccountId, S as TOKENS, St as FAILURE_MODES, _t as CapxulError, bt as isCapxulError, gt as CAPXUL_ERROR_CODES, m as CAPXUL_PAYMENTS_V2_ADDRESS, mt as HANDLE_RE, nt as toPartyId, q as toCurrencyCode, tt as toOrgId, xt as CHAIN_UPSTREAMS, yt as Errors, z as toAddress } from "./OAuthBearerAuthClient-5ujCTtKE.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,
|
|
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, TOKENS, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, createOpenfortBrowserSigner, 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, requireAsset, destination as resolveIdentityDestination, toAccountId, toCountryCode, toAddress as toEvmAddress, toHandle, toOrgId, toPartyId, toRaw, valueActivitySummary, valueIn };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as AuthCachePort,
|
|
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-B7Nbepmu.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
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as parseAuthSession, c as AuthCachePortTag, i as BrowserAuthCacheAdapter, o as parseCachedJwt, r as InMemoryAuthCacheAdapter, s as AuthCacheError, t as oauthBearerAuthClient, z as toAddress } from "../OAuthBearerAuthClient-5ujCTtKE.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";
|