diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index c9fc0f2..325fd3a 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -862,9 +862,13 @@ function getKMDAddressesNativeState(json) { } } -export function getKMDAddressesNative(coin) { +export function getKMDAddressesNative(coin, mode) { const type = ['public', 'private']; + if (mode !== 'native') { + type.pop(); + } + return dispatch => { Promise.all(type.map((_type, index) => { return new Promise((resolve, reject) => { @@ -903,6 +907,16 @@ export function getKMDAddressesNative(coin) { }; } + if (mode !== 'native') { + payload = { + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'coin': coin, + 'agent': 'bitcoinrpc', + 'method': 'getaddressesbyaccount', + 'account': '*' + }; + } + fetch('http://127.0.0.1:' + Config.iguanaCorePort, { method: 'POST', body: JSON.stringify(payload), @@ -940,6 +954,19 @@ export function getKMDAddressesNative(coin) { }; } + if (mode === 'full') { + payload = { + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'coin': coin, + 'method': 'listunspent', + 'params': [ + 1, + 9999999, + //[ atomic_explorer_input_data_val ] + ] + }; + } + fetch('http://127.0.0.1:' + Config.iguanaCorePort, { method: 'POST', body: JSON.stringify(payload), @@ -950,12 +977,16 @@ export function getKMDAddressesNative(coin) { }) .then(response => response.json()) .then(function(json) { + if (mode === 'full') { + result[0] = result[0].result; + } + const allAddrArray = json.map(res => res.address).filter((x, i, a) => a.indexOf(x) == i); for (let a=0; a < allAddrArray.length; a++) { const filteredArray = json.filter(res => res.address === allAddrArray[a]).map(res => res.amount); let isNewAddr = true; - for (let x=0; x < 2 && isNewAddr; x++) { + for (let x=0; x < result.length && isNewAddr; x++) { for (let y=0; y < result[x].length && isNewAddr; y++) { if (allAddrArray[a] === result[x][y]) { isNewAddr = false; @@ -975,7 +1006,7 @@ export function getKMDAddressesNative(coin) { let newAddressArray = []; - for (let a=0; a < 2; a++) { + for (let a=0; a < result.length; a++) { newAddressArray[a] = []; for (let b=0; b < result[a].length; b++) { diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js index bdc9c06..724566e 100644 --- a/react/src/components/dashboard/coinTileItem.js +++ b/react/src/components/dashboard/coinTileItem.js @@ -33,7 +33,7 @@ class CoinTileItem extends React.Component { var _iguanaActiveHandle = setInterval(function() { Store.dispatch(getSyncInfo(coin)); Store.dispatch(iguanaEdexBalance(coin, mode)); - Store.dispatch(getAddressesByAccount(coin)); + Store.dispatch(getKMDAddressesNative(coin, mode));//getAddressesByAccount(coin)); Store.dispatch(getFullTransactionsList(coin)); }, 3000); Store.dispatch(startInterval('sync', _iguanaActiveHandle)); diff --git a/react/src/components/dashboard/receiveCoin.js b/react/src/components/dashboard/receiveCoin.js index 6c23bf0..bec7f8f 100644 --- a/react/src/components/dashboard/receiveCoin.js +++ b/react/src/components/dashboard/receiveCoin.js @@ -4,16 +4,16 @@ import { translate } from '../../translate/translate'; class ReceiveCoin extends React.Component { renderAddressList() { if (this.props.addresses && this.props.addresses.length) { - return this.props.addresses.map((address) => + return this.props.addresses['public'].map((address) => {translate('IAPI.PUBLIC_SM')} - {address} - - + {address.address} + {address.amount} + {address.interest ? address.interest : 'N/A'} ); } else {