@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.
@@ -7040,6 +7040,8 @@ function genBech32(encoding) {
7040
7040
  function encode(prefix, words, limit = 90) {
7041
7041
  if (typeof prefix !== 'string')
7042
7042
  throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`);
7043
+ if (words instanceof Uint8Array)
7044
+ words = Array.from(words);
7043
7045
  if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number'))
7044
7046
  throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`);
7045
7047
  if (prefix.length === 0)
@@ -7078,7 +7080,19 @@ function genBech32(encoding) {
7078
7080
  const { prefix, words } = decode(str, false);
7079
7081
  return { prefix, words, bytes: fromWords(words) };
7080
7082
  }
7081
- return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords };
7083
+ function encodeFromBytes(prefix, bytes) {
7084
+ return encode(prefix, toWords(bytes));
7085
+ }
7086
+ return {
7087
+ encode,
7088
+ decode,
7089
+ encodeFromBytes,
7090
+ decodeToBytes,
7091
+ decodeUnsafe,
7092
+ fromWords,
7093
+ fromWordsUnsafe,
7094
+ toWords,
7095
+ };
7082
7096
  }
7083
7097
  const bech32 = /* @__PURE__ */ genBech32('bech32');
7084
7098
 
@@ -30280,7 +30294,7 @@ const cacheLoader = (opts) => {
30280
30294
  /**
30281
30295
  * The current version of Ethers.
30282
30296
  */
30283
- const version = "6.13.2";
30297
+ const version = "6.13.4";
30284
30298
 
30285
30299
  /**
30286
30300
  * Property helper functions.
@@ -46683,7 +46697,18 @@ class AbstractProvider {
46683
46697
  }
46684
46698
  this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls });
46685
46699
  let errorMessage = "unknown error";
46686
- const resp = await request.send();
46700
+ // Fetch the resource...
46701
+ let resp;
46702
+ try {
46703
+ resp = await request.send();
46704
+ }
46705
+ catch (error) {
46706
+ // ...low-level fetch error (missing host, bad SSL, etc.),
46707
+ // so try next URL
46708
+ errorMessages.push(error.message);
46709
+ this.emit("debug", { action: "receiveCcipReadFetchError", request, result: { error } });
46710
+ continue;
46711
+ }
46687
46712
  try {
46688
46713
  const result = resp.bodyJson;
46689
46714
  if (result.data) {
@@ -48279,7 +48304,7 @@ class JsonRpcSigner extends AbstractSigner {
48279
48304
  // If the network changed: calling again will also fail
48280
48305
  // If unsupported: likely destroyed
48281
48306
  if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") ||
48282
- isError(error, "NETWORK_ERROR")) {
48307
+ isError(error, "NETWORK_ERROR") || isError(error, "UNSUPPORTED_OPERATION")) {
48283
48308
  if (error.info == null) {
48284
48309
  error.info = {};
48285
48310
  }
@@ -54188,10 +54213,12 @@ const betweenOperator = (a, b) => {
54188
54213
  if (!Array.isArray(b) || b.length !== 2) {
54189
54214
  throw new Error('$between/$nonbetween operator value should be 2 elements array');
54190
54215
  }
54216
+ const [min, max] = b.map(BigInt);
54217
+ const predicate = (val) => val >= min && val <= max;
54191
54218
  if (Array.isArray(a)) {
54192
- return a.every((val) => val >= b[0] && val <= b[1]);
54219
+ return a.map(BigInt).every(predicate);
54193
54220
  }
54194
- return a >= b[0] && a <= b[1];
54221
+ return predicate(BigInt(a));
54195
54222
  };
54196
54223
  const comparatorOptions = {
54197
54224
  $noop: () => true,
@@ -54201,7 +54228,7 @@ const comparatorOptions = {
54201
54228
  $in: (a, b) => inOperator(a, b),
54202
54229
  $nin: (a, b) => !inOperator(a, b),
54203
54230
  $gt: (a, b) => greaterThan(a, b),
54204
- $lt: (a, b) => !greaterThan(a, b),
54231
+ $lt: (a, b) => !greaterThanOrEqual(a, b),
54205
54232
  $ne: (a, b) => !equalsComparator(a, b),
54206
54233
  $gte: (a, b) => greaterThanOrEqual(a, b),
54207
54234
  $lte: (a, b) => lessThanOrEqual(a, b),
@@ -58526,6 +58553,15 @@ class PaymentHandler extends AbstractMessageHandler {
58526
58553
  const allOperations = Object.values(QueryOperators);
58527
58554
  const v2Operations = [
58528
58555
  Operators.NOOP,
58556
+ Operators.EQ,
58557
+ Operators.LT,
58558
+ Operators.GT,
58559
+ Operators.IN,
58560
+ Operators.NIN,
58561
+ Operators.NE,
58562
+ Operators.SD
58563
+ ];
58564
+ const v2OnChainOperations = [
58529
58565
  Operators.EQ,
58530
58566
  Operators.LT,
58531
58567
  Operators.GT,
@@ -58535,9 +58571,15 @@ const v2Operations = [
58535
58571
  ];
58536
58572
  const circuitValidator = {
58537
58573
  [CircuitId.AtomicQueryMTPV2]: { maxQueriesCount: 1, supportedOperations: v2Operations },
58538
- [CircuitId.AtomicQueryMTPV2OnChain]: { maxQueriesCount: 1, supportedOperations: v2Operations },
58574
+ [CircuitId.AtomicQueryMTPV2OnChain]: {
58575
+ maxQueriesCount: 1,
58576
+ supportedOperations: v2OnChainOperations
58577
+ },
58539
58578
  [CircuitId.AtomicQuerySigV2]: { maxQueriesCount: 1, supportedOperations: v2Operations },
58540
- [CircuitId.AtomicQuerySigV2OnChain]: { maxQueriesCount: 1, supportedOperations: v2Operations },
58579
+ [CircuitId.AtomicQuerySigV2OnChain]: {
58580
+ maxQueriesCount: 1,
58581
+ supportedOperations: v2OnChainOperations
58582
+ },
58541
58583
  [CircuitId.AtomicQueryV3]: { maxQueriesCount: 1, supportedOperations: allOperations },
58542
58584
  [CircuitId.AtomicQueryV3OnChain]: { maxQueriesCount: 1, supportedOperations: allOperations },
58543
58585
  [CircuitId.AuthV2]: { maxQueriesCount: 0, supportedOperations: [] },
@@ -58604,7 +58646,6 @@ class InputGenerator {
58604
58646
  circuitInputs.signature = signature;
58605
58647
  circuitInputs.challenge = params.challenge;
58606
58648
  const query = circuitQueries[0];
58607
- query.operator = this.transformV2QueryOperator(query.operator);
58608
58649
  circuitInputs.query = query;
58609
58650
  circuitInputs.claim = {
58610
58651
  issuerID: circuitClaimData.issuerId,
@@ -58663,7 +58704,6 @@ class InputGenerator {
58663
58704
  circuitInputs.profileNonce = BigInt(params.authProfileNonce);
58664
58705
  circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
58665
58706
  const query = circuitQueries[0];
58666
- query.operator = this.transformV2QueryOperator(query.operator);
58667
58707
  circuitInputs.query = query;
58668
58708
  circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
58669
58709
  if (authClaimData.treeState) {