Skip to content

Commit

Permalink
fix: handle error when provider is not set up
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Jan 30, 2024
1 parent ea51443 commit 6fde28a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/providers/walletconnectNotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,22 @@ function formatMessage(event: Event, proposal) {
}

export async function send(event: Event, proposal, addresses: string[]) {
if (!isConfigured()) {
console.log('[WalletConnect] Sending skipped: client not setup');
}
if (event.event !== 'proposal/start') return;
const notificationMessage = formatMessage(event, proposal);

const accounts = addresses.map(address => `eip155:1:${address}`);

await queueNotificationsToSend(notificationMessage, accounts);
}

function isConfigured() {
return (
WALLETCONNECT_NOTIFY_SERVER_URL &&
WALLETCONNECT_PROJECT_SECRET &&
WALLETCONNECT_PROJECT_ID &&
WALLETCONNECT_NOTIFICATION_TYPE
);
}

0 comments on commit 6fde28a

Please sign in to comment.