@zkp2p/sdk 0.3.2 → 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-JRDFLSA7.mjs → chunk-L526MKG3.mjs} +641 -149
- package/dist/chunk-L526MKG3.mjs.map +1 -0
- package/dist/index.cjs +858 -295
- 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 +89 -32
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-GGSM2243.mjs +5 -0
- package/dist/{protocolViewerParsers-CQSES3QX.mjs.map → protocolViewerParsers-GGSM2243.mjs.map} +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- 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-JRDFLSA7.mjs.map +0 -1
- package/dist/protocolViewerParsers-CQSES3QX.mjs +0 -5
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,13 +1,14 @@
|
|
|
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
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
12
|
import { AbiCoder } from 'ethers';
|
|
12
13
|
import { Attribution } from 'ox/erc8021';
|
|
13
14
|
|
|
@@ -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", {
|
|
@@ -603,7 +612,7 @@ var PAYMENT_PLATFORMS = [
|
|
|
603
612
|
// src/utils/constants.ts
|
|
604
613
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
605
614
|
|
|
606
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.
|
|
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
|
|
607
616
|
var chainlink_default = {
|
|
608
617
|
feeds: [
|
|
609
618
|
{
|
|
@@ -1571,7 +1580,7 @@ var ProtocolViewerReader = class {
|
|
|
1571
1580
|
if (inputCount === null) {
|
|
1572
1581
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1573
1582
|
}
|
|
1574
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1583
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1575
1584
|
if (inputCount >= 3) {
|
|
1576
1585
|
return tryContexts(
|
|
1577
1586
|
protocolViewerContexts,
|
|
@@ -1650,7 +1659,7 @@ var ProtocolViewerReader = class {
|
|
|
1650
1659
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1651
1660
|
}
|
|
1652
1661
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1653
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1662
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1654
1663
|
if (inputCount >= 2) {
|
|
1655
1664
|
const requests = ids.map((id, index) => ({
|
|
1656
1665
|
index,
|
|
@@ -1755,7 +1764,7 @@ var ProtocolViewerReader = class {
|
|
|
1755
1764
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
1756
1765
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
1757
1766
|
}
|
|
1758
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1767
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1759
1768
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
1760
1769
|
if (inputCount >= 2) {
|
|
1761
1770
|
const readAndFilter = async (raw2) => {
|
|
@@ -1826,7 +1835,7 @@ var ProtocolViewerReader = class {
|
|
|
1826
1835
|
if (protocolViewerEntries.length === 0) {
|
|
1827
1836
|
throw new Error("ProtocolViewer not available for this network");
|
|
1828
1837
|
}
|
|
1829
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
1838
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1830
1839
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
1831
1840
|
let attemptedRead = false;
|
|
1832
1841
|
let hadSuccessfulRead = false;
|
|
@@ -1934,7 +1943,7 @@ var ProtocolViewerReader = class {
|
|
|
1934
1943
|
if (protocolViewerEntries.length === 0) {
|
|
1935
1944
|
throw new Error("ProtocolViewer not available for this network");
|
|
1936
1945
|
}
|
|
1937
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
1946
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-GGSM2243.mjs');
|
|
1938
1947
|
let lastError;
|
|
1939
1948
|
for (const pvEntry of protocolViewerEntries) {
|
|
1940
1949
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -5104,12 +5113,13 @@ async function apiUploadSellerCredential(makerId, bundle, baseApiUrl, timeoutMs,
|
|
|
5104
5113
|
timeoutMs
|
|
5105
5114
|
});
|
|
5106
5115
|
}
|
|
5107
|
-
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`;
|
|
5108
5120
|
return apiFetch({
|
|
5109
|
-
url: `${withApiBase(baseApiUrl)}
|
|
5121
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5110
5122
|
method: "GET",
|
|
5111
|
-
apiKey,
|
|
5112
|
-
authToken,
|
|
5113
5123
|
timeoutMs
|
|
5114
5124
|
});
|
|
5115
5125
|
}
|
|
@@ -5174,11 +5184,12 @@ var formatTokenAmountForDisplay = (amount, decimals) => {
|
|
|
5174
5184
|
const trimmed = formatted.replace(/\.?0+$/, "");
|
|
5175
5185
|
return trimmed.length > 0 ? trimmed : "0";
|
|
5176
5186
|
};
|
|
5177
|
-
var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig, decimals) => {
|
|
5187
|
+
var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig, decimals, options = {}) => {
|
|
5178
5188
|
try {
|
|
5179
|
-
const
|
|
5189
|
+
const backendNetAmount = BigInt(tokenAmount);
|
|
5190
|
+
const grossAmount = BigInt(options.signalIntentAmount ?? tokenAmount);
|
|
5180
5191
|
const feeAmount = grossAmount * BigInt(referrerFeeConfig.feeBps) / 10000n;
|
|
5181
|
-
const netAmount =
|
|
5192
|
+
const netAmount = feeAmount >= backendNetAmount ? 0n : backendNetAmount - feeAmount;
|
|
5182
5193
|
return {
|
|
5183
5194
|
tokenAmount: netAmount.toString(),
|
|
5184
5195
|
tokenAmountFormatted: formatTokenAmountForDisplay(netAmount, decimals),
|
|
@@ -5193,10 +5204,12 @@ var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig
|
|
|
5193
5204
|
}
|
|
5194
5205
|
};
|
|
5195
5206
|
var applyReferrerFeeDisplayFieldsToQuote = (quote, referrerFeeConfig, decimals) => {
|
|
5207
|
+
const signalIntentAmount = quote.signalIntentAmount ?? quote.intent?.amount ?? quote.tokenAmount;
|
|
5196
5208
|
const adjusted = applyReferrerFeeDisplayFieldsToTokenAmount(
|
|
5197
5209
|
quote.tokenAmount,
|
|
5198
5210
|
referrerFeeConfig,
|
|
5199
|
-
decimals
|
|
5211
|
+
decimals,
|
|
5212
|
+
{ signalIntentAmount }
|
|
5200
5213
|
);
|
|
5201
5214
|
if (!adjusted) {
|
|
5202
5215
|
return quote;
|
|
@@ -7732,7 +7745,13 @@ var Zkp2pClient = class {
|
|
|
7732
7745
|
payeeId: params.payeeId,
|
|
7733
7746
|
sessionMaterial: params.sessionMaterial
|
|
7734
7747
|
};
|
|
7735
|
-
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(
|
|
7736
7755
|
uploadPayload,
|
|
7737
7756
|
attestationServiceUrl,
|
|
7738
7757
|
params.platform,
|
|
@@ -7755,9 +7774,9 @@ var Zkp2pClient = class {
|
|
|
7755
7774
|
* omits low-level diagnostics. Curator may still re-probe stale credentials during verify, so callers
|
|
7756
7775
|
* should continue to handle a 410 from `verifySellerPayment`.
|
|
7757
7776
|
*
|
|
7758
|
-
*
|
|
7777
|
+
* The curator status endpoint is public and keyed by platform plus hashed payee details.
|
|
7759
7778
|
*
|
|
7760
|
-
* Fetch seller credential status for a maker from curator.
|
|
7779
|
+
* Fetch seller credential status for a maker identity from curator.
|
|
7761
7780
|
*/
|
|
7762
7781
|
async getSellerCredentialStatus(params, opts) {
|
|
7763
7782
|
const baseApiUrl = this.stripTrailingSlash(
|
|
@@ -7765,11 +7784,10 @@ var Zkp2pClient = class {
|
|
|
7765
7784
|
);
|
|
7766
7785
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7767
7786
|
return apiGetSellerCredentialStatus(
|
|
7768
|
-
params.
|
|
7787
|
+
params.processorName,
|
|
7788
|
+
params.payeeDetails,
|
|
7769
7789
|
baseApiUrl,
|
|
7770
|
-
timeoutMs
|
|
7771
|
-
this.apiKey,
|
|
7772
|
-
this.authorizationToken
|
|
7790
|
+
timeoutMs
|
|
7773
7791
|
);
|
|
7774
7792
|
}
|
|
7775
7793
|
/**
|
|
@@ -7981,7 +7999,7 @@ var fiatAmountRegex = /^-?\d*(\.\d{0,6})?$/;
|
|
|
7981
7999
|
var usdcAmountRegex = /^\d+$/;
|
|
7982
8000
|
var assertObjectInput = (params) => {
|
|
7983
8001
|
if (params === void 0) {
|
|
7984
|
-
|
|
8002
|
+
throw new Error("Peer extension onramp requires query params with intentHash.");
|
|
7985
8003
|
}
|
|
7986
8004
|
if (params === null || typeof params !== "object" || Array.isArray(params)) {
|
|
7987
8005
|
throw new Error("Peer extension onramp expects an object of query params.");
|
|
@@ -8069,10 +8087,43 @@ var normalizeUsdcAmount = (value) => {
|
|
|
8069
8087
|
}
|
|
8070
8088
|
return trimmed;
|
|
8071
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
|
+
};
|
|
8072
8123
|
var intentHashRegex = /^0x[a-fA-F0-9]{64}$/;
|
|
8073
8124
|
var normalizeIntentHash = (value) => {
|
|
8074
8125
|
if (value === void 0) {
|
|
8075
|
-
|
|
8126
|
+
throw new Error("Peer extension onramp intentHash is required.");
|
|
8076
8127
|
}
|
|
8077
8128
|
if (typeof value !== "string") {
|
|
8078
8129
|
throw new Error("Peer extension onramp intentHash must be a string.");
|
|
@@ -8104,6 +8155,7 @@ var buildOnrampQueryString = (params) => {
|
|
|
8104
8155
|
"paymentPlatform",
|
|
8105
8156
|
normalizeOptionalString(validated.paymentPlatform, "paymentPlatform")
|
|
8106
8157
|
);
|
|
8158
|
+
setParam("depositId", normalizeIntegerParam(validated.depositId, "depositId"));
|
|
8107
8159
|
setParam("toToken", normalizeOptionalString(validated.toToken, "toToken"));
|
|
8108
8160
|
setParam("amountUsdc", normalizeUsdcAmount(validated.amountUsdc));
|
|
8109
8161
|
setParam(
|
|
@@ -8118,8 +8170,13 @@ var createPeerExtensionSdk = (options = {}) => ({
|
|
|
8118
8170
|
requestConnection: () => requirePeer(options).requestConnection(),
|
|
8119
8171
|
checkConnectionStatus: () => requirePeer(options).checkConnectionStatus(),
|
|
8120
8172
|
openSidebar: (route) => requirePeer(options).openSidebar(route),
|
|
8121
|
-
onramp: (params) =>
|
|
8122
|
-
|
|
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)),
|
|
8123
8180
|
getVersion: () => requirePeer(options).getVersion(),
|
|
8124
8181
|
openInstallPage: () => openPeerExtensionInstallPage(options),
|
|
8125
8182
|
getState: () => getPeerExtensionState(options)
|