npm-package-near-intelligent-block
v1.0.0
Published
npm Package - near-intelligent-block
Downloads
148
Readme
npm-package-near-intelligent-block
Fetch and analyse NEAR Protocol blocks, transactions, gas prices, and account keys via the NEAR RPC.
Installation
npm install npm-package-near-intelligent-block
Functions
getBlock(blockId)— Fetch a block by height or finalitygetBlockTransactions(blockHeight)— Fetch all transactions for a blockgetGasPrice()— Get the current gas priceanalyseBlock(blockId)— Analyse a block and return summary insightsgetAccountKeys(accountId)— Retrieve access keys for an account
Usage
import { getBlock, getBlockTransactions, getGasPrice, analyseBlock, getAccountKeys, } from 'npm-package-near-intelligent-block';
// Fetch a block by height const block = await getBlock(12345678);
// Fetch the latest block (optimistic finality) const latest = await getBlock('latest');
// Fetch the final block const final = await getBlock('final');
// Get all transactions in a block const transactions = await getBlockTransactions(12345678);
// Get the current gas price const gasPrice = await getGasPrice();
// Analyse a block const analysis = await analyseBlock(12345678);
// Get access keys for a NEAR account const keys = await getAccountKeys('example.near');
Requirements
- Node.js 18+
near-api-jspeer dependency
License
MIT
