mirror of https://github.com/m2049r/xmrwallet.git
xmrto payment through subaddress (#639)
* use subaddress for xmrto only * fix exchange rate
This commit is contained in:
parent
7a1d788f2a
commit
037b019d4d
|
@ -457,8 +457,7 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||
}
|
||||
showProgress(3, getString(R.string.label_send_progress_create_tx));
|
||||
TxData txData = sendListener.getTxData();
|
||||
txData.setDestinationAddress(xmrtoStatus.getXmrReceivingAddress());
|
||||
txData.setPaymentId(xmrtoStatus.getXmrRequiredPaymentIdShort());
|
||||
txData.setDestinationAddress(xmrtoStatus.getXmrReceivingSubaddress());
|
||||
txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getXmrAmountTotal()));
|
||||
getActivityCallback().onPrepareSend(xmrtoStatus.getUuid(), txData);
|
||||
}
|
||||
|
|
|
@ -128,11 +128,11 @@ public class ExchangeOtherEditText extends ExchangeEditText {
|
|||
// first deal with XMR/baseCurrency & baseCurrency/XMR
|
||||
|
||||
if (currencyA.equals(Helper.BASE_CRYPTO) && (currencyB.equals(baseCurrency))) {
|
||||
localExchange(currencyA, currencyB, exchangeRate);
|
||||
localExchange(currencyA, currencyB, 1.0d / exchangeRate);
|
||||
return;
|
||||
}
|
||||
if (currencyA.equals(baseCurrency) && (currencyB.equals(Helper.BASE_CRYPTO))) {
|
||||
localExchange(currencyA, currencyB, 1.0d / exchangeRate);
|
||||
localExchange(currencyA, currencyB, exchangeRate);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ public interface QueryOrderStatus {
|
|||
|
||||
String getXmrReceivingAddress(); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
||||
|
||||
String getXmrReceivingSubaddress(); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
||||
|
||||
String getXmrReceivingIntegratedAddress(); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
|
||||
|
||||
int getXmrRecommendedMixin(); // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
|
||||
|
|
|
@ -52,6 +52,7 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
private double xmrAmountRemaining; // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>,
|
||||
private int xmrNumConfirmationsRemaining; // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
||||
private double xmrPriceBtc; // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
||||
private String xmrReceivingSubaddress; // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
||||
private String xmrReceivingAddress; // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
||||
private String xmrReceivingIntegratedAddress; // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
|
||||
private int xmrRecommendedMixin; // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
|
||||
|
@ -115,6 +116,10 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
return xmrPriceBtc;
|
||||
}
|
||||
|
||||
public String getXmrReceivingSubaddress() {
|
||||
return xmrReceivingSubaddress;
|
||||
}
|
||||
|
||||
public String getXmrReceivingAddress() {
|
||||
return xmrReceivingAddress;
|
||||
}
|
||||
|
@ -208,6 +213,7 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
xmrAmountRemaining = jsonObject.getDouble("xmr_amount_remaining"); // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>,
|
||||
xmrNumConfirmationsRemaining = jsonObject.getInt("xmr_num_confirmations_remaining"); // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
||||
xmrPriceBtc = jsonObject.getDouble("xmr_price_btc"); // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
||||
xmrReceivingSubaddress = jsonObject.getString("xmr_receiving_subaddress"); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
||||
xmrReceivingAddress = jsonObject.getString("xmr_receiving_address"); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
||||
xmrReceivingIntegratedAddress = jsonObject.getString("xmr_receiving_integrated_address"); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
|
||||
xmrRecommendedMixin = jsonObject.getInt("xmr_recommended_mixin"); // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
|
||||
|
|
|
@ -132,6 +132,7 @@ public class XmrToApiQueryOrderTest {
|
|||
final double xmrAmountRemaining = 6.464;
|
||||
final int xmrNumConfirmationsRemaining = -1;
|
||||
final double xmrPriceBtc = 0.0154703;
|
||||
final String xmrReceivingSubaddress = "83BGzCTthheE2KxNTBPnPJjJUthYPfDfCf3ENSVQcpga8RYSxNz9qCz1qp9MLye9euMjckGi11cRdeVGqsVqTLgH8w5fJ1D";
|
||||
final String xmrReceivingAddress = "44TVPcCSHebEQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV4UpB5n4";
|
||||
final String xmrReceivingIntegratedAddress = "4EAAQR1vtv7EQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV6B5rRtHLeXGQSECXy9";
|
||||
final int xmrRecommendedMixin = 5;
|
||||
|
@ -155,6 +156,7 @@ public class XmrToApiQueryOrderTest {
|
|||
xmrAmountRemaining,
|
||||
xmrNumConfirmationsRemaining,
|
||||
xmrPriceBtc,
|
||||
xmrReceivingSubaddress,
|
||||
xmrReceivingAddress,
|
||||
xmrReceivingIntegratedAddress,
|
||||
xmrRecommendedMixin,
|
||||
|
@ -184,6 +186,7 @@ public class XmrToApiQueryOrderTest {
|
|||
waiter.assertEquals(orderStatus.getXmrAmountRemaining(), xmrAmountRemaining);
|
||||
waiter.assertEquals(orderStatus.getXmrNumConfirmationsRemaining(), xmrNumConfirmationsRemaining);
|
||||
waiter.assertEquals(orderStatus.getXmrPriceBtc(), xmrPriceBtc);
|
||||
waiter.assertEquals(orderStatus.getXmrReceivingSubaddress(), xmrReceivingSubaddress);
|
||||
waiter.assertEquals(orderStatus.getXmrReceivingAddress(), xmrReceivingAddress);
|
||||
waiter.assertEquals(orderStatus.getXmrReceivingIntegratedAddress(), xmrReceivingIntegratedAddress);
|
||||
waiter.assertEquals(orderStatus.getXmrRecommendedMixin(), xmrRecommendedMixin);
|
||||
|
@ -267,6 +270,7 @@ public class XmrToApiQueryOrderTest {
|
|||
final double xmrAmountRemaining,
|
||||
final int xmrNumConfirmationsRemaining,
|
||||
final double xmrPriceBtc,
|
||||
final String xmrReceivingSubaddress,
|
||||
final String xmrReceivingAddress,
|
||||
final String xmrReceivingIntegratedAddress,
|
||||
final int xmrRecommendedMixin,
|
||||
|
@ -281,6 +285,7 @@ public class XmrToApiQueryOrderTest {
|
|||
" \"btc_amount\":\"" + btcAmount + "\",\n" +
|
||||
" \"btc_dest_address\":\"" + btcDestAddress + "\",\n" +
|
||||
" \"xmr_required_amount\":\"" + xmrRequiredAmount + "\",\n" +
|
||||
" \"xmr_receiving_subaddress\":\"" + xmrReceivingSubaddress + "\",\n" +
|
||||
" \"xmr_receiving_address\":\"" + xmrReceivingAddress + "\",\n" +
|
||||
" \"xmr_receiving_integrated_address\":\"" + xmrReceivingIntegratedAddress + "\",\n" +
|
||||
" \"xmr_required_payment_id_long\":\"" + xmrRequiredPaymentIdLong + "\",\n" +
|
||||
|
|
Loading…
Reference in New Issue