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

Fix: Error when using bigint in smart contract parameters #421

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

limemloh
Copy link
Contributor

Purpose

Closes #420.

Changes

  • The injected script will now send the smart contract parameters stringified using json-bigint, which is then parsed in the extension when parsing the payload. This is all internal and should not result in any breaking changes.
  • The type SmartContractParameters is extended with bigint.

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.

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.

I think I would prefer using our internal stringify/parse instead of adding a dependency.
It breaks the display in the popup.
otherwise LGTM.

Screenshot from 2024-01-22 16-06-00
Screenshot from 2024-01-22 16-03-53-1

@limemloh
Copy link
Contributor Author

limemloh commented Jan 22, 2024

I think I would prefer using our internal stringify/parse instead of adding a dependency.

The issue with the internal stringify/parse is that it does not support arbitrary JSON, ex. if my smart contract takes the JSON { '@type': "bigint", value: "5"} then it would hit our internal representation and be replaced with 5n.

@limemloh
Copy link
Contributor Author

limemloh commented Jan 23, 2024

It breaks the display in the popup.

I have fixed that part again

@limemloh limemloh force-pushed the fix-sc-params-bigint branch from 590b416 to 9e219d8 Compare January 24, 2024 08:04
@limemloh limemloh merged commit 41f2842 into main Jan 24, 2024
4 checks passed
@limemloh limemloh deleted the fix-sc-params-bigint branch January 24, 2024 08:10
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.

Error when using bigint in smart contract parameters
2 participants