Skip to content

Commit 90db465

Browse files
committed
nit: rename topic to type
1 parent ff533fd commit 90db465

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ describe.runIf(process.env.TW_SECRET_KEY)("Bridge.status", () => {
77
// TODO: flaky test
88
it.skip("should handle successful status", async () => {
99
const result = await status({
10-
chainId: 137,
10+
chainId: 8453,
1111
client: TEST_CLIENT,
1212
transactionHash:
13-
"0x5959b9321ec581640db531b80bac53cbd968f3d34fc6cb1d5f4ea75f26df2ad7",
13+
"0x8e8ab7c998bdfef6e10951c801a862373ce87af62c21fb870e62fca57683bf10",
1414
});
1515

1616
expect(result).toBeDefined();
@@ -46,7 +46,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Bridge.status", () => {
4646
chain: defineChain(8453),
4747
client: TEST_CLIENT,
4848
transactionHash:
49-
"0x06ac91479b3ea4c6507f9b7bff1f2d5f553253fa79af9a7db3755563b60f7dfb",
49+
"0x8e8ab7c998bdfef6e10951c801a862373ce87af62c21fb870e62fca57683bf10",
5050
});
5151

5252
expect(result).toBeDefined();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("parseIncomingWebhook", () => {
6464
],
6565
type: "transfer",
6666
},
67-
topic: "pay.onchain-transaction",
67+
type: "pay.onchain-transaction",
6868
version: 2,
6969
};
7070
const validPayload = {
@@ -158,7 +158,7 @@ describe("parseIncomingWebhook", () => {
158158
data: {
159159
someField: "value",
160160
},
161-
topic: "pay.onchain-transaction",
161+
type: "pay.onchain-transaction",
162162
version: 1,
163163
};
164164
const v1PayloadString = JSON.stringify(v1Payload);
@@ -585,7 +585,7 @@ describe("parseIncomingWebhook", () => {
585585

586586
it("should throw error for version 1 payload missing data object", async () => {
587587
const invalidPayload = {
588-
topic: "pay.onchain-transaction",
588+
type: "pay.onchain-transaction",
589589
version: 1,
590590
// no data field
591591
} as unknown as WebhookPayload;

packages/thirdweb/src/bridge/Webhook.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const tokenSchema = z.object({
2121
const onchainWebhookSchema = z.discriminatedUnion("version", [
2222
z.object({
2323
data: z.object({}),
24-
topic: z.literal("pay.onchain-transaction"),
24+
type: z.literal("pay.onchain-transaction"),
2525
version: z.literal(1),
2626
}),
2727
z.object({
@@ -49,15 +49,15 @@ const onchainWebhookSchema = z.discriminatedUnion("version", [
4949
),
5050
type: z.string(),
5151
}),
52-
topic: z.literal("pay.onchain-transaction"),
52+
type: z.literal("pay.onchain-transaction"),
5353
version: z.literal(2),
5454
}),
5555
]);
5656

5757
const onrampWebhookSchema = z.discriminatedUnion("version", [
5858
z.object({
5959
data: z.object({}),
60-
topic: z.literal("pay.onramp-transaction"),
60+
type: z.literal("pay.onramp-transaction"),
6161
version: z.literal(1),
6262
}),
6363
z.object({
@@ -75,12 +75,12 @@ const onrampWebhookSchema = z.discriminatedUnion("version", [
7575
token: tokenSchema,
7676
transactionHash: z.optional(hexSchema),
7777
}),
78-
topic: z.literal("pay.onramp-transaction"),
78+
type: z.literal("pay.onramp-transaction"),
7979
version: z.literal(2),
8080
}),
8181
]);
8282

83-
const webhookSchema = z.discriminatedUnion("topic", [
83+
const webhookSchema = z.discriminatedUnion("type", [
8484
onchainWebhookSchema,
8585
onrampWebhookSchema,
8686
]);

0 commit comments

Comments
 (0)