Skip to content

Commit c973514

Browse files
authored
TXN-1274: Fix handling signed transactions in WalletConnect client (#50)
1 parent cbbfefb commit c973514

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"url": "https://github.com/txnlab/use-wallet/issues"
1313
},
1414
"homepage": "https://txnlab.github.io/use-wallet",
15-
"version": "1.2.4",
15+
"version": "1.2.5",
1616
"description": "React hooks for using Algorand compatible wallets in dApps.",
1717
"scripts": {
1818
"dev": "yarn storybook",

src/clients/walletconnect/client.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,16 @@ class WalletConnectClient extends BaseWallet {
234234
this.keepWCAliveStop();
235235

236236
// Join the newly signed transactions with the original group of transactions.
237-
const signedTxns = result.reduce((signedTxns: Uint8Array[], txn, i) => {
238-
if (txn) {
239-
signedTxns.push(new Uint8Array(Buffer.from(txn, "base64")));
237+
const signedTxns = transactions.reduce<Uint8Array[]>((acc, txn, i) => {
238+
if (signedIndexes.includes(i)) {
239+
const signedByUser = result[i]
240+
signedByUser && acc.push(new Uint8Array(Buffer.from(signedByUser, 'base64')))
241+
} else if (returnGroup) {
242+
acc.push(txn)
240243
}
241244

242-
if (returnGroup) {
243-
signedTxns.push(transactions[i]);
244-
}
245-
246-
return signedTxns;
247-
}, []);
245+
return acc
246+
}, [])
248247

249248
return signedTxns;
250249
}

0 commit comments

Comments
 (0)