cargo install w3kit
to build the library from this GitHub repository you can run:
make build
note that all cargo commands relevant to this work are encoded in the Makefile
.
create an .env
file:
cp .env.example .env
vim .env
then add the config for the desired chain:
PROVIDER_URL_WS=
PROVIDER_URL_HTTP=
```
w3kit http -b ethereum
✅ connecting to "ethereum"
✅ current block: 16572583
```
```
w3kit ws -b ethereum
✅ connecting to "ethereum" ✅ current block: 16572598 ```
```
w3kit account -b ethereum -a 0xbA4C081942E6a25cAF87c5489B91b449c67f3078
✅ connecting to "ethereum" ✅ fetching account info: "0xbA4C081942E6a25cAF87c5489B91b449c67f3078" ✅ retrieving balances... 💰 account 0xba4c081942e6a25caf87c5489b91b449c67f3078 👉 0.0672775267238201 ETH ```
```
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}} ```
```
w3kit http -b arbitrum ```
```
w3kit ws -b arbitrum ```
```
w3kit account -b arbitrum -a
```
```
w3kit http -b avalanche ```
```
w3kit ws -b avalanche ```
```
w3kit account -b avalanche -a
```
```
w3kit http -b near ```
```
w3kit ws -b near ```
```
w3kit account -b near -a
```
```
w3kit http -b optimism ```
```
w3kit ws -b optimism ```
```
w3kit account -b optimism -a
```
```
w3kit http -b polygon ```
```
w3kit ws -b polygon ```
```
w3kit account -b polygon -a
```
```
w3kit http -b solana -a ```
```
w3kit ws -b solana -a ```
```
w3kit account -b solana -a
```