@ecp.eth/sdk / comments
comments
Ethereum Comments Protocol SDK Comments Core functionality for managing comments and approvals
Enumerations
Enumeration | Description |
---|---|
AuthorAuthMethod | - |
MetadataOperation | - |
Type Aliases
Variables
Functions
Function | Description |
---|---|
addApproval | Approves an app signer directly as author |
addApprovalWithSig | Adds an app signer approval with signature verification |
convertContractToRecordFormat | Converts from contract MetadataEntry array format to JS/SDK Record format Note: This requires knowledge of the original key string and type, which are lost in the contract format. This function attempts to reverse-engineer them from common patterns used in the codebase. |
convertRecordToContractFormat | Converts from JS/SDK Record format to contract MetadataEntry array format |
createApprovalTypedData | Create the EIP-712 typed data structure for approving comment |
createCommentData | Create the data structure of a comment |
createCommentTypedData | Create the EIP-712 typed data structure for adding comment |
createCustomMetadataEntry | Creates a metadata entry with a custom type |
createDeleteCommentTypedData | Create the EIP-712 typed data structure for deleting comment |
createEditCommentData | Create the data structure of a comment for editing |
createEditCommentTypedData | Create the EIP-712 typed data structure for editing comment |
createKeyTypeMap | Helper function to create a key-type mapping for known metadata keys This should be maintained by applications to properly convert from contract format |
createMetadataEntries | Creates multiple metadata entries from an object with explicit types |
createMetadataEntry | Creates a metadata entry from a key-value pair with explicit type specification |
createMetadataKey | Creates a metadata key by encoding a string in the format "type key" using abi.encodePacked |
createRemoveApprovalTypedData | Create the EIP-712 typed data structure for removing approval |
createReportCommentTypedData | Create the EIP-712 typed data structure for reporting a comment |
decodeAddressValue | Decodes an address value from encoded metadata bytes |
decodeBoolValue | Decodes a boolean value from encoded metadata bytes |
decodeBytesValue | Decodes a bytes value from encoded metadata bytes |
decodeMetadataTypes | Decodes metadata types from on-chain metadata entries by reverse-engineering the type information from the encoded key field. Works without requiring prior knowledge of the key-type mappings. |
decodeMetadataValue | Decodes a metadata entry value based on its type |
decodeNumberValue | Decodes a number value from encoded metadata bytes |
decodeStringValue | Decodes a string value from encoded metadata bytes |
encodeBoolValue | Encodes a boolean value as bytes for metadata |
encodeJsonValue | Encodes a JSON object as bytes for metadata |
encodeNumberValue | Encodes a number value as bytes for metadata |
encodeStringValue | Encodes a string value as bytes for metadata |
getAddApprovalHash | Gets the EIP-712 hash for adding approval |
getChannelManager | Gets the channel manager contract address |
getComment | Get a comment by ID |
getCommentId | Get the ID for a comment before it is posted |
getContractName | Gets the contract name |
getContractVersion | Gets the contract version |
getDeleteCommentHash | Get the hash for deleting a comment |
getDomainSeparator | Gets the EIP-712 domain separator |
getEditCommentHash | Get the hash for editing a comment |
getNonce | Get the nonce for the author and app signer |
getRemoveApprovalHash | Gets the EIP-712 hash for removing approval |
isApproved | Checks if an app signer is approved for an author |
parseMetadataFromContract | Convenience function to convert metadata from contracts for JS/SDK use |
prepareMetadataForContract | Convenience function to convert metadata for sending to contracts Handles both Record format and direct MetadataEntry array |
revokeApproval | Revokes an app signer approval directly as author |
revokeApprovalWithSig | Removes an app signer approval with signature verification |
updateChannelContract | Updates the channel manager contract address (only owner) |