Skip to content

fix: transaction result serialization #888

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

Merged
merged 6 commits into from
Jul 23, 2024

Conversation

abdulmth
Copy link
Contributor

fixes https://github.com/KILTprotocol/ticket/issues/3529

Adds toJSON implementation to the TransactionResult objects that include a block number.
Another way to solve the serialization issue is to change the block number type to string.

Base automatically changed from abd-chore-refactor-check-result to rf-did-helpers July 22, 2024 09:15
Copy link
Contributor

@rflechtner rflechtner left a comment

Choose a reason for hiding this comment

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

Did you check if stringifying the result object now works? I suspect that due to the getters this will still be a problem, and we likely have to implement toJSON() on the root as well

abdulmth and others added 2 commits July 22, 2024 13:28
Co-authored-by: Raphael Flechtner <39338561+rflechtner@users.noreply.github.com>
@abdulmth
Copy link
Contributor Author

@rflechtner It doesn't work because stringify tries to call the getters, and they will throw except one. But why do we need to implement it for the root? users should match the status anyways before doing anything, and having keys like asConfirmed are meant for conversion rather as a JSON key.

@rflechtner
Copy link
Contributor

@rflechtner It doesn't work because stringify tries to call the getters, and they will throw except one. But why do we need to implement it for the root? users should match the status anyways before doing anything, and having keys like asConfirmed are meant for conversion rather as a JSON key.

I thought so and wondered if we should allow stringifying to either something like

{
   status: 'confirmed',
   value: {
     block: {...},
     ...
   }
}

or

{
   status: 'confirmed',
   block: {...},
   ...
}

@abdulmth abdulmth requested a review from rflechtner July 22, 2024 13:11
Copy link
Contributor

@rflechtner rflechtner left a comment

Choose a reason for hiding this comment

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

👍

@abdulmth abdulmth merged commit 8de9ded into rf-did-helpers Jul 23, 2024
1 check passed
@abdulmth abdulmth deleted the abd-fix-result-serialization branch July 23, 2024 05:52
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.

2 participants