Skip to content

Commit

Permalink
Copy explorer URL for transaction (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholtzman authored Nov 29, 2021
1 parent 6dc3ab9 commit 4787642
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/App/Panel/Main/Account/Requests/TransactionRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ class TransactionRequest extends React.Component {
>
View Details
</div>
<div
className={req && req.tx && req.tx.hash ? 'txDetails txDetailsShow' : 'txDetails txDetailsHide'}
onMouseDown={() => {
if (req && req.tx && req.tx.hash) {
link.send('tray:copyExplorer', req.tx.hash, this.chain)
}
}}
>
Copy Details
</div>
<div className='txAugmentSpeedUp' onMouseDown={() => link.send('tray:replaceTx', req.handlerId, 'speed')}>
Speed Up
</div>
Expand Down
11 changes: 9 additions & 2 deletions main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 4787642

Please sign in to comment.