|
@ -10,7 +10,8 @@ import { |
|
|
triggerToaster, |
|
|
triggerToaster, |
|
|
iguanaUTXORawTX, |
|
|
iguanaUTXORawTX, |
|
|
clearLastSendToResponseState, |
|
|
clearLastSendToResponseState, |
|
|
sendToAddressStateAlt |
|
|
sendToAddressStateAlt, |
|
|
|
|
|
dexSendRawTX |
|
|
} from '../../actions/actionCreators'; |
|
|
} from '../../actions/actionCreators'; |
|
|
import Store from '../../store'; |
|
|
import Store from '../../store'; |
|
|
|
|
|
|
|
@ -41,7 +42,9 @@ class SendCoin extends React.Component { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
renderAddressAmount(address) { |
|
|
renderAddressAmount(address) { |
|
|
if (this.props.ActiveCoin.addresses && this.props.ActiveCoin.addresses['public'] && this.props.ActiveCoin.addresses['public'].length) { |
|
|
if (this.props.ActiveCoin.addresses && |
|
|
|
|
|
this.props.ActiveCoin.addresses['public'] && |
|
|
|
|
|
this.props.ActiveCoin.addresses['public'].length) { |
|
|
for (let i = 0; i < this.props.ActiveCoin.addresses['public'].length; i++) { |
|
|
for (let i = 0; i < this.props.ActiveCoin.addresses['public'].length; i++) { |
|
|
if (this.props.ActiveCoin.addresses['public'][i].address === address) { |
|
|
if (this.props.ActiveCoin.addresses['public'][i].address === address) { |
|
|
return this.props.ActiveCoin.addresses['public'][i].amount; |
|
|
return this.props.ActiveCoin.addresses['public'][i].amount; |
|
@ -53,7 +56,9 @@ class SendCoin extends React.Component { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
renderAddressByType(type) { |
|
|
renderAddressByType(type) { |
|
|
if (this.props.ActiveCoin.addresses && this.props.ActiveCoin.addresses[type] && this.props.ActiveCoin.addresses[type].length) { |
|
|
if (this.props.ActiveCoin.addresses && |
|
|
|
|
|
this.props.ActiveCoin.addresses[type] && |
|
|
|
|
|
this.props.ActiveCoin.addresses[type].length) { |
|
|
if (this.state.sendApiType) { |
|
|
if (this.state.sendApiType) { |
|
|
const mainAddress = this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]; |
|
|
const mainAddress = this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]; |
|
|
const mainAddressAmount = this.renderAddressAmount(mainAddress); |
|
|
const mainAddressAmount = this.renderAddressAmount(mainAddress); |
|
@ -179,20 +184,32 @@ class SendCoin extends React.Component { |
|
|
'sendsig': this.state.sendSig === true ? 0 : 1, |
|
|
'sendsig': this.state.sendSig === true ? 0 : 1, |
|
|
'utxos': utxoSet |
|
|
'utxos': utxoSet |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
iguanaUTXORawTX(sendData) |
|
|
iguanaUTXORawTX(sendData) |
|
|
.then(function(json) { |
|
|
.then(function(json) { |
|
|
console.log('sendData', sendData); |
|
|
console.log('sendData', sendData); |
|
|
console.log('iguanaUTXORawTXJSON', json); |
|
|
console.log('iguanaUTXORawTXJSON', json); |
|
|
if (json.result === 'success' && json.completed === true) { |
|
|
if (json.result === 'success' && json.completed === true) { |
|
|
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success')); |
|
|
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success')); |
|
|
Store.dispatch(sendToAddressStateAlt(json)); |
|
|
|
|
|
|
|
|
|
|
|
if (sendData.sendsig === 1) { |
|
|
if (sendData.sendsig === 1) { |
|
|
//Store.dispatch(triggerToaster(true, translate('TOASTR.SENDING_TX') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
|
|
|
//Store.dispatch(triggerToaster(true, translate('TOASTR.SENDING_TX') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
|
|
|
/*ajax_data_dexrawtx = { |
|
|
const dexrawtxData = { |
|
|
'signedtx': json.signedtx, |
|
|
'signedtx': json.signedtx, |
|
|
'coin': sendData.coin |
|
|
'coin': sendData.coin |
|
|
};*/ |
|
|
}; |
|
|
|
|
|
dexSendRawTX(dexrawtxData) |
|
|
|
|
|
.then(function(dexRawTxJson) { |
|
|
|
|
|
if (dexRawTxJson.error === undefined) { |
|
|
|
|
|
Store.dispatch(sendToAddressStateAlt(dexRawTxJson)); |
|
|
|
|
|
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'))); |
|
|
|
|
|
console.log('utxo remove', true); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('utxo alt'); |
|
|
|
|
|
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'))); |
|
|
|
|
|
Store.dispatch(sendToAddressStateAlt(dexRawTxJson)); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
Store.dispatch(sendToAddressStateAlt(json)); |
|
|
Store.dispatch(sendToAddressStateAlt(json)); |
|
|
} |
|
|
} |
|
@ -241,9 +258,15 @@ class SendCoin extends React.Component { |
|
|
<span className="label label-success">{this.props.ActiveCoin.lastSendToResponse[key] === true ? 'true' : 'success'}</span> |
|
|
<span className="label label-success">{this.props.ActiveCoin.lastSendToResponse[key] === true ? 'true' : 'success'}</span> |
|
|
); |
|
|
); |
|
|
} else { |
|
|
} else { |
|
|
return ( |
|
|
if (this.props.ActiveCoin.lastSendToResponse[key].length > 20 && key === 'result') { |
|
|
<span className="label label-danger">false</span> |
|
|
return ( |
|
|
); |
|
|
<span>{this.props.ActiveCoin.lastSendToResponse[key]}</span> |
|
|
|
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
return ( |
|
|
|
|
|
<span className="label label-danger">false</span> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} else if (key === 'error') { |
|
|
} else if (key === 'error') { |
|
|
return ( |
|
|
return ( |
|
@ -270,7 +293,6 @@ class SendCoin extends React.Component { |
|
|
|
|
|
|
|
|
renderSendCoinResponse() { |
|
|
renderSendCoinResponse() { |
|
|
if (this.props.ActiveCoin.lastSendToResponse) { |
|
|
if (this.props.ActiveCoin.lastSendToResponse) { |
|
|
console.log('renderSendCoinResponse', this.props.ActiveCoin.lastSendToResponse); |
|
|
|
|
|
return Object.keys(this.props.ActiveCoin.lastSendToResponse).map((key, index) => |
|
|
return Object.keys(this.props.ActiveCoin.lastSendToResponse).map((key, index) => |
|
|
<tr key={key}> |
|
|
<tr key={key}> |
|
|
<td>{key}</td> |
|
|
<td>{key}</td> |
|
|