Minimal (< 1 Kb), dependency-free and flexible JSON-RPC client library for Ethereum.
The goal is to make it easy to work with RPC endpoints.
This library uses JavaScript Proxy object to allow arbitrary prototype method calls, the API offers an intuitive translation to the raw RPC methods, where eth_getLogs
becomes eth.getLogs()
, and so on.
$ npm i --save-dev anix-js
main.mjs:
import {Anix} from 'anix-js'
const eth = new Anix('eth', <YOUR HTTP RPC ENDPOINT>)
console.dir(await eth.getBlockByNumber('latest', false))
$ node main.mjs
- or -
$ bun run main.mjs
import {Anix} from 'anix-js'
const eth = new Anix('eth', <YOUR HTTP RPC ENDPOINT>)
await eth.sendBundle({…})
Anix has a built-in REPL script, making it easy to prototype.
$ npx anix-js http://my-rpc-url.xyz
♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦
♦ ♦ ♦ ♦ Welcome to Anix ♦ ♦ ♦ ♦
♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦
Anix > await eth.blockNumber()
'0x12705de'
- Works with any set of custom RPC methods, because of its native proxy object.
- It resembles the Geth console JavaScript APIs.
- It's incredibly portable, with a minimal footprint (less than 1kb minified).
- It uses the native
fetch
method, implemented on top of Undici. - No dependencies attached: Anix is not prone to supply-chain attacks.
Check the examples directory for boilerplate code.
Ping me on twitter.