Cargo Features

[dependencies]
web3 = { version = "0.19.0", default-features = false, features = ["wasm", "eip-1193", "http", "http-tls", "http-native-tls", "http-rustls-tls", "signing", "ws-tokio", "ws-async-std", "ws-tls-tokio", "ws-tls-async-std", "ipc-tokio", "arbitrary_precision", "test"] }
default = http-tls, ipc-tokio, signing, ws-tls-tokio

These default features are set whenever web3 is added without default-features = false somewhere in the dependency tree.

wasm eip-1193? = getrandom, js-sys, rand, serde-wasm-bindgen, wasm-bindgen, wasm-bindgen-futures

Enables wasm-bindgen of futures-timer

eip-1193 = wasm

Affects transports::eip_1193

http http-native-tls? http-rustls-tls? http-tls = base64, bytes, headers, reqwest, url

Affects transports::http

http-tls default = http

Enables default-tls of reqwest ^0.11

reqwest:

Note: this doesn't enable the 'native-tls' feature, which adds specific functionality for it.

http-native-tls = http

Enables native-tls of reqwest ^0.11

reqwest:

Enables native-tls specific functionality not available by default.

http-rustls-tls = http

Enables rustls-tls of reqwest ^0.11

signing default = once_cell, secp256k1
ws-tokio ws-tls-tokio = headers, soketto, tokio, tokio-util, url

Affects ws::compat, transports::ws

ws-async-std ws-tls-async-std? = async-std, headers, soketto, url

Affects ws::compat, transports::ws

ws-tls-tokio default = async-native-tls, ws-tokio

Enables runtime-tokio of web3-async-native-tls

Temporarily use forked version released to crates.io

Affects ws::compat.TlsStream

ws-tls-async-std = async-native-tls, ws-async-std

Enables runtime-async-std of web3-async-native-tls

Affects ws::compat.TlsStream

ipc-tokio default = tokio, tokio-stream, tokio-util

Affects transports::ipc

arbitrary_precision

Enables arbitrary_precision of jsonrpc-core and serde_json

serde_json:

Use an arbitrary precision number representation for serde_json::Number. This allows JSON numbers of arbitrary size/precision to be read into a Number and written back to a JSON string without loss of precision.

Unlike float_roundtrip, this feature makes JSON -> serde_json::Number -> JSON produce output identical to the input.

allow-missing-fields test

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

secp256k1 signing

Enables secp256k1 ^0.27

Optional deps

once_cell signing
base64 http?

Enables base64 ^0.21

HTTP

bytes http?
reqwest http? http-native-tls? http-rustls-tls? http-tls

Enables reqwest ^0.11

headers http? ws-async-std? ws-tokio?

Enables headers ^0.3

async-native-tls ws-tls-async-std? ws-tls-tokio

Enables web3-async-native-tls

async-std ws-async-std?
tokio ipc-tokio ws-tokio?
tokio-stream ipc-tokio
tokio-util ipc-tokio ws-tokio?
soketto ws-async-std? ws-tokio?

Enables soketto ^0.7.0

url http? ws-async-std? ws-tokio?

Enables url

Shared (WS, HTTP)

js-sys wasm?

Enables js-sys

EIP-1193

getrandom wasm?

Enables getrandom

This is a transitive dependency, only here so we can turn on its wasm_bindgen feature

rand wasm?
serde-wasm-bindgen wasm?

Enables serde-wasm-bindgen ^0.5.0

wasm-bindgen wasm?
wasm-bindgen-futures wasm?