1.1.0 โ€ข Published 4 months ago

client-blockchain-rpc v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

๐Ÿ“– Description :

This very light package was created for those of you who want to interact directly with the EVM, SOLANA, and other blockchain.

  • support network http
  • support network websocket
  • support network ipc

๐Ÿ’ป Step to install :

npm install client-blockchain-rpc

โœ๏ธ Example :

import { provider } from "client-blockchain-rpc";
const init = provider({
  urlRpc: "https://bscrpc.com",
});

Usage

const { provider } = require("..");

const init = provider({
  urlRpc: "https://bscrpc.com",
});

(async () => {
  // single request
  const chainId = await init.send({
    method: "eth_chainId",
    params: [],
    formatReturn: parseInt,
  });

  // batch request
  const resBatch = await init.sendBatch([
    {
      method: "eth_chainId",
      params: [],
      formatReturn: BigInt,
    },
    {
      method: "eth_gasPrice",
      params: [],
      formatReturn: BigInt,
    },
  ]);
})();

full example see here

๐Ÿงพ Pre-Requisistes :

node.js >= 18

๐Ÿ“ License :

Licensed under the MIT License.