@zkp2p/sdk 0.4.0 → 0.4.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/dist/index.cjs +230 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.mjs +229 -28
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{vaultUtils-CyPf4QGT.d.mts → vaultUtils-Bi2uldoa.d.mts} +97 -7
- package/dist/{vaultUtils-CyPf4QGT.d.ts → vaultUtils-Bi2uldoa.d.ts} +97 -7
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, S as SellerCredentialUploadInput, a as SellerPlatform, b as SellerCredentialAttestationRuntime, A as AttestationServiceSellerCredentialUploadResponse, Q as QuotesBestByPlatformRequest,
|
|
2
|
-
export {
|
|
3
|
-
import { Address, Hex, WalletClient
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, S as SellerCredentialUploadInput, a as SellerPlatform, b as SellerCredentialAttestationRuntime, A as AttestationServiceSellerCredentialUploadResponse, B as BuyerTeeSessionMaterialEncryptionInput, C as ConfirmPayPalForwardingResponse, G as GoogleOAuthSellerCredentialPlatform, c as GoogleOAuthSellerCredentialUploadBodyByPlatform, d as CuratorSellerCredentialUploadResponse, Q as QuotesBestByPlatformRequest, e as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, f as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, g as PostDepositDetailsResponse, h as GetPayeeDetailsRequest, i as GetPayeeDetailsResponse, j as GetOwnerDepositsRequest, k as GetOwnerDepositsResponse, l as GetTakerTierRequest, m as GetTakerTierResponse, n as GetDepositBundleParams, o as ApiAdapterOptions, p as GetDepositBundleResponse, q as GetOrderbookParams, r as GetOrderbookResponse, s as CurrencyType, t as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-Bi2uldoa.mjs';
|
|
2
|
+
export { E as ActionCallback, af as ApiDeposit, am as ApiIntentStatus, aZ as AttestationServiceSellerCredentialProbeResponse, aY as AttestationServiceSellerVerifyResponse, y as AuthorizationTokenProvider, cx as BatchResult, U as BestByPlatformResponseObject, a_ as BuyerTeePaymentParams, a$ as BuyerTeePaymentProofInput, b0 as BuyerTeeSessionMaterial, w as CancelIntentMethodParams, O as CancelIntentParams, aF as CashAppCredentialUploadInput, aw as CashAppSessionMaterial, b7 as ConfirmPayPalForwardingRequest, J as CreateDepositConversionRate, H as CreateDepositParams, b1 as CuratorSellerCredentialStatusResponse, b2 as CuratorSellerVerifyResponse, c0 as Currency, c7 as CurrencyData, cw as DelegationDepositTarget, cu as DelegationRoute, cv as DelegationState, ci as Deposit, ck as DepositCurrency, bh as DepositIntentStatistics, ai as DepositStatus, ag as DepositVerifier, ah as DepositVerifierCurrency, be as DepositVerifierData, ch as DepositView, ab as FiatResponse, F as FulfillIntentMethodParams, M as FulfillIntentParams, X as GetBestByPlatformResponse, Y as GetBestByPlatformResponseObject, aj as GetDepositByIdRequest, ak as GetDepositByIdResponse, ar as GetIntentByHashRequest, as as GetIntentByHashResponse, ap as GetIntentsByDepositRequest, aq as GetIntentsByDepositResponse, a1 as GetNearbyQuote, a2 as GetNearbySuggestions, an as GetOwnerIntentsRequest, ao as GetOwnerIntentsResponse, _ as GetPlatformQuote, a3 as GetQuoteResponse, a4 as GetQuoteResponseObject, a5 as GetQuoteSingleResponse, b6 as GetSellerCredentialStatusParams, bo as IndexerClient, bW as IndexerDeploymentEnv, bu as IndexerDeposit, bL as IndexerDepositDailySnapshot, bN as IndexerDepositFilter, bK as IndexerDepositFundActivity, bM as IndexerDepositFundActivityType, bQ as IndexerDepositOrderDirection, bP as IndexerDepositOrderField, bO as IndexerDepositPagination, bx as IndexerDepositPaymentMethod, bq as IndexerDepositService, bZ as IndexerFulfillmentAndPaymentResponse, bX as IndexerFulfillmentRecord, bv as IndexerIntentFulfilled, bw as IndexerIntentFulfillmentAmounts, bz as IndexerIntentStatus, bD as IndexerManagerAggregateStats, bF as IndexerManagerDailySnapshot, bE as IndexerManagerStats, bI as IndexerManualRateUpdate, by as IndexerMethodCurrency, bJ as IndexerOracleConfigUpdate, bY as IndexerPaymentVerifiedRecord, bA as IndexerRateManager, bC as IndexerRateManagerDelegation, bT as IndexerRateManagerDelegationPagination, bH as IndexerRateManagerDetail, bR as IndexerRateManagerFilter, bG as IndexerRateManagerListItem, bV as IndexerRateManagerOrderDirection, bU as IndexerRateManagerOrderField, bS as IndexerRateManagerPagination, bB as IndexerRateManagerRate, br as IndexerRateManagerService, al as Intent, cm as IntentView, ad as NearbyQuote, ae as NearbySuggestions, Z as OfframpClient, bd as OnchainCurrency, cn as OnchainIntent, bg as OrderStats, bn as OrderbookEntry, b_ as PAYMENT_PLATFORMS, aH as PayPalCredentialUploadInput, b8 as PayPalForwardingConfirmationErrorCode, aC as PayPalGoogleOAuthSellerCredentialUploadBody, aB as PayPalSessionMaterial, cj as PaymentMethodData, b$ as PaymentPlatformType, bl as PlatformLimit, $ as PlatformQuote, bm as PlatformRiskLevel, bf as PreparedTransaction, aa as QuoteFeesResponse, a9 as QuoteIntentResponse, a0 as QuoteRequest, a6 as QuoteResponse, a7 as QuoteResponseObject, a8 as QuoteSingleResponse, K as Range, cl as ReferralFee, at as RegisterPayeeDetailsRequest, au as RegisterPayeeDetailsResponse, b4 as RegisteredUploadSellerCredentialParams, N as ReleaseFundsToPayerParams, cc as RuntimeEnv, aW as SellerAttestationOutput, aJ as SellerCiphertextBundle, aO as SellerCredentialBundle, aP as SellerCredentialBundleUpload, aX as SellerCredentialProbeResponse, aR as SellerCredentialStatus, aQ as SellerCredentialStatusValue, aI as SellerCredentialUploadInputByPlatform, aV as SellerPaymentTypedDataValue, aN as SellerProbeInput, aK as SellerSignedCiphertextBundle, aT as SellerTypedDataField, aU as SellerTypedDataSpec, aM as SellerVerifyInput, aL as SellerVerifyIntentDetails, aS as SellerVerifyProxyBody, cz as SendBatchFn, cy as SendTransactionFn, v as SignalIntentMethodParams, L as SignalIntentParams, u as SignalIntentReferralFee, bi as TakerTier, bk as TakerTierLevel, bj as TakerTierStats, z as TimeoutConfig, ac as TokenResponse, bb as UploadGoogleOAuthSellerCredentialParams, b9 as UploadPayPalGoogleOAuthSellerCredentialParams, b5 as UploadSellerCredentialOptions, b3 as UploadSellerCredentialParams, ba as UploadVenmoGoogleOAuthSellerCredentialParams, aE as VenmoCredentialUploadInput, aD as VenmoGoogleOAuthSellerCredentialUploadBody, av as VenmoSessionMaterial, bc as VerifySellerPaymentParams, aG as WiseCredentialUploadInput, ay as WiseProfileInfo, aA as WiseProfileNotFound, az as WiseProfileSelectionRequired, ax as WiseSessionMaterial, W as WithdrawDepositParams, co as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, x as Zkp2pClientOptions, ct as classifyDelegationState, bs as compareEventCursorIdsByRecency, c1 as currencyInfo, bp as defaultIndexerEndpoint, cf as enrichPvDepositView, cg as enrichPvIntentView, bt as fetchIndexerFulfillmentAndPayment, c8 as getContracts, c4 as getCurrencyCodeFromHash, c3 as getCurrencyInfoFromCountryCode, c2 as getCurrencyInfoFromHash, cs as getDelegationRoute, cb as getGatingServiceAddress, ca as getPaymentMethodsCatalog, c9 as getRateManagerContracts, c5 as isSupportedCurrencyHash, cp as isZeroRateManagerId, c6 as mapConversionRatesToOnchainMinRate, cq as normalizeRateManagerId, cr as normalizeRegistry, cd as parseDepositView, ce as parseIntentView } from './vaultUtils-Bi2uldoa.mjs';
|
|
3
|
+
import { Address, Hash, Hex, WalletClient } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
|
6
6
|
|
|
@@ -190,6 +190,7 @@ interface ConvertLiquidityOptions {
|
|
|
190
190
|
declare function convertDepositsForLiquidity(deposits: DepositWithRelations[], chainId: number, escrowAddress: string, options?: ConvertLiquidityOptions): EscrowDepositView[];
|
|
191
191
|
declare function convertIndexerIntentsToEscrowViews(intents: IntentEntity[], depositViewsById: Map<string, EscrowDepositView>): EscrowIntentView[];
|
|
192
192
|
|
|
193
|
+
declare function createEncryptedBuyerTeeSessionMaterial({ actionType, attestationRuntime, attestationServiceUrl, platform, sessionMaterial, timeoutMs, }: BuyerTeeSessionMaterialEncryptionInput): Promise<string>;
|
|
193
194
|
declare function apiCreateSellerCredentialBundle(payload: SellerCredentialUploadInput, attestationServiceUrl: string, platform: SellerPlatform, timeoutMs?: number, attestationRuntime?: SellerCredentialAttestationRuntime): Promise<AttestationServiceSellerCredentialUploadResponse>;
|
|
194
195
|
|
|
195
196
|
declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number, _apiKey?: string, _authToken?: string): Promise<PostDepositDetailsResponse>;
|
|
@@ -201,6 +202,19 @@ declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: strin
|
|
|
201
202
|
* Get taker tier information for a specific address.
|
|
202
203
|
*/
|
|
203
204
|
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string, timeoutMs?: number): Promise<GetTakerTierResponse>;
|
|
205
|
+
declare function apiConfirmPayPalForwarding(payeeDetails: Hash, body: {
|
|
206
|
+
payeeEmail: string;
|
|
207
|
+
forwardingInitiatorEmail: string;
|
|
208
|
+
}, baseApiUrl: string, opts?: {
|
|
209
|
+
apiKey?: string;
|
|
210
|
+
authToken?: string;
|
|
211
|
+
timeoutMs?: number;
|
|
212
|
+
}): Promise<ConfirmPayPalForwardingResponse>;
|
|
213
|
+
declare function apiUploadGoogleOAuthSellerCredential<P extends GoogleOAuthSellerCredentialPlatform>(processorName: P, payeeDetails: Hash, body: GoogleOAuthSellerCredentialUploadBodyByPlatform[P], baseApiUrl: string, opts?: {
|
|
214
|
+
apiKey?: string;
|
|
215
|
+
authToken?: string;
|
|
216
|
+
timeoutMs?: number;
|
|
217
|
+
}): Promise<CuratorSellerCredentialUploadResponse>;
|
|
204
218
|
declare function apiGetOrderbook(params: GetOrderbookParams, opts: ApiAdapterOptions): Promise<GetOrderbookResponse>;
|
|
205
219
|
declare function apiGetOrderbook(params: GetOrderbookParams, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<GetOrderbookResponse>;
|
|
206
220
|
declare function apiGetDepositBundle(params: GetDepositBundleParams, opts: ApiAdapterOptions): Promise<GetDepositBundleResponse>;
|
|
@@ -703,4 +717,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
703
717
|
constructor(message: string, details?: unknown);
|
|
704
718
|
}
|
|
705
719
|
|
|
706
|
-
export { APIError, ApiAdapterOptions, AttestationServiceSellerCredentialUploadResponse, 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, SellerCredentialAttestationRuntime, SellerCredentialUploadInput, SellerPlatform, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiCreateSellerCredentialBundle, 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 };
|
|
720
|
+
export { APIError, ApiAdapterOptions, AttestationServiceSellerCredentialUploadResponse, BASE_BUILDER_CODE, BestByPlatformResponse, BuyerTeeSessionMaterialEncryptionInput, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ConfirmPayPalForwardingResponse, ContractError, ContractRouter, type ContractRouterConfig, CuratorSellerCredentialUploadResponse, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetDepositBundleParams, GetDepositBundleResponse, GetOrderbookParams, GetOrderbookResponse, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, GoogleOAuthSellerCredentialPlatform, GoogleOAuthSellerCredentialUploadBodyByPlatform, 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, SellerCredentialAttestationRuntime, SellerCredentialUploadInput, SellerPlatform, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiConfirmPayPalForwarding, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiUploadGoogleOAuthSellerCredential, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, 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,6 +1,6 @@
|
|
|
1
|
-
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, S as SellerCredentialUploadInput, a as SellerPlatform, b as SellerCredentialAttestationRuntime, A as AttestationServiceSellerCredentialUploadResponse, Q as QuotesBestByPlatformRequest,
|
|
2
|
-
export {
|
|
3
|
-
import { Address, Hex, WalletClient
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, S as SellerCredentialUploadInput, a as SellerPlatform, b as SellerCredentialAttestationRuntime, A as AttestationServiceSellerCredentialUploadResponse, B as BuyerTeeSessionMaterialEncryptionInput, C as ConfirmPayPalForwardingResponse, G as GoogleOAuthSellerCredentialPlatform, c as GoogleOAuthSellerCredentialUploadBodyByPlatform, d as CuratorSellerCredentialUploadResponse, Q as QuotesBestByPlatformRequest, e as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, f as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, g as PostDepositDetailsResponse, h as GetPayeeDetailsRequest, i as GetPayeeDetailsResponse, j as GetOwnerDepositsRequest, k as GetOwnerDepositsResponse, l as GetTakerTierRequest, m as GetTakerTierResponse, n as GetDepositBundleParams, o as ApiAdapterOptions, p as GetDepositBundleResponse, q as GetOrderbookParams, r as GetOrderbookResponse, s as CurrencyType, t as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-Bi2uldoa.js';
|
|
2
|
+
export { E as ActionCallback, af as ApiDeposit, am as ApiIntentStatus, aZ as AttestationServiceSellerCredentialProbeResponse, aY as AttestationServiceSellerVerifyResponse, y as AuthorizationTokenProvider, cx as BatchResult, U as BestByPlatformResponseObject, a_ as BuyerTeePaymentParams, a$ as BuyerTeePaymentProofInput, b0 as BuyerTeeSessionMaterial, w as CancelIntentMethodParams, O as CancelIntentParams, aF as CashAppCredentialUploadInput, aw as CashAppSessionMaterial, b7 as ConfirmPayPalForwardingRequest, J as CreateDepositConversionRate, H as CreateDepositParams, b1 as CuratorSellerCredentialStatusResponse, b2 as CuratorSellerVerifyResponse, c0 as Currency, c7 as CurrencyData, cw as DelegationDepositTarget, cu as DelegationRoute, cv as DelegationState, ci as Deposit, ck as DepositCurrency, bh as DepositIntentStatistics, ai as DepositStatus, ag as DepositVerifier, ah as DepositVerifierCurrency, be as DepositVerifierData, ch as DepositView, ab as FiatResponse, F as FulfillIntentMethodParams, M as FulfillIntentParams, X as GetBestByPlatformResponse, Y as GetBestByPlatformResponseObject, aj as GetDepositByIdRequest, ak as GetDepositByIdResponse, ar as GetIntentByHashRequest, as as GetIntentByHashResponse, ap as GetIntentsByDepositRequest, aq as GetIntentsByDepositResponse, a1 as GetNearbyQuote, a2 as GetNearbySuggestions, an as GetOwnerIntentsRequest, ao as GetOwnerIntentsResponse, _ as GetPlatformQuote, a3 as GetQuoteResponse, a4 as GetQuoteResponseObject, a5 as GetQuoteSingleResponse, b6 as GetSellerCredentialStatusParams, bo as IndexerClient, bW as IndexerDeploymentEnv, bu as IndexerDeposit, bL as IndexerDepositDailySnapshot, bN as IndexerDepositFilter, bK as IndexerDepositFundActivity, bM as IndexerDepositFundActivityType, bQ as IndexerDepositOrderDirection, bP as IndexerDepositOrderField, bO as IndexerDepositPagination, bx as IndexerDepositPaymentMethod, bq as IndexerDepositService, bZ as IndexerFulfillmentAndPaymentResponse, bX as IndexerFulfillmentRecord, bv as IndexerIntentFulfilled, bw as IndexerIntentFulfillmentAmounts, bz as IndexerIntentStatus, bD as IndexerManagerAggregateStats, bF as IndexerManagerDailySnapshot, bE as IndexerManagerStats, bI as IndexerManualRateUpdate, by as IndexerMethodCurrency, bJ as IndexerOracleConfigUpdate, bY as IndexerPaymentVerifiedRecord, bA as IndexerRateManager, bC as IndexerRateManagerDelegation, bT as IndexerRateManagerDelegationPagination, bH as IndexerRateManagerDetail, bR as IndexerRateManagerFilter, bG as IndexerRateManagerListItem, bV as IndexerRateManagerOrderDirection, bU as IndexerRateManagerOrderField, bS as IndexerRateManagerPagination, bB as IndexerRateManagerRate, br as IndexerRateManagerService, al as Intent, cm as IntentView, ad as NearbyQuote, ae as NearbySuggestions, Z as OfframpClient, bd as OnchainCurrency, cn as OnchainIntent, bg as OrderStats, bn as OrderbookEntry, b_ as PAYMENT_PLATFORMS, aH as PayPalCredentialUploadInput, b8 as PayPalForwardingConfirmationErrorCode, aC as PayPalGoogleOAuthSellerCredentialUploadBody, aB as PayPalSessionMaterial, cj as PaymentMethodData, b$ as PaymentPlatformType, bl as PlatformLimit, $ as PlatformQuote, bm as PlatformRiskLevel, bf as PreparedTransaction, aa as QuoteFeesResponse, a9 as QuoteIntentResponse, a0 as QuoteRequest, a6 as QuoteResponse, a7 as QuoteResponseObject, a8 as QuoteSingleResponse, K as Range, cl as ReferralFee, at as RegisterPayeeDetailsRequest, au as RegisterPayeeDetailsResponse, b4 as RegisteredUploadSellerCredentialParams, N as ReleaseFundsToPayerParams, cc as RuntimeEnv, aW as SellerAttestationOutput, aJ as SellerCiphertextBundle, aO as SellerCredentialBundle, aP as SellerCredentialBundleUpload, aX as SellerCredentialProbeResponse, aR as SellerCredentialStatus, aQ as SellerCredentialStatusValue, aI as SellerCredentialUploadInputByPlatform, aV as SellerPaymentTypedDataValue, aN as SellerProbeInput, aK as SellerSignedCiphertextBundle, aT as SellerTypedDataField, aU as SellerTypedDataSpec, aM as SellerVerifyInput, aL as SellerVerifyIntentDetails, aS as SellerVerifyProxyBody, cz as SendBatchFn, cy as SendTransactionFn, v as SignalIntentMethodParams, L as SignalIntentParams, u as SignalIntentReferralFee, bi as TakerTier, bk as TakerTierLevel, bj as TakerTierStats, z as TimeoutConfig, ac as TokenResponse, bb as UploadGoogleOAuthSellerCredentialParams, b9 as UploadPayPalGoogleOAuthSellerCredentialParams, b5 as UploadSellerCredentialOptions, b3 as UploadSellerCredentialParams, ba as UploadVenmoGoogleOAuthSellerCredentialParams, aE as VenmoCredentialUploadInput, aD as VenmoGoogleOAuthSellerCredentialUploadBody, av as VenmoSessionMaterial, bc as VerifySellerPaymentParams, aG as WiseCredentialUploadInput, ay as WiseProfileInfo, aA as WiseProfileNotFound, az as WiseProfileSelectionRequired, ax as WiseSessionMaterial, W as WithdrawDepositParams, co as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, x as Zkp2pClientOptions, ct as classifyDelegationState, bs as compareEventCursorIdsByRecency, c1 as currencyInfo, bp as defaultIndexerEndpoint, cf as enrichPvDepositView, cg as enrichPvIntentView, bt as fetchIndexerFulfillmentAndPayment, c8 as getContracts, c4 as getCurrencyCodeFromHash, c3 as getCurrencyInfoFromCountryCode, c2 as getCurrencyInfoFromHash, cs as getDelegationRoute, cb as getGatingServiceAddress, ca as getPaymentMethodsCatalog, c9 as getRateManagerContracts, c5 as isSupportedCurrencyHash, cp as isZeroRateManagerId, c6 as mapConversionRatesToOnchainMinRate, cq as normalizeRateManagerId, cr as normalizeRegistry, cd as parseDepositView, ce as parseIntentView } from './vaultUtils-Bi2uldoa.js';
|
|
3
|
+
import { Address, Hash, Hex, WalletClient } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
|
6
6
|
|
|
@@ -190,6 +190,7 @@ interface ConvertLiquidityOptions {
|
|
|
190
190
|
declare function convertDepositsForLiquidity(deposits: DepositWithRelations[], chainId: number, escrowAddress: string, options?: ConvertLiquidityOptions): EscrowDepositView[];
|
|
191
191
|
declare function convertIndexerIntentsToEscrowViews(intents: IntentEntity[], depositViewsById: Map<string, EscrowDepositView>): EscrowIntentView[];
|
|
192
192
|
|
|
193
|
+
declare function createEncryptedBuyerTeeSessionMaterial({ actionType, attestationRuntime, attestationServiceUrl, platform, sessionMaterial, timeoutMs, }: BuyerTeeSessionMaterialEncryptionInput): Promise<string>;
|
|
193
194
|
declare function apiCreateSellerCredentialBundle(payload: SellerCredentialUploadInput, attestationServiceUrl: string, platform: SellerPlatform, timeoutMs?: number, attestationRuntime?: SellerCredentialAttestationRuntime): Promise<AttestationServiceSellerCredentialUploadResponse>;
|
|
194
195
|
|
|
195
196
|
declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number, _apiKey?: string, _authToken?: string): Promise<PostDepositDetailsResponse>;
|
|
@@ -201,6 +202,19 @@ declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: strin
|
|
|
201
202
|
* Get taker tier information for a specific address.
|
|
202
203
|
*/
|
|
203
204
|
declare function apiGetTakerTier(req: GetTakerTierRequest, apiKey: string | undefined, baseApiUrl: string, timeoutMs?: number): Promise<GetTakerTierResponse>;
|
|
205
|
+
declare function apiConfirmPayPalForwarding(payeeDetails: Hash, body: {
|
|
206
|
+
payeeEmail: string;
|
|
207
|
+
forwardingInitiatorEmail: string;
|
|
208
|
+
}, baseApiUrl: string, opts?: {
|
|
209
|
+
apiKey?: string;
|
|
210
|
+
authToken?: string;
|
|
211
|
+
timeoutMs?: number;
|
|
212
|
+
}): Promise<ConfirmPayPalForwardingResponse>;
|
|
213
|
+
declare function apiUploadGoogleOAuthSellerCredential<P extends GoogleOAuthSellerCredentialPlatform>(processorName: P, payeeDetails: Hash, body: GoogleOAuthSellerCredentialUploadBodyByPlatform[P], baseApiUrl: string, opts?: {
|
|
214
|
+
apiKey?: string;
|
|
215
|
+
authToken?: string;
|
|
216
|
+
timeoutMs?: number;
|
|
217
|
+
}): Promise<CuratorSellerCredentialUploadResponse>;
|
|
204
218
|
declare function apiGetOrderbook(params: GetOrderbookParams, opts: ApiAdapterOptions): Promise<GetOrderbookResponse>;
|
|
205
219
|
declare function apiGetOrderbook(params: GetOrderbookParams, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<GetOrderbookResponse>;
|
|
206
220
|
declare function apiGetDepositBundle(params: GetDepositBundleParams, opts: ApiAdapterOptions): Promise<GetDepositBundleResponse>;
|
|
@@ -703,4 +717,4 @@ declare class ContractError extends ZKP2PError {
|
|
|
703
717
|
constructor(message: string, details?: unknown);
|
|
704
718
|
}
|
|
705
719
|
|
|
706
|
-
export { APIError, ApiAdapterOptions, AttestationServiceSellerCredentialUploadResponse, 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, SellerCredentialAttestationRuntime, SellerCredentialUploadInput, SellerPlatform, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiCreateSellerCredentialBundle, 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 };
|
|
720
|
+
export { APIError, ApiAdapterOptions, AttestationServiceSellerCredentialUploadResponse, BASE_BUILDER_CODE, BestByPlatformResponse, BuyerTeeSessionMaterialEncryptionInput, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ConfirmPayPalForwardingResponse, ContractError, ContractRouter, type ContractRouterConfig, CuratorSellerCredentialUploadResponse, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetDepositBundleParams, GetDepositBundleResponse, GetOrderbookParams, GetOrderbookResponse, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, GoogleOAuthSellerCredentialPlatform, GoogleOAuthSellerCredentialUploadBodyByPlatform, 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, SellerCredentialAttestationRuntime, SellerCredentialUploadInput, SellerPlatform, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiConfirmPayPalForwarding, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiUploadGoogleOAuthSellerCredential, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, 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
|
@@ -8,7 +8,7 @@ export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCou
|
|
|
8
8
|
import './chunk-J5LGTIGS.mjs';
|
|
9
9
|
import { concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, formatUnits } from 'viem';
|
|
10
10
|
import { hardhat, base } from 'viem/chains';
|
|
11
|
-
import { createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
11
|
+
import { createEncryptedBuyerTeeSessionMaterial as createEncryptedBuyerTeeSessionMaterial$1, createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
12
12
|
import { AbiCoder } from 'ethers';
|
|
13
13
|
import { Attribution } from 'ox/erc8021';
|
|
14
14
|
|
|
@@ -413,6 +413,20 @@ async function apiSignIntentV3(request, opts) {
|
|
|
413
413
|
function headers() {
|
|
414
414
|
return { "Content-Type": "application/json" };
|
|
415
415
|
}
|
|
416
|
+
function normalizeOptionalString(value) {
|
|
417
|
+
if (typeof value !== "string") {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
const normalized = value.trim();
|
|
421
|
+
return normalized.length > 0 ? normalized : null;
|
|
422
|
+
}
|
|
423
|
+
function normalizeBaseUrl(value, label) {
|
|
424
|
+
const normalized = normalizeOptionalString(value)?.replace(/\/+$/u, "");
|
|
425
|
+
if (!normalized) {
|
|
426
|
+
throw new Error(`${label} is required for buyer TEE session encryption.`);
|
|
427
|
+
}
|
|
428
|
+
return normalized;
|
|
429
|
+
}
|
|
416
430
|
function isPayeeBoundSellerCredentialUploadInput(payload) {
|
|
417
431
|
return typeof payload.payeeId === "string";
|
|
418
432
|
}
|
|
@@ -477,6 +491,51 @@ async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platf
|
|
|
477
491
|
return res.json();
|
|
478
492
|
});
|
|
479
493
|
}
|
|
494
|
+
async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform, actionType) {
|
|
495
|
+
return withRetry(async () => {
|
|
496
|
+
let res;
|
|
497
|
+
try {
|
|
498
|
+
const endpoint = `/buyer/verify/${encodeURIComponent(platform)}/${encodeURIComponent(
|
|
499
|
+
actionType
|
|
500
|
+
)}`;
|
|
501
|
+
res = await fetch(`${attestationServiceUrl}${endpoint}`, {
|
|
502
|
+
method: "POST",
|
|
503
|
+
headers: headers(),
|
|
504
|
+
body: JSON.stringify(payload)
|
|
505
|
+
});
|
|
506
|
+
} catch (error) {
|
|
507
|
+
throw new NetworkError("Failed to connect to Attestation Service", {
|
|
508
|
+
endpoint: `/buyer/verify/${platform}/${actionType}`,
|
|
509
|
+
error
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
if (!res.ok) {
|
|
513
|
+
const errorText = await res.text();
|
|
514
|
+
throw parseAPIError(res, errorText);
|
|
515
|
+
}
|
|
516
|
+
return res.json();
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
async function createEncryptedBuyerTeeSessionMaterial({
|
|
520
|
+
actionType,
|
|
521
|
+
attestationRuntime,
|
|
522
|
+
attestationServiceUrl,
|
|
523
|
+
platform,
|
|
524
|
+
sessionMaterial,
|
|
525
|
+
timeoutMs
|
|
526
|
+
}) {
|
|
527
|
+
const params = {
|
|
528
|
+
actionType,
|
|
529
|
+
attestationServiceUrl: normalizeBaseUrl(attestationServiceUrl, "Attestation Service URL"),
|
|
530
|
+
platform,
|
|
531
|
+
sessionMaterial,
|
|
532
|
+
...timeoutMs == null ? {} : { timeoutMs },
|
|
533
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
534
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
535
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
536
|
+
};
|
|
537
|
+
return createEncryptedBuyerTeeSessionMaterial$1(params);
|
|
538
|
+
}
|
|
480
539
|
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs, attestationRuntime) {
|
|
481
540
|
return withRetry(
|
|
482
541
|
async () => {
|
|
@@ -531,12 +590,13 @@ function encodePaymentAttestation(attestation) {
|
|
|
531
590
|
const dataHash = td.dataHash;
|
|
532
591
|
const signatures = [resp.signature];
|
|
533
592
|
const encodedPaymentDetails = resp.encodedPaymentDetails;
|
|
593
|
+
const metadata = typeof resp.metadata === "string" && resp.metadata.length > 0 ? resp.metadata : "0x";
|
|
534
594
|
if (!intentHash || !releaseAmount || !dataHash || !encodedPaymentDetails) {
|
|
535
595
|
throw new Error("Attestation response missing required fields");
|
|
536
596
|
}
|
|
537
597
|
return abiCoder.encode(
|
|
538
598
|
["tuple(bytes32,uint256,bytes32,bytes[],bytes,bytes)"],
|
|
539
|
-
[[intentHash, releaseAmount, dataHash, signatures, encodedPaymentDetails,
|
|
599
|
+
[[intentHash, releaseAmount, dataHash, signatures, encodedPaymentDetails, metadata]]
|
|
540
600
|
);
|
|
541
601
|
}
|
|
542
602
|
|
|
@@ -938,6 +998,7 @@ var PLATFORM_ATTESTATION_CONFIG = {
|
|
|
938
998
|
chime: { actionType: "transfer_chime", actionPlatform: "chime" },
|
|
939
999
|
luxon: { actionType: "transfer_luxon", actionPlatform: "luxon" },
|
|
940
1000
|
n26: { actionType: "transfer_n26", actionPlatform: "n26" },
|
|
1001
|
+
alipay: { actionType: "transfer_alipay", actionPlatform: "alipay" },
|
|
941
1002
|
"zelle-chase": { actionType: "transfer_zelle", actionPlatform: "chase" },
|
|
942
1003
|
"zelle-bofa": { actionType: "transfer_zelle", actionPlatform: "bankofamerica" },
|
|
943
1004
|
"zelle-citi": { actionType: "transfer_zelle", actionPlatform: "citi" }
|
|
@@ -1238,6 +1299,8 @@ var IntentOperations = class {
|
|
|
1238
1299
|
paymentProof = precomputed.paymentProof;
|
|
1239
1300
|
verificationData = precomputed.verificationData;
|
|
1240
1301
|
} else {
|
|
1302
|
+
const { proof } = params;
|
|
1303
|
+
const buyerTeeProof = parseBuyerTeePaymentProofInput(proof);
|
|
1241
1304
|
const attestationServiceUrl = params.attestationServiceUrl ?? this.defaultAttestationService();
|
|
1242
1305
|
const inputs = await this.config.host.getFulfillIntentInputs(intentHash, {
|
|
1243
1306
|
orchestratorAddress: orchestratorContext.address
|
|
@@ -1252,24 +1315,33 @@ var IntentOperations = class {
|
|
|
1252
1315
|
throw new Error("Unknown paymentMethodHash for this network/env; update SDK catalogs.");
|
|
1253
1316
|
}
|
|
1254
1317
|
const platformConfig = resolvePlatformAttestationConfig(platformName);
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
paymentMethod: paymentMethodHash,
|
|
1265
|
-
fiatCurrency: inputs.fiatCurrency,
|
|
1266
|
-
conversionRate: inputs.conversionRate,
|
|
1267
|
-
payeeDetails: inputs.payeeDetails,
|
|
1268
|
-
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
1269
|
-
}
|
|
1318
|
+
const intent = {
|
|
1319
|
+
intentHash,
|
|
1320
|
+
amount: inputs.amount,
|
|
1321
|
+
timestampMs: inputs.intentTimestampMs,
|
|
1322
|
+
paymentMethod: paymentMethodHash,
|
|
1323
|
+
fiatCurrency: inputs.fiatCurrency,
|
|
1324
|
+
conversionRate: inputs.conversionRate,
|
|
1325
|
+
payeeDetails: inputs.payeeDetails,
|
|
1326
|
+
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
1270
1327
|
};
|
|
1271
|
-
const attestation = await
|
|
1272
|
-
|
|
1328
|
+
const attestation = buyerTeeProof ? await apiVerifyBuyerTeePayment(
|
|
1329
|
+
{
|
|
1330
|
+
encryptedSessionMaterial: buyerTeeProof.encryptedSessionMaterial,
|
|
1331
|
+
params: buyerTeeProof.params,
|
|
1332
|
+
chainId: this.config.getChainId(),
|
|
1333
|
+
intent
|
|
1334
|
+
},
|
|
1335
|
+
attestationServiceUrl,
|
|
1336
|
+
buyerTeeProof.actionPlatform ?? platformConfig.actionPlatform,
|
|
1337
|
+
buyerTeeProof.actionType ?? platformConfig.actionType
|
|
1338
|
+
) : await apiCreatePaymentAttestation(
|
|
1339
|
+
{
|
|
1340
|
+
proofType: "reclaim",
|
|
1341
|
+
proof: typeof proof === "string" ? proof : serializeProofInput(proof),
|
|
1342
|
+
chainId: this.config.getChainId(),
|
|
1343
|
+
intent
|
|
1344
|
+
},
|
|
1273
1345
|
attestationServiceUrl,
|
|
1274
1346
|
platformConfig.actionPlatform,
|
|
1275
1347
|
platformConfig.actionType
|
|
@@ -1387,6 +1459,34 @@ function serializeProofInput(proof) {
|
|
|
1387
1459
|
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
1388
1460
|
);
|
|
1389
1461
|
}
|
|
1462
|
+
function isRecord(value) {
|
|
1463
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1464
|
+
}
|
|
1465
|
+
function isBuyerTeeParams(value) {
|
|
1466
|
+
return isRecord(value) && Object.values(value).every(
|
|
1467
|
+
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean"
|
|
1468
|
+
);
|
|
1469
|
+
}
|
|
1470
|
+
function parseBuyerTeePaymentProofInput(proof) {
|
|
1471
|
+
if (!isRecord(proof) || proof.proofType !== "buyerTee") {
|
|
1472
|
+
return null;
|
|
1473
|
+
}
|
|
1474
|
+
if (typeof proof.encryptedSessionMaterial !== "string" || !isBuyerTeeParams(proof.params)) {
|
|
1475
|
+
throw new Error("Buyer TEE proof requires encryptedSessionMaterial and params.");
|
|
1476
|
+
}
|
|
1477
|
+
const parsed = {
|
|
1478
|
+
proofType: "buyerTee",
|
|
1479
|
+
encryptedSessionMaterial: proof.encryptedSessionMaterial,
|
|
1480
|
+
params: proof.params
|
|
1481
|
+
};
|
|
1482
|
+
if (typeof proof.actionType === "string") {
|
|
1483
|
+
parsed.actionType = proof.actionType;
|
|
1484
|
+
}
|
|
1485
|
+
if (typeof proof.actionPlatform === "string") {
|
|
1486
|
+
parsed.actionPlatform = proof.actionPlatform;
|
|
1487
|
+
}
|
|
1488
|
+
return parsed;
|
|
1489
|
+
}
|
|
1390
1490
|
function normalizeSignalIntentReferralFees(params) {
|
|
1391
1491
|
if (params.referralFees) {
|
|
1392
1492
|
return params.referralFees.map((referralFee) => ({
|
|
@@ -5157,6 +5257,32 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
|
|
|
5157
5257
|
timeoutMs
|
|
5158
5258
|
});
|
|
5159
5259
|
}
|
|
5260
|
+
async function apiConfirmPayPalForwarding(payeeDetails, body, baseApiUrl, opts) {
|
|
5261
|
+
const endpoint = `/v2/makers/paypal/${encodeURIComponent(
|
|
5262
|
+
payeeDetails
|
|
5263
|
+
)}/seller-credential/forwarding-confirmation`;
|
|
5264
|
+
return apiFetch({
|
|
5265
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5266
|
+
method: "POST",
|
|
5267
|
+
body,
|
|
5268
|
+
apiKey: opts?.apiKey,
|
|
5269
|
+
authToken: opts?.authToken,
|
|
5270
|
+
timeoutMs: opts?.timeoutMs
|
|
5271
|
+
});
|
|
5272
|
+
}
|
|
5273
|
+
async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails, body, baseApiUrl, opts) {
|
|
5274
|
+
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5275
|
+
payeeDetails
|
|
5276
|
+
)}/seller-credential/google-oauth`;
|
|
5277
|
+
return apiFetch({
|
|
5278
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5279
|
+
method: "POST",
|
|
5280
|
+
body,
|
|
5281
|
+
apiKey: opts?.apiKey,
|
|
5282
|
+
authToken: opts?.authToken,
|
|
5283
|
+
timeoutMs: opts?.timeoutMs
|
|
5284
|
+
});
|
|
5285
|
+
}
|
|
5160
5286
|
async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApiUrl, timeoutMs) {
|
|
5161
5287
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5162
5288
|
payeeDetails
|
|
@@ -5254,6 +5380,11 @@ var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig
|
|
|
5254
5380
|
}
|
|
5255
5381
|
};
|
|
5256
5382
|
var applyReferrerFeeDisplayFieldsToQuote = (quote, referrerFeeConfig, decimals) => {
|
|
5383
|
+
const enrichedQuote = quote;
|
|
5384
|
+
const hasCuratorReferrerFeeFields = enrichedQuote.referrerFeeAmount != null || enrichedQuote.referrerFeeBps != null;
|
|
5385
|
+
if (hasCuratorReferrerFeeFields) {
|
|
5386
|
+
return enrichedQuote;
|
|
5387
|
+
}
|
|
5257
5388
|
const signalIntentAmount = quote.signalIntentAmount ?? quote.intent?.amount ?? quote.tokenAmount;
|
|
5258
5389
|
const adjusted = applyReferrerFeeDisplayFieldsToTokenAmount(
|
|
5259
5390
|
quote.tokenAmount,
|
|
@@ -6223,7 +6354,7 @@ var Zkp2pClient = class {
|
|
|
6223
6354
|
* ```
|
|
6224
6355
|
*
|
|
6225
6356
|
* @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
|
|
6226
|
-
* @param params.proof - Payment proof from Reclaim (object or JSON string)
|
|
6357
|
+
* @param params.proof - Payment proof from Reclaim (object or JSON string) or buyer TEE proof input
|
|
6227
6358
|
* @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
|
|
6228
6359
|
* @param params.attestationServiceUrl - Override attestation service URL
|
|
6229
6360
|
* @param params.postIntentHookData - Data to pass to post-intent hook
|
|
@@ -7859,6 +7990,76 @@ var Zkp2pClient = class {
|
|
|
7859
7990
|
timeoutMs
|
|
7860
7991
|
);
|
|
7861
7992
|
}
|
|
7993
|
+
/**
|
|
7994
|
+
* Confirms the PayPal Gmail-forwarding setup for an existing maker payee hash.
|
|
7995
|
+
*
|
|
7996
|
+
* Uses curator's `/forwarding-confirmation` route and forwards both API key and
|
|
7997
|
+
* bearer token so either auth strategy can satisfy the hybrid gate. The endpoint
|
|
7998
|
+
* is rate-limited server-side; callers should surface retry guidance from APIError.
|
|
7999
|
+
*/
|
|
8000
|
+
async confirmPayPalForwarding(params, opts) {
|
|
8001
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
8002
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
8003
|
+
);
|
|
8004
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
8005
|
+
return apiConfirmPayPalForwarding(
|
|
8006
|
+
params.payeeDetails,
|
|
8007
|
+
{
|
|
8008
|
+
payeeEmail: params.payeeEmail,
|
|
8009
|
+
forwardingInitiatorEmail: params.forwardingInitiatorEmail
|
|
8010
|
+
},
|
|
8011
|
+
baseApiUrl,
|
|
8012
|
+
{
|
|
8013
|
+
apiKey: this.apiKey,
|
|
8014
|
+
authToken: this.authorizationToken,
|
|
8015
|
+
timeoutMs
|
|
8016
|
+
}
|
|
8017
|
+
);
|
|
8018
|
+
}
|
|
8019
|
+
/**
|
|
8020
|
+
* Upload a seller Gmail OAuth authorization code through curator.
|
|
8021
|
+
*
|
|
8022
|
+
* Curator owns the encryption hop to attestation-service for this flow, so
|
|
8023
|
+
* callers send the one-time Google code plus the stable seller identity.
|
|
8024
|
+
*/
|
|
8025
|
+
async uploadGoogleOAuthSellerCredential(params, opts) {
|
|
8026
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
8027
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
8028
|
+
);
|
|
8029
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
8030
|
+
if (params.platform === "paypal") {
|
|
8031
|
+
return apiUploadGoogleOAuthSellerCredential(
|
|
8032
|
+
"paypal",
|
|
8033
|
+
params.payeeDetails,
|
|
8034
|
+
{
|
|
8035
|
+
payeeEmail: params.payeeEmail,
|
|
8036
|
+
authorizationCode: params.authorizationCode,
|
|
8037
|
+
redirectUri: params.redirectUri
|
|
8038
|
+
},
|
|
8039
|
+
baseApiUrl,
|
|
8040
|
+
{
|
|
8041
|
+
apiKey: this.apiKey,
|
|
8042
|
+
authToken: this.authorizationToken,
|
|
8043
|
+
timeoutMs
|
|
8044
|
+
}
|
|
8045
|
+
);
|
|
8046
|
+
}
|
|
8047
|
+
return apiUploadGoogleOAuthSellerCredential(
|
|
8048
|
+
"venmo",
|
|
8049
|
+
params.payeeDetails,
|
|
8050
|
+
{
|
|
8051
|
+
accountId: params.accountId,
|
|
8052
|
+
authorizationCode: params.authorizationCode,
|
|
8053
|
+
redirectUri: params.redirectUri
|
|
8054
|
+
},
|
|
8055
|
+
baseApiUrl,
|
|
8056
|
+
{
|
|
8057
|
+
apiKey: this.apiKey,
|
|
8058
|
+
authToken: this.authorizationToken,
|
|
8059
|
+
timeoutMs
|
|
8060
|
+
}
|
|
8061
|
+
);
|
|
8062
|
+
}
|
|
7862
8063
|
/**
|
|
7863
8064
|
* Status is a coarse curator-owned signal (`active` / `inactive` / `missing`) and intentionally
|
|
7864
8065
|
* omits low-level diagnostics. Curator may still re-probe stale credentials during verify, so callers
|
|
@@ -8097,7 +8298,7 @@ var assertObjectInput = (params) => {
|
|
|
8097
8298
|
}
|
|
8098
8299
|
return params;
|
|
8099
8300
|
};
|
|
8100
|
-
var
|
|
8301
|
+
var normalizeOptionalString2 = (value, label) => {
|
|
8101
8302
|
if (value === void 0) {
|
|
8102
8303
|
return void 0;
|
|
8103
8304
|
}
|
|
@@ -8111,7 +8312,7 @@ var normalizeOptionalString = (value, label) => {
|
|
|
8111
8312
|
return trimmed;
|
|
8112
8313
|
};
|
|
8113
8314
|
var normalizeOptionalUrl = (value, label) => {
|
|
8114
|
-
const trimmed =
|
|
8315
|
+
const trimmed = normalizeOptionalString2(value, label);
|
|
8115
8316
|
if (trimmed === void 0) {
|
|
8116
8317
|
return void 0;
|
|
8117
8318
|
}
|
|
@@ -8238,20 +8439,20 @@ var buildOnrampQueryString = (params) => {
|
|
|
8238
8439
|
searchParams.set(key, value);
|
|
8239
8440
|
}
|
|
8240
8441
|
};
|
|
8241
|
-
setParam("referrer",
|
|
8442
|
+
setParam("referrer", normalizeOptionalString2(validated.referrer, "referrer"));
|
|
8242
8443
|
setParam("referrerLogo", normalizeOptionalUrl(validated.referrerLogo, "referrerLogo"));
|
|
8243
|
-
setParam("inputCurrency",
|
|
8444
|
+
setParam("inputCurrency", normalizeOptionalString2(validated.inputCurrency, "inputCurrency"));
|
|
8244
8445
|
setParam("inputAmount", normalizeFiatAmount(validated.inputAmount));
|
|
8245
8446
|
setParam(
|
|
8246
8447
|
"paymentPlatform",
|
|
8247
|
-
|
|
8448
|
+
normalizeOptionalString2(validated.paymentPlatform, "paymentPlatform")
|
|
8248
8449
|
);
|
|
8249
8450
|
setParam("depositId", normalizeIntegerParam(validated.depositId, "depositId"));
|
|
8250
|
-
setParam("toToken",
|
|
8451
|
+
setParam("toToken", normalizeOptionalString2(validated.toToken, "toToken"));
|
|
8251
8452
|
setParam("amountUsdc", normalizeUsdcAmount(validated.amountUsdc));
|
|
8252
8453
|
setParam(
|
|
8253
8454
|
"recipientAddress",
|
|
8254
|
-
|
|
8455
|
+
normalizeOptionalString2(validated.recipientAddress, "recipientAddress")
|
|
8255
8456
|
);
|
|
8256
8457
|
setParam("intentHash", normalizeIntentHash(validated.intentHash));
|
|
8257
8458
|
return searchParams.toString();
|
|
@@ -8312,6 +8513,6 @@ var logger = {
|
|
|
8312
8513
|
}
|
|
8313
8514
|
};
|
|
8314
8515
|
|
|
8315
|
-
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, apiCreateSellerCredentialBundle, 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 };
|
|
8516
|
+
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, apiConfirmPayPalForwarding, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiUploadGoogleOAuthSellerCredential, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
8316
8517
|
//# sourceMappingURL=index.mjs.map
|
|
8317
8518
|
//# sourceMappingURL=index.mjs.map
|