Updated on 2026-08-14
This commit is contained in:
parent
a5fc35bc25
commit
b3a6a8dc9b
2 changed files with 10 additions and 8 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue