Skip to content

Commit

Permalink
Merge pull request #202 from Chia-Network/hotfix-1.3.17
Browse files Browse the repository at this point in the history
fix: pagination on marketplace ids
  • Loading branch information
TheLastCicada authored Mar 8, 2024
2 parents aac6144 + c901e16 commit 4ac8e8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "climate-tokenization-engine",
"version": "1.3.18",
"version": "1.3.19",
"bin": "./src/server.js",
"description": "",
"main": "proxy.js",
Expand Down
4 changes: 2 additions & 2 deletions src/api/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ const waitForRegistryDataSync = async (options = {}) => {
*/
const getTokenizedUnitByAssetId = async (assetId) => {
try {
const url = `${registryUri}/v1/units?marketplaceIdentifiers=${assetId}`;
const url = `${registryUri}/v1/units?marketplaceIdentifiers=${assetId}&page=1&limit=100`;
logger.debug(`GET ${url}`);
const response = await superagent.get(url).set(maybeAppendRegistryApiKey());

Expand All @@ -698,7 +698,7 @@ const getTokenizedUnitByAssetId = async (assetId) => {
);
}

return response.body;
return response?.body?.data || [];
} catch (error) {
logger.error(`Could not get tokenized unit by asset id: ${error.message}`);

Expand Down
2 changes: 1 addition & 1 deletion src/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const parseDetokFile = async (req, res) => {
const unitToBeDetokenizedResponse =
await registry.getTokenizedUnitByAssetId(assetId);

let unitToBeDetokenized = JSON.parse(unitToBeDetokenizedResponse);
let unitToBeDetokenized = unitToBeDetokenizedResponse;
if (unitToBeDetokenized.length) {
unitToBeDetokenized = unitToBeDetokenized[0];
}
Expand Down

0 comments on commit 4ac8e8d

Please sign in to comment.