@txnlab/use-wallet 1.2.6 → 1.2.8

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.
Files changed (98) hide show
  1. package/README.md +69 -90
  2. package/dist/cjs/algod/index.d.ts +3 -3
  3. package/dist/cjs/clients/algosigner/client.d.ts +11 -6
  4. package/dist/cjs/clients/algosigner/index.d.ts +1 -1
  5. package/dist/cjs/clients/algosigner/types.d.ts +21 -17
  6. package/dist/cjs/clients/base/base.d.ts +13 -11
  7. package/dist/cjs/clients/base/index.d.ts +1 -1
  8. package/dist/cjs/clients/defly/client.d.ts +7 -7
  9. package/dist/cjs/clients/defly/index.d.ts +1 -1
  10. package/dist/cjs/clients/defly/types.d.ts +4 -4
  11. package/dist/cjs/clients/exodus/client.d.ts +6 -6
  12. package/dist/cjs/clients/exodus/index.d.ts +1 -1
  13. package/dist/cjs/clients/exodus/types.d.ts +3 -3
  14. package/dist/cjs/clients/index.d.ts +9 -9
  15. package/dist/cjs/clients/kmd/client.d.ts +7 -7
  16. package/dist/cjs/clients/kmd/index.d.ts +1 -1
  17. package/dist/cjs/clients/kmd/types.d.ts +3 -3
  18. package/dist/cjs/clients/mnemonic/client.d.ts +20 -10
  19. package/dist/cjs/clients/mnemonic/index.d.ts +1 -1
  20. package/dist/cjs/clients/mnemonic/types.d.ts +3 -3
  21. package/dist/cjs/clients/myalgo/client.d.ts +6 -6
  22. package/dist/cjs/clients/myalgo/index.d.ts +1 -1
  23. package/dist/cjs/clients/myalgo/types.d.ts +3 -3
  24. package/dist/cjs/clients/pera/client.d.ts +6 -6
  25. package/dist/cjs/clients/pera/index.d.ts +1 -1
  26. package/dist/cjs/clients/pera/types.d.ts +4 -4
  27. package/dist/cjs/clients/walletconnect/client.d.ts +6 -6
  28. package/dist/cjs/clients/walletconnect/index.d.ts +1 -1
  29. package/dist/cjs/clients/walletconnect/types.d.ts +4 -4
  30. package/dist/cjs/constants/constants.d.ts +1 -1
  31. package/dist/cjs/constants/index.d.ts +1 -1
  32. package/dist/cjs/hooks/index.d.ts +1 -1
  33. package/dist/cjs/hooks/useWallet.d.ts +9 -7
  34. package/dist/cjs/index.d.ts +6 -6
  35. package/dist/cjs/index.js +342 -332
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/store/index.d.ts +2 -2
  38. package/dist/cjs/store/state/clientStore.d.ts +1 -1
  39. package/dist/cjs/store/state/walletStore.d.ts +2 -2
  40. package/dist/cjs/types/api.d.ts +5 -2
  41. package/dist/cjs/types/index.d.ts +3 -3
  42. package/dist/cjs/types/node.d.ts +6 -6
  43. package/dist/cjs/types/wallet.d.ts +11 -9
  44. package/dist/cjs/utils/clearAccounts.d.ts +1 -1
  45. package/dist/cjs/utils/encodeNFDTransactionsArray.d.ts +1 -1
  46. package/dist/cjs/utils/index.d.ts +3 -3
  47. package/dist/cjs/utils/initializeProviders.d.ts +2 -2
  48. package/dist/cjs/utils/providers.d.ts +1 -1
  49. package/dist/cjs/utils/reconnectProviders.d.ts +1 -1
  50. package/dist/esm/algod/index.d.ts +3 -3
  51. package/dist/esm/clients/algosigner/client.d.ts +11 -6
  52. package/dist/esm/clients/algosigner/index.d.ts +1 -1
  53. package/dist/esm/clients/algosigner/types.d.ts +21 -17
  54. package/dist/esm/clients/base/base.d.ts +13 -11
  55. package/dist/esm/clients/base/index.d.ts +1 -1
  56. package/dist/esm/clients/defly/client.d.ts +7 -7
  57. package/dist/esm/clients/defly/index.d.ts +1 -1
  58. package/dist/esm/clients/defly/types.d.ts +4 -4
  59. package/dist/esm/clients/exodus/client.d.ts +6 -6
  60. package/dist/esm/clients/exodus/index.d.ts +1 -1
  61. package/dist/esm/clients/exodus/types.d.ts +3 -3
  62. package/dist/esm/clients/index.d.ts +9 -9
  63. package/dist/esm/clients/kmd/client.d.ts +7 -7
  64. package/dist/esm/clients/kmd/index.d.ts +1 -1
  65. package/dist/esm/clients/kmd/types.d.ts +3 -3
  66. package/dist/esm/clients/mnemonic/client.d.ts +20 -10
  67. package/dist/esm/clients/mnemonic/index.d.ts +1 -1
  68. package/dist/esm/clients/mnemonic/types.d.ts +3 -3
  69. package/dist/esm/clients/myalgo/client.d.ts +6 -6
  70. package/dist/esm/clients/myalgo/index.d.ts +1 -1
  71. package/dist/esm/clients/myalgo/types.d.ts +3 -3
  72. package/dist/esm/clients/pera/client.d.ts +6 -6
  73. package/dist/esm/clients/pera/index.d.ts +1 -1
  74. package/dist/esm/clients/pera/types.d.ts +4 -4
  75. package/dist/esm/clients/walletconnect/client.d.ts +6 -6
  76. package/dist/esm/clients/walletconnect/index.d.ts +1 -1
  77. package/dist/esm/clients/walletconnect/types.d.ts +4 -4
  78. package/dist/esm/constants/constants.d.ts +1 -1
  79. package/dist/esm/constants/index.d.ts +1 -1
  80. package/dist/esm/hooks/index.d.ts +1 -1
  81. package/dist/esm/hooks/useWallet.d.ts +9 -7
  82. package/dist/esm/index.d.ts +6 -6
  83. package/dist/esm/index.js +342 -332
  84. package/dist/esm/store/index.d.ts +2 -2
  85. package/dist/esm/store/state/clientStore.d.ts +1 -1
  86. package/dist/esm/store/state/walletStore.d.ts +2 -2
  87. package/dist/esm/types/api.d.ts +5 -2
  88. package/dist/esm/types/index.d.ts +3 -3
  89. package/dist/esm/types/node.d.ts +6 -6
  90. package/dist/esm/types/wallet.d.ts +11 -9
  91. package/dist/esm/utils/clearAccounts.d.ts +1 -1
  92. package/dist/esm/utils/encodeNFDTransactionsArray.d.ts +1 -1
  93. package/dist/esm/utils/index.d.ts +3 -3
  94. package/dist/esm/utils/initializeProviders.d.ts +2 -2
  95. package/dist/esm/utils/providers.d.ts +1 -1
  96. package/dist/esm/utils/reconnectProviders.d.ts +1 -1
  97. package/dist/index.d.ts +119 -63
  98. package/package.json +9 -2
package/README.md CHANGED
@@ -46,29 +46,21 @@ npm install algosdk @blockshake/defly-connect @perawallet/connect @randlabs/myal
46
46
 
47
47
  ### Set up the Wallet Provider
48
48
 
49
- In `app.js`, initialize the Wallet Provider so that the `useWallet` hook can be used in the child components, and use the `reconnectProviders` function to restore sessions for users returning to the app.
50
-
49
+ In `app.js`, initialize the Wallet Provider so that the `useWallet` hook can be used in the child components, and use the `reconnectProviders` function to restore sessions for users returning to the app.
51
50
 
52
51
  ```jsx
53
- import React from "react";
54
- import {
55
- reconnectProviders,
56
- initializeProviders,
57
- WalletProvider,
58
- } from "@txnlab/use-wallet";
52
+ import React from 'react'
53
+ import { reconnectProviders, initializeProviders, WalletProvider } from '@txnlab/use-wallet'
59
54
 
60
- const walletProviders = initializeProviders();
55
+ const walletProviders = initializeProviders()
61
56
 
62
57
  export default function App() {
63
58
  // Reconnect the session when the user returns to the dApp
64
59
  React.useEffect(() => {
65
- reconnectProviders(walletProviders);
66
- }, []);
60
+ reconnectProviders(walletProviders)
61
+ }, [])
67
62
 
68
- return (
69
- <WalletProvider value={walletProviders}>
70
- ...
71
- </WalletProvider>);
63
+ return <WalletProvider value={walletProviders}>...</WalletProvider>
72
64
  }
73
65
  ```
74
66
 
@@ -77,26 +69,23 @@ The `reconnectProviders` function is used to restore session states of wallets t
77
69
  By default, all of the supported providers except for `KMD` are returned by `useConnectWallet`. An array can be passed to `initializeProviders` to determine which providers your dApp supports, as shown below.
78
70
 
79
71
  ```jsx
80
- import { initializeProviders, PROVIDER_ID } from "@txnlab/use-wallet";
72
+ import { initializeProviders, PROVIDER_ID } from '@txnlab/use-wallet'
81
73
 
82
- const walletProviders = initializeProviders([
83
- PROVIDER_ID.KMD_WALLET,
84
- PROVIDER_ID.WALLET_CONNECT,
85
- ]);
74
+ const walletProviders = initializeProviders([PROVIDER_ID.KMD_WALLET, PROVIDER_ID.WALLET_CONNECT])
86
75
  ```
87
76
 
88
77
  For more configuration options, see [Provider Configuration](#provider-configuration).
89
78
 
90
79
  ### Connect
91
80
 
92
- Map through the `providers` object to list the providers and enable users to connect.
81
+ Map through the `providers` object to list the providers and enable users to connect.
93
82
 
94
83
  ```jsx
95
- import React from "react";
96
- import { useWallet } from "@txnlab/use-wallet";
84
+ import React from 'react'
85
+ import { useWallet } from '@txnlab/use-wallet'
97
86
 
98
87
  export default function Connect() {
99
- const { providers, activeAccount } = useWallet();
88
+ const { providers, activeAccount } = useWallet()
100
89
 
101
90
  // Map through the providers.
102
91
  // Render account information and "connect", "set active", and "disconnect" buttons.
@@ -104,19 +93,16 @@ export default function Connect() {
104
93
  return (
105
94
  <div>
106
95
  {providers?.map((provider) => (
107
- <div key={"provider-" + provider.metadata.id}>
96
+ <div key={'provider-' + provider.metadata.id}>
108
97
  <h4>
109
98
  <img width={30} height={30} alt="" src={provider.metadata.icon} />
110
- {provider.metadata.name} {provider.isActive && "[active]"}
99
+ {provider.metadata.name} {provider.isActive && '[active]'}
111
100
  </h4>
112
101
  <div>
113
102
  <button onClick={provider.connect} disabled={provider.isConnected}>
114
103
  Connect
115
104
  </button>
116
- <button
117
- onClick={provider.disconnect}
118
- disabled={!provider.isConnected}
119
- >
105
+ <button onClick={provider.disconnect} disabled={!provider.isConnected}>
120
106
  Disconnect
121
107
  </button>
122
108
  <button
@@ -132,7 +118,9 @@ export default function Connect() {
132
118
  onChange={(e) => provider.setActiveAccount(e.target.value)}
133
119
  >
134
120
  {provider.accounts.map((account) => (
135
- <option key={account.address} value={account.address}>{account.address}</option>
121
+ <option key={account.address} value={account.address}>
122
+ {account.address}
123
+ </option>
136
124
  ))}
137
125
  </select>
138
126
  )}
@@ -141,9 +129,8 @@ export default function Connect() {
141
129
  </div>
142
130
  ))}
143
131
  </div>
144
- );
132
+ )
145
133
  }
146
-
147
134
  ```
148
135
 
149
136
  Each provider has two connection states: `isConnected` and `isActive`.
@@ -159,58 +146,47 @@ The `activeAccount` is the primary account that is currently active and will be
159
146
  Construct a transaction using `algosdk`, and sign and send the transaction using the `signTransactions` and `sendTransactions` functions provided by the `useWallet` hook.
160
147
 
161
148
  ```jsx
162
- import React from "react";
149
+ import React from 'react'
163
150
  import {
164
151
  useWallet,
165
152
  DEFAULT_NODE_BASEURL,
166
153
  DEFAULT_NODE_TOKEN,
167
- DEFAULT_NODE_PORT,
168
- } from "@txnlab/use-wallet";
169
- import algosdk from "algosdk";
170
-
171
- const algodClient = new algosdk.Algodv2(
172
- DEFAULT_NODE_TOKEN,
173
- DEFAULT_NODE_BASEURL,
174
154
  DEFAULT_NODE_PORT
175
- );
155
+ } from '@txnlab/use-wallet'
156
+ import algosdk from 'algosdk'
157
+
158
+ const algodClient = new algosdk.Algodv2(DEFAULT_NODE_TOKEN, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT)
176
159
 
177
160
  export default function Transact() {
178
- const { activeAddress, signTransactions, sendTransactions } = useWallet();
161
+ const { activeAddress, signTransactions, sendTransactions } = useWallet()
179
162
 
180
- const sendTransaction = async (
181
- from?: string,
182
- to?: string,
183
- amount?: number
184
- ) => {
163
+ const sendTransaction = async (from?: string, to?: string, amount?: number) => {
185
164
  if (!from || !to || !amount) {
186
- throw new Error("Missing transaction params.");
165
+ throw new Error('Missing transaction params.')
187
166
  }
188
167
 
189
- const suggestedParams = await algodClient.getTransactionParams().do();
168
+ const suggestedParams = await algodClient.getTransactionParams().do()
190
169
 
191
170
  const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
192
171
  from,
193
172
  to,
194
173
  amount,
195
- suggestedParams,
196
- });
174
+ suggestedParams
175
+ })
197
176
 
198
- const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction);
177
+ const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction)
199
178
 
200
- const signedTransactions = await signTransactions([encodedTransaction]);
179
+ const signedTransactions = await signTransactions([encodedTransaction])
201
180
 
202
- const waitRoundsToConfirm = 4;
181
+ const waitRoundsToConfirm = 4
203
182
 
204
- const { id } = await sendTransactions(
205
- signedTransactions,
206
- waitRoundsToConfirm
207
- );
183
+ const { id } = await sendTransactions(signedTransactions, waitRoundsToConfirm)
208
184
 
209
- console.log("Successfully sent transaction. Transaction ID: ", id);
210
- };
185
+ console.log('Successfully sent transaction. Transaction ID: ', id)
186
+ }
211
187
 
212
188
  if (!activeAddress) {
213
- return <p>Connect an account first.</p>;
189
+ return <p>Connect an account first.</p>
214
190
  }
215
191
 
216
192
  return (
@@ -222,7 +198,7 @@ export default function Transact() {
222
198
  Sign and send transactions
223
199
  </button>
224
200
  </div>
225
- );
201
+ )
226
202
  }
227
203
  ```
228
204
 
@@ -231,14 +207,14 @@ export default function Transact() {
231
207
  The `activeAccount` object can be used to display details for the currently active account. For convenience, the `activeAddress` property shows the currently active address.
232
208
 
233
209
  ```jsx
234
- import React from "react";
235
- import { useWallet } from "@txnlab/use-wallet";
210
+ import React from 'react'
211
+ import { useWallet } from '@txnlab/use-wallet'
236
212
 
237
213
  export default function Account() {
238
- const { activeAccount } = useWallet();
214
+ const { activeAccount } = useWallet()
239
215
 
240
216
  if (!activeAccount) {
241
- return <p>No account active.</p>;
217
+ return <p>No account active.</p>
242
218
  }
243
219
 
244
220
  return (
@@ -254,7 +230,7 @@ export default function Account() {
254
230
  Provider: <span>{activeAccount.providerId}</span>
255
231
  </p>
256
232
  </div>
257
- );
233
+ )
258
234
  }
259
235
  ```
260
236
 
@@ -263,32 +239,30 @@ export default function Account() {
263
239
  The `isActive` and `isReady` properties can be used to check the status of the wallets. The `isActive` property determines whether or not an account is currently active. The `isReady` property shows if `use-wallet` has mounted and successfully read the connection status from the providers. These properties are useful when setting up client side access restrictions, for example, by redirecting a user if no wallet is active, as shown below.
264
240
 
265
241
  ```jsx
266
- const { isActive, isReady } = useWallet()
242
+ const { isActive, isReady } = useWallet()
267
243
 
268
- useEffect(() => {
269
- if (isReady && isActive) {
270
- allowAccess()
271
- }
272
-
273
- if (isReady && !isActive) {
274
- denyAccess()
275
- }
276
- })
244
+ useEffect(() => {
245
+ if (isReady && isActive) {
246
+ allowAccess()
247
+ }
277
248
 
249
+ if (isReady && !isActive) {
250
+ denyAccess()
251
+ }
252
+ })
278
253
  ```
279
254
 
280
-
281
255
  ## Provider Configuration
282
256
 
283
257
  The `initializeProviders` functon accepts a configuration object that can be used to configure the nodes that the providers use to send transactions, as shown below.
284
258
 
285
259
  ```jsx
286
260
  const walletProviders = initializeProviders([], {
287
- network: "devmodenet",
288
- nodeServer: "http://algod",
289
- nodeToken: "xxxxxxxxx",
290
- nodePort: "8080",
291
- });
261
+ network: 'devmodenet',
262
+ nodeServer: 'http://algod',
263
+ nodeToken: 'xxxxxxxxx',
264
+ nodePort: '8080'
265
+ })
292
266
  ```
293
267
 
294
268
  Passing an empty array as the first argument enables all of the default providers. The `network` property should be specified as `betanet`, `testnet`, `mainnet` or the name of your local development network.
@@ -317,7 +291,7 @@ const walletProviders = {
317
291
  }),
318
292
  };
319
293
 
320
- ...
294
+ ...
321
295
 
322
296
  <WalletProvider value={walletProviders}>
323
297
  ...
@@ -326,9 +300,9 @@ const walletProviders = {
326
300
 
327
301
  ## Static Imports
328
302
 
329
- By default, `use-wallet` dynamically imports all of the dependencies for the providiers, as well as `algosdk`, to reduce bundle size.
303
+ By default, `use-wallet` dynamically imports all of the dependencies for the providiers, as well as `algosdk`, to reduce bundle size.
330
304
 
331
- Some React frameworks, like [Remix](https://remix.run/), do not support dynamic imports. To get around this, those dependencies can be imported in your application and passed to the `useWallet` provider. See below for an example.
305
+ Some React frameworks, like [Remix](https://remix.run/), do not support dynamic imports. To get around this, those dependencies can be imported in your application and passed to the `useWallet` provider. See below for an example.
332
306
 
333
307
  ```jsx
334
308
  ...
@@ -412,19 +386,22 @@ yarn link
412
386
  ```
413
387
 
414
388
  In the root of your application, run:
389
+
415
390
  ```bash
416
391
  yarn link @txnlab/use-wallet
417
392
  ```
418
393
 
419
- ### Symlink React
394
+ ### Symlink React
420
395
 
421
396
  In the root of your application, run:
397
+
422
398
  ```bash
423
399
  cd node_modules/react
424
400
  yarn link
425
401
  ```
426
402
 
427
403
  In the root of `use-wallet` directory, run:
404
+
428
405
  ```bash
429
406
  yarn link react
430
407
  ```
@@ -433,8 +410,10 @@ yarn link react
433
410
 
434
411
  Are you using `@txnlab/use-wallet`? We'd love to include you here. Let us know! [Twitter](https://twitter.com/NFDomains) | [Discord](https://discord.gg/7XcuMTfeZP) | [Email](mailto:admin@txnlab.dev)
435
412
 
436
- * [@algoscan/use-wallet-ui](https://github.com/algoscan/use-wallet-ui)
437
- * [@algoworldnft/algoworld-swapper](https://github.com/algoworldnft/algoworld-swapper)
413
+ - [@algoscan/use-wallet-ui](https://github.com/algoscan/use-wallet-ui)
414
+ - [@algoworldnft/algoworld-swapper](https://github.com/algoworldnft/algoworld-swapper)
415
+
416
+ Full list of [Dependents](https://github.com/TxnLab/use-wallet/network/dependents)
438
417
 
439
418
  ## License
440
419
 
@@ -1,7 +1,7 @@
1
- import type _algosdk from "algosdk";
2
- import type { AlgodClientOptions } from "../types";
1
+ import type _algosdk from 'algosdk';
2
+ import type { AlgodClientOptions } from '../types';
3
3
  export declare const getAlgosdk: () => Promise<typeof _algosdk>;
4
- export declare const getAlgodClient: (algosdk: typeof _algosdk, algodClientOptions?: AlgodClientOptions) => Promise<_algosdk.Algodv2>;
4
+ export declare const getAlgodClient: (algosdk: typeof _algosdk, algodClientOptions?: AlgodClientOptions) => _algosdk.Algodv2;
5
5
  export default class Algod {
6
6
  algosdk: typeof _algosdk;
7
7
  algodClient: _algosdk.Algodv2;
@@ -1,20 +1,23 @@
1
- import BaseWallet from "../base";
2
- import { PROVIDER_ID } from "../../constants";
3
- import type { Network } from "../../types";
4
- import type { AlgoSignerClientConstructor, InitParams } from "./types";
1
+ import BaseWallet from '../base';
2
+ import { PROVIDER_ID } from '../../constants';
3
+ import type { Network } from '../../types';
4
+ import type { AlgoSignerClientConstructor, InitParams } from './types';
5
+ import { useWalletStore } from '../../store';
5
6
  declare class AlgoSignerClient extends BaseWallet {
6
7
  #private;
7
8
  network: Network;
8
- constructor({ metadata, client, algosdk, algodClient, network, }: AlgoSignerClientConstructor);
9
+ walletStore: typeof useWalletStore;
10
+ constructor({ metadata, client, algosdk, algodClient, network }: AlgoSignerClientConstructor);
9
11
  static metadata: {
10
12
  id: PROVIDER_ID;
11
13
  name: string;
12
14
  icon: string;
13
15
  isWalletConnect: boolean;
14
16
  };
15
- static init({ algodOptions, algosdkStatic, network, }: InitParams): Promise<AlgoSignerClient | null>;
17
+ static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<AlgoSignerClient | null>;
16
18
  connect(): Promise<{
17
19
  accounts: {
20
+ authAddr?: string | undefined;
18
21
  name: string;
19
22
  address: string;
20
23
  providerId: PROVIDER_ID;
@@ -27,5 +30,7 @@ declare class AlgoSignerClient extends BaseWallet {
27
30
  reconnect(onDisconnect: () => void): Promise<null>;
28
31
  disconnect(): Promise<void>;
29
32
  signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
33
+ getGenesisID(): string;
34
+ getAuthAddress(address: string): string | undefined;
30
35
  }
31
36
  export default AlgoSignerClient;
@@ -1,2 +1,2 @@
1
- import algosigner from "./client";
1
+ import algosigner from './client';
2
2
  export default algosigner;
@@ -1,26 +1,30 @@
1
- import type _algosdk from "algosdk";
2
- import { PROVIDER_ID } from "../../constants";
3
- import type { AlgodClientOptions, Network, Metadata } from "../../types";
1
+ import type _algosdk from 'algosdk';
2
+ import { PROVIDER_ID } from '../../constants';
3
+ import type { AlgodClientOptions, Network, Metadata } from '../../types';
4
4
  export declare type WindowExtended = {
5
- AlgoSigner: AlgoSigner;
5
+ algorand: AlgoSigner;
6
6
  } & Window & typeof globalThis;
7
+ export declare type GenesisId = 'betanet-v1.0' | 'testnet-v1.0' | 'mainnet-v1.0' | string;
8
+ export declare type EnableParams = {
9
+ genesisID?: GenesisId;
10
+ genesisHash?: string;
11
+ accounts?: string[];
12
+ };
13
+ export declare type EnableResponse = {
14
+ genesisID: GenesisId;
15
+ genesisHash: string;
16
+ accounts: string[];
17
+ };
7
18
  export declare type AlgoSignerTransaction = {
8
19
  txn: string;
9
- signers?: [];
20
+ signers?: string[];
21
+ stxn?: string;
10
22
  multisig?: string;
23
+ authAddr?: string;
11
24
  };
12
- export declare type SupportedLedgers = "MainNet" | "TestNet" | "BetaNet" | string;
13
25
  export declare type AlgoSigner = {
14
- connect: () => Promise<Record<string, never>>;
15
- accounts: (ledger: {
16
- ledger: SupportedLedgers;
17
- }) => Promise<{
18
- address: string;
19
- }[]>;
20
- signTxn: (transactions: AlgoSignerTransaction[]) => Promise<{
21
- txID: string;
22
- blob: string;
23
- }[]>;
26
+ enable: (params?: EnableParams) => Promise<EnableResponse>;
27
+ signTxns: (transactions: AlgoSignerTransaction[]) => Promise<string[]>;
24
28
  encoding: {
25
29
  msgpackToBase64(transaction: Uint8Array): string;
26
30
  byteArrayToString(transaction: Uint8Array): string;
@@ -32,7 +36,7 @@ export declare type AlgoSignerClientConstructor = {
32
36
  id: PROVIDER_ID;
33
37
  algosdk: typeof _algosdk;
34
38
  algodClient: _algosdk.Algodv2;
35
- network: SupportedLedgers;
39
+ network: Network;
36
40
  };
37
41
  export declare type InitParams = {
38
42
  algodOptions?: AlgodClientOptions;
@@ -1,5 +1,5 @@
1
- import type _algosdk from "algosdk";
2
- import type { Asset, Wallet, AccountInfo, TransactionsArray, Metadata } from "../../types";
1
+ import type _algosdk from 'algosdk';
2
+ import type { Asset, Wallet, AccountInfo, TransactionsArray, TxnInfo, Metadata } from '../../types';
3
3
  declare abstract class BaseClient {
4
4
  algosdk: typeof _algosdk;
5
5
  algodClient: _algosdk.Algodv2;
@@ -15,9 +15,9 @@ declare abstract class BaseClient {
15
15
  getAccountInfo(address: string): Promise<AccountInfo>;
16
16
  getAssets(address: string): Promise<Asset[]>;
17
17
  waitForConfirmation(txId: string, timeout?: number): Promise<{
18
- "confirmed-round": number;
19
- "global-state-delta": Record<string, unknown>[];
20
- "pool-error": string;
18
+ 'confirmed-round': number;
19
+ 'global-state-delta': Record<string, unknown>[];
20
+ 'pool-error': string;
21
21
  txn: {
22
22
  sig: Uint8Array;
23
23
  txn: import("../../types").Txn;
@@ -26,19 +26,21 @@ declare abstract class BaseClient {
26
26
  }>;
27
27
  decodeTransaction: (txn: string, isSigned: boolean) => _algosdk.Transaction;
28
28
  logEncodedTransaction(txn: string, isSigned: boolean): void;
29
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
29
+ groupTransactionsBySender(transactions: TransactionsArray): {
30
+ [sender: string]: TxnInfo[];
31
+ };
30
32
  sendRawTransactions(transactions: Uint8Array[], waitRoundsToConfirm?: number): Promise<{
31
- "confirmed-round": number;
32
- "global-state-delta": Record<string, unknown>[];
33
- "pool-error": string;
33
+ 'confirmed-round': number;
34
+ 'global-state-delta': Record<string, unknown>[];
35
+ 'pool-error': string;
34
36
  txn: {
35
37
  sig: Uint8Array;
36
38
  txn: import("../../types").Txn;
37
39
  };
38
40
  txId: string;
39
- id: any;
41
+ id: string;
40
42
  }>;
41
- keepWCAliveStart(): void;
43
+ keepWCAliveStart(): Promise<void>;
42
44
  keepWCAliveStop(): void;
43
45
  }
44
46
  export default BaseClient;
@@ -1,2 +1,2 @@
1
- import baseClient from "./base";
1
+ import baseClient from './base';
2
2
  export default baseClient;
@@ -1,19 +1,19 @@
1
- import type { Wallet } from "../../types";
2
- import { PROVIDER_ID } from "../../constants";
3
- import BaseWallet from "../base";
4
- import type { Network } from "../../types";
5
- import { InitParams, DeflyWalletClientConstructor } from "./types";
1
+ import type { Wallet } from '../../types';
2
+ import { PROVIDER_ID } from '../../constants';
3
+ import BaseWallet from '../base';
4
+ import type { Network } from '../../types';
5
+ import { InitParams, DeflyWalletClientConstructor } from './types';
6
6
  declare class DeflyWalletClient extends BaseWallet {
7
7
  #private;
8
8
  network: Network;
9
- constructor({ metadata, client, algosdk, algodClient, network, }: DeflyWalletClientConstructor);
9
+ constructor({ metadata, client, algosdk, algodClient, network }: DeflyWalletClientConstructor);
10
10
  static metadata: {
11
11
  id: PROVIDER_ID;
12
12
  name: string;
13
13
  icon: string;
14
14
  isWalletConnect: boolean;
15
15
  };
16
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams): Promise<DeflyWalletClient | null>;
16
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<DeflyWalletClient | null>;
17
17
  connect(onDisconnect: () => void): Promise<Wallet>;
18
18
  reconnect(onDisconnect: () => void): Promise<{
19
19
  accounts: {
@@ -1,2 +1,2 @@
1
- import defly from "./client";
1
+ import defly from './client';
2
2
  export default defly;
@@ -1,7 +1,7 @@
1
- import type { Transaction } from "algosdk";
2
- import type { AlgodClientOptions, Network, Metadata } from "../../types";
3
- import type { DeflyWalletConnect } from "@blockshake/defly-connect";
4
- import type _algosdk from "algosdk";
1
+ import type { Transaction } from 'algosdk';
2
+ import type { AlgodClientOptions, Network, Metadata } from '../../types';
3
+ import type { DeflyWalletConnect } from '@blockshake/defly-connect';
4
+ import type _algosdk from 'algosdk';
5
5
  export declare type ClientOptions = {
6
6
  bridge?: string;
7
7
  deep_link?: string;
@@ -1,18 +1,18 @@
1
- import BaseWallet from "../base";
2
- import { PROVIDER_ID } from "../../constants";
3
- import type { Network } from "../../types";
4
- import { InitParams, ExodusClientConstructor } from "./types";
1
+ import BaseWallet from '../base';
2
+ import { PROVIDER_ID } from '../../constants';
3
+ import type { Network } from '../../types';
4
+ import { InitParams, ExodusClientConstructor } from './types';
5
5
  declare class ExodusClient extends BaseWallet {
6
6
  #private;
7
7
  network: Network;
8
- constructor({ metadata, client, algosdk, algodClient, onlyIfTrusted, network, }: ExodusClientConstructor);
8
+ constructor({ metadata, client, algosdk, algodClient, onlyIfTrusted, network }: ExodusClientConstructor);
9
9
  static metadata: {
10
10
  id: PROVIDER_ID;
11
11
  name: string;
12
12
  icon: string;
13
13
  isWalletConnect: boolean;
14
14
  };
15
- static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams): Promise<ExodusClient | null>;
15
+ static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<ExodusClient | null>;
16
16
  connect(): Promise<{
17
17
  accounts: {
18
18
  name: string;
@@ -1,2 +1,2 @@
1
- import exodus from "./client";
1
+ import exodus from './client';
2
2
  export default exodus;
@@ -1,6 +1,6 @@
1
- import { PROVIDER_ID } from "../../constants";
2
- import type _algosdk from "algosdk";
3
- import type { AlgodClientOptions, Network, Metadata } from "../../types";
1
+ import { PROVIDER_ID } from '../../constants';
2
+ import type _algosdk from 'algosdk';
3
+ import type { AlgodClientOptions, Network, Metadata } from '../../types';
4
4
  export declare type ClientOptions = {
5
5
  onlyIfTrusted: boolean;
6
6
  };
@@ -1,12 +1,12 @@
1
- import pera from "./pera";
2
- import myalgo from "./myalgo";
3
- import defly from "./defly";
4
- import exodus from "./exodus";
5
- import algosigner from "./algosigner";
6
- import walletconnect from "./walletconnect";
7
- import kmd from "./kmd";
8
- import mnemonic from "./mnemonic";
9
- export { pera, myalgo, defly, exodus, algosigner, walletconnect, kmd, mnemonic, };
1
+ import pera from './pera';
2
+ import myalgo from './myalgo';
3
+ import defly from './defly';
4
+ import exodus from './exodus';
5
+ import algosigner from './algosigner';
6
+ import walletconnect from './walletconnect';
7
+ import kmd from './kmd';
8
+ import mnemonic from './mnemonic';
9
+ export { pera, myalgo, defly, exodus, algosigner, walletconnect, kmd, mnemonic };
10
10
  declare const _default: {
11
11
  [x: string]: typeof pera | typeof myalgo | typeof defly | typeof exodus | typeof algosigner | typeof walletconnect | typeof kmd | typeof mnemonic;
12
12
  };
@@ -1,24 +1,24 @@
1
- import BaseWallet from "../base";
2
- import { PROVIDER_ID } from "../../constants";
3
- import type { Account, Wallet, Network } from "../../types";
4
- import { InitParams, KMDWalletClientConstructor } from "./types";
1
+ import BaseWallet from '../base';
2
+ import { PROVIDER_ID } from '../../constants';
3
+ import type { Account, Wallet, Network } from '../../types';
4
+ import { InitParams, KMDWalletClientConstructor } from './types';
5
5
  declare class KMDWalletClient extends BaseWallet {
6
6
  #private;
7
7
  walletId: string;
8
8
  id: PROVIDER_ID;
9
9
  network: Network;
10
- constructor({ metadata, client, id, wallet, password, algosdk, algodClient, network, }: KMDWalletClientConstructor);
10
+ constructor({ metadata, client, id, wallet, password, algosdk, algodClient, network }: KMDWalletClientConstructor);
11
11
  static metadata: {
12
12
  id: PROVIDER_ID;
13
13
  name: string;
14
14
  icon: string;
15
15
  isWalletConnect: boolean;
16
16
  };
17
- static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams): Promise<KMDWalletClient | null>;
17
+ static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<KMDWalletClient | null>;
18
18
  connect(): Promise<Wallet>;
19
19
  disconnect(): Promise<void>;
20
20
  reconnect(): Promise<Wallet | null>;
21
- requestPassword(): Promise<string>;
21
+ requestPassword(): string;
22
22
  getWalletToken(walletId: string, password: string): Promise<string>;
23
23
  releaseToken(token: string): Promise<void>;
24
24
  listWallets(): Promise<Record<string, string>>;
@@ -1,2 +1,2 @@
1
- import kmd from "./client";
1
+ import kmd from './client';
2
2
  export default kmd;
@@ -1,6 +1,6 @@
1
- import type _algosdk from "algosdk";
2
- import type { AlgodClientOptions, Network, Metadata } from "../../types";
3
- import { PROVIDER_ID } from "../../constants";
1
+ import type _algosdk from 'algosdk';
2
+ import type { AlgodClientOptions, Network, Metadata } from '../../types';
3
+ import { PROVIDER_ID } from '../../constants';
4
4
  export declare type ClientOptions = {
5
5
  wallet: string;
6
6
  password: string;