@zkp2p/sdk 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-6WAMIVRB.mjs → chunk-WFDRBAV3.mjs} +2 -2
- package/dist/chunk-WFDRBAV3.mjs.map +1 -0
- package/dist/index.cjs +10 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -14
- package/dist/index.d.ts +13 -14
- package/dist/index.mjs +9 -18
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +12 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +14 -3
- package/dist/react.mjs.map +1 -1
- package/dist/{vaultUtils-VAfbA30W.d.mts → vaultUtils-CcJn5Yh6.d.mts} +38 -22
- package/dist/{vaultUtils-VAfbA30W.d.ts → vaultUtils-CcJn5Yh6.d.ts} +38 -22
- package/package.json +1 -1
- package/dist/chunk-6WAMIVRB.mjs.map +0 -1
|
@@ -1139,7 +1139,7 @@ type WiseProfileNotFound = {
|
|
|
1139
1139
|
profileId: string;
|
|
1140
1140
|
profiles: WiseProfileInfo[];
|
|
1141
1141
|
};
|
|
1142
|
-
type GoogleOAuthSellerCredentialPlatform = Extract<SellerPlatform, 'paypal' | 'venmo'
|
|
1142
|
+
type GoogleOAuthSellerCredentialPlatform = Extract<SellerPlatform, 'paypal' | 'venmo'>;
|
|
1143
1143
|
type PayPalGoogleOAuthSellerCredentialUploadBody = {
|
|
1144
1144
|
payeeEmail: string;
|
|
1145
1145
|
authorizationCode: string;
|
|
@@ -1150,15 +1150,9 @@ type VenmoGoogleOAuthSellerCredentialUploadBody = {
|
|
|
1150
1150
|
authorizationCode: string;
|
|
1151
1151
|
redirectUri: string;
|
|
1152
1152
|
};
|
|
1153
|
-
type ZelleGoogleOAuthSellerCredentialUploadBody = {
|
|
1154
|
-
payeeId: string;
|
|
1155
|
-
authorizationCode: string;
|
|
1156
|
-
redirectUri: string;
|
|
1157
|
-
};
|
|
1158
1153
|
type GoogleOAuthSellerCredentialUploadBodyByPlatform = {
|
|
1159
1154
|
paypal: PayPalGoogleOAuthSellerCredentialUploadBody;
|
|
1160
1155
|
venmo: VenmoGoogleOAuthSellerCredentialUploadBody;
|
|
1161
|
-
zelle: ZelleGoogleOAuthSellerCredentialUploadBody;
|
|
1162
1156
|
};
|
|
1163
1157
|
type VenmoCredentialUploadInput = {
|
|
1164
1158
|
payeeId: string;
|
|
@@ -1250,6 +1244,12 @@ type BuyerTeeSessionMaterialEncryptionInput = {
|
|
|
1250
1244
|
sessionMaterial: BuyerTeeSessionMaterial;
|
|
1251
1245
|
timeoutMs?: number | null;
|
|
1252
1246
|
};
|
|
1247
|
+
type BuyerTeeVerifyPaymentBody = {
|
|
1248
|
+
encryptedSessionMaterial: string;
|
|
1249
|
+
chainId: number;
|
|
1250
|
+
intent: SellerVerifyIntentDetails;
|
|
1251
|
+
params: BuyerTeePaymentParams;
|
|
1252
|
+
};
|
|
1253
1253
|
type MakerIdentityPlatform = Extract<IdentityPlatform, 'paypal' | 'wise'>;
|
|
1254
1254
|
type IdentityAttestationParams = IdentityParamsByPlatform[IdentityPlatform] | Record<string, string | number | boolean>;
|
|
1255
1255
|
type IdentityAttestationRequestBody = {
|
|
@@ -1395,11 +1395,7 @@ type UploadVenmoGoogleOAuthSellerCredentialParams = GoogleOAuthSellerCredentialB
|
|
|
1395
1395
|
platform: 'venmo';
|
|
1396
1396
|
accountId: string;
|
|
1397
1397
|
};
|
|
1398
|
-
type
|
|
1399
|
-
platform: 'zelle';
|
|
1400
|
-
payeeId: string;
|
|
1401
|
-
};
|
|
1402
|
-
type UploadGoogleOAuthSellerCredentialParams = UploadPayPalGoogleOAuthSellerCredentialParams | UploadVenmoGoogleOAuthSellerCredentialParams | UploadZelleGoogleOAuthSellerCredentialParams;
|
|
1398
|
+
type UploadGoogleOAuthSellerCredentialParams = UploadPayPalGoogleOAuthSellerCredentialParams | UploadVenmoGoogleOAuthSellerCredentialParams;
|
|
1403
1399
|
type VerifySellerPaymentParams = {
|
|
1404
1400
|
platform: SellerPlatform;
|
|
1405
1401
|
} & SellerVerifyProxyBody;
|
|
@@ -1857,8 +1853,10 @@ type PlatformRiskLevel = 'LOW' | 'MEDIUM_HIGH' | 'HIGH' | 'HIGHEST';
|
|
|
1857
1853
|
type PlatformLimit = {
|
|
1858
1854
|
paymentMethodHash: string;
|
|
1859
1855
|
platformName: string;
|
|
1860
|
-
|
|
1861
|
-
|
|
1856
|
+
/** Legacy risk category. Current curator cap-grid responses omit this. */
|
|
1857
|
+
riskLevel?: PlatformRiskLevel;
|
|
1858
|
+
/** Legacy multiplier. Current curator cap-grid responses omit this. */
|
|
1859
|
+
capMultiplier?: number;
|
|
1862
1860
|
effectiveCap: string;
|
|
1863
1861
|
effectiveCapDisplay: string;
|
|
1864
1862
|
hasCooldown: boolean;
|
|
@@ -1873,14 +1871,25 @@ type PlatformLimit = {
|
|
|
1873
1871
|
*/
|
|
1874
1872
|
reversible?: boolean;
|
|
1875
1873
|
};
|
|
1874
|
+
type TakerTierVolumeBreakdown = {
|
|
1875
|
+
platformName: string;
|
|
1876
|
+
paymentMethodHash: string;
|
|
1877
|
+
volumeBaseUnits: string;
|
|
1878
|
+
volumeDisplay: string;
|
|
1879
|
+
multiplierBps: number;
|
|
1880
|
+
weightedVolumeBaseUnits: string;
|
|
1881
|
+
weightedVolumeDisplay: string;
|
|
1882
|
+
};
|
|
1876
1883
|
/** How the curator resolved the taker tier (see curator tier engine). */
|
|
1877
1884
|
type TakerTierSource = 'computed' | 'fallback' | 'override' | 'blocklist' | 'peer_president';
|
|
1878
1885
|
type TakerTier = {
|
|
1879
1886
|
owner: string;
|
|
1880
1887
|
chainId: number;
|
|
1881
1888
|
tier: TakerTierLevel;
|
|
1882
|
-
|
|
1883
|
-
|
|
1889
|
+
/** Legacy base cap. Current curator responses expose enforced caps in platformLimits. */
|
|
1890
|
+
perIntentCapBaseUnits?: string;
|
|
1891
|
+
/** Legacy formatted base cap. */
|
|
1892
|
+
perIntentCapDisplay?: string;
|
|
1884
1893
|
lastUpdated: string;
|
|
1885
1894
|
source: TakerTierSource;
|
|
1886
1895
|
stats: TakerTierStats | null;
|
|
@@ -1889,9 +1898,13 @@ type TakerTier = {
|
|
|
1889
1898
|
cooldownActive: boolean;
|
|
1890
1899
|
cooldownRemainingSeconds: number;
|
|
1891
1900
|
nextIntentAvailableAt: string | null;
|
|
1901
|
+
/**
|
|
1902
|
+
* Server-authoritative platform cap grid. Use this for enforced caps; do not
|
|
1903
|
+
* derive platform caps from top-level tier caps or risk multipliers.
|
|
1904
|
+
*/
|
|
1892
1905
|
platformLimits?: PlatformLimit[];
|
|
1893
1906
|
/**
|
|
1894
|
-
* Server-authoritative tier fields (curator PR #461/#463 contract). All
|
|
1907
|
+
* Server-authoritative tier fields (curator PR #461/#463/#478 contract). All
|
|
1895
1908
|
* optional because the current production deployment still serves the older
|
|
1896
1909
|
* payload that omits them — read them when present and fall back gracefully.
|
|
1897
1910
|
* Amounts are USDC base-unit strings (6 decimals).
|
|
@@ -1899,21 +1912,24 @@ type TakerTier = {
|
|
|
1899
1912
|
/** Base per-intent cap before platform risk multipliers (alias of perIntentCapBaseUnits). */
|
|
1900
1913
|
maxOrderSize?: string;
|
|
1901
1914
|
maxOrderSizeDisplay?: string;
|
|
1902
|
-
/**
|
|
1915
|
+
/** Weighted maker-volume floor that qualifies the current tier. */
|
|
1903
1916
|
minVolumeForTier?: string;
|
|
1904
1917
|
minVolumeForTierDisplay?: string;
|
|
1905
1918
|
/** Next tier up the volume ladder, or null at the top / off-ladder tiers. */
|
|
1906
1919
|
nextTier?: TakerTierLevel | null;
|
|
1907
|
-
/** Remaining
|
|
1920
|
+
/** Remaining weighted maker volume to reach `nextTier`. */
|
|
1908
1921
|
volumeToNextTier?: string | null;
|
|
1909
1922
|
volumeToNextTierDisplay?: string | null;
|
|
1910
1923
|
nextTierMaxOrderSize?: string | null;
|
|
1911
1924
|
nextTierMaxOrderSizeDisplay?: string | null;
|
|
1912
1925
|
/**
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
1926
|
+
* Compatibility name retained by curator: now contains weighted all-maker
|
|
1927
|
+
* volume driving tier qualification. Present on deployments with the
|
|
1928
|
+
* PR #461/#463 progression contract; PR #478 changes its source semantics.
|
|
1915
1929
|
*/
|
|
1916
1930
|
peerPayVolume?: string;
|
|
1931
|
+
/** Auditable per-platform weighted-volume inputs. Present on PR #478+ deployments. */
|
|
1932
|
+
volumeBreakdown?: TakerTierVolumeBreakdown[];
|
|
1917
1933
|
};
|
|
1918
1934
|
type GetTakerTierRequest = {
|
|
1919
1935
|
owner: string;
|
|
@@ -3717,4 +3733,4 @@ type SendBatchFn = (txs: Array<{
|
|
|
3717
3733
|
value?: bigint;
|
|
3718
3734
|
}>) => Promise<string>;
|
|
3719
3735
|
|
|
3720
|
-
export { type
|
|
3736
|
+
export { type ReleaseFundsToPayerParams as $, type AttestationServiceIdentityResponse as A, type BuyerTeeVerifyPaymentBody as B, type CuratorSellerCredentialUploadResponse as C, type DepositWithRelations as D, type SignalIntentMethodParams as E, type FulfillIntentMethodParams as F, type GoogleOAuthSellerCredentialPlatform as G, type CancelIntentMethodParams as H, type IntentEntity$1 as I, type Zkp2pNextOptions as J, type AuthorizationTokenProvider as K, type TimeoutConfig as L, type ActionCallback as M, type CreateDepositParams as N, type CreateDepositConversionRate as O, type PostDepositDetailsRequest as P, type QuotesBestByPlatformRequest as Q, type ReferrerFeeConfig as R, type SellerCredentialBundle as S, type TakerTierLevel as T, type UploadSellerCredentialBundleParams as U, type ValidatePayeeDetailsRequest as V, type Range as W, type WithdrawDepositParams as X, type SignalIntentParams as Y, Zkp2pClient as Z, type FulfillIntentParams as _, type IdentityAttestationRequestBody as a, type SellerCredentialProbeResponse as a$, type CancelIntentParams as a0, type BestByPlatformResponseObject as a1, type GetBestByPlatformResponse as a2, type GetBestByPlatformResponseObject as a3, type GetPlatformQuote as a4, type PlatformQuote as a5, type QuoteRequest as a6, type GetNearbyQuote as a7, type GetNearbySuggestions as a8, type GetQuoteResponse as a9, type RegisterPayeeDetailsResponse as aA, type SellerPlatform as aB, type VenmoSessionMaterial as aC, type CashAppSessionMaterial as aD, type WiseSessionMaterial as aE, type WiseProfileInfo as aF, type WiseProfileSelectionRequired as aG, type WiseProfileNotFound as aH, type PayPalGoogleOAuthSellerCredentialUploadBody as aI, type VenmoGoogleOAuthSellerCredentialUploadBody as aJ, type VenmoCredentialUploadInput as aK, type CashAppCredentialUploadInput as aL, type WiseCredentialUploadInput as aM, type SellerCredentialUploadInputByPlatform as aN, type SellerCiphertextBundle as aO, type SellerSignedCiphertextBundle as aP, type SellerVerifyIntentDetails as aQ, type SellerVerifyInput as aR, type SellerProbeInput as aS, type SellerCredentialBundleUpload as aT, type SellerCredentialStatusValue as aU, type SellerCredentialStatus as aV, type SellerVerifyProxyBody as aW, type SellerTypedDataField as aX, type SellerTypedDataSpec as aY, type SellerPaymentTypedDataValue as aZ, type SellerAttestationOutput as a_, type GetQuoteResponseObject as aa, type GetQuoteSingleResponse as ab, type QuoteResponse as ac, type QuoteResponseObject as ad, type QuoteSingleResponse as ae, type QuoteIntentResponse as af, type QuoteFeesResponse as ag, type FiatResponse as ah, type TokenResponse as ai, type NearbyQuote as aj, type NearbySuggestions as ak, type ApiDeposit as al, type DepositVerifier as am, type DepositVerifierCurrency as an, type DepositStatus as ao, type GetDepositByIdRequest as ap, type GetDepositByIdResponse as aq, type Intent as ar, type ApiIntentStatus as as, type GetOwnerIntentsRequest as at, type GetOwnerIntentsResponse as au, type GetIntentsByDepositRequest as av, type GetIntentsByDepositResponse as aw, type GetIntentByHashRequest as ax, type GetIntentByHashResponse as ay, type RegisterPayeeDetailsRequest as az, type AttestationServiceSellerVerifyResponse as b, type RateManagerFilter as b$, type FulfillIntentAttestationResponse as b0, type AttestationServiceSellerCredentialProbeResponse as b1, type BuyerTeePaymentParams as b2, type BuyerTeePaymentProofInput as b3, type BuyerTeeSessionMaterial as b4, type CuratorSellerCredentialStatusResponse as b5, type CuratorSellerVerifyResponse as b6, type RegisteredSellerCredentialPlatform as b7, type UploadSellerCredentialParams as b8, type RegisteredUploadSellerCredentialParams as b9, IndexerDepositService as bA, IndexerRateManagerService as bB, compareEventCursorIdsByRecency as bC, fetchFulfillmentAndPayment as bD, type DepositEntity$1 as bE, type IntentFulfilledEntity as bF, type IntentFulfillmentAmountsEntity as bG, type DepositPaymentMethodEntity$1 as bH, type MethodCurrencyEntity$1 as bI, type IntentStatus as bJ, type RateManagerEntity as bK, type RateManagerRateEntity as bL, type RateManagerDelegationEntity as bM, type ManagerAggregateStatsEntity as bN, type ManagerStatsEntity as bO, type ManagerDailySnapshotEntity as bP, type RateManagerListItem as bQ, type RateManagerDetail as bR, type ManualRateUpdateEntity as bS, type OracleConfigUpdateEntity as bT, type DepositFundActivityEntity$1 as bU, type DepositDailySnapshotEntity$1 as bV, type DepositFundActivityType$1 as bW, type DepositFilter as bX, type PaginationOptions as bY, type DepositOrderField as bZ, type OrderDirection$1 as b_, type UploadSellerCredentialOptions as ba, type GetSellerCredentialStatusParams as bb, type UploadPayPalGoogleOAuthSellerCredentialParams as bc, type UploadVenmoGoogleOAuthSellerCredentialParams as bd, type UploadGoogleOAuthSellerCredentialParams as be, type VerifySellerPaymentParams as bf, type IdentityAttestationActionType as bg, type IdentityAttestationOutput as bh, type IdentityAttestationOutputFor as bi, type IdentityAttestationParams as bj, type MakerIdentityAttestationRequestBody as bk, type MakerIdentityPlatform as bl, type OnchainCurrency as bm, type DepositVerifierData as bn, type PreparedTransaction as bo, type OrderStats as bp, type DepositIntentStatistics as bq, type TakerTier as br, type TakerTierVolumeBreakdown as bs, type TakerTierStats as bt, type TakerTierSource as bu, type PlatformLimit as bv, type PlatformRiskLevel as bw, type OrderbookEntry as bx, IndexerClient as by, defaultIndexerEndpoint as bz, type SellerCredentialUploadInput as c, type RateManagerPaginationOptions as c0, type RateManagerDelegationPaginationOptions as c1, type RateManagerOrderField as c2, type OrderDirection as c3, type DeploymentEnv as c4, type FulfillmentRecord as c5, type PaymentVerifiedRecord as c6, type FulfillmentAndPaymentResponse as c7, PAYMENT_PLATFORMS as c8, type PaymentPlatformType as c9, normalizeRateManagerId as cA, normalizeRegistry as cB, getDelegationRoute as cC, classifyDelegationState as cD, type DelegationRoute as cE, type DelegationState as cF, type DelegationDepositTarget as cG, type BatchResult as cH, type SendTransactionFn as cI, type SendBatchFn as cJ, ZERO_ADDRESS as cK, asErrorMessage as cL, assertDelegationMethodSupport as cM, Currency as ca, currencyInfo as cb, getCurrencyInfoFromHash as cc, getCurrencyInfoFromCountryCode as cd, getCurrencyCodeFromHash as ce, isSupportedCurrencyHash as cf, mapConversionRatesToOnchainMinRate as cg, type CurrencyData as ch, getContracts as ci, getRateManagerContracts as cj, getPaymentMethodsCatalog as ck, getGatingServiceAddress as cl, type RuntimeEnv as cm, parseDepositView as cn, parseIntentView as co, enrichPvDepositView as cp, enrichPvIntentView as cq, type PV_DepositView as cr, type PV_Deposit as cs, type PV_PaymentMethodData as ct, type PV_Currency as cu, type PV_ReferralFee as cv, type PV_IntentView as cw, type PV_Intent as cx, ZERO_RATE_MANAGER_ID as cy, isZeroRateManagerId as cz, type SellerCredentialUploadPlatform as d, type SellerCredentialAttestationRuntime as e, type AttestationServiceSellerCredentialUploadResponse as f, type BuyerTeeSessionMaterialEncryptionInput as g, type GoogleOAuthSellerCredentialUploadBodyByPlatform as h, type BestByPlatformResponse as i, type ValidatePayeeDetailsResponse as j, type PostDepositDetailsResponse as k, type GetPayeeDetailsRequest as l, type GetPayeeDetailsResponse as m, type GetOwnerDepositsRequest as n, type GetOwnerDepositsResponse as o, type GetTakerTierRequest as p, type GetTakerTierResponse as q, type GetDepositBundleParams as r, type ApiAdapterOptions as s, type GetDepositBundleResponse as t, type GetOrderbookParams as u, type GetOrderbookResponse as v, type CurrencyType as w, type PaymentMethodCatalog as x, type TxOverrides as y, type SignalIntentReferralFee as z };
|
|
@@ -1139,7 +1139,7 @@ type WiseProfileNotFound = {
|
|
|
1139
1139
|
profileId: string;
|
|
1140
1140
|
profiles: WiseProfileInfo[];
|
|
1141
1141
|
};
|
|
1142
|
-
type GoogleOAuthSellerCredentialPlatform = Extract<SellerPlatform, 'paypal' | 'venmo'
|
|
1142
|
+
type GoogleOAuthSellerCredentialPlatform = Extract<SellerPlatform, 'paypal' | 'venmo'>;
|
|
1143
1143
|
type PayPalGoogleOAuthSellerCredentialUploadBody = {
|
|
1144
1144
|
payeeEmail: string;
|
|
1145
1145
|
authorizationCode: string;
|
|
@@ -1150,15 +1150,9 @@ type VenmoGoogleOAuthSellerCredentialUploadBody = {
|
|
|
1150
1150
|
authorizationCode: string;
|
|
1151
1151
|
redirectUri: string;
|
|
1152
1152
|
};
|
|
1153
|
-
type ZelleGoogleOAuthSellerCredentialUploadBody = {
|
|
1154
|
-
payeeId: string;
|
|
1155
|
-
authorizationCode: string;
|
|
1156
|
-
redirectUri: string;
|
|
1157
|
-
};
|
|
1158
1153
|
type GoogleOAuthSellerCredentialUploadBodyByPlatform = {
|
|
1159
1154
|
paypal: PayPalGoogleOAuthSellerCredentialUploadBody;
|
|
1160
1155
|
venmo: VenmoGoogleOAuthSellerCredentialUploadBody;
|
|
1161
|
-
zelle: ZelleGoogleOAuthSellerCredentialUploadBody;
|
|
1162
1156
|
};
|
|
1163
1157
|
type VenmoCredentialUploadInput = {
|
|
1164
1158
|
payeeId: string;
|
|
@@ -1250,6 +1244,12 @@ type BuyerTeeSessionMaterialEncryptionInput = {
|
|
|
1250
1244
|
sessionMaterial: BuyerTeeSessionMaterial;
|
|
1251
1245
|
timeoutMs?: number | null;
|
|
1252
1246
|
};
|
|
1247
|
+
type BuyerTeeVerifyPaymentBody = {
|
|
1248
|
+
encryptedSessionMaterial: string;
|
|
1249
|
+
chainId: number;
|
|
1250
|
+
intent: SellerVerifyIntentDetails;
|
|
1251
|
+
params: BuyerTeePaymentParams;
|
|
1252
|
+
};
|
|
1253
1253
|
type MakerIdentityPlatform = Extract<IdentityPlatform, 'paypal' | 'wise'>;
|
|
1254
1254
|
type IdentityAttestationParams = IdentityParamsByPlatform[IdentityPlatform] | Record<string, string | number | boolean>;
|
|
1255
1255
|
type IdentityAttestationRequestBody = {
|
|
@@ -1395,11 +1395,7 @@ type UploadVenmoGoogleOAuthSellerCredentialParams = GoogleOAuthSellerCredentialB
|
|
|
1395
1395
|
platform: 'venmo';
|
|
1396
1396
|
accountId: string;
|
|
1397
1397
|
};
|
|
1398
|
-
type
|
|
1399
|
-
platform: 'zelle';
|
|
1400
|
-
payeeId: string;
|
|
1401
|
-
};
|
|
1402
|
-
type UploadGoogleOAuthSellerCredentialParams = UploadPayPalGoogleOAuthSellerCredentialParams | UploadVenmoGoogleOAuthSellerCredentialParams | UploadZelleGoogleOAuthSellerCredentialParams;
|
|
1398
|
+
type UploadGoogleOAuthSellerCredentialParams = UploadPayPalGoogleOAuthSellerCredentialParams | UploadVenmoGoogleOAuthSellerCredentialParams;
|
|
1403
1399
|
type VerifySellerPaymentParams = {
|
|
1404
1400
|
platform: SellerPlatform;
|
|
1405
1401
|
} & SellerVerifyProxyBody;
|
|
@@ -1857,8 +1853,10 @@ type PlatformRiskLevel = 'LOW' | 'MEDIUM_HIGH' | 'HIGH' | 'HIGHEST';
|
|
|
1857
1853
|
type PlatformLimit = {
|
|
1858
1854
|
paymentMethodHash: string;
|
|
1859
1855
|
platformName: string;
|
|
1860
|
-
|
|
1861
|
-
|
|
1856
|
+
/** Legacy risk category. Current curator cap-grid responses omit this. */
|
|
1857
|
+
riskLevel?: PlatformRiskLevel;
|
|
1858
|
+
/** Legacy multiplier. Current curator cap-grid responses omit this. */
|
|
1859
|
+
capMultiplier?: number;
|
|
1862
1860
|
effectiveCap: string;
|
|
1863
1861
|
effectiveCapDisplay: string;
|
|
1864
1862
|
hasCooldown: boolean;
|
|
@@ -1873,14 +1871,25 @@ type PlatformLimit = {
|
|
|
1873
1871
|
*/
|
|
1874
1872
|
reversible?: boolean;
|
|
1875
1873
|
};
|
|
1874
|
+
type TakerTierVolumeBreakdown = {
|
|
1875
|
+
platformName: string;
|
|
1876
|
+
paymentMethodHash: string;
|
|
1877
|
+
volumeBaseUnits: string;
|
|
1878
|
+
volumeDisplay: string;
|
|
1879
|
+
multiplierBps: number;
|
|
1880
|
+
weightedVolumeBaseUnits: string;
|
|
1881
|
+
weightedVolumeDisplay: string;
|
|
1882
|
+
};
|
|
1876
1883
|
/** How the curator resolved the taker tier (see curator tier engine). */
|
|
1877
1884
|
type TakerTierSource = 'computed' | 'fallback' | 'override' | 'blocklist' | 'peer_president';
|
|
1878
1885
|
type TakerTier = {
|
|
1879
1886
|
owner: string;
|
|
1880
1887
|
chainId: number;
|
|
1881
1888
|
tier: TakerTierLevel;
|
|
1882
|
-
|
|
1883
|
-
|
|
1889
|
+
/** Legacy base cap. Current curator responses expose enforced caps in platformLimits. */
|
|
1890
|
+
perIntentCapBaseUnits?: string;
|
|
1891
|
+
/** Legacy formatted base cap. */
|
|
1892
|
+
perIntentCapDisplay?: string;
|
|
1884
1893
|
lastUpdated: string;
|
|
1885
1894
|
source: TakerTierSource;
|
|
1886
1895
|
stats: TakerTierStats | null;
|
|
@@ -1889,9 +1898,13 @@ type TakerTier = {
|
|
|
1889
1898
|
cooldownActive: boolean;
|
|
1890
1899
|
cooldownRemainingSeconds: number;
|
|
1891
1900
|
nextIntentAvailableAt: string | null;
|
|
1901
|
+
/**
|
|
1902
|
+
* Server-authoritative platform cap grid. Use this for enforced caps; do not
|
|
1903
|
+
* derive platform caps from top-level tier caps or risk multipliers.
|
|
1904
|
+
*/
|
|
1892
1905
|
platformLimits?: PlatformLimit[];
|
|
1893
1906
|
/**
|
|
1894
|
-
* Server-authoritative tier fields (curator PR #461/#463 contract). All
|
|
1907
|
+
* Server-authoritative tier fields (curator PR #461/#463/#478 contract). All
|
|
1895
1908
|
* optional because the current production deployment still serves the older
|
|
1896
1909
|
* payload that omits them — read them when present and fall back gracefully.
|
|
1897
1910
|
* Amounts are USDC base-unit strings (6 decimals).
|
|
@@ -1899,21 +1912,24 @@ type TakerTier = {
|
|
|
1899
1912
|
/** Base per-intent cap before platform risk multipliers (alias of perIntentCapBaseUnits). */
|
|
1900
1913
|
maxOrderSize?: string;
|
|
1901
1914
|
maxOrderSizeDisplay?: string;
|
|
1902
|
-
/**
|
|
1915
|
+
/** Weighted maker-volume floor that qualifies the current tier. */
|
|
1903
1916
|
minVolumeForTier?: string;
|
|
1904
1917
|
minVolumeForTierDisplay?: string;
|
|
1905
1918
|
/** Next tier up the volume ladder, or null at the top / off-ladder tiers. */
|
|
1906
1919
|
nextTier?: TakerTierLevel | null;
|
|
1907
|
-
/** Remaining
|
|
1920
|
+
/** Remaining weighted maker volume to reach `nextTier`. */
|
|
1908
1921
|
volumeToNextTier?: string | null;
|
|
1909
1922
|
volumeToNextTierDisplay?: string | null;
|
|
1910
1923
|
nextTierMaxOrderSize?: string | null;
|
|
1911
1924
|
nextTierMaxOrderSizeDisplay?: string | null;
|
|
1912
1925
|
/**
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
1926
|
+
* Compatibility name retained by curator: now contains weighted all-maker
|
|
1927
|
+
* volume driving tier qualification. Present on deployments with the
|
|
1928
|
+
* PR #461/#463 progression contract; PR #478 changes its source semantics.
|
|
1915
1929
|
*/
|
|
1916
1930
|
peerPayVolume?: string;
|
|
1931
|
+
/** Auditable per-platform weighted-volume inputs. Present on PR #478+ deployments. */
|
|
1932
|
+
volumeBreakdown?: TakerTierVolumeBreakdown[];
|
|
1917
1933
|
};
|
|
1918
1934
|
type GetTakerTierRequest = {
|
|
1919
1935
|
owner: string;
|
|
@@ -3717,4 +3733,4 @@ type SendBatchFn = (txs: Array<{
|
|
|
3717
3733
|
value?: bigint;
|
|
3718
3734
|
}>) => Promise<string>;
|
|
3719
3735
|
|
|
3720
|
-
export { type
|
|
3736
|
+
export { type ReleaseFundsToPayerParams as $, type AttestationServiceIdentityResponse as A, type BuyerTeeVerifyPaymentBody as B, type CuratorSellerCredentialUploadResponse as C, type DepositWithRelations as D, type SignalIntentMethodParams as E, type FulfillIntentMethodParams as F, type GoogleOAuthSellerCredentialPlatform as G, type CancelIntentMethodParams as H, type IntentEntity$1 as I, type Zkp2pNextOptions as J, type AuthorizationTokenProvider as K, type TimeoutConfig as L, type ActionCallback as M, type CreateDepositParams as N, type CreateDepositConversionRate as O, type PostDepositDetailsRequest as P, type QuotesBestByPlatformRequest as Q, type ReferrerFeeConfig as R, type SellerCredentialBundle as S, type TakerTierLevel as T, type UploadSellerCredentialBundleParams as U, type ValidatePayeeDetailsRequest as V, type Range as W, type WithdrawDepositParams as X, type SignalIntentParams as Y, Zkp2pClient as Z, type FulfillIntentParams as _, type IdentityAttestationRequestBody as a, type SellerCredentialProbeResponse as a$, type CancelIntentParams as a0, type BestByPlatformResponseObject as a1, type GetBestByPlatformResponse as a2, type GetBestByPlatformResponseObject as a3, type GetPlatformQuote as a4, type PlatformQuote as a5, type QuoteRequest as a6, type GetNearbyQuote as a7, type GetNearbySuggestions as a8, type GetQuoteResponse as a9, type RegisterPayeeDetailsResponse as aA, type SellerPlatform as aB, type VenmoSessionMaterial as aC, type CashAppSessionMaterial as aD, type WiseSessionMaterial as aE, type WiseProfileInfo as aF, type WiseProfileSelectionRequired as aG, type WiseProfileNotFound as aH, type PayPalGoogleOAuthSellerCredentialUploadBody as aI, type VenmoGoogleOAuthSellerCredentialUploadBody as aJ, type VenmoCredentialUploadInput as aK, type CashAppCredentialUploadInput as aL, type WiseCredentialUploadInput as aM, type SellerCredentialUploadInputByPlatform as aN, type SellerCiphertextBundle as aO, type SellerSignedCiphertextBundle as aP, type SellerVerifyIntentDetails as aQ, type SellerVerifyInput as aR, type SellerProbeInput as aS, type SellerCredentialBundleUpload as aT, type SellerCredentialStatusValue as aU, type SellerCredentialStatus as aV, type SellerVerifyProxyBody as aW, type SellerTypedDataField as aX, type SellerTypedDataSpec as aY, type SellerPaymentTypedDataValue as aZ, type SellerAttestationOutput as a_, type GetQuoteResponseObject as aa, type GetQuoteSingleResponse as ab, type QuoteResponse as ac, type QuoteResponseObject as ad, type QuoteSingleResponse as ae, type QuoteIntentResponse as af, type QuoteFeesResponse as ag, type FiatResponse as ah, type TokenResponse as ai, type NearbyQuote as aj, type NearbySuggestions as ak, type ApiDeposit as al, type DepositVerifier as am, type DepositVerifierCurrency as an, type DepositStatus as ao, type GetDepositByIdRequest as ap, type GetDepositByIdResponse as aq, type Intent as ar, type ApiIntentStatus as as, type GetOwnerIntentsRequest as at, type GetOwnerIntentsResponse as au, type GetIntentsByDepositRequest as av, type GetIntentsByDepositResponse as aw, type GetIntentByHashRequest as ax, type GetIntentByHashResponse as ay, type RegisterPayeeDetailsRequest as az, type AttestationServiceSellerVerifyResponse as b, type RateManagerFilter as b$, type FulfillIntentAttestationResponse as b0, type AttestationServiceSellerCredentialProbeResponse as b1, type BuyerTeePaymentParams as b2, type BuyerTeePaymentProofInput as b3, type BuyerTeeSessionMaterial as b4, type CuratorSellerCredentialStatusResponse as b5, type CuratorSellerVerifyResponse as b6, type RegisteredSellerCredentialPlatform as b7, type UploadSellerCredentialParams as b8, type RegisteredUploadSellerCredentialParams as b9, IndexerDepositService as bA, IndexerRateManagerService as bB, compareEventCursorIdsByRecency as bC, fetchFulfillmentAndPayment as bD, type DepositEntity$1 as bE, type IntentFulfilledEntity as bF, type IntentFulfillmentAmountsEntity as bG, type DepositPaymentMethodEntity$1 as bH, type MethodCurrencyEntity$1 as bI, type IntentStatus as bJ, type RateManagerEntity as bK, type RateManagerRateEntity as bL, type RateManagerDelegationEntity as bM, type ManagerAggregateStatsEntity as bN, type ManagerStatsEntity as bO, type ManagerDailySnapshotEntity as bP, type RateManagerListItem as bQ, type RateManagerDetail as bR, type ManualRateUpdateEntity as bS, type OracleConfigUpdateEntity as bT, type DepositFundActivityEntity$1 as bU, type DepositDailySnapshotEntity$1 as bV, type DepositFundActivityType$1 as bW, type DepositFilter as bX, type PaginationOptions as bY, type DepositOrderField as bZ, type OrderDirection$1 as b_, type UploadSellerCredentialOptions as ba, type GetSellerCredentialStatusParams as bb, type UploadPayPalGoogleOAuthSellerCredentialParams as bc, type UploadVenmoGoogleOAuthSellerCredentialParams as bd, type UploadGoogleOAuthSellerCredentialParams as be, type VerifySellerPaymentParams as bf, type IdentityAttestationActionType as bg, type IdentityAttestationOutput as bh, type IdentityAttestationOutputFor as bi, type IdentityAttestationParams as bj, type MakerIdentityAttestationRequestBody as bk, type MakerIdentityPlatform as bl, type OnchainCurrency as bm, type DepositVerifierData as bn, type PreparedTransaction as bo, type OrderStats as bp, type DepositIntentStatistics as bq, type TakerTier as br, type TakerTierVolumeBreakdown as bs, type TakerTierStats as bt, type TakerTierSource as bu, type PlatformLimit as bv, type PlatformRiskLevel as bw, type OrderbookEntry as bx, IndexerClient as by, defaultIndexerEndpoint as bz, type SellerCredentialUploadInput as c, type RateManagerPaginationOptions as c0, type RateManagerDelegationPaginationOptions as c1, type RateManagerOrderField as c2, type OrderDirection as c3, type DeploymentEnv as c4, type FulfillmentRecord as c5, type PaymentVerifiedRecord as c6, type FulfillmentAndPaymentResponse as c7, PAYMENT_PLATFORMS as c8, type PaymentPlatformType as c9, normalizeRateManagerId as cA, normalizeRegistry as cB, getDelegationRoute as cC, classifyDelegationState as cD, type DelegationRoute as cE, type DelegationState as cF, type DelegationDepositTarget as cG, type BatchResult as cH, type SendTransactionFn as cI, type SendBatchFn as cJ, ZERO_ADDRESS as cK, asErrorMessage as cL, assertDelegationMethodSupport as cM, Currency as ca, currencyInfo as cb, getCurrencyInfoFromHash as cc, getCurrencyInfoFromCountryCode as cd, getCurrencyCodeFromHash as ce, isSupportedCurrencyHash as cf, mapConversionRatesToOnchainMinRate as cg, type CurrencyData as ch, getContracts as ci, getRateManagerContracts as cj, getPaymentMethodsCatalog as ck, getGatingServiceAddress as cl, type RuntimeEnv as cm, parseDepositView as cn, parseIntentView as co, enrichPvDepositView as cp, enrichPvIntentView as cq, type PV_DepositView as cr, type PV_Deposit as cs, type PV_PaymentMethodData as ct, type PV_Currency as cu, type PV_ReferralFee as cv, type PV_IntentView as cw, type PV_Intent as cx, ZERO_RATE_MANAGER_ID as cy, isZeroRateManagerId as cz, type SellerCredentialUploadPlatform as d, type SellerCredentialAttestationRuntime as e, type AttestationServiceSellerCredentialUploadResponse as f, type BuyerTeeSessionMaterialEncryptionInput as g, type GoogleOAuthSellerCredentialUploadBodyByPlatform as h, type BestByPlatformResponse as i, type ValidatePayeeDetailsResponse as j, type PostDepositDetailsResponse as k, type GetPayeeDetailsRequest as l, type GetPayeeDetailsResponse as m, type GetOwnerDepositsRequest as n, type GetOwnerDepositsResponse as o, type GetTakerTierRequest as p, type GetTakerTierResponse as q, type GetDepositBundleParams as r, type ApiAdapterOptions as s, type GetDepositBundleResponse as t, type GetOrderbookParams as u, type GetOrderbookResponse as v, type CurrencyType as w, type PaymentMethodCatalog as x, type TxOverrides as y, type SignalIntentReferralFee as z };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/takerTiers.ts","../src/react/hooks/vaultUtils.ts"],"names":[],"mappings":";AA2CO,IAAM,mBAAA,GAAyD;AAAA,EACpE,EAAE,MAAM,UAAA,EAAY,eAAA,EAAiB,KAAM,YAAA,EAAc,GAAA,EAAQ,cAAc,QAAA,EAAS;AAAA,EACxF,EAAE,MAAM,KAAA,EAAO,eAAA,EAAiB,MAAM,YAAA,EAAc,GAAA,EAAO,cAAc,KAAA,EAAM;AAAA,EAC/E,EAAE,MAAM,MAAA,EAAQ,eAAA,EAAiB,KAAM,YAAA,EAAc,GAAA,EAAO,cAAc,KAAA,EAAM;AAAA,EAChF,EAAE,MAAM,MAAA,EAAQ,eAAA,EAAiB,KAAK,YAAA,EAAc,GAAA,EAAM,cAAc,IAAA,EAAK;AAAA,EAC7E,EAAE,MAAM,SAAA,EAAW,eAAA,EAAiB,KAAK,YAAA,EAAc,CAAA,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A;AACtD,EAAA,6BAAA,CAA8B,MAAA,EAAQ,OAAO,KAAK,CAAA;AAClD,EAAA,OAAO,MAAA,CAAO,eAAe,OAAA,CAAQ;AAAA,IACnC,eAAe,MAAA,CAAO,MAAA;AAAA,IACtB,WAAW,MAAA,CAAO,SAAA;AAAA,IAClB,oBAAoB,MAAA,CAAO,QAAA;AAAA,IAC3B,eAAe,MAAA,CAAO,aAAA;AAAA,IACtB,GAAI,WAAW,EAAE,WAAA,EAAa,EAAE,QAAA,EAAS,KAAM;AAAC,GACjD,CAAA;AACH","file":"chunk-6WAMIVRB.mjs","sourcesContent":["import type { TakerTierLevel } from './types';\n\n/**\n * Canonical taker tier schedule — the single client-side source of truth for\n * per-intent caps and volume thresholds. Mirrors the curator's authoritative\n * tier engine (curator `src/common/services/tier/tierConstants.ts`), which is\n * what the backend actually enforces.\n *\n * The signal is now **lifetime Peer-Pay-consumed maker volume**, not raw taker\n * fulfilled volume (curator PR #463 removed SAR weighting).\n *\n * A user's *live* tier, cap, and progression always come from the taker-tier\n * API payload (`TakerTier.perIntentCapBaseUnits`, `minVolumeForTier`,\n * `volumeToNextTier`, `peerPayVolume`). Those values are DB-backed and\n * server-authoritative — they vary per environment (e.g. preprod runs\n * different thresholds than these). This static schedule is ONLY a\n * documented-default reference for displays that must show every tier at once\n * (the Fees & Tiers ladder) when no live payload is available; never gate or\n * compute a user's real cap from it.\n *\n * Volume bands track the live (pre-prod) tuned qualification thresholds, which\n * were re-anchored to the real maker distribution — PEER $1k, PLUS $10k,\n * PRO $50k, PLATINUM $100k (the earlier $2.5k/$20k/$75k/$300k placeholders left\n * PLATINUM literally unreachable; the top band sits in the $99k–$167k gap so the\n * same 3 whales qualify, on a round number). Caps ($100/$250/$1k/$2.5k/$5k) are\n * unchanged.\n * Production still runs the old placeholder bands until the tuned config is\n * promoted, so even this reference can disagree with a given environment — read\n * the live per-user values from the API.\n *\n * Ordered highest tier → lowest (PLATINUM first) to match UI display order.\n * PEER_PRESIDENT is invite-only and excluded from the volume ladder.\n */\nexport interface TakerTierScheduleEntry {\n tier: TakerTierLevel;\n /** Per-intent order cap in whole USD (base, before platform risk multipliers). */\n perIntentCapUsd: number;\n /** Inclusive lower bound of lifetime Peer-Pay volume (USD) that qualifies for this tier. */\n minVolumeUsd: number;\n /** Inclusive upper bound of lifetime Peer-Pay volume (USD); `Infinity` for the top tier. */\n maxVolumeUsd: number;\n}\n\nexport const TAKER_TIER_SCHEDULE: readonly TakerTierScheduleEntry[] = [\n { tier: 'PLATINUM', perIntentCapUsd: 5000, minVolumeUsd: 100000, maxVolumeUsd: Infinity },\n { tier: 'PRO', perIntentCapUsd: 2500, minVolumeUsd: 50000, maxVolumeUsd: 99999 },\n { tier: 'PLUS', perIntentCapUsd: 1000, minVolumeUsd: 10000, maxVolumeUsd: 49999 },\n { tier: 'PEER', perIntentCapUsd: 250, minVolumeUsd: 1000, maxVolumeUsd: 9999 },\n { tier: 'PEASANT', perIntentCapUsd: 100, minVolumeUsd: 0, maxVolumeUsd: 999 },\n];\n\n/** Volume-based tier order, lowest → highest, for next-tier progression. */\nexport const TAKER_TIER_ORDER: readonly TakerTierLevel[] = [\n 'PEASANT',\n 'PEER',\n 'PLUS',\n 'PRO',\n 'PLATINUM',\n];\n\n/** Per-intent caps (whole USD) keyed by tier, derived from the schedule. */\nexport const TAKER_TIER_CAPS: Readonly<Record<string, number>> = Object.fromEntries(\n TAKER_TIER_SCHEDULE.map((entry) => [entry.tier, entry.perIntentCapUsd]),\n);\n\n/**\n * Default take-fee discount (in basis points) applied per tier, mirroring\n * curator `TIER_FEE_DISCOUNT_BPS`. The discount is subtracted from the base\n * service fee server-side at quote and sign time — it is NOT returned by the\n * tier endpoint. These are documented defaults for reference fee displays only;\n * the curator DB control-plane can override them, so prefer the fee shown on a\n * live quote when one is available.\n */\nexport const TAKER_TIER_FEE_DISCOUNT_BPS: Readonly<Record<TakerTierLevel, number>> = {\n PEASANT: 0,\n PEER: 5,\n PLUS: 10,\n PRO: 20,\n PLATINUM: 30,\n PEER_PRESIDENT: 30,\n};\n\n/** The default fee-discount (bps) for a tier, or 0 for unknown tiers. */\nexport function getTakerTierFeeDiscountBps(tier: string | undefined): number {\n if (!tier) return 0;\n return TAKER_TIER_FEE_DISCOUNT_BPS[tier as TakerTierLevel] ?? 0;\n}\n\n/** The next tier up from `currentTier`, or `null` at the top / for unknown tiers. */\nexport function getNextTakerTier(currentTier: string | undefined): TakerTierLevel | null {\n if (!currentTier) return null;\n const index = TAKER_TIER_ORDER.indexOf(currentTier as TakerTierLevel);\n if (index === -1 || index >= TAKER_TIER_ORDER.length - 1) return null;\n return TAKER_TIER_ORDER[index + 1];\n}\n","import type { Address, Hex } from 'viem';\nimport type { PreparedTransaction } from '../../types/prepared';\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nexport const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as const;\nexport const ZERO_RATE_MANAGER_ID =\n '0x0000000000000000000000000000000000000000000000000000000000000000' as const;\n\n// ---------------------------------------------------------------------------\n// Normalizers\n// ---------------------------------------------------------------------------\n\nexport const normalizeRateManagerId = (value?: string | null): string =>\n (value ?? ZERO_RATE_MANAGER_ID).toLowerCase();\n\nexport const normalizeRegistry = (value?: string | null): string =>\n (value ?? ZERO_ADDRESS).toLowerCase();\n\nexport const isZeroRateManagerId = (value?: string | null): boolean => {\n if (!value) return true;\n const normalized = value.toLowerCase();\n return normalized === ZERO_ADDRESS || normalized === ZERO_RATE_MANAGER_ID;\n};\n\n// ---------------------------------------------------------------------------\n// Error helper\n// ---------------------------------------------------------------------------\n\nexport const asErrorMessage = (error: unknown): string => {\n if (!error) return 'Unknown error';\n if (error instanceof Error) return error.message;\n if (typeof error === 'string') return error;\n\n const anyErr = error as Record<string, unknown>;\n if (typeof anyErr.shortMessage === 'string') return anyErr.shortMessage;\n if (typeof anyErr.details === 'string') return anyErr.details;\n if (typeof anyErr.message === 'string') return anyErr.message;\n\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n};\n\n// ---------------------------------------------------------------------------\n// Delegation state classification\n// ---------------------------------------------------------------------------\n\nexport type DelegationState = 'delegated_here' | 'delegated_elsewhere' | 'not_delegated';\n\n/**\n * Classify whether a deposit is delegated to the target vault, delegated\n * elsewhere, or not delegated at all.\n *\n * @param currentRateManagerId The deposit's current rateManagerId (from indexer)\n * @param currentRegistry The deposit's current rateManagerAddress / registry (from indexer)\n * @param targetRateManagerId The vault's rateManagerId we're comparing against\n * @param targetRegistry The vault's registry address we're comparing against\n */\nexport const classifyDelegationState = (\n currentRateManagerId: string | null | undefined,\n currentRegistry: string | null | undefined,\n targetRateManagerId: string,\n targetRegistry: string | null | undefined,\n): DelegationState => {\n if (isZeroRateManagerId(currentRateManagerId)) {\n return 'not_delegated';\n }\n\n const normalizedCurrent = normalizeRateManagerId(currentRateManagerId);\n const normalizedTarget = targetRateManagerId.toLowerCase();\n const normalizedCurrentRegistry = normalizeRegistry(currentRegistry);\n const normalizedTargetRegistry = targetRegistry ? targetRegistry.toLowerCase() : '';\n\n const idsMatch = normalizedCurrent === normalizedTarget;\n const registryMatches = normalizedTargetRegistry\n ? normalizedCurrentRegistry === normalizedTargetRegistry\n : true;\n\n if (idsMatch && registryMatches) {\n return 'delegated_here';\n }\n\n return 'delegated_elsewhere';\n};\n\nexport const assertAtomicDelegationSwitchSupport = (\n requiresSwitch: boolean,\n canBatch: boolean,\n): void => {\n if (!requiresSwitch || canBatch) return;\n throw new Error(\n 'Switching delegation targets requires smart-account batching. Clear the existing delegation first.',\n );\n};\n\n// ---------------------------------------------------------------------------\n// Contract routing\n// ---------------------------------------------------------------------------\n\nexport type DelegationRoute = 'v2';\n\nexport const getDelegationRoute = (_client: unknown, _escrow: Address): DelegationRoute => 'v2';\n\ntype DelegationMethodSupportClient = Partial<\n Record<'setRateManager' | 'clearRateManager', { prepare?: unknown }>\n>;\n\nexport const assertDelegationMethodSupport = (\n client: DelegationMethodSupportClient,\n _route: DelegationRoute,\n action: 'set' | 'clear',\n): void => {\n const method = action === 'set' ? 'setRateManager' : 'clearRateManager';\n if (client?.[method]?.prepare) return;\n throw new Error(`Delegation requires SDK ${method} support`);\n};\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface DelegationDepositTarget {\n compositeDepositId: string;\n escrow: Address;\n depositId: bigint;\n currentRateManagerId?: string | null;\n currentRateManagerRegistry?: string | null;\n}\n\nexport interface BatchResult {\n hashes: string[];\n failed: Array<{ compositeDepositId: string; error: string }>;\n}\n\n/**\n * Callback the consumer provides for sending a single prepared transaction.\n * Returns the transaction hash.\n */\nexport type SendTransactionFn = (tx: { to: Address; data: Hex; value?: bigint }) => Promise<string>;\n\n/**\n * Optional callback for batching multiple calls in a single user operation\n * (e.g. via a smart account). If not provided, transactions are sent\n * sequentially via sendTransaction.\n */\nexport type SendBatchFn = (\n txs: Array<{ to: Address; data: Hex; value?: bigint }>,\n) => Promise<string>;\n\n// ---------------------------------------------------------------------------\n// Prepare helpers (used internally by hooks)\n// ---------------------------------------------------------------------------\n\nexport const prepareClearDelegationTx = async (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n client: any,\n params: { escrow: Address; depositId: bigint },\n referrer?: string | string[],\n): Promise<PreparedTransaction> => {\n const route = getDelegationRoute(client, params.escrow);\n assertDelegationMethodSupport(client, route, 'clear');\n return client.clearRateManager.prepare({\n escrowAddress: params.escrow,\n depositId: params.depositId,\n ...(referrer ? { txOverrides: { referrer } } : {}),\n });\n};\n\nexport const prepareSetDelegationTx = async (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n client: any,\n params: {\n escrow: Address;\n depositId: bigint;\n registry: Address;\n rateManagerId: Hex;\n },\n referrer?: string | string[],\n): Promise<PreparedTransaction> => {\n const route = getDelegationRoute(client, params.escrow);\n assertDelegationMethodSupport(client, route, 'set');\n return client.setRateManager.prepare({\n escrowAddress: params.escrow,\n depositId: params.depositId,\n rateManagerAddress: params.registry,\n rateManagerId: params.rateManagerId,\n ...(referrer ? { txOverrides: { referrer } } : {}),\n });\n};\n"]}
|