From c2f5882c98cac9889cac0a31d485739f7abf1460 Mon Sep 17 00:00:00 2001 From: Matt Holtzman Date: Tue, 23 Nov 2021 10:27:04 -0500 Subject: [PATCH] copy explorer URL for transaction --- .../Main/Account/Requests/TransactionRequest/index.js | 10 ++++++++++ main/index.js | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/App/Panel/Main/Account/Requests/TransactionRequest/index.js b/app/App/Panel/Main/Account/Requests/TransactionRequest/index.js index 288d57994..b61a639a7 100644 --- a/app/App/Panel/Main/Account/Requests/TransactionRequest/index.js +++ b/app/App/Panel/Main/Account/Requests/TransactionRequest/index.js @@ -326,6 +326,16 @@ class TransactionRequest extends React.Component { > View Details +
{ + if (req && req.tx && req.tx.hash) { + link.send('tray:copyExplorer', req.tx.hash, this.chain) + } + }} + > + Copy Details +
link.send('tray:replaceTx', req.handlerId, 'speed')}> Speed Up
diff --git a/main/index.js b/main/index.js index 4f4a5de0c..cb575af41 100644 --- a/main/index.js +++ b/main/index.js @@ -125,8 +125,15 @@ ipcMain.on('tray:openExternal', (e, url) => { }) ipcMain.on('tray:openExplorer', (e, hash, chain) => { - const explorer = store('main.networks', chain.type, chain.id, 'explorer') - shell.openExternal(explorer + '/tx/' + hash) + // remove trailing slashes from the base url + const explorer = (store('main.networks', chain.type, chain.id, 'explorer') || '').replace(/\/+$/, '') + shell.openExternal(`${explorer}/tx/${hash}`) +}) + +ipcMain.on('tray:copyExplorer', (e, hash, chain) => { + // remove trailing slashes from the base url + const explorer = (store('main.networks', chain.type, chain.id, 'explorer') || '').replace(/\/+$/, '') + clipboard.writeText(explorer + '/tx/' + hash) }) ipcMain.on('tray:giveAccess', (e, req, access) => {