Skip to content

show contract webhooks as deprecated #7612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions apps/dashboard/src/@/api/insight/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ export interface WebhookFilters {
};
}

interface CreateWebhookPayload {
name: string;
webhook_url: string;
filters: WebhookFilters;
}

interface WebhooksListResponse {
data: WebhookResponse[];
error?: string;
Expand All @@ -57,56 +51,10 @@ interface WebhookSingleResponse {
error?: string;
}

interface TestWebhookPayload {
webhook_url: string;
type?: "event" | "transaction";
}

interface TestWebhookResponse {
success: boolean;
error?: string;
}

type SupportedWebhookChainsResponse =
| { chains: Array<number> }
| { error: string };

export async function createWebhook(
payload: CreateWebhookPayload,
clientId: string,
): Promise<WebhookSingleResponse> {
try {
const authToken = await getAuthToken();
const response = await fetch(
`https://${THIRDWEB_INSIGHT_API_DOMAIN}/v1/webhooks`,
{
body: JSON.stringify(payload),
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
"x-client-id": clientId,
},
method: "POST",
},
);

if (!response.ok) {
const errorText = await response.text();
return {
data: null,
error: `Failed to create webhook: ${errorText}`,
};
}

return (await response.json()) as WebhookSingleResponse;
} catch (error) {
return {
data: null,
error: `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
};
}
}

export async function getWebhooks(
clientId: string,
): Promise<WebhooksListResponse> {
Expand Down Expand Up @@ -174,42 +122,6 @@ export async function deleteWebhook(
}
}

export async function testWebhook(
payload: TestWebhookPayload,
clientId: string,
): Promise<TestWebhookResponse> {
try {
const authToken = await getAuthToken();
const response = await fetch(
`https://${THIRDWEB_INSIGHT_API_DOMAIN}/v1/webhooks/test`,
{
body: JSON.stringify(payload),
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
"x-client-id": clientId,
},
method: "POST",
},
);

if (!response.ok) {
const errorText = await response.text();
return {
error: `Failed to test webhook: ${errorText}`,
success: false,
};
}

return (await response.json()) as TestWebhookResponse;
} catch (error) {
return {
error: `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
success: false,
};
}
}

export async function getSupportedWebhookChains(): Promise<SupportedWebhookChainsResponse> {
try {
const response = await fetch(
Expand Down

This file was deleted.

Loading
Loading