Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / createEditCommentTypedData

Function: createEditCommentTypedData()

function createEditCommentTypedData(params): {
  domain: {
     chainId: number;
     name: "Comments";
     verifyingContract: `0x${string}`;
     version: "1";
  };
  message: {
     app: `0x${string}`;
     author: `0x${string}`;
     commentId: `0x${string}`;
     content: string;
     deadline: bigint;
     metadata: string;
     nonce: bigint;
  };
  primaryType: "EditComment";
  types: {
     EditComment: (
        | {
        name: "commentId";
        type: "bytes32";
      }
        | {
        name: "content";
        type: "string";
      }
        | {
        name: "metadata";
        type: "string";
      }
        | {
        name: "author";
        type: "address";
      }
        | {
        name: "app";
        type: "address";
      }
        | {
        name: "nonce";
        type: "uint256";
      }
        | {
        name: "deadline";
        type: "uint256";
     })[];
  };
};

Defined in: packages/sdk/src/comments/comment.ts:787

Create the EIP-712 typed data structure for editing comment

Parameters

params

CreateEditCommentTypedDataParams

Returns

{
  domain: {
     chainId: number;
     name: "Comments";
     verifyingContract: `0x${string}`;
     version: "1";
  };
  message: {
     app: `0x${string}`;
     author: `0x${string}`;
     commentId: `0x${string}`;
     content: string;
     deadline: bigint;
     metadata: string;
     nonce: bigint;
  };
  primaryType: "EditComment";
  types: {
     EditComment: (
        | {
        name: "commentId";
        type: "bytes32";
      }
        | {
        name: "content";
        type: "string";
      }
        | {
        name: "metadata";
        type: "string";
      }
        | {
        name: "author";
        type: "address";
      }
        | {
        name: "app";
        type: "address";
      }
        | {
        name: "nonce";
        type: "uint256";
      }
        | {
        name: "deadline";
        type: "uint256";
     })[];
  };
}

The typed data

domain

domain: {
  chainId: number;
  name: "Comments";
  verifyingContract: `0x${string}`;
  version: "1";
};

domain.chainId

chainId: number;

domain.name

name: "Comments";

domain.verifyingContract

verifyingContract: `0x${string}` = HexSchema;

domain.version

version: "1";

message

message: {
  app: `0x${string}`;
  author: `0x${string}`;
  commentId: `0x${string}`;
  content: string;
  deadline: bigint;
  metadata: string;
  nonce: bigint;
};

message.app

app: `0x${string}` = HexSchema;

message.author

author: `0x${string}` = HexSchema;

message.commentId

commentId: `0x${string}` = HexSchema;

message.content

content: string;

message.deadline

deadline: bigint;

message.metadata

metadata: string = CommentMetadataSchema;

message.nonce

nonce: bigint;

primaryType

primaryType: "EditComment";

types

types: {
  EditComment: (
     | {
     name: "commentId";
     type: "bytes32";
   }
     | {
     name: "content";
     type: "string";
   }
     | {
     name: "metadata";
     type: "string";
   }
     | {
     name: "author";
     type: "address";
   }
     | {
     name: "app";
     type: "address";
   }
     | {
     name: "nonce";
     type: "uint256";
   }
     | {
     name: "deadline";
     type: "uint256";
  })[];
};

types.EditComment

EditComment: (
  | {
  name: "commentId";
  type: "bytes32";
}
  | {
  name: "content";
  type: "string";
}
  | {
  name: "metadata";
  type: "string";
}
  | {
  name: "author";
  type: "address";
}
  | {
  name: "app";
  type: "address";
}
  | {
  name: "nonce";
  type: "uint256";
}
  | {
  name: "deadline";
  type: "uint256";
})[];