@zkp2p/sdk 0.3.2-rc.0 → 0.4.0-rc.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 +58 -1
- package/dist/chunk-J5LGTIGS.mjs +9 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/chunk-L526MKG3.mjs +41021 -0
- package/dist/chunk-L526MKG3.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 +41232 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +17 -25
- package/dist/index.d.ts +17 -25
- package/dist/index.mjs +168 -35
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-GGSM2243.mjs +5 -0
- package/dist/{protocolViewerParsers-ZQZ6QGEX.mjs.map → protocolViewerParsers-GGSM2243.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-C-9Z50Ak.d.mts → vaultUtils-BBdtW9in.d.mts} +25 -13
- package/dist/{vaultUtils-C-9Z50Ak.d.ts → vaultUtils-BBdtW9in.d.ts} +25 -13
- package/package.json +3 -2
- package/dist/chunk-ENH4KRFK.mjs +0 -506
- package/dist/chunk-ENH4KRFK.mjs.map +0 -1
- package/dist/protocolViewerParsers-ZQZ6QGEX.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, 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-
|
|
2
|
-
export { r as ActionCallback, a6 as ApiDeposit, ad as ApiIntentStatus, aM as AttestationServiceSellerCredentialProbeResponse, aK as AttestationServiceSellerCredentialUploadResponse, aL as AttestationServiceSellerVerifyResponse, p as AuthorizationTokenProvider,
|
|
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-BBdtW9in.mjs';
|
|
2
|
+
export { r as ActionCallback, a6 as ApiDeposit, ad as ApiIntentStatus, aM as AttestationServiceSellerCredentialProbeResponse, aK as AttestationServiceSellerCredentialUploadResponse, aL as AttestationServiceSellerVerifyResponse, p as AuthorizationTokenProvider, cd 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, bI as Currency, bP as CurrencyData, cc as DelegationDepositTarget, ca as DelegationRoute, cb as DelegationState, b_ as Deposit, c0 as DepositCurrency, aZ as DepositIntentStatistics, a9 as DepositStatus, a7 as DepositVerifier, a8 as DepositVerifierCurrency, aW as DepositVerifierData, bZ 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, aT as GetSellerCredentialStatusParams, b4 as IndexerClient, bC as IndexerDeploymentEnv, ba as IndexerDeposit, br as IndexerDepositDailySnapshot, bt as IndexerDepositFilter, bq as IndexerDepositFundActivity, bs as IndexerDepositFundActivityType, bw as IndexerDepositOrderDirection, bv as IndexerDepositOrderField, bu as IndexerDepositPagination, bd as IndexerDepositPaymentMethod, b6 as IndexerDepositService, bF as IndexerFulfillmentAndPaymentResponse, bD as IndexerFulfillmentRecord, bb as IndexerIntentFulfilled, bc as IndexerIntentFulfillmentAmounts, bf as IndexerIntentStatus, bj as IndexerManagerAggregateStats, bl as IndexerManagerDailySnapshot, bk as IndexerManagerStats, bo as IndexerManualRateUpdate, be as IndexerMethodCurrency, bp as IndexerOracleConfigUpdate, bE as IndexerPaymentVerifiedRecord, bg as IndexerRateManager, bi as IndexerRateManagerDelegation, bz as IndexerRateManagerDelegationPagination, bn as IndexerRateManagerDetail, bx as IndexerRateManagerFilter, bm as IndexerRateManagerListItem, bB as IndexerRateManagerOrderDirection, bA as IndexerRateManagerOrderField, by as IndexerRateManagerPagination, bh as IndexerRateManagerRate, b7 as IndexerRateManagerService, ac as Intent, c2 as IntentView, a4 as NearbyQuote, a5 as NearbySuggestions, Z as OfframpClient, aV as OnchainCurrency, c3 as OnchainIntent, aY as OrderStats, b3 as OrderbookEntry, bG as PAYMENT_PLATFORMS, b$ as PaymentMethodData, bH as PaymentPlatformType, b1 as PlatformLimit, K as PlatformQuote, b2 as PlatformRiskLevel, aX as PreparedTransaction, a1 as QuoteFeesResponse, a0 as QuoteIntentResponse, L as QuoteRequest, Y as QuoteResponse, _ as QuoteResponseObject, $ as QuoteSingleResponse, u as Range, c1 as ReferralFee, ak as RegisterPayeeDetailsRequest, al as RegisterPayeeDetailsResponse, x as ReleaseFundsToPayerParams, bU as RuntimeEnv, aI as SellerAttestationOutput, av as SellerCiphertextBundle, aS as SellerCredentialAttestationRuntime, 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, cf as SendBatchFn, ce as SendTransactionFn, m as SignalIntentMethodParams, v as SignalIntentParams, S as SignalIntentReferralFee, a_ as TakerTier, b0 as TakerTierLevel, a$ as TakerTierStats, q as TimeoutConfig, a3 as TokenResponse, aR as UploadSellerCredentialOptions, aQ as UploadSellerCredentialParams, aq as VenmoCredentialUploadInput, an as VenmoSessionMaterial, aU as VerifySellerPaymentParams, as as WiseCredentialUploadInput, ap as WiseSessionMaterial, W as WithdrawDepositParams, c4 as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, o as Zkp2pClientOptions, c9 as classifyDelegationState, b8 as compareEventCursorIdsByRecency, bJ as currencyInfo, b5 as defaultIndexerEndpoint, bX as enrichPvDepositView, bY as enrichPvIntentView, b9 as fetchIndexerFulfillmentAndPayment, bQ as getContracts, bM as getCurrencyCodeFromHash, bL as getCurrencyInfoFromCountryCode, bK as getCurrencyInfoFromHash, c8 as getDelegationRoute, bT as getGatingServiceAddress, bS as getPaymentMethodsCatalog, bR as getRateManagerContracts, bN as isSupportedCurrencyHash, c5 as isZeroRateManagerId, bO as mapConversionRatesToOnchainMinRate, c6 as normalizeRateManagerId, c7 as normalizeRegistry, bV as parseDepositView, bW as parseIntentView } from './vaultUtils-BBdtW9in.mjs';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
|
@@ -126,44 +126,36 @@ declare class ContractRouter {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
type PeerConnectionStatus = 'connected' | 'disconnected' | 'pending';
|
|
129
|
-
type
|
|
130
|
-
type PeerIntentFulfilledResult = {
|
|
129
|
+
type PeerOnrampPreparedTransactionResult = {
|
|
131
130
|
intentHash: `0x${string}`;
|
|
132
|
-
status: '
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
status: PeerIntentFulfilledBridgeStatus;
|
|
139
|
-
trackingUrl?: string | null;
|
|
140
|
-
txHashes?: Array<{
|
|
141
|
-
txHash: `0x${string}`;
|
|
142
|
-
chainId: number;
|
|
143
|
-
}>;
|
|
144
|
-
outputAmount?: string | null;
|
|
145
|
-
expectedOutputAmount?: string | null;
|
|
131
|
+
status: 'calldata_ready';
|
|
132
|
+
transaction: {
|
|
133
|
+
to: `0x${string}`;
|
|
134
|
+
data: `0x${string}`;
|
|
135
|
+
value: string;
|
|
136
|
+
chainId: number;
|
|
146
137
|
};
|
|
147
138
|
};
|
|
148
|
-
type
|
|
139
|
+
type PeerOnrampPreparedTransactionCallback = (result: PeerOnrampPreparedTransactionResult) => void;
|
|
149
140
|
type PeerExtensionApi = {
|
|
150
141
|
requestConnection(): Promise<boolean>;
|
|
151
142
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
152
143
|
openSidebar(route: string): void;
|
|
153
|
-
onramp(queryString: string): void;
|
|
154
|
-
|
|
144
|
+
onramp(queryString: string, callback: PeerOnrampPreparedTransactionCallback): void;
|
|
145
|
+
getOnrampTransaction(intentHash: string): Promise<PeerOnrampPreparedTransactionResult | null>;
|
|
155
146
|
getVersion(): Promise<string>;
|
|
156
147
|
};
|
|
157
148
|
type PeerExtensionOnrampParams = {
|
|
149
|
+
intentHash: string;
|
|
158
150
|
referrer?: string;
|
|
159
151
|
referrerLogo?: string;
|
|
160
152
|
inputCurrency?: string;
|
|
161
153
|
inputAmount?: string | number;
|
|
162
154
|
paymentPlatform?: string;
|
|
155
|
+
depositId?: string | number | bigint;
|
|
163
156
|
toToken?: string;
|
|
164
157
|
amountUsdc?: string | number | bigint;
|
|
165
158
|
recipientAddress?: string;
|
|
166
|
-
intentHash?: string;
|
|
167
159
|
};
|
|
168
160
|
type PeerExtensionWindow = Window & {
|
|
169
161
|
peer?: PeerExtensionApi;
|
|
@@ -175,8 +167,8 @@ type PeerExtensionSdk = {
|
|
|
175
167
|
requestConnection(): Promise<boolean>;
|
|
176
168
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
177
169
|
openSidebar(route: string): void;
|
|
178
|
-
onramp(params
|
|
179
|
-
|
|
170
|
+
onramp(params: PeerExtensionOnrampParams, callback: PeerOnrampPreparedTransactionCallback): void;
|
|
171
|
+
getOnrampTransaction(intentHash: string): Promise<PeerOnrampPreparedTransactionResult | null>;
|
|
180
172
|
getVersion(): Promise<string>;
|
|
181
173
|
isAvailable(): boolean;
|
|
182
174
|
openInstallPage(): void;
|
|
@@ -709,4 +701,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
709
701
|
constructor(message: string, details?: unknown);
|
|
710
702
|
}
|
|
711
703
|
|
|
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
|
|
704
|
+
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 PeerOnrampPreparedTransactionCallback, type PeerOnrampPreparedTransactionResult, 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, 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-
|
|
2
|
-
export { r as ActionCallback, a6 as ApiDeposit, ad as ApiIntentStatus, aM as AttestationServiceSellerCredentialProbeResponse, aK as AttestationServiceSellerCredentialUploadResponse, aL as AttestationServiceSellerVerifyResponse, p as AuthorizationTokenProvider,
|
|
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-BBdtW9in.js';
|
|
2
|
+
export { r as ActionCallback, a6 as ApiDeposit, ad as ApiIntentStatus, aM as AttestationServiceSellerCredentialProbeResponse, aK as AttestationServiceSellerCredentialUploadResponse, aL as AttestationServiceSellerVerifyResponse, p as AuthorizationTokenProvider, cd 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, bI as Currency, bP as CurrencyData, cc as DelegationDepositTarget, ca as DelegationRoute, cb as DelegationState, b_ as Deposit, c0 as DepositCurrency, aZ as DepositIntentStatistics, a9 as DepositStatus, a7 as DepositVerifier, a8 as DepositVerifierCurrency, aW as DepositVerifierData, bZ 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, aT as GetSellerCredentialStatusParams, b4 as IndexerClient, bC as IndexerDeploymentEnv, ba as IndexerDeposit, br as IndexerDepositDailySnapshot, bt as IndexerDepositFilter, bq as IndexerDepositFundActivity, bs as IndexerDepositFundActivityType, bw as IndexerDepositOrderDirection, bv as IndexerDepositOrderField, bu as IndexerDepositPagination, bd as IndexerDepositPaymentMethod, b6 as IndexerDepositService, bF as IndexerFulfillmentAndPaymentResponse, bD as IndexerFulfillmentRecord, bb as IndexerIntentFulfilled, bc as IndexerIntentFulfillmentAmounts, bf as IndexerIntentStatus, bj as IndexerManagerAggregateStats, bl as IndexerManagerDailySnapshot, bk as IndexerManagerStats, bo as IndexerManualRateUpdate, be as IndexerMethodCurrency, bp as IndexerOracleConfigUpdate, bE as IndexerPaymentVerifiedRecord, bg as IndexerRateManager, bi as IndexerRateManagerDelegation, bz as IndexerRateManagerDelegationPagination, bn as IndexerRateManagerDetail, bx as IndexerRateManagerFilter, bm as IndexerRateManagerListItem, bB as IndexerRateManagerOrderDirection, bA as IndexerRateManagerOrderField, by as IndexerRateManagerPagination, bh as IndexerRateManagerRate, b7 as IndexerRateManagerService, ac as Intent, c2 as IntentView, a4 as NearbyQuote, a5 as NearbySuggestions, Z as OfframpClient, aV as OnchainCurrency, c3 as OnchainIntent, aY as OrderStats, b3 as OrderbookEntry, bG as PAYMENT_PLATFORMS, b$ as PaymentMethodData, bH as PaymentPlatformType, b1 as PlatformLimit, K as PlatformQuote, b2 as PlatformRiskLevel, aX as PreparedTransaction, a1 as QuoteFeesResponse, a0 as QuoteIntentResponse, L as QuoteRequest, Y as QuoteResponse, _ as QuoteResponseObject, $ as QuoteSingleResponse, u as Range, c1 as ReferralFee, ak as RegisterPayeeDetailsRequest, al as RegisterPayeeDetailsResponse, x as ReleaseFundsToPayerParams, bU as RuntimeEnv, aI as SellerAttestationOutput, av as SellerCiphertextBundle, aS as SellerCredentialAttestationRuntime, 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, cf as SendBatchFn, ce as SendTransactionFn, m as SignalIntentMethodParams, v as SignalIntentParams, S as SignalIntentReferralFee, a_ as TakerTier, b0 as TakerTierLevel, a$ as TakerTierStats, q as TimeoutConfig, a3 as TokenResponse, aR as UploadSellerCredentialOptions, aQ as UploadSellerCredentialParams, aq as VenmoCredentialUploadInput, an as VenmoSessionMaterial, aU as VerifySellerPaymentParams, as as WiseCredentialUploadInput, ap as WiseSessionMaterial, W as WithdrawDepositParams, c4 as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, o as Zkp2pClientOptions, c9 as classifyDelegationState, b8 as compareEventCursorIdsByRecency, bJ as currencyInfo, b5 as defaultIndexerEndpoint, bX as enrichPvDepositView, bY as enrichPvIntentView, b9 as fetchIndexerFulfillmentAndPayment, bQ as getContracts, bM as getCurrencyCodeFromHash, bL as getCurrencyInfoFromCountryCode, bK as getCurrencyInfoFromHash, c8 as getDelegationRoute, bT as getGatingServiceAddress, bS as getPaymentMethodsCatalog, bR as getRateManagerContracts, bN as isSupportedCurrencyHash, c5 as isZeroRateManagerId, bO as mapConversionRatesToOnchainMinRate, c6 as normalizeRateManagerId, c7 as normalizeRegistry, bV as parseDepositView, bW as parseIntentView } from './vaultUtils-BBdtW9in.js';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
|
@@ -126,44 +126,36 @@ declare class ContractRouter {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
type PeerConnectionStatus = 'connected' | 'disconnected' | 'pending';
|
|
129
|
-
type
|
|
130
|
-
type PeerIntentFulfilledResult = {
|
|
129
|
+
type PeerOnrampPreparedTransactionResult = {
|
|
131
130
|
intentHash: `0x${string}`;
|
|
132
|
-
status: '
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
status: PeerIntentFulfilledBridgeStatus;
|
|
139
|
-
trackingUrl?: string | null;
|
|
140
|
-
txHashes?: Array<{
|
|
141
|
-
txHash: `0x${string}`;
|
|
142
|
-
chainId: number;
|
|
143
|
-
}>;
|
|
144
|
-
outputAmount?: string | null;
|
|
145
|
-
expectedOutputAmount?: string | null;
|
|
131
|
+
status: 'calldata_ready';
|
|
132
|
+
transaction: {
|
|
133
|
+
to: `0x${string}`;
|
|
134
|
+
data: `0x${string}`;
|
|
135
|
+
value: string;
|
|
136
|
+
chainId: number;
|
|
146
137
|
};
|
|
147
138
|
};
|
|
148
|
-
type
|
|
139
|
+
type PeerOnrampPreparedTransactionCallback = (result: PeerOnrampPreparedTransactionResult) => void;
|
|
149
140
|
type PeerExtensionApi = {
|
|
150
141
|
requestConnection(): Promise<boolean>;
|
|
151
142
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
152
143
|
openSidebar(route: string): void;
|
|
153
|
-
onramp(queryString: string): void;
|
|
154
|
-
|
|
144
|
+
onramp(queryString: string, callback: PeerOnrampPreparedTransactionCallback): void;
|
|
145
|
+
getOnrampTransaction(intentHash: string): Promise<PeerOnrampPreparedTransactionResult | null>;
|
|
155
146
|
getVersion(): Promise<string>;
|
|
156
147
|
};
|
|
157
148
|
type PeerExtensionOnrampParams = {
|
|
149
|
+
intentHash: string;
|
|
158
150
|
referrer?: string;
|
|
159
151
|
referrerLogo?: string;
|
|
160
152
|
inputCurrency?: string;
|
|
161
153
|
inputAmount?: string | number;
|
|
162
154
|
paymentPlatform?: string;
|
|
155
|
+
depositId?: string | number | bigint;
|
|
163
156
|
toToken?: string;
|
|
164
157
|
amountUsdc?: string | number | bigint;
|
|
165
158
|
recipientAddress?: string;
|
|
166
|
-
intentHash?: string;
|
|
167
159
|
};
|
|
168
160
|
type PeerExtensionWindow = Window & {
|
|
169
161
|
peer?: PeerExtensionApi;
|
|
@@ -175,8 +167,8 @@ type PeerExtensionSdk = {
|
|
|
175
167
|
requestConnection(): Promise<boolean>;
|
|
176
168
|
checkConnectionStatus(): Promise<PeerConnectionStatus>;
|
|
177
169
|
openSidebar(route: string): void;
|
|
178
|
-
onramp(params
|
|
179
|
-
|
|
170
|
+
onramp(params: PeerExtensionOnrampParams, callback: PeerOnrampPreparedTransactionCallback): void;
|
|
171
|
+
getOnrampTransaction(intentHash: string): Promise<PeerOnrampPreparedTransactionResult | null>;
|
|
180
172
|
getVersion(): Promise<string>;
|
|
181
173
|
isAvailable(): boolean;
|
|
182
174
|
openInstallPage(): void;
|
|
@@ -709,4 +701,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
709
701
|
constructor(message: string, details?: unknown);
|
|
710
702
|
}
|
|
711
703
|
|
|
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
|
|
704
|
+
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 PeerOnrampPreparedTransactionCallback, type PeerOnrampPreparedTransactionResult, 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,16 @@
|
|
|
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-L526MKG3.mjs';
|
|
5
|
+
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-L526MKG3.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';
|
|
11
|
+
import { createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
10
12
|
import { AbiCoder } from 'ethers';
|
|
11
13
|
import { Attribution } from 'ox/erc8021';
|
|
12
|
-
import chainlinkFeeds from '@zkp2p/contracts-v2/oracleFeeds/chainlink.json';
|
|
13
14
|
|
|
14
15
|
// src/utils/address.ts
|
|
15
16
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -340,7 +341,7 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
|
340
341
|
for (let i = 0; i < maxRetries; i++) {
|
|
341
342
|
try {
|
|
342
343
|
if (timeoutMs) {
|
|
343
|
-
const { withTimeout } = await import('./timeout-
|
|
344
|
+
const { withTimeout } = await import('./timeout-YLP3WHZF.mjs');
|
|
344
345
|
return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
|
|
345
346
|
}
|
|
346
347
|
return await fn();
|
|
@@ -405,8 +406,6 @@ async function apiSignIntentV3(request, opts) {
|
|
|
405
406
|
referralFees
|
|
406
407
|
};
|
|
407
408
|
}
|
|
408
|
-
|
|
409
|
-
// src/adapters/attestation.ts
|
|
410
409
|
function headers() {
|
|
411
410
|
return { "Content-Type": "application/json" };
|
|
412
411
|
}
|
|
@@ -433,16 +432,26 @@ async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platf
|
|
|
433
432
|
return res.json();
|
|
434
433
|
});
|
|
435
434
|
}
|
|
436
|
-
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs) {
|
|
435
|
+
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs, attestationRuntime) {
|
|
437
436
|
return withRetry(
|
|
438
437
|
async () => {
|
|
438
|
+
const requestFetch = attestationRuntime?.fetch ?? fetch;
|
|
439
|
+
const encryptedUpload = await createEncryptedSellerCredentialUpload({
|
|
440
|
+
attestationServiceUrl,
|
|
441
|
+
payeeId: payload.payeeId,
|
|
442
|
+
sessionMaterial: payload.sessionMaterial,
|
|
443
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
444
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
445
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
446
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
447
|
+
});
|
|
439
448
|
let res;
|
|
440
449
|
try {
|
|
441
450
|
const endpoint = `/seller/credentials/${encodeURIComponent(platform)}`;
|
|
442
|
-
res = await
|
|
451
|
+
res = await requestFetch(`${attestationServiceUrl}${endpoint}`, {
|
|
443
452
|
method: "POST",
|
|
444
453
|
headers: headers(),
|
|
445
|
-
body: JSON.stringify(
|
|
454
|
+
body: JSON.stringify({ encryptedUpload })
|
|
446
455
|
});
|
|
447
456
|
} catch (error) {
|
|
448
457
|
throw new NetworkError("Failed to connect to Attestation Service", {
|
|
@@ -602,6 +611,82 @@ var PAYMENT_PLATFORMS = [
|
|
|
602
611
|
|
|
603
612
|
// src/utils/constants.ts
|
|
604
613
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
614
|
+
|
|
615
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.2_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
|
|
616
|
+
var chainlink_default = {
|
|
617
|
+
feeds: [
|
|
618
|
+
{
|
|
619
|
+
pair: "AUD/USD",
|
|
620
|
+
feed: "0x46e51B8cA41d709928EdA9Ae43e42193E6CDf229",
|
|
621
|
+
decimals: 8
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
pair: "BRL/USD",
|
|
625
|
+
feed: "0x0b0E64c05083FdF9ED7C5D3d8262c4216eFc9394",
|
|
626
|
+
decimals: 8
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
pair: "CAD/USD",
|
|
630
|
+
feed: "0xA840145F87572E82519d578b1F36340368a25D5d",
|
|
631
|
+
decimals: 8
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
pair: "CHF/USD",
|
|
635
|
+
feed: "0x3A1d6444fb6a402470098E23DaD0B7E86E14252F",
|
|
636
|
+
decimals: 8
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
pair: "EUR/USD",
|
|
640
|
+
feed: "0xc91D87E81faB8f93699ECf7Ee9B44D11e1D53F0F",
|
|
641
|
+
decimals: 8
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
pair: "GBP/USD",
|
|
645
|
+
feed: "0xCceA6576904C118037695eB71195a5425E69Fa15",
|
|
646
|
+
decimals: 8
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
pair: "IDR/USD",
|
|
650
|
+
feed: "0x05A6cF213EcC5501A11a08EBefA4A8a60313ef97",
|
|
651
|
+
decimals: 8
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
pair: "MXN/USD",
|
|
655
|
+
feed: "0x9e8Ee77c76d4fa41306056D1C3196AF5da1600bd",
|
|
656
|
+
decimals: 8
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
pair: "NGN/USD",
|
|
660
|
+
feed: "0xdfbb5Cbc88E382de007bfe6CE99C388176ED80aD",
|
|
661
|
+
decimals: 8
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
pair: "NZD/USD",
|
|
665
|
+
feed: "0x06bdFe07E71C476157FC025d3cCD4BBe08e83EF9",
|
|
666
|
+
decimals: 8
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
pair: "PHP/USD",
|
|
670
|
+
feed: "0x0396000dc82bfAEe746A9Ac6dC69dAd3223Ca9c6",
|
|
671
|
+
decimals: 8
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
pair: "SGD/USD",
|
|
675
|
+
feed: "0x81575495532fB311Efc5C993B612564274F0949b",
|
|
676
|
+
decimals: 8
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
pair: "TRY/USD",
|
|
680
|
+
feed: "0x29413773e7CD4Dfd6Ad89a50887877b88a6C592C",
|
|
681
|
+
decimals: 8
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
pair: "ZAR/USD",
|
|
685
|
+
feed: "0x2ecc8A8B370fC6a217166b2782a35339bEBEe98B",
|
|
686
|
+
decimals: 8
|
|
687
|
+
}
|
|
688
|
+
]
|
|
689
|
+
};
|
|
605
690
|
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
606
691
|
var CHAINLINK_ORACLE_ADAPTER = "0xfc81d1b5841e697973af3072fc8e03af76cb39ef";
|
|
607
692
|
var PYTH_ORACLE_ADAPTER = "0xaa2bBDa3072bD37af76613846268Ec48bd0bB885";
|
|
@@ -635,7 +720,7 @@ function parseUsdPair(pair) {
|
|
|
635
720
|
}
|
|
636
721
|
function buildChainlinkOracleFeeds() {
|
|
637
722
|
const map = {};
|
|
638
|
-
for (const feed of
|
|
723
|
+
for (const feed of chainlink_default.feeds) {
|
|
639
724
|
const parsed = parseUsdPair(feed.pair);
|
|
640
725
|
if (!parsed) continue;
|
|
641
726
|
map[parsed.currency] = {
|
|
@@ -1495,7 +1580,7 @@ var ProtocolViewerReader = class {
|
|
|
1495
1580
|
if (inputCount === null) {
|
|
1496
1581
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1497
1582
|
}
|
|
1498
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1583
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1499
1584
|
if (inputCount >= 3) {
|
|
1500
1585
|
return tryContexts(
|
|
1501
1586
|
protocolViewerContexts,
|
|
@@ -1574,7 +1659,7 @@ var ProtocolViewerReader = class {
|
|
|
1574
1659
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1575
1660
|
}
|
|
1576
1661
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1577
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1662
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1578
1663
|
if (inputCount >= 2) {
|
|
1579
1664
|
const requests = ids.map((id, index) => ({
|
|
1580
1665
|
index,
|
|
@@ -1679,7 +1764,7 @@ var ProtocolViewerReader = class {
|
|
|
1679
1764
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
1680
1765
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
1681
1766
|
}
|
|
1682
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1767
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1683
1768
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
1684
1769
|
if (inputCount >= 2) {
|
|
1685
1770
|
const readAndFilter = async (raw2) => {
|
|
@@ -1750,7 +1835,7 @@ var ProtocolViewerReader = class {
|
|
|
1750
1835
|
if (protocolViewerEntries.length === 0) {
|
|
1751
1836
|
throw new Error("ProtocolViewer not available for this network");
|
|
1752
1837
|
}
|
|
1753
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
1838
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1754
1839
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
1755
1840
|
let attemptedRead = false;
|
|
1756
1841
|
let hadSuccessfulRead = false;
|
|
@@ -1858,7 +1943,7 @@ var ProtocolViewerReader = class {
|
|
|
1858
1943
|
if (protocolViewerEntries.length === 0) {
|
|
1859
1944
|
throw new Error("ProtocolViewer not available for this network");
|
|
1860
1945
|
}
|
|
1861
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
1946
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1862
1947
|
let lastError;
|
|
1863
1948
|
for (const pvEntry of protocolViewerEntries) {
|
|
1864
1949
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -5028,12 +5113,13 @@ async function apiUploadSellerCredential(makerId, bundle, baseApiUrl, timeoutMs,
|
|
|
5028
5113
|
timeoutMs
|
|
5029
5114
|
});
|
|
5030
5115
|
}
|
|
5031
|
-
async function apiGetSellerCredentialStatus(
|
|
5116
|
+
async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApiUrl, timeoutMs) {
|
|
5117
|
+
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5118
|
+
payeeDetails
|
|
5119
|
+
)}/seller-credential/status`;
|
|
5032
5120
|
return apiFetch({
|
|
5033
|
-
url: `${withApiBase(baseApiUrl)}
|
|
5121
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5034
5122
|
method: "GET",
|
|
5035
|
-
apiKey,
|
|
5036
|
-
authToken,
|
|
5037
5123
|
timeoutMs
|
|
5038
5124
|
});
|
|
5039
5125
|
}
|
|
@@ -5098,11 +5184,12 @@ var formatTokenAmountForDisplay = (amount, decimals) => {
|
|
|
5098
5184
|
const trimmed = formatted.replace(/\.?0+$/, "");
|
|
5099
5185
|
return trimmed.length > 0 ? trimmed : "0";
|
|
5100
5186
|
};
|
|
5101
|
-
var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig, decimals) => {
|
|
5187
|
+
var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig, decimals, options = {}) => {
|
|
5102
5188
|
try {
|
|
5103
|
-
const
|
|
5189
|
+
const backendNetAmount = BigInt(tokenAmount);
|
|
5190
|
+
const grossAmount = BigInt(options.signalIntentAmount ?? tokenAmount);
|
|
5104
5191
|
const feeAmount = grossAmount * BigInt(referrerFeeConfig.feeBps) / 10000n;
|
|
5105
|
-
const netAmount =
|
|
5192
|
+
const netAmount = feeAmount >= backendNetAmount ? 0n : backendNetAmount - feeAmount;
|
|
5106
5193
|
return {
|
|
5107
5194
|
tokenAmount: netAmount.toString(),
|
|
5108
5195
|
tokenAmountFormatted: formatTokenAmountForDisplay(netAmount, decimals),
|
|
@@ -5117,10 +5204,12 @@ var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig
|
|
|
5117
5204
|
}
|
|
5118
5205
|
};
|
|
5119
5206
|
var applyReferrerFeeDisplayFieldsToQuote = (quote, referrerFeeConfig, decimals) => {
|
|
5207
|
+
const signalIntentAmount = quote.signalIntentAmount ?? quote.intent?.amount ?? quote.tokenAmount;
|
|
5120
5208
|
const adjusted = applyReferrerFeeDisplayFieldsToTokenAmount(
|
|
5121
5209
|
quote.tokenAmount,
|
|
5122
5210
|
referrerFeeConfig,
|
|
5123
|
-
decimals
|
|
5211
|
+
decimals,
|
|
5212
|
+
{ signalIntentAmount }
|
|
5124
5213
|
);
|
|
5125
5214
|
if (!adjusted) {
|
|
5126
5215
|
return quote;
|
|
@@ -7388,7 +7477,7 @@ var Zkp2pClient = class {
|
|
|
7388
7477
|
}
|
|
7389
7478
|
}
|
|
7390
7479
|
});
|
|
7391
|
-
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-
|
|
7480
|
+
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-MARF3D2J.mjs');
|
|
7392
7481
|
const normalized = params.conversionRates.map(
|
|
7393
7482
|
(group) => group.map((r) => ({ currency: r.currency, conversionRate: r.conversionRate }))
|
|
7394
7483
|
);
|
|
@@ -7656,7 +7745,13 @@ var Zkp2pClient = class {
|
|
|
7656
7745
|
payeeId: params.payeeId,
|
|
7657
7746
|
sessionMaterial: params.sessionMaterial
|
|
7658
7747
|
};
|
|
7659
|
-
const bundleResponse = await apiCreateSellerCredentialBundle(
|
|
7748
|
+
const bundleResponse = opts?.attestationRuntime ? await apiCreateSellerCredentialBundle(
|
|
7749
|
+
uploadPayload,
|
|
7750
|
+
attestationServiceUrl,
|
|
7751
|
+
params.platform,
|
|
7752
|
+
timeoutMs,
|
|
7753
|
+
opts.attestationRuntime
|
|
7754
|
+
) : await apiCreateSellerCredentialBundle(
|
|
7660
7755
|
uploadPayload,
|
|
7661
7756
|
attestationServiceUrl,
|
|
7662
7757
|
params.platform,
|
|
@@ -7679,9 +7774,9 @@ var Zkp2pClient = class {
|
|
|
7679
7774
|
* omits low-level diagnostics. Curator may still re-probe stale credentials during verify, so callers
|
|
7680
7775
|
* should continue to handle a 410 from `verifySellerPayment`.
|
|
7681
7776
|
*
|
|
7682
|
-
*
|
|
7777
|
+
* The curator status endpoint is public and keyed by platform plus hashed payee details.
|
|
7683
7778
|
*
|
|
7684
|
-
* Fetch seller credential status for a maker from curator.
|
|
7779
|
+
* Fetch seller credential status for a maker identity from curator.
|
|
7685
7780
|
*/
|
|
7686
7781
|
async getSellerCredentialStatus(params, opts) {
|
|
7687
7782
|
const baseApiUrl = this.stripTrailingSlash(
|
|
@@ -7689,11 +7784,10 @@ var Zkp2pClient = class {
|
|
|
7689
7784
|
);
|
|
7690
7785
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7691
7786
|
return apiGetSellerCredentialStatus(
|
|
7692
|
-
params.
|
|
7787
|
+
params.processorName,
|
|
7788
|
+
params.payeeDetails,
|
|
7693
7789
|
baseApiUrl,
|
|
7694
|
-
timeoutMs
|
|
7695
|
-
this.apiKey,
|
|
7696
|
-
this.authorizationToken
|
|
7790
|
+
timeoutMs
|
|
7697
7791
|
);
|
|
7698
7792
|
}
|
|
7699
7793
|
/**
|
|
@@ -7905,7 +7999,7 @@ var fiatAmountRegex = /^-?\d*(\.\d{0,6})?$/;
|
|
|
7905
7999
|
var usdcAmountRegex = /^\d+$/;
|
|
7906
8000
|
var assertObjectInput = (params) => {
|
|
7907
8001
|
if (params === void 0) {
|
|
7908
|
-
|
|
8002
|
+
throw new Error("Peer extension onramp requires query params with intentHash.");
|
|
7909
8003
|
}
|
|
7910
8004
|
if (params === null || typeof params !== "object" || Array.isArray(params)) {
|
|
7911
8005
|
throw new Error("Peer extension onramp expects an object of query params.");
|
|
@@ -7993,10 +8087,43 @@ var normalizeUsdcAmount = (value) => {
|
|
|
7993
8087
|
}
|
|
7994
8088
|
return trimmed;
|
|
7995
8089
|
};
|
|
8090
|
+
var normalizeIntegerParam = (value, label) => {
|
|
8091
|
+
if (value === void 0) {
|
|
8092
|
+
return void 0;
|
|
8093
|
+
}
|
|
8094
|
+
if (typeof value === "bigint") {
|
|
8095
|
+
if (value < 0n) {
|
|
8096
|
+
throw new Error(`Peer extension onramp ${label} must be a non-negative integer.`);
|
|
8097
|
+
}
|
|
8098
|
+
return value.toString();
|
|
8099
|
+
}
|
|
8100
|
+
if (typeof value === "number") {
|
|
8101
|
+
if (!Number.isFinite(value) || value < 0 || !Number.isInteger(value)) {
|
|
8102
|
+
throw new Error(`Peer extension onramp ${label} must be a non-negative integer.`);
|
|
8103
|
+
}
|
|
8104
|
+
if (!Number.isSafeInteger(value)) {
|
|
8105
|
+
throw new Error(
|
|
8106
|
+
`Peer extension onramp ${label} number input must be a safe integer; pass a string or bigint for larger values.`
|
|
8107
|
+
);
|
|
8108
|
+
}
|
|
8109
|
+
return String(value);
|
|
8110
|
+
}
|
|
8111
|
+
if (typeof value !== "string") {
|
|
8112
|
+
throw new Error(`Peer extension onramp ${label} must be a string, number, or bigint.`);
|
|
8113
|
+
}
|
|
8114
|
+
const trimmed = value.trim();
|
|
8115
|
+
if (!trimmed) {
|
|
8116
|
+
throw new Error(`Peer extension onramp ${label} must be a non-empty value.`);
|
|
8117
|
+
}
|
|
8118
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
8119
|
+
throw new Error(`Peer extension onramp ${label} must be a non-negative integer.`);
|
|
8120
|
+
}
|
|
8121
|
+
return trimmed;
|
|
8122
|
+
};
|
|
7996
8123
|
var intentHashRegex = /^0x[a-fA-F0-9]{64}$/;
|
|
7997
8124
|
var normalizeIntentHash = (value) => {
|
|
7998
8125
|
if (value === void 0) {
|
|
7999
|
-
|
|
8126
|
+
throw new Error("Peer extension onramp intentHash is required.");
|
|
8000
8127
|
}
|
|
8001
8128
|
if (typeof value !== "string") {
|
|
8002
8129
|
throw new Error("Peer extension onramp intentHash must be a string.");
|
|
@@ -8028,6 +8155,7 @@ var buildOnrampQueryString = (params) => {
|
|
|
8028
8155
|
"paymentPlatform",
|
|
8029
8156
|
normalizeOptionalString(validated.paymentPlatform, "paymentPlatform")
|
|
8030
8157
|
);
|
|
8158
|
+
setParam("depositId", normalizeIntegerParam(validated.depositId, "depositId"));
|
|
8031
8159
|
setParam("toToken", normalizeOptionalString(validated.toToken, "toToken"));
|
|
8032
8160
|
setParam("amountUsdc", normalizeUsdcAmount(validated.amountUsdc));
|
|
8033
8161
|
setParam(
|
|
@@ -8042,8 +8170,13 @@ var createPeerExtensionSdk = (options = {}) => ({
|
|
|
8042
8170
|
requestConnection: () => requirePeer(options).requestConnection(),
|
|
8043
8171
|
checkConnectionStatus: () => requirePeer(options).checkConnectionStatus(),
|
|
8044
8172
|
openSidebar: (route) => requirePeer(options).openSidebar(route),
|
|
8045
|
-
onramp: (params) =>
|
|
8046
|
-
|
|
8173
|
+
onramp: (params, callback) => {
|
|
8174
|
+
if (typeof callback !== "function") {
|
|
8175
|
+
throw new Error("Peer extension onramp callback is required.");
|
|
8176
|
+
}
|
|
8177
|
+
requirePeer(options).onramp(buildOnrampQueryString(params), callback);
|
|
8178
|
+
},
|
|
8179
|
+
getOnrampTransaction: (intentHash) => requirePeer(options).getOnrampTransaction(normalizeIntentHash(intentHash)),
|
|
8047
8180
|
getVersion: () => requirePeer(options).getVersion(),
|
|
8048
8181
|
openInstallPage: () => openPeerExtensionInstallPage(options),
|
|
8049
8182
|
getState: () => getPeerExtensionState(options)
|