const fetch = require('node-fetch'); // Set up the Polygon JSON-RPC endpoint URL const rpcEndpoint = 'https://rpc-mainnet.maticvigil.com/'; // Set up the JSON-RPC request to retrieve pending transactions const requestBody = { jsonrpc: '2.0', method: 'eth_pendingTransactions', params: [], id: 1 }; // Send the JSON-RPC request to the endpoint fetch(rpcEndpoint, { method: 'POST', body: JSON.stringify(requestBody), headers: { 'Content-Type': 'application/json' } }) .then(response => response.json()) .then(data => { // Handle the response data console.log(data.result); }) .catch(error => { // Handle errors console.error(error); });