Description of the issue:
I’m using ethers v5.7.2 to send request eth_signTypedData_v4 to request message sign to connected wallet
Here is the code I’ve been using for requesting this signature
import { Web3Provider } from '@ethersproject/providers'
const typedData = {
types: {
'Hubble Exchange': [
{ name: 'action', type: 'string' },
{ name: 'notice', type: 'string' },
{ name: 'chainId', type: 'string' },
{ name: 'nonce', type: 'int' },
],
},
domain: { name: 'Hubble Exchange', version: 'v2', chainId: 1 },
primaryType: 'Hubble Exchange',
message: {
action: 'Hey sign this message',
notice: 'Only sign this on example.com',
chainId: '1',
nonce: 0,
},
}
const signer = (new Web3Provider(window.ethereum)).getSigner()
const signature = await signer._signTypedData(
typedData.domain,
typedData.types,
typedData.message
)
Here is the error I get from brave wallet
{code: 4200, message: 'A generic request processing error has occurred'}
For reference ethersjs sends eth_signTypedData_v4 request
async _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string> {
// Populate any ENS names (in-place)
const populated = await _TypedDataEncoder.resolveNames(domain, types, value, (name: string) => {
return this.provider.resolveName(name);
});
const address = await this.getAddress();
try {
return await this.provider.send("eth_signTypedData_v4", [
address.toLowerCase(),
JSON.stringify(_TypedDataEncoder.getPayload(populated.domain, types, populated.value))
]);
} catch (error) {
if (typeof(error.message) === "string" && error.message.match(/user denied/i)) {
logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, {
action: "_signTypedData",
from: address,
message: { domain: populated.domain, types, value: populated.value }
});
}
throw error;
}
}
Is the issue occurring on a specific network?
no
What operating system are you using?
MacOS
Brave Version (check About Brave):
Version 1.61.104 Chromium: 120.0.6099.115 (Official Build) (arm64)
Additional Information: