Open Hamzaelkhatri opened 2 years ago
When I run the solution and test without inserting any param in JsonRpcProvider -> localhost:8545 , I got this message :
JsonRpcProvider
Error: missing response (...) ... { reason: 'missing response', code: 'SERVER_ERROR', requestBody: '{"method":"eth_accounts","params":[],"id":42,"jsonrpc":"2.0"}', requestMethod: 'POST', serverError: Error: connect ECONNREFUSED ::1:8545 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1237:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 8545 }, url: 'http://localhost:8545' }
but I added 127.0.0.1 in the JsonRpcProvider params, and everything works as expected
127.0.0.1
async function getAccount() { const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); const accounts = await provider.listAccounts(); console.log(accounts[0]) return accounts[0] }
When I run the solution and test without inserting any param in
JsonRpcProvider
-> localhost:8545 , I got this message :but I added
127.0.0.1
in the JsonRpcProvider params, and everything works as expected