@ -48,8 +48,6 @@ export function toggleDashboardActiveSection(name) {
}
}
export function toggleDashboardTxInfoModal ( display , txIndex ) {
export function toggleDashboardTxInfoModal ( display , txIndex ) {
console . log ( 'toggleTxInfoModal' , txIndex ) ;
return {
return {
type : DASHBOARD_ACTIVE_TXINFO_MODAL ,
type : DASHBOARD_ACTIVE_TXINFO_MODAL ,
showTransactionInfo : display ,
showTransactionInfo : display ,
@ -811,7 +809,12 @@ function getKMDAddressesNativeState(json) {
}
}
}
}
export function getKMDAddressesNative ( coin , pubpriv ) {
export function getKMDAddressesNative ( coin ) {
const type = [ 'public' , 'private' ] ;
return dispatch => {
Promise . all ( type . map ( ( _ type , index ) => {
return new Promise ( ( resolve , reject ) => {
var payload ,
var payload ,
ajax_data_to_hex = '' ,
ajax_data_to_hex = '' ,
ajax_function_input = '' ,
ajax_function_input = '' ,
@ -819,11 +822,11 @@ export function getKMDAddressesNative(coin, pubpriv) {
passthru_agent = getPassthruAgent ( coin ) ,
passthru_agent = getPassthruAgent ( coin ) ,
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage . getItem ( 'IguanaRPCAuth' ) ;
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage . getItem ( 'IguanaRPCAuth' ) ;
if ( pubpriv === 'public' ) {
if ( _ type === 'public' ) {
ajax_function_input = 'getaddressesbyaccount' ;
ajax_function_input = 'getaddressesbyaccount' ;
tmplistaddr_hex_input = '222200' ;
tmplistaddr_hex_input = '222200' ;
}
}
if ( pubpriv === 'private' ) {
if ( _ type === 'private' ) {
ajax_function_input = 'z_listaddresses' ;
ajax_function_input = 'z_listaddresses' ;
tmplistaddr_hex_input = '' ;
tmplistaddr_hex_input = '' ;
}
}
@ -847,8 +850,7 @@ export function getKMDAddressesNative(coin, pubpriv) {
} ;
} ;
}
}
return dispatch => {
fetch ( 'http://127.0.0.1:' + Config . iguanaCorePort , {
return fetch ( 'http://127.0.0.1:' + Config . iguanaCorePort , {
method : 'POST' ,
method : 'POST' ,
body : JSON . stringify ( payload ) ,
body : JSON . stringify ( payload ) ,
} )
} )
@ -857,42 +859,14 @@ export function getKMDAddressesNative(coin, pubpriv) {
dispatch ( triggerToaster ( true , 'getKMDAddressesNative' , 'Error' , 'error' ) ) ;
dispatch ( triggerToaster ( true , 'getKMDAddressesNative' , 'Error' , 'error' ) ) ;
} )
} )
. then ( response => response . json ( ) )
. then ( response => response . json ( ) )
. then ( json => dispatch ( getKMDAddressesNativeState ( json , dispatch ) ) )
. then ( json => resolve ( json ) )
}
}
/ * f u n c t i o n K M D L i s t A d d r e s s e s ( p u b p r i v ) {
NProgress . done ( true ) ;
NProgress . configure ( {
template : templates . nprogressBar
} ) ;
} ) ;
NProgress . start ( ) ;
} ) )
. then ( result => {
dispatch ( getKMDAddressesNativeState ( result [ 0 ] . concat ( result [ 1 ] ) ) ) ;
$ . ajax ( {
async : false ,
type : 'POST' ,
data : JSON . stringify ( ajax_data ) ,
url : 'http://127.0.0.1:' + config . iguanaPort ,
success : function ( data , textStatus , jqXHR ) {
var AjaxOutputData = JSON . parse ( data ) ; // Ajax output gets the whole list of unspent coin with addresses
result = AjaxOutputData ;
} ,
error : function ( xhr , textStatus , error ) {
console . log ( 'failed getting Coin History.' ) ;
console . log ( xhr . statusText ) ;
if ( xhr . readyState == 0 ) {
Iguana_ServiceUnavailable ( ) ;
}
console . log ( textStatus ) ;
console . log ( error ) ;
}
} ) ;
} ) ;
}
NProgress . done ( ) ;
}
return result ;
} * /
function getDebugLogState ( json ) {
function getDebugLogState ( json ) {
const _ data = json . result . replace ( '\n' , '\r\n' ) ;
const _ data = json . result . replace ( '\n' , '\r\n' ) ;
@ -1175,6 +1149,59 @@ export function getNativeTxHistoryState(json) {
}
}
}
}
function handleGetNewKMDAddresses ( pubpriv , coin , dispatch ) {
dispatch ( triggerToaster ( true , translate ( 'KMD_NATIVE.NEW_ADDR_GENERATED' ) , translate ( 'TOASTR.WALLET_NOTIFICATION' ) , 'success' ) ) ;
dispatch ( getKMDAddressesNative ( coin ) ) ;
return { } ;
}
export function getNewKMDAddresses ( coin , pubpriv ) {
var payload ,
ajax_function_input = '' ;
if ( pubpriv === 'public' ) {
ajax_function_input = 'getnewaddress' ;
}
if ( pubpriv === 'private' ) {
ajax_function_input = 'z_getnewaddress' ;
}
if ( getPassthruAgent ( coin ) === 'iguana' ) {
payload = {
'userpass' : 'tmpIgRPCUser@' + sessionStorage . getItem ( 'IguanaRPCAuth' ) ,
'agent' : getPassthruAgent ( coin ) ,
'method' : 'passthru' ,
'asset' : coin ,
'function' : ajax_function_input ,
'hex' : ''
} ;
} else {
payload = {
'userpass' : 'tmpIgRPCUser@' + sessionStorage . getItem ( 'IguanaRPCAuth' ) ,
'agent' : coin ,
'method' : 'passthru' ,
'function' : ajax_function_input ,
'hex' : ''
} ;
}
return dispatch => {
return fetch ( 'http://127.0.0.1:' + Config . iguanaCorePort , {
method : 'POST' ,
body : JSON . stringify ( payload ) ,
} )
. catch ( function ( error ) {
console . log ( error ) ;
dispatch ( triggerToaster ( true , 'getNewKMDAddresses' , 'Error' , 'error' ) ) ;
} )
. then ( response => response . json ( ) )
. then ( json => dispatch ( handleGetNewKMDAddresses ( pubpriv , coin , dispatch ) ) )
. catch ( function ( ex ) {
dispatch ( handleGetNewKMDAddresses ( pubpriv , coin , dispatch ) )
} )
}
}
/ * f u n c t i o n S h e p h e r d _ S e n d P e n d V a l u e ( ) {
/ * f u n c t i o n S h e p h e r d _ S e n d P e n d V a l u e ( ) {
Shepherd_SysInfo ( ) . then ( function ( result ) {
Shepherd_SysInfo ( ) . then ( function ( result ) {
var ram_data = formatBytes ( result . totalmem_bytes )
var ram_data = formatBytes ( result . totalmem_bytes )