@txnlab/use-wallet 1.3.0 → 1.3.1-alpha.0

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/README.md CHANGED
@@ -19,8 +19,6 @@ Preview a basic implementation in [Storybook](https://txnlab.github.io/use-walle
19
19
 
20
20
  ## Quick Start
21
21
 
22
- ⚠️ If you're using `create-react-app` and `webpack 5` (most newer React projects), you will need to install polyfills. Follow [these directions](#webpack-5).
23
-
24
22
  ### Yarn
25
23
 
26
24
  ```bash
package/dist/cjs/index.js CHANGED
@@ -1154,7 +1154,11 @@ class PeraWalletClient extends BaseClient {
1154
1154
  async disconnect() {
1155
1155
  await this.#client.disconnect();
1156
1156
  }
1157
- async signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
1157
+ async signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
1158
+ // If txnGroups is a nested array, flatten it
1159
+ const transactions = Array.isArray(txnGroups[0])
1160
+ ? txnGroups.flatMap((txn) => txn)
1161
+ : txnGroups;
1158
1162
  // Decode the transactions to access their properties.
1159
1163
  const decodedTxns = transactions.map((txn) => {
1160
1164
  return this.algosdk.decodeObj(txn);
@@ -1294,7 +1298,11 @@ class DaffiWalletClient extends BaseClient {
1294
1298
  async disconnect() {
1295
1299
  await this.#client.disconnect();
1296
1300
  }
1297
- async signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
1301
+ async signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
1302
+ // If txnGroups is a nested array, flatten it
1303
+ const transactions = Array.isArray(txnGroups[0])
1304
+ ? txnGroups.flatMap((txn) => txn)
1305
+ : txnGroups;
1298
1306
  // Decode the transactions to access their properties.
1299
1307
  const decodedTxns = transactions.map((txn) => {
1300
1308
  return this.algosdk.decodeObj(txn);
@@ -1537,7 +1545,11 @@ class DeflyWalletClient extends BaseClient {
1537
1545
  async disconnect() {
1538
1546
  await this.#client.disconnect();
1539
1547
  }
1540
- async signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
1548
+ async signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
1549
+ // If txnGroups is a nested array, flatten it
1550
+ const transactions = Array.isArray(txnGroups[0])
1551
+ ? txnGroups.flatMap((txn) => txn)
1552
+ : txnGroups;
1541
1553
  // Decode the transactions to access their properties.
1542
1554
  const decodedTxns = transactions.map((txn) => {
1543
1555
  return this.algosdk.decodeObj(txn);
@@ -1680,7 +1692,11 @@ class ExodusClient extends BaseClient {
1680
1692
  async disconnect() {
1681
1693
  return;
1682
1694
  }
1683
- async signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
1695
+ async signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
1696
+ // If txnGroups is a nested array, flatten it
1697
+ const transactions = Array.isArray(txnGroups[0])
1698
+ ? txnGroups.flatMap((txn) => txn)
1699
+ : txnGroups;
1684
1700
  // Decode the transactions to access their properties.
1685
1701
  const decodedTxns = transactions.map((txn) => {
1686
1702
  return this.algosdk.decodeObj(txn);
@@ -1979,7 +1995,11 @@ class WalletConnectClient extends BaseClient {
1979
1995
  console.error('Error disconnecting', e);
1980
1996
  }
1981
1997
  }
1982
- async signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
1998
+ async signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
1999
+ // If txnGroups is a nested array, flatten it
2000
+ const transactions = Array.isArray(txnGroups[0])
2001
+ ? txnGroups.flatMap((txn) => txn)
2002
+ : txnGroups;
1983
2003
  // Decode the transactions to access their properties.
1984
2004
  const decodedTxns = transactions.map((txn) => {
1985
2005
  return this.algosdk.decodeObj(txn);
@@ -2149,7 +2169,11 @@ class KMDWalletClient extends BaseClient {
2149
2169
  this.walletId = walletMap[this.#wallet];
2150
2170
  return this.walletId;
2151
2171
  }
2152
- async signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
2172
+ async signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
2173
+ // If txnGroups is a nested array, flatten it
2174
+ const transactions = Array.isArray(txnGroups[0])
2175
+ ? txnGroups.flatMap((txn) => txn)
2176
+ : txnGroups;
2153
2177
  // Decode the transactions to access their properties.
2154
2178
  const decodedTxns = transactions.map((txn) => {
2155
2179
  return this.algosdk.decodeObj(txn);
@@ -2270,10 +2294,14 @@ class MnemonicWalletClient extends BaseClient {
2270
2294
  const pass = prompt('enter mnemonic passphrase, 25 words');
2271
2295
  return pass ? pass : '';
2272
2296
  }
2273
- signTransactions(connectedAccounts, transactions, indexesToSign, returnGroup = true) {
2297
+ signTransactions(connectedAccounts, txnGroups, indexesToSign, returnGroup = true) {
2274
2298
  if (!this.#client) {
2275
2299
  throw new Error('Client not connected');
2276
2300
  }
2301
+ // If txnGroups is a nested array, flatten it
2302
+ const transactions = Array.isArray(txnGroups[0])
2303
+ ? txnGroups.flatMap((txn) => txn)
2304
+ : txnGroups;
2277
2305
  // Decode the transactions to access their properties.
2278
2306
  const decodedTxns = transactions.map((txn) => {
2279
2307
  return this.algosdk.decodeObj(txn);