foundry-rpc
Version:
A thin wrapper of Foundry RPC
37 lines (23 loc) • 827 B
Markdown
Foundry RPC JS is a JavaScript library that calls RPC to a Foundry node.
If you are using NPM, use the command below:
```
npm install foundry-rpc --save
```
If you prefer Yarn, use the command below:
```
yarn add foundry-rpc
```
```
const RPC = require("foundry-rpc").default;
async function main() {
const rpc = new RPC("http://localhost:8080");
const blockNumber = await rpc.chain.getBestBlockNumber();
console.log(`Current best block number: ${blockNumber}`);
}
main().catch(console.error);
```
You can find the RPC list in [this link](https://github.com/CodeChain-io/codechain/blob/master/spec/JSON-RPC.md).