-
Notifications
You must be signed in to change notification settings - Fork 95
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
The wasm_bindgen
support of fuel-asm
and fuel-types
#499
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dentosal
reviewed
Jul 5, 2023
Dentosal
reviewed
Jul 5, 2023
Dentosal
requested changes
Jul 5, 2023
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.
Only minor issues, but lets fix those before merging
@xgreenx How can I build these two locally? I'd assume it is done via |
One time install: cargo install wasm-bindgen-cli And to build the rust to WASM and WASM to js/ts: rustc --target wasm32-unknown-unknown -p fuel-types --features typescript --crate-type=cdylib
rustc --target wasm32-unknown-unknown -p fuel-asm --features typescript --crate-type=cdylib
wasm-bindgen --target nodejs --typescript ./target/wasm32-unknown-unknown/release/fuel_types.wasm --out-dir ./typescript_types
wasm-bindgen --target nodejs --typescript ./target/wasm32-unknown-unknown/release/fuel_asm.wasm --out-dir ./typescript_asm |
Voxelot
previously approved these changes
Jul 11, 2023
Dentosal
previously approved these changes
Jul 12, 2023
arboleya
previously approved these changes
Jul 21, 2023
* Drafting NodeJS package template for publishing to NPM * Adding boilerplate for `fuel-types` package * Encapsulating commands as a function for optimal reuse * Adding `fuel-types` to the build/publish script routine * Removing all boilerplate files * Moving .gitignore one directory up * Turning all boilerplate files into reusable templates * Refactoring the main script for WASM generation and NPM pkg assembling * Tyop * Fixing template tags for package `name` and `version` * Moving template around * Renaming templates directory * DRY-refactoring script; formatting; fetching version from `Cargo.toml` * Renaming method and removing TODO - publishing routine should be in CI * Renaming and moving script inside `.npm` dir (decluttering root dir) * Cd’ing to the previous dir without echoing its path * Adjusting templates, using `@fuels/` org prefix for NPM packages * Re-shaping `.npm` directory as a workspace for easier maintenance * Linting - removing extraneous whitespaces * Adjusting `package.json` * Drafting CI action for NPM publishing * Adjusting nomenclature * Commenting requirements temporarily * Adjusting order of CI job steps * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Adjusting sed flags; updating lock file * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Debugging CI * Adding step to ensure NPM access is ok * Adding README * Docs * Tyop * Debugging CI * Removing `dryRun` flag, preparing for real publishing * Fixing package title, adding `@fuels` suffix * Setting up job constrains * Validating real publishing flow * Scoped packages needs to be explicitly published with `--access public` * Rolling back release constrains * Renaming dubious files and scripts * Docs * Trimming jobs dependencies; formatting * Rolling back git checks * Update .npm/.scripts/prepare-wasm-packages.sh Co-authored-by: Green Baneling <XgreenX9999@gmail.com> --------- Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
arboleya
approved these changes
Jul 24, 2023
Merged
This was referenced Sep 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added
wasm_bindgen
forfuel-types
andfuel-asm
. Thewasm_bindgen
requires C-style enums. So I removed all constant variables and merged the enum definition with theTryFrom
orFrom
implementation to use the values directly.The
wasm_bindgen
doesn't support non C-style enums, so I created a wrapper aroundInstruction
-typescript::Instruction
.The
wasm_bindgen
doesn't work with constant functions and generics, so I created non-constant and non-generic analogs for methods.The
wasm_bindgen
doesn't support constants, so I created non-constant methods.Replaced the
Self
with actual type's name because it is required bywasm_bindgen
.I removed the usage of
fuel-types
fromfuel-asm
to generate less code forfuels-ts
.