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.
Experimental PR to make
chia-protocol
available as a wasm module.Current status:
Building wasm module only with
struct
/enum
succeededSteps to reproduce:
wasm-pack
installed on your system. (Just invokecargo add wasm-pack
to install)cd chia-protocol
wasm-pack build
To convert methods with fixed sized byte array arguments/return value like
&[u8; 4]
, we need to waitwasm-bindgen
' updaterustwasm/wasm-bindgen#3458
u128
not supported yet bywasm-bindgen
wasm-bindgen
does not yet supportu128
so only when compiling forwasm32
the type will be converted tou64
temporarily by#[wasm_patch::conv_u128_to_u64_for_wasm]
proc macro attritute.BytesImpl should not be used outside
chia-protocol/src/bytes.rs
BytesImpl<T>
is basically aliased to types likeBytes32
,Bytes48
, and so on.Since
wasm-bindgen
cannot treat generic parameters well when it is converting rust code to wasm, please do not useBytesImpl<T>
notation outsidebytes.rs
.