From e11275cb49779f4f27ae3465420ea017dd245b84 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 30 Apr 2019 16:02:17 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../com/tangem/data/network/BinanceApi.java | 6 +- .../java/com/tangem/data/network/Server.java | 4 +- .../tangem/data/network/ServerApiBinance.java | 116 ++++++++++++++ .../tangem/data/network/model/BinanceFee.kt | 2 +- .../tangem/wallet/binance/BinanceData.java | 2 +- .../tangem/wallet/binance/BinanceEngine.java | 145 ++++++++++++------ .../client/BinanceDexApiRestClient.java | 2 +- .../TransactionRequestAssemblerExtSign.java | 10 +- .../impl/BinanceDexApiRestClientImpl.java | 4 +- 9 files changed, 233 insertions(+), 58 deletions(-) create mode 100644 app/src/main/java/com/tangem/data/network/ServerApiBinance.java diff --git a/app/src/main/java/com/tangem/data/network/BinanceApi.java b/app/src/main/java/com/tangem/data/network/BinanceApi.java index 70e84259f9..5bc0b95059 100644 --- a/app/src/main/java/com/tangem/data/network/BinanceApi.java +++ b/app/src/main/java/com/tangem/data/network/BinanceApi.java @@ -2,10 +2,12 @@ package com.tangem.data.network; import com.tangem.data.network.model.BinanceFees; +import java.util.List; + import retrofit2.Call; import retrofit2.http.GET; public interface BinanceApi { - @GET("/fees") - Call binanceFees(); + @GET("fees") + Call> binanceFees(); } diff --git a/app/src/main/java/com/tangem/data/network/Server.java b/app/src/main/java/com/tangem/data/network/Server.java index 35a7431285..eb9119b2ad 100644 --- a/app/src/main/java/com/tangem/data/network/Server.java +++ b/app/src/main/java/com/tangem/data/network/Server.java @@ -60,7 +60,7 @@ public class Server { public static final String URL_BINANCE = ServerURL.API_BINANCE; public static class Method { - public static final String API_V1 = URL_BINANCE + "api/v1"; + public static final String API_V1 = URL_BINANCE + "api/v1/"; } } @@ -68,7 +68,7 @@ public class Server { public static final String URL_BINANCE_TESTNET = ServerURL.API_BINANCE_TESTNET; public static class Method { - public static final String API_V1 = URL_BINANCE_TESTNET + "api/v1"; + public static final String API_V1 = URL_BINANCE_TESTNET + "api/v1/"; } } diff --git a/app/src/main/java/com/tangem/data/network/ServerApiBinance.java b/app/src/main/java/com/tangem/data/network/ServerApiBinance.java new file mode 100644 index 0000000000..d299018449 --- /dev/null +++ b/app/src/main/java/com/tangem/data/network/ServerApiBinance.java @@ -0,0 +1,116 @@ +package com.tangem.data.network; + +import android.util.Log; + +import com.tangem.wallet.TangemContext; +import com.tangem.wallet.Transaction; +import com.tangem.wallet.binance.BinanceData; +import com.tangem.wallet.binance.client.BinanceDexApiRestClient; +import com.tangem.wallet.binance.client.domain.Account; +import com.tangem.wallet.binance.client.domain.Balance; +import com.tangem.wallet.binance.client.domain.TransactionMetadata; +import com.tangem.wallet.binance.client.encoding.message.TransactionRequestAssemblerExtSign; + +import java.util.ArrayList; +import java.util.List; + +import io.reactivex.Observable; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.observers.DefaultObserver; +import io.reactivex.schedulers.Schedulers; +import okhttp3.RequestBody; + +public class ServerApiBinance { + private static String TAG = ServerApiBinance.class.getSimpleName(); + + private ResponseListener responseListener; + + public interface ResponseListener { + void onSuccess(); + void onFail(); + } + + public void setResponseListener(ResponseListener listener) { + responseListener = listener; + } + + public void getBalance(TangemContext ctx, BinanceDexApiRestClient client) { + Log.i(TAG, "new getBalance request"); + + Observable balanceObservable = Observable.just(new Account()) + .map(account -> client.getAccount(ctx.getCoinData().getWallet())) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()); + + balanceObservable.subscribe(new DefaultObserver() { + @Override + public void onNext(Account account) { + Log.i(TAG, "getBalance onNext"); +// account = client.getAccount(ctx.getCoinData().getWallet()); + BinanceData binanceData = (BinanceData) ctx.getCoinData(); + + for (Balance balance : account.getBalances()) { + if (balance.getSymbol().equals("BNB")) { + binanceData.setBalanceReceived(true); + binanceData.setBalance(balance.getFree()); + break; + } + } + + binanceData.setAccountNumber(account.getAccountNumber()); + binanceData.setSequence(account.getSequence()); + } + + @Override + public void onError(Throwable e) { + Log.e(TAG, "getBalance onError" + e.getMessage()); + e.printStackTrace(); + ctx.setError(e.getMessage()); + responseListener.onFail(); + } + + @Override + public void onComplete() { + Log.i(TAG, "getBalance onComplete"); + responseListener.onSuccess(); + } + }); + } + + public void sendTransaction (byte[] txForSend, BinanceDexApiRestClient client) { + Log.i(TAG, "new sendTransaction request"); + + RequestBody requestBody = TransactionRequestAssemblerExtSign.createRequestBody(txForSend); + + Observable> sendObservable = Observable.just(new ArrayList<>()) + .map(metadatas -> client.broadcastNoWallet(requestBody, true)) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()); + + sendObservable.subscribe(new DefaultObserver>() { + @Override + public void onNext(List metadatas ) { +// RequestBody requestBody = TransactionRequestAssemblerExtSign.createRequestBody(txForSend); +// List metadatas = client.broadcastNoWallet(requestBody, true); + if (!metadatas.isEmpty() && metadatas.get(0).isOk()) { + responseListener.onSuccess(); + } else { + Log.e(TAG, "Transaction send error"); + responseListener.onFail(); + } + } + + @Override + public void onError(Throwable e) { + Log.e(TAG, "sendTransaction onError" + e.getMessage()); + e.printStackTrace(); + responseListener.onFail(); + } + + @Override + public void onComplete() { + Log.i(TAG, "sendTransaction onComplete"); + } + }); + } +} diff --git a/app/src/main/java/com/tangem/data/network/model/BinanceFee.kt b/app/src/main/java/com/tangem/data/network/model/BinanceFee.kt index 9e439231d7..061b9dbb27 100644 --- a/app/src/main/java/com/tangem/data/network/model/BinanceFee.kt +++ b/app/src/main/java/com/tangem/data/network/model/BinanceFee.kt @@ -12,5 +12,5 @@ data class BinanceFixedFee( var msg_type: String? = null, @SerializedName("fee") - var fee: Long? = null + var fee: Int? = null ) \ No newline at end of file diff --git a/app/src/main/java/com/tangem/wallet/binance/BinanceData.java b/app/src/main/java/com/tangem/wallet/binance/BinanceData.java index 9881e3e85e..05f69742fd 100644 --- a/app/src/main/java/com/tangem/wallet/binance/BinanceData.java +++ b/app/src/main/java/com/tangem/wallet/binance/BinanceData.java @@ -32,7 +32,7 @@ public class BinanceData extends CoinData { if (balance != null) B.putString("Balance", balance); if (chainId != null) B.putString("ChainId", chainId); if (sequence != null) B.putLong("Sequence", sequence); - if (accountNumber != null) B.putLong("AccountNumber", accountNumber); + if (accountNumber != null) B.putInt("AccountNumber", accountNumber); } catch (Exception e) { Log.e("Can't save to bundle ", e.getMessage()); } diff --git a/app/src/main/java/com/tangem/wallet/binance/BinanceEngine.java b/app/src/main/java/com/tangem/wallet/binance/BinanceEngine.java index 8cd0a30b6f..dafe30b5b1 100644 --- a/app/src/main/java/com/tangem/wallet/binance/BinanceEngine.java +++ b/app/src/main/java/com/tangem/wallet/binance/BinanceEngine.java @@ -1,6 +1,9 @@ package com.tangem.wallet.binance; import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.os.StrictMode; import android.text.InputFilter; import android.util.Log; @@ -8,12 +11,14 @@ import androidx.annotation.NonNull; import com.ripple.crypto.ecdsa.ECDSASignature; import com.tangem.card_common.data.TangemCard; +import com.tangem.card_common.reader.CardCrypto; import com.tangem.card_common.reader.CardProtocol; import com.tangem.card_common.tasks.SignTask; import com.tangem.card_common.util.Util; import com.tangem.data.Blockchain; import com.tangem.data.network.BinanceApi; import com.tangem.data.network.Server; +import com.tangem.data.network.ServerApiBinance; import com.tangem.data.network.model.BinanceFees; import com.tangem.util.CryptoUtil; import com.tangem.util.DecimalDigitsInputFilter; @@ -33,6 +38,7 @@ import com.tangem.wallet.binance.client.domain.broadcast.TransactionOption; import com.tangem.wallet.binance.client.domain.broadcast.Transfer; import com.tangem.wallet.binance.client.encoding.Bech32; import com.tangem.wallet.binance.client.encoding.Crypto; +import com.tangem.wallet.binance.client.encoding.message.MessageType; import com.tangem.wallet.binance.client.encoding.message.TransactionRequestAssemblerExtSign; import com.tangem.wallet.binance.client.encoding.message.TransferMessage; @@ -365,6 +371,13 @@ public class BinanceEngine extends CoinEngine { amount = amountValue.setScale(getDecimals(), RoundingMode.DOWN).toPlainString(); } + byte[] pubKey = ctx.getCard().getWalletPublicKeyRar(); + byte[] pubKeyPrefix = MessageType.PubKey.getTypePrefixBytes(); + byte[] pubKeyForSign = new byte[pubKey.length + pubKeyPrefix.length + 1]; + System.arraycopy(pubKeyPrefix, 0, pubKeyForSign, 0, pubKeyPrefix.length); + pubKeyForSign[pubKeyPrefix.length] = (byte) 33; + System.arraycopy(pubKey, 0, pubKeyForSign, pubKeyPrefix.length + 1, pubKey.length); + Transfer transfer = new Transfer(); transfer.setCoin("BNB"); transfer.setFromAddress(ctx.getCoinData().getWallet()); @@ -373,11 +386,32 @@ public class BinanceEngine extends CoinEngine { TransactionOption options = TransactionOption.DEFAULT_INSTANCE; - TransactionRequestAssemblerExtSign txAssembler = client.prepareTransfer(transfer, coinData, ctx.getCard().getWalletPublicKeyRar(), options, true); + TransactionRequestAssemblerExtSign txAssembler = client.prepareTransfer(transfer, coinData, pubKeyForSign, options, true); // TransactionRequestAssembler.buildTransfer as reference TransferMessage msgBean = txAssembler.createTransferMessage(transfer); byte[] msg = txAssembler.encodeTransferMessage(msgBean); byte[] dataForSign = txAssembler.prepareForSign(msgBean); +// byte[] dataForSign = Util.fromHexString("7b226163636f756e745f6e756d626572223a2231222c22636861696e5f6964223a22626e62636861696e2d31303030222c226d656d6f223a22222c226d736773223a5b7b226964223a22423635363144434331303431333030353941374330384634384336343631304331463646393036342d3130222c226f7264657274797065223a322c227072696365223a3130303030303030302c227175616e74697479223a313230303030303030302c2273656e646572223a22626e63316b6574706d6e71736779637174786e7570723667636572707073306b6c797279687a36667a6c222c2273696465223a312c2273796d626f6c223a224254432d3543345f424e42222c2274696d65696e666f726365223a317d5d2c2273657175656e6365223a2239227d"); +// +// byte[] privateKey = Util.fromHexString("30c5e838578a29e3e9273edddd753d6c9b38aca2446dd84bdfe2e5988b0da0a1"); +// +// byte[] signFromCard = CardCrypto.Signature(privateKey, dataForSign); +// +// int size = signFromCard.length / 2; +// BigInteger r = new BigInteger(1, Arrays.copyOfRange(signFromCard, 0, size)); +// BigInteger s = new BigInteger(1, Arrays.copyOfRange(signFromCard, size, size * 2)); +// s = CryptoUtil.toCanonicalised(s); +//// ECKey.ECDSASignature sig = new ECKey.ECDSASignature(r, s); +//// byte[] sigDer = sig.encodeToDER(); +//// if (!ECDSASignature.isStrictlyCanonical(sigDer)) { +//// throw new IllegalStateException("Signature is not strictly canonical"); +//// } +// byte[] resultSig = new byte[64]; +// System.arraycopy(Utils.bigIntegerToBytes(r, 32), 0, resultSig, 0, 32); +// System.arraycopy(Utils.bigIntegerToBytes(s, 32), 0, resultSig, 32, 32); +// +// String test = Util.byteArrayToHexString(resultSig); +// int x = 1; return new SignTask.TransactionToSign() { @@ -389,7 +423,7 @@ public class BinanceEngine extends CoinEngine { @Override public byte[][] getHashesToSign() { byte[][] hashForSign = new byte[1][]; - hashForSign[1] = CryptoUtil.doubleSha256(dataForSign); + hashForSign[0] = CryptoUtil.doubleSha256(dataForSign); return hashForSign; } @@ -410,37 +444,47 @@ public class BinanceEngine extends CoinEngine { @Override public byte[] onSignCompleted(byte[] signFromCard) throws Exception { - int size = signFromCard.length / 2; - BigInteger r = new BigInteger(1, Arrays.copyOfRange(signFromCard, 0, size)); - BigInteger s = new BigInteger(1, Arrays.copyOfRange(signFromCard, size, size * 2)); - s = CryptoUtil.toCanonicalised(s); - ECKey.ECDSASignature sig = new ECKey.ECDSASignature(r, s); - byte[] sigDer = sig.encodeToDER(); - if (!ECDSASignature.isStrictlyCanonical(sigDer)) { - throw new IllegalStateException("Signature is not strictly canonical"); - } +// int size = signFromCard.length / 2; +// BigInteger r = new BigInteger(1, Arrays.copyOfRange(signFromCard, 0, size)); +// BigInteger s = new BigInteger(1, Arrays.copyOfRange(signFromCard, size, size * 2)); +//// s = CryptoUtil.toCanonicalised(s); +//// ECKey.ECDSASignature sig = new ECKey.ECDSASignature(r, s); +//// byte[] sigDer = sig.encodeToDER(); +//// if (!ECDSASignature.isStrictlyCanonical(sigDer)) { +//// throw new IllegalStateException("Signature is not strictly canonical"); +//// } +// byte[] resultSig = new byte[64]; +// System.arraycopy(Utils.bigIntegerToBytes(r, 32), 0, resultSig, 0, 32); +// System.arraycopy(Utils.bigIntegerToBytes(s, 32), 0, resultSig, 32, 32); // TransactionRequestAssembler.buildTransfer as reference - byte[] signature = txAssembler.encodeSignature(sigDer); - return txAssembler.encodeStdTx(msg, signature); + byte[] signature = txAssembler.encodeSignature(signFromCard); + byte[] txForSend = txAssembler.encodeStdTx(msg, signature); + + notifyOnNeedSendTransaction(txForSend); + return txForSend; } }; } public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) { try { - Account account = client.getAccount(ctx.getCoinData().getWallet()); + ServerApiBinance serverApiBinance = new ServerApiBinance(); - for (Balance balance : account.getBalances()) { - if (balance.getSymbol().equals("BNB")) { - coinData.setBalanceReceived(true); - coinData.setBalance(balance.getFree()); - break; + ServerApiBinance.ResponseListener responseListener = new ServerApiBinance.ResponseListener() { + @Override + public void onSuccess() { + blockchainRequestsCallbacks.onComplete(true); } - } - coinData.setAccountNumber(account.getAccountNumber()); - coinData.setSequence(account.getSequence()); + @Override + public void onFail() { + blockchainRequestsCallbacks.onComplete(false); + } + }; + + serverApiBinance.setResponseListener(responseListener); + serverApiBinance.getBalance(ctx, client); if (ctx.getBlockchain() == Blockchain.Binance) { coinData.setValidationNodeDescription(Server.ApiBinance.URL_BINANCE); @@ -450,7 +494,6 @@ public class BinanceEngine extends CoinEngine { throw new Exception("Invalid blockchain for BinanceEngine"); } - blockchainRequestsCallbacks.onComplete(true); } catch (Exception e) { e.printStackTrace(); Log.e(TAG, "FAIL Binance balance exception"); @@ -461,7 +504,7 @@ public class BinanceEngine extends CoinEngine { public void requestFee(BlockchainRequestsCallbacks blockchainRequestsCallbacks, String targetAddress, Amount amount) { try { - String baseUrl = null; + String baseUrl; if (ctx.getBlockchain() == Blockchain.Binance) { baseUrl = Server.ApiBinance.Method.API_V1; @@ -477,16 +520,20 @@ public class BinanceEngine extends CoinEngine { .build(); BinanceApi binanceApi = retrofitBinance.create(BinanceApi.class); - Call call = binanceApi.binanceFees(); - call.enqueue(new Callback() { + Call> call = binanceApi.binanceFees(); + call.enqueue(new Callback>() { @Override - public void onResponse(@NonNull Call call, @NonNull Response response) { + public void onResponse(@NonNull Call> call, @NonNull Response> response) { if (response.code() == 200) { - Long fee = response.body().getFixed_fee_params().getFee(); - Amount feeAmount = new Amount(BigDecimal.valueOf(fee).divide(BigDecimal.valueOf(100000000)).setScale(8, RoundingMode.DOWN), getFeeCurrency()); - coinData.minFee = coinData.normalFee = coinData.maxFee = feeAmount; - Log.i(TAG, "requestFee onResponse " + response.code()); - blockchainRequestsCallbacks.onComplete(true); + for (BinanceFees fee : response.body()) { + if (fee.getFixed_fee_params() != null) { + Long longFee = Long.valueOf(fee.getFixed_fee_params().getFee()); + Amount feeAmount = new Amount(BigDecimal.valueOf(longFee).divide(BigDecimal.valueOf(100000000)).setScale(8, RoundingMode.DOWN), getFeeCurrency()); + coinData.minFee = coinData.normalFee = coinData.maxFee = feeAmount; + Log.i(TAG, "requestFee onResponse " + response.code()); + blockchainRequestsCallbacks.onComplete(true); + } + } } else { ctx.setError(response.code()); Log.e(TAG, "requestFee onResponse " + response.code()); @@ -495,7 +542,7 @@ public class BinanceEngine extends CoinEngine { } @Override - public void onFailure(@NonNull Call call, @NonNull Throwable t) { + public void onFailure(@NonNull Call> call, @NonNull Throwable t) { ctx.setError(t.getMessage()); Log.e(TAG, "requestFee onFailure " + t.getMessage()); blockchainRequestsCallbacks.onComplete(false); @@ -510,17 +557,27 @@ public class BinanceEngine extends CoinEngine { } public void requestSendTransaction(BlockchainRequestsCallbacks blockchainRequestsCallbacks, byte[] txForSend) { - RequestBody requestBody = TransactionRequestAssemblerExtSign.createRequestBody(txForSend); +// RequestBody requestBody = TransactionRequestAssemblerExtSign.createRequestBody(txForSend); try { - List metadatas = client.broadcastNoWallet(requestBody, true); - if (!metadatas.isEmpty() && metadatas.get(0).isOk()) { - ctx.setError(null); - blockchainRequestsCallbacks.onComplete(true); - } else { - Log.e(TAG, "Transaction send error"); - ctx.setError("Transaction send error"); - blockchainRequestsCallbacks.onComplete(false); - } + ServerApiBinance serverApiBinance = new ServerApiBinance(); + + ServerApiBinance.ResponseListener responseListener = new ServerApiBinance.ResponseListener() { + @Override + public void onSuccess() { + ctx.setError(null); + blockchainRequestsCallbacks.onComplete(true); + } + + @Override + public void onFail() { + ctx.setError("Transaction send error"); + blockchainRequestsCallbacks.onComplete(false); + } + }; + + serverApiBinance.setResponseListener(responseListener); + serverApiBinance.sendTransaction(txForSend, client); + } catch (Exception e) { Log.e(TAG, "Transaction send error"); ctx.setError("Transaction send error"); @@ -528,7 +585,7 @@ public class BinanceEngine extends CoinEngine { } } - public boolean allowSelectFeeInclusion() { + public boolean allowSelectFeeLevel() { return false; } } diff --git a/app/src/main/java/com/tangem/wallet/binance/client/BinanceDexApiRestClient.java b/app/src/main/java/com/tangem/wallet/binance/client/BinanceDexApiRestClient.java index 2e8f6675b2..9f09541d02 100644 --- a/app/src/main/java/com/tangem/wallet/binance/client/BinanceDexApiRestClient.java +++ b/app/src/main/java/com/tangem/wallet/binance/client/BinanceDexApiRestClient.java @@ -72,7 +72,7 @@ public interface BinanceDexApiRestClient { List transfer(Transfer transfer, Wallet wallet, TransactionOption options, boolean sync) throws IOException, NoSuchAlgorithmException; - TransactionRequestAssemblerExtSign prepareTransfer(Transfer transfer, BinanceData binanceData, byte[] pubKey, TransactionOption options, boolean sync) + TransactionRequestAssemblerExtSign prepareTransfer(Transfer transfer, BinanceData binanceData, byte[] pubKeyFroSign, TransactionOption options, boolean sync) throws IOException, NoSuchAlgorithmException; List freeze(TokenFreeze freeze, Wallet wallet, TransactionOption options, boolean sync) diff --git a/app/src/main/java/com/tangem/wallet/binance/client/encoding/message/TransactionRequestAssemblerExtSign.java b/app/src/main/java/com/tangem/wallet/binance/client/encoding/message/TransactionRequestAssemblerExtSign.java index 97ef075d3e..6825e6de3f 100644 --- a/app/src/main/java/com/tangem/wallet/binance/client/encoding/message/TransactionRequestAssemblerExtSign.java +++ b/app/src/main/java/com/tangem/wallet/binance/client/encoding/message/TransactionRequestAssemblerExtSign.java @@ -19,7 +19,7 @@ import java.util.List; import okhttp3.RequestBody; /** - * Assemble a transaction message body. + * Assemble a transaction message body with external signature * https://testnet-dex.binance.org/doc/encoding.html */ public class TransactionRequestAssemblerExtSign { @@ -29,12 +29,12 @@ public class TransactionRequestAssemblerExtSign { //private Wallet wallet; private BinanceData binanceData; - private byte[] pubKey; + private byte[] pubKeyForSign; private TransactionOption options; - public TransactionRequestAssemblerExtSign(BinanceData binanceData, byte[] pubKey, TransactionOption options) { + public TransactionRequestAssemblerExtSign(BinanceData binanceData, byte[] pubKeyForSign, TransactionOption options) { this.binanceData = binanceData; - this.pubKey = pubKey; + this.pubKeyForSign = pubKeyForSign; this.options = options; } @@ -62,7 +62,7 @@ public class TransactionRequestAssemblerExtSign { } public byte[] encodeSignature(byte[] signatureBytes) throws IOException { - StdSignature stdSignature = StdSignature.newBuilder().setPubKey(ByteString.copyFrom(pubKey)) + StdSignature stdSignature = StdSignature.newBuilder().setPubKey(ByteString.copyFrom(pubKeyForSign)) .setSignature(ByteString.copyFrom(signatureBytes)) .setAccountNumber(binanceData.getAccountNumber()) .setSequence(binanceData.getSequence()) diff --git a/app/src/main/java/com/tangem/wallet/binance/client/impl/BinanceDexApiRestClientImpl.java b/app/src/main/java/com/tangem/wallet/binance/client/impl/BinanceDexApiRestClientImpl.java index 7f2cc260d2..4ce3be6e21 100644 --- a/app/src/main/java/com/tangem/wallet/binance/client/impl/BinanceDexApiRestClientImpl.java +++ b/app/src/main/java/com/tangem/wallet/binance/client/impl/BinanceDexApiRestClientImpl.java @@ -198,9 +198,9 @@ public class BinanceDexApiRestClientImpl implements BinanceDexApiRestClient { return broadcast(requestBody, sync, wallet); } - public TransactionRequestAssemblerExtSign prepareTransfer(Transfer transfer, BinanceData binanceData, byte[] pubKey, TransactionOption options, boolean sync) + public TransactionRequestAssemblerExtSign prepareTransfer(Transfer transfer, BinanceData binanceData, byte[] pubKeyFroSign, TransactionOption options, boolean sync) throws IOException, NoSuchAlgorithmException { - TransactionRequestAssemblerExtSign assembler = new TransactionRequestAssemblerExtSign(binanceData, pubKey, options); + TransactionRequestAssemblerExtSign assembler = new TransactionRequestAssemblerExtSign(binanceData, pubKeyFroSign, options); return assembler; // RequestBody requestBody = assembler.buildTransfer(transfer); // return broadcast(requestBody, sync, wallet);