JsonRpcProvider returns empty response #4450
-
Ethers Version6.8.0 Search TermsNo response Describe the ProblemI want to create tests and check if provider contains _isProvider true but getting an empty response. Code Snippetconst { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider("https://eth.llamarpc.com");
console.log(provider); Contract ABINo response ErrorsNo response EnvironmentNo response Environment (Other)No response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The result isn’t empty. It depends on your environment and its implementation of So, any of the values defined by getters are present, but they are not enumerated by This is because a getter can have side-effects, and no one wants console.log to mutate the state of an object. I also believe, Make sense? |
Beta Was this translation helpful? Give feedback.
The result isn’t empty. It depends on your environment and its implementation of
console.log
.So, any of the values defined by getters are present, but they are not enumerated by
console.log
(in node.js; generally the interactivelog
in a web browser is far more attentive).This is because a getter can have side-effects, and no one wants console.log to mutate the state of an object.
I also believe,
_isProvider
is no longer a property in v6. Instead, the focus is on capability-checking; e.g. if an object has aestimateGas
function then it will be used during ContractRunner. As a result method signatures have been adjusted to make sure the arguments and return types are shared across possib…