Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AND-9347 Send (TON): cannot send some of ton's tokens if the amount is longer than Long (from support team) #858

Open
wants to merge 1 commit into
base: release-app_5.19
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading