alloy-rs / alloy

Transports, Middleware, and Networks for the Alloy project
https://alloy.rs
Apache License 2.0
543 stars 186 forks source link

[Bug] wasm erc20 token transfer not working #1095

Open skutcher opened 1 month ago

skutcher commented 1 month ago

Component

contract, transports

What version of Alloy are you on?

├── alloy v0.2.0 │ ├── alloy-contract v0.2.0 │ │ ├── alloy-dyn-abi v0.7.7 │ │ │ ├── alloy-json-abi v0.7.7 │ │ │ │ ├── alloy-primitives v0.7.7 │ │ │ │ │ ├── alloy-rlp v0.3.7 │ │ │ │ │ │ ├── alloy-rlp-derive v0.3.7 (proc-macro) │ │ │ │ │ │ ├── alloy-rlp v0.3.7 () │ │ │ │ ├── alloy-sol-type-parser v0.7.7 │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ ├── alloy-sol-type-parser v0.7.7 () │ │ │ ├── alloy-sol-types v0.7.7 │ │ │ │ ├── alloy-json-abi v0.7.7 () │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ │ ├── alloy-sol-macro v0.7.7 (proc-macro) │ │ │ │ │ ├── alloy-sol-macro-expander v0.7.7 │ │ │ │ │ │ ├── alloy-json-abi v0.7.7 │ │ │ │ │ │ │ ├── alloy-primitives v0.7.7 │ │ │ │ │ │ │ ├── alloy-sol-type-parser v0.7.7 │ │ │ │ │ │ ├── alloy-sol-macro-input v0.7.7 │ │ │ │ │ │ │ ├── alloy-json-abi v0.7.7 () │ │ │ │ │ ├── alloy-sol-macro-input v0.7.7 () │ │ ├── alloy-json-abi v0.7.7 () │ │ ├── alloy-network v0.2.0 │ │ │ ├── alloy-consensus v0.2.0 │ │ │ │ ├── alloy-eips v0.2.0 │ │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ │ │ ├── alloy-rlp v0.3.7 () │ │ │ │ │ ├── alloy-serde v0.2.0 │ │ │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ │ ├── alloy-rlp v0.3.7 () │ │ │ │ ├── alloy-serde v0.2.0 () │ │ │ ├── alloy-eips v0.2.0 () │ │ │ ├── alloy-json-rpc v0.2.0 │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ ├── alloy-rpc-types-eth v0.2.0 │ │ │ │ ├── alloy-consensus v0.2.0 () │ │ │ │ ├── alloy-eips v0.2.0 () │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ │ ├── alloy-rlp v0.3.7 () │ │ │ │ ├── alloy-serde v0.2.0 () │ │ │ │ ├── alloy-sol-types v0.7.7 () │ │ │ ├── alloy-serde v0.2.0 () │ │ │ ├── alloy-signer v0.2.0 │ │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ ├── alloy-sol-types v0.7.7 () │ │ ├── alloy-primitives v0.7.7 () │ │ ├── alloy-provider v0.2.0 │ │ │ ├── alloy-chains v0.1.23 │ │ │ ├── alloy-consensus v0.2.0 () │ │ │ ├── alloy-eips v0.2.0 () │ │ │ ├── alloy-json-rpc v0.2.0 () │ │ │ ├── alloy-network v0.2.0 () │ │ │ ├── alloy-primitives v0.7.7 () │ │ │ ├── alloy-rpc-client v0.2.0 │ │ │ │ ├── alloy-json-rpc v0.2.0 () │ │ │ │ ├── alloy-transport v0.2.0 │ │ │ │ │ ├── alloy-json-rpc v0.2.0 () │ │ │ │ ├── alloy-transport-http v0.2.0 │ │ │ │ │ ├── alloy-json-rpc v0.2.0 () │ │ │ │ │ ├── alloy-transport v0.2.0 () │ │ │ ├── alloy-rpc-types-eth v0.2.0 () │ │ │ ├── alloy-transport v0.2.0 () │ │ │ ├── alloy-transport-http v0.2.0 () │ │ ├── alloy-rpc-types-eth v0.2.0 () │ │ ├── alloy-sol-types v0.7.7 () │ │ ├── alloy-transport v0.2.0 () │ ├── alloy-core v0.7.7 │ │ ├── alloy-dyn-abi v0.7.7 () │ │ ├── alloy-json-abi v0.7.7 () │ │ ├── alloy-primitives v0.7.7 () │ │ └── alloy-sol-types v0.7.7 () │ ├── alloy-eips v0.2.0 () │ ├── alloy-provider v0.2.0 () │ └── alloy-rpc-client v0.2.0 (*)

Operating System

Linux

Describe the bug

I try todo an erc20 token transfer with target wasm32-unknown-unknown. contract total supply as well as contract balance of works perfect. but as soon as i call contract.transfer("to_adress", "token_amount).from("my_address").send().await

i got the following error message in the browser console:

panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alloy-transport-0.2.0/src/utils.rs:56:9:
The 'wasm-bindgen' feature must be enabled

I have already added wasm bindgen to the future list in my Cargo.toml, but this changed nothing:

alloy = { version = "0.2", features = ["providers", "sol-types", "json", "contract", "wasm-bindgen"] }

DaniPopes commented 1 month ago

Can you try enabling "transports" feature too?

skutcher commented 1 month ago

Can you try enabling "transports" feature too?

sure than i got this at exactly the same line within the code

panicked at library/std/src/sys/pal/wasm/../unsupported/time.rs:13:9:
time not implemented on this platform