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

Add transaction receipts to responses #145

Conversation

zsculac
Copy link
Contributor

@zsculac zsculac commented Sep 6, 2024

Was able to test the following methods:

  • asset-operation-manager
    • extendStoringPeriod
    • addTokens
  • paranet-operation-manager
    • create
    • deployIncentivesContract
    • createService
    • addServices

Could not test these methods:

  • asset-operation-manager
    • burn
    • cancelUpdate
    • addUpdateToken
  • paranet-operation-manager
    • claimVoterReward
    • claimOperatorReward
    • updateClaimableRewards

transactionHash: receipt.transactionHash,
status: receipt.status,
};
return receipt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't change the way returned object looks like, it would be a breaking change otherwise. I suggest we just add additional field operation

transactionHash: receipt.transactionHash,
status: receipt.status,
};
return receipt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return receipt;
return {
operation: receipt,
transactionHash: receipt.transactionHash,
status: receipt.status,
};

@@ -285,7 +285,7 @@ class BlockchainServiceBase {
data: { tokenId },
});

return tokenId;
return [tokenId, receipt];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's return an object to avoid mistakes in the future

Suggested change
return [tokenId, receipt];
return { tokenId, receipt };

tokenId = await this.blockchainService.createAsset(
let receipt;
if (paranetUAL == null) {
[tokenId, receipt] = await this.blockchainService.createAsset(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest returning object here, then destructuring would look like that:

Suggested change
[tokenId, receipt] = await this.blockchainService.createAsset(
({ tokenId, receipt } = await this.blockchainService.createAsset(

@@ -352,7 +344,7 @@ class AssetOperationsManager {
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
);
));

);
return {
UAL,
publicAssertionId,
operation: getOperationStatusObject(operationResult, operationId),
operation: {
updateKnowledgeAssetReceipt: receipt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
updateKnowledgeAssetReceipt: receipt,
updateKnowledgeAsset: receipt,

operation: getOperationStatusObject(operationResult, operationId),
operation: {
updateKnowledgeAssetReceipt: receipt,
localStore: getOperationStatusObject(localStoreOperationResult, UpdateOperationId),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
localStore: getOperationStatusObject(localStoreOperationResult, UpdateOperationId),
localStore: getOperationStatusObject(localStoreOperationResult, updateOperationId),

status: getOperationStatusObject({ status: 'COMPLETED' }, null),
cancelKnowledgeAssetUpdateReceipt: receipt,
},
cancelAssetUpdateReceipt: receipt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have it inside operation

Suggested change
cancelAssetUpdateReceipt: receipt,


return {
UAL,
operation: getOperationStatusObject({ status: 'COMPLETED' }, null),
operation: {
status: getOperationStatusObject({ status: 'COMPLETED' }, null),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This on is not needed, since we only have 1 operation in this function, I would just return operation: receipt

@@ -53,6 +53,7 @@ class ParanetOperationsManager {

return {
paranetUAL: UAL,
createParanetReceipt: receipt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
createParanetReceipt: receipt
operation: receipt

@zsculac zsculac changed the base branch from master to release/v6.5.3 September 16, 2024 10:46
@u-hubar u-hubar merged commit d889651 into OriginTrail:release/v6.5.3 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants