Sign structured data according to the EIP-712 standard, which provides a more readable and secure signing experience for users.
Wagmi is not available on React Native. Use Ethers.js or Viem for EVM operations.
Sign Typed Data
import { ethers } from "ethers";
async function signTypedData(
signer: ethers.Signer,
domain: any,
types: any,
value: any
) {
const signature = await signer.signTypedData(domain, types, value);
console.log("Signature:", signature);
return signature;
}
async function signTypedData(
walletClient: any,
account: any,
domain: any,
types: any,
primaryType: string,
message: any
) {
const signature = await walletClient.signTypedData({
account,
domain,
types,
primaryType,
message,
});
console.log("Signature:", signature);
return signature;
}
Next Steps