Function signTypedData

  • Sign typed data according to EIP-712. The signing differs based upon the version.

    V1 is based upon an early version of EIP-712 that lacked some later security improvements, and should generally be neglected in favor of later versions.

    V3 is based on EIP-712, except that arrays and recursive data structures are not supported.

    V4 is based on EIP-712, and includes full support of arrays and recursive data structures.

    Type Parameters

    Parameters

    • options: {
          data: V extends "V1"
              ? TypedDataV1
              : TypedMessage<T>;
          privateKey: Buffer;
          version: V;
      }

      The signing options.

      • data: V extends "V1"
            ? TypedDataV1
            : TypedMessage<T>

        The typed data to sign.

      • privateKey: Buffer

        The private key to sign with.

      • version: V

        The signing version to use.

    Returns string

    The '0x'-prefixed hex encoded signature.