## 🕹 w3kit: a web3 toolkit in rust
### tl;dr ##### 🛠 **[this package](https://github.com/go-outside-labs/web3-toolkit-rs/tree/main/w3kit)** contains an ongoing crate with a set of scripts for several blockchains (check it at **[crates.io](https://crates.io/crates/w3kit)**). ##### 📚 for a fun in-depth reading about rust, check my mirror post [w3kit: a web3 toolkit in rust](). ##### 💡 for a rusty boilerplate for running stat searchers, check **[coingator](https://github.com/go-outside-labs/searcher-coingator-rs)**.



--- ### installation
#### as a package
``` cargo install w3kit ```
#### for development
to build the library from this [GitHub repository](https://github.com/go-outside-labs/web3-toolkit-rs/tree/main/w3kit) you can run: ``` make build ```
note that all [cargo](https://doc.rust-lang.org/cargo/) commands relevant to this work are encoded in the `Makefile`.
#### setup
create an `.env` file: ``` cp .env.example .env vim .env ``` then add the config for the desired chain: ``` PROVIDER_URL_WS= PROVIDER_URL_HTTP= ```
---- ### ethereum
#### connection to the chain
###### through an http connection: ``` > w3kit http -b ethereum ✅ connecting to "ethereum" ✅ current block: 16572583 ```
###### through a websocket connection: ``` > w3kit ws -b ethereum ✅ connecting to "ethereum" ✅ current block: 16572598 ```
#### retrieving an account data ``` > w3kit account -b ethereum -a 0xbA4C081942E6a25cAF87c5489B91b449c67f3078 ✅ connecting to "ethereum" ✅ fetching account info: "0xbA4C081942E6a25cAF87c5489B91b449c67f3078" ✅ retrieving balances... 💰 account 0xba4c081942e6a25caf87c5489b91b449c67f3078 👉 0.0672775267238201 ETH ```
#### retrieving a coin price ``` > w3kit coin ethereum ✅ fetching coin info: "ethereum" ✅ fetching price for ethereum in usd ✅ GET https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd 💰 ethereum price 👉 {"ethereum":{"usd":1623.04}} ```
--- ### arbitrum
#### connection to the chain
###### through an http connection: ``` > w3kit http -b arbitrum ```
###### through a websocket connection: ``` > w3kit ws -b arbitrum ```
#### retrieving an account data ``` > w3kit account -b arbitrum -a ```
--- ### avalanche
#### connection to the chain
###### through an http connection: ``` > w3kit http -b avalanche ```
###### through a websocket connection: ``` > w3kit ws -b avalanche ```
#### retrieving an account data ``` > w3kit account -b avalanche -a ```
--- ### near
#### connection to the chain
###### through an http connection: ``` > w3kit http -b near ```
###### through a websocket connection: ``` > w3kit ws -b near ```
#### retrieving an account data ``` > w3kit account -b near -a ```
--- ### optimism
#### connection to the chain
###### through an http connection: ``` > w3kit http -b optimism ```
###### through a websocket connection: ``` > w3kit ws -b optimism ```
#### retrieving an account data ``` > w3kit account -b optimism -a ```
--- ### polygon
#### connection to the chain
###### through an http connection: ``` > w3kit http -b polygon ```
###### through a websocket connection: ``` > w3kit ws -b polygon ```
#### retrieving an account data ``` > w3kit account -b polygon -a ```
--- ### solana
#### connection to the chain
###### through an http connection: ``` > w3kit http -b solana -a ```
###### through a websocket connection: ``` > w3kit ws -b solana -a ```
#### retrieving an account data ``` > w3kit account -b solana -a ```