-
Notifications
You must be signed in to change notification settings - Fork 133
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
Feat/clarinet sdk browser #1448
Conversation
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
a9ef52c
to
122c55d
Compare
122c55d
to
086e0b9
Compare
8ed2484
to
859957a
Compare
dbe51ff
to
d6e3272
Compare
10fd20c
to
46105b9
Compare
46105b9
to
a3b8830
Compare
f8c06a7
to
d4771fd
Compare
f3cd2be
to
fc687ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor suggestion for the sdk workflow. Otherwise looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving GHA workflow changes/additions
Thanks @CharlieC3 |
Description
Closes: #1432
This is a pretty important PR that brings the Clarinet SDK for the browser.
Two new packages
@hirosystems/clarinet-sdk-wasm-browser
@hirosystems/clarinet-sdk-browser
They are the equivalent of these existing packages (but for the browser)
@hirosystems/clarinet-sdk-wasm
@hirosystems/clarinet-sdk
Enhancement
This PR also brings some enhancement to the SDK and some new methods useful for the browser use case (such as
initEmptySession()
andclearCache()
).Improved typing
Some Rust structs are encoded in JS objects, and the TS types for those were in
clarinet-sdk
.They have been moved to
components/clarinet-sdk-wasm/src/ts_types.rs
Review
A good first step to review this PR is to look at these 4 READMEs:
Some docs should be moved to the root Readme (how to build the sdk), but this readme require a lot of work, let's do this in a future PR
Caveats
It brings complexity to an already complicated architecture.
The
clarinet-sdk-wasm
component remain almost the same, except that it now requires a build script that runswasm-pack
twice targetingnodejs
andweb
. It will also rename the web package to@hirosystems/clarinet-sdk-wasm-browser
.The src directory of the
clarinet-sdk
component has been split into 3 directoriescommon/src
,node/src
,browser/src
. With a bit of code duplication betweennode/src/sdkProxy.ts
andbrowser/src/sdkProxy.ts
.But thanks to NPM workspace, it still easy to build and publish the two components.