From e878ba1e3ceb3cdd637c07a475205d36e219bc0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Fern=C3=A1ndez?= Date: Tue, 9 Jul 2024 15:07:32 +0000 Subject: [PATCH] Keep a default node for signTransaction --- src/lib/dapp/DAppSigner.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/dapp/DAppSigner.ts b/src/lib/dapp/DAppSigner.ts index 23d8f889..2245edac 100644 --- a/src/lib/dapp/DAppSigner.ts +++ b/src/lib/dapp/DAppSigner.ts @@ -174,9 +174,13 @@ export class DAppSigner implements Signer { } async signTransaction(transaction: T): Promise { + let nodeAccountId: AccountId + if (!transaction.nodeAccountIds || transaction.nodeAccountIds.length === 0) + nodeAccountId = this._getRandomNodes(1)[0] + else nodeAccountId = transaction.nodeAccountIds[0] const transactionBody: proto.TransactionBody = transactionToTransactionBody( transaction, - transaction.nodeAccountIds[0], + nodeAccountId, ) const transactionBodyBase64 = transactionBodyToBase64String(transactionBody)