From 1efd036484c15ab37f9db412ac058c935e1b8a14 Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 28 Aug 2024 14:03:04 -0400 Subject: [PATCH] support nonzero_unlock_time in submit tx result --- src/main/ts/daemon/MoneroDaemonRpc.ts | 1 + src/main/ts/daemon/model/MoneroSubmitTxResult.ts | 10 ++++++++++ src/test/TestMoneroDaemonRpc.ts | 1 + 3 files changed, 12 insertions(+) diff --git a/src/main/ts/daemon/MoneroDaemonRpc.ts b/src/main/ts/daemon/MoneroDaemonRpc.ts index accff3b0c..1e7e18647 100644 --- a/src/main/ts/daemon/MoneroDaemonRpc.ts +++ b/src/main/ts/daemon/MoneroDaemonRpc.ts @@ -1343,6 +1343,7 @@ class MoneroDaemonRpc extends MoneroDaemon { else if (key === "status" || key === "untrusted") {} // handled elsewhere else if (key === "top_hash") result.setTopBlockHash("" === val ? undefined : val); else if (key === "tx_extra_too_big") result.setIsTxExtraTooBig(val); + else if (key === "nonzero_unlock_time") result.setIsNonzeroUnlockTime(val); else console.log("WARNING: ignoring unexpected field in submit tx hex result: " + key + ": " + val); } return result; diff --git a/src/main/ts/daemon/model/MoneroSubmitTxResult.ts b/src/main/ts/daemon/model/MoneroSubmitTxResult.ts index 6c7420d2c..8f6a3f34c 100644 --- a/src/main/ts/daemon/model/MoneroSubmitTxResult.ts +++ b/src/main/ts/daemon/model/MoneroSubmitTxResult.ts @@ -18,6 +18,7 @@ export default class MoneroSubmitTxResult { credits: bigint; topBlockHash: string; isTxExtraTooBig: boolean; + isNonzeroUnlockTime: boolean; constructor(result?: Partial) { Object.assign(this, result); @@ -164,4 +165,13 @@ export default class MoneroSubmitTxResult { this.isTxExtraTooBig = isTxExtraTooBig; return this; } + + getIsNonzeroUnlockTime(): boolean { + return this.isNonzeroUnlockTime; + } + + setIsNonzeroUnlockTime(isNonzeroUnlockTime: boolean): MoneroSubmitTxResult { + this.isNonzeroUnlockTime = isNonzeroUnlockTime; + return this; + } } diff --git a/src/test/TestMoneroDaemonRpc.ts b/src/test/TestMoneroDaemonRpc.ts index 474083a75..f2f07e748 100644 --- a/src/test/TestMoneroDaemonRpc.ts +++ b/src/test/TestMoneroDaemonRpc.ts @@ -1618,6 +1618,7 @@ function testSubmitTxResultGood(result: MoneroSubmitTxResult) { assert.equal(result.getTopBlockHash(), undefined); assert.equal(result.getIsTxExtraTooBig(), false); assert.equal(result.getIsGood(), true); + assert.equal(result.getIsNonzeroUnlockTime(), false); } catch (e) { console.log("Submit result is not good: " + JSON.stringify(result.toJson())); throw e;