provider as 'undefined' when using JsonRpcProvider #2746
Unanswered
ritheshNFT
asked this question in
Q&A
Replies: 1 comment
-
Just few JS things:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here is the snippet of my code :
const url = "https://eth-ropsten.alchemyapi.io/v2/****";
const provider = new ethers.providers.JsonRpcProvider(url);
console.log('Provider - '+provider);
console.log('Provider add - '+provider.getaddress);
Both logs showing as 'undefined'
When I add below log :
const signer = provider.getSigner();
console.log('signer val - '+signer);
I am getting whole function as output
"function () { var _this = this; if (this._address) { return Promise.resolve(this._address); } return this.provider.send("eth_accounts", []).then(function (accounts) { if (accounts.length <= _this._index) { logger.throwError("unknown account #" + _this._index, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getAddress" }); } return _this.provider.formatter.address(accounts[_this._index]); }); }"
Please let me know if I am doing something wrong. I can confirm that Alchemy api is getting hits but provider is setting as undefined.
Beta Was this translation helpful? Give feedback.
All reactions