@ecp.eth/sdk / comments / createCommentTypedData
Function: createCommentTypedData()
function createCommentTypedData(params): {
domain: {
chainId: number;
name: "Ethereum Comments Protocol";
verifyingContract: `0x${string}`;
version: "1";
};
message: | {
app: `0x${string}`;
author: `0x${string}`;
channelId: bigint;
commentType: number;
content: string;
deadline: bigint;
metadata: {
key: `0x${string}`;
value: `0x${string}`;
}[];
parentId: `0x${string}`;
targetUri: string;
}
| {
app: `0x${string}`;
author: `0x${string}`;
channelId: bigint;
commentType: number;
content: string;
deadline: bigint;
metadata: {
key: `0x${string}`;
value: `0x${string}`;
}[];
parentId: `0x${string}`;
targetUri: "";
};
primaryType: "AddComment";
types: {
AddComment: (
| {
name: "content";
type: "string";
}
| {
name: "metadata";
type: "MetadataEntry[]";
}
| {
name: "targetUri";
type: "string";
}
| {
name: "commentType";
type: "uint8";
}
| {
name: "author";
type: "address";
}
| {
name: "app";
type: "address";
}
| {
name: "channelId";
type: "uint256";
}
| {
name: "deadline";
type: "uint256";
}
| {
name: "parentId";
type: "bytes32";
})[];
MetadataEntry: (
| {
name: "key";
type: "bytes32";
}
| {
name: "value";
type: "bytes";
})[];
};
};
Defined in: packages/sdk/src/comments/comment.ts:535
Create the EIP-712 typed data structure for adding comment
Parameters
params
Returns
{
domain: {
chainId: number;
name: "Ethereum Comments Protocol";
verifyingContract: `0x${string}`;
version: "1";
};
message: | {
app: `0x${string}`;
author: `0x${string}`;
channelId: bigint;
commentType: number;
content: string;
deadline: bigint;
metadata: {
key: `0x${string}`;
value: `0x${string}`;
}[];
parentId: `0x${string}`;
targetUri: string;
}
| {
app: `0x${string}`;
author: `0x${string}`;
channelId: bigint;
commentType: number;
content: string;
deadline: bigint;
metadata: {
key: `0x${string}`;
value: `0x${string}`;
}[];
parentId: `0x${string}`;
targetUri: "";
};
primaryType: "AddComment";
types: {
AddComment: (
| {
name: "content";
type: "string";
}
| {
name: "metadata";
type: "MetadataEntry[]";
}
| {
name: "targetUri";
type: "string";
}
| {
name: "commentType";
type: "uint8";
}
| {
name: "author";
type: "address";
}
| {
name: "app";
type: "address";
}
| {
name: "channelId";
type: "uint256";
}
| {
name: "deadline";
type: "uint256";
}
| {
name: "parentId";
type: "bytes32";
})[];
MetadataEntry: (
| {
name: "key";
type: "bytes32";
}
| {
name: "value";
type: "bytes";
})[];
};
}
The typed data
domain
domain: {
chainId: number;
name: "Ethereum Comments Protocol";
verifyingContract: `0x${string}`;
version: "1";
};
domain.chainId
chainId: number;
domain.name
name: "Ethereum Comments Protocol";
domain.verifyingContract
verifyingContract: `0x${string}` = HexSchema;
domain.version
version: "1";
message
message:
| {
app: `0x${string}`;
author: `0x${string}`;
channelId: bigint;
commentType: number;
content: string;
deadline: bigint;
metadata: {
key: `0x${string}`;
value: `0x${string}`;
}[];
parentId: `0x${string}`;
targetUri: string;
}
| {
app: `0x${string}`;
author: `0x${string}`;
channelId: bigint;
commentType: number;
content: string;
deadline: bigint;
metadata: {
key: `0x${string}`;
value: `0x${string}`;
}[];
parentId: `0x${string}`;
targetUri: "";
} = CommentInputDataSchema;
primaryType
primaryType: "AddComment";
types
types: {
AddComment: (
| {
name: "content";
type: "string";
}
| {
name: "metadata";
type: "MetadataEntry[]";
}
| {
name: "targetUri";
type: "string";
}
| {
name: "commentType";
type: "uint8";
}
| {
name: "author";
type: "address";
}
| {
name: "app";
type: "address";
}
| {
name: "channelId";
type: "uint256";
}
| {
name: "deadline";
type: "uint256";
}
| {
name: "parentId";
type: "bytes32";
})[];
MetadataEntry: (
| {
name: "key";
type: "bytes32";
}
| {
name: "value";
type: "bytes";
})[];
};
types.AddComment
AddComment: (
| {
name: "content";
type: "string";
}
| {
name: "metadata";
type: "MetadataEntry[]";
}
| {
name: "targetUri";
type: "string";
}
| {
name: "commentType";
type: "uint8";
}
| {
name: "author";
type: "address";
}
| {
name: "app";
type: "address";
}
| {
name: "channelId";
type: "uint256";
}
| {
name: "deadline";
type: "uint256";
}
| {
name: "parentId";
type: "bytes32";
})[];
types.MetadataEntry
MetadataEntry: (
| {
name: "key";
type: "bytes32";
}
| {
name: "value";
type: "bytes";
})[];