Skip to content

Commit

Permalink
Merge 5d8f531 into ad681e9
Browse files Browse the repository at this point in the history
  • Loading branch information
pbca26 authored Mar 10, 2022
2 parents ad681e9 + 5d8f531 commit 49b9ac7
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 36 deletions.
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "hw-kmd-wallet-electron",
"version": "0.3.2",
"version": "0.3.3",
"description": "Komodo Hardware Wallet Electron App",
"main": "main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hw-kmd-wallet",
"version": "0.3.2",
"version": "0.3.3",
"author": "Luke Childs <[email protected]> (http://lukechilds.co.uk), Komodo Platform (https://komodoplatform.com)",
"repository": "pbca26/hw-kmd-wallet",
"homepage": "https://pbca26.github.io/hw-kmd-wallet",
Expand Down
42 changes: 21 additions & 21 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class App extends React.Component {
activeCoin: null,
});

setLocalStorageVar('coins', coins);
setLocalStorageVar('coins', coins, true);
setLocalStorageVar('lastOperations', lastOperations);
}

Expand Down Expand Up @@ -541,26 +541,6 @@ class App extends React.Component {
rewardsSum += accounts[i].rewards;
}

if (coin === 'KMD') {
writeLog('check if any KMD rewards are overdue');

for (let i = 0; i < accounts.length; i++) {
//writeLog(accounts[i].utxos);
for (let j = 0; j < accounts[i].utxos.length; j++) {
const rewardEndDate = getRewardEndDate({locktime: accounts[i].utxos[j].locktime, height: 7777776});

writeLog('rewardEndDate', rewardEndDate, ' vs ', Date.now());

if (Date.now() > rewardEndDate) {
writeLog('account', i, 'rewards overdue');
accounts[i].isRewardsOverdue = true;
} else {
accounts[i].isRewardsOverdue = false;
}
}
}
}

balances.push({
coin,
balance: balanceSum,
Expand Down Expand Up @@ -610,6 +590,26 @@ class App extends React.Component {
});
}
}

if (coin === 'KMD') {
writeLog('check if any KMD rewards are overdue');

for (let i = 0; i < coins[coin].accounts.length; i++) {
//writeLog(coins[coin].accounts[i].utxos);
for (let j = 0; j < coins[coin].accounts[i].utxos.length; j++) {
const rewardEndDate = getRewardEndDate({locktime: coins[coin].accounts[i].utxos[j].locktime, height: 7777776});

writeLog('rewardEndDate', rewardEndDate, ' vs ', Date.now());

if (Date.now() > rewardEndDate) {
writeLog('account', i, 'rewards overdue');
coins[coin].accounts[i].isRewardsOverdue = true;
} else {
coins[coin].accounts[i].isRewardsOverdue = false;
}
}
}
}
}

writeLog('lastops', lastOperations);
Expand Down
12 changes: 6 additions & 6 deletions src/SendCoinButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ class SendCoinButton extends React.Component {

if (!isUserInputValid) {
const {coin} = this.props;
let tiptime = await blockchain[blockchainAPI].getTipTime();
tiptime = this.props.checkTipTime(this.props.tiptime);
let currentAction = 'connect';
let tiptime;

let currentAction;
try {
if (coin === 'KMD' && !tiptime) {
throw new Error('Unable to get tiptime!');
if (coin === 'KMD') {
tiptime = await blockchain[blockchainAPI].getTipTime();
tiptime = this.props.checkTipTime(tiptime);
if (!tiptime) throw new Error('Unable to get tiptime!');
}

currentAction = 'connect';
updateActionState(this, currentAction, 'loading');
const hwIsAvailable = await hw[this.props.vendor].isAvailable();
if (!hwIsAvailable) {
Expand Down
18 changes: 11 additions & 7 deletions src/lib/localstorage-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const encodeStoredData = (str) => {
}
};

export const setLocalStorageVar = (name, json) => {
export const setLocalStorageVar = (name, json, replace) => {
return new Promise((resolve, reject) => {
let _var = {};
//writeLog('localStorageCache', localStorageCache);
Expand All @@ -112,14 +112,18 @@ export const setLocalStorageVar = (name, json) => {
writeLog(e);
}

for (let key in json) {
_var[key] = json[key];
if (replace) {
localStorageCache[name] = json;
} else {
for (let key in json) {
_var[key] = json[key];
}

localStorageCache[name] = Array.isArray(json) ? json : Object.assign({}, localStorageCache[name], _var);
}

writeLog('_var', _var);

localStorageCache[name] = Array.isArray(json) ? json : Object.assign({}, localStorageCache[name], _var);

writeLog('_var', _var);

encodeStoredData(JSON.stringify(localStorageCache));
resolve(true);
});
Expand Down
8 changes: 8 additions & 0 deletions src/uiv2.scss
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,14 @@
position: relative;
top: 2px;
}
.notification.is-success {
word-break: break-all;

.copy-btn {
height: 24px !important;
top: 4px !important;
}
}
}

.Modal-coin-settings {
Expand Down

0 comments on commit 49b9ac7

Please sign in to comment.