@zkp2p/sdk 0.14.8-rc.0 → 0.14.8

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.
@@ -1,4 +1,4 @@
1
1
  export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchain, mapConversionRatesToOnchainMinRate } from './chunk-WDEEWFEU.mjs';
2
- import './chunk-KQT4XYPO.mjs';
3
- //# sourceMappingURL=currency-45EYG6OA.mjs.map
4
- //# sourceMappingURL=currency-45EYG6OA.mjs.map
2
+ import './chunk-HG27KAGT.mjs';
3
+ //# sourceMappingURL=currency-ELLII4P5.mjs.map
4
+ //# sourceMappingURL=currency-ELLII4P5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"currency-45EYG6OA.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"currency-ELLII4P5.mjs"}
package/dist/index.cjs CHANGED
@@ -21,7 +21,7 @@ var __export = (target, all) => {
21
21
  var define_ZKP2P_SDK_BUILD_METADATA_default;
22
22
  var init_define_ZKP2P_SDK_BUILD_METADATA = __esm({
23
23
  "<define:__ZKP2P_SDK_BUILD_METADATA__>"() {
24
- define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "959ea2fdca3a9938c97be98f96f66f1e74ec144d", kind: "github", distributable: true }, sdkPackageVersion: "0.14.8-rc.0", contractsPackageVersion: "0.4.4-rc.2", indexerSchemaPackageVersion: "0.22.0", activeDisputeStack: { base: { version: 2, selectionHash: "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c" }, baseStaging: { version: 2, selectionHash: "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9" } } };
24
+ define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "46efc268b38382bdd6c66bbd7fd9b91f9368a79d", kind: "github", distributable: true }, sdkPackageVersion: "0.14.8", contractsPackageVersion: "0.4.4-rc.2", indexerSchemaPackageVersion: "0.22.0", activeDisputeStack: { base: { version: 2, selectionHash: "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c" }, baseStaging: { version: 2, selectionHash: "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9" } } };
25
25
  }
26
26
  });
27
27
 
@@ -102221,6 +102221,55 @@ var zelleCitiVerifyConfig = {
102221
102221
  return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
102222
102222
  }
102223
102223
  };
102224
+ var CAPITAL_ONE_ZELLE_APP_LINK = "https://links.capitalone.com/bank/zelle/getting-started/";
102225
+ var zelleCapitalOneSendConfig = {
102226
+ paymentMethodName: "Capital One",
102227
+ defaultPaymentMode: "QR_CODE",
102228
+ useCustomQRCode: true,
102229
+ getFormattedSendLink: () => CAPITAL_ONE_ZELLE_APP_LINK,
102230
+ troubleScanningQRCodeLink: () => CAPITAL_ONE_ZELLE_APP_LINK,
102231
+ deepLinkEmbedsRecipient: false,
102232
+ supportsSendingPaymentOnWeb: true,
102233
+ showTroubleScanningQRCodeLink: true,
102234
+ sendPaymentWarning: (currency, amount) => `Send exactly ${amount} ${currencyInfo[currency].currencyCode} in a single payment through Capital One's Zelle.`,
102235
+ sendPaymentInfo: () => "Only use Capital One. Keep the \u201CYou sent money with Zelle\u201D email to verify this payment.",
102236
+ sendPaymentDos: (currency, amount) => [
102237
+ { text: "Use Capital One for this payment", emphasize: ["Capital One"] },
102238
+ {
102239
+ text: `Send exactly ${amount} ${currencyInfo[currency].currencyCode} in a single payment`,
102240
+ emphasize: [
102241
+ "exactly",
102242
+ amount,
102243
+ currencyInfo[currency].currencyCode,
102244
+ "single"
102245
+ ]
102246
+ }
102247
+ ],
102248
+ sendPaymentDonts: () => [
102249
+ {
102250
+ text: "Do not send unless you can open the Capital One payment email. The email is required to verify your payment and complete this order.",
102251
+ emphasize: ["Do not send", "payment email"]
102252
+ },
102253
+ { text: "Do not send using any other bank", emphasize: ["Do not"] }
102254
+ ]
102255
+ };
102256
+ var zelleCapitalOneVerifyConfig = {
102257
+ authLink: "https://myaccounts.capitalone.com/",
102258
+ actionType: "transfer_zelle_capitalone",
102259
+ actionPlatform: PaymentPlatform.ZELLE,
102260
+ numPaymentsFetched: 20,
102261
+ minExtensionVersion: "0.0.0",
102262
+ supportsAppclip: false,
102263
+ totalProofs: 1,
102264
+ verifiesByEmail: true,
102265
+ // PeerAuth never captures payment metadata for an email-verified bank.
102266
+ parseMetadata: () => {
102267
+ throw new Error("Capital One payments have no PeerAuth metadata");
102268
+ },
102269
+ getSubjectText: () => {
102270
+ throw new Error("Capital One payments have no PeerAuth metadata");
102271
+ }
102272
+ };
102224
102273
  var genericZelleBankRoutes = [
102225
102274
  {
102226
102275
  bankId: "chase",
@@ -102236,12 +102285,23 @@ var genericZelleBankRoutes = [
102236
102285
  bankId: "citi",
102237
102286
  sendConfig: zelleCitiSendConfig,
102238
102287
  verifyConfig: zelleCitiVerifyConfig
102288
+ },
102289
+ {
102290
+ bankId: "capitalone",
102291
+ sendConfig: zelleCapitalOneSendConfig,
102292
+ verifyConfig: zelleCapitalOneVerifyConfig
102239
102293
  }
102240
102294
  ];
102241
102295
  genericZelleBankRoutes.map(({ sendConfig, verifyConfig }) => ({
102242
102296
  sendConfig,
102243
102297
  verifyConfig
102244
102298
  }));
102299
+ var usdcUnits = (amount) => {
102300
+ return viem.parseUnits(amount.toString(), 6);
102301
+ };
102302
+ ({
102303
+ singleOrderDeposit: {
102304
+ minDeposit: usdcUnits(10)}});
102245
102305
  var DISPUTE_PROTECTION_STAKE_PLATFORMS = [
102246
102306
  PaymentPlatform.VENMO,
102247
102307
  PaymentPlatform.PAYPAL
@@ -103516,6 +103576,7 @@ function resolvePlatformAttestationConfig(platformName) {
103516
103576
  // src/client/IntentOperations.ts
103517
103577
  var GENERIC_ZELLE_ATTESTATION_ACTION_TYPES = /* @__PURE__ */ new Set([
103518
103578
  "transfer_zelle_bofa",
103579
+ "transfer_zelle_capitalone",
103519
103580
  "transfer_zelle_chase",
103520
103581
  "transfer_zelle_citi"
103521
103582
  ]);
@@ -111011,7 +111072,7 @@ function resolveAttestorEnvironment(attestationServiceUrl) {
111011
111072
  }
111012
111073
  return environment;
111013
111074
  }
111014
- async function attestICloudMailSellerCredential(params, context) {
111075
+ async function uploadICloudMailSellerCredential(params, context) {
111015
111076
  const { appSpecificPassword, platform } = params;
111016
111077
  const mailboxEmail = params.mailboxEmail.trim().toLowerCase();
111017
111078
  if (!mailboxEmail) throw new exports.ValidationError("mailboxEmail is required", "mailboxEmail");
@@ -111074,39 +111135,33 @@ async function attestICloudMailSellerCredential(params, context) {
111074
111135
  `Attestor returned credential type ${bundle.credentialType}`
111075
111136
  );
111076
111137
  }
111077
- return bundle;
111138
+ let stored;
111139
+ try {
111140
+ const response = await apiUploadSellerCredential(
111141
+ platform,
111142
+ payeeDetails,
111143
+ bundle,
111144
+ context.baseApiUrl,
111145
+ context.timeoutMs,
111146
+ context.authorizationToken,
111147
+ // Send once: a 429 or lost response returns to the user, who retries.
111148
+ 1
111149
+ );
111150
+ stored = response.success ? response.responseObject : null;
111151
+ } catch (error) {
111152
+ throw toCuratorError(error, mailboxEmail);
111153
+ }
111154
+ if (stored?.status !== "active" || stored.credentialType !== "icloud_mail" || stored.platform !== platform || stored.payeeIdHash.toLowerCase() !== payeeDetails) {
111155
+ throw new ICloudMailCredentialError(
111156
+ "store_failed",
111157
+ "Curator did not store an active iCloud credential"
111158
+ );
111159
+ }
111160
+ return stored;
111078
111161
  } finally {
111079
111162
  mailboxesInFlight.delete(mailboxEmail);
111080
111163
  }
111081
111164
  }
111082
- async function uploadICloudMailSellerCredential(params, context) {
111083
- const bundle = await attestICloudMailSellerCredential(params, context);
111084
- const { platform } = params;
111085
- const payeeDetails = params.payeeDetails.toLowerCase();
111086
- let stored;
111087
- try {
111088
- const response = await apiUploadSellerCredential(
111089
- platform,
111090
- payeeDetails,
111091
- bundle,
111092
- context.baseApiUrl,
111093
- context.timeoutMs,
111094
- context.authorizationToken,
111095
- // Send once: a 429 or lost response returns to the user, who retries.
111096
- 1
111097
- );
111098
- stored = response.success ? response.responseObject : null;
111099
- } catch (error) {
111100
- throw toCuratorError(error, params.mailboxEmail.trim().toLowerCase());
111101
- }
111102
- if (stored?.status !== "active" || stored.credentialType !== "icloud_mail" || stored.platform !== platform || stored.payeeIdHash.toLowerCase() !== payeeDetails) {
111103
- throw new ICloudMailCredentialError(
111104
- "store_failed",
111105
- "Curator did not store an active iCloud credential"
111106
- );
111107
- }
111108
- return stored;
111109
- }
111110
111165
 
111111
111166
  // src/sellerCredentials.ts
111112
111167
  init_define_ZKP2P_SDK_BUILD_METADATA();
@@ -114415,34 +114470,18 @@ var Zkp2pClient = class {
114415
114470
  * delay. The attestor defaults to the one paired with `baseApiUrl`.
114416
114471
  */
114417
114472
  async uploadICloudMailSellerCredential(params, opts) {
114418
- return uploadICloudMailSellerCredential(params, {
114419
- ...this.iCloudMailAttestContext(opts),
114420
- authorizationToken: await this.resolveAuthorizationToken()
114421
- });
114422
- }
114423
- /**
114424
- * Run the checks, enclave upload and bundle verification of
114425
- * `uploadICloudMailSellerCredential` and return the verified bundle without
114426
- * storing it, for callers that store it through another Curator route. Needs
114427
- * no Curator session; Venmo still fetches the maker's account ID from
114428
- * `baseApiUrl`. Rejects with the same `ICloudMailCredentialError` reasons,
114429
- * mailbox lock and rate-limit delay.
114430
- */
114431
- async attestICloudMailSellerCredential(params, opts) {
114432
- return attestICloudMailSellerCredential(params, this.iCloudMailAttestContext(opts));
114433
- }
114434
- iCloudMailAttestContext(opts) {
114435
114473
  const baseApiUrl = this.stripTrailingSlash(
114436
114474
  opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
114437
114475
  );
114438
- return {
114476
+ return uploadICloudMailSellerCredential(params, {
114439
114477
  attestationServiceUrl: this.stripTrailingSlash(
114440
114478
  opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
114441
114479
  ),
114442
114480
  attestationRuntime: opts?.attestationRuntime,
114443
114481
  baseApiUrl,
114444
- timeoutMs: this.apiTimeoutMs
114445
- };
114482
+ timeoutMs: this.apiTimeoutMs,
114483
+ authorizationToken: await this.resolveAuthorizationToken()
114484
+ });
114446
114485
  }
114447
114486
  /**
114448
114487
  * Status is a coarse curator-owned signal (`active` / `inactive` / `missing`) and intentionally
@@ -114982,7 +115021,6 @@ exports.apiVerifyBuyerTeePayment = apiVerifyBuyerTeePayment;
114982
115021
  exports.appendAttributionToCalldata = appendAttributionToCalldata;
114983
115022
  exports.asciiToBytes32 = asciiToBytes32;
114984
115023
  exports.assertValidReferrerFeeConfig = assertValidReferrerFeeConfig;
114985
- exports.attestICloudMailSellerCredential = attestICloudMailSellerCredential;
114986
115024
  exports.buildStakingEntityIds = buildStakingEntityIds;
114987
115025
  exports.calculateRequiredCoverage = calculateRequiredCoverage;
114988
115026
  exports.calculateStakeBackedCapacity = calculateStakeBackedCapacity;