Browse Source

update(wip)

all-modes
Petr Balashov 8 years ago
parent
commit
6d958e6554
  1. 57
      react/src/actions/actionCreators.js
  2. 71
      react/src/components/dashboard/sendCoin.js

57
react/src/actions/actionCreators.js

@ -2364,6 +2364,63 @@ export function dexSendRawTX(data) {
});
}
export function edexGetTransaction(data) {
const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
'symbol': data.coin,
'agent': 'dex',
'method': 'gettransaction',
'vout': 1,
'txid': data.txid
};
console.log('edexGetTransaction', payload);
return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
method: 'POST',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'edexGetTransaction', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))
});
}
function EDEXgettransaction(coin,txid) {
return new Promise((resolve) => {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'symbol': coin,
'agent': 'dex',
'method': 'gettransaction',
'vout': 1,
'txid': txid
};
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:' + config.iguanaPort
})
.then(function(data) {
res_data = JSON.parse(data);
resolve(res_data);
})
.fail(function(xhr, textStatus, error) {
// handle request failures
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
}
console.log(textStatus);
console.log(error);
});
});
}
/*function Shepherd_SendPendValue() {
Shepherd_SysInfo().then(function(result){
var ram_data = formatBytes(result.totalmem_bytes)

71
react/src/components/dashboard/sendCoin.js

@ -2,6 +2,7 @@ import React from 'react';
import Config from '../../config';
import { translate } from '../../translate/translate';
import { checkTimestamp, secondsElapsedToString, secondsToString } from '../../util/time';
import { edexGetTxIDList, edexRemoveTXID } from '../../util/cacheFormat';
import {
sendToAddress,
sendFromAddress,
@ -14,7 +15,8 @@ import {
sendToAddressStateAlt,
dexSendRawTX,
fetchUtxoCache,
basiliskRefresh
basiliskRefresh,
edexGetTransaction
} from '../../actions/actionCreators';
import Store from '../../store';
@ -279,14 +281,75 @@ class SendCoin extends React.Component {
'coin': sendData.coin
};
dexSendRawTX(dexrawtxData)
.then(function(dexRawTxJson) {
console.log('dexRawTxJson', dexRawTxJson);
.then(function(dexRawTxJSON) {
console.log('dexRawTxJson', dexRawTxJSON);
if (dexRawTxJson.indexOf('"error":{"code"') > -1) {
Store.dispatch(triggerToaster(true, 'Transaction failed', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
Store.dispatch(sendToAddressStateAlt(JSON.parse(dexRawTxJson)));
Store.dispatch(sendToAddressStateAlt(JSON.parse(dexRawTxJSON)));
} else {
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
Store.dispatch(sendToAddressStateAlt(json));
let getTxidData = function() {
return new Promise(function(resolve, reject) {
Store.dispatch(triggerToaster(true, translate('TOASTR.GETTING_TXID_INFO') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
edexGetTransaction({
'coin': sendData.coin,
'txid': dexRawTxJSON.txid
})
.then(function(json) {
resolve(json);
});
});
}
let processRefreshUTXOs = function(vinData) {
return new Promise(function(resolve, reject) {
edexGetTxIDList(vinData)
.then(function(json) {
console.log(json);
resolve(json);
});
});
}
/*var process_refresh_utxos = function(gettxdata) {
return new Promise(function(resolve, reject) {
console.log(gettxdata);
console.log(utxos_set);
EDEX_GetTxIDList(gettxdata).then(function(get_txid_list) {
console.log(get_txid_list);
resolve(get_txid_list);
});
});
}
var get_data_cache_contents = function(get_txid_list) {
return new Promise(function(resolve, reject) {
console.log(get_txid_list);
console.log(send_data);
console.log(send_data.sendfrom);
Shepherd_GroomData_Get().then(function(result) {
console.log(result);
var save_this_data = EDEX_RemoveTXID(result, get_txid_list);
console.log(save_this_data);
resolve(save_this_data);
});
});
}
var save_new_cache_data = function(save_this_data) {
return new Promise(function(resolve, reject) {
console.log(save_this_data);
Shepherd_GroomData_Post(save_this_data).then(function(result) {
console.log(result);
resolve(result);
});
});
}*/
console.log('utxo remove', true);
}
});

Loading…
Cancel
Save