@zkp2p/sdk 0.14.7 → 0.14.8-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.
@@ -0,0 +1,12 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // <define:__ZKP2P_SDK_BUILD_METADATA__>
8
+ var 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" } } };
9
+
10
+ export { __export, define_ZKP2P_SDK_BUILD_METADATA_default };
11
+ //# sourceMappingURL=chunk-KQT4XYPO.mjs.map
12
+ //# sourceMappingURL=chunk-KQT4XYPO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["%3Cdefine:__ZKP2P_SDK_BUILD_METADATA__%3E"],"names":[],"mappings":";;;;;;;AAAA,IAAA,uCAAA,GAAA,EAAC,aAAA,EAAgB,CAAA,EAAE,MAAA,EAAS,EAAC,YAAa,qBAAA,EAAsB,SAAA,EAAY,0CAAA,EAA2C,IAAA,EAAO,UAAS,aAAA,EAAgB,IAAA,EAAI,EAAE,iBAAA,EAAoB,eAAc,uBAAA,EAA0B,YAAA,EAAa,2BAAA,EAA8B,QAAA,EAAS,oBAAqB,EAAC,IAAA,EAAO,EAAC,OAAA,EAAU,GAAE,aAAA,EAAgB,kEAAA,EAAkE,EAAE,WAAA,EAAc,EAAC,OAAA,EAAU,CAAA,EAAE,aAAA,EAAgB,kEAAA,IAAmE","file":"chunk-KQT4XYPO.mjs","sourcesContent":["{\"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\"}}}"]}
@@ -1,4 +1,4 @@
1
1
  export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchain, mapConversionRatesToOnchainMinRate } from './chunk-WDEEWFEU.mjs';
2
- import './chunk-SWQCAVQR.mjs';
3
- //# sourceMappingURL=currency-7YDW5OGY.mjs.map
4
- //# sourceMappingURL=currency-7YDW5OGY.mjs.map
2
+ import './chunk-KQT4XYPO.mjs';
3
+ //# sourceMappingURL=currency-45EYG6OA.mjs.map
4
+ //# sourceMappingURL=currency-45EYG6OA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"currency-7YDW5OGY.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"currency-45EYG6OA.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: "b2eb8395983f34f42ecbfecda99efa0fe3fba75a", kind: "github", distributable: true }, sdkPackageVersion: "0.14.7", 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: "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" } } };
25
25
  }
26
26
  });
27
27
 
@@ -111011,7 +111011,7 @@ function resolveAttestorEnvironment(attestationServiceUrl) {
111011
111011
  }
111012
111012
  return environment;
111013
111013
  }
111014
- async function uploadICloudMailSellerCredential(params, context) {
111014
+ async function attestICloudMailSellerCredential(params, context) {
111015
111015
  const { appSpecificPassword, platform } = params;
111016
111016
  const mailboxEmail = params.mailboxEmail.trim().toLowerCase();
111017
111017
  if (!mailboxEmail) throw new exports.ValidationError("mailboxEmail is required", "mailboxEmail");
@@ -111074,33 +111074,39 @@ async function uploadICloudMailSellerCredential(params, context) {
111074
111074
  `Attestor returned credential type ${bundle.credentialType}`
111075
111075
  );
111076
111076
  }
111077
- let stored;
111078
- try {
111079
- const response = await apiUploadSellerCredential(
111080
- platform,
111081
- payeeDetails,
111082
- bundle,
111083
- context.baseApiUrl,
111084
- context.timeoutMs,
111085
- context.authorizationToken,
111086
- // Send once: a 429 or lost response returns to the user, who retries.
111087
- 1
111088
- );
111089
- stored = response.success ? response.responseObject : null;
111090
- } catch (error) {
111091
- throw toCuratorError(error, mailboxEmail);
111092
- }
111093
- if (stored?.status !== "active" || stored.credentialType !== "icloud_mail" || stored.platform !== platform || stored.payeeIdHash.toLowerCase() !== payeeDetails) {
111094
- throw new ICloudMailCredentialError(
111095
- "store_failed",
111096
- "Curator did not store an active iCloud credential"
111097
- );
111098
- }
111099
- return stored;
111077
+ return bundle;
111100
111078
  } finally {
111101
111079
  mailboxesInFlight.delete(mailboxEmail);
111102
111080
  }
111103
111081
  }
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
+ }
111104
111110
 
111105
111111
  // src/sellerCredentials.ts
111106
111112
  init_define_ZKP2P_SDK_BUILD_METADATA();
@@ -114409,18 +114415,34 @@ var Zkp2pClient = class {
114409
114415
  * delay. The attestor defaults to the one paired with `baseApiUrl`.
114410
114416
  */
114411
114417
  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) {
114412
114435
  const baseApiUrl = this.stripTrailingSlash(
114413
114436
  opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
114414
114437
  );
114415
- return uploadICloudMailSellerCredential(params, {
114438
+ return {
114416
114439
  attestationServiceUrl: this.stripTrailingSlash(
114417
114440
  opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
114418
114441
  ),
114419
114442
  attestationRuntime: opts?.attestationRuntime,
114420
114443
  baseApiUrl,
114421
- timeoutMs: this.apiTimeoutMs,
114422
- authorizationToken: await this.resolveAuthorizationToken()
114423
- });
114444
+ timeoutMs: this.apiTimeoutMs
114445
+ };
114424
114446
  }
114425
114447
  /**
114426
114448
  * Status is a coarse curator-owned signal (`active` / `inactive` / `missing`) and intentionally
@@ -114960,6 +114982,7 @@ exports.apiVerifyBuyerTeePayment = apiVerifyBuyerTeePayment;
114960
114982
  exports.appendAttributionToCalldata = appendAttributionToCalldata;
114961
114983
  exports.asciiToBytes32 = asciiToBytes32;
114962
114984
  exports.assertValidReferrerFeeConfig = assertValidReferrerFeeConfig;
114985
+ exports.attestICloudMailSellerCredential = attestICloudMailSellerCredential;
114963
114986
  exports.buildStakingEntityIds = buildStakingEntityIds;
114964
114987
  exports.calculateRequiredCoverage = calculateRequiredCoverage;
114965
114988
  exports.calculateStakeBackedCapacity = calculateStakeBackedCapacity;