Mantle support for OZDeffender meta tx workshop

I am tryint to update the code from the OZ Deffender meta tx workshop to work with Mantle mainnet. Metamask wallet is used with Mantle mainnet chain imported. Deploy of the relayer works fine as well as the action creation.

:computer: Environment

Metamask wallet


:1234: Code to reproduce


  1. App does not recognize Mantle chain.

const userNetwork = await userProvider.getNetwork() produce this network object:
"name": "unknown",
"chainId": "5000"
Even though the chainId is 5000 and the code is updated to:

if (userNetwork.chainId !== 5000) throw new Error(Please switch to Mantle for signing);

the error is still being thrown and cannot be bypassed.

  1. After (1) is commented out and the provider.js rpc url has been changed to:
    export function createProvider() {
    return new ethers.JsonRpcProvider("", 5);
    the error message is shown:
    network changed: 5 => 5000 (event="changed", code=NETWORK_ERROR, version=6.9.2)

  2. Running
    NAME=alice yarn sign
    throws the following error:
    TypeError: forwarder.getNonce is not a function

1 Like