@zkp2p/sdk 0.3.1 → 0.3.2
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 +2 -2
- package/dist/chunk-J5LGTIGS.mjs +9 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/chunk-JRDFLSA7.mjs +40529 -0
- package/dist/chunk-JRDFLSA7.mjs.map +1 -0
- package/dist/{currency-PKI2EGJD.mjs → currency-MARF3D2J.mjs} +3 -2
- package/dist/{currency-PKI2EGJD.mjs.map → currency-MARF3D2J.mjs.map} +1 -1
- package/dist/index.cjs +40838 -178
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.mjs +311 -14
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-CQSES3QX.mjs +5 -0
- package/dist/{protocolViewerParsers-TPB47QOH.mjs.map → protocolViewerParsers-CQSES3QX.mjs.map} +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +1 -0
- package/dist/react.mjs.map +1 -1
- package/dist/{timeout-QB7K5SOB.mjs → timeout-YLP3WHZF.mjs} +3 -2
- package/dist/timeout-YLP3WHZF.mjs.map +1 -0
- package/dist/{vaultUtils-DATqc35J.d.mts → vaultUtils-C-9Z50Ak.d.mts} +495 -45
- package/dist/{vaultUtils-DATqc35J.d.ts → vaultUtils-C-9Z50Ak.d.ts} +495 -45
- package/package.json +1 -1
- package/dist/chunk-AXX3QCRW.mjs +0 -522
- package/dist/chunk-AXX3QCRW.mjs.map +0 -1
- package/dist/protocolViewerParsers-TPB47QOH.mjs +0 -4
- package/dist/timeout-QB7K5SOB.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, 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,
|
|
2
|
-
export {
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, 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, h as GetDepositBundleParams, A as ApiAdapterOptions, i as GetDepositBundleResponse, j as GetOrderbookParams, k as GetOrderbookResponse, C as CurrencyType, l as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-C-9Z50Ak.mjs';
|
|
2
|
+
export { r as ActionCallback, a6 as ApiDeposit, ad as ApiIntentStatus, aM as AttestationServiceSellerCredentialProbeResponse, aK as AttestationServiceSellerCredentialUploadResponse, aL as AttestationServiceSellerVerifyResponse, p as AuthorizationTokenProvider, cb as BatchResult, z as BestByPlatformResponseObject, n as CancelIntentMethodParams, y as CancelIntentParams, ar as CashAppCredentialUploadInput, ao as CashAppSessionMaterial, t as CreateDepositConversionRate, s as CreateDepositParams, aO as CuratorSellerCredentialStatusResponse, aN as CuratorSellerCredentialUploadResponse, aP as CuratorSellerVerifyResponse, bG as Currency, bN as CurrencyData, ca as DelegationDepositTarget, c8 as DelegationRoute, c9 as DelegationState, bY as Deposit, b_ as DepositCurrency, aX as DepositIntentStatistics, a9 as DepositStatus, a7 as DepositVerifier, a8 as DepositVerifierCurrency, aU as DepositVerifierData, bX as DepositView, a2 as FiatResponse, F as FulfillIntentMethodParams, w as FulfillIntentParams, E as GetBestByPlatformResponse, H as GetBestByPlatformResponseObject, aa as GetDepositByIdRequest, ab as GetDepositByIdResponse, ai as GetIntentByHashRequest, aj as GetIntentByHashResponse, ag as GetIntentsByDepositRequest, ah as GetIntentsByDepositResponse, M as GetNearbyQuote, N as GetNearbySuggestions, ae as GetOwnerIntentsRequest, af as GetOwnerIntentsResponse, J as GetPlatformQuote, O as GetQuoteResponse, U as GetQuoteResponseObject, X as GetQuoteSingleResponse, aR as GetSellerCredentialStatusParams, b2 as IndexerClient, bA as IndexerDeploymentEnv, b8 as IndexerDeposit, bp as IndexerDepositDailySnapshot, br as IndexerDepositFilter, bo as IndexerDepositFundActivity, bq as IndexerDepositFundActivityType, bu as IndexerDepositOrderDirection, bt as IndexerDepositOrderField, bs as IndexerDepositPagination, bb as IndexerDepositPaymentMethod, b4 as IndexerDepositService, bD as IndexerFulfillmentAndPaymentResponse, bB as IndexerFulfillmentRecord, b9 as IndexerIntentFulfilled, ba as IndexerIntentFulfillmentAmounts, bd as IndexerIntentStatus, bh as IndexerManagerAggregateStats, bj as IndexerManagerDailySnapshot, bi as IndexerManagerStats, bm as IndexerManualRateUpdate, bc as IndexerMethodCurrency, bn as IndexerOracleConfigUpdate, bC as IndexerPaymentVerifiedRecord, be as IndexerRateManager, bg as IndexerRateManagerDelegation, bx as IndexerRateManagerDelegationPagination, bl as IndexerRateManagerDetail, bv as IndexerRateManagerFilter, bk as IndexerRateManagerListItem, bz as IndexerRateManagerOrderDirection, by as IndexerRateManagerOrderField, bw as IndexerRateManagerPagination, bf as IndexerRateManagerRate, b5 as IndexerRateManagerService, ac as Intent, c0 as IntentView, a4 as NearbyQuote, a5 as NearbySuggestions, Z as OfframpClient, aT as OnchainCurrency, c1 as OnchainIntent, aW as OrderStats, b1 as OrderbookEntry, bE as PAYMENT_PLATFORMS, bZ as PaymentMethodData, bF as PaymentPlatformType, a$ as PlatformLimit, K as PlatformQuote, b0 as PlatformRiskLevel, aV as PreparedTransaction, a1 as QuoteFeesResponse, a0 as QuoteIntentResponse, L as QuoteRequest, Y as QuoteResponse, _ as QuoteResponseObject, $ as QuoteSingleResponse, u as Range, b$ as ReferralFee, ak as RegisterPayeeDetailsRequest, al as RegisterPayeeDetailsResponse, x as ReleaseFundsToPayerParams, bS as RuntimeEnv, aI as SellerAttestationOutput, av as SellerCiphertextBundle, aA as SellerCredentialBundle, aB as SellerCredentialBundleUpload, aJ as SellerCredentialProbeResponse, aD as SellerCredentialStatus, aC as SellerCredentialStatusValue, au as SellerCredentialUploadInput, at as SellerCredentialUploadInputByPlatform, aH as SellerPaymentTypedDataValue, am as SellerPlatform, az as SellerProbeInput, aw as SellerSignedCiphertextBundle, aF as SellerTypedDataField, aG as SellerTypedDataSpec, ay as SellerVerifyInput, ax as SellerVerifyIntentDetails, aE as SellerVerifyProxyBody, cd as SendBatchFn, cc as SendTransactionFn, m as SignalIntentMethodParams, v as SignalIntentParams, S as SignalIntentReferralFee, aY as TakerTier, a_ as TakerTierLevel, aZ as TakerTierStats, q as TimeoutConfig, a3 as TokenResponse, aQ as UploadSellerCredentialParams, aq as VenmoCredentialUploadInput, an as VenmoSessionMaterial, aS as VerifySellerPaymentParams, as as WiseCredentialUploadInput, ap as WiseSessionMaterial, W as WithdrawDepositParams, c2 as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, o as Zkp2pClientOptions, c7 as classifyDelegationState, b6 as compareEventCursorIdsByRecency, bH as currencyInfo, b3 as defaultIndexerEndpoint, bV as enrichPvDepositView, bW as enrichPvIntentView, b7 as fetchIndexerFulfillmentAndPayment, bO as getContracts, bK as getCurrencyCodeFromHash, bJ as getCurrencyInfoFromCountryCode, bI as getCurrencyInfoFromHash, c6 as getDelegationRoute, bR as getGatingServiceAddress, bQ as getPaymentMethodsCatalog, bP as getRateManagerContracts, bL as isSupportedCurrencyHash, c3 as isZeroRateManagerId, bM as mapConversionRatesToOnchainMinRate, c4 as normalizeRateManagerId, c5 as normalizeRegistry, bT as parseDepositView, bU as parseIntentView } from './vaultUtils-C-9Z50Ak.mjs';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
|
@@ -207,6 +207,10 @@ declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: strin
|
|
|
207
207
|
* Get taker tier information for a specific address.
|
|
208
208
|
*/
|
|
209
209
|
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string, timeoutMs?: number): Promise<GetTakerTierResponse>;
|
|
210
|
+
declare function apiGetOrderbook(params: GetOrderbookParams, opts: ApiAdapterOptions): Promise<GetOrderbookResponse>;
|
|
211
|
+
declare function apiGetOrderbook(params: GetOrderbookParams, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<GetOrderbookResponse>;
|
|
212
|
+
declare function apiGetDepositBundle(params: GetDepositBundleParams, opts: ApiAdapterOptions): Promise<GetDepositBundleResponse>;
|
|
213
|
+
declare function apiGetDepositBundle(params: GetDepositBundleParams, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<GetDepositBundleResponse>;
|
|
210
214
|
|
|
211
215
|
/** Minimal interface for the publicClient parameter, avoids viem version coupling. */
|
|
212
216
|
interface MulticallClient {
|
|
@@ -705,4 +709,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
705
709
|
constructor(message: string, details?: unknown);
|
|
706
710
|
}
|
|
707
711
|
|
|
708
|
-
export { APIError, BASE_BUILDER_CODE, BestByPlatformResponse, 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, QuotesBestByPlatformRequest, 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, apiGetQuotesBestByPlatform, 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 };
|
|
712
|
+
export { APIError, ApiAdapterOptions, BASE_BUILDER_CODE, BestByPlatformResponse, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetDepositBundleParams, GetDepositBundleResponse, GetOrderbookParams, GetOrderbookResponse, 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, QuotesBestByPlatformRequest, 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, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, 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,5 +1,5 @@
|
|
|
1
|
-
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, 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,
|
|
2
|
-
export {
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, 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, h as GetDepositBundleParams, A as ApiAdapterOptions, i as GetDepositBundleResponse, j as GetOrderbookParams, k as GetOrderbookResponse, C as CurrencyType, l as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-C-9Z50Ak.js';
|
|
2
|
+
export { r as ActionCallback, a6 as ApiDeposit, ad as ApiIntentStatus, aM as AttestationServiceSellerCredentialProbeResponse, aK as AttestationServiceSellerCredentialUploadResponse, aL as AttestationServiceSellerVerifyResponse, p as AuthorizationTokenProvider, cb as BatchResult, z as BestByPlatformResponseObject, n as CancelIntentMethodParams, y as CancelIntentParams, ar as CashAppCredentialUploadInput, ao as CashAppSessionMaterial, t as CreateDepositConversionRate, s as CreateDepositParams, aO as CuratorSellerCredentialStatusResponse, aN as CuratorSellerCredentialUploadResponse, aP as CuratorSellerVerifyResponse, bG as Currency, bN as CurrencyData, ca as DelegationDepositTarget, c8 as DelegationRoute, c9 as DelegationState, bY as Deposit, b_ as DepositCurrency, aX as DepositIntentStatistics, a9 as DepositStatus, a7 as DepositVerifier, a8 as DepositVerifierCurrency, aU as DepositVerifierData, bX as DepositView, a2 as FiatResponse, F as FulfillIntentMethodParams, w as FulfillIntentParams, E as GetBestByPlatformResponse, H as GetBestByPlatformResponseObject, aa as GetDepositByIdRequest, ab as GetDepositByIdResponse, ai as GetIntentByHashRequest, aj as GetIntentByHashResponse, ag as GetIntentsByDepositRequest, ah as GetIntentsByDepositResponse, M as GetNearbyQuote, N as GetNearbySuggestions, ae as GetOwnerIntentsRequest, af as GetOwnerIntentsResponse, J as GetPlatformQuote, O as GetQuoteResponse, U as GetQuoteResponseObject, X as GetQuoteSingleResponse, aR as GetSellerCredentialStatusParams, b2 as IndexerClient, bA as IndexerDeploymentEnv, b8 as IndexerDeposit, bp as IndexerDepositDailySnapshot, br as IndexerDepositFilter, bo as IndexerDepositFundActivity, bq as IndexerDepositFundActivityType, bu as IndexerDepositOrderDirection, bt as IndexerDepositOrderField, bs as IndexerDepositPagination, bb as IndexerDepositPaymentMethod, b4 as IndexerDepositService, bD as IndexerFulfillmentAndPaymentResponse, bB as IndexerFulfillmentRecord, b9 as IndexerIntentFulfilled, ba as IndexerIntentFulfillmentAmounts, bd as IndexerIntentStatus, bh as IndexerManagerAggregateStats, bj as IndexerManagerDailySnapshot, bi as IndexerManagerStats, bm as IndexerManualRateUpdate, bc as IndexerMethodCurrency, bn as IndexerOracleConfigUpdate, bC as IndexerPaymentVerifiedRecord, be as IndexerRateManager, bg as IndexerRateManagerDelegation, bx as IndexerRateManagerDelegationPagination, bl as IndexerRateManagerDetail, bv as IndexerRateManagerFilter, bk as IndexerRateManagerListItem, bz as IndexerRateManagerOrderDirection, by as IndexerRateManagerOrderField, bw as IndexerRateManagerPagination, bf as IndexerRateManagerRate, b5 as IndexerRateManagerService, ac as Intent, c0 as IntentView, a4 as NearbyQuote, a5 as NearbySuggestions, Z as OfframpClient, aT as OnchainCurrency, c1 as OnchainIntent, aW as OrderStats, b1 as OrderbookEntry, bE as PAYMENT_PLATFORMS, bZ as PaymentMethodData, bF as PaymentPlatformType, a$ as PlatformLimit, K as PlatformQuote, b0 as PlatformRiskLevel, aV as PreparedTransaction, a1 as QuoteFeesResponse, a0 as QuoteIntentResponse, L as QuoteRequest, Y as QuoteResponse, _ as QuoteResponseObject, $ as QuoteSingleResponse, u as Range, b$ as ReferralFee, ak as RegisterPayeeDetailsRequest, al as RegisterPayeeDetailsResponse, x as ReleaseFundsToPayerParams, bS as RuntimeEnv, aI as SellerAttestationOutput, av as SellerCiphertextBundle, aA as SellerCredentialBundle, aB as SellerCredentialBundleUpload, aJ as SellerCredentialProbeResponse, aD as SellerCredentialStatus, aC as SellerCredentialStatusValue, au as SellerCredentialUploadInput, at as SellerCredentialUploadInputByPlatform, aH as SellerPaymentTypedDataValue, am as SellerPlatform, az as SellerProbeInput, aw as SellerSignedCiphertextBundle, aF as SellerTypedDataField, aG as SellerTypedDataSpec, ay as SellerVerifyInput, ax as SellerVerifyIntentDetails, aE as SellerVerifyProxyBody, cd as SendBatchFn, cc as SendTransactionFn, m as SignalIntentMethodParams, v as SignalIntentParams, S as SignalIntentReferralFee, aY as TakerTier, a_ as TakerTierLevel, aZ as TakerTierStats, q as TimeoutConfig, a3 as TokenResponse, aQ as UploadSellerCredentialParams, aq as VenmoCredentialUploadInput, an as VenmoSessionMaterial, aS as VerifySellerPaymentParams, as as WiseCredentialUploadInput, ap as WiseSessionMaterial, W as WithdrawDepositParams, c2 as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, o as Zkp2pClientOptions, c7 as classifyDelegationState, b6 as compareEventCursorIdsByRecency, bH as currencyInfo, b3 as defaultIndexerEndpoint, bV as enrichPvDepositView, bW as enrichPvIntentView, b7 as fetchIndexerFulfillmentAndPayment, bO as getContracts, bK as getCurrencyCodeFromHash, bJ as getCurrencyInfoFromCountryCode, bI as getCurrencyInfoFromHash, c6 as getDelegationRoute, bR as getGatingServiceAddress, bQ as getPaymentMethodsCatalog, bP as getRateManagerContracts, bL as isSupportedCurrencyHash, c3 as isZeroRateManagerId, bM as mapConversionRatesToOnchainMinRate, c4 as normalizeRateManagerId, c5 as normalizeRegistry, bT as parseDepositView, bU as parseIntentView } from './vaultUtils-C-9Z50Ak.js';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
|
@@ -207,6 +207,10 @@ declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: strin
|
|
|
207
207
|
* Get taker tier information for a specific address.
|
|
208
208
|
*/
|
|
209
209
|
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string, timeoutMs?: number): Promise<GetTakerTierResponse>;
|
|
210
|
+
declare function apiGetOrderbook(params: GetOrderbookParams, opts: ApiAdapterOptions): Promise<GetOrderbookResponse>;
|
|
211
|
+
declare function apiGetOrderbook(params: GetOrderbookParams, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<GetOrderbookResponse>;
|
|
212
|
+
declare function apiGetDepositBundle(params: GetDepositBundleParams, opts: ApiAdapterOptions): Promise<GetDepositBundleResponse>;
|
|
213
|
+
declare function apiGetDepositBundle(params: GetDepositBundleParams, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<GetDepositBundleResponse>;
|
|
210
214
|
|
|
211
215
|
/** Minimal interface for the publicClient parameter, avoids viem version coupling. */
|
|
212
216
|
interface MulticallClient {
|
|
@@ -705,4 +709,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
705
709
|
constructor(message: string, details?: unknown);
|
|
706
710
|
}
|
|
707
711
|
|
|
708
|
-
export { APIError, BASE_BUILDER_CODE, BestByPlatformResponse, 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, QuotesBestByPlatformRequest, 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, apiGetQuotesBestByPlatform, 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 };
|
|
712
|
+
export { APIError, ApiAdapterOptions, BASE_BUILDER_CODE, BestByPlatformResponse, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetDepositBundleParams, GetDepositBundleResponse, GetOrderbookParams, GetOrderbookResponse, 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, QuotesBestByPlatformRequest, 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, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, 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.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { ZERO_RATE_MANAGER_ID, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-LPJE2MN7.mjs';
|
|
2
2
|
import { ValidationError, NetworkError, APIError } from './chunk-GHQK65J2.mjs';
|
|
3
3
|
export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-GHQK65J2.mjs';
|
|
4
|
-
import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-
|
|
5
|
-
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-
|
|
4
|
+
import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-JRDFLSA7.mjs';
|
|
5
|
+
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-JRDFLSA7.mjs';
|
|
6
6
|
import { Currency, currencyKeccak256 } from './chunk-ZFBH4HD7.mjs';
|
|
7
7
|
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-ZFBH4HD7.mjs';
|
|
8
|
+
import './chunk-J5LGTIGS.mjs';
|
|
8
9
|
import { concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, formatUnits } from 'viem';
|
|
9
10
|
import { hardhat, base } from 'viem/chains';
|
|
10
11
|
import { AbiCoder } from 'ethers';
|
|
11
12
|
import { Attribution } from 'ox/erc8021';
|
|
12
|
-
import chainlinkFeeds from '@zkp2p/contracts-v2/oracleFeeds/chainlink.json';
|
|
13
13
|
|
|
14
14
|
// src/utils/address.ts
|
|
15
15
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -340,7 +340,7 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
|
340
340
|
for (let i = 0; i < maxRetries; i++) {
|
|
341
341
|
try {
|
|
342
342
|
if (timeoutMs) {
|
|
343
|
-
const { withTimeout } = await import('./timeout-
|
|
343
|
+
const { withTimeout } = await import('./timeout-YLP3WHZF.mjs');
|
|
344
344
|
return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
|
|
345
345
|
}
|
|
346
346
|
return await fn();
|
|
@@ -433,6 +433,34 @@ async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platf
|
|
|
433
433
|
return res.json();
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
|
+
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs) {
|
|
437
|
+
return withRetry(
|
|
438
|
+
async () => {
|
|
439
|
+
let res;
|
|
440
|
+
try {
|
|
441
|
+
const endpoint = `/seller/credentials/${encodeURIComponent(platform)}`;
|
|
442
|
+
res = await fetch(`${attestationServiceUrl}${endpoint}`, {
|
|
443
|
+
method: "POST",
|
|
444
|
+
headers: headers(),
|
|
445
|
+
body: JSON.stringify(payload)
|
|
446
|
+
});
|
|
447
|
+
} catch (error) {
|
|
448
|
+
throw new NetworkError("Failed to connect to Attestation Service", {
|
|
449
|
+
endpoint: `/seller/credentials/${platform}`,
|
|
450
|
+
error
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
if (!res.ok) {
|
|
454
|
+
const errorText = await res.text();
|
|
455
|
+
throw parseAPIError(res, errorText);
|
|
456
|
+
}
|
|
457
|
+
return res.json();
|
|
458
|
+
},
|
|
459
|
+
3,
|
|
460
|
+
1e3,
|
|
461
|
+
timeoutMs
|
|
462
|
+
);
|
|
463
|
+
}
|
|
436
464
|
var abiCoder = AbiCoder.defaultAbiCoder();
|
|
437
465
|
function encodeVerifyPaymentData(params) {
|
|
438
466
|
return abiCoder.encode(
|
|
@@ -571,6 +599,85 @@ var PAYMENT_PLATFORMS = [
|
|
|
571
599
|
"luxon",
|
|
572
600
|
"n26"
|
|
573
601
|
];
|
|
602
|
+
|
|
603
|
+
// src/utils/constants.ts
|
|
604
|
+
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
605
|
+
|
|
606
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.1_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.2.1/node_modules/@zkp2p/contracts-v2/oracleFeeds/chainlink.json
|
|
607
|
+
var chainlink_default = {
|
|
608
|
+
feeds: [
|
|
609
|
+
{
|
|
610
|
+
pair: "AUD/USD",
|
|
611
|
+
feed: "0x46e51B8cA41d709928EdA9Ae43e42193E6CDf229",
|
|
612
|
+
decimals: 8
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
pair: "BRL/USD",
|
|
616
|
+
feed: "0x0b0E64c05083FdF9ED7C5D3d8262c4216eFc9394",
|
|
617
|
+
decimals: 8
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
pair: "CAD/USD",
|
|
621
|
+
feed: "0xA840145F87572E82519d578b1F36340368a25D5d",
|
|
622
|
+
decimals: 8
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
pair: "CHF/USD",
|
|
626
|
+
feed: "0x3A1d6444fb6a402470098E23DaD0B7E86E14252F",
|
|
627
|
+
decimals: 8
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
pair: "EUR/USD",
|
|
631
|
+
feed: "0xc91D87E81faB8f93699ECf7Ee9B44D11e1D53F0F",
|
|
632
|
+
decimals: 8
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
pair: "GBP/USD",
|
|
636
|
+
feed: "0xCceA6576904C118037695eB71195a5425E69Fa15",
|
|
637
|
+
decimals: 8
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
pair: "IDR/USD",
|
|
641
|
+
feed: "0x05A6cF213EcC5501A11a08EBefA4A8a60313ef97",
|
|
642
|
+
decimals: 8
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
pair: "MXN/USD",
|
|
646
|
+
feed: "0x9e8Ee77c76d4fa41306056D1C3196AF5da1600bd",
|
|
647
|
+
decimals: 8
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
pair: "NGN/USD",
|
|
651
|
+
feed: "0xdfbb5Cbc88E382de007bfe6CE99C388176ED80aD",
|
|
652
|
+
decimals: 8
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
pair: "NZD/USD",
|
|
656
|
+
feed: "0x06bdFe07E71C476157FC025d3cCD4BBe08e83EF9",
|
|
657
|
+
decimals: 8
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
pair: "PHP/USD",
|
|
661
|
+
feed: "0x0396000dc82bfAEe746A9Ac6dC69dAd3223Ca9c6",
|
|
662
|
+
decimals: 8
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
pair: "SGD/USD",
|
|
666
|
+
feed: "0x81575495532fB311Efc5C993B612564274F0949b",
|
|
667
|
+
decimals: 8
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
pair: "TRY/USD",
|
|
671
|
+
feed: "0x29413773e7CD4Dfd6Ad89a50887877b88a6C592C",
|
|
672
|
+
decimals: 8
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
pair: "ZAR/USD",
|
|
676
|
+
feed: "0x2ecc8A8B370fC6a217166b2782a35339bEBEe98B",
|
|
677
|
+
decimals: 8
|
|
678
|
+
}
|
|
679
|
+
]
|
|
680
|
+
};
|
|
574
681
|
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
575
682
|
var CHAINLINK_ORACLE_ADAPTER = "0xfc81d1b5841e697973af3072fc8e03af76cb39ef";
|
|
576
683
|
var PYTH_ORACLE_ADAPTER = "0xaa2bBDa3072bD37af76613846268Ec48bd0bB885";
|
|
@@ -604,7 +711,7 @@ function parseUsdPair(pair) {
|
|
|
604
711
|
}
|
|
605
712
|
function buildChainlinkOracleFeeds() {
|
|
606
713
|
const map = {};
|
|
607
|
-
for (const feed of
|
|
714
|
+
for (const feed of chainlink_default.feeds) {
|
|
608
715
|
const parsed = parseUsdPair(feed.pair);
|
|
609
716
|
if (!parsed) continue;
|
|
610
717
|
map[parsed.currency] = {
|
|
@@ -815,6 +922,13 @@ var IntentOperations = class {
|
|
|
815
922
|
orchestratorAddress: params.orchestratorAddress,
|
|
816
923
|
escrowAddress: escrowContext.address
|
|
817
924
|
});
|
|
925
|
+
const currentEscrow = this.config.getEscrowV2Address();
|
|
926
|
+
const currentOrchestrator = this.config.getOrchestratorV2Address();
|
|
927
|
+
if (currentEscrow && escrowContext.address.toLowerCase() !== currentEscrow.toLowerCase() || currentOrchestrator && orchestratorContext.address.toLowerCase() !== currentOrchestrator.toLowerCase()) {
|
|
928
|
+
throw new Error(
|
|
929
|
+
"signalIntent is only supported on the current EscrowV2 / OrchestratorV2 deployment"
|
|
930
|
+
);
|
|
931
|
+
}
|
|
818
932
|
const catalog = getPaymentMethodsCatalog(this.config.getChainId(), this.config.getRuntimeEnv());
|
|
819
933
|
const paymentMethod = resolvePaymentMethodHashFromCatalog(params.processorName, catalog);
|
|
820
934
|
const fiatCurrency = resolveFiatCurrencyBytes32(params.fiatCurrencyCode);
|
|
@@ -1457,7 +1571,7 @@ var ProtocolViewerReader = class {
|
|
|
1457
1571
|
if (inputCount === null) {
|
|
1458
1572
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1459
1573
|
}
|
|
1460
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1574
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-CQSES3QX.mjs');
|
|
1461
1575
|
if (inputCount >= 3) {
|
|
1462
1576
|
return tryContexts(
|
|
1463
1577
|
protocolViewerContexts,
|
|
@@ -1536,7 +1650,7 @@ var ProtocolViewerReader = class {
|
|
|
1536
1650
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1537
1651
|
}
|
|
1538
1652
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1539
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1653
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-CQSES3QX.mjs');
|
|
1540
1654
|
if (inputCount >= 2) {
|
|
1541
1655
|
const requests = ids.map((id, index) => ({
|
|
1542
1656
|
index,
|
|
@@ -1641,7 +1755,7 @@ var ProtocolViewerReader = class {
|
|
|
1641
1755
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
1642
1756
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
1643
1757
|
}
|
|
1644
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1758
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-CQSES3QX.mjs');
|
|
1645
1759
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
1646
1760
|
if (inputCount >= 2) {
|
|
1647
1761
|
const readAndFilter = async (raw2) => {
|
|
@@ -1712,7 +1826,7 @@ var ProtocolViewerReader = class {
|
|
|
1712
1826
|
if (protocolViewerEntries.length === 0) {
|
|
1713
1827
|
throw new Error("ProtocolViewer not available for this network");
|
|
1714
1828
|
}
|
|
1715
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
1829
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-CQSES3QX.mjs');
|
|
1716
1830
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
1717
1831
|
let attemptedRead = false;
|
|
1718
1832
|
let hadSuccessfulRead = false;
|
|
@@ -1820,7 +1934,7 @@ var ProtocolViewerReader = class {
|
|
|
1820
1934
|
if (protocolViewerEntries.length === 0) {
|
|
1821
1935
|
throw new Error("ProtocolViewer not available for this network");
|
|
1822
1936
|
}
|
|
1823
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
1937
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-CQSES3QX.mjs');
|
|
1824
1938
|
let lastError;
|
|
1825
1939
|
for (const pvEntry of protocolViewerEntries) {
|
|
1826
1940
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -4980,6 +5094,78 @@ async function apiGetTakerTier(req, apiKey, baseApiUrl, timeoutMs) {
|
|
|
4980
5094
|
timeoutMs
|
|
4981
5095
|
});
|
|
4982
5096
|
}
|
|
5097
|
+
async function apiUploadSellerCredential(makerId, bundle, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
5098
|
+
return apiFetch({
|
|
5099
|
+
url: `${withApiBase(baseApiUrl)}/v2/makers/${makerId}/seller-credential`,
|
|
5100
|
+
method: "POST",
|
|
5101
|
+
body: bundle,
|
|
5102
|
+
apiKey,
|
|
5103
|
+
authToken,
|
|
5104
|
+
timeoutMs
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
async function apiGetSellerCredentialStatus(makerId, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
5108
|
+
return apiFetch({
|
|
5109
|
+
url: `${withApiBase(baseApiUrl)}/v2/makers/${makerId}/seller-credential/status`,
|
|
5110
|
+
method: "GET",
|
|
5111
|
+
apiKey,
|
|
5112
|
+
authToken,
|
|
5113
|
+
timeoutMs
|
|
5114
|
+
});
|
|
5115
|
+
}
|
|
5116
|
+
async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
5117
|
+
return apiFetch({
|
|
5118
|
+
url: `${withApiBase(baseApiUrl)}/v2/verify/seller/${encodeURIComponent(platform)}`,
|
|
5119
|
+
method: "POST",
|
|
5120
|
+
body: req,
|
|
5121
|
+
apiKey,
|
|
5122
|
+
authToken,
|
|
5123
|
+
timeoutMs
|
|
5124
|
+
});
|
|
5125
|
+
}
|
|
5126
|
+
async function apiGetOrderbook(params, optsOrBaseApiUrl, timeoutMs, apiKey) {
|
|
5127
|
+
const opts = typeof optsOrBaseApiUrl === "string" ? {
|
|
5128
|
+
baseApiUrl: optsOrBaseApiUrl,
|
|
5129
|
+
timeoutMs,
|
|
5130
|
+
apiKey
|
|
5131
|
+
} : optsOrBaseApiUrl;
|
|
5132
|
+
const query = new URLSearchParams();
|
|
5133
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
5134
|
+
if (value === void 0 || value === null) return;
|
|
5135
|
+
query.set(key, String(value));
|
|
5136
|
+
});
|
|
5137
|
+
const response = await apiFetch({
|
|
5138
|
+
url: `${withApiBase(opts.baseApiUrl)}/v2/orderbook?${query.toString()}`,
|
|
5139
|
+
method: "GET",
|
|
5140
|
+
apiKey: opts.apiKey,
|
|
5141
|
+
authToken: opts.authToken,
|
|
5142
|
+
timeoutMs: opts.timeoutMs
|
|
5143
|
+
});
|
|
5144
|
+
return response.responseObject;
|
|
5145
|
+
}
|
|
5146
|
+
async function apiGetDepositBundle(params, optsOrBaseApiUrl, timeoutMs, apiKey) {
|
|
5147
|
+
const opts = typeof optsOrBaseApiUrl === "string" ? {
|
|
5148
|
+
baseApiUrl: optsOrBaseApiUrl,
|
|
5149
|
+
timeoutMs,
|
|
5150
|
+
apiKey
|
|
5151
|
+
} : optsOrBaseApiUrl;
|
|
5152
|
+
const escrowAddress = requireEscrowAddress(
|
|
5153
|
+
params.escrowAddress,
|
|
5154
|
+
"apiGetDepositBundle requires escrowAddress"
|
|
5155
|
+
);
|
|
5156
|
+
const query = new URLSearchParams({ escrowAddress });
|
|
5157
|
+
if (params.dailySnapshotLimit !== void 0) {
|
|
5158
|
+
query.set("dailySnapshotLimit", String(params.dailySnapshotLimit));
|
|
5159
|
+
}
|
|
5160
|
+
const response = await apiFetch({
|
|
5161
|
+
url: `${withApiBase(opts.baseApiUrl)}/v2/deposits/${params.depositId}/bundle?${query.toString()}`,
|
|
5162
|
+
method: "GET",
|
|
5163
|
+
apiKey: opts.apiKey,
|
|
5164
|
+
authToken: opts.authToken,
|
|
5165
|
+
timeoutMs: opts.timeoutMs
|
|
5166
|
+
});
|
|
5167
|
+
return response.responseObject;
|
|
5168
|
+
}
|
|
4983
5169
|
var formatTokenAmountForDisplay = (amount, decimals) => {
|
|
4984
5170
|
const formatted = formatUnits(amount, decimals);
|
|
4985
5171
|
if (!formatted.includes(".")) {
|
|
@@ -6190,6 +6376,7 @@ var Zkp2pClient = class {
|
|
|
6190
6376
|
getProtocolViewerAbi: () => this.protocolViewerAbi,
|
|
6191
6377
|
getIndexerClient: () => this._indexerClient,
|
|
6192
6378
|
getIndexerService: () => this._indexerService,
|
|
6379
|
+
getEscrowV2Address: () => this.escrowV2Address,
|
|
6193
6380
|
getOrchestratorV2Address: () => this.orchestratorV2Address,
|
|
6194
6381
|
host: {
|
|
6195
6382
|
resolveEscrowContext: (options) => this.resolveEscrowContext(options),
|
|
@@ -6213,6 +6400,30 @@ var Zkp2pClient = class {
|
|
|
6213
6400
|
parseRawDepositId(depositId) {
|
|
6214
6401
|
return parseRawDepositId(depositId);
|
|
6215
6402
|
}
|
|
6403
|
+
stripTrailingSlash(url) {
|
|
6404
|
+
return url.replace(/\/$/, "");
|
|
6405
|
+
}
|
|
6406
|
+
defaultAttestationServiceForBaseApiUrl(baseApiUrl) {
|
|
6407
|
+
try {
|
|
6408
|
+
const { hostname } = new URL(baseApiUrl);
|
|
6409
|
+
if (hostname === "api-staging.zkp2p.xyz") {
|
|
6410
|
+
return "https://attestation-service-staging.zkp2p.xyz";
|
|
6411
|
+
}
|
|
6412
|
+
if (hostname === "api-preprod.zkp2p.xyz") {
|
|
6413
|
+
return "https://attestation-service.zkp2p.xyz";
|
|
6414
|
+
}
|
|
6415
|
+
if (hostname === "api.zkp2p.xyz") {
|
|
6416
|
+
return "https://attestation-service.zkp2p.xyz";
|
|
6417
|
+
}
|
|
6418
|
+
} catch {
|
|
6419
|
+
}
|
|
6420
|
+
if (baseApiUrl === DEFAULT_BASE_API_URL) {
|
|
6421
|
+
return "https://attestation-service.zkp2p.xyz";
|
|
6422
|
+
}
|
|
6423
|
+
throw new Error(
|
|
6424
|
+
`attestationServiceUrl is required when baseApiUrl is not a supported zkp2p API host: ${baseApiUrl}`
|
|
6425
|
+
);
|
|
6426
|
+
}
|
|
6216
6427
|
normalizeOracleRateConfig(config) {
|
|
6217
6428
|
return normalizeOracleRateConfig(config);
|
|
6218
6429
|
}
|
|
@@ -7253,7 +7464,7 @@ var Zkp2pClient = class {
|
|
|
7253
7464
|
}
|
|
7254
7465
|
}
|
|
7255
7466
|
});
|
|
7256
|
-
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-
|
|
7467
|
+
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-MARF3D2J.mjs');
|
|
7257
7468
|
const normalized = params.conversionRates.map(
|
|
7258
7469
|
(group) => group.map((r) => ({ currency: r.currency, conversionRate: r.conversionRate }))
|
|
7259
7470
|
);
|
|
@@ -7406,7 +7617,7 @@ var Zkp2pClient = class {
|
|
|
7406
7617
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7407
7618
|
const reqWithEscrow = { ...req };
|
|
7408
7619
|
if (!reqWithEscrow.escrowAddresses || reqWithEscrow.escrowAddresses.length === 0) {
|
|
7409
|
-
const configuredEscrows = this.
|
|
7620
|
+
const configuredEscrows = this.escrowV2Address ? [this.escrowV2Address] : this.escrowAddress ? [this.escrowAddress] : [];
|
|
7410
7621
|
if (configuredEscrows.length > 0) {
|
|
7411
7622
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
7412
7623
|
}
|
|
@@ -7450,7 +7661,7 @@ var Zkp2pClient = class {
|
|
|
7450
7661
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7451
7662
|
const reqWithEscrow = { ...req };
|
|
7452
7663
|
if (!reqWithEscrow.escrowAddresses || reqWithEscrow.escrowAddresses.length === 0) {
|
|
7453
|
-
const configuredEscrows = this.
|
|
7664
|
+
const configuredEscrows = this.escrowV2Address ? [this.escrowV2Address] : this.escrowAddress ? [this.escrowAddress] : [];
|
|
7454
7665
|
if (configuredEscrows.length > 0) {
|
|
7455
7666
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
7456
7667
|
}
|
|
@@ -7500,6 +7711,92 @@ var Zkp2pClient = class {
|
|
|
7500
7711
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7501
7712
|
return apiGetTakerTier(req, void 0, baseApiUrl, timeoutMs);
|
|
7502
7713
|
}
|
|
7714
|
+
/**
|
|
7715
|
+
* The signed `expiresAtMs` field is an upload-time freshness token minted by attestation-service.
|
|
7716
|
+
* Once curator persists the bundle, seller-automated-release availability is governed by curator's
|
|
7717
|
+
* probe/revalidation state rather than this timestamp.
|
|
7718
|
+
*
|
|
7719
|
+
* Curator accepts either a configured API key or bearer token for this endpoint.
|
|
7720
|
+
*
|
|
7721
|
+
* Create a signed seller credential bundle with attestation-service and store it on the maker via curator.
|
|
7722
|
+
*/
|
|
7723
|
+
async uploadSellerCredential(params, opts) {
|
|
7724
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
7725
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
7726
|
+
);
|
|
7727
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7728
|
+
const attestationServiceUrl = this.stripTrailingSlash(
|
|
7729
|
+
opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
|
|
7730
|
+
);
|
|
7731
|
+
const uploadPayload = {
|
|
7732
|
+
payeeId: params.payeeId,
|
|
7733
|
+
sessionMaterial: params.sessionMaterial
|
|
7734
|
+
};
|
|
7735
|
+
const bundleResponse = await apiCreateSellerCredentialBundle(
|
|
7736
|
+
uploadPayload,
|
|
7737
|
+
attestationServiceUrl,
|
|
7738
|
+
params.platform,
|
|
7739
|
+
timeoutMs
|
|
7740
|
+
);
|
|
7741
|
+
if (!bundleResponse.success || !bundleResponse.responseObject) {
|
|
7742
|
+
throw new Error(bundleResponse.message || "Failed to create seller credential bundle");
|
|
7743
|
+
}
|
|
7744
|
+
return apiUploadSellerCredential(
|
|
7745
|
+
params.makerId,
|
|
7746
|
+
bundleResponse.responseObject,
|
|
7747
|
+
baseApiUrl,
|
|
7748
|
+
timeoutMs,
|
|
7749
|
+
this.apiKey,
|
|
7750
|
+
this.authorizationToken
|
|
7751
|
+
);
|
|
7752
|
+
}
|
|
7753
|
+
/**
|
|
7754
|
+
* Status is a coarse curator-owned signal (`active` / `inactive` / `missing`) and intentionally
|
|
7755
|
+
* omits low-level diagnostics. Curator may still re-probe stale credentials during verify, so callers
|
|
7756
|
+
* should continue to handle a 410 from `verifySellerPayment`.
|
|
7757
|
+
*
|
|
7758
|
+
* Curator accepts either a configured API key or bearer token for this endpoint.
|
|
7759
|
+
*
|
|
7760
|
+
* Fetch seller credential status for a maker from curator.
|
|
7761
|
+
*/
|
|
7762
|
+
async getSellerCredentialStatus(params, opts) {
|
|
7763
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
7764
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
7765
|
+
);
|
|
7766
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7767
|
+
return apiGetSellerCredentialStatus(
|
|
7768
|
+
params.makerId,
|
|
7769
|
+
baseApiUrl,
|
|
7770
|
+
timeoutMs,
|
|
7771
|
+
this.apiKey,
|
|
7772
|
+
this.authorizationToken
|
|
7773
|
+
);
|
|
7774
|
+
}
|
|
7775
|
+
/**
|
|
7776
|
+
* Internal-use endpoint. The curator route requires an internal `x-api-key`; standard SDK consumer
|
|
7777
|
+
* API keys will be rejected with 401. Returns 410 GONE when curator has marked the credential inactive
|
|
7778
|
+
* or a stale credential fails its synchronous re-probe.
|
|
7779
|
+
*
|
|
7780
|
+
* Verify a seller payment via curator's seller-credential proxy.
|
|
7781
|
+
*/
|
|
7782
|
+
async verifySellerPayment(params, opts) {
|
|
7783
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
7784
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
7785
|
+
);
|
|
7786
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7787
|
+
return apiVerifySellerPayment(
|
|
7788
|
+
params.platform,
|
|
7789
|
+
{
|
|
7790
|
+
txId: params.txId,
|
|
7791
|
+
chainId: params.chainId,
|
|
7792
|
+
intent: params.intent
|
|
7793
|
+
},
|
|
7794
|
+
baseApiUrl,
|
|
7795
|
+
timeoutMs,
|
|
7796
|
+
this.apiKey,
|
|
7797
|
+
this.authorizationToken
|
|
7798
|
+
);
|
|
7799
|
+
}
|
|
7503
7800
|
// ╔═══════════════════════════════════════════════════════════════════════════╗
|
|
7504
7801
|
// ║ CORE: ON-CHAIN DEPOSIT VIEWS ║
|
|
7505
7802
|
// ╚═══════════════════════════════════════════════════════════════════════════╝
|
|
@@ -7867,6 +8164,6 @@ var logger = {
|
|
|
7867
8164
|
}
|
|
7868
8165
|
};
|
|
7869
8166
|
|
|
7870
|
-
export { BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PAYMENT_PLATFORMS, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
8167
|
+
export { BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PAYMENT_PLATFORMS, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
7871
8168
|
//# sourceMappingURL=index.mjs.map
|
|
7872
8169
|
//# sourceMappingURL=index.mjs.map
|