diff --git a/apps/alchemy/src/create.ts b/apps/alchemy/src/create.ts index 7b5629cc..9527522b 100644 --- a/apps/alchemy/src/create.ts +++ b/apps/alchemy/src/create.ts @@ -2,25 +2,29 @@ import { Alchemy, Network, WebhookType } from 'alchemy-sdk' import { appConfig } from './config' async function createAddressActivityNotification() { - const settings = { - authToken: appConfig.alchemyNotifyToken, - network: Network.MATIC_MAINNET, // Replace with your network. - } + try { + const settings = { + authToken: appConfig.alchemyNotifyToken, + network: Network.MATIC_MAINNET, // Replace with your network. + } - const alchemy = new Alchemy(settings) - const addressActivityWebhook = await alchemy.notify.createWebhook( - appConfig.alchemyActivityWebhookUrl, - WebhookType.ADDRESS_ACTIVITY, - { - addresses: [appConfig.presaleAddress], - network: Network.MATIC_MAINNET, - }, - ) - console.log('Address Activity Webhook Details:') - console.log(JSON.stringify(addressActivityWebhook, null, 2)) - console.log( - 'Alchemy Notify address activity notification created, go to https://dashboard.alchemy.com/notify to see details of your custom hook.', - ) + const alchemy = new Alchemy(settings) + const addressActivityWebhook = await alchemy.notify.createWebhook( + appConfig.alchemyActivityWebhookUrl, + WebhookType.ADDRESS_ACTIVITY, + { + addresses: [appConfig.presaleAddress], + network: Network.MATIC_MAINNET, + }, + ) + console.log('Address Activity Webhook Details:') + console.log(JSON.stringify(addressActivityWebhook, null, 2)) + console.log( + 'Alchemy Notify address activity notification created, go to https://dashboard.alchemy.com/notify to see details of your custom hook.', + ) + } catch (error) { + console.error('Failed to create address activity notification:', error) + } } createAddressActivityNotification()