Updated on 2026-08-14

This commit is contained in:
Tangem 2020-02-11 15:14:37 +03:00
parent 903fc32bc9
commit 3c05edb758
6 changed files with 54 additions and 14 deletions

View file

@ -55,7 +55,7 @@ object WalletManagerFactory {
walletConfig = WalletConfig(false, true)
)
}
blockchainName.contains("xrp") -> {
blockchainName == Blockchain.XRP.id -> {
return XrpWalletManager(
cardId = card.cardId,
walletPublicKey = walletPublicKey,

View file

@ -3,6 +3,6 @@ package com.tangem.blockchain.common.extensions
import com.tangem.blockchain.common.Amount
import java.math.BigInteger
fun Amount.bigIntegerValue(): BigInteger {
return this.value!!.movePointRight(this.decimals.toInt()).toBigInteger()
fun Amount.bigIntegerValue(): BigInteger? {
return this.value?.movePointRight(this.decimals.toInt())?.toBigInteger()
}

View file

@ -12,18 +12,18 @@ import com.tangem.blockchain.xrp.override.XrpSignedTransaction
import org.bitcoinj.core.ECKey
import java.math.BigInteger
class XrpTransactionBuilder(private val walletPublicKey: ByteArray) {
class XrpTransactionBuilder(walletPublicKey: ByteArray) {
private val canonicalPublicKey = XrpAddressFactory.canonizePublicKey(walletPublicKey)
var sequence: Long? = null
private var transaction: XrpSignedTransaction? = null
fun buildToSign(transactionData: TransactionData): ByteArray {
val payment = XrpPayment()
payment.`as`(AccountID.Account, transactionData.sourceAddress)
payment.`as`(AccountID.Destination, transactionData.destinationAddress)
payment.`as`(Amount.Amount, transactionData.amount.bigIntegerValue().toString())
payment.`as`(UInt32.Sequence, sequence)
payment.`as`(Amount.Fee, transactionData.fee!!.bigIntegerValue().toString())
payment.putTranslated(AccountID.Account, transactionData.sourceAddress)
payment.putTranslated(AccountID.Destination, transactionData.destinationAddress)
payment.putTranslated(Amount.Amount, transactionData.amount.bigIntegerValue().toString())
payment.putTranslated(UInt32.Sequence, sequence)
payment.putTranslated(Amount.Fee, transactionData.fee!!.bigIntegerValue().toString())
transaction = payment.prepare(canonicalPublicKey)

View file

@ -2,10 +2,6 @@ package com.tangem.blockchain.xrp.override;
import java.math.BigInteger;
/**
* Created by Ilia on 15.02.2018.
*/
public class XrpBase58 {
private static final char[] BASE58 = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz".toCharArray();