From a2024213612cb80884c15f55f5f815755ca5a276 Mon Sep 17 00:00:00 2001 From: tuliomir Date: Thu, 4 Sep 2025 10:49:37 -0300 Subject: [PATCH 1/2] fix: type validation on fullnode event --- packages/daemon/src/types/event.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/daemon/src/types/event.ts b/packages/daemon/src/types/event.ts index 44c595c2..23f1a7c5 100644 --- a/packages/daemon/src/types/event.ts +++ b/packages/daemon/src/types/event.ts @@ -103,6 +103,7 @@ export const EventTxOutputSchema = z.object({ type: z.string(), address: z.string(), timelock: z.number().nullable(), + token_data: z.number().optional(), }).nullable(), z.object({}).strict() ]), From fb12c5a98f3fb058eab366b2d45d2db0ff16727a Mon Sep 17 00:00:00 2001 From: tuliomir Date: Thu, 4 Sep 2025 14:00:55 -0300 Subject: [PATCH 2/2] fix: validates token_data only decoded output --- packages/daemon/src/types/event.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/daemon/src/types/event.ts b/packages/daemon/src/types/event.ts index 23f1a7c5..cd6b76ba 100644 --- a/packages/daemon/src/types/event.ts +++ b/packages/daemon/src/types/event.ts @@ -99,12 +99,15 @@ export const EventTxOutputSchema = z.object({ script: z.string(), locked: z.boolean().optional(), decoded: z.union([ - z.object({ + z.object({ // Common case, with mandatory type and address type: z.string(), address: z.string(), timelock: z.number().nullable(), token_data: z.number().optional(), }).nullable(), + z.object({ // Some events have exclusively the token_data field + token_data: z.number(), + }).nullable(), z.object({}).strict() ]), });