Skip to content

Commit 8d115d2

Browse files
committed
[thirdweb] Fix webhook transaction schema parsing
1 parent ac4ade6 commit 8d115d2

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

.changeset/calm-pets-post.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
fix webhook parsing

packages/thirdweb/src/bridge/Webhook.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,14 @@ describe("parseIncomingWebhook", () => {
5252
receiver: "0x1234567890123456789012345678901234567890",
5353
type: "transfer",
5454
transactions: [
55-
"0x1234567890123456789012345678901234567890",
56-
"0x1234567890123456789012345678901234567890",
55+
{
56+
chainId: 1,
57+
transactionHash: "0x1234567890123456789012345678901234567890",
58+
},
59+
{
60+
chainId: 1,
61+
transactionHash: "0x1234567890123456789012345678901234567890",
62+
},
5763
],
5864
developerFeeBps: 100,
5965
developerFeeRecipient: "0x1234567890123456789012345678901234567890",

packages/thirdweb/src/bridge/Webhook.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ const webhookSchema = z.union([
4646
sender: addressSchema,
4747
receiver: addressSchema,
4848
type: z.string(),
49-
transactions: z.array(hexSchema),
49+
transactions: z.array(
50+
z.object({
51+
chainId: z.coerce.number(),
52+
transactionHash: hexSchema,
53+
}),
54+
),
5055
developerFeeBps: z.coerce.number(),
5156
developerFeeRecipient: addressSchema,
5257
purchaseData: z.record(z.string(), z.unknown()),

0 commit comments

Comments
 (0)