Skip to content

Commit

Permalink
feat: add "Open In Explorer" button to Tx sent Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
JSKitty committed Nov 19, 2024
1 parent b53ea64 commit 1ecf474
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,20 @@ function subscribeToNetworkEvents() {

getEventEmitter().on('transaction-sent', (success, result) => {
if (success) {
// Prepare an Alert action function to open the TX in the explorer
const network = useNetwork();
const openTxExplorer = () =>
window.open(network.explorerUrl + '/tx/' + result, '_blank');

// Notify the user of their transaction
createAlert(
'success',
`${ALERTS.TX_SENT}<br>${sanitizeHTML(result)}`,
result ? 1250 + result.length * 50 : 3000
`<b>${ALERTS.TX_SENT}</b><br>${sanitizeHTML(
result.substring(0, 24)
)}...`,
15000,
'Open In Explorer',
openTxExplorer
);
} else {
debugError(DebugTopics.NET, 'Error sending transaction:');
Expand Down

0 comments on commit 1ecf474

Please sign in to comment.