Skip to content

Commit

Permalink
Merge pull request #254 from logion-network/feature/merge-items
Browse files Browse the repository at this point in the history
Show only on-chain collection items
  • Loading branch information
benoitdevos authored Apr 23, 2024
2 parents 05b0830 + 04035be commit 562c387
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@logion/client",
"version": "0.43.0",
"version": "0.43.1-1",
"description": "logion SDK for client applications",
"main": "dist/index.js",
"packageManager": "[email protected]",
Expand Down
7 changes: 1 addition & 6 deletions packages/client/src/LocClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,6 @@ export abstract class LocClient {
const { locId } = parameters;
const onchainItems = await this.nodeApi.queries.getCollectionItems(locId);

const onchainItemsMap: Record<string, CollectionItem> = {};
for(const item of onchainItems) {
onchainItemsMap[item.id.toHex()] = item;
}

try {
const offchainItems = await this.getOffchainItems({ locId });

Expand All @@ -625,7 +620,7 @@ export abstract class LocClient {
offchainItemsMap[item.itemId] = item;
}

return offchainItems.map(item => this.mergeItems(onchainItemsMap[item.itemId], offchainItemsMap[item.itemId]));
return onchainItems.map(item => this.mergeItems(item, offchainItemsMap[item.id.toHex()]));
} catch(e) {
throw newBackendError(e);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/license/Factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export class MergedTermsAndConditionsElement {

/**
* Creates a new Terms and Conditions, based on given type.
* @param termsAndConditions the Terms and Conditions elements, as stored on the chain.
* @param onchainTCs the Terms and Conditions elements, as stored on the chain.
* @param offchainTCs the Terms and Conditions elements, as stored on the off-chain backend.
* @return an array of terms and conditions element
* @group TermsAndConditions
*/
Expand Down

0 comments on commit 562c387

Please sign in to comment.