Skip to content

Commit

Permalink
TXN-1276: Handle varying payload lengths in signTransactions (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
drichar authored Mar 14, 2023
1 parent c973514 commit 79a9228
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/clients/walletconnect/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,13 @@ class WalletConnectClient extends BaseWallet {

this.keepWCAliveStop();

// Check if the result is the same length as the transactions
const lengthsMatch = result.length === transactions.length

// Join the newly signed transactions with the original group of transactions.
const signedTxns = transactions.reduce<Uint8Array[]>((acc, txn, i) => {
if (signedIndexes.includes(i)) {
const signedByUser = result[i]
const signedByUser = lengthsMatch ? result[i] : result.shift()
signedByUser && acc.push(new Uint8Array(Buffer.from(signedByUser, 'base64')))
} else if (returnGroup) {
acc.push(txn)
Expand Down

0 comments on commit 79a9228

Please sign in to comment.