diff --git a/packages/webhook/sdk/src/event-types.ts b/packages/webhook/sdk/src/event-types.ts index 38d46eab40..26c6d2ab73 100644 --- a/packages/webhook/sdk/src/event-types.ts +++ b/packages/webhook/sdk/src/event-types.ts @@ -1,5 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ +import { imx } from '@imtbl/generated-clients'; + export interface BlockChainMetadata { log_index: string; block_number: string; @@ -344,3 +346,60 @@ export interface ZkevmTradeCreated { log_index_in_block: string; }; } + +export enum imxEventName { + imtbl_x_nft_created = '', + imtbl_x_nft_updated = '', + imtbl_x_order_accepted = '', + imtbl_x_order_filled = '', + imtbl_x_order_cancelled = 'imtbl_x_order_cancelled', + imtbl_x_transfer_created = 'imtbl_x_transfer_created', +} + +// imtbl_x_nft_created +export interface XNftCreated { + event_name: 'imtbl_x_nft_created'; + event_id: string; + chain: string; + data: imx.Asset; +} + +// imtbl_x_nft_updated +export interface XNftUpdated { + event_name: 'imtbl_x_nft_updated'; + event_id: string; + chain: string; + data: imx.Asset; +} + +// imtbl_x_order_accepted +export interface XOrderAccepted { + event_name: 'imtbl_x_order_accepted'; + event_id: string; + chain: string; + data: imx.Order; +} + +// imtbl_x_order_filled +export interface XOrderFilled { + event_name: 'imtbl_x_order_filled'; + event_id: string; + chain: string; + data: imx.Order; +} + +// imtbl_x_order_cancelled +export interface XOrderCancelled { + event_name: 'imtbl_x_order_cancelled'; + event_id: string; + chain: string; + data: imx.Order; +} + +// imtbl_x_transfer_created +export interface XTransferCreated { + event_name: 'imtbl_x_transfer_created'; + event_id: string; + chain: string; + data: imx.Transfer; +} diff --git a/packages/webhook/sdk/src/handler.ts b/packages/webhook/sdk/src/handler.ts index 508277f305..138a9cbbcc 100644 --- a/packages/webhook/sdk/src/handler.ts +++ b/packages/webhook/sdk/src/handler.ts @@ -1,7 +1,12 @@ import MessageValidator from 'sns-validator'; import { Environment } from '@imtbl/config'; -import { imx } from '@imtbl/generated-clients'; import { + XNftCreated, + XNftUpdated, + XOrderAccepted, + XOrderCancelled, + XOrderFilled, + XTransferCreated, ZkevmActivityBurn, ZkevmActivityDeposit, ZkevmActivityMint, ZkevmActivitySale, ZkevmActivityTransfer, ZkevmActivityWithdrawal, ZkevmCollectionUpdated, ZkevmMetadataUpdated, ZkevmMintRequestUpdated, ZkevmNftUpdated, ZkevmOrderUpdated, ZkevmTokenUpdated, @@ -29,12 +34,12 @@ export type WebhookHandlers = { zkEvmTokenUpdated?: (event: ZkevmTokenUpdated) => Promise; zkEvmOrderUpdated?: (event: ZkevmOrderUpdated) => Promise; zkEvmTradeCreated?: (event: ZkevmTradeCreated) => Promise; - xNftCreated?: (event: imx.Asset) => Promise; - xNftUpdated?: (event: imx.Asset) => Promise; - xOrderAccepted?: (event: imx.OrderV3) => Promise; - xOrderFilled?: (event: imx.OrderV3) => Promise; - xOrderCancelled?: (event: imx.OrderV3) => Promise; - xTransferCreated?: (event: imx.Transfer) => Promise; + xNftCreated?: (event: XNftCreated) => Promise; + xNftUpdated?: (event: XNftUpdated) => Promise; + xOrderAccepted?: (event: XOrderAccepted) => Promise; + xOrderFilled?: (event: XOrderFilled) => Promise; + xOrderCancelled?: (event: XOrderCancelled) => Promise; + xTransferCreated?: (event: XTransferCreated) => Promise; all?: (event: any) => Promise; };