Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.
Merged

V0.24 #187

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions assets/mainWindow/css/loading.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ body.agama-app-settings-window {
top: 0;
right: 0;
cursor: pointer;
z-index: 100;
}

.btn-close img {
Expand Down Expand Up @@ -466,4 +467,47 @@ small {

.padding-top-40 {
padding-top: 40px;
}

.agama-modes-help {
background: rgba(255, 255, 255, 0.85);
width: 420px;
height: auto;
position: absolute;
color: #000;
border-radius: 4px;
font-weight: normal;
font-size: 14px;
text-align: left;
padding: 10px;
top: 60px;
left: 40px;
z-index: 1000;
}

.agama-modes-help .close-btn {
float: right;
width: 10px;
height: 10px;
cursor: pointer;
}

.pointer {
cursor: pointer;
}

.mode-desc {
top: 173px;
position: absolute;
}
.mode-desc.native {
left: 88px;
}
.mode-desc.spv {
left: 293px;
}

.intro {
position: relative;
top: -15px;
}
12 changes: 11 additions & 1 deletion assets/mainWindow/js/loading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
// TODO: merge into react app
let _configCopy;

function toggleMainWindowHelp() {
const _help = $('.agama-modes-help');

if (_help.is(':visible')) {
_help.hide();
} else {
_help.show();
}
}

function toggleDropdown(type) {
const _dropdown = $('.dropdown-menu.' + (type === 'lite' ? 'lite' : 'native'));

Expand All @@ -10,7 +20,7 @@ function toggleDropdown(type) {
_dropdown.addClass('hide');
}

$('.dropdown-menu.' + (type === 'lite' ? 'native' : 'lite')).addClass('hide');;
$('.dropdown-menu.' + (type === 'lite' ? 'native' : 'lite')).addClass('hide');
}

function initSettingsForm() {
Expand Down
8 changes: 8 additions & 0 deletions react/src/actions/actionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
DISPLAY_IMPORT_KEY_MODAL,
ELECTRUM_SERVER_CHANGED,
DISPLAY_ZCASH_PARAMS_FETCH,
DASHBOARD_REMOVE_COIN,
} from './storeType';

export * from './actions/nativeSyncInfo';
Expand Down Expand Up @@ -288,4 +289,11 @@ export function toggleZcparamsFetchModal(display) {
type: DISPLAY_ZCASH_PARAMS_FETCH,
displayZcparamsModal: display,
}
}

export function dashboardRemoveCoin(coin) {
return {
type: DASHBOARD_REMOVE_COIN,
coin,
}
}
23 changes: 23 additions & 0 deletions react/src/actions/actions/coinList.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,27 @@ export function shepherdPostCoinList(data) {
.then(response => response.json())
.then(json => resolve(json))
});
}

export function shepherdClearCoindFolder(coin, keepWalletDat) {
return new Promise((resolve, reject) => {
fetch(keepWalletDat ? `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}&keepwallet=true` : `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.catch((error) => {
console.log(error);
dispatch(
triggerToaster(
'shepherdClearCoindFolder',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(json => resolve(json))
});
}
14 changes: 14 additions & 0 deletions react/src/actions/actions/interest.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ export function getListUnspent(coin) {
})
.then(response => response.json())
.then(json => {
if (json &&
json.result &&
json.result.length) {
let _spendable = [];

for (let i = 0; i < json.result.length; i++) {
if (json.result[i].spendable) {
_spendable.push(json.result[i]);
}
}

json.result = _spendable;
}

resolve(json.result ? json.result : json);
})
});
Expand Down
42 changes: 30 additions & 12 deletions react/src/actions/actions/nativeDashboardUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export function getDashboardUpdate(coin, activeCoinProps) {
export function getDashboardUpdateState(json, coin, fakeResponse) {
// rescan or similar resource heavy process
if (fakeResponse ||
((json.result['getinfo'].error && json.result['getinfo'].error === 'daemon is busy') &&
(json.result['z_getoperationstatus'].error && json.result['z_getoperationstatus'].error === 'daemon is busy') &&
(json.result['listtransactions'].error && json.result['listtransactions'].error === 'daemon is busy') &&
(json.result['listtransactions'].error && json.result['listtransactions'].error === 'daemon is busy'))) {
((json.result.getinfo.error && json.result.getinfo.error === 'daemon is busy') &&
(json.result.z_getoperationstatus.error && json.result.z_getoperationstatus.error === 'daemon is busy') &&
(json.result.listtransactions.error && json.result.listtransactions.error === 'daemon is busy') &&
(json.result.listtransactions.error && json.result.listtransactions.error === 'daemon is busy'))) {
return {
type: DASHBOARD_UPDATE,
progress: null,
Expand All @@ -60,7 +60,7 @@ export function getDashboardUpdateState(json, coin, fakeResponse) {
rescanInProgress: true,
};
} else {
let _listtransactions = json.result['listtransactions'];
let _listtransactions = json.result.listtransactions;

if (_listtransactions &&
_listtransactions.error) {
Expand All @@ -74,22 +74,40 @@ export function getDashboardUpdateState(json, coin, fakeResponse) {
if (coin === 'CHIPS') {
return {
type: DASHBOARD_UPDATE,
progress: json.result['getinfo'].result,
progress: json.result.getinfo.result,
opids: null,
txhistory: _listtransactions,
balance: { transparent: json.result['getbalance'].result, total: json.result['getbalance'].result },
addresses: json.result['addresses'],
balance: {
transparent: json.result.getbalance.result,
total: json.result.getbalance.result
},
addresses: json.result.addresses,
coin: coin,
rescanInProgress: false,
};
} else {
// calc transparent balance properly
let _tbalance = 0;

if (json.result.addresses &&
json.result.addresses.public &&
json.result.addresses.public.length) {
for (let i = 0; i < json.result.addresses.public.length; i++) {
_tbalance += json.result.addresses.public[i].spendable;
}
}

json.result.z_gettotalbalance.result.transparent = _tbalance.toFixed(8);
json.result.z_gettotalbalance.result.total = Number(json.result.z_gettotalbalance.result.transparent) + Number(json.result.z_gettotalbalance.result.interest) + Number(json.result.z_gettotalbalance.result.private);
json.result.z_gettotalbalance.result.total = json.result.z_gettotalbalance.result.total.toFixed(8);

return {
type: DASHBOARD_UPDATE,
progress: json.result['getinfo'].result,
opids: json.result['z_getoperationstatus'].result,
progress: json.result.getinfo.result,
opids: json.result.z_getoperationstatus.result,
txhistory: _listtransactions,
balance: json.result['z_gettotalbalance'].result,
addresses: json.result['addresses'],
balance: json.result.z_gettotalbalance.result,
addresses: json.result.addresses,
coin: coin,
rescanInProgress: false,
};
Expand Down
3 changes: 2 additions & 1 deletion react/src/actions/storeType.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ export const DASHBOARD_ELECTRUM_BALANCE = 'DASHBOARD_ELECTRUM_BALANCE';
export const DASHBOARD_ELECTRUM_TRANSACTIONS = 'DASHBOARD_ELECTRUM_TRANSACTIONS';
export const DASHBOARD_ELECTRUM_COINS = 'DASHBOARD_ELECTRUM_COINS';
export const ELECTRUM_SERVER_CHANGED = 'ELECTRUM_SERVER_CHANGED';
export const DISPLAY_ZCASH_PARAMS_FETCH = 'DISPLAY_ZCASH_PARAMS_FETCH';
export const DISPLAY_ZCASH_PARAMS_FETCH = 'DISPLAY_ZCASH_PARAMS_FETCH';
export const DASHBOARD_REMOVE_COIN = 'DASHBOARD_REMOVE_COIN';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getRawTransaction,
copyString,
sendToAddressPromise,
triggerToaster
triggerToaster,
} from '../../../actions/actionCreators';
import { translate } from '../../../translate/translate';
import {
Expand Down
6 changes: 5 additions & 1 deletion react/src/components/dashboard/coinTile/coinTileItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
triggerToaster,
shepherdRemoveCoin,
toggleCoindDownModal,
dashboardRemoveCoin,
} from '../../../actions/actionCreators';
import Store from '../../../store';
import Config from '../../../config';
Expand Down Expand Up @@ -94,9 +95,9 @@ class CoinTileItem extends React.Component {
];
const allCoins = this.props.Main.coins;
let _coinSelected = false;
let _coinMode = {};
let _mode;
let _coin;
let _coinMode = {};

if (allCoins) {
modes.map((mode) => {
Expand Down Expand Up @@ -151,6 +152,8 @@ class CoinTileItem extends React.Component {
'success'
)
);

Store.dispatch(dashboardRemoveCoin(coin));
Store.dispatch(getDexCoins());
Store.dispatch(activeHandle());
setTimeout(() => {
Expand Down Expand Up @@ -179,6 +182,7 @@ class CoinTileItem extends React.Component {
)
);

Store.dispatch(dashboardRemoveCoin(coin));
Store.dispatch(getDexCoins());
Store.dispatch(activeHandle());
setTimeout(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
&.form-material {
&.floating {
height: 80%;
max-height: calc(100% - 100px);
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions react/src/components/dashboard/receiveCoin/receiveCoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ class ReceiveCoin extends React.Component {
openDropMenu: false,
hideZeroAdresses: false,
toggledAddressMenu: null,
toggleIsMine: false,
};
this.openDropMenu = this.openDropMenu.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.toggleVisibleAddress = this.toggleVisibleAddress.bind(this);
this.checkTotalBalance = this.checkTotalBalance.bind(this);
this.ReceiveCoinTableRender = _ReceiveCoinTableRender.bind(this);
this.toggleAddressMenu = this.toggleAddressMenu.bind(this);
this.toggleIsMine = this.toggleIsMine.bind(this);
}

toggleAddressMenu(address) {
Expand Down Expand Up @@ -119,6 +121,12 @@ class ReceiveCoin extends React.Component {
}));
}

toggleIsMine() {
this.setState(Object.assign({}, this.state, {
toggleIsMine: !this.state.toggleIsMine,
}));
}

checkTotalBalance() {
let _balance = '0';

Expand Down Expand Up @@ -147,10 +155,20 @@ class ReceiveCoin extends React.Component {
AddressItemRender.call(this, address, type)
);
}

if (!this.state.toggleIsMine &&
!address.canspend) {
items.pop();
}
} else {
items.push(
AddressItemRender.call(this, address, type)
);

if (!this.state.toggleIsMine &&
!address.canspend) {
items.pop();
}
}
}

Expand Down
Loading