1.1.0 โข Published 4 months ago
client-blockchain-rpc v1.1.0
๐ 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.