Skip to content

core: eth_signTypedData_v4 is not compliant w/ EIP1193 #1444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
PierreJeanjacquot opened this issue Mar 13, 2025 · 2 comments · May be fixed by #1445
Open

core: eth_signTypedData_v4 is not compliant w/ EIP1193 #1444

PierreJeanjacquot opened this issue Mar 13, 2025 · 2 comments · May be fixed by #1445
Labels
bug Something isn't working

Comments

@PierreJeanjacquot
Copy link
Contributor

Thanks for filling out this bug report. Please provide as much detail as possible.

If your issue is with our RPC APIs and not the SDK please report your issue on (discord)[https://alchemy.com/discord].

[REQUIRED] Environment

  • Browser version: nodejs
  • AA SDK version: @aa-sdk/[email protected]
  • Package: @aa-sdk/core

[REQUIRED] Describe the problem

The client request method does not handle the RPC method eth_signTypedData_v4 like other providers (see metamask example)

Calling request with the expected personal_sign signature throws an error

request({ 
  method: "eth_signTypedData_v4",
  params: [address, JSON.stringify(typedDataObject)]
})

How to reproduce:

Run this script with appropriate env to request an eth_signTypedData_v4 of typed data (typed data example inspired from metamask)

import { LocalAccountSigner } from "@aa-sdk/core";
import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
import { alchemy, arbitrumSepolia } from "@account-kit/infra";

const { PRIVATE_KEY, ALCHEMY_API_KEY, ALCHEMY_POLICY_ID } = process.env;

const client = await createLightAccountAlchemyClient({
  transport: alchemy({ apiKey: ALCHEMY_API_KEY }),
  chain: arbitrumSepolia,
  signer: LocalAccountSigner.privateKeyToAccountSigner(PRIVATE_KEY),
  policyId: ALCHEMY_POLICY_ID,
});
console.log("client.account.address", client.account.address);

const typedData = {
  domain: {
    chainId: arbitrumSepolia.id,
    name: "Ether Mail",
    verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
    version: "1",
  },
  message: {
    contents: "Hello, Bob!",
    from: {
      name: "Cow",
      wallets: [
        "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
        "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF",
      ],
    },
    to: [
      {
        name: "Bob",
        wallets: [
          "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
          "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57",
          "0xB0B0b0b0b0b0B000000000000000000000000000",
        ],
      },
    ],
  },
  primaryType: "Mail",
  types: {
    EIP712Domain: [
      { name: "name", type: "string" },
      { name: "version", type: "string" },
      { name: "chainId", type: "uint256" },
      { name: "verifyingContract", type: "address" },
    ],
    Mail: [
      { name: "from", type: "Person" },
      { name: "to", type: "Person[]" },
      { name: "contents", type: "string" },
    ],
    Person: [
      { name: "name", type: "string" },
      { name: "wallets", type: "address[]" },
    ],
  },
};

// this will throw
const sign = await client.request({
  method: "eth_signTypedData_v4",
  params: [client.account.address, JSON.stringify(typedData)],
});

console.log("sign", sign);

You will get the following error

UnknownRpcError: An unknown RPC error occurred.

Details: Cannot read properties of undefined (reading 'domain')
Version: [email protected]

Relevant code or sample repro:

@PierreJeanjacquot PierreJeanjacquot added the bug Something isn't working label Mar 13, 2025
@PierreJeanjacquot PierreJeanjacquot changed the title core: eth_signTypedData_v4 is not complient w/ EIP1193 core: eth_signTypedData_v4 is not compliant w/ EIP1193 Mar 13, 2025
@lippytm
Copy link

lippytm commented Apr 2, 2025

Same issues

@lippytm
Copy link

lippytm commented Apr 2, 2025

Please Solve this issue

PierreJeanjacquot added a commit to PierreJeanjacquot/aa-sdk that referenced this issue Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants