Skip to content

Commit

Permalink
fix issue with non-exists
Browse files Browse the repository at this point in the history
  • Loading branch information
vmidyllic committed Mar 22, 2024
1 parent 3dff826 commit 7c1dd45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xpolygonid/js-sdk",
"version": "1.9.1",
"version": "1.9.2",
"description": "SDK to work with Polygon ID",
"main": "dist/node/cjs/index.js",
"module": "dist/node/esm/index.js",
Expand Down
11 changes: 9 additions & 2 deletions src/proof/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ export const parseQueryMetadata = async (
);
}

const datatype = propertyQuery.operator === Operators.EXISTS ? XSDNS.Boolean : query.datatype;
query.values = await transformQueryValueToBigInts(propertyQuery.operatorValue, datatype);
query.values = Operators.EXISTS ? transformExistsValue(propertyQuery.operatorValue): await transformQueryValueToBigInts(propertyQuery.operatorValue, query.datatype);
}
return query;
};
Expand Down Expand Up @@ -247,3 +246,11 @@ export const transformQueryValueToBigInts = async (
}
return values;
};

const transformExistsValue = (value : unknown): bigint[] =>{

if (typeof value == "boolean") {
return [BigInt(value)];
}
throw new Error("exists operator value must be true or false")
}

0 comments on commit 7c1dd45

Please sign in to comment.