@0xpolygonid/js-sdk 1.21.0 → 1.21.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.
@@ -7093,6 +7093,8 @@ var PolygonIdSdk = (function (exports) {
7093
7093
  function encode(prefix, words, limit = 90) {
7094
7094
  if (typeof prefix !== 'string')
7095
7095
  throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`);
7096
+ if (words instanceof Uint8Array)
7097
+ words = Array.from(words);
7096
7098
  if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number'))
7097
7099
  throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`);
7098
7100
  if (prefix.length === 0)
@@ -7131,7 +7133,19 @@ var PolygonIdSdk = (function (exports) {
7131
7133
  const { prefix, words } = decode(str, false);
7132
7134
  return { prefix, words, bytes: fromWords(words) };
7133
7135
  }
7134
- return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords };
7136
+ function encodeFromBytes(prefix, bytes) {
7137
+ return encode(prefix, toWords(bytes));
7138
+ }
7139
+ return {
7140
+ encode,
7141
+ decode,
7142
+ encodeFromBytes,
7143
+ decodeToBytes,
7144
+ decodeUnsafe,
7145
+ fromWords,
7146
+ fromWordsUnsafe,
7147
+ toWords,
7148
+ };
7135
7149
  }
7136
7150
  const bech32 = /* @__PURE__ */ genBech32('bech32');
7137
7151
 
@@ -30419,7 +30433,7 @@ var PolygonIdSdk = (function (exports) {
30419
30433
  /**
30420
30434
  * The current version of Ethers.
30421
30435
  */
30422
- const version = "6.13.2";
30436
+ const version = "6.13.4";
30423
30437
 
30424
30438
  /**
30425
30439
  * Property helper functions.
@@ -46822,7 +46836,18 @@ var PolygonIdSdk = (function (exports) {
46822
46836
  }
46823
46837
  this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls });
46824
46838
  let errorMessage = "unknown error";
46825
- const resp = await request.send();
46839
+ // Fetch the resource...
46840
+ let resp;
46841
+ try {
46842
+ resp = await request.send();
46843
+ }
46844
+ catch (error) {
46845
+ // ...low-level fetch error (missing host, bad SSL, etc.),
46846
+ // so try next URL
46847
+ errorMessages.push(error.message);
46848
+ this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } });
46849
+ continue;
46850
+ }
46826
46851
  try {
46827
46852
  const result = resp.bodyJson;
46828
46853
  if (result.data) {
@@ -48418,7 +48443,7 @@ var PolygonIdSdk = (function (exports) {
48418
48443
  // If the network changed: calling again will also fail
48419
48444
  // If unsupported: likely destroyed
48420
48445
  if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") ||
48421
- isError(error, "NETWORK_ERROR")) {
48446
+ isError(error, "NETWORK_ERROR") || isError(error, "UNSUPPORTED_OPERATION")) {
48422
48447
  if (error.info == null) {
48423
48448
  error.info = {};
48424
48449
  }
@@ -54327,10 +54352,12 @@ var PolygonIdSdk = (function (exports) {
54327
54352
  if (!Array.isArray(b) || b.length !== 2) {
54328
54353
  throw new Error('$between/$nonbetween operator value should be 2 elements array');
54329
54354
  }
54355
+ const [min, max] = b.map(BigInt);
54356
+ const predicate = (val) => val >= min && val <= max;
54330
54357
  if (Array.isArray(a)) {
54331
- return a.every((val) => val >= b[0] && val <= b[1]);
54358
+ return a.map(BigInt).every(predicate);
54332
54359
  }
54333
- return a >= b[0] && a <= b[1];
54360
+ return predicate(BigInt(a));
54334
54361
  };
54335
54362
  const comparatorOptions = {
54336
54363
  $noop: () => true,
@@ -54340,7 +54367,7 @@ var PolygonIdSdk = (function (exports) {
54340
54367
  $in: (a, b) => inOperator(a, b),
54341
54368
  $nin: (a, b) => !inOperator(a, b),
54342
54369
  $gt: (a, b) => greaterThan(a, b),
54343
- $lt: (a, b) => !greaterThan(a, b),
54370
+ $lt: (a, b) => !greaterThanOrEqual(a, b),
54344
54371
  $ne: (a, b) => !equalsComparator(a, b),
54345
54372
  $gte: (a, b) => greaterThanOrEqual(a, b),
54346
54373
  $lte: (a, b) => lessThanOrEqual(a, b),
@@ -79408,6 +79435,15 @@ var PolygonIdSdk = (function (exports) {
79408
79435
  const allOperations = Object.values(QueryOperators);
79409
79436
  const v2Operations = [
79410
79437
  exports.Operators.NOOP,
79438
+ exports.Operators.EQ,
79439
+ exports.Operators.LT,
79440
+ exports.Operators.GT,
79441
+ exports.Operators.IN,
79442
+ exports.Operators.NIN,
79443
+ exports.Operators.NE,
79444
+ exports.Operators.SD
79445
+ ];
79446
+ const v2OnChainOperations = [
79411
79447
  exports.Operators.EQ,
79412
79448
  exports.Operators.LT,
79413
79449
  exports.Operators.GT,
@@ -79417,9 +79453,15 @@ var PolygonIdSdk = (function (exports) {
79417
79453
  ];
79418
79454
  const circuitValidator = {
79419
79455
  [exports.CircuitId.AtomicQueryMTPV2]: { maxQueriesCount: 1, supportedOperations: v2Operations },
79420
- [exports.CircuitId.AtomicQueryMTPV2OnChain]: { maxQueriesCount: 1, supportedOperations: v2Operations },
79456
+ [exports.CircuitId.AtomicQueryMTPV2OnChain]: {
79457
+ maxQueriesCount: 1,
79458
+ supportedOperations: v2OnChainOperations
79459
+ },
79421
79460
  [exports.CircuitId.AtomicQuerySigV2]: { maxQueriesCount: 1, supportedOperations: v2Operations },
79422
- [exports.CircuitId.AtomicQuerySigV2OnChain]: { maxQueriesCount: 1, supportedOperations: v2Operations },
79461
+ [exports.CircuitId.AtomicQuerySigV2OnChain]: {
79462
+ maxQueriesCount: 1,
79463
+ supportedOperations: v2OnChainOperations
79464
+ },
79423
79465
  [exports.CircuitId.AtomicQueryV3]: { maxQueriesCount: 1, supportedOperations: allOperations },
79424
79466
  [exports.CircuitId.AtomicQueryV3OnChain]: { maxQueriesCount: 1, supportedOperations: allOperations },
79425
79467
  [exports.CircuitId.AuthV2]: { maxQueriesCount: 0, supportedOperations: [] },
@@ -79486,7 +79528,6 @@ var PolygonIdSdk = (function (exports) {
79486
79528
  circuitInputs.signature = signature;
79487
79529
  circuitInputs.challenge = params.challenge;
79488
79530
  const query = circuitQueries[0];
79489
- query.operator = this.transformV2QueryOperator(query.operator);
79490
79531
  circuitInputs.query = query;
79491
79532
  circuitInputs.claim = {
79492
79533
  issuerID: circuitClaimData.issuerId,
@@ -79545,7 +79586,6 @@ var PolygonIdSdk = (function (exports) {
79545
79586
  circuitInputs.profileNonce = BigInt(params.authProfileNonce);
79546
79587
  circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
79547
79588
  const query = circuitQueries[0];
79548
- query.operator = this.transformV2QueryOperator(query.operator);
79549
79589
  circuitInputs.query = query;
79550
79590
  circuitInputs.currentTimeStamp = b$4(new Date());
79551
79591
  if (authClaimData.treeState) {