# \[Archive\] Sign Typed Data v4 error

**URL:** <https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [May 12, 2024, 11:05am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337 "2024-05-12T11:05:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![betnow](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/betnow/32/14_2.png) [@betnow](https://builder.metamask.io/u/betnow)\
**Post date:** [May 12, 2024, 11:05am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/1 "2024-05-12T11:05:08Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **betnow** on 5/12/2024.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

v 6.1.8  
react 18

[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/9406d493e4a0422478d610a4e13a1553caf4a2a2.png)
image1220×195 8 KB
](https://web3auth.io/community/uploads/default/original/2X/1/1a4ed04d5b2467d3376355d9c493dd178240a12f.png "image")

Getting error when using Sign Typed Data v4 method

 ![](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/4bea15d5fdfd372b2e7fae21263c61fab3da9379.png)

```
  <a href="https://web3auth.io/docs/connect-blockchain/evm/polygon/web#sign-typed-data-v4" target="_blank" rel="noopener">Web3Auth</a>

```

 ![](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/43ef7d724b088477b1d5eb266cbaddf9072e6e4f.png)

### [Integrate Web3Auth with the Polygon Blockchain in JavaScript](https://web3auth.io/docs/connect-blockchain/evm/polygon/web#sign-typed-data-v4)

Integrate Web3Auth with the Polygon Blockchain in JavaScript | Documentation - Web3Auth

```auto
 const originalMessage = JSON.stringify({
                    domain,

                    // Defining the message signing data content.
                    message: {
                        /*
                           - Anything you want. Just a JSON Blob that encodes the data you want to send
                           - No required fields
                           - This is DApp Specific
                           - Be as explicit as possible when building out the message schema.
                          */
                        contents: "Hello, Bob!",
                        attachedMoneyInEth: 4.2,
                        from: {
                            name: "Cow",
                            wallets: ["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"],
                        },
                        to: [
                            {
                                name: "Bob",
                                wallets: [
                                    "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
                                    "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57",
                                    "0xB0B0b0b0b0b0B000000000000000000000000000",
                                ],
                            },
                        ],
                    },
                    // Refers to the keys of the *types* object below.
                    primaryType: "Mail",
                    types: {
                        // TODO: Clarify if EIP712Domain refers to the domain the contract is hosted on
                        EIP712Domain: [
                            { name: "name", type: "string" },
                            { name: "version", type: "string" },
                            { name: "chainId", type: "uint256" },
                            { name: "verifyingContract", type: "address" },
                        ],
                        // Not an EIP712Domain definition
                        Group: [
                            { name: "name", type: "string" },
                            { name: "members", type: "Person[]" },
                        ],
                        // Refer to PrimaryType
                        Mail: [
                            { name: "from", type: "Person" },
                            { name: "to", type: "Person[]" },
                            { name: "contents", type: "string" },
                        ],
                        // Not an EIP712Domain definition
                        Person: [
                            { name: "name", type: "string" },
                            { name: "wallets", type: "address[]" },
                        ],
                    },
                });

                const params = [eoaAddress, originalMessage];
                const method = "eth_signTypedData_v4";
                const signedMessage = await signer.provider.send(method, params)

```

---

<div class="post-metadata">

**Author:** ![TomTom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@TomTom](https://builder.metamask.io/u/TomTom)\
**Post date:** [May 13, 2024, 11:37am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/2 "2024-05-13T11:37:33Z")

</div>

hi @betnow

Trust you’re all doing well today … please let me check it and come back to you 🙂

---

<div class="post-metadata">

**Author:** ![TomTom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@TomTom](https://builder.metamask.io/u/TomTom)\
**Post date:** [May 13, 2024, 1:00pm UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/3 "2024-05-13T13:00:58Z")

</div>

hi @betnow ,

I have no problem with the Ethers library example. Please check the RPC you are using (you can share with me all your configs) and also check that the Active chainId is the same one that you are using inside the domain/chain attribute in the message.

---

<div class="post-metadata">

**Author:** ![betnow](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/betnow/32/14_2.png) [@betnow](https://builder.metamask.io/u/betnow)\
**Post date:** [May 14, 2024, 3:32am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/4 "2024-05-14T03:32:44Z")

</div>

Domain

```auto
tconst domain = {
    name: 'Live Betting',
    version: '1.0.0',
    chainId: 137,
    verifyingContract: AZURO_CLIENT_CORE,
}

```

How signer is set

```auto
const connectHanlder = async () => {
    try {
      if (web3Auth) {
        const web3authProvider = await web3Auth.connect()
        if (web3authProvider) {
          hotjar.initialize(3306401, 6);
          setIsConnecting(true)
          const web3Provider = new ethers.providers.Web3Provider(web3authProvider);
          //const web3 = new Web3(web3authProvider);
          const signerVal = web3Provider.getSigner();
          const address = await signerVal.getAddress();
          const accountInfo = await web3Auth.getUserInfo();
          const isSocialLogin = Object.keys(accountInfo).length !== 0
          const biconomySmartAccountConfig = {
            signer: signerVal,
            chainId: ChainId.POLYGON_MAINNET,
            bundler: bundler,
            paymaster: paymaster,
            rpcUrl: getRpc(),
          };
          let biconomySmartAccount = new BiconomySmartAccount(
            biconomySmartAccountConfig
          );
          biconomySmartAccount = await biconomySmartAccount.init();
          const scwAddress = await biconomySmartAccount.getSmartAccountAddress()
      setEoaAddress(address?.toLowerCase())
      setSmartAccount(biconomySmartAccount);
      setProvider(web3Provider);
      setSigner(signerVal)
      setIsConnected(true);
      setSocailLogin(isSocialLogin)
      setProvider1(new ethers.providers.JsonRpcProvider(process.env.REACT_APP_POLYGON_RPC_URL_1))
      setProvider2(new ethers.providers.JsonRpcProvider(process.env.REACT_APP_POLYGON_RPC_URL_2))
      setProvider3(new ethers.providers.JsonRpcProvider(process.env.REACT_APP_POLYGON_RPC_URL_3))
      //setWeb3Val(web3);
      isSocialLogin ? setSocialInfo(accountInfo) : setSocialInfo(null)
      if (scwAddress?.length) {
        if (searchParams.get("referralID")?.length) {
          connectWalletAddress(scwAddress, searchParams.get("referralID"), isSocialLogin, accountInfo, address?.toLowerCase(), connectWalletCallBack)
        } else {
          connectWalletAddress(scwAddress, "", isSocialLogin, accountInfo, address?.toLowerCase(), connectWalletCallBack);
        }
      }
      setIsConnecting(false)
      return scwAddress;
    }
  } else return
} catch (err) {
  setIsConnecting(false)
  //console.log(err, "here")
}

```

When i use signer.signMessage ,I’m able to get the signature but Sign Typed Data v4 is failing

---

<div class="post-metadata">

**Author:** ![TomTom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@TomTom](https://builder.metamask.io/u/TomTom)\
**Post date:** [May 14, 2024, 10:35am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/5 "2024-05-14T10:35:20Z")

</div>

hi @betnow

If you have an error with the RPC, can you share the URL you are using to connect?

also please update Ethers to the latest version

Thanks!

---

<div class="post-metadata">

**Author:** ![betnow](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/betnow/32/14_2.png) [@betnow](https://builder.metamask.io/u/betnow)\
**Post date:** [May 15, 2024, 3:37am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/6 "2024-05-15T03:37:41Z")

</div>

Rpc

[https://polygon-mainnet.g.alchemy.com/v2/oQYTxK4aENs-](https://polygon-mainnet.g.alchemy.com/v2/oQYTxK4aENs-)…

Sure will update ethers and let you know if it works

---

<div class="post-metadata">

**Author:** ![vjgee](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vjgee](https://builder.metamask.io/u/vjgee)\
**Post date:** [June 10, 2024, 5:30am UTC](https://builder.metamask.io/t/archive-sign-typed-data-v4-error/1337/7 "2024-06-10T05:30:41Z")

</div>

@betnow Is your issue resolved?
