Commit 98a5635d authored by zeroleak's avatar zeroleak
Browse files

cleanup

parent 813ec0f6
...@@ -101,7 +101,7 @@ export default function Tx0Modal(props) { ...@@ -101,7 +101,7 @@ export default function Tx0Modal(props) {
<div className='row'> <div className='row'>
<div className='col-sm-6'> <div className='col-sm-6'>
Tx0 miner fee: {tx0Preview && <strong>{utils.toBtc(tx0Preview.tx0MinerFee)} btc</strong>} Tx0 miner fee: {tx0Preview && <span><strong>{utils.toBtc(tx0Preview.tx0MinerFee)} btc</strong> <small className='text-muted'> · {tx0Preview.tx0MinerFeePrice} sats/b</small></span>}
<select className="form-control" onChange={e => setTx0FeeTarget(e.target.value)} defaultValue={tx0FeeTarget}> <select className="form-control" onChange={e => setTx0FeeTarget(e.target.value)} defaultValue={tx0FeeTarget}>
{Object.keys(TX0_FEE_TARGET).map(feeTargetKey => { {Object.keys(TX0_FEE_TARGET).map(feeTargetKey => {
const feeTargetItem = TX0_FEE_TARGET[feeTargetKey] const feeTargetItem = TX0_FEE_TARGET[feeTargetKey]
...@@ -112,7 +112,7 @@ export default function Tx0Modal(props) { ...@@ -112,7 +112,7 @@ export default function Tx0Modal(props) {
</div> </div>
<div className='col-sm-6'> <div className='col-sm-6'>
Mix miner fee contribution: {tx0Preview && <strong>{tx0Preview.nbPremix} x {utils.toBtc(tx0Preview.premixMinerFee)} btc = {utils.toBtc(tx0Preview.mixMinerFee)} btc</strong>} Mix miner fee contribution: {tx0Preview && <span><strong>{tx0Preview.nbPremix} x {utils.toBtc(tx0Preview.premixMinerFee)} btc = {utils.toBtc(tx0Preview.mixMinerFee)} btc</strong> <small className='text-muted'> · {tx0Preview.mixMinerFeePrice} sats/b</small></span>}
<select className="form-control" onChange={e => setMixFeeTarget(e.target.value)} defaultValue={mixFeeTarget}> <select className="form-control" onChange={e => setMixFeeTarget(e.target.value)} defaultValue={mixFeeTarget}>
{Object.keys(TX0_FEE_TARGET).map(feeTargetKey => { {Object.keys(TX0_FEE_TARGET).map(feeTargetKey => {
const feeTargetItem = TX0_FEE_TARGET[feeTargetKey] const feeTargetItem = TX0_FEE_TARGET[feeTargetKey]
......
/**
*
* Status
*
*/
import React from 'react';
import mixService from '../../services/mixService';
import { WHIRLPOOL_ACCOUNTS } from '../../services/utils';
import { Dropdown, DropdownButton } from 'react-bootstrap';
/* eslint-disable react/prefer-stateless-function */
class UtxoPoolSelector extends React.PureComponent {
computePoolLabel(poolId) {
return poolId ? poolId : 'none'
}
render () {
const utxo = this.props.utxo
const pools = mixService.getPoolsForUtxo(utxo);
if (pools.length == 0) {
// no pool
return <span className='text-muted'>-</span>
}
const activeLabel = this.computePoolLabel(utxo.poolId)
if (pools.length < 2 && (!this.props.noPool || !utxo.poolId)) {
// single choice available
return <span>{activeLabel}</span>
}
return (
<DropdownButton size='sm' variant="default" title={activeLabel} className='utxoPoolSelector'>
{pools.map((pool,i) => {
const poolLabel = this.computePoolLabel(pool.poolId)
return <Dropdown.Item key={i} active={utxo.poolId === pool.poolId} onClick={() => mixService.setPoolId(utxo, pool.poolId)}>{poolLabel}</Dropdown.Item>
})}
{(this.props.noPool || !utxo.poolId) && <Dropdown.Divider />}
{(this.props.noPool || !utxo.poolId) && <Dropdown.Item active={!utxo.poolId} onClick={() => mixService.setPoolId(utxo, undefined)}>{this.computePoolLabel(undefined)}</Dropdown.Item>}
</DropdownButton>
)
}
}
export default UtxoPoolSelector
...@@ -9,10 +9,9 @@ import mixService from '../../services/mixService'; ...@@ -9,10 +9,9 @@ import mixService from '../../services/mixService';
import * as Icon from 'react-feather'; import * as Icon from 'react-feather';
import utils, { MIXABLE_STATUS, UTXO_STATUS, WHIRLPOOL_ACCOUNTS } from '../../services/utils'; import utils, { MIXABLE_STATUS, UTXO_STATUS, WHIRLPOOL_ACCOUNTS } from '../../services/utils';
import LinkExternal from '../Utils/LinkExternal'; import LinkExternal from '../Utils/LinkExternal';
import UtxoPoolSelector from './UtxoPoolSelector';
import modalService from '../../services/modalService'; import modalService from '../../services/modalService';
import * as Icons from '@fortawesome/free-solid-svg-icons'; import * as Icons from '@fortawesome/free-solid-svg-icons';
import {FormCheck} from 'react-bootstrap'; import { FormCheck } from 'react-bootstrap';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import TableGeneric from '../TableGeneric/TableGeneric'; import TableGeneric from '../TableGeneric/TableGeneric';
...@@ -80,7 +79,7 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => { ...@@ -80,7 +79,7 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
<Icon.Clipboard <Icon.Clipboard
className='clipboard-icon' className='clipboard-icon'
size={18} size={18}
onClick={() => copyToClipboard(utxo.address)} onClick={() => utils.copyToClipboard(utxo.address)}
/> />
</span> </span>
</small> </small>
......
...@@ -116,7 +116,7 @@ class InitPage extends Component<Props> { ...@@ -116,7 +116,7 @@ class InitPage extends Component<Props> {
<p>This will connect Whirlpool to Samourai Wallet.</p> <p>This will connect Whirlpool to Samourai Wallet.</p>
{this.state.cliUrl && <div><FontAwesomeIcon icon={Icons.faCheck} color='green' /> Connected to whirlpool-cli: <strong>{this.state.cliLocal ? 'standalone' : this.state.cliUrl}</strong></div>} {this.state.cliUrl && <div><FontAwesomeIcon icon={Icons.faCheck} color='green' /> Connected to whirlpool-cli: <strong>{this.state.cliLocal ? 'standalone' : this.state.cliUrl}</strong></div>}
{this.state.hasPairingPayload && <div><FontAwesomeIcon icon={Icons.faCheck} color='green' /> Ready to pair with Samourai Wallet</div>} {this.state.hasPairingPayload && <div><FontAwesomeIcon icon={Icons.faCheck} color='green' /> Pairing with Samourai Wallet</div>}
{this.state.step === STEP_LAST && <div><FontAwesomeIcon icon={Icons.faCheck} color='green' /> Configuration saved</div>} {this.state.step === STEP_LAST && <div><FontAwesomeIcon icon={Icons.faCheck} color='green' /> Configuration saved</div>}
<br/> <br/>
......
...@@ -157,10 +157,6 @@ code { ...@@ -157,10 +157,6 @@ code {
width: 100%; width: 100%;
} }
.utxoPoolSelector .dropdown-item {
padding: 0 0.4em;
}
.table-utxos .dropdown .btn { .table-utxos .dropdown .btn {
padding:0; padding:0;
} }
......
...@@ -180,13 +180,6 @@ class BackendService { ...@@ -180,13 +180,6 @@ class BackendService {
}; };
utxo = { utxo = {
configure: (hash, index, poolId) => {
return this.withStatus('Utxo', 'Configure utxo', () =>
this.fetchBackendAsJson('/rest/utxos/'+hash+':'+index, 'POST', {
poolId: poolId
})
)
},
startMix: (hash, index) => { startMix: (hash, index) => {
return this.withStatus('Utxo', 'Start mixing', () => return this.withStatus('Utxo', 'Start mixing', () =>
this.fetchBackend('/rest/utxos/'+hash+':'+index+'/startMix', 'POST') this.fetchBackend('/rest/utxos/'+hash+':'+index+'/startMix', 'POST')
......
...@@ -70,15 +70,6 @@ class MixService { ...@@ -70,15 +70,6 @@ class MixService {
&& this.getPoolsForTx0(utxo).length > 0 && this.getPoolsForTx0(utxo).length > 0
} }
setPoolId(utxo, poolId) {
utxo.poolId = poolId
return this.configure(utxo)
}
configure(utxo) {
return backendService.utxo.configure(utxo.hash, utxo.index, utxo.poolId).then(() => walletService.fetchState())
}
tx0(utxos, tx0FeeTarget, mixFeeTarget, poolId) { tx0(utxos, tx0FeeTarget, mixFeeTarget, poolId) {
return backendService.tx0.tx0(utxos, tx0FeeTarget, mixFeeTarget, poolId).then(() => walletService.fetchState()) return backendService.tx0.tx0(utxos, tx0FeeTarget, mixFeeTarget, poolId).then(() => walletService.fetchState())
} }
......
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