From 0108e81c3933ab4adb14e73af176ef150021890c Mon Sep 17 00:00:00 2001 From: pbca26 Date: Mon, 5 Jun 2017 15:17:53 +0300 Subject: [PATCH 01/19] zaddr balance fix --- react/src/actions/actions/addressBalance.js | 85 +++++++++++++++++-- .../dashboard/walletsNativeBalance.js | 2 +- 2 files changed, 80 insertions(+), 7 deletions(-) diff --git a/react/src/actions/actions/addressBalance.js b/react/src/actions/actions/addressBalance.js index 3713e34..4a551c5 100644 --- a/react/src/actions/actions/addressBalance.js +++ b/react/src/actions/actions/addressBalance.js @@ -5,7 +5,8 @@ import { triggerToaster, Config, shepherdGroomPost, - getPassthruAgent + getPassthruAgent, + iguanaHashHex } from '../actionCreators'; import { logGuiHttp, @@ -171,7 +172,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }; } - // if api cache option is off if (mode === 'basilisk') { payload = { 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, @@ -235,17 +235,90 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { sum += filteredArray[i]; } + if (sum === 0 && + a === 1) { + + } + newAddressArray[a][b] = { address: result[a][b], amount: currentAddress === result[a][b] || mode === 'native' ? sum : 'N/A', + type: a === 0 ? 'public': 'private', }; } } - dispatch(getKMDAddressesNativeState({ - 'public': newAddressArray[0], - 'private': newAddressArray[1] - })); + // get zaddr balance + if (result[1] && + result[1].length) { + Promise.all(result[1].map((_address, index) => { + return new Promise((resolve, reject) => { + const _timestamp = Date.now(); + let ajaxDataToHex = `["${_address}"]`; + + iguanaHashHex(ajaxDataToHex, dispatch).then((hashHexJson) => { + if (getPassthruAgent(coin) === 'iguana') { + payload = { + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, + 'agent': getPassthruAgent(coin), + 'method': 'passthru', + 'asset': coin, + 'function': 'z_getbalance', + 'hex': hashHexJson, + }; + } else { + payload = { + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, + 'agent': getPassthruAgent(coin), + 'method': 'passthru', + 'function': 'z_getbalance', + 'hex': hashHexJson, + }; + } + + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, + { + method: 'POST', + body: JSON.stringify(payload), + }) + .catch(function(error) { + console.log(error); + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + dispatch(triggerToaster(true, 'getKMDAddressesNative+ZBalance', 'Error', 'error')); + }) + .then(response => response.json()) + .then(function(json) { + resolve(json); + newAddressArray[1][index] = { + address: _address, + amount: json, + type: 'private', + }; + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + }); + }); + }); + })) + .then(zresult => { + dispatch(getKMDAddressesNativeState({ + 'public': newAddressArray[0], + 'private': newAddressArray[1] + })); + }); + } else { + dispatch(getKMDAddressesNativeState({ + 'public': newAddressArray[0], + 'private': newAddressArray[1] + })); + } } if (mode === 'basilisk') { diff --git a/react/src/components/dashboard/walletsNativeBalance.js b/react/src/components/dashboard/walletsNativeBalance.js index cfaf44d..30d10f2 100644 --- a/react/src/components/dashboard/walletsNativeBalance.js +++ b/react/src/components/dashboard/walletsNativeBalance.js @@ -45,7 +45,7 @@ class WalletsNativeBalance extends React.Component {
{ translate('INDEX.INTEREST_EARNED') }
- { this.props.Dashboard.progress.interest ? this.props.Dashboard.progress.interest : '-' } + { this.props.Dashboard.progress && this.props.Dashboard.progress.interest ? this.props.Dashboard.progress.interest : '-' } From 0f08fbabad9037c8b677becc2cca18c36d9cc7cb Mon Sep 17 00:00:00 2001 From: pbca26 Date: Mon, 5 Jun 2017 15:45:13 +0300 Subject: [PATCH 02/19] native send zaddr val ellipsis --- react/src/actions/actions/addressBalance.js | 41 ++++++++++++++----- .../components/dashboard/walletsNativeSend.js | 2 +- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/react/src/actions/actions/addressBalance.js b/react/src/actions/actions/addressBalance.js index 4a551c5..ad77083 100644 --- a/react/src/actions/actions/addressBalance.js +++ b/react/src/actions/actions/addressBalance.js @@ -275,6 +275,14 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { 'hex': hashHexJson, }; } + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDAddressesNative+ZBalance', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { @@ -292,17 +300,28 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }) .then(response => response.json()) .then(function(json) { - resolve(json); - newAddressArray[1][index] = { - address: _address, - amount: json, - type: 'private', - }; - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (json && + json.error) { + resolve(0); + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': json, + })); + dispatch(triggerToaster(true, 'getKMDAddressesNative+ZBalance', 'Error', 'error')); + } else { + resolve(json); + newAddressArray[1][index] = { + address: _address, + amount: json, + type: 'private', + }; + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } }); }); }); diff --git a/react/src/components/dashboard/walletsNativeSend.js b/react/src/components/dashboard/walletsNativeSend.js index 1d82938..666881e 100644 --- a/react/src/components/dashboard/walletsNativeSend.js +++ b/react/src/components/dashboard/walletsNativeSend.js @@ -54,7 +54,7 @@ class WalletsNativeSend extends React.Component { this.props.ActiveCoin.addresses[type].length) { return this.props.ActiveCoin.addresses[type].map((address) =>
  • - this.updateAddressSelection(address.address, type, address.amount) }> [ { address.amount } { this.props.ActiveCoin.coin } ]  { address.address } + this.updateAddressSelection(address.address, type, address.amount) }> [ { address.amount } { this.props.ActiveCoin.coin } ]  { type === 'public' ? address.address : address.address.substring(0, 34) + '...' }
  • ); } else { From b1a892e4593c0682e7dc266eaac5b75fe493808e Mon Sep 17 00:00:00 2001 From: petitPapillon Date: Mon, 5 Jun 2017 22:48:00 +0200 Subject: [PATCH 03/19] Merge redux into decouple-jsx-out-of-js --- .../addcoin/coin-selectors.render.js | 4 +- .../components/dashboard/coinTile.render.js | 10 ++-- .../src/components/dashboard/jumblr.render.js | 49 ++++++----------- .../src/components/dashboard/navbar.render.js | 52 +++++++++---------- .../dashboard/notifications.render.js | 29 ++++------- .../dashboard/receiveCoin.render.js | 9 ++-- react/src/components/login/login.render.js | 6 +-- .../components/login/swall-modal.render.js | 4 +- 8 files changed, 68 insertions(+), 95 deletions(-) diff --git a/react/src/components/addcoin/coin-selectors.render.js b/react/src/components/addcoin/coin-selectors.render.js index 0c33726..e0b20e1 100644 --- a/react/src/components/addcoin/coin-selectors.render.js +++ b/react/src/components/addcoin/coin-selectors.render.js @@ -7,7 +7,9 @@ import AddCoinOptionsACFiat from '../addcoin/addcoinOptionsACFiat'; const CoinSelectorsRender = function(item, coin, i) { return ( -
    +
    1 ? 'multi' : 'single' } + key={ `add-coin-${i}` }>
    @@ -23,8 +23,8 @@ const CoinTileRender = function () {
    -
    -
    +
    +
    { this.renderTiles() }
    diff --git a/react/src/components/dashboard/jumblr.render.js b/react/src/components/dashboard/jumblr.render.js index 0ce9322..6acc630 100644 --- a/react/src/components/dashboard/jumblr.render.js +++ b/react/src/components/dashboard/jumblr.render.js @@ -10,9 +10,9 @@ const JumblrRender = function () {
    -
    - { translate('JUMBLR.NOTICE') } @@ -24,11 +24,11 @@ const JumblrRender = function () {
    - - { translate('JUMBLR.NEED_NATIVE') } + { translate('JUMBLR.NEED_NATIVE') }
    { translate('JUMBLR.TO_USE_JUMBLR') } @@ -42,23 +42,17 @@ const JumblrRender = function () {
    -
    +
    + id="jumblr_security_notes_1">
    • { translate('JUMBLR.FEW_SECURITY_NOTES_DESC1') }
    • @@ -74,18 +68,12 @@ const JumblrRender = function () {
      + id="jumblr_access_funds_2">

      { translate('JUMBLR.ADDRESS_ACCESSIBLE_EASILY') }

        @@ -114,17 +102,12 @@ const JumblrRender = function () {
      -