|
|
@ -106,14 +106,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
} |
|
|
|
|
|
|
|
const _timestamp = Date.now(); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative', |
|
|
|
'type': 'post', |
|
|
|
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative', |
|
|
|
'type': 'post', |
|
|
|
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
let _fetchConfig = { |
|
|
|
method: 'POST', |
|
|
@ -137,11 +139,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
) |
|
|
|
.catch(function(error) { |
|
|
|
console.log(error); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
} |
|
|
|
dispatch( |
|
|
|
triggerToaster( |
|
|
|
'getKMDAddressesNative', |
|
|
@ -152,11 +156,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
}) |
|
|
|
.then(response => response.json()) |
|
|
|
.then(json => { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
} |
|
|
|
resolve(Config.cli.default && mode === 'native' ? json.result : json); |
|
|
|
}) |
|
|
|
} |
|
|
@ -279,7 +285,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
Promise.all(result[1].map((_address, index) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const _timestamp = Date.now(); |
|
|
|
let ajaxDataToHex = `[\"${_address}\"]`; |
|
|
|
let ajaxDataToHex = '["' + _address + '"]'; |
|
|
|
|
|
|
|
iguanaHashHex(ajaxDataToHex, dispatch) |
|
|
|
.then((hashHexJson) => { |
|
|
@ -301,14 +307,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
'hex': hashHexJson, |
|
|
|
}; |
|
|
|
} |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative+ZBalance', |
|
|
|
'type': 'post', |
|
|
|
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative+ZBalance', |
|
|
|
'type': 'post', |
|
|
|
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
let _fetchConfig = { |
|
|
|
method: 'POST', |
|
|
@ -341,11 +349,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
) |
|
|
|
.catch(function(error) { |
|
|
|
console.log(error); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
} |
|
|
|
dispatch( |
|
|
|
triggerToaster( |
|
|
|
'getKMDAddressesNative+ZBalance', |
|
|
@ -359,11 +369,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
if (json && |
|
|
|
json.error) { |
|
|
|
resolve(0); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
} |
|
|
|
dispatch( |
|
|
|
triggerToaster( |
|
|
|
'getKMDAddressesNative+ZBalance', |
|
|
@ -382,11 +394,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
amount: json, |
|
|
|
type: 'private', |
|
|
|
}; |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -435,14 +449,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
calcBalance(result, json[coin][currentAddress].refresh.data, dispatch, mode); |
|
|
|
} else { |
|
|
|
const _timestamp = Date.now(); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative+Balance', |
|
|
|
'type': 'post', |
|
|
|
'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative+Balance', |
|
|
|
'type': 'post', |
|
|
|
'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, { |
|
|
|
method: 'POST', |
|
|
@ -450,11 +466,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
}) |
|
|
|
.catch(function(error) { |
|
|
|
console.log(error); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
} |
|
|
|
dispatch( |
|
|
|
triggerToaster( |
|
|
|
'getKMDAddressesNative+Balance', |
|
|
@ -465,11 +483,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
}) |
|
|
|
.then(response => response.json()) |
|
|
|
.then(function(json) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
} |
|
|
|
updatedCache.basilisk[coin][currentAddress].refresh = { |
|
|
|
'data': json, |
|
|
|
'status': 'done', |
|
|
@ -487,14 +507,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
const _timestamp = Date.now(); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative+Balance', |
|
|
|
'type': 'post', |
|
|
|
'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'function': 'getKMDAddressesNative+Balance', |
|
|
|
'type': 'post', |
|
|
|
'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, |
|
|
|
'payload': payload, |
|
|
|
'status': 'pending', |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
let _fetchConfig = { |
|
|
|
method: 'POST', |
|
|
@ -525,11 +547,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
) |
|
|
|
.catch(function(error) { |
|
|
|
console.log(error); |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'error', |
|
|
|
'response': error, |
|
|
|
})); |
|
|
|
} |
|
|
|
dispatch( |
|
|
|
triggerToaster( |
|
|
|
'getKMDAddressesNative+Balance', |
|
|
@ -544,11 +568,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { |
|
|
|
mode === 'native') { |
|
|
|
json = json.result; |
|
|
|
} |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
if (Config.debug) { |
|
|
|
dispatch(logGuiHttp({ |
|
|
|
'timestamp': _timestamp, |
|
|
|
'status': 'success', |
|
|
|
'response': json, |
|
|
|
})); |
|
|
|
} |
|
|
|
calcBalance( |
|
|
|
result, |
|
|
|
json, |
|
|
|