ethers.js
ethers.js copied to clipboard
signer.signTypedData require a provider
Ethers Version
6.9
Search Terms
signer.signTypedData blaming ENS provider when value don't match type definition
Describe the Problem
signer.signTypedData crash says to resolve ENS/that it doesn't have a valid provider.
The ENS resolver is innocent here, as well as not providing a provider in new ethers.Wallet, it's the generic trycatch wrapping the rest of signTypedData internal functions that hide the type issue.
Code Snippet
domain = {
name: 'TestName',
version: '1',
};
types = {
WhitelistSignature: [
{ type: 'uint256', name: 'bidAmount' },
],
};
value = {
bidAmountWithATypo: "abcedf"
};
signer = await new ethers.Wallet("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80");
signedHash = await signer.signTypedData(domain, types, value);
Contract ABI
No response
Errors
the error message is the error, leading people on a wild gosse chase
Environment
any
Environment (Other)
any
Can you include the error?
hi, this is also happening to me. the error is this
Error: network does not support ENS (operation="getResolver", network="unknown", code=UNSUPPORTED_OPERATION, version=providers/5.7.2)
at Logger.makeError (/Users/jblanchette/code/offline-payment-util/node_modules/@ethersproject/logger/lib/index.js:238:21)
at Logger.throwError (/Users/jblanchette/code/offline-payment-util/node_modules/@ethersproject/logger/lib/index.js:247:20)
at JsonRpcProvider.<anonymous> (/Users/jblanchette/code/offline-payment-util/node_modules/@ethersproject/providers/lib/base-provider.js:2315:36)
at step (/Users/jblanchette/code/offline-payment-util/node_modules/@ethersproject/providers/lib/base-provider.js:48:23)
at Object.next (/Users/jblanchette/code/offline-payment-util/node_modules/@ethersproject/providers/lib/base-provider.js:29:53)
at fulfilled (/Users/jblanchette/code/offline-payment-util/node_modules/@ethersproject/providers/lib/base-provider.js:20:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
reason: 'network does not support ENS',
code: 'UNSUPPORTED_OPERATION',
operation: 'getResolver',
network: 'unknown'
}
It also happens to me
That means you are using an address (in the payload or the domain) that isn’t an address, so it is assuming it is an ENS name. Check all your values you are passing in; often this happens when there is a dotenv misconfigured or another source of data isn’t getting loaded correctly…
I just realized you are using v5.7.2, not v6.9. If you use v6, it will include the value of the name trying to be resolved, which might help diagnose the issue.