@ecp.eth/sdk / comments
comments
Ethereum Comments Protocol SDK Comments Core functionality for managing comments and approvals
Enumerations
| Enumeration | Description |
|---|---|
| AuthorAuthMethod | - |
| MetadataOperation | - |
Classes
| Class | Description |
|---|---|
| CAIP373Error | Base error for CAIP-373 errors |
| InvalidCommentIdError | Error thrown when the comment id is invalid |
| InvalidCommentManagerAddressError | Error thrown when the comment manager address is not the same as the chain's comment manager address |
| InvalidFunctionCallDataError | Error thrown when the function call data is invalid |
| MalformedCaip373Error | Error thrown when the CAIP-373 is malformed |
| UnsupportedChainError | Error thrown when the chain is unsupported |
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". |
| 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 |
| decodeJsonValue | Decodes a JSON object from encoded metadata bytes |
| decodeMetadataKey | Decodes a metadata key from a hex-encoded key |
| 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. |
| decodeQuotedCommentFromCaip373 | Parses a CAIP-373 quoted comment. |
| decodeStringValue | Decodes a string value from encoded metadata bytes. |
| encodeAddressValue | Encodes an address value as bytes for metadata |
| encodeBoolValue | Encodes a boolean value as bytes for metadata |
| encodeBytesValue | Encodes a bytes value as bytes for metadata |
| encodeJsonValue | Encodes a JSON object as bytes for metadata |
| encodeNumberValue | Encodes a number value as bytes for metadata. |
| encodeQuotedCommentFromCaip373 | Encodes a quoted comment from a CAIP-373 |
| 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) |