From 68b0692a0f6df2750b7151247503d871008e6b4b Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Tue, 23 Jan 2018 21:19:09 -0400 Subject: [PATCH] - Fixed precision when sending transactions --- .../crystalwallet/activities/SendTransactionActivity.java | 6 +++++- .../crystalwallet/fragments/SendTransactionFragment.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java index c2f6aec..01d26b4 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java @@ -157,11 +157,15 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali public void importSend(){ if (this.sendTransactionValidator.isValid()) { //TODO convert the amount to long type using the precision of the currency + Long amountFromEditText = Long.parseLong(this.etAmount.getText().toString()); + Long amount = amountFromEditText*Math.round(Math.pow(10,((CryptoCurrency)spAsset.getSelectedItem()).getPrecision())); + + ValidateBitsharesSendRequest sendRequest = new ValidateBitsharesSendRequest( this.getApplicationContext(), this.grapheneAccount, this.etTo.getText().toString(), - Long.parseLong(this.etAmount.getText().toString()), + amount, ((CryptoCurrency)spAsset.getSelectedItem()).getName(), etMemo.getText().toString() ); diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index 270c51c..619d688 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -231,11 +231,14 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat public void sendTransaction(){ if (this.sendTransactionValidator.isValid()) { //TODO convert the amount to long type using the precision of the currency + Long amountFromEditText = Long.parseLong(this.etAmount.getText().toString()); + Long amount = amountFromEditText*Math.round(Math.pow(10,((CryptoCurrency)spAsset.getSelectedItem()).getPrecision())); + final ValidateBitsharesSendRequest sendRequest = new ValidateBitsharesSendRequest( this.getContext(), this.grapheneAccount, this.etTo.getText().toString(), - Long.parseLong(this.etAmount.getText().toString()), + amount, ((CryptoCurrency)spAsset.getSelectedItem()).getName(), etMemo.getText().toString() );