Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / indexer/webhooks / constructEvent

Function: constructEvent()

function constructEvent(options): 
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     comment:   | {
        app: `0x${string}`;
        author: `0x${string}`;
        channelId: bigint;
        commentType: number;
        content: string;
        createdAt: Date;
        id: `0x${string}`;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        moderationStatus: "approved" | "pending" | "rejected";
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: ... | ...;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ...;
              dimension: ...;
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        targetUri: string;
        type: "root";
        updatedAt: Date;
      }
        | {
        app: `0x${string}`;
        author: `0x${string}`;
        channelId: bigint;
        commentType: number;
        content: string;
        createdAt: Date;
        id: `0x${string}`;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        moderationStatus: "approved" | "pending" | "rejected";
        parentId: `0x${string}`;
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: ... | ...;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ...;
              dimension: ...;
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        type: "reply";
        updatedAt: Date;
      };
     zeroExSwap:   | null
        | {
        from: {
           address: `0x${string}`;
           amount: string;
           symbol: string;
        };
        to: {
           address: "" | `0x${string}`;
           amount: string;
           symbol: string;
        };
      };
  };
  event: "comment:added";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     comment: {
        hookMetadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        id: `0x${string}`;
        updatedAt: Date;
     };
     hookMetadataOperation:   | {
        key: `0x${string}`;
        type: "delete";
      }
        | {
        key: `0x${string}`;
        type: "create";
        value: `0x${string}`;
      }
        | {
        key: `0x${string}`;
        type: "update";
        value: `0x${string}`;
      };
  };
  event: "comment:hook:metadata:set";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     comment: {
        deletedAt: Date;
        id: `0x${string}`;
        updatedAt: Date;
     };
  };
  event: "comment:deleted";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     comment: {
        content: string;
        id: `0x${string}`;
        moderationStatus: "approved" | "pending" | "rejected";
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: null | string;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ... | ...;
              dimension: {
                 height: ...;
                 width: ...;
              };
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        updatedAt: Date;
     };
  };
  event: "comment:edited";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  data: {
     comment: {
        id: `0x${string}`;
        moderationStatus: "approved" | "pending" | "rejected";
        moderationStatusChangedAt: Date;
     };
  };
  event: "comment:moderation:status:updated";
  uid: string;
  version: 1;
}
  | {
  data: {
     comment: {
        id: `0x${string}`;
        reactionCounts: Record<string, number>;
     };
  };
  event: "comment:reactions:updated";
  uid: string;
  version: 1;
}
  | {
  data: {
     comment: {
        id: `0x${string}`;
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: null | string;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ... | ...;
              dimension: {
                 height: ...;
                 width: ...;
              };
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        referencesResolutionStatus: "pending" | "partial" | "success" | "failed";
        referencesResolutionStatusChangedAt: Date;
     };
  };
  event: "comment:references:updated";
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        chainId: number;
        createdAt: Date;
        description: string;
        hook: null | `0x${string}`;
        id: bigint;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        name: string;
        owner: `0x${string}`;
        updatedAt: Date;
     };
  };
  event: "channel:created";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        description: string;
        id: bigint;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        name: string;
        updatedAt: Date;
     };
  };
  event: "channel:updated";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        hook: null | `0x${string}`;
        id: bigint;
        updatedAt: Date;
     };
     hook: {
        address: `0x${string}`;
        enabled: boolean;
     };
  };
  event: "channel:hook:status:updated";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        id: bigint;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        updatedAt: Date;
     };
     metadataOperation:   | {
        key: `0x${string}`;
        type: "delete";
      }
        | {
        key: `0x${string}`;
        type: "create";
        value: `0x${string}`;
      }
        | {
        key: `0x${string}`;
        type: "update";
        value: `0x${string}`;
      };
  };
  event: "channel:metadata:set";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        id: bigint;
        owner: `0x${string}`;
        updatedAt: Date;
     };
     from: `0x${string}`;
     to: `0x${string}`;
  };
  event: "channel:transferred";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     approval: {
        app: `0x${string}`;
        author: `0x${string}`;
        createdAt: Date;
        id: string;
        updatedAt: Date;
     };
  };
  event: "approval:added";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  blockNumber: bigint;
  chainId: number;
  data: {
     approval: {
        id: string;
     };
  };
  event: "approval:removed";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}
  | {
  appId: string;
  data: {
     message: string;
  };
  event: "test";
  uid: string;
  version: 1;
  webhookId: string;
};

Defined in: packages/sdk/src/indexer/webhooks/utils.ts:70

Constructs an event from the request body, signature, and timestamp.

Parameters

options

The options for constructing the event.

appSecret

string = ...

The app secret key.

requestBody

string = ...

The request body.

requestSignature

string = ...

The signature from X-ECP-Webhook-Signature header.

requestTimestamp

string | number = ...

The timestamp from X-ECP-Webhook-Timestamp header.

Returns

{
  blockNumber: bigint;
  chainId: number;
  data: {
     comment:   | {
        app: `0x${string}`;
        author: `0x${string}`;
        channelId: bigint;
        commentType: number;
        content: string;
        createdAt: Date;
        id: `0x${string}`;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        moderationStatus: "approved" | "pending" | "rejected";
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: ... | ...;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ...;
              dimension: ...;
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        targetUri: string;
        type: "root";
        updatedAt: Date;
      }
        | {
        app: `0x${string}`;
        author: `0x${string}`;
        channelId: bigint;
        commentType: number;
        content: string;
        createdAt: Date;
        id: `0x${string}`;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        moderationStatus: "approved" | "pending" | "rejected";
        parentId: `0x${string}`;
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: ... | ...;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ...;
              dimension: ...;
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        type: "reply";
        updatedAt: Date;
      };
     zeroExSwap:   | null
        | {
        from: {
           address: `0x${string}`;
           amount: string;
           symbol: string;
        };
        to: {
           address: "" | `0x${string}`;
           amount: string;
           symbol: string;
        };
      };
  };
  event: "comment:added";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  comment:   | {
     app: `0x${string}`;
     author: `0x${string}`;
     channelId: bigint;
     commentType: number;
     content: string;
     createdAt: Date;
     id: `0x${string}`;
     metadata: {
        key: `0x${string}`;
        value: `0x${string}`;
     }[];
     moderationStatus: "approved" | "pending" | "rejected";
     references: (
        | {
        address: `0x${string}`;
        avatarUrl: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        type: "ens";
        url: string;
      }
        | {
        address: `0x${string}`;
        displayName: null | string;
        fid: number;
        fname: string;
        pfpUrl: null | string;
        position: {
           end: number;
           start: number;
        };
        type: "farcaster";
        url: string;
        username: string;
      }
        | {
        address: `0x${string}`;
        chainId: null | number;
        chains: {
           caip: string;
           chainId: number;
        }[];
        decimals: number;
        logoURI: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        symbol: string;
        type: "erc20";
      }
        | {
        description: null | string;
        favicon: null | string;
        mediaType: string;
        opengraph:   | null
           | {
           description: ... | ...;
           image: string;
           title: string;
           url: string;
         };
        position: {
           end: number;
           start: number;
        };
        title: string;
        type: "webpage";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "file";
        url: string;
      }
        | {
        dimension?: {
           height: number;
           width: number;
        };
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "image";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "video";
        url: string;
        videoTracks?: {
           codec?: ...;
           dimension: ...;
        }[];
      }
        | {
        chainId: number;
        id: `0x${string}`;
        position: {
           end: number;
           start: number;
        };
        type: "quoted_comment";
     })[];
     targetUri: string;
     type: "root";
     updatedAt: Date;
   }
     | {
     app: `0x${string}`;
     author: `0x${string}`;
     channelId: bigint;
     commentType: number;
     content: string;
     createdAt: Date;
     id: `0x${string}`;
     metadata: {
        key: `0x${string}`;
        value: `0x${string}`;
     }[];
     moderationStatus: "approved" | "pending" | "rejected";
     parentId: `0x${string}`;
     references: (
        | {
        address: `0x${string}`;
        avatarUrl: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        type: "ens";
        url: string;
      }
        | {
        address: `0x${string}`;
        displayName: null | string;
        fid: number;
        fname: string;
        pfpUrl: null | string;
        position: {
           end: number;
           start: number;
        };
        type: "farcaster";
        url: string;
        username: string;
      }
        | {
        address: `0x${string}`;
        chainId: null | number;
        chains: {
           caip: string;
           chainId: number;
        }[];
        decimals: number;
        logoURI: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        symbol: string;
        type: "erc20";
      }
        | {
        description: null | string;
        favicon: null | string;
        mediaType: string;
        opengraph:   | null
           | {
           description: ... | ...;
           image: string;
           title: string;
           url: string;
         };
        position: {
           end: number;
           start: number;
        };
        title: string;
        type: "webpage";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "file";
        url: string;
      }
        | {
        dimension?: {
           height: number;
           width: number;
        };
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "image";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "video";
        url: string;
        videoTracks?: {
           codec?: ...;
           dimension: ...;
        }[];
      }
        | {
        chainId: number;
        id: `0x${string}`;
        position: {
           end: number;
           start: number;
        };
        type: "quoted_comment";
     })[];
     type: "reply";
     updatedAt: Date;
   };
  zeroExSwap:   | null
     | {
     from: {
        address: `0x${string}`;
        amount: string;
        symbol: string;
     };
     to: {
        address: "" | `0x${string}`;
        amount: string;
        symbol: string;
     };
   };
};

Data of the event

data.comment

comment: 
  | {
  app: `0x${string}`;
  author: `0x${string}`;
  channelId: bigint;
  commentType: number;
  content: string;
  createdAt: Date;
  id: `0x${string}`;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  moderationStatus: "approved" | "pending" | "rejected";
  references: (
     | {
     address: `0x${string}`;
     avatarUrl: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     type: "ens";
     url: string;
   }
     | {
     address: `0x${string}`;
     displayName: null | string;
     fid: number;
     fname: string;
     pfpUrl: null | string;
     position: {
        end: number;
        start: number;
     };
     type: "farcaster";
     url: string;
     username: string;
   }
     | {
     address: `0x${string}`;
     chainId: null | number;
     chains: {
        caip: string;
        chainId: number;
     }[];
     decimals: number;
     logoURI: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     symbol: string;
     type: "erc20";
   }
     | {
     description: null | string;
     favicon: null | string;
     mediaType: string;
     opengraph:   | null
        | {
        description: ... | ...;
        image: string;
        title: string;
        url: string;
      };
     position: {
        end: number;
        start: number;
     };
     title: string;
     type: "webpage";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "file";
     url: string;
   }
     | {
     dimension?: {
        height: number;
        width: number;
     };
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "image";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "video";
     url: string;
     videoTracks?: {
        codec?: ...;
        dimension: ...;
     }[];
   }
     | {
     chainId: number;
     id: `0x${string}`;
     position: {
        end: number;
        start: number;
     };
     type: "quoted_comment";
  })[];
  targetUri: string;
  type: "root";
  updatedAt: Date;
}
  | {
  app: `0x${string}`;
  author: `0x${string}`;
  channelId: bigint;
  commentType: number;
  content: string;
  createdAt: Date;
  id: `0x${string}`;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  moderationStatus: "approved" | "pending" | "rejected";
  parentId: `0x${string}`;
  references: (
     | {
     address: `0x${string}`;
     avatarUrl: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     type: "ens";
     url: string;
   }
     | {
     address: `0x${string}`;
     displayName: null | string;
     fid: number;
     fname: string;
     pfpUrl: null | string;
     position: {
        end: number;
        start: number;
     };
     type: "farcaster";
     url: string;
     username: string;
   }
     | {
     address: `0x${string}`;
     chainId: null | number;
     chains: {
        caip: string;
        chainId: number;
     }[];
     decimals: number;
     logoURI: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     symbol: string;
     type: "erc20";
   }
     | {
     description: null | string;
     favicon: null | string;
     mediaType: string;
     opengraph:   | null
        | {
        description: ... | ...;
        image: string;
        title: string;
        url: string;
      };
     position: {
        end: number;
        start: number;
     };
     title: string;
     type: "webpage";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "file";
     url: string;
   }
     | {
     dimension?: {
        height: number;
        width: number;
     };
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "image";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "video";
     url: string;
     videoTracks?: {
        codec?: ...;
        dimension: ...;
     }[];
   }
     | {
     chainId: number;
     id: `0x${string}`;
     position: {
        end: number;
        start: number;
     };
     type: "quoted_comment";
  })[];
  type: "reply";
  updatedAt: Date;
};

Comment data

Type declaration
{
  app: `0x${string}`;
  author: `0x${string}`;
  channelId: bigint;
  commentType: number;
  content: string;
  createdAt: Date;
  id: `0x${string}`;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  moderationStatus: "approved" | "pending" | "rejected";
  references: (
     | {
     address: `0x${string}`;
     avatarUrl: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     type: "ens";
     url: string;
   }
     | {
     address: `0x${string}`;
     displayName: null | string;
     fid: number;
     fname: string;
     pfpUrl: null | string;
     position: {
        end: number;
        start: number;
     };
     type: "farcaster";
     url: string;
     username: string;
   }
     | {
     address: `0x${string}`;
     chainId: null | number;
     chains: {
        caip: string;
        chainId: number;
     }[];
     decimals: number;
     logoURI: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     symbol: string;
     type: "erc20";
   }
     | {
     description: null | string;
     favicon: null | string;
     mediaType: string;
     opengraph:   | null
        | {
        description: ... | ...;
        image: string;
        title: string;
        url: string;
      };
     position: {
        end: number;
        start: number;
     };
     title: string;
     type: "webpage";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "file";
     url: string;
   }
     | {
     dimension?: {
        height: number;
        width: number;
     };
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "image";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "video";
     url: string;
     videoTracks?: {
        codec?: ...;
        dimension: ...;
     }[];
   }
     | {
     chainId: number;
     id: `0x${string}`;
     position: {
        end: number;
        start: number;
     };
     type: "quoted_comment";
  })[];
  targetUri: string;
  type: "root";
  updatedAt: Date;
}
{
  app: `0x${string}`;
  author: `0x${string}`;
  channelId: bigint;
  commentType: number;
  content: string;
  createdAt: Date;
  id: `0x${string}`;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  moderationStatus: "approved" | "pending" | "rejected";
  parentId: `0x${string}`;
  references: (
     | {
     address: `0x${string}`;
     avatarUrl: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     type: "ens";
     url: string;
   }
     | {
     address: `0x${string}`;
     displayName: null | string;
     fid: number;
     fname: string;
     pfpUrl: null | string;
     position: {
        end: number;
        start: number;
     };
     type: "farcaster";
     url: string;
     username: string;
   }
     | {
     address: `0x${string}`;
     chainId: null | number;
     chains: {
        caip: string;
        chainId: number;
     }[];
     decimals: number;
     logoURI: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     symbol: string;
     type: "erc20";
   }
     | {
     description: null | string;
     favicon: null | string;
     mediaType: string;
     opengraph:   | null
        | {
        description: ... | ...;
        image: string;
        title: string;
        url: string;
      };
     position: {
        end: number;
        start: number;
     };
     title: string;
     type: "webpage";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "file";
     url: string;
   }
     | {
     dimension?: {
        height: number;
        width: number;
     };
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "image";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "video";
     url: string;
     videoTracks?: {
        codec?: ...;
        dimension: ...;
     }[];
   }
     | {
     chainId: number;
     id: `0x${string}`;
     position: {
        end: number;
        start: number;
     };
     type: "quoted_comment";
  })[];
  type: "reply";
  updatedAt: Date;
}

data.zeroExSwap

zeroExSwap: 
  | null
  | {
  from: {
     address: `0x${string}`;
     amount: string;
     symbol: string;
  };
  to: {
     address: "" | `0x${string}`;
     amount: string;
     symbol: string;
  };
};

ZeroEx swap data

event

event: "comment:added";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     comment: {
        hookMetadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        id: `0x${string}`;
        updatedAt: Date;
     };
     hookMetadataOperation:   | {
        key: `0x${string}`;
        type: "delete";
      }
        | {
        key: `0x${string}`;
        type: "create";
        value: `0x${string}`;
      }
        | {
        key: `0x${string}`;
        type: "update";
        value: `0x${string}`;
      };
  };
  event: "comment:hook:metadata:set";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  comment: {
     hookMetadata: {
        key: `0x${string}`;
        value: `0x${string}`;
     }[];
     id: `0x${string}`;
     updatedAt: Date;
  };
  hookMetadataOperation:   | {
     key: `0x${string}`;
     type: "delete";
   }
     | {
     key: `0x${string}`;
     type: "create";
     value: `0x${string}`;
   }
     | {
     key: `0x${string}`;
     type: "update";
     value: `0x${string}`;
   };
};

Data of the event

data.comment

comment: {
  hookMetadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  id: `0x${string}`;
  updatedAt: Date;
};

Updated comment data

data.comment.hookMetadata

hookMetadata: {
  key: `0x${string}`;
  value: `0x${string}`;
}[] = MetadataArraySchema;

Hook metadata. On wire it is a ISO 8601 date and time string.

data.comment.id

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

ID of the comment

data.comment.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date. On wire it is a ISO 8601 date and time string.

data.hookMetadataOperation

hookMetadataOperation: 
  | {
  key: `0x${string}`;
  type: "delete";
}
  | {
  key: `0x${string}`;
  type: "create";
  value: `0x${string}`;
}
  | {
  key: `0x${string}`;
  type: "update";
  value: `0x${string}`;
} = MetadataSetOperationSchema;

Hook metadata operation

event

event: "comment:hook:metadata:set";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     comment: {
        deletedAt: Date;
        id: `0x${string}`;
        updatedAt: Date;
     };
  };
  event: "comment:deleted";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  comment: {
     deletedAt: Date;
     id: `0x${string}`;
     updatedAt: Date;
  };
};

Data of the event

data.comment

comment: {
  deletedAt: Date;
  id: `0x${string}`;
  updatedAt: Date;
};

Updated comment data

data.comment.deletedAt

deletedAt: Date = ISO8601DateSchema;

Deleted at date. On wire it is a ISO 8601 date and time string

data.comment.id

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

ID of the comment

data.comment.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date. On wire it is a ISO 8601 date and time string

event

event: "comment:deleted";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     comment: {
        content: string;
        id: `0x${string}`;
        moderationStatus: "approved" | "pending" | "rejected";
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: null | string;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ... | ...;
              dimension: {
                 height: ...;
                 width: ...;
              };
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        updatedAt: Date;
     };
  };
  event: "comment:edited";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  comment: {
     content: string;
     id: `0x${string}`;
     moderationStatus: "approved" | "pending" | "rejected";
     references: (
        | {
        address: `0x${string}`;
        avatarUrl: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        type: "ens";
        url: string;
      }
        | {
        address: `0x${string}`;
        displayName: null | string;
        fid: number;
        fname: string;
        pfpUrl: null | string;
        position: {
           end: number;
           start: number;
        };
        type: "farcaster";
        url: string;
        username: string;
      }
        | {
        address: `0x${string}`;
        chainId: null | number;
        chains: {
           caip: string;
           chainId: number;
        }[];
        decimals: number;
        logoURI: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        symbol: string;
        type: "erc20";
      }
        | {
        description: null | string;
        favicon: null | string;
        mediaType: string;
        opengraph:   | null
           | {
           description: null | string;
           image: string;
           title: string;
           url: string;
         };
        position: {
           end: number;
           start: number;
        };
        title: string;
        type: "webpage";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "file";
        url: string;
      }
        | {
        dimension?: {
           height: number;
           width: number;
        };
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "image";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "video";
        url: string;
        videoTracks?: {
           codec?: ... | ...;
           dimension: {
              height: ...;
              width: ...;
           };
        }[];
      }
        | {
        chainId: number;
        id: `0x${string}`;
        position: {
           end: number;
           start: number;
        };
        type: "quoted_comment";
     })[];
     updatedAt: Date;
  };
};

Data of the event

data.comment

comment: {
  content: string;
  id: `0x${string}`;
  moderationStatus: "approved" | "pending" | "rejected";
  references: (
     | {
     address: `0x${string}`;
     avatarUrl: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     type: "ens";
     url: string;
   }
     | {
     address: `0x${string}`;
     displayName: null | string;
     fid: number;
     fname: string;
     pfpUrl: null | string;
     position: {
        end: number;
        start: number;
     };
     type: "farcaster";
     url: string;
     username: string;
   }
     | {
     address: `0x${string}`;
     chainId: null | number;
     chains: {
        caip: string;
        chainId: number;
     }[];
     decimals: number;
     logoURI: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     symbol: string;
     type: "erc20";
   }
     | {
     description: null | string;
     favicon: null | string;
     mediaType: string;
     opengraph:   | null
        | {
        description: null | string;
        image: string;
        title: string;
        url: string;
      };
     position: {
        end: number;
        start: number;
     };
     title: string;
     type: "webpage";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "file";
     url: string;
   }
     | {
     dimension?: {
        height: number;
        width: number;
     };
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "image";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "video";
     url: string;
     videoTracks?: {
        codec?: ... | ...;
        dimension: {
           height: ...;
           width: ...;
        };
     }[];
   }
     | {
     chainId: number;
     id: `0x${string}`;
     position: {
        end: number;
        start: number;
     };
     type: "quoted_comment";
  })[];
  updatedAt: Date;
};

Updated comment data

data.comment.content

content: string;

Content of the comment

data.comment.id

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

ID of the comment

data.comment.moderationStatus

moderationStatus: "approved" | "pending" | "rejected" = CommentModerationStatusSchema;

Moderation status of the comment

data.comment.references

references: (
  | {
  address: `0x${string}`;
  avatarUrl: null | string;
  name: string;
  position: {
     end: number;
     start: number;
  };
  type: "ens";
  url: string;
}
  | {
  address: `0x${string}`;
  displayName: null | string;
  fid: number;
  fname: string;
  pfpUrl: null | string;
  position: {
     end: number;
     start: number;
  };
  type: "farcaster";
  url: string;
  username: string;
}
  | {
  address: `0x${string}`;
  chainId: null | number;
  chains: {
     caip: string;
     chainId: number;
  }[];
  decimals: number;
  logoURI: null | string;
  name: string;
  position: {
     end: number;
     start: number;
  };
  symbol: string;
  type: "erc20";
}
  | {
  description: null | string;
  favicon: null | string;
  mediaType: string;
  opengraph:   | null
     | {
     description: null | string;
     image: string;
     title: string;
     url: string;
   };
  position: {
     end: number;
     start: number;
  };
  title: string;
  type: "webpage";
  url: string;
}
  | {
  mediaType: string;
  position: {
     end: number;
     start: number;
  };
  type: "file";
  url: string;
}
  | {
  dimension?: {
     height: number;
     width: number;
  };
  mediaType: string;
  position: {
     end: number;
     start: number;
  };
  type: "image";
  url: string;
}
  | {
  mediaType: string;
  position: {
     end: number;
     start: number;
  };
  type: "video";
  url: string;
  videoTracks?: {
     codec?: ... | ...;
     dimension: {
        height: ...;
        width: ...;
     };
  }[];
}
  | {
  chainId: number;
  id: `0x${string}`;
  position: {
     end: number;
     start: number;
  };
  type: "quoted_comment";
})[] = IndexerAPICommentReferencesSchema;

References of the comment

data.comment.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date. On wire it is a ISO 8601 date and time string

event

event: "comment:edited";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  data: {
     comment: {
        id: `0x${string}`;
        moderationStatus: "approved" | "pending" | "rejected";
        moderationStatusChangedAt: Date;
     };
  };
  event: "comment:moderation:status:updated";
  uid: string;
  version: 1;
}

data

data: {
  comment: {
     id: `0x${string}`;
     moderationStatus: "approved" | "pending" | "rejected";
     moderationStatusChangedAt: Date;
  };
};

Data of the event

data.comment

comment: {
  id: `0x${string}`;
  moderationStatus: "approved" | "pending" | "rejected";
  moderationStatusChangedAt: Date;
};

Updated comment data

data.comment.id

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

ID of the comment

data.comment.moderationStatus

moderationStatus: "approved" | "pending" | "rejected" = CommentModerationStatusSchema;

Moderation status of the comment

data.comment.moderationStatusChangedAt

moderationStatusChangedAt: Date = ISO8601DateSchema;

Moderation status changed at date. On wire it is a ISO 8601 date and time string

event

event: "comment:moderation:status:updated";

Event type

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  data: {
     comment: {
        id: `0x${string}`;
        reactionCounts: Record<string, number>;
     };
  };
  event: "comment:reactions:updated";
  uid: string;
  version: 1;
}

data

data: {
  comment: {
     id: `0x${string}`;
     reactionCounts: Record<string, number>;
  };
};

Data of the event

data.comment

comment: {
  id: `0x${string}`;
  reactionCounts: Record<string, number>;
};

Updated comment data

data.comment.id

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

ID of the comment

data.comment.reactionCounts

reactionCounts: Record<string, number>;

Reaction counts

event

event: "comment:reactions:updated";

Event type

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  data: {
     comment: {
        id: `0x${string}`;
        references: (
           | {
           address: `0x${string}`;
           avatarUrl: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           type: "ens";
           url: string;
         }
           | {
           address: `0x${string}`;
           displayName: null | string;
           fid: number;
           fname: string;
           pfpUrl: null | string;
           position: {
              end: number;
              start: number;
           };
           type: "farcaster";
           url: string;
           username: string;
         }
           | {
           address: `0x${string}`;
           chainId: null | number;
           chains: {
              caip: string;
              chainId: number;
           }[];
           decimals: number;
           logoURI: null | string;
           name: string;
           position: {
              end: number;
              start: number;
           };
           symbol: string;
           type: "erc20";
         }
           | {
           description: null | string;
           favicon: null | string;
           mediaType: string;
           opengraph:   | null
              | {
              description: null | string;
              image: string;
              title: string;
              url: string;
            };
           position: {
              end: number;
              start: number;
           };
           title: string;
           type: "webpage";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "file";
           url: string;
         }
           | {
           dimension?: {
              height: number;
              width: number;
           };
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "image";
           url: string;
         }
           | {
           mediaType: string;
           position: {
              end: number;
              start: number;
           };
           type: "video";
           url: string;
           videoTracks?: {
              codec?: ... | ...;
              dimension: {
                 height: ...;
                 width: ...;
              };
           }[];
         }
           | {
           chainId: number;
           id: `0x${string}`;
           position: {
              end: number;
              start: number;
           };
           type: "quoted_comment";
        })[];
        referencesResolutionStatus: "pending" | "partial" | "success" | "failed";
        referencesResolutionStatusChangedAt: Date;
     };
  };
  event: "comment:references:updated";
  uid: string;
  version: 1;
}

data

data: {
  comment: {
     id: `0x${string}`;
     references: (
        | {
        address: `0x${string}`;
        avatarUrl: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        type: "ens";
        url: string;
      }
        | {
        address: `0x${string}`;
        displayName: null | string;
        fid: number;
        fname: string;
        pfpUrl: null | string;
        position: {
           end: number;
           start: number;
        };
        type: "farcaster";
        url: string;
        username: string;
      }
        | {
        address: `0x${string}`;
        chainId: null | number;
        chains: {
           caip: string;
           chainId: number;
        }[];
        decimals: number;
        logoURI: null | string;
        name: string;
        position: {
           end: number;
           start: number;
        };
        symbol: string;
        type: "erc20";
      }
        | {
        description: null | string;
        favicon: null | string;
        mediaType: string;
        opengraph:   | null
           | {
           description: null | string;
           image: string;
           title: string;
           url: string;
         };
        position: {
           end: number;
           start: number;
        };
        title: string;
        type: "webpage";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "file";
        url: string;
      }
        | {
        dimension?: {
           height: number;
           width: number;
        };
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "image";
        url: string;
      }
        | {
        mediaType: string;
        position: {
           end: number;
           start: number;
        };
        type: "video";
        url: string;
        videoTracks?: {
           codec?: ... | ...;
           dimension: {
              height: ...;
              width: ...;
           };
        }[];
      }
        | {
        chainId: number;
        id: `0x${string}`;
        position: {
           end: number;
           start: number;
        };
        type: "quoted_comment";
     })[];
     referencesResolutionStatus: "pending" | "partial" | "success" | "failed";
     referencesResolutionStatusChangedAt: Date;
  };
};

data.comment

comment: {
  id: `0x${string}`;
  references: (
     | {
     address: `0x${string}`;
     avatarUrl: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     type: "ens";
     url: string;
   }
     | {
     address: `0x${string}`;
     displayName: null | string;
     fid: number;
     fname: string;
     pfpUrl: null | string;
     position: {
        end: number;
        start: number;
     };
     type: "farcaster";
     url: string;
     username: string;
   }
     | {
     address: `0x${string}`;
     chainId: null | number;
     chains: {
        caip: string;
        chainId: number;
     }[];
     decimals: number;
     logoURI: null | string;
     name: string;
     position: {
        end: number;
        start: number;
     };
     symbol: string;
     type: "erc20";
   }
     | {
     description: null | string;
     favicon: null | string;
     mediaType: string;
     opengraph:   | null
        | {
        description: null | string;
        image: string;
        title: string;
        url: string;
      };
     position: {
        end: number;
        start: number;
     };
     title: string;
     type: "webpage";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "file";
     url: string;
   }
     | {
     dimension?: {
        height: number;
        width: number;
     };
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "image";
     url: string;
   }
     | {
     mediaType: string;
     position: {
        end: number;
        start: number;
     };
     type: "video";
     url: string;
     videoTracks?: {
        codec?: ... | ...;
        dimension: {
           height: ...;
           width: ...;
        };
     }[];
   }
     | {
     chainId: number;
     id: `0x${string}`;
     position: {
        end: number;
        start: number;
     };
     type: "quoted_comment";
  })[];
  referencesResolutionStatus: "pending" | "partial" | "success" | "failed";
  referencesResolutionStatusChangedAt: Date;
};

data.comment.id

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

data.comment.references

references: (
  | {
  address: `0x${string}`;
  avatarUrl: null | string;
  name: string;
  position: {
     end: number;
     start: number;
  };
  type: "ens";
  url: string;
}
  | {
  address: `0x${string}`;
  displayName: null | string;
  fid: number;
  fname: string;
  pfpUrl: null | string;
  position: {
     end: number;
     start: number;
  };
  type: "farcaster";
  url: string;
  username: string;
}
  | {
  address: `0x${string}`;
  chainId: null | number;
  chains: {
     caip: string;
     chainId: number;
  }[];
  decimals: number;
  logoURI: null | string;
  name: string;
  position: {
     end: number;
     start: number;
  };
  symbol: string;
  type: "erc20";
}
  | {
  description: null | string;
  favicon: null | string;
  mediaType: string;
  opengraph:   | null
     | {
     description: null | string;
     image: string;
     title: string;
     url: string;
   };
  position: {
     end: number;
     start: number;
  };
  title: string;
  type: "webpage";
  url: string;
}
  | {
  mediaType: string;
  position: {
     end: number;
     start: number;
  };
  type: "file";
  url: string;
}
  | {
  dimension?: {
     height: number;
     width: number;
  };
  mediaType: string;
  position: {
     end: number;
     start: number;
  };
  type: "image";
  url: string;
}
  | {
  mediaType: string;
  position: {
     end: number;
     start: number;
  };
  type: "video";
  url: string;
  videoTracks?: {
     codec?: ... | ...;
     dimension: {
        height: ...;
        width: ...;
     };
  }[];
}
  | {
  chainId: number;
  id: `0x${string}`;
  position: {
     end: number;
     start: number;
  };
  type: "quoted_comment";
})[] = IndexerAPICommentReferencesSchema;

data.comment.referencesResolutionStatus

referencesResolutionStatus: "pending" | "partial" | "success" | "failed";

data.comment.referencesResolutionStatusChangedAt

referencesResolutionStatusChangedAt: Date = ISO8601DateSchema;

event

event: "comment:references:updated";

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        chainId: number;
        createdAt: Date;
        description: string;
        hook: null | `0x${string}`;
        id: bigint;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        name: string;
        owner: `0x${string}`;
        updatedAt: Date;
     };
  };
  event: "channel:created";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  channel: {
     chainId: number;
     createdAt: Date;
     description: string;
     hook: null | `0x${string}`;
     id: bigint;
     metadata: {
        key: `0x${string}`;
        value: `0x${string}`;
     }[];
     name: string;
     owner: `0x${string}`;
     updatedAt: Date;
  };
};

Data of the event

data.channel

channel: {
  chainId: number;
  createdAt: Date;
  description: string;
  hook: null | `0x${string}`;
  id: bigint;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  name: string;
  owner: `0x${string}`;
  updatedAt: Date;
};

data.channel.chainId

chainId: number;

Chain ID where the channel was created

data.channel.createdAt

createdAt: Date = ISO8601DateSchema;

Created at date. On wire it is a ISO 8601 date and time string.

data.channel.description

description: string;

Description of the channel

data.channel.hook

hook: null | `0x${string}`;

Hook address

data.channel.id

id: bigint = StringBigintSchema;

ID of the channel. On wire it is a stringified bigint.

data.channel.metadata

metadata: {
  key: `0x${string}`;
  value: `0x${string}`;
}[] = MetadataArraySchema;

Metadata of the channel

data.channel.name

name: string;

Name of the channel

data.channel.owner

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

Owner address

data.channel.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date. On wire it is a ISO 8601 date and time string.

event

event: "channel:created";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        description: string;
        id: bigint;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        name: string;
        updatedAt: Date;
     };
  };
  event: "channel:updated";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  channel: {
     description: string;
     id: bigint;
     metadata: {
        key: `0x${string}`;
        value: `0x${string}`;
     }[];
     name: string;
     updatedAt: Date;
  };
};

Data of the event

data.channel

channel: {
  description: string;
  id: bigint;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  name: string;
  updatedAt: Date;
};

Updated channel data

data.channel.description

description: string;

Description of the channel

data.channel.id

id: bigint = StringBigintSchema;

ID of the channel

data.channel.metadata

metadata: {
  key: `0x${string}`;
  value: `0x${string}`;
}[] = MetadataArraySchema;

Metadata of the channel

data.channel.name

name: string;

Name of the channel

data.channel.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date

event

event: "channel:updated";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        hook: null | `0x${string}`;
        id: bigint;
        updatedAt: Date;
     };
     hook: {
        address: `0x${string}`;
        enabled: boolean;
     };
  };
  event: "channel:hook:status:updated";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  channel: {
     hook: null | `0x${string}`;
     id: bigint;
     updatedAt: Date;
  };
  hook: {
     address: `0x${string}`;
     enabled: boolean;
  };
};

Data of the event

data.channel

channel: {
  hook: null | `0x${string}`;
  id: bigint;
  updatedAt: Date;
};

Updated channel data

data.channel.hook

hook: null | `0x${string}`;

Hook address

data.channel.id

id: bigint = StringBigintSchema;

ID of the channel

data.channel.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date

data.hook

hook: {
  address: `0x${string}`;
  enabled: boolean;
};

Updated hook data

data.hook.address

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

Address of the hook

data.hook.enabled

enabled: boolean;

Enabled status

event

event: "channel:hook:status:updated";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        id: bigint;
        metadata: {
           key: `0x${string}`;
           value: `0x${string}`;
        }[];
        updatedAt: Date;
     };
     metadataOperation:   | {
        key: `0x${string}`;
        type: "delete";
      }
        | {
        key: `0x${string}`;
        type: "create";
        value: `0x${string}`;
      }
        | {
        key: `0x${string}`;
        type: "update";
        value: `0x${string}`;
      };
  };
  event: "channel:metadata:set";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  channel: {
     id: bigint;
     metadata: {
        key: `0x${string}`;
        value: `0x${string}`;
     }[];
     updatedAt: Date;
  };
  metadataOperation:   | {
     key: `0x${string}`;
     type: "delete";
   }
     | {
     key: `0x${string}`;
     type: "create";
     value: `0x${string}`;
   }
     | {
     key: `0x${string}`;
     type: "update";
     value: `0x${string}`;
   };
};

Data of the event

data.channel

channel: {
  id: bigint;
  metadata: {
     key: `0x${string}`;
     value: `0x${string}`;
  }[];
  updatedAt: Date;
};

Updated channel data

data.channel.id

id: bigint = StringBigintSchema;

ID of the channel

data.channel.metadata

metadata: {
  key: `0x${string}`;
  value: `0x${string}`;
}[] = MetadataArraySchema;

Metadata of the channel

data.channel.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date

data.metadataOperation

metadataOperation: 
  | {
  key: `0x${string}`;
  type: "delete";
}
  | {
  key: `0x${string}`;
  type: "create";
  value: `0x${string}`;
}
  | {
  key: `0x${string}`;
  type: "update";
  value: `0x${string}`;
} = MetadataSetOperationSchema;

Metadata operation

event

event: "channel:metadata:set";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     channel: {
        id: bigint;
        owner: `0x${string}`;
        updatedAt: Date;
     };
     from: `0x${string}`;
     to: `0x${string}`;
  };
  event: "channel:transferred";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  channel: {
     id: bigint;
     owner: `0x${string}`;
     updatedAt: Date;
  };
  from: `0x${string}`;
  to: `0x${string}`;
};

Data of the event

data.channel

channel: {
  id: bigint;
  owner: `0x${string}`;
  updatedAt: Date;
};

Updated channel data

data.channel.id

id: bigint = StringBigintSchema;

ID of the channel

data.channel.owner

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

Owner address

data.channel.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date

data.from

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

From address

data.to

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

To address

event

event: "channel:transferred";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     approval: {
        app: `0x${string}`;
        author: `0x${string}`;
        createdAt: Date;
        id: string;
        updatedAt: Date;
     };
  };
  event: "approval:added";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  approval: {
     app: `0x${string}`;
     author: `0x${string}`;
     createdAt: Date;
     id: string;
     updatedAt: Date;
  };
};

Data of the event

data.approval

approval: {
  app: `0x${string}`;
  author: `0x${string}`;
  createdAt: Date;
  id: string;
  updatedAt: Date;
};

Approval data

data.approval.app

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

App address

data.approval.author

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

Author address

data.approval.createdAt

createdAt: Date = ISO8601DateSchema;

Created at date. On wire it is a ISO 8601 date and time string.

data.approval.id

id: string;

ID of the approval

data.approval.updatedAt

updatedAt: Date = ISO8601DateSchema;

Updated at date. On wire it is a ISO 8601 date and time string.

event

event: "approval:added";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  blockNumber: bigint;
  chainId: number;
  data: {
     approval: {
        id: string;
     };
  };
  event: "approval:removed";
  logIndex: number;
  txHash: `0x${string}`;
  uid: string;
  version: 1;
}

blockNumber

blockNumber: bigint = StringBigintSchema;

Block number. On wire it is a stringified bigint.

chainId

chainId: number;

Chain ID

data

data: {
  approval: {
     id: string;
  };
};

Data of the event

data.approval

approval: {
  id: string;
};

Approval data

data.approval.id

id: string;

ID of the approval that was removed

event

event: "approval:removed";

Event type

logIndex

logIndex: number;

Log index

txHash

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

Transaction hash

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

{
  appId: string;
  data: {
     message: string;
  };
  event: "test";
  uid: string;
  version: 1;
  webhookId: string;
}

appId

appId: string;

App ID

data

data: {
  message: string;
};

Data of the event

data.message

message: string;

Message

event

event: "test";

Event type

uid

uid: string;

Unique identifier for the event. You can use it to deduplicate events. In case of retry attempts the id is the same.

version

version: 1;

Version of the event

webhookId

webhookId: string;

Webhook ID

The event.

Example

import { constructEvent } from "@ecp.eth/sdk/indexer/webhooks";
 
export async function POST(request: Request) {
  const event = constructEvent({
    appSecret: process.env.APP_SECRET,
    requestBody: await request.text(),
    requestSignature: request.headers.get("x-ecp-webhook-signature"),
    requestTimestamp: request.headers.get("x-ecp-webhook-timestamp"),
  });
 
  // ...
}

Throws

If the event signature is invalid.

Throws

If the request body is not valid JSON object.

Throws

If the event is invalid.