Skip to content

Commit

Permalink
chore: add try catch
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
gaboesquivel and coderabbitai[bot] authored Aug 23, 2024
1 parent 5034075 commit 56aab01
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions apps/alchemy/src/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 56aab01

Please sign in to comment.