eth_newPendingTransactionFilter
Creates a filter on Moonriver to notify when new pending transactions arrive.
Parameters#
This method accepts no parameters.
Request#
{
"jsonrpc": "2.0",
"method": "eth_newPendingTransactionFilter",
"params": [],
"id": 1
}
Returns#
| Type | Description |
|---|---|
QUANTITY | Filter ID |
Code Examples#
- cURL
- JavaScript
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_newPendingTransactionFilter",
"params": [],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('');
const filterId = await provider.send('eth_newPendingTransactionFilter', []);
// Poll for pending transactions
const pendingTxs = await provider.send('eth_getFilterChanges', [filterId]);
console.log('Pending transaction hashes:', pendingTxs);
Related Methods#
eth_getFilterChanges- Poll filtereth_getTransactionByHash- Get transaction details