@zkp2p/sdk 0.14.2-rc.2 → 0.14.2-rc.3

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.mjs CHANGED
@@ -2,11 +2,11 @@ import { IntentGuardianOperations } from './chunk-YA67SM3A.mjs';
2
2
  export { ZERO_RATE_MANAGER_ID, classifyDelegationState, classifyIntentGuardianError, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-YA67SM3A.mjs';
3
3
  import { NetworkError, ValidationError, APIError } from './chunk-3J4FPMPW.mjs';
4
4
  export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-3J4FPMPW.mjs';
5
- import { OrchestratorRegistry_default, DISPUTE_PROTECTION_POLICY_ABI, DisputeProtectionPolicy_default, METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, MultiAttestationVerifier_default, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash, OrchestratorV3_default, DisputeNullifierRegistry_default, DisputeVerifier_default, WhitelistPolicy_default, StakeVault_default, IntentLifecycleHookV1_default } from './chunk-DPMEQLSY.mjs';
6
- export { DISPUTE_PROTECTION_POLICY_ABI2 as DISPUTE_PROTECTION_POLICY_ABI, ORCHESTRATOR_V3_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI, asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getGatingServiceAddress, getIntentGuardianContract, getOrchestratorV3Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, hasIntentGuardian, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-DPMEQLSY.mjs';
5
+ import { OrchestratorRegistry_default, DISPUTE_PROTECTION_POLICY_ABI, DisputeProtectionPolicy_default, METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, MultiAttestationVerifier_default, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash, OrchestratorV3_default, DisputeNullifierRegistry_default, DisputeVerifier_default, WhitelistPolicy_default, StakeVault_default, IntentLifecycleHookV1_default } from './chunk-DNKX73LN.mjs';
6
+ export { DISPUTE_PROTECTION_POLICY_ABI2 as DISPUTE_PROTECTION_POLICY_ABI, ORCHESTRATOR_V3_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI, asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getGatingServiceAddress, getIntentGuardianContract, getOrchestratorV3Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, hasIntentGuardian, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-DNKX73LN.mjs';
7
7
  import { Currency, currencyKeccak256 } from './chunk-ZB22BZLZ.mjs';
8
8
  export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-ZB22BZLZ.mjs';
9
- import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-EDYYWCCJ.mjs';
9
+ import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-VGVHGGQU.mjs';
10
10
  import { keccak256, concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, isAddress, zeroAddress, formatUnits } from 'viem';
11
11
  import { hardhat, base } from 'viem/chains';
12
12
  import { createEncryptedBuyerTeeSessionMaterial as createEncryptedBuyerTeeSessionMaterial$1, createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
@@ -357,7 +357,7 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs, shouldRet
357
357
  for (let i = 0; i < maxRetries; i++) {
358
358
  try {
359
359
  if (timeoutMs) {
360
- const { withTimeout } = await import('./timeout-QRO3IS4N.mjs');
360
+ const { withTimeout } = await import('./timeout-P7V7KVRD.mjs');
361
361
  return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
362
362
  }
363
363
  return await fn();
@@ -1927,7 +1927,7 @@ var ProtocolViewerReader = class {
1927
1927
  if (inputCount === null) {
1928
1928
  throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
1929
1929
  }
1930
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-4BJOG6JG.mjs');
1930
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-FQ3FBMNT.mjs');
1931
1931
  if (inputCount >= 3) {
1932
1932
  return tryContexts(
1933
1933
  protocolViewerContexts,
@@ -2013,7 +2013,7 @@ var ProtocolViewerReader = class {
2013
2013
  return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
2014
2014
  }
2015
2015
  const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
2016
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-4BJOG6JG.mjs');
2016
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-FQ3FBMNT.mjs');
2017
2017
  if (inputCount >= 2) {
2018
2018
  const requests = ids.map((id, index) => ({
2019
2019
  index,
@@ -2118,7 +2118,7 @@ var ProtocolViewerReader = class {
2118
2118
  if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
2119
2119
  return this.config.host.getPvAccountDepositsFromIndexer(owner);
2120
2120
  }
2121
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-4BJOG6JG.mjs');
2121
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-FQ3FBMNT.mjs');
2122
2122
  const { address, abi } = this.config.host.requireProtocolViewer();
2123
2123
  if (inputCount >= 2) {
2124
2124
  const readAndFilter = async (raw2) => {
@@ -2189,7 +2189,7 @@ var ProtocolViewerReader = class {
2189
2189
  if (protocolViewerEntries.length === 0) {
2190
2190
  throw new Error("ProtocolViewer not available for this network");
2191
2191
  }
2192
- const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-4BJOG6JG.mjs');
2192
+ const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-FQ3FBMNT.mjs');
2193
2193
  const intentsByHash = /* @__PURE__ */ new Map();
2194
2194
  let attemptedRead = false;
2195
2195
  let hadSuccessfulRead = false;
@@ -2297,7 +2297,7 @@ var ProtocolViewerReader = class {
2297
2297
  if (protocolViewerEntries.length === 0) {
2298
2298
  throw new Error("ProtocolViewer not available for this network");
2299
2299
  }
2300
- const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-4BJOG6JG.mjs');
2300
+ const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-FQ3FBMNT.mjs');
2301
2301
  let lastError;
2302
2302
  for (const pvEntry of protocolViewerEntries) {
2303
2303
  const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
@@ -5457,7 +5457,9 @@ async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails,
5457
5457
  method: "POST",
5458
5458
  body,
5459
5459
  authorizationToken: opts?.authorizationToken,
5460
- signal: controller.signal
5460
+ signal: controller.signal,
5461
+ // A lost response may already have consumed the one-time Google code.
5462
+ retryCount: 1
5461
5463
  });
5462
5464
  } catch (error) {
5463
5465
  if (timedOut) throw new Error("Google OAuth upload timed out.");
@@ -11539,7 +11541,7 @@ var Zkp2pClient = class {
11539
11541
  }
11540
11542
  }
11541
11543
  });
11542
- const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-C5E6NVSR.mjs');
11544
+ const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-LT7VKBBS.mjs');
11543
11545
  currencies = mapConversionRatesToOnchainMinRate2(
11544
11546
  params.conversionRates,
11545
11547
  paymentMethods.length
@@ -11976,19 +11978,7 @@ var Zkp2pClient = class {
11976
11978
  opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
11977
11979
  );
11978
11980
  const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
11979
- const getUploadOptions = async () => {
11980
- let authorizationToken;
11981
- try {
11982
- authorizationToken = await this.resolveAuthorizationToken();
11983
- } catch {
11984
- authorizationToken = void 0;
11985
- }
11986
- return {
11987
- timeoutMs,
11988
- ...opts?.signal ? { signal: opts.signal } : {},
11989
- ...authorizationToken ? { authorizationToken } : {}
11990
- };
11991
- };
11981
+ const authorizationToken = await this.resolveAuthorizationToken();
11992
11982
  const body = {
11993
11983
  authorizationCode: params.authorizationCode,
11994
11984
  redirectUri: params.redirectUri
@@ -11998,7 +11988,11 @@ var Zkp2pClient = class {
11998
11988
  params.payeeDetails,
11999
11989
  params.platform === "paypal" ? { ...body, payeeEmail: params.payeeEmail } : body,
12000
11990
  baseApiUrl,
12001
- await getUploadOptions()
11991
+ {
11992
+ timeoutMs,
11993
+ ...opts?.signal ? { signal: opts.signal } : {},
11994
+ ...authorizationToken ? { authorizationToken } : {}
11995
+ }
12002
11996
  );
12003
11997
  }
12004
11998
  /**