Skip to content
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

Add EIP-1193 support #414

Merged
merged 14 commits into from
Dec 7, 2020
Merged
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ before_script:
- if [[ "${TRAVIS_RUST_VERSION}" == stable ]]; then
rustup component add rustfmt && cargo install cargo-deny;
fi
- rustup target add wasm32-unknown-unknown

script:
- if [[ "${TRAVIS_RUST_VERSION}" == "stable" ]]; then
Expand All @@ -42,6 +43,7 @@ script:
- cargo build
- cargo test
- cargo check --no-default-features
- cargo check --target wasm32-unknown-unknown --no-default-features --features eip-1193
- cargo check --no-default-features --features http
- cargo check --no-default-features --features http-tls
- cargo check --no-default-features --features ws-tokio
Expand Down
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ log = "0.4.6"
parking_lot = "0.11.0"
rlp = "0.4"
rustc-hex = "2.1.0"
secp256k1 = { version = "0.19", features = ["recovery"] }
secp256k1 = { version = "0.19", features = ["recovery"], optional = true }
serde = { version = "1.0.90", features = ["derive"] }
serde_json = "1.0.39"
tiny-keccak = { version = "2.0.1", features = ["keccak"] }
Expand All @@ -44,16 +44,24 @@ soketto = { version = "0.4.1", optional = true }
## Shared (WS, HTTP)
native-tls = { version = "0.2", optional = true }
url = { version = "2.1", optional = true }
## EIP-1193
js-sys = { version = "0.3.45", optional = true }
### This is a transitive dependency, only here so we can turn on its wasm_bindgen feature
rand = { version = "0.7.3", optional = true }
wasm-bindgen = { version = "0.2.68", optional = true, features = ["serde-serialize"] }
wasm-bindgen-futures = { version = "0.4.18", optional = true }

[dev-dependencies]
# For examples
env_logger = "0.8"
tokio = { version = "0.2", features = ["full"] }

[features]
default = ["http-tls", "ws-tls-tokio"]
default = ["http-tls", "signing", "ws-tls-tokio"]
eip-1193 = ["js-sys", "wasm-bindgen", "wasm-bindgen-futures", "futures-timer/wasm-bindgen", "rand/wasm-bindgen"]
http = ["hyper", "hyper-proxy", "url", "base64", "typed-headers"]
http-tls = ["hyper-tls", "native-tls", "http"]
signing = ["secp256k1"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of disabling signing capabilities in JS it's actually possible to use libsecpk256k1 which compiles to WASM. See how it's done in ethsign. That said, it might be pretty involved and would rather review that separately in a follow up PR, so we can just create an issue for now.

ws-tokio = ["soketto", "url", "tokio", "tokio-util"]
ws-async-std = ["soketto", "url", "async-std"]
ws-tls-tokio = ["async-native-tls", "native-tls", "async-native-tls/runtime-tokio", "ws-tokio"]
Expand Down
Loading