CDP Frontend SDK
    Preparing search index...

    Function signEvmTypedData

    • Signs EIP-712 typed data with an EVM account.

      Parameters

      • options: SignEvmTypedDataOptions

        The options for the signing.

        Request parameters for signing EIP-712 typed data with an EVM account.

        • evmAccount: EvmAddress

          The EVM account to sign the typed data with.

        • typedData: EIP712TypedData

          The EIP-712 typed data to sign.

      Returns Promise<SignEvmTypedDataResult>

      The result of the signing.

      const user = await getCurrentUser();
      const evmAccount = user?.evmAccounts[0];

      const result = await signEvmTypedData({
      evmAccount,
      typedData: {
      domain: {
      name: "USDC",
      version: "2",
      chainId: 84532,
      verifyingContract: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", // Base Sepolia USDC
      },
      types: {
      EIP712Domain: [
      { name: "name", type: "string" },
      { name: "version", type: "string" },
      { name: "chainId", type: "uint256" },
      { name: "verifyingContract", type: "address" },
      ],
      TransferWithAuthorization: [
      { name: "from", type: "address" },
      { name: "to", type: "address" },
      { name: "value", type: "uint256" },
      { name: "validAfter", type: "uint256" },
      { name: "validBefore", type: "uint256" },
      { name: "nonce", type: "bytes32" },
      ],
      },
      primaryType: "TransferWithAuthorization",
      message: {
      from: evmAccount,
      to: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
      value: "1000000", // 1 USDC (6 decimals)
      validAfter: 0, // Valid immediately
      validBefore: 2524604400, // Valid until 2050
      nonce: 0
      },
      },
      });