Updated on 2026-08-14
This commit is contained in:
parent
2550dff2f4
commit
9c4bd4f3b3
2 changed files with 35 additions and 13 deletions
|
|
@ -420,7 +420,7 @@ public class ServerApiHelper {
|
|||
socket.bind(new InetSocketAddress(0));
|
||||
socket.connect(new InetSocketAddress(serverAddress, port));
|
||||
try {
|
||||
Log.i(TAG, "<< ");
|
||||
// Log.i(TAG, "<< ");
|
||||
OutputStream os = socket.getOutputStream();
|
||||
OutputStreamWriter out = new OutputStreamWriter(os, "UTF-8");
|
||||
InputStream is = socket.getInputStream();
|
||||
|
|
@ -436,10 +436,10 @@ public class ServerApiHelper {
|
|||
electrumRequest.host = host;
|
||||
electrumRequest.port = port;
|
||||
if (electrumRequest.answerData != null) {
|
||||
Log.i(TAG, ">> " + electrumRequest.answerData);
|
||||
// Log.i(TAG, ">> " + electrumRequest.answerData);
|
||||
} else {
|
||||
electrumRequest.error = "No answer from server";
|
||||
Log.i(TAG, ">> <NULL>");
|
||||
// Log.i(TAG, ">> <NULL>");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
electrumRequest.error = e.toString();
|
||||
|
|
@ -447,9 +447,9 @@ public class ServerApiHelper {
|
|||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.i(TAG, e.getMessage());
|
||||
// Log.i(TAG, e.getMessage());
|
||||
} finally {
|
||||
Log.i(TAG, "close");
|
||||
// Log.i(TAG, "close");
|
||||
socket.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -270,7 +270,24 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
e.printStackTrace()
|
||||
engine.switchNode(card)
|
||||
}
|
||||
}
|
||||
|
||||
if (it.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
|
||||
try {
|
||||
var hashTX = it.resultString
|
||||
try {
|
||||
LastSignStorage.setLastMessage(card!!.wallet, hashTX)
|
||||
if (hashTX.startsWith("0x") || hashTX.startsWith("0X"))
|
||||
hashTX = hashTX.substring(2)
|
||||
val bigInt = BigInteger(hashTX, 16) //TODO: очень плохой способ
|
||||
LastSignStorage.setTxWasSend(card!!.wallet)
|
||||
LastSignStorage.setLastMessage(card!!.wallet, "")
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1016,17 +1033,22 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
requestInfura(ServerApiHelper.INFURA_ETH_SEND_RAW_TRANSACTION, "")
|
||||
|
||||
} else if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet) {
|
||||
val nodeAddress = engine!!.getNode(card)
|
||||
val nodePort = engine.getNodePort(card)
|
||||
// val nodeAddress = engine!!.getNode(card)
|
||||
// val nodePort = engine.getNodePort(card)
|
||||
//
|
||||
// val connectTask = UpdateWalletInfoTask(this@LoadedWallet, nodeAddress, nodePort)
|
||||
// connectTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
|
||||
requestElectrum(card!!, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
|
||||
val connectTask = UpdateWalletInfoTask(this@LoadedWallet, nodeAddress, nodePort)
|
||||
connectTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
} else if (card!!.blockchain == Blockchain.BitcoinCash || card!!.blockchain == Blockchain.BitcoinCashTestNet) {
|
||||
val nodeAddress = engine!!.getNode(card)
|
||||
val nodePort = engine.getNodePort(card)
|
||||
// val nodeAddress = engine!!.getNode(card)
|
||||
// val nodePort = engine.getNodePort(card)
|
||||
//
|
||||
// val connectTask = UpdateWalletInfoTask(this@LoadedWallet, nodeAddress, nodePort)
|
||||
// connectTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
|
||||
val connectTask = UpdateWalletInfoTask(this@LoadedWallet, nodeAddress, nodePort)
|
||||
connectTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
requestElectrum(card!!, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue