Updated on 2026-08-14

This commit is contained in:
Tangem 2018-11-08 12:21:22 +03:00
parent a5fc35bc25
commit b3a6a8dc9b
2 changed files with 10 additions and 8 deletions

View file

@ -155,6 +155,10 @@ public class ElectrumRequest {
return getAnswer().getJSONObject("result");
}
public JSONObject getError() throws JSONException {
return getAnswer().getJSONObject("error");
}
public String getResultString() throws JSONException {
return getAnswer().getString("result");
}

View file

@ -58,11 +58,10 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onSuccess(electrumRequest: ElectrumRequest?) {
if (electrumRequest!!.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
try {
val hashTX = electrumRequest.resultString
if (hashTX.length > 1)
finishWithSuccess()
else
finishWithError("empty hash")
if (electrumRequest.resultString.isEmpty())
finishWithError("Rejected by node: " + electrumRequest.getError())
finishWithSuccess()
} catch (e: JSONException) {
e.printStackTrace()
}
@ -82,9 +81,8 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
ServerApiHelper.INFURA_ETH_SEND_RAW_TRANSACTION -> {
try {
//infuraResponse.result - it's HashTX
if (infuraResponse.result.isEmpty()) {
finishWithError("Rejected by server: " + infuraResponse.error)
}
if (infuraResponse.result.isEmpty())
finishWithError("Rejected by node: " + infuraResponse.error)
val nonce = (ctx.coinData!! as EthData).confirmedTXCount
nonce.add(BigInteger.valueOf(1))