@txnlab/use-wallet 1.3.1 → 2.0.0-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.
Files changed (108) hide show
  1. package/README.md +490 -188
  2. package/dist/cjs/index.js +231 -129
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/jest.config.d.ts +7 -0
  5. package/dist/cjs/src/clients/algosigner/client.d.ts +3 -3
  6. package/dist/cjs/src/clients/algosigner/types.d.ts +2 -8
  7. package/dist/cjs/src/clients/base/base.d.ts +3 -2
  8. package/dist/cjs/src/clients/base/index.d.ts +2 -2
  9. package/dist/cjs/src/clients/daffi/client.d.ts +5 -4
  10. package/dist/cjs/src/clients/daffi/types.d.ts +5 -7
  11. package/dist/cjs/src/clients/defly/client.d.ts +6 -5
  12. package/dist/cjs/src/clients/defly/types.d.ts +5 -7
  13. package/dist/cjs/src/clients/exodus/client.d.ts +6 -5
  14. package/dist/cjs/src/clients/exodus/types.d.ts +5 -10
  15. package/dist/cjs/src/clients/index.d.ts +1 -1
  16. package/dist/cjs/src/clients/kmd/client.d.ts +4 -5
  17. package/dist/cjs/src/clients/kmd/types.d.ts +4 -9
  18. package/dist/cjs/src/clients/mnemonic/client.d.ts +4 -5
  19. package/dist/cjs/src/clients/mnemonic/types.d.ts +2 -9
  20. package/dist/cjs/src/clients/myalgo/client.d.ts +6 -5
  21. package/dist/cjs/src/clients/myalgo/types.d.ts +10 -12
  22. package/dist/cjs/src/clients/pera/client.d.ts +6 -5
  23. package/dist/cjs/src/clients/pera/types.d.ts +5 -7
  24. package/dist/cjs/src/clients/{walletconnect → walletconnect2}/client.d.ts +8 -7
  25. package/dist/cjs/src/clients/walletconnect2/constants.d.ts +6 -0
  26. package/dist/cjs/src/clients/walletconnect2/index.d.ts +2 -0
  27. package/dist/cjs/src/clients/walletconnect2/types.d.ts +38 -0
  28. package/dist/cjs/src/clients/walletconnect2/utils.d.ts +2 -0
  29. package/dist/cjs/src/hooks/index.d.ts +1 -0
  30. package/dist/cjs/src/hooks/useInitializeProviders.d.ts +9 -0
  31. package/dist/cjs/src/hooks/useInitializeProviders.test.d.ts +4 -0
  32. package/dist/cjs/src/hooks/useWallet.d.ts +4 -13
  33. package/dist/cjs/src/hooks/useWallet.test.d.ts +4 -0
  34. package/dist/cjs/src/index.d.ts +1 -1
  35. package/dist/cjs/src/store/state/clientStore.d.ts +2 -23
  36. package/dist/cjs/src/testUtils/createWrapper.d.ts +6 -0
  37. package/dist/cjs/src/testUtils/mockAccounts.d.ts +3 -0
  38. package/dist/cjs/src/testUtils/mockClients.d.ts +33 -0
  39. package/dist/cjs/src/types/index.d.ts +1 -0
  40. package/dist/cjs/src/types/node.d.ts +2 -1
  41. package/dist/cjs/src/types/providers.d.ts +71 -0
  42. package/dist/cjs/src/types/wallet.d.ts +5 -3
  43. package/dist/cjs/src/utils/clearAccounts.d.ts +1 -1
  44. package/dist/cjs/src/utils/encodeNFDTransactionArray.spec.d.ts +1 -0
  45. package/dist/cjs/src/utils/initializeProviders.d.ts +2 -12
  46. package/dist/cjs/src/utils/initializeProviders.test.d.ts +4 -0
  47. package/dist/cjs/src/utils/providers.d.ts +1 -1
  48. package/dist/cjs/src/utils/providers.spec.d.ts +1 -0
  49. package/dist/cjs/src/utils/reconnectProviders.d.ts +1 -5
  50. package/dist/cjs/src/utils/reconnectProviders.test.d.ts +1 -0
  51. package/dist/cjs/src/utils/types.d.ts +2 -0
  52. package/dist/esm/index.js +231 -130
  53. package/dist/esm/jest.config.d.ts +7 -0
  54. package/dist/esm/src/clients/algosigner/client.d.ts +3 -3
  55. package/dist/esm/src/clients/algosigner/types.d.ts +2 -8
  56. package/dist/esm/src/clients/base/base.d.ts +3 -2
  57. package/dist/esm/src/clients/base/index.d.ts +2 -2
  58. package/dist/esm/src/clients/daffi/client.d.ts +5 -4
  59. package/dist/esm/src/clients/daffi/types.d.ts +5 -7
  60. package/dist/esm/src/clients/defly/client.d.ts +6 -5
  61. package/dist/esm/src/clients/defly/types.d.ts +5 -7
  62. package/dist/esm/src/clients/exodus/client.d.ts +6 -5
  63. package/dist/esm/src/clients/exodus/types.d.ts +5 -10
  64. package/dist/esm/src/clients/index.d.ts +1 -1
  65. package/dist/esm/src/clients/kmd/client.d.ts +4 -5
  66. package/dist/esm/src/clients/kmd/types.d.ts +4 -9
  67. package/dist/esm/src/clients/mnemonic/client.d.ts +4 -5
  68. package/dist/esm/src/clients/mnemonic/types.d.ts +2 -9
  69. package/dist/esm/src/clients/myalgo/client.d.ts +6 -5
  70. package/dist/esm/src/clients/myalgo/types.d.ts +10 -12
  71. package/dist/esm/src/clients/pera/client.d.ts +6 -5
  72. package/dist/esm/src/clients/pera/types.d.ts +5 -7
  73. package/dist/esm/src/clients/{walletconnect → walletconnect2}/client.d.ts +8 -7
  74. package/dist/esm/src/clients/walletconnect2/constants.d.ts +6 -0
  75. package/dist/esm/src/clients/walletconnect2/index.d.ts +2 -0
  76. package/dist/esm/src/clients/walletconnect2/types.d.ts +38 -0
  77. package/dist/esm/src/clients/walletconnect2/utils.d.ts +2 -0
  78. package/dist/esm/src/hooks/index.d.ts +1 -0
  79. package/dist/esm/src/hooks/useInitializeProviders.d.ts +9 -0
  80. package/dist/esm/src/hooks/useInitializeProviders.test.d.ts +4 -0
  81. package/dist/esm/src/hooks/useWallet.d.ts +4 -13
  82. package/dist/esm/src/hooks/useWallet.test.d.ts +4 -0
  83. package/dist/esm/src/index.d.ts +1 -1
  84. package/dist/esm/src/store/state/clientStore.d.ts +2 -23
  85. package/dist/esm/src/testUtils/createWrapper.d.ts +6 -0
  86. package/dist/esm/src/testUtils/mockAccounts.d.ts +3 -0
  87. package/dist/esm/src/testUtils/mockClients.d.ts +33 -0
  88. package/dist/esm/src/types/index.d.ts +1 -0
  89. package/dist/esm/src/types/node.d.ts +2 -1
  90. package/dist/esm/src/types/providers.d.ts +71 -0
  91. package/dist/esm/src/types/wallet.d.ts +5 -3
  92. package/dist/esm/src/utils/clearAccounts.d.ts +1 -1
  93. package/dist/esm/src/utils/encodeNFDTransactionArray.spec.d.ts +1 -0
  94. package/dist/esm/src/utils/initializeProviders.d.ts +2 -12
  95. package/dist/esm/src/utils/initializeProviders.test.d.ts +4 -0
  96. package/dist/esm/src/utils/providers.d.ts +1 -1
  97. package/dist/esm/src/utils/providers.spec.d.ts +1 -0
  98. package/dist/esm/src/utils/reconnectProviders.d.ts +1 -5
  99. package/dist/esm/src/utils/reconnectProviders.test.d.ts +1 -0
  100. package/dist/esm/src/utils/types.d.ts +2 -0
  101. package/dist/index.d.ts +240 -254
  102. package/package.json +17 -18
  103. package/dist/cjs/src/clients/walletconnect/constants.d.ts +0 -2
  104. package/dist/cjs/src/clients/walletconnect/index.d.ts +0 -2
  105. package/dist/cjs/src/clients/walletconnect/types.d.ts +0 -55
  106. package/dist/esm/src/clients/walletconnect/constants.d.ts +0 -2
  107. package/dist/esm/src/clients/walletconnect/index.d.ts +0 -2
  108. package/dist/esm/src/clients/walletconnect/types.d.ts +0 -55
package/dist/index.d.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  import _algosdk from 'algosdk';
2
- import * as react from 'react';
3
2
  import { PeraWalletConnect } from '@perawallet/connect';
4
- import _MyAlgoConnect from '@randlabs/myalgo-connect';
5
3
  import { DeflyWalletConnect } from '@blockshake/defly-connect';
4
+ import { DaffiWalletConnect } from '@daffiwallet/connect';
5
+ import SignClient from '@walletconnect/sign-client';
6
+ import MyAlgoConnect from '@randlabs/myalgo-connect';
7
+ import { WalletConnectModalConfig, WalletConnectModal } from '@walletconnect/modal';
8
+ import { SignClientTypes } from '@walletconnect/types';
9
+ import * as react from 'react';
6
10
  import * as zustand_middleware from 'zustand/middleware';
7
11
  import * as immer_dist_internal from 'immer/dist/internal';
8
12
  import * as zustand from 'zustand';
9
- import WalletConnect from '@walletconnect/client';
10
- import QRCodeModal from 'algorand-walletconnect-qrcode-modal';
11
13
 
12
- declare type Network = 'betanet' | 'testnet' | 'mainnet' | string;
14
+ declare type PublicNetwork = 'betanet' | 'testnet' | 'mainnet';
15
+ declare type Network = PublicNetwork | string;
13
16
  declare type Txn = {
14
17
  apaa: Uint8Array;
15
18
  apas: number[];
@@ -85,6 +88,7 @@ declare const DEFAULT_NODE_PORT = "";
85
88
  declare abstract class BaseClient {
86
89
  algosdk: typeof _algosdk;
87
90
  algodClient: _algosdk.Algodv2;
91
+ clientOptions?: ClientOptions;
88
92
  keepWCAlive: HTMLAudioElement;
89
93
  metadata: Metadata;
90
94
  static metadata: Metadata;
@@ -92,7 +96,7 @@ declare abstract class BaseClient {
92
96
  abstract disconnect(): Promise<void>;
93
97
  abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
94
98
  abstract signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
95
- protected constructor(metadata: Metadata, algosdk: typeof _algosdk, algodClient: _algosdk.Algodv2);
99
+ protected constructor(metadata: Metadata, algosdk: typeof _algosdk, algodClient: _algosdk.Algodv2, clientOptions?: ClientOptions);
96
100
  healthCheck(): Promise<{}>;
97
101
  getAccountInfo(address: string): Promise<AccountInfo>;
98
102
  getAssets(address: string): Promise<Asset[]>;
@@ -174,20 +178,205 @@ declare type Metadata = {
174
178
  icon: string;
175
179
  isWalletConnect: boolean;
176
180
  };
181
+ declare type ClientOptions = Record<string, any>;
177
182
  declare type WalletClient = BaseClient;
183
+ declare type SupportedProviders = Partial<Record<PROVIDER_ID, WalletClient | null>>;
184
+
185
+ declare type PeraWalletConnectOptions = {
186
+ bridge?: string;
187
+ shouldShowSignTxnToast?: boolean;
188
+ chainId?: 416001 | 416002 | 416003 | 4160;
189
+ };
190
+ declare type PeraWalletClientConstructor = {
191
+ metadata: Metadata;
192
+ client: PeraWalletConnect;
193
+ clientOptions?: PeraWalletConnectOptions;
194
+ algosdk: typeof _algosdk;
195
+ algodClient: _algosdk.Algodv2;
196
+ network: Network;
197
+ };
198
+ declare type InitParams$7 = CommonInitParams & {
199
+ clientOptions?: PeraWalletConnectOptions;
200
+ clientStatic?: typeof PeraWalletConnect;
201
+ };
202
+
203
+ declare type DeflyWalletConnectOptions = {
204
+ bridge?: string;
205
+ deep_link?: string;
206
+ app_meta?: {
207
+ logo: string;
208
+ name: string;
209
+ main_color: string;
210
+ };
211
+ shouldShowSignTxnToast?: boolean;
212
+ };
213
+ declare type DeflyWalletClientConstructor = {
214
+ metadata: Metadata;
215
+ client: DeflyWalletConnect;
216
+ clientOptions?: DeflyWalletConnectOptions;
217
+ algosdk: typeof _algosdk;
218
+ algodClient: _algosdk.Algodv2;
219
+ network: Network;
220
+ };
221
+ declare type InitParams$6 = CommonInitParams & {
222
+ clientOptions?: DeflyWalletConnectOptions;
223
+ clientStatic?: typeof DeflyWalletConnect;
224
+ };
225
+
226
+ declare type ExodusOptions = {
227
+ onlyIfTrusted: boolean;
228
+ };
229
+ declare type Bytes = Readonly<Uint8Array>;
230
+ declare type Exodus = {
231
+ isConnected: boolean;
232
+ address: string | null;
233
+ connect: ({ onlyIfTrusted }: {
234
+ onlyIfTrusted: boolean;
235
+ }) => Promise<{
236
+ address: string;
237
+ }>;
238
+ disconnect: () => void;
239
+ signAndSendTransaction(transactions: Bytes[]): Promise<{
240
+ txId: string;
241
+ }>;
242
+ signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
243
+ };
244
+ declare type ExodusClientConstructor = {
245
+ metadata: Metadata;
246
+ client: Exodus;
247
+ clientOptions: ExodusOptions;
248
+ algosdk: typeof _algosdk;
249
+ algodClient: _algosdk.Algodv2;
250
+ network: Network;
251
+ };
252
+ declare type InitParams$5 = CommonInitParams & {
253
+ clientOptions?: ExodusOptions;
254
+ };
255
+
256
+ declare type KmdOptions = {
257
+ wallet: string;
258
+ password: string;
259
+ host: string;
260
+ token: string;
261
+ port: string;
262
+ };
263
+ declare type KMDWalletClientConstructor = {
264
+ metadata: Metadata;
265
+ client: _algosdk.Kmd;
266
+ algosdk: typeof _algosdk;
267
+ algodClient: _algosdk.Algodv2;
268
+ wallet: string;
269
+ password: string;
270
+ network: Network;
271
+ };
272
+ declare type InitParams$4 = CommonInitParams & {
273
+ clientOptions?: KmdOptions;
274
+ };
275
+
276
+ /**
277
+ * Helpful resources:
278
+ * https://github.com/randlabs/myalgo-connect
279
+ */
280
+
281
+ declare type MyAlgoConnectOptions = {
282
+ disableLedgerNano: boolean;
283
+ };
284
+ declare type MyAlgoWalletClientConstructor = {
285
+ metadata: Metadata;
286
+ client: MyAlgoConnect;
287
+ clientOptions?: MyAlgoConnectOptions;
288
+ algosdk: typeof _algosdk;
289
+ algodClient: _algosdk.Algodv2;
290
+ network: Network;
291
+ };
292
+ declare type InitParams$3 = CommonInitParams & {
293
+ clientOptions?: MyAlgoConnectOptions;
294
+ clientStatic?: typeof MyAlgoConnect;
295
+ };
296
+
297
+ declare type WalletConnectOptions = SignClientTypes.Options;
298
+ declare type WalletConnectModalOptions = Omit<WalletConnectModalConfig, 'projectId' | 'walletConnectVersion'>;
299
+ declare type InitParams$2 = CommonInitParams & {
300
+ clientOptions?: WalletConnectOptions;
301
+ clientStatic?: typeof SignClient;
302
+ modalStatic?: typeof WalletConnectModal;
303
+ modalOptions?: WalletConnectModalOptions;
304
+ };
305
+ declare type WalletConnectClientConstructor = {
306
+ metadata: Metadata;
307
+ client: SignClient;
308
+ clientOptions?: WalletConnectOptions;
309
+ modal: WalletConnectModal;
310
+ algosdk: typeof _algosdk;
311
+ algodClient: _algosdk.Algodv2;
312
+ network: Network;
313
+ chain: string;
314
+ };
315
+
316
+ declare type DaffiWalletConnectOptions = {
317
+ bridge?: string;
318
+ shouldShowSignTxnToast?: boolean;
319
+ chainId?: 416001 | 416002 | 416003 | 4160;
320
+ };
321
+
322
+ declare type ProviderConfigMapping = {
323
+ [PROVIDER_ID.PERA]: {
324
+ clientOptions?: PeraWalletConnectOptions;
325
+ clientStatic?: typeof PeraWalletConnect;
326
+ };
327
+ [PROVIDER_ID.DAFFI]: {
328
+ clientOptions?: DaffiWalletConnectOptions;
329
+ clientStatic?: typeof DaffiWalletConnect;
330
+ };
331
+ [PROVIDER_ID.DEFLY]: {
332
+ clientOptions?: DeflyWalletConnectOptions;
333
+ clientStatic?: typeof DeflyWalletConnect;
334
+ };
335
+ [PROVIDER_ID.WALLETCONNECT]: {
336
+ clientOptions?: WalletConnectOptions;
337
+ clientStatic?: typeof SignClient;
338
+ modalStatic?: typeof WalletConnectModal;
339
+ modalOptions?: WalletConnectModalOptions;
340
+ };
341
+ [PROVIDER_ID.MYALGO]: {
342
+ clientOptions?: MyAlgoConnectOptions;
343
+ clientStatic?: typeof MyAlgoConnect;
344
+ };
345
+ [PROVIDER_ID.EXODUS]: {
346
+ clientOptions?: ExodusOptions;
347
+ };
348
+ [PROVIDER_ID.KMD]: {
349
+ clientOptions?: KmdOptions;
350
+ };
351
+ [PROVIDER_ID.ALGOSIGNER]: Record<string, never>;
352
+ [PROVIDER_ID.MNEMONIC]: Record<string, never>;
353
+ };
354
+ /**
355
+ * Enforces correct configuration given for each provider. For example,
356
+ * if `id` is `PROVIDER_ID.PERA`, then `clientOptions` must be of type
357
+ * `PeraWalletConnectOptions`.
358
+ *
359
+ * @todo install `tsd` to test TypeScript type definitions in CI
360
+ */
361
+ declare type ProviderConfig<T extends keyof ProviderConfigMapping> = {
362
+ [K in T]: {
363
+ id: K;
364
+ } & ProviderConfigMapping[K];
365
+ }[T];
366
+ declare type CommonInitParams = {
367
+ network?: Network;
368
+ algodOptions?: AlgodClientOptions;
369
+ algosdkStatic?: typeof _algosdk;
370
+ };
371
+ declare type NodeConfig = {
372
+ network: Network;
373
+ nodeServer: string;
374
+ nodeToken?: string;
375
+ nodePort?: string;
376
+ };
178
377
 
179
378
  declare function useWallet(): {
180
- clients: Partial<{
181
- kmd: Promise<BaseClient | null>;
182
- pera: Promise<BaseClient | null>;
183
- daffi: Promise<BaseClient | null>;
184
- myalgo: Promise<BaseClient | null>;
185
- algosigner: Promise<BaseClient | null>;
186
- defly: Promise<BaseClient | null>;
187
- exodus: Promise<BaseClient | null>;
188
- walletconnect: Promise<BaseClient | null>;
189
- mnemonic: Promise<BaseClient | null>;
190
- }> | null;
379
+ clients: Partial<Record<PROVIDER_ID, BaseClient | null>> | null;
191
380
  providers: Provider[] | null;
192
381
  connectedAccounts: Account[];
193
382
  connectedActiveAccounts: Account[];
@@ -210,25 +399,20 @@ declare function useWallet(): {
210
399
  id: string;
211
400
  }>;
212
401
  getAddress: () => string | undefined;
213
- groupTransactionsBySender: (transactions: TransactionsArray) => Promise<Record<string, TxnInfo[]>>;
402
+ groupTransactionsBySender: (transactions: TransactionsArray) => Record<string, TxnInfo[]>;
214
403
  getAccountInfo: () => Promise<AccountInfo>;
215
404
  getAssets: () => Promise<Asset[]>;
216
405
  };
217
406
 
218
- declare type SupportedProviders$1 = {
219
- [x: string]: Promise<WalletClient | null>;
220
- };
221
- declare type NodeConfig = {
222
- network: Network;
223
- nodeServer: string;
224
- nodeToken?: string;
225
- nodePort?: string;
226
- };
227
- declare const initializeProviders: (providers?: PROVIDER_ID[], nodeConfig?: NodeConfig, algosdkStatic?: typeof _algosdk) => SupportedProviders$1;
407
+ interface InitializeProvidersOptions<T extends keyof ProviderConfigMapping = keyof ProviderConfigMapping> {
408
+ providers?: Array<T | ProviderConfig<T>>;
409
+ nodeConfig?: NodeConfig;
410
+ algosdkStatic?: typeof _algosdk;
411
+ }
412
+ declare function useInitializeProviders<T extends keyof ProviderConfigMapping = keyof ProviderConfigMapping>({ providers, nodeConfig, algosdkStatic }?: InitializeProvidersOptions<T>): Partial<Record<PROVIDER_ID, BaseClient | null>> | null;
413
+
414
+ declare const initializeProviders: <T extends keyof ProviderConfigMapping>(providers?: (T | ProviderConfig<T>)[] | undefined, nodeConfig?: NodeConfig, algosdkStatic?: typeof _algosdk) => Promise<SupportedProviders>;
228
415
 
229
- declare type SupportedProviders = {
230
- [x: string]: Promise<WalletClient | null>;
231
- };
232
416
  declare const reconnectProviders: (providers: SupportedProviders) => Promise<void>;
233
417
 
234
418
  declare type NFDTransactionsArray = ['u' | 's', string][];
@@ -260,49 +444,20 @@ declare const useWalletStore: zustand.UseBoundStore<Omit<Omit<Omit<zustand.Store
260
444
  }>(nextStateOrUpdater: WalletStore | Partial<WalletStore> | ((state: immer_dist_internal.WritableDraft<WalletStore>) => void), shouldReplace?: boolean | undefined, action?: A | undefined): void;
261
445
  }>;
262
446
 
263
- declare const _default: react.Provider<Partial<{
264
- kmd: Promise<BaseClient | null>;
265
- pera: Promise<BaseClient | null>;
266
- daffi: Promise<BaseClient | null>;
267
- myalgo: Promise<BaseClient | null>;
268
- algosigner: Promise<BaseClient | null>;
269
- defly: Promise<BaseClient | null>;
270
- exodus: Promise<BaseClient | null>;
271
- walletconnect: Promise<BaseClient | null>;
272
- mnemonic: Promise<BaseClient | null>;
273
- }> | null>;
274
-
275
- declare type ClientOptions$6 = {
276
- bridge?: string;
277
- shouldShowSignTxnToast?: boolean;
278
- chainId?: 416001 | 416002 | 416003 | 4160;
279
- };
280
- declare type PeraWalletClientConstructor = {
281
- metadata: Metadata;
282
- client: PeraWalletConnect;
283
- algosdk: typeof _algosdk;
284
- algodClient: _algosdk.Algodv2;
285
- network: Network;
286
- };
287
- declare type InitParams$7 = {
288
- clientOptions?: ClientOptions$6;
289
- algodOptions?: AlgodClientOptions;
290
- clientStatic?: typeof PeraWalletConnect;
291
- algosdkStatic?: typeof _algosdk;
292
- network?: Network;
293
- };
447
+ declare const _default: react.Provider<Partial<Record<PROVIDER_ID, BaseClient | null>> | null>;
294
448
 
295
449
  declare class PeraWalletClient extends BaseClient {
296
450
  #private;
451
+ clientOptions?: PeraWalletConnectOptions;
297
452
  network: Network;
298
- constructor({ metadata, client, algosdk, algodClient, network }: PeraWalletClientConstructor);
453
+ constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: PeraWalletClientConstructor);
299
454
  static metadata: {
300
455
  id: PROVIDER_ID;
301
456
  name: string;
302
457
  icon: string;
303
458
  isWalletConnect: boolean;
304
459
  };
305
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams$7): Promise<PeraWalletClient | null>;
460
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams$7): Promise<BaseClient | null>;
306
461
  connect(onDisconnect: () => void): Promise<Wallet>;
307
462
  reconnect(onDisconnect: () => void): Promise<{
308
463
  accounts: {
@@ -319,29 +474,6 @@ declare class PeraWalletClient extends BaseClient {
319
474
  signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
320
475
  }
321
476
 
322
- /**
323
- * Helpful resources:
324
- * https://github.com/randlabs/myalgo-connect
325
- */
326
-
327
- declare type MyAlgoWalletClientConstructor = {
328
- metadata: Metadata;
329
- client: _MyAlgoConnect;
330
- algosdk: typeof _algosdk;
331
- algodClient: _algosdk.Algodv2;
332
- network: Network;
333
- };
334
- declare type ClientOptions$5 = {
335
- disableLedgerNano: boolean;
336
- };
337
- declare type InitParams$6 = {
338
- clientOptions?: ClientOptions$5;
339
- algodOptions?: AlgodClientOptions;
340
- clientStatic?: typeof _MyAlgoConnect;
341
- algosdkStatic?: typeof _algosdk;
342
- network?: Network;
343
- };
344
-
345
477
  /**
346
478
  * Helpful resources:
347
479
  * https://github.com/randlabs/myalgo-connect
@@ -349,15 +481,16 @@ declare type InitParams$6 = {
349
481
 
350
482
  declare class MyAlgoWalletClient extends BaseClient {
351
483
  #private;
484
+ clientOptions?: MyAlgoConnectOptions;
352
485
  network: Network;
353
- constructor({ metadata, client, algosdk, algodClient, network }: MyAlgoWalletClientConstructor);
486
+ constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: MyAlgoWalletClientConstructor);
354
487
  static metadata: {
355
488
  id: PROVIDER_ID;
356
489
  name: string;
357
490
  icon: string;
358
491
  isWalletConnect: boolean;
359
492
  };
360
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams$6): Promise<MyAlgoWalletClient | null>;
493
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams$3): Promise<BaseClient | null>;
361
494
  connect(): Promise<{
362
495
  accounts: {
363
496
  providerId: PROVIDER_ID;
@@ -374,42 +507,18 @@ declare class MyAlgoWalletClient extends BaseClient {
374
507
  signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
375
508
  }
376
509
 
377
- declare type ClientOptions$4 = {
378
- bridge?: string;
379
- deep_link?: string;
380
- app_meta?: {
381
- logo: string;
382
- name: string;
383
- main_color: string;
384
- };
385
- shouldShowSignTxnToast?: boolean;
386
- };
387
- declare type DeflyWalletClientConstructor = {
388
- metadata: Metadata;
389
- client: DeflyWalletConnect;
390
- algosdk: typeof _algosdk;
391
- algodClient: _algosdk.Algodv2;
392
- network: Network;
393
- };
394
- declare type InitParams$5 = {
395
- clientOptions?: ClientOptions$4;
396
- algodOptions?: AlgodClientOptions;
397
- clientStatic?: typeof DeflyWalletConnect;
398
- algosdkStatic?: typeof _algosdk;
399
- network?: Network;
400
- };
401
-
402
510
  declare class DeflyWalletClient extends BaseClient {
403
511
  #private;
512
+ clientOptions?: DeflyWalletConnectOptions;
404
513
  network: Network;
405
- constructor({ metadata, client, algosdk, algodClient, network }: DeflyWalletClientConstructor);
514
+ constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: DeflyWalletClientConstructor);
406
515
  static metadata: {
407
516
  id: PROVIDER_ID;
408
517
  name: string;
409
518
  icon: string;
410
519
  isWalletConnect: boolean;
411
520
  };
412
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams$5): Promise<DeflyWalletClient | null>;
521
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams$6): Promise<BaseClient | null>;
413
522
  connect(onDisconnect: () => void): Promise<Wallet>;
414
523
  reconnect(onDisconnect: () => void): Promise<{
415
524
  accounts: {
@@ -426,51 +535,18 @@ declare class DeflyWalletClient extends BaseClient {
426
535
  signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
427
536
  }
428
537
 
429
- declare type ClientOptions$3 = {
430
- onlyIfTrusted: boolean;
431
- };
432
- declare type Bytes = Readonly<Uint8Array>;
433
- declare type Exodus = {
434
- isConnected: boolean;
435
- address: string | null;
436
- connect: ({ onlyIfTrusted }: {
437
- onlyIfTrusted: boolean;
438
- }) => Promise<{
439
- address: string;
440
- }>;
441
- disconnect: () => void;
442
- signAndSendTransaction(transactions: Bytes[]): Promise<{
443
- txId: string;
444
- }>;
445
- signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
446
- };
447
- declare type ExodusClientConstructor = {
448
- metadata: Metadata;
449
- client: Exodus;
450
- id: PROVIDER_ID;
451
- algosdk: typeof _algosdk;
452
- algodClient: _algosdk.Algodv2;
453
- onlyIfTrusted: boolean;
454
- network: Network;
455
- };
456
- declare type InitParams$4 = {
457
- clientOptions?: ClientOptions$3;
458
- algodOptions?: AlgodClientOptions;
459
- algosdkStatic?: typeof _algosdk;
460
- network?: Network;
461
- };
462
-
463
538
  declare class ExodusClient extends BaseClient {
464
539
  #private;
540
+ clientOptions: ExodusOptions;
465
541
  network: Network;
466
- constructor({ metadata, client, algosdk, algodClient, onlyIfTrusted, network }: ExodusClientConstructor);
542
+ constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: ExodusClientConstructor);
467
543
  static metadata: {
468
544
  id: PROVIDER_ID;
469
545
  name: string;
470
546
  icon: string;
471
547
  isWalletConnect: boolean;
472
548
  };
473
- static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams$4): Promise<ExodusClient | null>;
549
+ static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams$5): Promise<BaseClient | null>;
474
550
  connect(): Promise<{
475
551
  accounts: {
476
552
  name: string;
@@ -516,16 +592,11 @@ declare type AlgoSigner = {
516
592
  declare type AlgoSignerClientConstructor = {
517
593
  metadata: Metadata;
518
594
  client: AlgoSigner;
519
- id: PROVIDER_ID;
520
595
  algosdk: typeof _algosdk;
521
596
  algodClient: _algosdk.Algodv2;
522
597
  network: Network;
523
598
  };
524
- declare type InitParams$3 = {
525
- algodOptions?: AlgodClientOptions;
526
- algosdkStatic?: typeof _algosdk;
527
- network?: Network;
528
- };
599
+ declare type InitParams$1 = CommonInitParams;
529
600
 
530
601
  declare class AlgoSignerClient extends BaseClient {
531
602
  #private;
@@ -538,7 +609,7 @@ declare class AlgoSignerClient extends BaseClient {
538
609
  icon: string;
539
610
  isWalletConnect: boolean;
540
611
  };
541
- static init({ algodOptions, algosdkStatic, network }: InitParams$3): Promise<AlgoSignerClient | null>;
612
+ static init({ algodOptions, algosdkStatic, network }: InitParams$1): Promise<BaseClient | null>;
542
613
  connect(): Promise<{
543
614
  accounts: {
544
615
  authAddr?: string | undefined;
@@ -558,64 +629,19 @@ declare class AlgoSignerClient extends BaseClient {
558
629
  getAuthAddress(address: string): string | undefined;
559
630
  }
560
631
 
561
- interface IClientMeta {
562
- description: string;
563
- url: string;
564
- icons: string[];
565
- name: string;
566
- }
567
- interface IWalletConnectSession {
568
- connected: boolean;
569
- accounts: string[];
570
- chainId: number;
571
- bridge: string;
572
- key: string;
573
- clientId: string;
574
- clientMeta: IClientMeta | null;
575
- peerId: string;
576
- peerMeta: IClientMeta | null;
577
- handshakeId: number;
578
- handshakeTopic: string;
579
- qrcodeModal: {
580
- open: (uri: string, cb: any, qrcodeModalOptions?: any) => void;
581
- close: () => void;
582
- };
583
- }
584
- declare type ClientOptions$2 = {
585
- bridge?: string;
586
- uri?: string;
587
- storageId?: string;
588
- signingMethods?: string[];
589
- session?: IWalletConnectSession;
590
- clientMeta?: IClientMeta;
591
- };
592
- declare type InitParams$2 = {
593
- clientOptions?: ClientOptions$2;
594
- algodOptions?: AlgodClientOptions;
595
- clientStatic?: typeof WalletConnect;
596
- modalStatic?: typeof QRCodeModal;
597
- algosdkStatic?: typeof _algosdk;
598
- network?: Network;
599
- };
600
- declare type WalletConnectClientConstructor = {
601
- metadata: Metadata;
602
- client: WalletConnect;
603
- algosdk: typeof _algosdk;
604
- algodClient: _algosdk.Algodv2;
605
- network: Network;
606
- };
607
-
608
632
  declare class WalletConnectClient extends BaseClient {
609
633
  #private;
634
+ clientOptions?: WalletConnectOptions;
610
635
  network: Network;
611
- constructor({ metadata, client, algosdk, algodClient, network }: WalletConnectClientConstructor);
636
+ chain: string;
637
+ constructor({ metadata, client, clientOptions, modal, algosdk, algodClient, network, chain }: WalletConnectClientConstructor);
612
638
  static metadata: {
613
639
  id: PROVIDER_ID;
614
640
  name: string;
615
641
  icon: string;
616
642
  isWalletConnect: boolean;
617
643
  };
618
- static init({ clientOptions, algodOptions, clientStatic, modalStatic, algosdkStatic, network }: InitParams$2): Promise<WalletConnectClient | null>;
644
+ static init({ clientOptions, algodOptions, clientStatic, modalStatic, modalOptions, algosdkStatic, network }: InitParams$2): Promise<BaseClient | null>;
619
645
  connect(): Promise<Wallet>;
620
646
  reconnect(): Promise<{
621
647
  accounts: {
@@ -628,48 +654,22 @@ declare class WalletConnectClient extends BaseClient {
628
654
  icon: string;
629
655
  isWalletConnect: boolean;
630
656
  } | null>;
631
- check(): boolean;
632
657
  disconnect(): Promise<void>;
633
658
  signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
634
659
  }
635
660
 
636
- declare type ClientOptions$1 = {
637
- wallet: string;
638
- password: string;
639
- host: string;
640
- token: string;
641
- port: string;
642
- };
643
- declare type KMDWalletClientConstructor = {
644
- metadata: Metadata;
645
- client: _algosdk.Kmd;
646
- id: PROVIDER_ID;
647
- algosdk: typeof _algosdk;
648
- algodClient: _algosdk.Algodv2;
649
- wallet: string;
650
- password: string;
651
- network: Network;
652
- };
653
- declare type InitParams$1 = {
654
- clientOptions?: ClientOptions$1;
655
- algodOptions?: AlgodClientOptions;
656
- algosdkStatic?: typeof _algosdk;
657
- network?: Network;
658
- };
659
-
660
661
  declare class KMDWalletClient extends BaseClient {
661
662
  #private;
662
663
  walletId: string;
663
- id: PROVIDER_ID;
664
664
  network: Network;
665
- constructor({ metadata, client, id, wallet, password, algosdk, algodClient, network }: KMDWalletClientConstructor);
665
+ constructor({ metadata, client, wallet, password, algosdk, algodClient, network }: KMDWalletClientConstructor);
666
666
  static metadata: {
667
667
  id: PROVIDER_ID;
668
668
  name: string;
669
669
  icon: string;
670
670
  isWalletConnect: boolean;
671
671
  };
672
- static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams$1): Promise<KMDWalletClient | null>;
672
+ static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams$4): Promise<BaseClient | null>;
673
673
  connect(): Promise<Wallet>;
674
674
  disconnect(): Promise<void>;
675
675
  reconnect(): Promise<Wallet | null>;
@@ -682,39 +682,25 @@ declare class KMDWalletClient extends BaseClient {
682
682
  signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
683
683
  }
684
684
 
685
- declare type ClientOptions = {
686
- wallet: string;
687
- password: string;
688
- host: string;
689
- token: string;
690
- port: string;
691
- };
692
685
  declare type MnemonicWalletClientConstructor = {
693
686
  metadata: Metadata;
694
- id: PROVIDER_ID;
695
687
  algosdk: typeof _algosdk;
696
688
  algodClient: _algosdk.Algodv2;
697
689
  network: Network;
698
690
  };
699
- declare type InitParams = {
700
- clientOptions?: ClientOptions;
701
- algodOptions?: AlgodClientOptions;
702
- algosdkStatic?: typeof _algosdk;
703
- network?: Network;
704
- };
691
+ declare type InitParams = CommonInitParams;
705
692
 
706
693
  declare class MnemonicWalletClient extends BaseClient {
707
694
  #private;
708
- id: PROVIDER_ID;
709
695
  network: Network;
710
- constructor({ metadata, id, algosdk, algodClient, network }: MnemonicWalletClientConstructor);
696
+ constructor({ metadata, algosdk, algodClient, network }: MnemonicWalletClientConstructor);
711
697
  static metadata: {
712
698
  id: PROVIDER_ID;
713
699
  name: string;
714
700
  icon: string;
715
701
  isWalletConnect: boolean;
716
702
  };
717
- static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<MnemonicWalletClient | null>;
703
+ static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
718
704
  connect(): Promise<{
719
705
  accounts: {
720
706
  name: string;
@@ -733,4 +719,4 @@ declare class MnemonicWalletClient extends BaseClient {
733
719
  signEncodedTransactions(_transactions: TransactionsArray): Promise<Uint8Array[]>;
734
720
  }
735
721
 
736
- export { Account, AccountInfo, AlgodClientOptions, Asset, ConfirmedTxn, DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, DecodedSignedTransaction, DecodedTransaction, Metadata, Network, PROVIDER_ID, Provider, RawTxnResponse, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, _default as WalletProvider, AlgoSignerClient as algosigner, DeflyWalletClient as defly, encodeNFDTransactionsArray, ExodusClient as exodus, initializeProviders, KMDWalletClient as kmd, MnemonicWalletClient as mnemonic, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useWallet, WalletConnectClient as walletconnect };
722
+ export { Account, AccountInfo, AlgodClientOptions, Asset, ClientOptions, CommonInitParams, ConfirmedTxn, DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, DecodedSignedTransaction, DecodedTransaction, Metadata, Network, NodeConfig, PROVIDER_ID, Provider, ProviderConfig, ProviderConfigMapping, PublicNetwork, RawTxnResponse, SupportedProviders, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, _default as WalletProvider, AlgoSignerClient as algosigner, DeflyWalletClient as defly, encodeNFDTransactionsArray, ExodusClient as exodus, initializeProviders, KMDWalletClient as kmd, MnemonicWalletClient as mnemonic, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useInitializeProviders, useWallet, WalletConnectClient as walletconnect };