@zkp2p/sdk 0.4.0-rc.3 → 0.4.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/dist/index.cjs +121 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +121 -32
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{vaultUtils-CSwo6wIa.d.mts → vaultUtils-CyPf4QGT.d.mts} +48 -12
- package/dist/{vaultUtils-CSwo6wIa.d.ts → vaultUtils-CyPf4QGT.d.ts} +48 -12
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, c as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, d as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, e as GetPayeeDetailsResponse, f as GetOwnerDepositsRequest, g as GetOwnerDepositsResponse, h as GetTakerTierRequest, i as GetTakerTierResponse, j as GetDepositBundleParams, k as ApiAdapterOptions, l as GetDepositBundleResponse, m as GetOrderbookParams, n as GetOrderbookResponse, C as CurrencyType, o as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-
|
|
2
|
-
export { v as ActionCallback, aa as ApiDeposit, ah as ApiIntentStatus,
|
|
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, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, c as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, d as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, e as GetPayeeDetailsResponse, f as GetOwnerDepositsRequest, g as GetOwnerDepositsResponse, h as GetTakerTierRequest, i as GetTakerTierResponse, j as GetDepositBundleParams, k as ApiAdapterOptions, l as GetDepositBundleResponse, m as GetOrderbookParams, n as GetOrderbookResponse, C as CurrencyType, o as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-CyPf4QGT.mjs';
|
|
2
|
+
export { v as ActionCallback, aa as ApiDeposit, ah as ApiIntentStatus, aS as AttestationServiceSellerCredentialProbeResponse, aR as AttestationServiceSellerVerifyResponse, t as AuthorizationTokenProvider, cj as BatchResult, K as BestByPlatformResponseObject, r as CancelIntentMethodParams, J as CancelIntentParams, ay as CashAppCredentialUploadInput, ar as CashAppSessionMaterial, x as CreateDepositConversionRate, w as CreateDepositParams, aU as CuratorSellerCredentialStatusResponse, aT as CuratorSellerCredentialUploadResponse, aV as CuratorSellerVerifyResponse, bO as Currency, bV as CurrencyData, ci as DelegationDepositTarget, cg as DelegationRoute, ch as DelegationState, c4 as Deposit, c6 as DepositCurrency, b3 as DepositIntentStatistics, ad as DepositStatus, ab as DepositVerifier, ac as DepositVerifierCurrency, b0 as DepositVerifierData, c3 as DepositView, a6 as FiatResponse, F as FulfillIntentMethodParams, E as FulfillIntentParams, L as GetBestByPlatformResponse, M as GetBestByPlatformResponseObject, ae as GetDepositByIdRequest, af as GetDepositByIdResponse, am as GetIntentByHashRequest, an as GetIntentByHashResponse, ak as GetIntentsByDepositRequest, al as GetIntentsByDepositResponse, X as GetNearbyQuote, Y as GetNearbySuggestions, ai as GetOwnerIntentsRequest, aj as GetOwnerIntentsResponse, N as GetPlatformQuote, _ as GetQuoteResponse, $ as GetQuoteResponseObject, a0 as GetQuoteSingleResponse, aZ as GetSellerCredentialStatusParams, ba as IndexerClient, bI as IndexerDeploymentEnv, bg as IndexerDeposit, bx as IndexerDepositDailySnapshot, bz as IndexerDepositFilter, bw as IndexerDepositFundActivity, by as IndexerDepositFundActivityType, bC as IndexerDepositOrderDirection, bB as IndexerDepositOrderField, bA as IndexerDepositPagination, bj as IndexerDepositPaymentMethod, bc as IndexerDepositService, bL as IndexerFulfillmentAndPaymentResponse, bJ as IndexerFulfillmentRecord, bh as IndexerIntentFulfilled, bi as IndexerIntentFulfillmentAmounts, bl as IndexerIntentStatus, bp as IndexerManagerAggregateStats, br as IndexerManagerDailySnapshot, bq as IndexerManagerStats, bu as IndexerManualRateUpdate, bk as IndexerMethodCurrency, bv as IndexerOracleConfigUpdate, bK as IndexerPaymentVerifiedRecord, bm as IndexerRateManager, bo as IndexerRateManagerDelegation, bF as IndexerRateManagerDelegationPagination, bt as IndexerRateManagerDetail, bD as IndexerRateManagerFilter, bs as IndexerRateManagerListItem, bH as IndexerRateManagerOrderDirection, bG as IndexerRateManagerOrderField, bE as IndexerRateManagerPagination, bn as IndexerRateManagerRate, bd as IndexerRateManagerService, ag as Intent, c8 as IntentView, a8 as NearbyQuote, a9 as NearbySuggestions, Z as OfframpClient, a$ as OnchainCurrency, c9 as OnchainIntent, b2 as OrderStats, b9 as OrderbookEntry, bM as PAYMENT_PLATFORMS, aA as PayPalCredentialUploadInput, aw as PayPalSessionMaterial, c5 as PaymentMethodData, bN as PaymentPlatformType, b7 as PlatformLimit, O as PlatformQuote, b8 as PlatformRiskLevel, b1 as PreparedTransaction, a5 as QuoteFeesResponse, a4 as QuoteIntentResponse, U as QuoteRequest, a1 as QuoteResponse, a2 as QuoteResponseObject, a3 as QuoteSingleResponse, y as Range, c7 as ReferralFee, ao as RegisterPayeeDetailsRequest, ap as RegisterPayeeDetailsResponse, aX as RegisteredUploadSellerCredentialParams, H as ReleaseFundsToPayerParams, b_ as RuntimeEnv, aP as SellerAttestationOutput, aC as SellerCiphertextBundle, aH as SellerCredentialBundle, aI as SellerCredentialBundleUpload, aQ as SellerCredentialProbeResponse, aK as SellerCredentialStatus, aJ as SellerCredentialStatusValue, aB as SellerCredentialUploadInputByPlatform, aO as SellerPaymentTypedDataValue, aG as SellerProbeInput, aD as SellerSignedCiphertextBundle, aM as SellerTypedDataField, aN as SellerTypedDataSpec, aF as SellerVerifyInput, aE as SellerVerifyIntentDetails, aL as SellerVerifyProxyBody, cl as SendBatchFn, ck as SendTransactionFn, q as SignalIntentMethodParams, z as SignalIntentParams, p as SignalIntentReferralFee, b4 as TakerTier, b6 as TakerTierLevel, b5 as TakerTierStats, u as TimeoutConfig, a7 as TokenResponse, aY as UploadSellerCredentialOptions, aW as UploadSellerCredentialParams, ax as VenmoCredentialUploadInput, aq as VenmoSessionMaterial, a_ as VerifySellerPaymentParams, az as WiseCredentialUploadInput, at as WiseProfileInfo, av as WiseProfileNotFound, au as WiseProfileSelectionRequired, as as WiseSessionMaterial, W as WithdrawDepositParams, ca as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, s as Zkp2pClientOptions, cf as classifyDelegationState, be as compareEventCursorIdsByRecency, bP as currencyInfo, bb as defaultIndexerEndpoint, c1 as enrichPvDepositView, c2 as enrichPvIntentView, bf as fetchIndexerFulfillmentAndPayment, bW as getContracts, bS as getCurrencyCodeFromHash, bR as getCurrencyInfoFromCountryCode, bQ as getCurrencyInfoFromHash, ce as getDelegationRoute, bZ as getGatingServiceAddress, bY as getPaymentMethodsCatalog, bX as getRateManagerContracts, bT as isSupportedCurrencyHash, cb as isZeroRateManagerId, bU as mapConversionRatesToOnchainMinRate, cc as normalizeRateManagerId, cd as normalizeRegistry, b$ as parseDepositView, c0 as parseIntentView } from './vaultUtils-CyPf4QGT.mjs';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, c as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, d as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, e as GetPayeeDetailsResponse, f as GetOwnerDepositsRequest, g as GetOwnerDepositsResponse, h as GetTakerTierRequest, i as GetTakerTierResponse, j as GetDepositBundleParams, k as ApiAdapterOptions, l as GetDepositBundleResponse, m as GetOrderbookParams, n as GetOrderbookResponse, C as CurrencyType, o as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-
|
|
2
|
-
export { v as ActionCallback, aa as ApiDeposit, ah as ApiIntentStatus,
|
|
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, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, c as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, d as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, e as GetPayeeDetailsResponse, f as GetOwnerDepositsRequest, g as GetOwnerDepositsResponse, h as GetTakerTierRequest, i as GetTakerTierResponse, j as GetDepositBundleParams, k as ApiAdapterOptions, l as GetDepositBundleResponse, m as GetOrderbookParams, n as GetOrderbookResponse, C as CurrencyType, o as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-CyPf4QGT.js';
|
|
2
|
+
export { v as ActionCallback, aa as ApiDeposit, ah as ApiIntentStatus, aS as AttestationServiceSellerCredentialProbeResponse, aR as AttestationServiceSellerVerifyResponse, t as AuthorizationTokenProvider, cj as BatchResult, K as BestByPlatformResponseObject, r as CancelIntentMethodParams, J as CancelIntentParams, ay as CashAppCredentialUploadInput, ar as CashAppSessionMaterial, x as CreateDepositConversionRate, w as CreateDepositParams, aU as CuratorSellerCredentialStatusResponse, aT as CuratorSellerCredentialUploadResponse, aV as CuratorSellerVerifyResponse, bO as Currency, bV as CurrencyData, ci as DelegationDepositTarget, cg as DelegationRoute, ch as DelegationState, c4 as Deposit, c6 as DepositCurrency, b3 as DepositIntentStatistics, ad as DepositStatus, ab as DepositVerifier, ac as DepositVerifierCurrency, b0 as DepositVerifierData, c3 as DepositView, a6 as FiatResponse, F as FulfillIntentMethodParams, E as FulfillIntentParams, L as GetBestByPlatformResponse, M as GetBestByPlatformResponseObject, ae as GetDepositByIdRequest, af as GetDepositByIdResponse, am as GetIntentByHashRequest, an as GetIntentByHashResponse, ak as GetIntentsByDepositRequest, al as GetIntentsByDepositResponse, X as GetNearbyQuote, Y as GetNearbySuggestions, ai as GetOwnerIntentsRequest, aj as GetOwnerIntentsResponse, N as GetPlatformQuote, _ as GetQuoteResponse, $ as GetQuoteResponseObject, a0 as GetQuoteSingleResponse, aZ as GetSellerCredentialStatusParams, ba as IndexerClient, bI as IndexerDeploymentEnv, bg as IndexerDeposit, bx as IndexerDepositDailySnapshot, bz as IndexerDepositFilter, bw as IndexerDepositFundActivity, by as IndexerDepositFundActivityType, bC as IndexerDepositOrderDirection, bB as IndexerDepositOrderField, bA as IndexerDepositPagination, bj as IndexerDepositPaymentMethod, bc as IndexerDepositService, bL as IndexerFulfillmentAndPaymentResponse, bJ as IndexerFulfillmentRecord, bh as IndexerIntentFulfilled, bi as IndexerIntentFulfillmentAmounts, bl as IndexerIntentStatus, bp as IndexerManagerAggregateStats, br as IndexerManagerDailySnapshot, bq as IndexerManagerStats, bu as IndexerManualRateUpdate, bk as IndexerMethodCurrency, bv as IndexerOracleConfigUpdate, bK as IndexerPaymentVerifiedRecord, bm as IndexerRateManager, bo as IndexerRateManagerDelegation, bF as IndexerRateManagerDelegationPagination, bt as IndexerRateManagerDetail, bD as IndexerRateManagerFilter, bs as IndexerRateManagerListItem, bH as IndexerRateManagerOrderDirection, bG as IndexerRateManagerOrderField, bE as IndexerRateManagerPagination, bn as IndexerRateManagerRate, bd as IndexerRateManagerService, ag as Intent, c8 as IntentView, a8 as NearbyQuote, a9 as NearbySuggestions, Z as OfframpClient, a$ as OnchainCurrency, c9 as OnchainIntent, b2 as OrderStats, b9 as OrderbookEntry, bM as PAYMENT_PLATFORMS, aA as PayPalCredentialUploadInput, aw as PayPalSessionMaterial, c5 as PaymentMethodData, bN as PaymentPlatformType, b7 as PlatformLimit, O as PlatformQuote, b8 as PlatformRiskLevel, b1 as PreparedTransaction, a5 as QuoteFeesResponse, a4 as QuoteIntentResponse, U as QuoteRequest, a1 as QuoteResponse, a2 as QuoteResponseObject, a3 as QuoteSingleResponse, y as Range, c7 as ReferralFee, ao as RegisterPayeeDetailsRequest, ap as RegisterPayeeDetailsResponse, aX as RegisteredUploadSellerCredentialParams, H as ReleaseFundsToPayerParams, b_ as RuntimeEnv, aP as SellerAttestationOutput, aC as SellerCiphertextBundle, aH as SellerCredentialBundle, aI as SellerCredentialBundleUpload, aQ as SellerCredentialProbeResponse, aK as SellerCredentialStatus, aJ as SellerCredentialStatusValue, aB as SellerCredentialUploadInputByPlatform, aO as SellerPaymentTypedDataValue, aG as SellerProbeInput, aD as SellerSignedCiphertextBundle, aM as SellerTypedDataField, aN as SellerTypedDataSpec, aF as SellerVerifyInput, aE as SellerVerifyIntentDetails, aL as SellerVerifyProxyBody, cl as SendBatchFn, ck as SendTransactionFn, q as SignalIntentMethodParams, z as SignalIntentParams, p as SignalIntentReferralFee, b4 as TakerTier, b6 as TakerTierLevel, b5 as TakerTierStats, u as TimeoutConfig, a7 as TokenResponse, aY as UploadSellerCredentialOptions, aW as UploadSellerCredentialParams, ax as VenmoCredentialUploadInput, aq as VenmoSessionMaterial, a_ as VerifySellerPaymentParams, az as WiseCredentialUploadInput, at as WiseProfileInfo, av as WiseProfileNotFound, au as WiseProfileSelectionRequired, as as WiseSessionMaterial, W as WithdrawDepositParams, ca as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, s as Zkp2pClientOptions, cf as classifyDelegationState, be as compareEventCursorIdsByRecency, bP as currencyInfo, bb as defaultIndexerEndpoint, c1 as enrichPvDepositView, c2 as enrichPvIntentView, bf as fetchIndexerFulfillmentAndPayment, bW as getContracts, bS as getCurrencyCodeFromHash, bR as getCurrencyInfoFromCountryCode, bQ as getCurrencyInfoFromHash, ce as getDelegationRoute, bZ as getGatingServiceAddress, bY as getPaymentMethodsCatalog, bX as getRateManagerContracts, bT as isSupportedCurrencyHash, cb as isZeroRateManagerId, bU as mapConversionRatesToOnchainMinRate, cc as normalizeRateManagerId, cd as normalizeRegistry, b$ as parseDepositView, c0 as parseIntentView } from './vaultUtils-CyPf4QGT.js';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
package/dist/index.mjs
CHANGED
|
@@ -326,15 +326,19 @@ var ContractRouter = class {
|
|
|
326
326
|
// src/errors/utils.ts
|
|
327
327
|
function parseAPIError(response, responseText) {
|
|
328
328
|
let message = `Request failed: ${response.statusText}`;
|
|
329
|
+
let parsedBody;
|
|
329
330
|
try {
|
|
330
|
-
|
|
331
|
-
if (
|
|
332
|
-
|
|
331
|
+
parsedBody = responseText ? JSON.parse(responseText) : void 0;
|
|
332
|
+
if (parsedBody && typeof parsedBody === "object") {
|
|
333
|
+
const body = parsedBody;
|
|
334
|
+
if (body.error || body.message) {
|
|
335
|
+
message = body.error || body.message;
|
|
336
|
+
}
|
|
333
337
|
}
|
|
334
338
|
} catch {
|
|
335
339
|
if (responseText && responseText.length < 200) message = responseText;
|
|
336
340
|
}
|
|
337
|
-
return new APIError(message, response.status, { url: response.url });
|
|
341
|
+
return new APIError(message, response.status, { url: response.url, responseBody: parsedBody });
|
|
338
342
|
}
|
|
339
343
|
async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
340
344
|
let lastErr;
|
|
@@ -409,6 +413,47 @@ async function apiSignIntentV3(request, opts) {
|
|
|
409
413
|
function headers() {
|
|
410
414
|
return { "Content-Type": "application/json" };
|
|
411
415
|
}
|
|
416
|
+
function isPayeeBoundSellerCredentialUploadInput(payload) {
|
|
417
|
+
return typeof payload.payeeId === "string";
|
|
418
|
+
}
|
|
419
|
+
function isWiseCredentialUploadInput(payload) {
|
|
420
|
+
return typeof payload.sessionMaterial?.apiToken === "string";
|
|
421
|
+
}
|
|
422
|
+
async function createEncryptedSellerCredentialUploadForPlatform({
|
|
423
|
+
attestationServiceUrl,
|
|
424
|
+
attestationRuntime,
|
|
425
|
+
payload,
|
|
426
|
+
platform,
|
|
427
|
+
timeoutMs
|
|
428
|
+
}) {
|
|
429
|
+
if (platform === "wise") {
|
|
430
|
+
if (!isWiseCredentialUploadInput(payload)) {
|
|
431
|
+
throw new Error("apiToken is required for wise seller credential uploads");
|
|
432
|
+
}
|
|
433
|
+
return createEncryptedSellerCredentialUpload({
|
|
434
|
+
attestationServiceUrl,
|
|
435
|
+
platform: "wise",
|
|
436
|
+
sessionMaterial: payload.sessionMaterial,
|
|
437
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
438
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
439
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
440
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
|
|
444
|
+
throw new Error(`payeeId is required for ${platform} seller credential uploads`);
|
|
445
|
+
}
|
|
446
|
+
return createEncryptedSellerCredentialUpload({
|
|
447
|
+
attestationServiceUrl,
|
|
448
|
+
platform,
|
|
449
|
+
payeeId: payload.payeeId,
|
|
450
|
+
sessionMaterial: payload.sessionMaterial,
|
|
451
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
452
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
453
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
454
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
455
|
+
});
|
|
456
|
+
}
|
|
412
457
|
async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platform, actionType) {
|
|
413
458
|
return withRetry(async () => {
|
|
414
459
|
let res;
|
|
@@ -436,14 +481,12 @@ async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, p
|
|
|
436
481
|
return withRetry(
|
|
437
482
|
async () => {
|
|
438
483
|
const requestFetch = attestationRuntime?.fetch ?? fetch;
|
|
439
|
-
const encryptedUpload = await
|
|
484
|
+
const encryptedUpload = await createEncryptedSellerCredentialUploadForPlatform({
|
|
440
485
|
attestationServiceUrl,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
446
|
-
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
486
|
+
attestationRuntime,
|
|
487
|
+
payload,
|
|
488
|
+
platform,
|
|
489
|
+
timeoutMs
|
|
447
490
|
});
|
|
448
491
|
let res;
|
|
449
492
|
try {
|
|
@@ -5103,13 +5146,14 @@ async function apiGetTakerTier(req, apiKey, baseApiUrl, timeoutMs) {
|
|
|
5103
5146
|
timeoutMs
|
|
5104
5147
|
});
|
|
5105
5148
|
}
|
|
5106
|
-
async function apiUploadSellerCredential(
|
|
5149
|
+
async function apiUploadSellerCredential(processorName, payeeDetails, bundle, baseApiUrl, timeoutMs) {
|
|
5150
|
+
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5151
|
+
payeeDetails
|
|
5152
|
+
)}/seller-credential`;
|
|
5107
5153
|
return apiFetch({
|
|
5108
|
-
url: `${withApiBase(baseApiUrl)}
|
|
5154
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5109
5155
|
method: "POST",
|
|
5110
5156
|
body: bundle,
|
|
5111
|
-
apiKey,
|
|
5112
|
-
authToken,
|
|
5113
5157
|
timeoutMs
|
|
5114
5158
|
});
|
|
5115
5159
|
}
|
|
@@ -5124,10 +5168,16 @@ async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApi
|
|
|
5124
5168
|
});
|
|
5125
5169
|
}
|
|
5126
5170
|
async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
5171
|
+
const body = {
|
|
5172
|
+
txId: req.txId,
|
|
5173
|
+
chainId: req.chainId,
|
|
5174
|
+
intent: req.intent,
|
|
5175
|
+
...req.metadata !== void 0 ? { metadata: req.metadata } : {}
|
|
5176
|
+
};
|
|
5127
5177
|
return apiFetch({
|
|
5128
5178
|
url: `${withApiBase(baseApiUrl)}/v2/verify/seller/${encodeURIComponent(platform)}`,
|
|
5129
5179
|
method: "POST",
|
|
5130
|
-
body
|
|
5180
|
+
body,
|
|
5131
5181
|
apiKey,
|
|
5132
5182
|
authToken,
|
|
5133
5183
|
timeoutMs
|
|
@@ -7731,9 +7781,10 @@ var Zkp2pClient = class {
|
|
|
7731
7781
|
* seller-automated-release availability is governed by curator's probe/revalidation state
|
|
7732
7782
|
* rather than these timestamps.
|
|
7733
7783
|
*
|
|
7734
|
-
*
|
|
7735
|
-
*
|
|
7736
|
-
*
|
|
7784
|
+
* Create a signed seller credential bundle with attestation-service and store it via
|
|
7785
|
+
* curator's platform plus hashed payee-details route. Session-cookie platforms register
|
|
7786
|
+
* or recover the payee maker row before upload; Wise derives the payee hash inside the enclave
|
|
7787
|
+
* from the submitted Personal API Token.
|
|
7737
7788
|
*/
|
|
7738
7789
|
async uploadSellerCredential(params, opts) {
|
|
7739
7790
|
const baseApiUrl = this.stripTrailingSlash(
|
|
@@ -7743,32 +7794,69 @@ var Zkp2pClient = class {
|
|
|
7743
7794
|
const attestationServiceUrl = this.stripTrailingSlash(
|
|
7744
7795
|
opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
|
|
7745
7796
|
);
|
|
7746
|
-
const
|
|
7747
|
-
|
|
7748
|
-
sessionMaterial: params.sessionMaterial
|
|
7749
|
-
};
|
|
7750
|
-
const bundleResponse = opts?.attestationRuntime ? await apiCreateSellerCredentialBundle(
|
|
7751
|
-
uploadPayload,
|
|
7797
|
+
const createBundle = (uploadPayload2) => opts?.attestationRuntime ? apiCreateSellerCredentialBundle(
|
|
7798
|
+
uploadPayload2,
|
|
7752
7799
|
attestationServiceUrl,
|
|
7753
7800
|
params.platform,
|
|
7754
7801
|
timeoutMs,
|
|
7755
7802
|
opts.attestationRuntime
|
|
7756
|
-
) :
|
|
7757
|
-
|
|
7803
|
+
) : apiCreateSellerCredentialBundle(
|
|
7804
|
+
uploadPayload2,
|
|
7758
7805
|
attestationServiceUrl,
|
|
7759
7806
|
params.platform,
|
|
7760
7807
|
timeoutMs
|
|
7761
7808
|
);
|
|
7809
|
+
if (params.platform === "wise") {
|
|
7810
|
+
const bundleResponse2 = await createBundle({
|
|
7811
|
+
sessionMaterial: params.sessionMaterial
|
|
7812
|
+
});
|
|
7813
|
+
if (!bundleResponse2.success || !bundleResponse2.responseObject) {
|
|
7814
|
+
throw new Error(bundleResponse2.message || "Failed to create seller credential bundle");
|
|
7815
|
+
}
|
|
7816
|
+
return apiUploadSellerCredential(
|
|
7817
|
+
params.platform,
|
|
7818
|
+
bundleResponse2.responseObject.payeeIdHash,
|
|
7819
|
+
bundleResponse2.responseObject,
|
|
7820
|
+
baseApiUrl,
|
|
7821
|
+
timeoutMs
|
|
7822
|
+
);
|
|
7823
|
+
}
|
|
7824
|
+
const registeredPayeePayload = {
|
|
7825
|
+
offchainId: params.offchainId,
|
|
7826
|
+
processorName: params.platform
|
|
7827
|
+
};
|
|
7828
|
+
if (params.telegramUsername !== void 0) {
|
|
7829
|
+
registeredPayeePayload.telegramUsername = params.telegramUsername;
|
|
7830
|
+
}
|
|
7831
|
+
if (params.metadata !== void 0) {
|
|
7832
|
+
registeredPayeePayload.metadata = params.metadata;
|
|
7833
|
+
}
|
|
7834
|
+
const registeredPayeeResponse = await apiPostDepositDetails(
|
|
7835
|
+
registeredPayeePayload,
|
|
7836
|
+
baseApiUrl,
|
|
7837
|
+
timeoutMs
|
|
7838
|
+
);
|
|
7839
|
+
if (!registeredPayeeResponse.success || !registeredPayeeResponse.responseObject) {
|
|
7840
|
+
throw new Error(registeredPayeeResponse.message || "Failed to register seller payee details");
|
|
7841
|
+
}
|
|
7842
|
+
const uploadPayload = {
|
|
7843
|
+
payeeId: params.payeeId,
|
|
7844
|
+
sessionMaterial: params.sessionMaterial
|
|
7845
|
+
};
|
|
7846
|
+
const bundleResponse = await createBundle(uploadPayload);
|
|
7762
7847
|
if (!bundleResponse.success || !bundleResponse.responseObject) {
|
|
7763
7848
|
throw new Error(bundleResponse.message || "Failed to create seller credential bundle");
|
|
7764
7849
|
}
|
|
7850
|
+
const registeredPayee = registeredPayeeResponse.responseObject;
|
|
7851
|
+
if (registeredPayee.hashedOnchainId.toLowerCase() !== bundleResponse.responseObject.payeeIdHash.toLowerCase()) {
|
|
7852
|
+
throw new Error("Seller credential payee hash does not match registered payee details");
|
|
7853
|
+
}
|
|
7765
7854
|
return apiUploadSellerCredential(
|
|
7766
|
-
params.
|
|
7855
|
+
params.platform,
|
|
7856
|
+
registeredPayee.hashedOnchainId,
|
|
7767
7857
|
bundleResponse.responseObject,
|
|
7768
7858
|
baseApiUrl,
|
|
7769
|
-
timeoutMs
|
|
7770
|
-
this.apiKey,
|
|
7771
|
-
this.authorizationToken
|
|
7859
|
+
timeoutMs
|
|
7772
7860
|
);
|
|
7773
7861
|
}
|
|
7774
7862
|
/**
|
|
@@ -7809,7 +7897,8 @@ var Zkp2pClient = class {
|
|
|
7809
7897
|
{
|
|
7810
7898
|
txId: params.txId,
|
|
7811
7899
|
chainId: params.chainId,
|
|
7812
|
-
intent: params.intent
|
|
7900
|
+
intent: params.intent,
|
|
7901
|
+
...params.metadata !== void 0 ? { metadata: params.metadata } : {}
|
|
7813
7902
|
},
|
|
7814
7903
|
baseApiUrl,
|
|
7815
7904
|
timeoutMs,
|