Browse Source

Merge pull request #5 from SuperNETorg/v0.25

12 new spv coins, send form reset on coin change
v0.25
pbca26 7 years ago
committed by GitHub
parent
commit
4896909bae
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      react/src/assets/images/cryptologo/bch.png
  2. BIN
      react/src/assets/images/cryptologo/btg.png
  3. 72
      react/src/components/addcoin/addcoinOptionsCrypto.js
  4. 19
      react/src/components/dashboard/sendCoin/sendCoin.js
  5. 4
      react/src/components/dashboard/sendCoin/sendCoin.render.js
  6. 17
      react/src/components/dashboard/walletsNav/walletsNav.render.js
  7. 2
      react/src/components/overrides.scss
  8. 4
      react/src/translate/en.js
  9. 83
      react/src/util/coinHelper.js

BIN
react/src/assets/images/cryptologo/bch.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
react/src/assets/images/cryptologo/btg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

72
react/src/components/addcoin/addcoinOptionsCrypto.js

@ -4,7 +4,7 @@ import mainWindow from '../../util/mainWindow';
const addCoinOptionsCrypto = () => {
const availableKMDModes = mainWindow.arch === 'x64' ? 'spv|native' : 'spv';
return [{
let _coins = [{
label: 'Komodo (KMD)',
icon: 'KMD',
value: `KMD|${availableKMDModes}`,
@ -14,6 +14,76 @@ const addCoinOptionsCrypto = () => {
icon: 'CHIPS',
value: `CHIPS|spv`,
}];
if (mainWindow.argv.indexOf('spvcoins=all') > -1) {
_coins.push(/*{
label: 'BitcoinGold (BTG)',
icon: 'BTG',
value: `BTG|spv`,
}, {
label: 'BitcoinCash (BCH)',
icon: 'BCH',
value: `BCH|spv`,
}, {
label: 'Bitcoin (BTC)',
icon: 'BTC',
value: `BTC|spv`,
}, */{
label: 'Crown (CRW)',
icon: 'CRW',
value: `CRW|spv`,
}, {
label: 'Dash (DASH)',
icon: 'DASH',
value: `DASH|spv`,
}, {
label: 'DigiByte (DGB)',
icon: 'DGB',
value: `DGB|spv`,
}, {
label: 'Faircoin (FAIR)',
icon: 'FAIR',
value: `FAIR|spv`,
}, {
label: 'Argentum (ARG)',
icon: 'ARG',
value: `ARG|spv`,
}, {
label: 'Litecoin (LTC)',
icon: 'LTC',
value: `LTC|spv`,
}, {
label: 'Monacoin (MONA)',
icon: 'MONA',
value: `MONA|spv`,
}, {
label: 'Namecoin (NMC)',
icon: 'NMC',
value: `NMC|spv`,
}, {
label: 'Vertcoin (VTC)',
icon: 'VTC',
value: `VTC|spv`,
}, {
label: 'Viacoin (VIA)',
icon: 'VIA',
value: `VIA|spv`,
}, {
label: 'Sibcoin (SIB)',
icon: 'SIB',
value: `SIB|spv`,
},/* {
label: 'Blackcoin (BLK)',
icon: 'BLK',
value: `BLK|spv`,
}, */{
label: 'Dogecoin (DOGE)',
icon: 'DOGE',
value: `DOGE|spv`,
});
}
return _coins;
}
export default addCoinOptionsCrypto;

19
react/src/components/dashboard/sendCoin/sendCoin.js

@ -20,6 +20,7 @@ import {
_SendFormRender
} from './sendCoin.render';
import { isPositiveNumber } from '../../../util/number';
import mainWindow from '../../../util/mainWindow';
// TODO: - add links to explorers
// - render z address trim
@ -111,6 +112,10 @@ class SendCoin extends React.Component {
}
componentWillReceiveProps(props) {
if (this.props.ActiveCoin.coin !== props.ActiveCoin.coin &&
this.props.ActiveCoin.lastSendToResponse) {
Store.dispatch(clearLastSendToResponseState());
}
this.checkZAddressCount(props);
}
@ -488,11 +493,21 @@ class SendCoin extends React.Component {
const _amount = this.state.amount;
const _amountSats = this.state.amount * 100000000;
const _balanceSats = this.props.ActiveCoin.balance.balanceSats;
const _fees = mainWindow.spvFees;
if (Number(_amountSats) + 10000 > _balanceSats) {
if (Number(_amountSats) + _fees[this.props.ActiveCoin.coin] > _balanceSats) {
Store.dispatch(
triggerToaster(
`${translate('SEND.INSUFFICIENT_FUNDS')} max available balance is ${(0.00000001 * (_balanceSats - _fees[this.props.ActiveCoin.coin])).toFixed(8)} ${this.props.ActiveCoin.coin}`,
translate('TOASTR.WALLET_NOTIFICATION'),
'error'
)
);
valid = false;
} else if (Number(_amountSats) < _fees[this.props.ActiveCoin.coin]) {
Store.dispatch(
triggerToaster(
`${translate('SEND.INSUFFICIENT_FUNDS')} max available balance is ${(0.00000001 * (_balanceSats - 10000)).toFixed(8)} ${this.props.ActiveCoin.coin}`,
`Amount ${this.state.amount} is too small, min ${this.props.ActiveCoin.coin} amount is ${_fees[this.props.ActiveCoin.coin] * 0.00000001}`,
translate('TOASTR.WALLET_NOTIFICATION'),
'error'
)

4
react/src/components/dashboard/sendCoin/sendCoin.render.js

@ -1,6 +1,7 @@
import React from 'react';
import { translate } from '../../../translate/translate';
import QRModal from '../qrModal/qrModal';
import { isKomodoCoin } from '../../../util/coinHelper';
export const AddressListRender = function() {
return (
@ -293,6 +294,7 @@ export const SendRender = function() {
this.state.lastSendToResponse &&
this.state.lastSendToResponse.txid) ||
(this.props.ActiveCoin.mode === 'native' && this.state.lastSendToResponse && this.state.lastSendToResponse.length === 64)) &&
isKomodoCoin(this.props.ActiveCoin.coin) &&
<div className="margin-top-10">
<button
type="button"
@ -315,7 +317,7 @@ export const SendRender = function() {
this.state.lastSendToResponse.msg === 'error' &&
<div className="padding-left-30 padding-top-10">
<div>
<strong>{ translate('API.ERROR_SM') }</strong>
<strong className="text-capitalize">{ translate('API.ERROR_SM') }</strong>
</div>
<div>{ this.state.lastSendToResponse.result }</div>
</div>

17
react/src/components/dashboard/walletsNav/walletsNav.render.js

@ -53,13 +53,16 @@ export const WalletsNavWithWalletRender = function() {
onClick={ this.toggleNativeWalletTransactions }>
<i className="icon md-view-dashboard"></i> { translate('INDEX.TRANSACTIONS') }
</button>
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ () => this.toggleSendCoinForm(!this.props.ActiveCoin.send) }
disabled={ this.checkTotalBalance() <= 0 }>
<i className="icon fa-send"></i> { translate('INDEX.SEND') }
</button>
{ this.props.ActiveCoin &&
this.props.ActiveCoin.coin !== 'BTC' &&
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ () => this.toggleSendCoinForm(!this.props.ActiveCoin.send) }
disabled={ this.checkTotalBalance() <= 0 }>
<i className="icon fa-send"></i> { translate('INDEX.SEND') }
</button>
}
<button
type="button"
className="btn btn-success waves-effect waves-light"

2
react/src/components/overrides.scss

@ -233,7 +233,7 @@ input:checked + .slider:before {
.coin-logo {
&.breadcrumb {
z-index: 100;
z-index: 99;
}
}
.breadcrumb > li + li:before {

4
react/src/translate/en.js

@ -408,7 +408,7 @@ export const _lang = {
'FIND_DEPOSIT_ADDR': 'There find your Deposit Address for coin you want to anonymise your funds. (For a start only KMD is supported. BTC support will come in later versions)',
'YOU_SEND_FUNDS': 'You send your funds to deposit address.',
'KEEP_WALLET_OPEN': 'Keep your wallet open',
'IMPORTANT_FUNDS': '[IMPORTANT] Funds are processed in lot sizes 100 KMD, 1000 KMD, and 10,000 KMD.',
'IMPORTANT_FUNDS': '[IMPORTANT] Funds are processed in lot sizes 10 KMD, 100 KMD, 1000 KMD, and 10,000 KMD.',
'LARGE_LOT': 'The large lot sizes will process first, and then smaller.',
'EG': 'For example, you sent 1393 KMD to KMD Deposit Address.<br>' +
'First it will process 1000 KMD<br>' +
@ -417,7 +417,7 @@ export const _lang = {
'then 100 KMD',
'93_KMD': '93 KMD will keep waiting in deposit address.',
'TO_CLEAR_THEM': 'To clear them you\'ll have to send 7 KMD more to your KMD Deposit Address.',
'WHEN_IT_TOTALS': 'When it totals to 100 KMD, it will process to your KMD Jumblr Address.',
'WHEN_IT_TOTALS': 'When it totals to 10/100/1000 KMD, it will process to your KMD Jumblr Address.',
'JADDR': 'Jumblr Addresses',
'BTC_DEPOSIT': 'BTC Deposit',
'SHOW_HIDE': 'Show/Hide',

83
react/src/util/coinHelper.js

@ -6,12 +6,56 @@ export function getCoinTitle(coin) {
let hideTitle = false;
switch (coin) {
case 'BCH':
coinlogo = 'bch';
coinname = 'BitcoinCash';
break;
case 'BLK':
coinlogo = 'blk';
coinname = 'Blackcoin';
break;
case 'SIB':
coinlogo = 'sib';
coinname = 'Sibcoin';
break;
case 'VIA':
coinlogo = 'via';
coinname = 'Viacoin';
break;
case 'VTC':
coinlogo = 'vtc';
coinname = 'Vertcoin';
break;
case 'MONA':
coinlogo = 'mona';
coinname = 'Monacoin';
break;
case 'ARG':
coinlogo = 'arg';
coinname = 'Argentum';
break;
case 'FAIR':
coinlogo = 'fair';
coinname = 'Faircoin';
break;
case 'DASH':
coinlogo = 'dash';
coinname = 'Dash';
break;
case 'CRW':
coinlogo = 'crw';
coinname = 'Crown';
break;
case 'BTG':
coinlogo = 'btg';
coinname = 'BitcoinGold';
break;
case 'CHIPS':
coinlogo = 'chips';
coinname = 'Chips';
break;
case 'BTC':
coinlogo = 'bitcoin';
coinlogo = 'btc';
coinname = 'Bitcoin';
break;
case 'BTCD':
@ -19,7 +63,7 @@ export function getCoinTitle(coin) {
coinname = 'BitcoinDark';
break;
case 'LTC':
coinlogo = 'litecoin';
coinlogo = 'ltc';
coinname = 'Litecoin';
break;
case 'VPN':
@ -35,7 +79,7 @@ export function getCoinTitle(coin) {
coinname = 'Zcash';
break;
case 'NMC':
coinlogo = 'namecoin';
coinlogo = 'nmc';
coinname = 'Namecoin';
break;
case 'DEX':
@ -43,11 +87,11 @@ export function getCoinTitle(coin) {
coinname = 'DEX';
break;
case 'DOGE':
coinlogo = 'dogecoin';
coinlogo = 'doge';
coinname = 'Dogecoin';
break;
case 'DGB':
coinlogo = 'digibyte';
coinlogo = 'dgb';
coinname = 'Digibyte';
break;
case 'MZC':
@ -98,10 +142,6 @@ export function getCoinTitle(coin) {
coinlogo = 'SUPERNET';
coinname = 'SUPERNET';
break;
case 'CHIPS':
coinlogo = 'SUPERNET';
coinname = 'CHIPS';
break;
case 'REVS':
coinlogo = 'REVS';
coinname = 'REVS';
@ -430,3 +470,28 @@ export function coindList() {
return _coins;
}
export const isKomodoCoin = (coin) => {
if (coin === 'SUPERNET' ||
coin === 'REVS' ||
coin === 'PANGEA' ||
coin === 'DEX' ||
coin === 'JUMBLR' ||
coin === 'BET' ||
coin === 'CRYPTO' ||
coin === 'COQUI' ||
coin === 'HODL' ||
coin === 'MSHARK' ||
coin === 'BOTS' ||
coin === 'MGW' ||
coin === 'MVP' ||
coin === 'KV' ||
coin === 'CEAL' ||
coin === 'MESH' ||
coin === 'WLC' ||
coin === 'MNZ' ||
coin === 'CHIPS' ||
coin === 'KMD') {
return true;
}
}
Loading…
Cancel
Save