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 function for stringifying wrapper types as unwrapped, serializable types #306

Merged
merged 11 commits into from
Nov 13, 2023

Conversation

soerenbf
Copy link
Collaborator

@soerenbf soerenbf commented Nov 9, 2023

Purpose

Unwrap types to a representation of the inner value, to make it easier to stringify structures using the newly added types into something sensible (f.x. for http requests).

Types that already had toJSON functions on them are kept as is.

Changes

  • Add toJSON functions where needed.

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

@soerenbf soerenbf self-assigned this Nov 9, 2023
@soerenbf
Copy link
Collaborator Author

soerenbf commented Nov 9, 2023

Kept as draft until it's been verified as compatible in Concordium/concordium-dapp-libraries#51

Copy link
Contributor

@shjortConcordium shjortConcordium left a comment

Choose a reason for hiding this comment

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

These changes do break with the browser wallet, using this with wCCD, gives me
Error: The given transaction is not valid due to: TypeError: Cannot read properties of undefined (reading 'split').
I'll check wallet connect tomorrow.

packages/sdk/CHANGELOG.md Outdated Show resolved Hide resolved
packages/sdk/src/types/ContractAddress.ts Outdated Show resolved Hide resolved
packages/sdk/test/ci/types/native-json.test.ts Outdated Show resolved Hide resolved
@soerenbf
Copy link
Collaborator Author

These changes do break with the browser wallet, using this with wCCD, gives me Error: The given transaction is not valid due to: TypeError: Cannot read properties of undefined (reading 'split'). I'll check wallet connect tomorrow.

Upon checking again it seems you're right.. Will need to figure out an alternative

@soerenbf soerenbf changed the title Add toJSON for all types, ensuring types serialize to inner values on stringify Add function for stringifying wrapper types as unwrapped, serializable types Nov 10, 2023
@soerenbf soerenbf marked this pull request as ready for review November 10, 2023 11:58
packages/sdk/package.json Outdated Show resolved Hide resolved
packages/sdk/src/types/json.ts Outdated Show resolved Hide resolved
@soerenbf soerenbf merged commit 1c859a0 into main Nov 13, 2023
11 checks passed
@soerenbf soerenbf deleted the types-tojson branch November 13, 2023 13:34
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