diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java index e518b3ee..8452452d 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendBtcConfirmWizardFragment.java @@ -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); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeOtherEditText.java b/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeOtherEditText.java index 29145883..3b57d07e 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeOtherEditText.java +++ b/app/src/main/java/com/m2049r/xmrwallet/widget/ExchangeOtherEditText.java @@ -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; } diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/QueryOrderStatus.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/QueryOrderStatus.java index 21603a92..c6f0b7fd 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/QueryOrderStatus.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/api/QueryOrderStatus.java @@ -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(); // , + String getXmrReceivingIntegratedAddress(); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string", int getXmrRecommendedMixin(); // "xmr_recommended_mixin": , diff --git a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java index 91b721dc..04706692 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/xmrto/network/QueryOrderStatusImpl.java @@ -52,6 +52,7 @@ class QueryOrderStatusImpl implements QueryOrderStatus { private double xmrAmountRemaining; // "xmr_amount_remaining": , private int xmrNumConfirmationsRemaining; // "xmr_num_confirmations_remaining": , private double xmrPriceBtc; // "xmr_price_btc": , + private String xmrReceivingSubaddress; // , 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": , @@ -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": , xmrNumConfirmationsRemaining = jsonObject.getInt("xmr_num_confirmations_remaining"); // "xmr_num_confirmations_remaining": , xmrPriceBtc = jsonObject.getDouble("xmr_price_btc"); // "xmr_price_btc": , + xmrReceivingSubaddress = jsonObject.getString("xmr_receiving_subaddress"); // , 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": , diff --git a/app/src/test/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiQueryOrderTest.java b/app/src/test/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiQueryOrderTest.java index dac52600..25f3de60 100644 --- a/app/src/test/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiQueryOrderTest.java +++ b/app/src/test/java/com/m2049r/xmrwallet/xmrto/network/XmrToApiQueryOrderTest.java @@ -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" +