txpool-explorer
v1.9.2
Published
Transaction pool explorer
Downloads
17
Readme
txpool-explorer
Nodejs Ethereum transactions pool explorer.
Installation
Install txpool-explorer with npm
npm install txpool-explorer
Before Starting
Make sure to whitelist the txpool namespace as described in the Official Go implementation of the Ethereum protocol .
geth --ws --ws.api eth,net,web3,txpool
Getting Started
import TxpoolExplorer, { Transaction } from "txpool-explorer";
const host : string = 'http://127.0.0.1:8546' // Provider Websocket Endpoint
const explorer = new TxpoolExplorer({ host });
API Reference
Get Transaction Pool Content :
console.log(await explorer.getPoolContent());
Returns :
Promise<{pending:Transaction[];queued:Transaction[];}>
Subscribe to the transactions pool updates :
let pool: "pending" | "queued" = "pending";
let filter = (transaction: Transaction) => transaction.to == "0x7D0556D55ca1a92708681e2e231733EBd922597D";
explorer.watch({ pool, filter }, (transactions: Transaction[]) => {
console.log(transactions);
});
Parameters
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| pool
| string
| Required. "pending" or "queued" |
| filter
| (transaction: Transaction) => boolean
| Optional. Filter callback called with the argument transaction of type Transaction
|