Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #211

Merged
merged 17 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ jobs:
productsign --sign "Developer ID Installer: Chia Network Inc." ${{ github.workspace }}/build-scripts/macos/target/pkg/ClimateTokenizationEngine-macos-installer-x64.pkg ${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimateTokenizationEngine-macos-installer-x64.pkg

echo "Notarizing the .pkg"
npm install -g notarize-cli
notarize-cli \
--file=${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimateTokenizationEngine-macos-installer-x64.pkg \
--bundle-id net.chia.climate-tokenization-engine \
--username "${{ secrets.APPLE_NOTARIZE_USERNAME }}" \
--password "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
xcrun notarytool submit \
--wait \
--apple-id "${{ secrets.APPLE_NOTARIZE_USERNAME }}" \
--password "${{ secrets.APPLE_NOTARIZE_PASSWORD }}" \
--team-id "${{ secrets.APPLE_TEAM_ID }}" \
"${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimateTokenizationEngine-macos-installer-x64.pkg"

- name: Upload Mac Installer
if: matrix.runs-on == 'macos-latest'
Expand Down
2 changes: 1 addition & 1 deletion .repo-content-updater.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pr_target_grant: develop
pr_target_branch: develop
assign_users:
- TheLastCicada
commit_prefix: "chore: "
65 changes: 14 additions & 51 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "climate-tokenization-engine",
"version": "1.3.20",
"version": "1.3.21",
"bin": "./src/server.js",
"description": "",
"main": "proxy.js",
Expand Down Expand Up @@ -36,7 +36,7 @@
"chia-datalayer": "^2.0.14",
"chia-root-resolver": "^1.0.0",
"dotenv": "^16.4.5",
"express": "^4.18.2",
"express": "^4.19.2",
"express-form-data": "^2.0.23",
"express-joi-validation": "^5.0.1",
"http-proxy-middleware": "^2.0.6",
Expand Down
55 changes: 28 additions & 27 deletions src/api/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,48 +143,49 @@ const retireUnit = async (unit, beneficiaryName, beneficiaryAddress) => {
};

/**
* Gets asset unit blocks by a marketplace identifier.
* Fetches all pages of asset unit blocks by a marketplace identifier and aggregates the data.
*
* @param {string} marketplaceIdentifier - The marketplace identifier
* @returns {Promise<Object>} The response body
* @returns {Promise<Array>} Aggregate of data from all pages
*/
const getAssetUnitBlocks = async (marketplaceIdentifier) => {
const aggregateData = [];
let currentPage = 1;
let pageCount = 1;
try {
logger.debug(
`GET ${registryUri}/v1/units?filter=marketplaceIdentifier:${marketplaceIdentifier}:eq&page=1&limit=100`
);
const response = await superagent
.get(`${registryUri}/v1/units`)
.query({
filter: `marketplaceIdentifier:${marketplaceIdentifier}:eq`,
page: 1,
limit: 1000,
})
.set(maybeAppendRegistryApiKey());
do {
logger.debug(`Fetching page ${currentPage} for marketplaceIdentifier: ${marketplaceIdentifier}`);
const response = await superagent
.get(`${registryUri}/v1/units`)
.query({
filter: `marketplaceIdentifier:${marketplaceIdentifier}:eq`,
page: currentPage,
limit: 2,
})
.set(maybeAppendRegistryApiKey());

if (response.status === 403) {
throw new Error(
"Registry API key is invalid, please check your config.yaml."
);
}
if (response.status === 403) {
throw new Error("Registry API key is invalid, please check your config.yaml.");
}

return response?.body;
aggregateData.push(...response.body.data);
pageCount = response.body.pageCount;
currentPage++;
} while (currentPage <= pageCount);

return aggregateData;
} catch (error) {
logger.error(
`Could not get asset unit blocks from registry: ${error.message}`
);
logger.error(`Could not get asset unit blocks from registry: ${error.message}`);

// Log additional information if present in the error object
if (error.response && error.response.body) {
logger.error(
`Additional error details: ${JSON.stringify(error.response.body)}`
);
logger.error(`Additional error details: ${JSON.stringify(error.response.body)}`);
}

return null;
return [];
}
};


/**
* Gets the last processed block height.
*
Expand Down
7 changes: 3 additions & 4 deletions src/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ const getTokenizedUnits = () => {
const currentUrl = new URL(`${registryUri}${path}`);
const newQuery = updateQueryWithParam(
currentUrl.search,
{ param: "hasMarketplaceIdentifier", value: true },
{ param: "orgUid", value: homeOrgUid },
{ param: "includeProjectInfoInSearch", value: true }
{ param: "onlyTokenizedUnits", value: true },
{ param: "orgUid", value: homeOrgUid }
);
return "/v1/units" + newQuery;
},
Expand Down Expand Up @@ -79,7 +78,7 @@ const getUntokenizedUnits = () => {
const currentUrl = new URL(`${registryUri}${path}`);
const newQuery = updateQueryWithParam(
currentUrl.search,
{ param: "hasMarketplaceIdentifier", value: false },
{ param: "onlyTokenizedUnits", value: false },
{ param: "orgUid", value: homeOrgUid },
{ param: "includeProjectInfoInSearch", value: true },
{ param: "filter", value: CONFIG().TOKENIZATION_ENGINE.UNITS_FILTER }
Expand Down
Loading