@@ -41,12 +41,6 @@ export interface WebhookFilters {
41
41
} ;
42
42
}
43
43
44
- interface CreateWebhookPayload {
45
- name : string ;
46
- webhook_url : string ;
47
- filters : WebhookFilters ;
48
- }
49
-
50
44
interface WebhooksListResponse {
51
45
data : WebhookResponse [ ] ;
52
46
error ?: string ;
@@ -57,56 +51,10 @@ interface WebhookSingleResponse {
57
51
error ?: string ;
58
52
}
59
53
60
- interface TestWebhookPayload {
61
- webhook_url : string ;
62
- type ?: "event" | "transaction" ;
63
- }
64
-
65
- interface TestWebhookResponse {
66
- success : boolean ;
67
- error ?: string ;
68
- }
69
-
70
54
type SupportedWebhookChainsResponse =
71
55
| { chains : Array < number > }
72
56
| { error : string } ;
73
57
74
- export async function createWebhook (
75
- payload : CreateWebhookPayload ,
76
- clientId : string ,
77
- ) : Promise < WebhookSingleResponse > {
78
- try {
79
- const authToken = await getAuthToken ( ) ;
80
- const response = await fetch (
81
- `https://${ THIRDWEB_INSIGHT_API_DOMAIN } /v1/webhooks` ,
82
- {
83
- body : JSON . stringify ( payload ) ,
84
- headers : {
85
- Authorization : `Bearer ${ authToken } ` ,
86
- "Content-Type" : "application/json" ,
87
- "x-client-id" : clientId ,
88
- } ,
89
- method : "POST" ,
90
- } ,
91
- ) ;
92
-
93
- if ( ! response . ok ) {
94
- const errorText = await response . text ( ) ;
95
- return {
96
- data : null ,
97
- error : `Failed to create webhook: ${ errorText } ` ,
98
- } ;
99
- }
100
-
101
- return ( await response . json ( ) ) as WebhookSingleResponse ;
102
- } catch ( error ) {
103
- return {
104
- data : null ,
105
- error : `Network or parsing error: ${ error instanceof Error ? error . message : "Unknown error" } ` ,
106
- } ;
107
- }
108
- }
109
-
110
58
export async function getWebhooks (
111
59
clientId : string ,
112
60
) : Promise < WebhooksListResponse > {
@@ -174,42 +122,6 @@ export async function deleteWebhook(
174
122
}
175
123
}
176
124
177
- export async function testWebhook (
178
- payload : TestWebhookPayload ,
179
- clientId : string ,
180
- ) : Promise < TestWebhookResponse > {
181
- try {
182
- const authToken = await getAuthToken ( ) ;
183
- const response = await fetch (
184
- `https://${ THIRDWEB_INSIGHT_API_DOMAIN } /v1/webhooks/test` ,
185
- {
186
- body : JSON . stringify ( payload ) ,
187
- headers : {
188
- Authorization : `Bearer ${ authToken } ` ,
189
- "Content-Type" : "application/json" ,
190
- "x-client-id" : clientId ,
191
- } ,
192
- method : "POST" ,
193
- } ,
194
- ) ;
195
-
196
- if ( ! response . ok ) {
197
- const errorText = await response . text ( ) ;
198
- return {
199
- error : `Failed to test webhook: ${ errorText } ` ,
200
- success : false ,
201
- } ;
202
- }
203
-
204
- return ( await response . json ( ) ) as TestWebhookResponse ;
205
- } catch ( error ) {
206
- return {
207
- error : `Network or parsing error: ${ error instanceof Error ? error . message : "Unknown error" } ` ,
208
- success : false ,
209
- } ;
210
- }
211
- }
212
-
213
125
export async function getSupportedWebhookChains ( ) : Promise < SupportedWebhookChainsResponse > {
214
126
try {
215
127
const response = await fetch (
0 commit comments