gakonst / ethers-rs

Complete Ethereum & Celo library and wallet implementation in Rust. https://docs.rs/ethers
Apache License 2.0
2.47k stars 796 forks source link

WASM Support #96

Closed SilentCicero closed 3 years ago

SilentCicero commented 3 years ago

What is the WASM support status on this lib?

What needs to be done?

gakonst commented 3 years ago

Probably hard to get it working with async-trait.

wasm-pack inside ethers-providers has this error: image

Could maybe be solved by switching our async-traits to not be Send, but that would mean we can't spawn them, which is not ideal

mattsse commented 3 years ago

@gakonst following up on this, because I just saw ethabi no_std https://github.com/darwinia-network/ethabi/tree/xavier-no-std

Would it actually be worth it to support wasm/no_std? I can't really think of a good use case...

That being said, I think we can get the problems in providers resolved for no_std

gakonst commented 3 years ago

I don't have a great use-case in mind either, and candidly, feels like doing async stuff over wasm/ffi would be a big pain :P I think it'd be great if the crate is in a state where it compiles with no_std/wasm-pack, so that if anybody ever wanted to build things that way, they'd be able to.

prestwich commented 3 years ago

async in wasm is not as bad as it seems. You can convert to/from promises relatively easily. To be honest, my approach would be to ensure that the wasm32-unknown-unknown target compiles, but not provide any official wasm interface. That gives people the option to use it, with very little work up front

gakonst commented 3 years ago

Agreed, exactly what I meant above