@txnlab/use-wallet 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +10 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +10 -6
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1820,6 +1820,7 @@ class WalletConnectClient extends BaseClient {
|
|
|
1820
1820
|
const decodedTxns = transactions.map((txn) => {
|
|
1821
1821
|
return this.algosdk.decodeObj(txn);
|
|
1822
1822
|
});
|
|
1823
|
+
const signedIndexes = [];
|
|
1823
1824
|
// Marshal the transactions,
|
|
1824
1825
|
// and add the signers property if they shouldn't be signed.
|
|
1825
1826
|
const txnsToSign = decodedTxns.reduce((acc, txn, i) => {
|
|
@@ -1827,12 +1828,14 @@ class WalletConnectClient extends BaseClient {
|
|
|
1827
1828
|
if (indexesToSign &&
|
|
1828
1829
|
indexesToSign.length &&
|
|
1829
1830
|
indexesToSign.includes(i)) {
|
|
1831
|
+
signedIndexes.push(i);
|
|
1830
1832
|
acc.push({
|
|
1831
1833
|
txn: Buffer.from(transactions[i]).toString("base64"),
|
|
1832
1834
|
});
|
|
1833
1835
|
}
|
|
1834
1836
|
else if (!isSigned &&
|
|
1835
1837
|
connectedAccounts.includes(this.algosdk.encodeAddress(txn["snd"]))) {
|
|
1838
|
+
signedIndexes.push(i);
|
|
1836
1839
|
acc.push({
|
|
1837
1840
|
txn: Buffer.from(transactions[i]).toString("base64"),
|
|
1838
1841
|
});
|
|
@@ -1856,14 +1859,15 @@ class WalletConnectClient extends BaseClient {
|
|
|
1856
1859
|
const result = await this.#client.sendCustomRequest(request);
|
|
1857
1860
|
this.keepWCAliveStop();
|
|
1858
1861
|
// Join the newly signed transactions with the original group of transactions.
|
|
1859
|
-
const signedTxns =
|
|
1860
|
-
if (
|
|
1861
|
-
|
|
1862
|
+
const signedTxns = transactions.reduce((acc, txn, i) => {
|
|
1863
|
+
if (signedIndexes.includes(i)) {
|
|
1864
|
+
const signedByUser = result[i];
|
|
1865
|
+
signedByUser && acc.push(new Uint8Array(Buffer.from(signedByUser, 'base64')));
|
|
1862
1866
|
}
|
|
1863
|
-
if (returnGroup) {
|
|
1864
|
-
|
|
1867
|
+
else if (returnGroup) {
|
|
1868
|
+
acc.push(txn);
|
|
1865
1869
|
}
|
|
1866
|
-
return
|
|
1870
|
+
return acc;
|
|
1867
1871
|
}, []);
|
|
1868
1872
|
return signedTxns;
|
|
1869
1873
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "https://github.com/txnlab/use-wallet/issues"
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://txnlab.github.io/use-wallet",
|
|
15
|
-
"version": "1.2.
|
|
15
|
+
"version": "1.2.5",
|
|
16
16
|
"description": "React hooks for using Algorand compatible wallets in dApps.",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"dev": "yarn storybook",
|