From 9e7dad8c3f24db718b098b9426d1b2b5e73f5b03 Mon Sep 17 00:00:00 2001 From: xiuxiufxx Date: Wed, 12 Oct 2022 18:07:34 +0800 Subject: [PATCH] New function: the transaction needs to be signed by the node and sent to the chain --- src/transaction/submit.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/transaction/submit.js b/src/transaction/submit.js index e310d386..55cda940 100644 --- a/src/transaction/submit.js +++ b/src/transaction/submit.js @@ -26,14 +26,22 @@ function formatSubmitResponse(response) { if (isImmediateRejection(response.engine_result)) { throw new utils.common.errors.ChainsqldError('Submit failed', data) } + if (response.hasOwnProperty("tx_json") && response.tx_json !== "") { + data.txJson = response.tx_json; + } return data } function submit(signedTransaction: string): Promise { validate.submit({signedTransaction}) - + var cmd; + if(isNeedPeerSign){ + cmd = 'submit_peer_sign' + }else{ + cmd = 'submit' + } const request = { - command: 'submit', + command: cmd, tx_blob: signedTransaction } return this.connection.request(request).then(formatSubmitResponse)