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 message schema validators #18

Merged
merged 6 commits into from
Jun 20, 2024
Merged

Add message schema validators #18

merged 6 commits into from
Jun 20, 2024

Conversation

aryzing
Copy link
Contributor

@aryzing aryzing commented May 28, 2024

Updates sats-connect-core to derive types from (runtime) schema validators. The validators are exported, and can be used at type assertion boundaries, such as when data is passed by a third party app to the background script, or when the background script passes data via url params to the extension popup.

Given JSON RPC 2.0 is an integral part of sats-connect, schema validators for RPC calls are also inlcuded.

The validator lib is marked as a peer dependency to better integrate with third party use of sats-connect. The schema validators are pure functions, and any modern build tool should tree-shake them away if not used.

This PR updates the types of 3 methods (getInfo, getAddresses, getAccounts), with remaining methods planned to be incrementally updated with future PRs.

A couple of new methods for connecting and disconnecting the wallet are also added.

@aryzing aryzing self-assigned this May 29, 2024
@aryzing aryzing requested a review from m-aboelenein May 30, 2024 10:03
@aryzing aryzing marked this pull request as ready for review May 30, 2024 10:26
@aryzing aryzing force-pushed the eduard/schema-validators branch from c89bad6 to 712848f Compare June 19, 2024 13:34
@aryzing aryzing force-pushed the eduard/schema-validators branch from 712848f to ca12279 Compare June 20, 2024 09:37
@aryzing aryzing requested a review from dhriaznov June 20, 2024 09:38
@dhriaznov dhriaznov removed their request for review June 20, 2024 15:51
@aryzing aryzing merged commit b0557b4 into main Jun 20, 2024
1 check passed
@teebszet teebszet deleted the eduard/schema-validators branch June 21, 2024 12:46
@aryzing aryzing mentioned this pull request Jul 1, 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.

2 participants