Commit 89fe7832 authored by zeroleak's avatar zeroleak
Browse files

add utxo.address

parent 8b72d555
......@@ -11,12 +11,12 @@
line-height: 1em !important;
}
th.clipboard {
width: 20px;
th.hash {
width: 100px;
}
th.hash {
width: 190px;
th.address {
width: 100px;
}
th.path {
......@@ -27,7 +27,11 @@ th.account {
width: 70px;
}
th.confirmations, th.value, th.poolId, th.mixsDone, th.utxoStatus {
th.confirmations {
width:60px;
}
th.value, th.poolId, th.mixsDone, th.utxoStatus {
width: 95px;
}
......@@ -90,7 +94,7 @@ td.utxoMessage {
outline: none;
}
.table-utxos tbody tr:hover .clipboard-icon {
.table-utxos tbody tr td:hover .clipboard-icon {
visibility: visible;
}
......
......@@ -74,7 +74,6 @@ const UtxosTable = ({ controls, account, utxos }) => {
<table className="table table-sm table-hover">
<thead>
<tr>
<th scope="col" className='clipboard'/>
{account && <th scope="col" className='account'>
<a onClick={() => handleSetSort('account')}>
Account {renderSort('account')}
......@@ -85,6 +84,11 @@ const UtxosTable = ({ controls, account, utxos }) => {
UTXO {renderSort('hash')}
</a>
</th>
<th scope="col" className='address'>
<a onClick={() => handleSetSort('address')}>
Address {renderSort('address')}
</a>
</th>
<th scope="col" className='path'>
<a onClick={() => handleSetSort('path')}>
Path {renderSort('path')}
......@@ -92,7 +96,7 @@ const UtxosTable = ({ controls, account, utxos }) => {
</th>
<th scope="col" className='confirmations'>
<a onClick={() => handleSetSort('confirmations')}>
Confirms {renderSort('confirmations')}
Confs {renderSort('confirmations')}
</a>
</th>
<th scope="col" className='value'>
......@@ -131,32 +135,45 @@ const UtxosTable = ({ controls, account, utxos }) => {
return (
<tr key={i} className={utxoReadOnly ? 'utxo-disabled' : ''}>
<td>
<span title='Copy TX ID'>
<Icon.Clipboard
className='clipboard-icon'
tabIndex={0}
size={18}
onClick={() => copyToClipboard(utxo.hash)}
/>
</span>
</td>
{account && <td><small>{utxo.account}</small></td>}
<td>
<small>
<span title={utxo.hash + ':' + utxo.index}>
<LinkExternal href={utils.linkExplorer(utxo)}>
{utxo.hash.substring(0, 20)}...{utxo.hash.substring(utxo.hash.length - 5)}:{utxo.index}
{utils.shorten(utxo.hash)}:{utxo.index}
</LinkExternal>
</span>{' '}
<span title='Copy TXID'>
<Icon.Clipboard
className='clipboard-icon'
size={18}
onClick={() => copyToClipboard(utxo.hash)}
/>
</span>
</small>
</td>
<td>
<small>
<span title={utxo.address}>
<LinkExternal href={utils.linkExplorerAddress(utxo)}>
{utils.shorten(utxo.address)}
</LinkExternal>
</span>{' '}
<span title='Copy address'>
<Icon.Clipboard
className='clipboard-icon'
size={18}
onClick={() => copyToClipboard(utxo.address)}
/>
</span>
</small>
</td>
<td>
<small>{utxo.path}</small>
<small className='text-muted'>{utxo.path}</small>
</td>
<td>
<small>{utxo.confirmations > 0 ? (
<span title="confirmations">{utxo.confirmations}</span>
<span title="confirmations" className='text-muted'>{utxo.confirmations}</span>
) : (
<strong>unconfirmed</strong>
)}
......
......@@ -3,6 +3,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import * as Icons from '@fortawesome/free-solid-svg-icons';
import * as React from 'react';
import { shell } from 'electron';
import LinkExternal from '../components/Utils/LinkExternal';
const AMOUNT_PRECISION = 4
const BTC_TO_SAT = 100000000
......@@ -106,6 +107,13 @@ class Utils {
return 'https://oxt.me/transaction/'+utxo.hash
}
linkExplorerAddress(utxo) {
if (cliService.isTestnet()) {
return 'https://blockstream.info/testnet/address/'+utxo.address
}
return 'https://oxt.me/address/'+utxo.address
}
statusIcon(utxo) {
if (utxo.status === UTXO_STATUS.MIX_STARTED) {
......@@ -222,6 +230,14 @@ class Utils {
checkedIcon(checked) {
return <FontAwesomeIcon icon={checked?Icons.faCheck:Icons.faTimes} color={checked?'green':'red'} />
}
shorten(str) {
const len = str.length
if (len < 10) {
return str
}
return str.substring(0, 5)+'...'+str.substring(len - 3)
}
}
const utils = new Utils()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment