@txnlab/use-wallet 1.1.5 → 1.2.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/dist/index.d.ts CHANGED
@@ -67,7 +67,8 @@ declare enum PROVIDER_ID {
67
67
  ALGOSIGNER = "algosigner",
68
68
  DEFLY = "defly",
69
69
  EXODUS = "exodus",
70
- WALLETCONNECT = "walletconnect"
70
+ WALLETCONNECT = "walletconnect",
71
+ MNEMONIC = "mnemonic"
71
72
  }
72
73
  declare const DEFAULT_NETWORK: Network;
73
74
  declare const DEFAULT_NODE_BASEURL = "https://mainnet-api.algonode.cloud";
@@ -176,6 +177,7 @@ declare function useWallet(): {
176
177
  defly: Promise<BaseClient | null>;
177
178
  exodus: Promise<BaseClient | null>;
178
179
  walletconnect: Promise<BaseClient | null>;
180
+ mnemonic: Promise<BaseClient | null>;
179
181
  }> | null;
180
182
  providers: Provider[] | null;
181
183
  connectedAccounts: Account[];
@@ -240,9 +242,10 @@ declare const _default: react.Provider<Partial<{
240
242
  defly: Promise<BaseClient | null>;
241
243
  exodus: Promise<BaseClient | null>;
242
244
  walletconnect: Promise<BaseClient | null>;
245
+ mnemonic: Promise<BaseClient | null>;
243
246
  }> | null>;
244
247
 
245
- declare type ClientOptions$5 = {
248
+ declare type ClientOptions$6 = {
246
249
  bridge?: string;
247
250
  deep_link?: string;
248
251
  app_meta?: {
@@ -268,8 +271,8 @@ declare type PeraWalletClientConstructor = {
268
271
  algodClient: _algosdk.Algodv2;
269
272
  network: Network;
270
273
  };
271
- declare type InitParams$6 = {
272
- clientOptions?: ClientOptions$5;
274
+ declare type InitParams$7 = {
275
+ clientOptions?: ClientOptions$6;
273
276
  algodOptions?: AlgodClientOptions;
274
277
  clientStatic?: typeof PeraWalletConnect;
275
278
  algosdkStatic?: typeof _algosdk;
@@ -286,7 +289,7 @@ declare class PeraWalletClient extends BaseClient {
286
289
  icon: string;
287
290
  isWalletConnect: boolean;
288
291
  };
289
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams$6): Promise<PeraWalletClient | null>;
292
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams$7): Promise<PeraWalletClient | null>;
290
293
  connect(onDisconnect: () => void): Promise<Wallet>;
291
294
  reconnect(onDisconnect: () => void): Promise<{
292
295
  accounts: {
@@ -319,11 +322,11 @@ declare type MyAlgoWalletClientConstructor = {
319
322
  algodClient: _algosdk.Algodv2;
320
323
  network: Network;
321
324
  };
322
- declare type ClientOptions$4 = {
325
+ declare type ClientOptions$5 = {
323
326
  disableLedgerNano: boolean;
324
327
  };
325
- declare type InitParams$5 = {
326
- clientOptions?: ClientOptions$4;
328
+ declare type InitParams$6 = {
329
+ clientOptions?: ClientOptions$5;
327
330
  algodOptions?: AlgodClientOptions;
328
331
  clientStatic?: typeof _MyAlgoConnect;
329
332
  algosdkStatic?: typeof _algosdk;
@@ -345,7 +348,7 @@ declare class MyAlgoWalletClient extends BaseClient {
345
348
  icon: string;
346
349
  isWalletConnect: boolean;
347
350
  };
348
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams$5): Promise<MyAlgoWalletClient | null>;
351
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams$6): Promise<MyAlgoWalletClient | null>;
349
352
  connect(): Promise<{
350
353
  accounts: {
351
354
  providerId: PROVIDER_ID;
@@ -364,7 +367,7 @@ declare class MyAlgoWalletClient extends BaseClient {
364
367
  signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
365
368
  }
366
369
 
367
- declare type ClientOptions$3 = {
370
+ declare type ClientOptions$4 = {
368
371
  bridge?: string;
369
372
  deep_link?: string;
370
373
  app_meta?: {
@@ -390,8 +393,8 @@ declare type DeflyWalletClientConstructor = {
390
393
  algodClient: _algosdk.Algodv2;
391
394
  network: Network;
392
395
  };
393
- declare type InitParams$4 = {
394
- clientOptions?: ClientOptions$3;
396
+ declare type InitParams$5 = {
397
+ clientOptions?: ClientOptions$4;
395
398
  algodOptions?: AlgodClientOptions;
396
399
  clientStatic?: typeof DeflyWalletConnect;
397
400
  algosdkStatic?: typeof _algosdk;
@@ -408,7 +411,7 @@ declare class DeflyWalletClient extends BaseClient {
408
411
  icon: string;
409
412
  isWalletConnect: boolean;
410
413
  };
411
- static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams$4): Promise<DeflyWalletClient | null>;
414
+ static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams$5): Promise<DeflyWalletClient | null>;
412
415
  connect(onDisconnect: () => void): Promise<Wallet>;
413
416
  reconnect(onDisconnect: () => void): Promise<{
414
417
  accounts: {
@@ -429,7 +432,7 @@ declare class DeflyWalletClient extends BaseClient {
429
432
  formatTransactionsArray(transactions: TransactionsArray): DeflyTransaction[];
430
433
  }
431
434
 
432
- declare type ClientOptions$2 = {
435
+ declare type ClientOptions$3 = {
433
436
  onlyIfTrusted: boolean;
434
437
  };
435
438
  declare type Bytes = Readonly<Uint8Array>;
@@ -456,8 +459,8 @@ declare type ExodusClientConstructor = {
456
459
  onlyIfTrusted: boolean;
457
460
  network: Network;
458
461
  };
459
- declare type InitParams$3 = {
460
- clientOptions?: ClientOptions$2;
462
+ declare type InitParams$4 = {
463
+ clientOptions?: ClientOptions$3;
461
464
  algodOptions?: AlgodClientOptions;
462
465
  algosdkStatic?: typeof _algosdk;
463
466
  network?: Network;
@@ -473,7 +476,7 @@ declare class ExodusClient extends BaseClient {
473
476
  icon: string;
474
477
  isWalletConnect: boolean;
475
478
  };
476
- static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams$3): Promise<ExodusClient | null>;
479
+ static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams$4): Promise<ExodusClient | null>;
477
480
  connect(): Promise<{
478
481
  accounts: {
479
482
  name: string;
@@ -522,7 +525,7 @@ declare type AlgoSignerClientConstructor = {
522
525
  algodClient: _algosdk.Algodv2;
523
526
  network: SupportedLedgers;
524
527
  };
525
- declare type InitParams$2 = {
528
+ declare type InitParams$3 = {
526
529
  algodOptions?: AlgodClientOptions;
527
530
  algosdkStatic?: typeof _algosdk;
528
531
  network?: Network;
@@ -538,7 +541,7 @@ declare class AlgoSignerClient extends BaseClient {
538
541
  icon: string;
539
542
  isWalletConnect: boolean;
540
543
  };
541
- static init({ algodOptions, algosdkStatic, network, }: InitParams$2): Promise<AlgoSignerClient | null>;
544
+ static init({ algodOptions, algosdkStatic, network, }: InitParams$3): Promise<AlgoSignerClient | null>;
542
545
  connect(): Promise<{
543
546
  accounts: {
544
547
  name: string;
@@ -582,7 +585,7 @@ interface IWalletConnectSession {
582
585
  close: () => void;
583
586
  };
584
587
  }
585
- declare type ClientOptions$1 = {
588
+ declare type ClientOptions$2 = {
586
589
  bridge?: string;
587
590
  uri?: string;
588
591
  storageId?: string;
@@ -595,8 +598,8 @@ declare type WalletConnectTransaction = {
595
598
  message?: string;
596
599
  signers?: string[] | [];
597
600
  };
598
- declare type InitParams$1 = {
599
- clientOptions?: ClientOptions$1;
601
+ declare type InitParams$2 = {
602
+ clientOptions?: ClientOptions$2;
600
603
  algodOptions?: AlgodClientOptions;
601
604
  clientStatic?: typeof WalletConnect;
602
605
  modalStatic?: typeof QRCodeModal;
@@ -621,7 +624,7 @@ declare class WalletConnectClient extends BaseClient {
621
624
  icon: string;
622
625
  isWalletConnect: boolean;
623
626
  };
624
- static init({ clientOptions, algodOptions, clientStatic, modalStatic, algosdkStatic, network, }: InitParams$1): Promise<WalletConnectClient | null>;
627
+ static init({ clientOptions, algodOptions, clientStatic, modalStatic, algosdkStatic, network, }: InitParams$2): Promise<WalletConnectClient | null>;
625
628
  connect(): Promise<Wallet>;
626
629
  reconnect(): Promise<{
627
630
  accounts: {
@@ -643,7 +646,7 @@ declare class WalletConnectClient extends BaseClient {
643
646
  signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
644
647
  }
645
648
 
646
- declare type ClientOptions = {
649
+ declare type ClientOptions$1 = {
647
650
  wallet: string;
648
651
  password: string;
649
652
  host: string;
@@ -660,8 +663,8 @@ declare type KMDWalletClientConstructor = {
660
663
  password: string;
661
664
  network: Network;
662
665
  };
663
- declare type InitParams = {
664
- clientOptions?: ClientOptions;
666
+ declare type InitParams$1 = {
667
+ clientOptions?: ClientOptions$1;
665
668
  algodOptions?: AlgodClientOptions;
666
669
  algosdkStatic?: typeof _algosdk;
667
670
  network?: Network;
@@ -679,7 +682,7 @@ declare class KMDWalletClient extends BaseClient {
679
682
  icon: string;
680
683
  isWalletConnect: boolean;
681
684
  };
682
- static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams): Promise<KMDWalletClient | null>;
685
+ static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams$1): Promise<KMDWalletClient | null>;
683
686
  connect(): Promise<Wallet>;
684
687
  disconnect(): Promise<void>;
685
688
  reconnect(): Promise<Wallet | null>;
@@ -688,8 +691,50 @@ declare class KMDWalletClient extends BaseClient {
688
691
  releaseToken(token: string): Promise<void>;
689
692
  listWallets(): Promise<Record<string, string>>;
690
693
  listAccounts(wallet: string, password: string): Promise<Array<Account>>;
694
+ getWalletId(): Promise<string>;
695
+ signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
696
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
697
+ }
698
+
699
+ declare type ClientOptions = {
700
+ wallet: string;
701
+ password: string;
702
+ host: string;
703
+ token: string;
704
+ port: string;
705
+ };
706
+ declare type MnemonicWalletClientConstructor = {
707
+ metadata: Metadata;
708
+ id: PROVIDER_ID;
709
+ algosdk: typeof _algosdk;
710
+ algodClient: _algosdk.Algodv2;
711
+ network: Network;
712
+ };
713
+ declare type InitParams = {
714
+ clientOptions?: ClientOptions;
715
+ algodOptions?: AlgodClientOptions;
716
+ algosdkStatic?: typeof _algosdk;
717
+ network?: Network;
718
+ };
719
+
720
+ declare class MnemonicWalletClient extends BaseClient {
721
+ #private;
722
+ id: PROVIDER_ID;
723
+ network: Network;
724
+ constructor({ metadata, id, algosdk, algodClient, network, }: MnemonicWalletClientConstructor);
725
+ static metadata: {
726
+ id: PROVIDER_ID;
727
+ name: string;
728
+ icon: string;
729
+ isWalletConnect: boolean;
730
+ };
731
+ static init({ algodOptions, algosdkStatic, network, }: InitParams): Promise<MnemonicWalletClient | null>;
732
+ connect(): Promise<Wallet>;
733
+ disconnect(): Promise<void>;
734
+ reconnect(): Promise<Wallet | null>;
735
+ requestPassword(): Promise<string>;
691
736
  signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
692
737
  signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
693
738
  }
694
739
 
695
- export { Account, AccountInfo, AlgodClientOptions, Asset, ConfirmedTxn, DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, DecodedSignedTransaction, DecodedTransaction, Metadata, Network, PROVIDER_ID, Provider, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, _default as WalletProvider, AlgoSignerClient as algosigner, DeflyWalletClient as defly, ExodusClient as exodus, initializeProviders, KMDWalletClient as kmd, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useWallet, WalletConnectClient as walletconnect };
740
+ export { Account, AccountInfo, AlgodClientOptions, Asset, ConfirmedTxn, DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, DecodedSignedTransaction, DecodedTransaction, Metadata, Network, PROVIDER_ID, Provider, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, _default as WalletProvider, AlgoSignerClient as algosigner, DeflyWalletClient as defly, ExodusClient as exodus, initializeProviders, KMDWalletClient as kmd, MnemonicWalletClient as mnemonic, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useWallet, WalletConnectClient as walletconnect };
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.1.5",
15
+ "version": "1.2.0",
16
16
  "description": "React hooks for using Algorand compatible wallets in dApps.",
17
17
  "scripts": {
18
18
  "dev": "yarn storybook",
@@ -79,7 +79,7 @@
79
79
  "peerDependencies": {
80
80
  "@blockshake/defly-connect": "^1.0.0",
81
81
  "@json-rpc-tools/utils": "^1.7.6",
82
- "@perawallet/connect": "^1.0.7",
82
+ "@perawallet/connect": "^1.1.0",
83
83
  "@randlabs/myalgo-connect": "^1.4.2",
84
84
  "@walletconnect/client": "^1.8.0",
85
85
  "algorand-walletconnect-qrcode-modal": "^1.8.0",