@0xpolygonid/js-sdk 1.10.3 → 1.10.4

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.
@@ -297,10 +297,7 @@ class PubSignalsVerifier {
297
297
  }
298
298
  };
299
299
  this.checkStateExistenceForId = async (userId, userState) => {
300
- const { latest } = await this.resolve(userId, userState.bigInt());
301
- if (!latest) {
302
- throw exports.userStateError;
303
- }
300
+ await this.resolve(userId, userState.bigInt());
304
301
  };
305
302
  this.checkGlobalState = async (state, id) => {
306
303
  return this.rootResolve(state.bigInt(), id.bigInt());
@@ -393,7 +390,9 @@ class PubSignalsVerifier {
393
390
  contractState = await this._stateStorage.getStateInfoByIdAndState(idBigInt, state);
394
391
  }
395
392
  catch (e) {
396
- if (e.errorArgs[0] === 'State does not exist') {
393
+ const stateNotExistErr = (e?.errorArgs ?? [])[0];
394
+ const errMsg = stateNotExistErr || e.message;
395
+ if (errMsg === 'State does not exist') {
397
396
  if (isGenesis) {
398
397
  return {
399
398
  latest: true,
@@ -294,10 +294,7 @@ export class PubSignalsVerifier {
294
294
  }
295
295
  };
296
296
  this.checkStateExistenceForId = async (userId, userState) => {
297
- const { latest } = await this.resolve(userId, userState.bigInt());
298
- if (!latest) {
299
- throw userStateError;
300
- }
297
+ await this.resolve(userId, userState.bigInt());
301
298
  };
302
299
  this.checkGlobalState = async (state, id) => {
303
300
  return this.rootResolve(state.bigInt(), id.bigInt());
@@ -390,7 +387,9 @@ export class PubSignalsVerifier {
390
387
  contractState = await this._stateStorage.getStateInfoByIdAndState(idBigInt, state);
391
388
  }
392
389
  catch (e) {
393
- if (e.errorArgs[0] === 'State does not exist') {
390
+ const stateNotExistErr = (e?.errorArgs ?? [])[0];
391
+ const errMsg = stateNotExistErr || e.message;
392
+ if (errMsg === 'State does not exist') {
394
393
  if (isGenesis) {
395
394
  return {
396
395
  latest: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.10.3",
3
+ "version": "1.10.4",
4
4
  "description": "SDK to work with Polygon ID",
5
5
  "main": "dist/node/cjs/index.js",
6
6
  "module": "dist/node/esm/index.js",