@zkp2p/sdk 0.1.0-rc.8 → 0.1.0
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 +73 -14
- package/dist/{chunk-6YLLNF6Q.mjs → chunk-JH74HXTS.mjs} +103 -11
- package/dist/chunk-JH74HXTS.mjs.map +1 -0
- package/dist/{chunk-456CSWDT.mjs → chunk-YLITJ7SI.mjs} +2 -2
- package/dist/{chunk-456CSWDT.mjs.map → chunk-YLITJ7SI.mjs.map} +1 -1
- package/dist/{chunk-PQQWQF3C.mjs → chunk-ZFBH4HD7.mjs} +10 -4
- package/dist/chunk-ZFBH4HD7.mjs.map +1 -0
- package/dist/{currency-5RZ6VCEA.mjs → currency-PKI2EGJD.mjs} +3 -4
- package/dist/{currency-5RZ6VCEA.mjs.map → currency-PKI2EGJD.mjs.map} +1 -1
- package/dist/index.cjs +3152 -5150
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +73 -34
- package/dist/index.d.ts +73 -34
- package/dist/index.mjs +2553 -1604
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-QVG4JP23.mjs +4 -0
- package/dist/{protocolViewerParsers-EUBHHIPL.mjs.map → protocolViewerParsers-QVG4JP23.mjs.map} +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.mjs +2 -2
- package/dist/{vaultUtils-CZKrvm9v.d.mts → vaultUtils-J1WboG1T.d.mts} +123 -228
- package/dist/{vaultUtils-CZKrvm9v.d.ts → vaultUtils-J1WboG1T.d.ts} +123 -228
- package/package.json +10 -3
- package/dist/chunk-37HJPVJE.mjs +0 -11
- package/dist/chunk-37HJPVJE.mjs.map +0 -1
- package/dist/chunk-6YLLNF6Q.mjs.map +0 -1
- package/dist/chunk-E5SYWOUK.mjs +0 -231
- package/dist/chunk-E5SYWOUK.mjs.map +0 -1
- package/dist/chunk-F7USDS7O.mjs +0 -408
- package/dist/chunk-F7USDS7O.mjs.map +0 -1
- package/dist/chunk-PQQWQF3C.mjs.map +0 -1
- package/dist/constants-YK56UVLH.mjs +0 -5
- package/dist/constants-YK56UVLH.mjs.map +0 -1
- package/dist/paymentResolution-3TC4HRHU.mjs +0 -4
- package/dist/paymentResolution-3TC4HRHU.mjs.map +0 -1
- package/dist/protocolViewerParsers-EUBHHIPL.mjs +0 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-
|
|
2
|
-
export {
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-J1WboG1T.mjs';
|
|
2
|
+
export { m as ActionCallback, O as ApiDeposit, a1 as ApiIntentStatus, A as AuthorizationTokenProvider, bt as BatchResult, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, aX as Currency, b2 as CurrencyData, bs as DelegationDepositTarget, bq as DelegationRoute, br as DelegationState, be as Deposit, bg as DepositCurrency, ae as DepositIntentStatistics, Y as DepositStatus, U as DepositVerifier, X as DepositVerifierCurrency, ab as DepositVerifierData, bd as DepositView, K as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, _ as GetDepositByIdRequest, $ as GetDepositByIdResponse, a6 as GetIntentByHashRequest, a7 as GetIntentByHashResponse, a4 as GetIntentsByDepositRequest, a5 as GetIntentsByDepositResponse, u as GetNearbyQuote, v as GetNearbySuggestions, a2 as GetOwnerIntentsRequest, a3 as GetOwnerIntentsResponse, w as GetQuoteResponse, x as GetQuoteResponseObject, y as GetQuoteSingleResponse, b7 as HISTORICAL_ESCROW_ADDRESSES, ak as IndexerClient, aR as IndexerDeploymentEnv, ap as IndexerDeposit, aG as IndexerDepositDailySnapshot, aI as IndexerDepositFilter, aF as IndexerDepositFundActivity, aH as IndexerDepositFundActivityType, aL as IndexerDepositOrderDirection, aK as IndexerDepositOrderField, aJ as IndexerDepositPagination, as as IndexerDepositPaymentMethod, am as IndexerDepositService, aU as IndexerFulfillmentAndPaymentResponse, aS as IndexerFulfillmentRecord, aq as IndexerIntentFulfilled, ar as IndexerIntentFulfillmentAmounts, au as IndexerIntentStatus, ay as IndexerManagerAggregateStats, aA as IndexerManagerDailySnapshot, az as IndexerManagerStats, aD as IndexerManualRateUpdate, at as IndexerMethodCurrency, aE as IndexerOracleConfigUpdate, aT as IndexerPaymentVerifiedRecord, av as IndexerRateManager, ax as IndexerRateManagerDelegation, aO as IndexerRateManagerDelegationPagination, aC as IndexerRateManagerDetail, aM as IndexerRateManagerFilter, aB as IndexerRateManagerListItem, aQ as IndexerRateManagerOrderDirection, aP as IndexerRateManagerOrderField, aN as IndexerRateManagerPagination, aw as IndexerRateManagerRate, an as IndexerRateManagerService, a0 as Intent, bi as IntentView, N as NearbyQuote, M as NearbySuggestions, Z as OfframpClient, aa as OnchainCurrency, bj as OnchainIntent, ad as OrderStats, aV as PAYMENT_PLATFORMS, bf as PaymentMethodData, aW as PaymentPlatformType, ai as PlatformLimit, aj as PlatformRiskLevel, ac as PreparedTransaction, J as QuoteFeesResponse, H as QuoteIntentResponse, Q as QuoteRequest, z as QuoteResponse, B as QuoteResponseObject, E as QuoteSingleResponse, p as Range, bh as ReferralFee, a8 as RegisterPayeeDetailsRequest, a9 as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, b8 as RuntimeEnv, bv as SendBatchFn, bu as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, af as TakerTier, ah as TakerTierLevel, ag as TakerTierStats, l as TimeoutConfig, L as TokenResponse, W as WithdrawDepositParams, bk as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bp as classifyDelegationState, aY as currencyInfo, al as defaultIndexerEndpoint, bb as enrichPvDepositView, bc as enrichPvIntentView, ao as fetchIndexerFulfillmentAndPayment, b3 as getContracts, a$ as getCurrencyCodeFromHash, a_ as getCurrencyInfoFromCountryCode, aZ as getCurrencyInfoFromHash, bo as getDelegationRoute, b6 as getGatingServiceAddress, b5 as getPaymentMethodsCatalog, b4 as getRateManagerContracts, b0 as isSupportedCurrencyHash, bl as isZeroRateManagerId, b1 as mapConversionRatesToOnchainMinRate, bm as normalizeRateManagerId, bn as normalizeRegistry, b9 as parseDepositView, ba as parseIntentView } from './vaultUtils-J1WboG1T.mjs';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
|
+
import '@zkp2p/indexer-schema';
|
|
5
6
|
|
|
6
7
|
interface EscrowRange {
|
|
7
8
|
min: bigint;
|
|
@@ -61,6 +62,12 @@ interface EscrowIntentView {
|
|
|
61
62
|
deposit: EscrowDepositView;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
declare const isValidReferrerFeeRecipient: (value: string) => value is `0x${string}`;
|
|
66
|
+
declare const isValidReferrerFeeBps: (value: number) => boolean;
|
|
67
|
+
declare const assertValidReferrerFeeConfig: (config: ReferrerFeeConfig | undefined, context: "getQuote" | "signalIntent") => ReferrerFeeConfig | undefined;
|
|
68
|
+
declare const parseReferrerFeeConfig: (recipient: string | null | undefined, feeBpsValue: string | number | null | undefined) => ReferrerFeeConfig | null;
|
|
69
|
+
declare const referrerFeeConfigToPreciseUnits: (config: ReferrerFeeConfig) => bigint;
|
|
70
|
+
|
|
64
71
|
interface EscrowContractContext {
|
|
65
72
|
address: Address;
|
|
66
73
|
abi: Abi;
|
|
@@ -130,29 +137,32 @@ declare class ContractRouter {
|
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
type PeerConnectionStatus = 'connected' | 'disconnected' | 'pending';
|
|
133
|
-
type
|
|
134
|
-
type
|
|
135
|
-
intentHash: string
|
|
136
|
-
status:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
type PeerIntentFulfilledBridgeStatus = 'not_required' | 'pending';
|
|
141
|
+
type PeerIntentFulfilledResult = {
|
|
142
|
+
intentHash: `0x${string}`;
|
|
143
|
+
status: 'fulfilled';
|
|
144
|
+
fulfillTxHash: `0x${string}`;
|
|
145
|
+
recipientAddress: string | null;
|
|
146
|
+
destinationToken: string | null;
|
|
147
|
+
bridge: {
|
|
148
|
+
required: boolean;
|
|
149
|
+
status: PeerIntentFulfilledBridgeStatus;
|
|
150
|
+
trackingUrl?: string | null;
|
|
151
|
+
txHashes?: Array<{
|
|
152
|
+
txHash: `0x${string}`;
|
|
153
|
+
chainId: number;
|
|
154
|
+
}>;
|
|
155
|
+
outputAmount?: string | null;
|
|
156
|
+
expectedOutputAmount?: string | null;
|
|
147
157
|
};
|
|
148
158
|
};
|
|
149
|
-
type
|
|
159
|
+
type PeerIntentFulfilledCallback = (result: PeerIntentFulfilledResult) => void;
|
|
150
160
|
type PeerExtensionApi = {
|
|
151
161
|
requestConnection(): Promise<boolean>;
|
|
152
162
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
153
163
|
openSidebar(route: string): void;
|
|
154
164
|
onramp(queryString: string): void;
|
|
155
|
-
|
|
165
|
+
onIntentFulfilled(callback: PeerIntentFulfilledCallback): () => void;
|
|
156
166
|
getVersion(): Promise<string>;
|
|
157
167
|
};
|
|
158
168
|
type PeerExtensionOnrampParams = {
|
|
@@ -164,7 +174,6 @@ type PeerExtensionOnrampParams = {
|
|
|
164
174
|
toToken?: string;
|
|
165
175
|
amountUsdc?: string | number | bigint;
|
|
166
176
|
recipientAddress?: string;
|
|
167
|
-
callbackUrl?: string;
|
|
168
177
|
intentHash?: string;
|
|
169
178
|
};
|
|
170
179
|
type PeerExtensionWindow = Window & {
|
|
@@ -178,7 +187,7 @@ type PeerExtensionSdk = {
|
|
|
178
187
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
179
188
|
openSidebar(route: string): void;
|
|
180
189
|
onramp(params?: PeerExtensionOnrampParams): void;
|
|
181
|
-
|
|
190
|
+
onIntentFulfilled(callback: PeerIntentFulfilledCallback): () => void;
|
|
182
191
|
getVersion(): Promise<string>;
|
|
183
192
|
isAvailable(): boolean;
|
|
184
193
|
openInstallPage(): void;
|
|
@@ -204,20 +213,42 @@ declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: strin
|
|
|
204
213
|
/**
|
|
205
214
|
* Get taker tier information for a specific address.
|
|
206
215
|
*/
|
|
207
|
-
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string,
|
|
216
|
+
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string, timeoutMs?: number): Promise<GetTakerTierResponse>;
|
|
208
217
|
|
|
218
|
+
/** Minimal interface for the publicClient parameter, avoids viem version coupling. */
|
|
219
|
+
interface MulticallClient {
|
|
220
|
+
multicall(args: {
|
|
221
|
+
contracts: ReadonlyArray<{
|
|
222
|
+
address: Address;
|
|
223
|
+
abi: readonly unknown[];
|
|
224
|
+
functionName: string;
|
|
225
|
+
args: readonly unknown[];
|
|
226
|
+
}>;
|
|
227
|
+
allowFailure: true;
|
|
228
|
+
}): Promise<ReadonlyArray<{
|
|
229
|
+
status: 'success' | 'failure';
|
|
230
|
+
result?: unknown;
|
|
231
|
+
error?: unknown;
|
|
232
|
+
}>>;
|
|
233
|
+
}
|
|
209
234
|
/**
|
|
210
235
|
* Chainlink adapter currently used by V2.2 oracle floor configs.
|
|
211
236
|
*/
|
|
212
237
|
declare const CHAINLINK_ORACLE_ADAPTER: "0xfc81d1b5841e697973af3072fc8e03af76cb39ef";
|
|
213
238
|
/**
|
|
214
|
-
*
|
|
239
|
+
* Deprecated: retained for SDK compatibility after contracts-v2 rc.12 removed
|
|
240
|
+
* Pyth feed metadata from the package.
|
|
215
241
|
*/
|
|
216
242
|
declare const PYTH_ORACLE_ADAPTER: "0xaa2bBDa3072bD37af76613846268Ec48bd0bB885";
|
|
217
243
|
/**
|
|
218
244
|
* Default max staleness window for oracle-backed floors.
|
|
219
245
|
*/
|
|
220
246
|
declare const DEFAULT_ORACLE_MAX_STALENESS_SECONDS = 86400;
|
|
247
|
+
/**
|
|
248
|
+
* Deprecated: retained for SDK compatibility after contracts-v2 rc.12 removed
|
|
249
|
+
* Pyth feed metadata from the package.
|
|
250
|
+
*/
|
|
251
|
+
declare const PYTH_CONTRACT_BASE: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C";
|
|
221
252
|
type OracleKind = 'oracle_chainlink' | 'oracle_pyth';
|
|
222
253
|
type SpreadOracleFeedConfig = {
|
|
223
254
|
feed: Address;
|
|
@@ -246,30 +277,38 @@ type SpreadOracleConfig = {
|
|
|
246
277
|
};
|
|
247
278
|
/**
|
|
248
279
|
* Currency -> Chainlink feed mapping used for spread/floor configuration.
|
|
249
|
-
*
|
|
250
|
-
* Feed pairs are quoted as <FIAT>/USD, so non-USD currencies use invert=true
|
|
251
|
-
* to derive fiat-per-USDC rates from USD-denominated feeds.
|
|
280
|
+
* Sourced from @zkp2p/contracts-v2/oracleFeeds/chainlink.json.
|
|
252
281
|
*/
|
|
253
282
|
declare const CHAINLINK_ORACLE_FEEDS: Partial<Record<CurrencyType, SpreadOracleFeedConfig>>;
|
|
254
283
|
/** @deprecated Use CHAINLINK_ORACLE_FEEDS instead. */
|
|
255
284
|
declare const SPREAD_ORACLE_FEEDS: Partial<Record<CurrencyType, SpreadOracleFeedConfig>>;
|
|
256
285
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* - XXX/USD feeds (EUR, GBP, AUD, NZD): invert=true on-chain to derive USD/XXX.
|
|
261
|
-
* - USD/XXX feeds (JPY, CAD, etc.): invert=false — already in desired direction.
|
|
262
|
-
*
|
|
263
|
-
* Verified active on Hermes 2026-03-03.
|
|
286
|
+
* Deprecated: contracts-v2 rc.12 no longer ships Pyth feed metadata, so this
|
|
287
|
+
* now remains empty and currencies without Chainlink feeds fall back to
|
|
288
|
+
* fixed-rate behavior.
|
|
264
289
|
*/
|
|
265
290
|
declare const PYTH_ORACLE_FEEDS: Partial<Record<CurrencyType, PythFeedConfig>>;
|
|
266
291
|
declare function encodeSpreadOracleAdapterConfig(config: SpreadOracleFeedConfig): Hex;
|
|
292
|
+
/**
|
|
293
|
+
* Deprecated: retained for SDK consumers that still build custom Pyth configs.
|
|
294
|
+
*/
|
|
267
295
|
declare function encodePythAdapterConfig(config: PythFeedConfig): Hex;
|
|
268
296
|
interface OracleAdapterOverrides {
|
|
269
297
|
chainlinkOracleAdapter?: Address;
|
|
270
298
|
pythOracleAdapter?: Address;
|
|
271
299
|
}
|
|
272
300
|
declare function getSpreadOracleConfig(currency: CurrencyType, adapters?: OracleAdapterOverrides): SpreadOracleConfig | null;
|
|
301
|
+
/**
|
|
302
|
+
* Validates which oracle feeds are actually live on-chain.
|
|
303
|
+
*
|
|
304
|
+
* - Chainlink: calls `latestRoundData()` on each feed contract.
|
|
305
|
+
* - USD passthrough (zero-address Chainlink) is always included.
|
|
306
|
+
*
|
|
307
|
+
* Returns the set of CurrencyType values with working on-chain feeds.
|
|
308
|
+
* Currencies that `getSpreadOracleConfig` would resolve are only
|
|
309
|
+
* considered available if they pass this check.
|
|
310
|
+
*/
|
|
311
|
+
declare function validateOracleFeedsOnChain(publicClient: MulticallClient, _pythContract?: Address): Promise<Set<CurrencyType>>;
|
|
273
312
|
|
|
274
313
|
/**
|
|
275
314
|
* SDK Constants
|
|
@@ -451,7 +490,7 @@ declare function resolveFiatCurrencyBytes32(codeOrBytes: string): `0x${string}`;
|
|
|
451
490
|
* with on-chain registrations.
|
|
452
491
|
*
|
|
453
492
|
* If the processor is not found in the catalog, falls back to the known
|
|
454
|
-
* payment method hashes
|
|
493
|
+
* protocol payment method hashes before throwing an error.
|
|
455
494
|
*
|
|
456
495
|
* @param processorName - Payment platform name ('wise', 'revolut', etc.)
|
|
457
496
|
* @param catalog - Payment method catalog from `getPaymentMethodsCatalog()`
|
|
@@ -673,4 +712,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
673
712
|
constructor(message: string, details?: unknown);
|
|
674
713
|
}
|
|
675
714
|
|
|
676
|
-
export { APIError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type
|
|
715
|
+
export { APIError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, type MulticallClient, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerIntentFulfilledBridgeStatus, type PeerIntentFulfilledCallback, type PeerIntentFulfilledResult, PostDepositDetailsRequest, PostDepositDetailsResponse, type PythFeedConfig, ReferrerFeeConfig, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-
|
|
2
|
-
export {
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-J1WboG1T.js';
|
|
2
|
+
export { m as ActionCallback, O as ApiDeposit, a1 as ApiIntentStatus, A as AuthorizationTokenProvider, bt as BatchResult, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, aX as Currency, b2 as CurrencyData, bs as DelegationDepositTarget, bq as DelegationRoute, br as DelegationState, be as Deposit, bg as DepositCurrency, ae as DepositIntentStatistics, Y as DepositStatus, U as DepositVerifier, X as DepositVerifierCurrency, ab as DepositVerifierData, bd as DepositView, K as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, _ as GetDepositByIdRequest, $ as GetDepositByIdResponse, a6 as GetIntentByHashRequest, a7 as GetIntentByHashResponse, a4 as GetIntentsByDepositRequest, a5 as GetIntentsByDepositResponse, u as GetNearbyQuote, v as GetNearbySuggestions, a2 as GetOwnerIntentsRequest, a3 as GetOwnerIntentsResponse, w as GetQuoteResponse, x as GetQuoteResponseObject, y as GetQuoteSingleResponse, b7 as HISTORICAL_ESCROW_ADDRESSES, ak as IndexerClient, aR as IndexerDeploymentEnv, ap as IndexerDeposit, aG as IndexerDepositDailySnapshot, aI as IndexerDepositFilter, aF as IndexerDepositFundActivity, aH as IndexerDepositFundActivityType, aL as IndexerDepositOrderDirection, aK as IndexerDepositOrderField, aJ as IndexerDepositPagination, as as IndexerDepositPaymentMethod, am as IndexerDepositService, aU as IndexerFulfillmentAndPaymentResponse, aS as IndexerFulfillmentRecord, aq as IndexerIntentFulfilled, ar as IndexerIntentFulfillmentAmounts, au as IndexerIntentStatus, ay as IndexerManagerAggregateStats, aA as IndexerManagerDailySnapshot, az as IndexerManagerStats, aD as IndexerManualRateUpdate, at as IndexerMethodCurrency, aE as IndexerOracleConfigUpdate, aT as IndexerPaymentVerifiedRecord, av as IndexerRateManager, ax as IndexerRateManagerDelegation, aO as IndexerRateManagerDelegationPagination, aC as IndexerRateManagerDetail, aM as IndexerRateManagerFilter, aB as IndexerRateManagerListItem, aQ as IndexerRateManagerOrderDirection, aP as IndexerRateManagerOrderField, aN as IndexerRateManagerPagination, aw as IndexerRateManagerRate, an as IndexerRateManagerService, a0 as Intent, bi as IntentView, N as NearbyQuote, M as NearbySuggestions, Z as OfframpClient, aa as OnchainCurrency, bj as OnchainIntent, ad as OrderStats, aV as PAYMENT_PLATFORMS, bf as PaymentMethodData, aW as PaymentPlatformType, ai as PlatformLimit, aj as PlatformRiskLevel, ac as PreparedTransaction, J as QuoteFeesResponse, H as QuoteIntentResponse, Q as QuoteRequest, z as QuoteResponse, B as QuoteResponseObject, E as QuoteSingleResponse, p as Range, bh as ReferralFee, a8 as RegisterPayeeDetailsRequest, a9 as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, b8 as RuntimeEnv, bv as SendBatchFn, bu as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, af as TakerTier, ah as TakerTierLevel, ag as TakerTierStats, l as TimeoutConfig, L as TokenResponse, W as WithdrawDepositParams, bk as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bp as classifyDelegationState, aY as currencyInfo, al as defaultIndexerEndpoint, bb as enrichPvDepositView, bc as enrichPvIntentView, ao as fetchIndexerFulfillmentAndPayment, b3 as getContracts, a$ as getCurrencyCodeFromHash, a_ as getCurrencyInfoFromCountryCode, aZ as getCurrencyInfoFromHash, bo as getDelegationRoute, b6 as getGatingServiceAddress, b5 as getPaymentMethodsCatalog, b4 as getRateManagerContracts, b0 as isSupportedCurrencyHash, bl as isZeroRateManagerId, b1 as mapConversionRatesToOnchainMinRate, bm as normalizeRateManagerId, bn as normalizeRegistry, b9 as parseDepositView, ba as parseIntentView } from './vaultUtils-J1WboG1T.js';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
|
+
import '@zkp2p/indexer-schema';
|
|
5
6
|
|
|
6
7
|
interface EscrowRange {
|
|
7
8
|
min: bigint;
|
|
@@ -61,6 +62,12 @@ interface EscrowIntentView {
|
|
|
61
62
|
deposit: EscrowDepositView;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
declare const isValidReferrerFeeRecipient: (value: string) => value is `0x${string}`;
|
|
66
|
+
declare const isValidReferrerFeeBps: (value: number) => boolean;
|
|
67
|
+
declare const assertValidReferrerFeeConfig: (config: ReferrerFeeConfig | undefined, context: "getQuote" | "signalIntent") => ReferrerFeeConfig | undefined;
|
|
68
|
+
declare const parseReferrerFeeConfig: (recipient: string | null | undefined, feeBpsValue: string | number | null | undefined) => ReferrerFeeConfig | null;
|
|
69
|
+
declare const referrerFeeConfigToPreciseUnits: (config: ReferrerFeeConfig) => bigint;
|
|
70
|
+
|
|
64
71
|
interface EscrowContractContext {
|
|
65
72
|
address: Address;
|
|
66
73
|
abi: Abi;
|
|
@@ -130,29 +137,32 @@ declare class ContractRouter {
|
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
type PeerConnectionStatus = 'connected' | 'disconnected' | 'pending';
|
|
133
|
-
type
|
|
134
|
-
type
|
|
135
|
-
intentHash: string
|
|
136
|
-
status:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
type PeerIntentFulfilledBridgeStatus = 'not_required' | 'pending';
|
|
141
|
+
type PeerIntentFulfilledResult = {
|
|
142
|
+
intentHash: `0x${string}`;
|
|
143
|
+
status: 'fulfilled';
|
|
144
|
+
fulfillTxHash: `0x${string}`;
|
|
145
|
+
recipientAddress: string | null;
|
|
146
|
+
destinationToken: string | null;
|
|
147
|
+
bridge: {
|
|
148
|
+
required: boolean;
|
|
149
|
+
status: PeerIntentFulfilledBridgeStatus;
|
|
150
|
+
trackingUrl?: string | null;
|
|
151
|
+
txHashes?: Array<{
|
|
152
|
+
txHash: `0x${string}`;
|
|
153
|
+
chainId: number;
|
|
154
|
+
}>;
|
|
155
|
+
outputAmount?: string | null;
|
|
156
|
+
expectedOutputAmount?: string | null;
|
|
147
157
|
};
|
|
148
158
|
};
|
|
149
|
-
type
|
|
159
|
+
type PeerIntentFulfilledCallback = (result: PeerIntentFulfilledResult) => void;
|
|
150
160
|
type PeerExtensionApi = {
|
|
151
161
|
requestConnection(): Promise<boolean>;
|
|
152
162
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
153
163
|
openSidebar(route: string): void;
|
|
154
164
|
onramp(queryString: string): void;
|
|
155
|
-
|
|
165
|
+
onIntentFulfilled(callback: PeerIntentFulfilledCallback): () => void;
|
|
156
166
|
getVersion(): Promise<string>;
|
|
157
167
|
};
|
|
158
168
|
type PeerExtensionOnrampParams = {
|
|
@@ -164,7 +174,6 @@ type PeerExtensionOnrampParams = {
|
|
|
164
174
|
toToken?: string;
|
|
165
175
|
amountUsdc?: string | number | bigint;
|
|
166
176
|
recipientAddress?: string;
|
|
167
|
-
callbackUrl?: string;
|
|
168
177
|
intentHash?: string;
|
|
169
178
|
};
|
|
170
179
|
type PeerExtensionWindow = Window & {
|
|
@@ -178,7 +187,7 @@ type PeerExtensionSdk = {
|
|
|
178
187
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
179
188
|
openSidebar(route: string): void;
|
|
180
189
|
onramp(params?: PeerExtensionOnrampParams): void;
|
|
181
|
-
|
|
190
|
+
onIntentFulfilled(callback: PeerIntentFulfilledCallback): () => void;
|
|
182
191
|
getVersion(): Promise<string>;
|
|
183
192
|
isAvailable(): boolean;
|
|
184
193
|
openInstallPage(): void;
|
|
@@ -204,20 +213,42 @@ declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: strin
|
|
|
204
213
|
/**
|
|
205
214
|
* Get taker tier information for a specific address.
|
|
206
215
|
*/
|
|
207
|
-
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string,
|
|
216
|
+
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string, timeoutMs?: number): Promise<GetTakerTierResponse>;
|
|
208
217
|
|
|
218
|
+
/** Minimal interface for the publicClient parameter, avoids viem version coupling. */
|
|
219
|
+
interface MulticallClient {
|
|
220
|
+
multicall(args: {
|
|
221
|
+
contracts: ReadonlyArray<{
|
|
222
|
+
address: Address;
|
|
223
|
+
abi: readonly unknown[];
|
|
224
|
+
functionName: string;
|
|
225
|
+
args: readonly unknown[];
|
|
226
|
+
}>;
|
|
227
|
+
allowFailure: true;
|
|
228
|
+
}): Promise<ReadonlyArray<{
|
|
229
|
+
status: 'success' | 'failure';
|
|
230
|
+
result?: unknown;
|
|
231
|
+
error?: unknown;
|
|
232
|
+
}>>;
|
|
233
|
+
}
|
|
209
234
|
/**
|
|
210
235
|
* Chainlink adapter currently used by V2.2 oracle floor configs.
|
|
211
236
|
*/
|
|
212
237
|
declare const CHAINLINK_ORACLE_ADAPTER: "0xfc81d1b5841e697973af3072fc8e03af76cb39ef";
|
|
213
238
|
/**
|
|
214
|
-
*
|
|
239
|
+
* Deprecated: retained for SDK compatibility after contracts-v2 rc.12 removed
|
|
240
|
+
* Pyth feed metadata from the package.
|
|
215
241
|
*/
|
|
216
242
|
declare const PYTH_ORACLE_ADAPTER: "0xaa2bBDa3072bD37af76613846268Ec48bd0bB885";
|
|
217
243
|
/**
|
|
218
244
|
* Default max staleness window for oracle-backed floors.
|
|
219
245
|
*/
|
|
220
246
|
declare const DEFAULT_ORACLE_MAX_STALENESS_SECONDS = 86400;
|
|
247
|
+
/**
|
|
248
|
+
* Deprecated: retained for SDK compatibility after contracts-v2 rc.12 removed
|
|
249
|
+
* Pyth feed metadata from the package.
|
|
250
|
+
*/
|
|
251
|
+
declare const PYTH_CONTRACT_BASE: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C";
|
|
221
252
|
type OracleKind = 'oracle_chainlink' | 'oracle_pyth';
|
|
222
253
|
type SpreadOracleFeedConfig = {
|
|
223
254
|
feed: Address;
|
|
@@ -246,30 +277,38 @@ type SpreadOracleConfig = {
|
|
|
246
277
|
};
|
|
247
278
|
/**
|
|
248
279
|
* Currency -> Chainlink feed mapping used for spread/floor configuration.
|
|
249
|
-
*
|
|
250
|
-
* Feed pairs are quoted as <FIAT>/USD, so non-USD currencies use invert=true
|
|
251
|
-
* to derive fiat-per-USDC rates from USD-denominated feeds.
|
|
280
|
+
* Sourced from @zkp2p/contracts-v2/oracleFeeds/chainlink.json.
|
|
252
281
|
*/
|
|
253
282
|
declare const CHAINLINK_ORACLE_FEEDS: Partial<Record<CurrencyType, SpreadOracleFeedConfig>>;
|
|
254
283
|
/** @deprecated Use CHAINLINK_ORACLE_FEEDS instead. */
|
|
255
284
|
declare const SPREAD_ORACLE_FEEDS: Partial<Record<CurrencyType, SpreadOracleFeedConfig>>;
|
|
256
285
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* - XXX/USD feeds (EUR, GBP, AUD, NZD): invert=true on-chain to derive USD/XXX.
|
|
261
|
-
* - USD/XXX feeds (JPY, CAD, etc.): invert=false — already in desired direction.
|
|
262
|
-
*
|
|
263
|
-
* Verified active on Hermes 2026-03-03.
|
|
286
|
+
* Deprecated: contracts-v2 rc.12 no longer ships Pyth feed metadata, so this
|
|
287
|
+
* now remains empty and currencies without Chainlink feeds fall back to
|
|
288
|
+
* fixed-rate behavior.
|
|
264
289
|
*/
|
|
265
290
|
declare const PYTH_ORACLE_FEEDS: Partial<Record<CurrencyType, PythFeedConfig>>;
|
|
266
291
|
declare function encodeSpreadOracleAdapterConfig(config: SpreadOracleFeedConfig): Hex;
|
|
292
|
+
/**
|
|
293
|
+
* Deprecated: retained for SDK consumers that still build custom Pyth configs.
|
|
294
|
+
*/
|
|
267
295
|
declare function encodePythAdapterConfig(config: PythFeedConfig): Hex;
|
|
268
296
|
interface OracleAdapterOverrides {
|
|
269
297
|
chainlinkOracleAdapter?: Address;
|
|
270
298
|
pythOracleAdapter?: Address;
|
|
271
299
|
}
|
|
272
300
|
declare function getSpreadOracleConfig(currency: CurrencyType, adapters?: OracleAdapterOverrides): SpreadOracleConfig | null;
|
|
301
|
+
/**
|
|
302
|
+
* Validates which oracle feeds are actually live on-chain.
|
|
303
|
+
*
|
|
304
|
+
* - Chainlink: calls `latestRoundData()` on each feed contract.
|
|
305
|
+
* - USD passthrough (zero-address Chainlink) is always included.
|
|
306
|
+
*
|
|
307
|
+
* Returns the set of CurrencyType values with working on-chain feeds.
|
|
308
|
+
* Currencies that `getSpreadOracleConfig` would resolve are only
|
|
309
|
+
* considered available if they pass this check.
|
|
310
|
+
*/
|
|
311
|
+
declare function validateOracleFeedsOnChain(publicClient: MulticallClient, _pythContract?: Address): Promise<Set<CurrencyType>>;
|
|
273
312
|
|
|
274
313
|
/**
|
|
275
314
|
* SDK Constants
|
|
@@ -451,7 +490,7 @@ declare function resolveFiatCurrencyBytes32(codeOrBytes: string): `0x${string}`;
|
|
|
451
490
|
* with on-chain registrations.
|
|
452
491
|
*
|
|
453
492
|
* If the processor is not found in the catalog, falls back to the known
|
|
454
|
-
* payment method hashes
|
|
493
|
+
* protocol payment method hashes before throwing an error.
|
|
455
494
|
*
|
|
456
495
|
* @param processorName - Payment platform name ('wise', 'revolut', etc.)
|
|
457
496
|
* @param catalog - Payment method catalog from `getPaymentMethodsCatalog()`
|
|
@@ -673,4 +712,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
673
712
|
constructor(message: string, details?: unknown);
|
|
674
713
|
}
|
|
675
714
|
|
|
676
|
-
export { APIError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type
|
|
715
|
+
export { APIError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, type MulticallClient, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerIntentFulfilledBridgeStatus, type PeerIntentFulfilledCallback, type PeerIntentFulfilledResult, PostDepositDetailsRequest, PostDepositDetailsResponse, type PythFeedConfig, ReferrerFeeConfig, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|