format the amount in ETH decently
This commit is contained in:
parent
c0ff55adb8
commit
c226ffa741
|
@ -0,0 +1,5 @@
|
|||
package im.status.keycard.connect.data
|
||||
|
||||
import java.math.BigInteger
|
||||
|
||||
fun BigInteger.toTransferredAmount(decimals : Int = 18) : String = this.toBigDecimal().movePointLeft(decimals).toPlainString().trimEnd('0')
|
|
@ -158,12 +158,12 @@ class WalletConnect(var bip32Path: String, var chainID: Long) : ExportKeyCommand
|
|||
|
||||
val intent = Intent(Registry.mainActivity, SignTransactionActivity::class.java).apply {
|
||||
if (tx.isTokenTransfer()) {
|
||||
//TODO: use currency name and decimal places to show amount
|
||||
putExtra(SIGN_TX_AMOUNT, tx.getTokenTransferValue().toString(10))
|
||||
//TODO: Replace with short name
|
||||
putExtra(SIGN_TX_CURRENCY, tx.to?.hex)
|
||||
putExtra(SIGN_TX_TO, tx.getTokenTransferTo().hex)
|
||||
} else {
|
||||
putExtra(SIGN_TX_AMOUNT, tx.value?.toString(10))
|
||||
putExtra(SIGN_TX_AMOUNT, tx.value?.toTransferredAmount())
|
||||
putExtra(SIGN_TX_CURRENCY, "ETH")
|
||||
putExtra(SIGN_TX_TO, tx.to?.hex)
|
||||
putExtra(SIGN_TX_DATA, tx.input.toNoPrefixHexString())
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.view.View
|
|||
import android.widget.EditText
|
||||
import im.status.keycard.connect.R
|
||||
import im.status.keycard.connect.data.*
|
||||
import java.util.*
|
||||
|
||||
class LoadKeyActivity : AppCompatActivity() {
|
||||
|
||||
|
@ -33,7 +34,7 @@ class LoadKeyActivity : AppCompatActivity() {
|
|||
fun importBIP39(@Suppress("UNUSED_PARAMETER") view: View) {
|
||||
val intent = Intent()
|
||||
intent.putExtra(LOAD_TYPE, LOAD_IMPORT_BIP39)
|
||||
intent.putExtra(LOAD_MNEMONIC, findViewById<EditText>(R.id.importMnemonicText).text.toString())
|
||||
intent.putExtra(LOAD_MNEMONIC, findViewById<EditText>(R.id.importMnemonicText).text.toString().toLowerCase(Locale.ENGLISH).trim())
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
finish()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue