Skip to content

Commit

Permalink
AND-9347 Send (TON): cannot send some of ton's tokens if the amount i…
Browse files Browse the repository at this point in the history
…s longer than Long (from support team)
  • Loading branch information
Mama1emon authored and kozarezvlad committed Dec 16, 2024
1 parent 8219f7e commit 5b73582
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blockchain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ dependencies {

implementation files('libs/hedera-sdk-java-2.29.0.jar')
implementation "com.tangem:blstlib:master-6@aar"
implementation "com.tangem:wallet-core:4.0.46-tangem1@aar"
implementation("com.tangem:wallet-core-proto:4.0.46-tangem1") {
implementation "com.tangem:wallet-core:4.0.46-tangem4@aar"
implementation("com.tangem:wallet-core-proto:4.0.46-tangem4") {
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.tangem.blockchain.blockchains.ton

import com.google.protobuf.ByteString
import com.tangem.blockchain.common.*
import com.tangem.blockchain.extensions.Result
import com.tangem.common.KeyPair
import com.tangem.common.card.EllipticCurve
import com.tangem.crypto.CryptoUtils
import wallet.core.jni.proto.TheOpenNetwork
import com.tangem.blockchain.extensions.Result

internal class TonTransactionBuilder(private val walletAddress: String) {

Expand Down Expand Up @@ -73,7 +73,7 @@ internal class TonTransactionBuilder(private val walletAddress: String) {

val jettonTransfer = TheOpenNetwork.JettonTransfer.newBuilder()
.setTransfer(transfer)
.setJettonAmount(amount.longValueOrZero)
.setJettonAmount(ByteString.copyFrom(amount.byteArrayValue))
.setToOwner(destination)
.setResponseAddress(walletAddress)
.setForwardAmount(1) // some amount needed to send "jetton transfer notification", use minimum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ data class Amount(
// Be careful! The property may overflow if the decimals are much larger than the long value.
val longValueOrZero: Long by lazy { value?.movePointRight(decimals)?.toLong() ?: 0L }

val byteArrayValue: ByteArray? by lazy { value?.movePointRight(decimals)?.toBigInteger()?.toByteArray() }

constructor(
value: BigDecimal?,
blockchain: Blockchain,
Expand Down

0 comments on commit 5b73582

Please sign in to comment.