@txnlab/use-wallet 0.1.14 → 0.1.16

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
@@ -1,10 +1,8 @@
1
- import * as algosdk from 'algosdk';
2
- import algosdk__default, { TransactionType, Transaction } from 'algosdk';
3
- import * as _walletconnect_client from '@walletconnect/client';
4
- import * as _blockshake_defly_connect_dist_DeflyWalletConnect from '@blockshake/defly-connect/dist/DeflyWalletConnect';
5
- import * as _randlabs_myalgo_connect from '@randlabs/myalgo-connect';
6
- import * as _perawallet_connect_dist_PeraWalletConnect from '@perawallet/connect/dist/PeraWalletConnect';
7
- import * as algosdk_dist_types_src_main from 'algosdk/dist/types/src/main';
1
+ import algosdk, { TransactionType, Transaction, Kmd } from 'algosdk';
2
+ import { PeraWalletConnect } from '@perawallet/connect';
3
+ import MyAlgoConnect from '@randlabs/myalgo-connect';
4
+ import { DeflyWalletConnect } from '@blockshake/defly-connect';
5
+ import WalletConnect from '@walletconnect/client';
8
6
 
9
7
  declare type Txn = {
10
8
  apaa: Uint8Array;
@@ -82,7 +80,7 @@ interface BaseWalletInterface {
82
80
  healthCheck(): Promise<Record<string, never>>;
83
81
  disconnect(): Promise<void>;
84
82
  reconnect(onDisconnect: () => void): Promise<Wallet | null>;
85
- decodeTransaction(txn: string, isSigned: boolean): algosdk__default.Transaction;
83
+ decodeTransaction(txn: string, isSigned: boolean): algosdk.Transaction;
86
84
  logEncodedTransaction(txn: string, isSigned: boolean): void;
87
85
  groupTransactionsBySender(transactions: TransactionsArray): Record<string, TxnInfo[]>;
88
86
  signTransactions(activeAddress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
@@ -94,6 +92,46 @@ interface BaseWalletInterface {
94
92
  getAssets(address: string): Promise<Asset[]>;
95
93
  waitForConfirmation(txId: string, timeout?: number): Promise<ConfirmedTxn>;
96
94
  }
95
+ declare abstract class BaseWallet implements BaseWalletInterface {
96
+ keepWCAlive: HTMLAudioElement;
97
+ protected abstract id: PROVIDER_ID;
98
+ protected abstract provider: WalletProvider;
99
+ abstract connect(onDisconnect: () => void): Promise<Wallet>;
100
+ abstract disconnect(): Promise<void>;
101
+ abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
102
+ abstract signTransactions(activeAdress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
103
+ abstract signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
104
+ protected constructor();
105
+ healthCheck(): Promise<{}>;
106
+ getAccountInfo(address: string): Promise<AccountInfo>;
107
+ getAssets(address: string): Promise<Asset[]>;
108
+ waitForConfirmation(txId: string, timeout?: number): Promise<{
109
+ "confirmed-round": number;
110
+ "global-state-delta": Record<string, unknown>[];
111
+ "pool-error": string;
112
+ txn: {
113
+ sig: Uint8Array;
114
+ txn: Txn;
115
+ };
116
+ txId: string;
117
+ }>;
118
+ decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
119
+ logEncodedTransaction(txn: string, isSigned: boolean): void;
120
+ groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
121
+ sendRawTransactions(transactions: Uint8Array[]): Promise<{
122
+ "confirmed-round": number;
123
+ "global-state-delta": Record<string, unknown>[];
124
+ "pool-error": string;
125
+ txn: {
126
+ sig: Uint8Array;
127
+ txn: Txn;
128
+ };
129
+ txId: string;
130
+ id: any;
131
+ }>;
132
+ keepWCAliveStart(): void;
133
+ keepWCAliveStop(): void;
134
+ }
97
135
 
98
136
  interface Account {
99
137
  providerId: PROVIDER_ID;
@@ -143,7 +181,7 @@ declare type WalletClient = BaseWalletInterface;
143
181
  declare function useWallet(): {
144
182
  accounts: Account[];
145
183
  activeAccount: Account | null;
146
- signer: algosdk__default.TransactionSigner;
184
+ signer: algosdk.TransactionSigner;
147
185
  signTransactions: (transactions: Array<Uint8Array>) => Promise<Uint8Array[]>;
148
186
  sendTransactions: (transactions: Uint8Array[]) => Promise<ConfirmedTxn & {
149
187
  id: string;
@@ -188,8 +226,6 @@ declare function useConnectWallet(options?: Options): {
188
226
  };
189
227
 
190
228
  declare const getWalletClient: (id: PROVIDER_ID | undefined) => Promise<WalletClient>;
191
- declare const formatPrice: (price: number, isAlgos?: boolean, options?: Intl.NumberFormatOptions | undefined) => string;
192
- declare const convertMicroalgosToAlgos: (amount: number) => number;
193
229
 
194
230
  declare const providers: {
195
231
  "Pera Wallet": WalletProvider;
@@ -201,12 +237,7 @@ declare const providers: {
201
237
  "Wallet Connect": WalletProvider;
202
238
  };
203
239
 
204
- /**
205
- * Helpful resources:
206
- * https://github.com/blockshake-io/defly-connect
207
- */
208
-
209
- interface DeflyTransaction {
240
+ interface PeraTransaction {
210
241
  txn: Transaction;
211
242
  /**
212
243
  * Optional list of addresses that must sign the transactions.
@@ -215,13 +246,125 @@ interface DeflyTransaction {
215
246
  */
216
247
  signers?: string[];
217
248
  }
249
+ declare type InitWallet$6 = {
250
+ id: PROVIDER_ID;
251
+ client: PeraWalletConnect;
252
+ provider: WalletProvider;
253
+ };
254
+ declare class PeraWalletClient extends BaseWallet {
255
+ #private;
256
+ id: PROVIDER_ID;
257
+ provider: WalletProvider;
258
+ constructor(initWallet: InitWallet$6);
259
+ static init(): Promise<PeraWalletClient>;
260
+ connect(onDisconnect: () => void): Promise<Wallet>;
261
+ reconnect(onDisconnect: () => void): Promise<{
262
+ accounts: {
263
+ name: string;
264
+ address: string;
265
+ providerId: PROVIDER_ID;
266
+ }[];
267
+ id: PROVIDER_ID;
268
+ name: string;
269
+ icon: string;
270
+ isWalletConnect: boolean;
271
+ } | null>;
272
+ disconnect(): Promise<void>;
273
+ formatTransactionsArray(transactions: TransactionsArray): PeraTransaction[];
274
+ signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
275
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
276
+ }
218
277
 
219
278
  /**
220
279
  * Helpful resources:
221
- * https://github.com/perawallet/connect
280
+ * https://github.com/randlabs/myalgo-connect
222
281
  */
223
282
 
224
- interface PeraTransaction {
283
+ declare type InitWallet$5 = {
284
+ id: PROVIDER_ID;
285
+ client: MyAlgoConnect;
286
+ provider: WalletProvider;
287
+ };
288
+ declare class MyAlgoWalletClient extends BaseWallet {
289
+ #private;
290
+ id: PROVIDER_ID;
291
+ provider: WalletProvider;
292
+ constructor(initWallet: InitWallet$5);
293
+ static init(): Promise<MyAlgoWalletClient>;
294
+ connect(): Promise<{
295
+ accounts: {
296
+ providerId: PROVIDER_ID;
297
+ address: string;
298
+ name: string;
299
+ }[];
300
+ id: PROVIDER_ID;
301
+ name: string;
302
+ icon: string;
303
+ isWalletConnect: boolean;
304
+ }>;
305
+ reconnect(): Promise<null>;
306
+ disconnect(): Promise<void>;
307
+ signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
308
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
309
+ }
310
+
311
+ /**
312
+ * Helpful resources:
313
+ * https://github.com/PureStake/algosigner/blob/develop/docs/dApp-integration.md
314
+ */
315
+
316
+ declare type AlgoSignerTransaction = {
317
+ txn: string;
318
+ signers?: [];
319
+ multisig?: string;
320
+ };
321
+ declare type SupportedLedgers = "MainNet" | "TestNet" | "BetaNet" | string;
322
+ declare type AlgoSigner = {
323
+ connect: () => Promise<Record<string, never>>;
324
+ accounts: (ledger: {
325
+ ledger: SupportedLedgers;
326
+ }) => Promise<{
327
+ address: string;
328
+ }[]>;
329
+ signTxn: (transactions: AlgoSignerTransaction[]) => Promise<{
330
+ txID: string;
331
+ blob: string;
332
+ }[]>;
333
+ encoding: {
334
+ msgpackToBase64(transaction: Uint8Array): string;
335
+ byteArrayToString(transaction: Uint8Array): string;
336
+ };
337
+ };
338
+ declare type InitWallet$4 = {
339
+ client: AlgoSigner;
340
+ id: PROVIDER_ID;
341
+ provider: WalletProvider;
342
+ };
343
+ declare class AlgoSignerClient extends BaseWallet {
344
+ #private;
345
+ id: PROVIDER_ID;
346
+ provider: WalletProvider;
347
+ constructor(initWallet: InitWallet$4);
348
+ static init(): Promise<AlgoSignerClient>;
349
+ connect(): Promise<{
350
+ accounts: {
351
+ name: string;
352
+ address: string;
353
+ providerId: PROVIDER_ID;
354
+ }[];
355
+ id: PROVIDER_ID;
356
+ name: string;
357
+ icon: string;
358
+ isWalletConnect: boolean;
359
+ }>;
360
+ reconnect(onDisconnect: () => void): Promise<null>;
361
+ disconnect(): Promise<void>;
362
+ formatTransactionsArray(transactions: TransactionsArray): AlgoSignerTransaction[];
363
+ signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
364
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
365
+ }
366
+
367
+ interface DeflyTransaction {
225
368
  txn: Transaction;
226
369
  /**
227
370
  * Optional list of addresses that must sign the transactions.
@@ -230,411 +373,148 @@ interface PeraTransaction {
230
373
  */
231
374
  signers?: string[];
232
375
  }
233
-
234
- declare const clients: {
235
- "KMD Wallet": Promise<void | {
236
- "__#23@#client": algosdk.Kmd;
237
- walletId: string;
238
- id: PROVIDER_ID;
239
- provider: WalletProvider;
240
- connect(): Promise<Wallet>;
241
- disconnect(): Promise<void>;
242
- reconnect(): Promise<Wallet | null>;
243
- requestPassword(): Promise<string>;
244
- getWalletToken(walletId: string, password: string): Promise<string>;
245
- releaseToken(token: string): Promise<void>;
246
- listWallets(): Promise<Record<string, string>>;
247
- listAccounts(wallet: string, password: string): Promise<Account[]>;
248
- signTransactions(activeAddress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
249
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
250
- algodClient: algosdk.Algodv2;
251
- algosdk: typeof algosdk_dist_types_src_main;
252
- keepWCAlive: HTMLAudioElement;
253
- healthCheck(): Promise<{}>;
254
- getAccountInfo(address: string): Promise<AccountInfo>;
255
- getAssets(address: string): Promise<Asset[]>;
256
- waitForConfirmation(txId: string, timeout?: number): Promise<{
257
- "confirmed-round": number;
258
- "global-state-delta": Record<string, unknown>[];
259
- "pool-error": string;
260
- txn: {
261
- sig: Uint8Array;
262
- txn: Txn;
263
- };
264
- txId: string;
265
- }>;
266
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
267
- logEncodedTransaction(txn: string, isSigned: boolean): void;
268
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
269
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
270
- "confirmed-round": number;
271
- "global-state-delta": Record<string, unknown>[];
272
- "pool-error": string;
273
- txn: {
274
- sig: Uint8Array;
275
- txn: Txn;
276
- };
277
- txId: string;
278
- id: any;
279
- }>;
280
- keepWCAliveStart(): void;
281
- keepWCAliveStop(): void;
282
- }>;
283
- "Pera Wallet": Promise<void | {
284
- "__#18@#client": _perawallet_connect_dist_PeraWalletConnect.default;
285
- id: PROVIDER_ID;
286
- provider: WalletProvider;
287
- connect(onDisconnect: () => void): Promise<Wallet>;
288
- reconnect(onDisconnect: () => void): Promise<{
289
- accounts: {
290
- name: string;
291
- address: string;
292
- providerId: PROVIDER_ID;
293
- }[];
294
- id: PROVIDER_ID;
376
+ declare type InitWallet$3 = {
377
+ id: PROVIDER_ID;
378
+ client: DeflyWalletConnect;
379
+ provider: WalletProvider;
380
+ };
381
+ declare class DeflyWalletClient extends BaseWallet {
382
+ #private;
383
+ id: PROVIDER_ID;
384
+ provider: WalletProvider;
385
+ constructor(initWallet: InitWallet$3);
386
+ static init(): Promise<DeflyWalletClient>;
387
+ connect(onDisconnect: () => void): Promise<Wallet>;
388
+ reconnect(onDisconnect: () => void): Promise<{
389
+ accounts: {
295
390
  name: string;
296
- icon: string;
297
- isWalletConnect: boolean;
298
- } | null>;
299
- disconnect(): Promise<void>;
300
- formatTransactionsArray(transactions: TransactionsArray): PeraTransaction[];
301
- signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
302
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
303
- algodClient: algosdk.Algodv2;
304
- algosdk: typeof algosdk_dist_types_src_main;
305
- keepWCAlive: HTMLAudioElement;
306
- healthCheck(): Promise<{}>;
307
- getAccountInfo(address: string): Promise<AccountInfo>;
308
- getAssets(address: string): Promise<Asset[]>;
309
- waitForConfirmation(txId: string, timeout?: number): Promise<{
310
- "confirmed-round": number;
311
- "global-state-delta": Record<string, unknown>[];
312
- "pool-error": string;
313
- txn: {
314
- sig: Uint8Array;
315
- txn: Txn;
316
- };
317
- txId: string;
318
- }>;
319
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
320
- logEncodedTransaction(txn: string, isSigned: boolean): void;
321
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
322
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
323
- "confirmed-round": number;
324
- "global-state-delta": Record<string, unknown>[];
325
- "pool-error": string;
326
- txn: {
327
- sig: Uint8Array;
328
- txn: Txn;
329
- };
330
- txId: string;
331
- id: any;
332
- }>;
333
- keepWCAliveStart(): void;
334
- keepWCAliveStop(): void;
335
- }>;
336
- "MyAlgo Wallet": Promise<void | {
337
- "__#19@#client": _randlabs_myalgo_connect.default;
391
+ address: string;
392
+ providerId: PROVIDER_ID;
393
+ }[];
338
394
  id: PROVIDER_ID;
339
- provider: WalletProvider;
340
- connect(): Promise<{
341
- accounts: {
342
- providerId: PROVIDER_ID;
343
- address: string;
344
- name: string;
345
- }[];
346
- id: PROVIDER_ID;
347
- name: string;
348
- icon: string;
349
- isWalletConnect: boolean;
350
- }>;
351
- reconnect(): Promise<null>;
352
- disconnect(): Promise<void>;
353
- signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
354
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
355
- algodClient: algosdk.Algodv2;
356
- algosdk: typeof algosdk_dist_types_src_main;
357
- keepWCAlive: HTMLAudioElement;
358
- healthCheck(): Promise<{}>;
359
- getAccountInfo(address: string): Promise<AccountInfo>;
360
- getAssets(address: string): Promise<Asset[]>;
361
- waitForConfirmation(txId: string, timeout?: number): Promise<{
362
- "confirmed-round": number;
363
- "global-state-delta": Record<string, unknown>[];
364
- "pool-error": string;
365
- txn: {
366
- sig: Uint8Array;
367
- txn: Txn;
368
- };
369
- txId: string;
370
- }>;
371
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
372
- logEncodedTransaction(txn: string, isSigned: boolean): void;
373
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
374
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
375
- "confirmed-round": number;
376
- "global-state-delta": Record<string, unknown>[];
377
- "pool-error": string;
378
- txn: {
379
- sig: Uint8Array;
380
- txn: Txn;
381
- };
382
- txId: string;
383
- id: any;
384
- }>;
385
- keepWCAliveStart(): void;
386
- keepWCAliveStop(): void;
395
+ name: string;
396
+ icon: string;
397
+ isWalletConnect: boolean;
398
+ } | null>;
399
+ disconnect(): Promise<void>;
400
+ formatTransactionsArray(transactions: TransactionsArray): DeflyTransaction[];
401
+ signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
402
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
403
+ }
404
+
405
+ /**
406
+ * Helpful resources:
407
+ * https://docs.exodus.com/api-reference/algorand-provider-api/
408
+ */
409
+
410
+ declare type Bytes = Readonly<Uint8Array>;
411
+ declare type Exodus = {
412
+ isConnected: boolean;
413
+ address: string | null;
414
+ connect: () => Promise<{
415
+ address: string;
387
416
  }>;
388
- "Algo Signer": Promise<void | {
389
- "__#20@#client": {
390
- connect: () => Promise<Record<string, never>>;
391
- accounts: (ledger: {
392
- ledger: string;
393
- }) => Promise<{
394
- address: string;
395
- }[]>;
396
- signTxn: (transactions: {
397
- txn: string;
398
- signers?: [] | undefined;
399
- multisig?: string | undefined;
400
- }[]) => Promise<{
401
- txID: string;
402
- blob: string;
403
- }[]>;
404
- encoding: {
405
- msgpackToBase64(transaction: Uint8Array): string;
406
- byteArrayToString(transaction: Uint8Array): string;
407
- };
408
- };
409
- id: PROVIDER_ID;
410
- provider: WalletProvider;
411
- connect(): Promise<{
412
- accounts: {
413
- name: string;
414
- address: string;
415
- providerId: PROVIDER_ID;
416
- }[];
417
- id: PROVIDER_ID;
418
- name: string;
419
- icon: string;
420
- isWalletConnect: boolean;
421
- }>;
422
- reconnect(onDisconnect: () => void): Promise<null>;
423
- disconnect(): Promise<void>;
424
- formatTransactionsArray(transactions: TransactionsArray): {
425
- txn: string;
426
- signers?: [] | undefined;
427
- multisig?: string | undefined;
428
- }[];
429
- signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
430
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
431
- algodClient: algosdk.Algodv2;
432
- algosdk: typeof algosdk_dist_types_src_main;
433
- keepWCAlive: HTMLAudioElement;
434
- healthCheck(): Promise<{}>;
435
- getAccountInfo(address: string): Promise<AccountInfo>;
436
- getAssets(address: string): Promise<Asset[]>;
437
- waitForConfirmation(txId: string, timeout?: number): Promise<{
438
- "confirmed-round": number;
439
- "global-state-delta": Record<string, unknown>[];
440
- "pool-error": string;
441
- txn: {
442
- sig: Uint8Array;
443
- txn: Txn;
444
- };
445
- txId: string;
446
- }>;
447
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
448
- logEncodedTransaction(txn: string, isSigned: boolean): void;
449
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
450
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
451
- "confirmed-round": number;
452
- "global-state-delta": Record<string, unknown>[];
453
- "pool-error": string;
454
- txn: {
455
- sig: Uint8Array;
456
- txn: Txn;
457
- };
458
- txId: string;
459
- id: any;
460
- }>;
461
- keepWCAliveStart(): void;
462
- keepWCAliveStop(): void;
417
+ disconnect: () => void;
418
+ signAndSendTransaction(transactions: Bytes[]): Promise<{
419
+ txId: string;
463
420
  }>;
464
- Defly: Promise<void | {
465
- "__#21@#client": _blockshake_defly_connect_dist_DeflyWalletConnect.default;
466
- id: PROVIDER_ID;
467
- provider: WalletProvider;
468
- connect(onDisconnect: () => void): Promise<Wallet>;
469
- reconnect(onDisconnect: () => void): Promise<{
470
- accounts: {
471
- name: string;
472
- address: string;
473
- providerId: PROVIDER_ID;
474
- }[];
475
- id: PROVIDER_ID;
421
+ signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
422
+ };
423
+ declare type InitWallet$2 = {
424
+ client: Exodus;
425
+ id: PROVIDER_ID;
426
+ provider: WalletProvider;
427
+ };
428
+ declare class ExodusClient extends BaseWallet {
429
+ #private;
430
+ id: PROVIDER_ID;
431
+ provider: WalletProvider;
432
+ constructor(initWallet: InitWallet$2);
433
+ static init(): Promise<ExodusClient>;
434
+ connect(): Promise<{
435
+ accounts: {
476
436
  name: string;
477
- icon: string;
478
- isWalletConnect: boolean;
479
- } | null>;
480
- disconnect(): Promise<void>;
481
- formatTransactionsArray(transactions: TransactionsArray): DeflyTransaction[];
482
- signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
483
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
484
- algodClient: algosdk.Algodv2;
485
- algosdk: typeof algosdk_dist_types_src_main;
486
- keepWCAlive: HTMLAudioElement;
487
- healthCheck(): Promise<{}>;
488
- getAccountInfo(address: string): Promise<AccountInfo>;
489
- getAssets(address: string): Promise<Asset[]>;
490
- waitForConfirmation(txId: string, timeout?: number): Promise<{
491
- "confirmed-round": number;
492
- "global-state-delta": Record<string, unknown>[];
493
- "pool-error": string;
494
- txn: {
495
- sig: Uint8Array;
496
- txn: Txn;
497
- };
498
- txId: string;
499
- }>;
500
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
501
- logEncodedTransaction(txn: string, isSigned: boolean): void;
502
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
503
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
504
- "confirmed-round": number;
505
- "global-state-delta": Record<string, unknown>[];
506
- "pool-error": string;
507
- txn: {
508
- sig: Uint8Array;
509
- txn: Txn;
510
- };
511
- txId: string;
512
- id: any;
513
- }>;
514
- keepWCAliveStart(): void;
515
- keepWCAliveStop(): void;
516
- }>;
517
- Exodus: Promise<void | {
518
- "__#22@#client": {
519
- isConnected: boolean;
520
- address: string | null;
521
- connect: () => Promise<{
522
- address: string;
523
- }>;
524
- disconnect: () => void;
525
- signAndSendTransaction(transactions: Readonly<Uint8Array>[]): Promise<{
526
- txId: string;
527
- }>;
528
- signTransaction(transactions: Readonly<Uint8Array>[]): Promise<Readonly<Uint8Array>[]>;
529
- };
437
+ address: string;
438
+ providerId: PROVIDER_ID;
439
+ }[];
530
440
  id: PROVIDER_ID;
531
- provider: WalletProvider;
532
- connect(): Promise<{
533
- accounts: {
534
- name: string;
535
- address: string;
536
- providerId: PROVIDER_ID;
537
- }[];
538
- id: PROVIDER_ID;
539
- name: string;
540
- icon: string;
541
- isWalletConnect: boolean;
542
- }>;
543
- reconnect(onDisconnect: () => void): Promise<null>;
544
- disconnect(): Promise<void>;
545
- signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
546
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
547
- algodClient: algosdk.Algodv2;
548
- algosdk: typeof algosdk_dist_types_src_main;
549
- keepWCAlive: HTMLAudioElement;
550
- healthCheck(): Promise<{}>;
551
- getAccountInfo(address: string): Promise<AccountInfo>;
552
- getAssets(address: string): Promise<Asset[]>;
553
- waitForConfirmation(txId: string, timeout?: number): Promise<{
554
- "confirmed-round": number;
555
- "global-state-delta": Record<string, unknown>[];
556
- "pool-error": string;
557
- txn: {
558
- sig: Uint8Array;
559
- txn: Txn;
560
- };
561
- txId: string;
562
- }>;
563
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
564
- logEncodedTransaction(txn: string, isSigned: boolean): void;
565
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
566
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
567
- "confirmed-round": number;
568
- "global-state-delta": Record<string, unknown>[];
569
- "pool-error": string;
570
- txn: {
571
- sig: Uint8Array;
572
- txn: Txn;
573
- };
574
- txId: string;
575
- id: any;
576
- }>;
577
- keepWCAliveStart(): void;
578
- keepWCAliveStop(): void;
441
+ name: string;
442
+ icon: string;
443
+ isWalletConnect: boolean;
579
444
  }>;
580
- "Wallet Connect": Promise<void | {
581
- "__#24@#client": _walletconnect_client.default;
582
- id: PROVIDER_ID;
583
- provider: WalletProvider;
584
- connect(): Promise<Wallet>;
585
- reconnect(): Promise<{
586
- accounts: {
587
- name: string;
588
- address: string;
589
- providerId: PROVIDER_ID;
590
- }[];
591
- id: PROVIDER_ID;
445
+ reconnect(onDisconnect: () => void): Promise<null>;
446
+ disconnect(): Promise<void>;
447
+ signTransactions(activeAdress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
448
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
449
+ }
450
+
451
+ declare type InitWallet$1 = {
452
+ client: Kmd;
453
+ id: PROVIDER_ID;
454
+ provider: WalletProvider;
455
+ };
456
+ declare class KMDWallet extends BaseWallet {
457
+ #private;
458
+ walletId: string;
459
+ id: PROVIDER_ID;
460
+ provider: WalletProvider;
461
+ constructor(initWallet: InitWallet$1);
462
+ static init(): Promise<KMDWallet>;
463
+ connect(): Promise<Wallet>;
464
+ disconnect(): Promise<void>;
465
+ reconnect(): Promise<Wallet | null>;
466
+ requestPassword(): Promise<string>;
467
+ getWalletToken(walletId: string, password: string): Promise<string>;
468
+ releaseToken(token: string): Promise<void>;
469
+ listWallets(): Promise<Record<string, string>>;
470
+ listAccounts(wallet: string, password: string): Promise<Array<Account>>;
471
+ signTransactions(activeAddress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
472
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
473
+ }
474
+
475
+ declare type WalletConnectTransaction = {
476
+ txn: string;
477
+ message?: string;
478
+ signers?: string[] | [];
479
+ };
480
+ declare type InitWallet = {
481
+ id: PROVIDER_ID;
482
+ client: WalletConnect;
483
+ provider: WalletProvider;
484
+ };
485
+ declare class WalletConnectClient extends BaseWallet {
486
+ #private;
487
+ id: PROVIDER_ID;
488
+ provider: WalletProvider;
489
+ constructor(initWallet: InitWallet);
490
+ static init(): Promise<WalletConnectClient>;
491
+ connect(): Promise<Wallet>;
492
+ reconnect(): Promise<{
493
+ accounts: {
592
494
  name: string;
593
- icon: string;
594
- isWalletConnect: boolean;
595
- } | null>;
596
- check(): boolean;
597
- disconnect(): Promise<void>;
598
- formatTransactionsArray(transactions: TransactionsArray): {
599
- txn: string;
600
- message?: string | undefined;
601
- signers?: [] | string[] | undefined;
495
+ address: string;
496
+ providerId: PROVIDER_ID;
602
497
  }[];
603
- signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
604
- signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
605
- algodClient: algosdk.Algodv2;
606
- algosdk: typeof algosdk_dist_types_src_main;
607
- keepWCAlive: HTMLAudioElement;
608
- healthCheck(): Promise<{}>;
609
- getAccountInfo(address: string): Promise<AccountInfo>;
610
- getAssets(address: string): Promise<Asset[]>;
611
- waitForConfirmation(txId: string, timeout?: number): Promise<{
612
- "confirmed-round": number;
613
- "global-state-delta": Record<string, unknown>[];
614
- "pool-error": string;
615
- txn: {
616
- sig: Uint8Array;
617
- txn: Txn;
618
- };
619
- txId: string;
620
- }>;
621
- decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
622
- logEncodedTransaction(txn: string, isSigned: boolean): void;
623
- groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
624
- sendRawTransactions(transactions: Uint8Array[]): Promise<{
625
- "confirmed-round": number;
626
- "global-state-delta": Record<string, unknown>[];
627
- "pool-error": string;
628
- txn: {
629
- sig: Uint8Array;
630
- txn: Txn;
631
- };
632
- txId: string;
633
- id: any;
634
- }>;
635
- keepWCAliveStart(): void;
636
- keepWCAliveStop(): void;
637
- }>;
498
+ id: PROVIDER_ID;
499
+ name: string;
500
+ icon: string;
501
+ isWalletConnect: boolean;
502
+ } | null>;
503
+ check(): boolean;
504
+ disconnect(): Promise<void>;
505
+ formatTransactionsArray(transactions: TransactionsArray): WalletConnectTransaction[];
506
+ signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
507
+ signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
508
+ }
509
+
510
+ declare const clients: {
511
+ "KMD Wallet": typeof KMDWallet;
512
+ "Pera Wallet": typeof PeraWalletClient;
513
+ "MyAlgo Wallet": typeof MyAlgoWalletClient;
514
+ "Algo Signer": typeof AlgoSignerClient;
515
+ Defly: typeof DeflyWalletClient;
516
+ Exodus: typeof ExodusClient;
517
+ "Wallet Connect": typeof WalletConnectClient;
638
518
  };
639
519
 
640
- export { Account, AccountInfo, Asset, ConfirmedTxn, DecodedSignedTransaction, DecodedTransaction, KMD_HOST, KMD_PASSWORD, KMD_PORT, KMD_TOKEN, KMD_WALLET, NODE_NETWORK, NODE_PORT, NODE_SERVER, NODE_TOKEN, PROVIDER_ID, Provider, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, WalletProvider, clients, convertMicroalgosToAlgos, formatPrice, getWalletClient, providers, useConnectWallet, useWallet };
520
+ export { Account, AccountInfo, Asset, ConfirmedTxn, DecodedSignedTransaction, DecodedTransaction, KMD_HOST, KMD_PASSWORD, KMD_PORT, KMD_TOKEN, KMD_WALLET, NODE_NETWORK, NODE_PORT, NODE_SERVER, NODE_TOKEN, PROVIDER_ID, Provider, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, WalletProvider, clients, getWalletClient, providers, useConnectWallet, useWallet };