You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using version=6.13.4 of ethers.js and when I call the getNonce() function it tells me I need to give a provider.
It was my understanding that if I supply the private key, I do not need to supply a provider considering this is running on a back-end server.
This is the code
import { ethers } from "ethers";
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!);
const nonce = await wallet.getNonce();
and this is the errror:
Error: missing provider (operation="getTransactionCount", code=UNSUPPORTED_OPERATION, version=6.13.4)
at makeError (.../node_modules/ethers/src.ts/utils/errors.ts:694:21)
at assert (...//node_modules/ethers/src.ts/utils/errors.ts:715:25)
at checkProvider (.../node_modules/ethers/src.ts/providers/abstract-signer.ts:28:5)
at _Wallet.getNonce (.../node_modules/ethers/src.ts/providers/abstract-signer.ts:87:16)
at run (...myFunction.ts:37:34)
getTransactionCount is the old function from v5 that has been wrapped with getNonce I believe?
Should this just work with the private key or did my misunderstand the documentation
Code Snippet
import { ethers } from "ethers";
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!);
const nonce = await wallet.getNonce();
Contract ABI
No response
Errors
Error: missing provider (operation="getTransactionCount", code=UNSUPPORTED_OPERATION, version=6.13.4)
at makeError (.../node_modules/ethers/src.ts/utils/errors.ts:694:21)
at assert (...//node_modules/ethers/src.ts/utils/errors.ts:715:25)
at checkProvider (.../node_modules/ethers/src.ts/providers/abstract-signer.ts:28:5)
at _Wallet.getNonce (.../node_modules/ethers/src.ts/providers/abstract-signer.ts:87:16)
at run (...myFunction.ts:37:34)
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered:
Ah it seems like this is not a real issue.
Re-reading the docs for v6, it is not possible to get a nonce without a provider.
Not a bug, just confusion between reading different doc versions
Ethers Version
6.13.4
Search Terms
getNonce
Describe the Problem
I am using version=6.13.4 of ethers.js and when I call the getNonce() function it tells me I need to give a provider.
It was my understanding that if I supply the private key, I do not need to supply a provider considering this is running on a back-end server.
This is the code
and this is the errror:
getTransactionCount is the old function from v5 that has been wrapped with getNonce I believe?
Should this just work with the private key or did my misunderstand the documentation
Code Snippet
Contract ABI
No response
Errors
Error: missing provider (operation="getTransactionCount", code=UNSUPPORTED_OPERATION, version=6.13.4) at makeError (.../node_modules/ethers/src.ts/utils/errors.ts:694:21) at assert (...//node_modules/ethers/src.ts/utils/errors.ts:715:25) at checkProvider (.../node_modules/ethers/src.ts/providers/abstract-signer.ts:28:5) at _Wallet.getNonce (.../node_modules/ethers/src.ts/providers/abstract-signer.ts:87:16) at run (...myFunction.ts:37:34)
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: