@txnlab/use-wallet 3.10.0 → 4.0.0-beta.2
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.cjs +778 -410
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -66
- package/dist/index.d.ts +133 -66
- package/dist/index.js +776 -408
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -37,32 +37,38 @@ declare class Logger {
|
|
|
37
37
|
}
|
|
38
38
|
declare const logger: Logger;
|
|
39
39
|
|
|
40
|
-
declare enum NetworkId {
|
|
41
|
-
MAINNET = "mainnet",
|
|
42
|
-
TESTNET = "testnet",
|
|
43
|
-
BETANET = "betanet",
|
|
44
|
-
FNET = "fnet",
|
|
45
|
-
LOCALNET = "localnet",
|
|
46
|
-
VOIMAIN = "voimain",
|
|
47
|
-
ARAMIDMAIN = "aramidmain"
|
|
48
|
-
}
|
|
49
40
|
interface AlgodConfig {
|
|
50
41
|
token: string | algosdk.AlgodTokenHeader | algosdk.CustomTokenHeader | algosdk.BaseHTTPClient;
|
|
51
42
|
baseServer: string;
|
|
52
43
|
port?: string | number;
|
|
53
44
|
headers?: Record<string, string>;
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
interface NetworkConfig {
|
|
47
|
+
name: string;
|
|
48
|
+
algod: AlgodConfig;
|
|
49
|
+
genesisHash?: string;
|
|
50
|
+
genesisId?: string;
|
|
51
|
+
isTestnet?: boolean;
|
|
52
|
+
caipChainId?: string;
|
|
53
|
+
}
|
|
54
|
+
declare const DEFAULT_NETWORKS: Record<string, NetworkConfig>;
|
|
55
|
+
declare enum NetworkId {
|
|
56
|
+
MAINNET = "mainnet",
|
|
57
|
+
TESTNET = "testnet",
|
|
58
|
+
BETANET = "betanet",
|
|
59
|
+
FNET = "fnet",
|
|
60
|
+
LOCALNET = "localnet"
|
|
61
|
+
}
|
|
57
62
|
|
|
58
63
|
declare abstract class BaseWallet {
|
|
59
64
|
readonly id: WalletId;
|
|
60
65
|
readonly metadata: WalletMetadata;
|
|
66
|
+
protected readonly networks: Record<string, NetworkConfig>;
|
|
61
67
|
protected store: Store<State>;
|
|
62
68
|
protected getAlgodClient: () => algosdk.Algodv2;
|
|
63
69
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
64
70
|
protected logger: ReturnType<typeof logger.createScopedLogger>;
|
|
65
|
-
protected constructor({ id, metadata, store, subscribe, getAlgodClient }: WalletConstructor<WalletId>);
|
|
71
|
+
protected constructor({ id, metadata, store, subscribe, getAlgodClient, networks }: WalletConstructor<WalletId>);
|
|
66
72
|
static defaultMetadata: WalletMetadata;
|
|
67
73
|
abstract connect(args?: Record<string, any>): Promise<WalletAccount[]>;
|
|
68
74
|
abstract disconnect(): Promise<void>;
|
|
@@ -76,9 +82,11 @@ declare abstract class BaseWallet {
|
|
|
76
82
|
get addresses(): string[];
|
|
77
83
|
get activeAccount(): WalletAccount | null;
|
|
78
84
|
get activeAddress(): string | null;
|
|
79
|
-
get activeNetwork():
|
|
85
|
+
get activeNetwork(): string;
|
|
80
86
|
get isConnected(): boolean;
|
|
81
87
|
get isActive(): boolean;
|
|
88
|
+
get networkConfig(): Record<string, NetworkConfig>;
|
|
89
|
+
protected get activeNetworkConfig(): NetworkConfig;
|
|
82
90
|
protected onDisconnect: () => void;
|
|
83
91
|
protected manageWalletConnectSession: (action: "backup" | "restore", targetWalletId?: WalletId) => void;
|
|
84
92
|
}
|
|
@@ -96,7 +104,7 @@ interface CustomWalletOptions {
|
|
|
96
104
|
declare class CustomWallet extends BaseWallet {
|
|
97
105
|
private provider;
|
|
98
106
|
protected store: Store<State>;
|
|
99
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.CUSTOM>);
|
|
107
|
+
constructor({ id, store, subscribe, getAlgodClient, networks, options, metadata }: WalletConstructor<WalletId.CUSTOM>);
|
|
100
108
|
static defaultMetadata: {
|
|
101
109
|
name: string;
|
|
102
110
|
icon: string;
|
|
@@ -117,7 +125,7 @@ declare class DeflyWallet extends BaseWallet {
|
|
|
117
125
|
private client;
|
|
118
126
|
private options;
|
|
119
127
|
protected store: Store<State>;
|
|
120
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.DEFLY>);
|
|
128
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.DEFLY>);
|
|
121
129
|
static defaultMetadata: {
|
|
122
130
|
name: string;
|
|
123
131
|
icon: string;
|
|
@@ -132,6 +140,80 @@ declare class DeflyWallet extends BaseWallet {
|
|
|
132
140
|
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
133
141
|
}
|
|
134
142
|
|
|
143
|
+
declare abstract class AVMProvider extends BaseWallet {
|
|
144
|
+
avmWebClient: AVMWebProviderSDK.AVMWebClient | null;
|
|
145
|
+
protected avmWebProviderSDK: typeof AVMWebProviderSDK | null;
|
|
146
|
+
protected providerId: string;
|
|
147
|
+
constructor(args: WalletConstructor<WalletId> & {
|
|
148
|
+
providerId: string;
|
|
149
|
+
});
|
|
150
|
+
protected _initializeAVMWebProviderSDK(): Promise<typeof AVMWebProviderSDK>;
|
|
151
|
+
protected _initializeAVMWebClient(): Promise<AVMWebProviderSDK.AVMWebClient>;
|
|
152
|
+
protected _getGenesisHash(): Promise<string>;
|
|
153
|
+
protected _mapAVMWebProviderAccountToWalletAccounts(accounts: AVMWebProviderSDK.IAccount[]): WalletAccount[];
|
|
154
|
+
protected processTxns(txnGroup: algosdk.Transaction[], indexesToSign?: number[]): AVMWebProviderSDK.IARC0001Transaction[];
|
|
155
|
+
protected processEncodedTxns(txnGroup: Uint8Array[], indexesToSign?: number[]): AVMWebProviderSDK.IARC0001Transaction[];
|
|
156
|
+
/**
|
|
157
|
+
* Abstract methods
|
|
158
|
+
* These methods must be implemented by specific wallet providers
|
|
159
|
+
*/
|
|
160
|
+
protected abstract _enable(): Promise<AVMWebProviderSDK.IEnableResult>;
|
|
161
|
+
protected abstract _disable(): Promise<AVMWebProviderSDK.IDisableResult>;
|
|
162
|
+
protected abstract _signTransactions(txns: AVMWebProviderSDK.IARC0001Transaction[]): Promise<AVMWebProviderSDK.ISignTransactionsResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Common methods
|
|
165
|
+
* These methods can be overridden by specific wallet providers if needed
|
|
166
|
+
*/
|
|
167
|
+
connect(): Promise<WalletAccount[]>;
|
|
168
|
+
disconnect(): Promise<void>;
|
|
169
|
+
resumeSession(): Promise<void>;
|
|
170
|
+
signTransactions<T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]): Promise<(Uint8Array | null)[]>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
declare class DeflyWebWallet extends AVMProvider {
|
|
174
|
+
constructor({ id, store, subscribe, getAlgodClient, metadata, networks }: WalletConstructor<WalletId.DEFLY_WEB>);
|
|
175
|
+
static defaultMetadata: {
|
|
176
|
+
name: string;
|
|
177
|
+
icon: string;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Calls the "enable" method on the provider. This method will timeout after 3 minutes.
|
|
181
|
+
* @returns {Promise<AVMWebProviderSDK.IEnableResult>} a promise that resolves to the result.
|
|
182
|
+
* @protected
|
|
183
|
+
* @throws {MethodCanceledError} if the method was cancelled by the user.
|
|
184
|
+
* @throws {MethodNotSupportedError} if the method is not supported for the configured network.
|
|
185
|
+
* @throws {MethodTimedOutError} if the method timed out by lack of response (>= 3 minutes).
|
|
186
|
+
* @throws {NetworkNotSupportedError} if the network is not supported for the configured network.
|
|
187
|
+
* @throws {UnknownError} if the response result is empty.
|
|
188
|
+
*/
|
|
189
|
+
protected _enable(): Promise<AVMWebProviderSDK.IEnableResult>;
|
|
190
|
+
/**
|
|
191
|
+
* Calls the "disable" method on the provider. This method will timeout after 0.75 seconds.
|
|
192
|
+
* @returns {Promise<AVMWebProviderSDK.IDisableResult>} a promise that resolves to the result.
|
|
193
|
+
* @protected
|
|
194
|
+
* @throws {MethodNotSupportedError} if the method is not supported for the configured network.
|
|
195
|
+
* @throws {MethodTimedOutError} if the method timed out by lack of response (>= 3 minutes).
|
|
196
|
+
* @throws {NetworkNotSupportedError} if the network is not supported for the configured network.
|
|
197
|
+
* @throws {UnknownError} if the response result is empty.
|
|
198
|
+
*/
|
|
199
|
+
protected _disable(): Promise<AVMWebProviderSDK.IDisableResult>;
|
|
200
|
+
/**
|
|
201
|
+
* Calls the "signTransactions" method to sign the supplied ARC-0001 transactions. This method will timeout after 3
|
|
202
|
+
* minutes.
|
|
203
|
+
* @returns {Promise<AVMWebProviderSDK.ISignTransactionsResult>} a promise that resolves to the result.
|
|
204
|
+
* @protected
|
|
205
|
+
* @throws {InvalidInputError} if computed group ID for the txns does not match the assigned group ID.
|
|
206
|
+
* @throws {InvalidGroupIdError} if the unsigned txns is malformed or not conforming to ARC-0001.
|
|
207
|
+
* @throws {MethodCanceledError} if the method was cancelled by the user.
|
|
208
|
+
* @throws {MethodNotSupportedError} if the method is not supported for the configured network.
|
|
209
|
+
* @throws {MethodTimedOutError} if the method timed out by lack of response (>= 3 minutes).
|
|
210
|
+
* @throws {NetworkNotSupportedError} if the network is not supported for the configured network.
|
|
211
|
+
* @throws {UnauthorizedSignerError} if a signer in the request is not authorized by the provider.
|
|
212
|
+
* @throws {UnknownError} if the response result is empty.
|
|
213
|
+
*/
|
|
214
|
+
protected _signTransactions(txns: AVMWebProviderSDK.IARC0001Transaction[]): Promise<AVMWebProviderSDK.ISignTransactionsResult>;
|
|
215
|
+
}
|
|
216
|
+
|
|
135
217
|
/** @see https://docs.exodus.com/api-reference/algorand-provider-arc-api/ */
|
|
136
218
|
interface EnableNetworkOpts {
|
|
137
219
|
genesisID?: string;
|
|
@@ -163,7 +245,7 @@ declare class ExodusWallet extends BaseWallet {
|
|
|
163
245
|
private client;
|
|
164
246
|
private options;
|
|
165
247
|
protected store: Store<State>;
|
|
166
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.EXODUS>);
|
|
248
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.EXODUS>);
|
|
167
249
|
static defaultMetadata: {
|
|
168
250
|
name: string;
|
|
169
251
|
icon: string;
|
|
@@ -177,51 +259,40 @@ declare class ExodusWallet extends BaseWallet {
|
|
|
177
259
|
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
178
260
|
}
|
|
179
261
|
|
|
180
|
-
declare function isAVMWebProviderSDKError(error: any): error is AVMWebProviderSDK.BaseARC0027Error;
|
|
181
262
|
declare const KIBISIS_AVM_WEB_PROVIDER_ID = "f6d1c86b-4493-42fb-b88d-a62407b4cdf6";
|
|
182
263
|
declare const ICON: string;
|
|
183
|
-
declare class KibisisWallet extends
|
|
184
|
-
|
|
185
|
-
protected avmWebProviderSDK: typeof AVMWebProviderSDK | null;
|
|
186
|
-
protected store: Store<State>;
|
|
187
|
-
constructor({ id, store, subscribe, getAlgodClient, metadata }: WalletConstructor<WalletId.KIBISIS>);
|
|
264
|
+
declare class KibisisWallet extends AVMProvider {
|
|
265
|
+
constructor({ id, store, subscribe, getAlgodClient, metadata, networks }: WalletConstructor<WalletId.KIBISIS>);
|
|
188
266
|
static defaultMetadata: {
|
|
189
267
|
name: string;
|
|
190
268
|
icon: string;
|
|
191
269
|
};
|
|
192
270
|
/**
|
|
193
|
-
*
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
*
|
|
197
|
-
* @returns {Promise<AVMWebProviderSDK.IDisableResult>} a promise that resolves to the result.
|
|
198
|
-
* @private
|
|
271
|
+
* Calls the "enable" method on the provider. This method will timeout after 3 minutes.
|
|
272
|
+
* @returns {Promise<AVMWebProviderSDK.IEnableResult>} a promise that resolves to the result.
|
|
273
|
+
* @protected
|
|
274
|
+
* @throws {MethodCanceledError} if the method was cancelled by the user.
|
|
199
275
|
* @throws {MethodNotSupportedError} if the method is not supported for the configured network.
|
|
200
276
|
* @throws {MethodTimedOutError} if the method timed out by lack of response (>= 3 minutes).
|
|
201
277
|
* @throws {NetworkNotSupportedError} if the network is not supported for the configured network.
|
|
202
278
|
* @throws {UnknownError} if the response result is empty.
|
|
203
279
|
*/
|
|
204
|
-
|
|
280
|
+
protected _enable(): Promise<AVMWebProviderSDK.IEnableResult>;
|
|
205
281
|
/**
|
|
206
|
-
* Calls the "
|
|
207
|
-
* @returns {Promise<AVMWebProviderSDK.
|
|
208
|
-
* @
|
|
209
|
-
* @throws {MethodCanceledError} if the method was cancelled by the user.
|
|
282
|
+
* Calls the "disable" method on the provider. This method will timeout after 0.75 seconds.
|
|
283
|
+
* @returns {Promise<AVMWebProviderSDK.IDisableResult>} a promise that resolves to the result.
|
|
284
|
+
* @protected
|
|
210
285
|
* @throws {MethodNotSupportedError} if the method is not supported for the configured network.
|
|
211
286
|
* @throws {MethodTimedOutError} if the method timed out by lack of response (>= 3 minutes).
|
|
212
287
|
* @throws {NetworkNotSupportedError} if the network is not supported for the configured network.
|
|
213
288
|
* @throws {UnknownError} if the response result is empty.
|
|
214
289
|
*/
|
|
215
|
-
|
|
216
|
-
private _getGenesisHash;
|
|
217
|
-
private _initializeAVMWebClient;
|
|
218
|
-
private _initializeAVMWebProviderSDK;
|
|
219
|
-
private _mapAVMWebProviderAccountToWalletAccounts;
|
|
290
|
+
protected _disable(): Promise<AVMWebProviderSDK.IDisableResult>;
|
|
220
291
|
/**
|
|
221
292
|
* Calls the "signTransactions" method to sign the supplied ARC-0001 transactions. This method will timeout after 3
|
|
222
293
|
* minutes.
|
|
223
294
|
* @returns {Promise<AVMWebProviderSDK.ISignTransactionsResult>} a promise that resolves to the result.
|
|
224
|
-
* @
|
|
295
|
+
* @protected
|
|
225
296
|
* @throws {InvalidInputError} if computed group ID for the txns does not match the assigned group ID.
|
|
226
297
|
* @throws {InvalidGroupIdError} if the unsigned txns is malformed or not conforming to ARC-0001.
|
|
227
298
|
* @throws {MethodCanceledError} if the method was cancelled by the user.
|
|
@@ -231,16 +302,7 @@ declare class KibisisWallet extends BaseWallet {
|
|
|
231
302
|
* @throws {UnauthorizedSignerError} if a signer in the request is not authorized by the provider.
|
|
232
303
|
* @throws {UnknownError} if the response result is empty.
|
|
233
304
|
*/
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* public functions
|
|
237
|
-
*/
|
|
238
|
-
connect(): Promise<WalletAccount[]>;
|
|
239
|
-
disconnect(): Promise<void>;
|
|
240
|
-
resumeSession(): Promise<void>;
|
|
241
|
-
private processTxns;
|
|
242
|
-
private processEncodedTxns;
|
|
243
|
-
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
305
|
+
protected _signTransactions(txns: AVMWebProviderSDK.IARC0001Transaction[]): Promise<AVMWebProviderSDK.ISignTransactionsResult>;
|
|
244
306
|
}
|
|
245
307
|
|
|
246
308
|
interface KmdConstructor {
|
|
@@ -259,7 +321,7 @@ declare class KmdWallet extends BaseWallet {
|
|
|
259
321
|
private walletId;
|
|
260
322
|
private password;
|
|
261
323
|
protected store: Store<State>;
|
|
262
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.KMD>);
|
|
324
|
+
constructor({ id, store, subscribe, getAlgodClient, networks, options, metadata }: WalletConstructor<WalletId.KMD>);
|
|
263
325
|
static defaultMetadata: {
|
|
264
326
|
name: string;
|
|
265
327
|
icon: string;
|
|
@@ -282,7 +344,7 @@ declare class LiquidWallet extends BaseWallet {
|
|
|
282
344
|
protected store: Store<State>;
|
|
283
345
|
authClient: LiquidAuthClient | undefined | null;
|
|
284
346
|
private options;
|
|
285
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.LIQUID>);
|
|
347
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.LIQUID>);
|
|
286
348
|
static defaultMetadata: {
|
|
287
349
|
name: string;
|
|
288
350
|
icon: string;
|
|
@@ -301,7 +363,7 @@ declare class LuteWallet extends BaseWallet {
|
|
|
301
363
|
private client;
|
|
302
364
|
private options;
|
|
303
365
|
protected store: Store<State>;
|
|
304
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.LUTE>);
|
|
366
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.LUTE>);
|
|
305
367
|
static defaultMetadata: {
|
|
306
368
|
name: string;
|
|
307
369
|
icon: string;
|
|
@@ -328,7 +390,7 @@ declare class MagicAuth extends BaseWallet {
|
|
|
328
390
|
private options;
|
|
329
391
|
protected store: Store<State>;
|
|
330
392
|
userInfo: MagicUserMetadata | null;
|
|
331
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.MAGIC>);
|
|
393
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.MAGIC>);
|
|
332
394
|
static defaultMetadata: {
|
|
333
395
|
name: string;
|
|
334
396
|
icon: string;
|
|
@@ -350,7 +412,7 @@ declare class MnemonicWallet extends BaseWallet {
|
|
|
350
412
|
private account;
|
|
351
413
|
private options;
|
|
352
414
|
protected store: Store<State>;
|
|
353
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.MNEMONIC>);
|
|
415
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.MNEMONIC>);
|
|
354
416
|
static defaultMetadata: {
|
|
355
417
|
name: string;
|
|
356
418
|
icon: string;
|
|
@@ -378,7 +440,7 @@ declare class PeraWallet$1 extends BaseWallet {
|
|
|
378
440
|
private client;
|
|
379
441
|
private options;
|
|
380
442
|
protected store: Store<State>;
|
|
381
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.PERA>);
|
|
443
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.PERA>);
|
|
382
444
|
static defaultMetadata: {
|
|
383
445
|
name: string;
|
|
384
446
|
icon: string;
|
|
@@ -404,7 +466,7 @@ declare class PeraWallet extends BaseWallet {
|
|
|
404
466
|
private client;
|
|
405
467
|
private options;
|
|
406
468
|
protected store: Store<State>;
|
|
407
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.PERA2>);
|
|
469
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.PERA2>);
|
|
408
470
|
static defaultMetadata: {
|
|
409
471
|
name: string;
|
|
410
472
|
icon: string;
|
|
@@ -436,7 +498,7 @@ declare class WalletConnect extends BaseWallet {
|
|
|
436
498
|
private modalOptions;
|
|
437
499
|
private session;
|
|
438
500
|
protected store: Store<State>;
|
|
439
|
-
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.WALLETCONNECT>);
|
|
501
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata, networks }: WalletConstructor<WalletId.WALLETCONNECT>);
|
|
440
502
|
static defaultMetadata: {
|
|
441
503
|
name: string;
|
|
442
504
|
icon: string;
|
|
@@ -469,6 +531,7 @@ declare class BiatecWallet extends WalletConnect {
|
|
|
469
531
|
declare enum WalletId {
|
|
470
532
|
BIATEC = "biatec",
|
|
471
533
|
DEFLY = "defly",
|
|
534
|
+
DEFLY_WEB = "defly-web",
|
|
472
535
|
CUSTOM = "custom",
|
|
473
536
|
EXODUS = "exodus",
|
|
474
537
|
KIBISIS = "kibisis",
|
|
@@ -485,6 +548,7 @@ type WalletMap = {
|
|
|
485
548
|
[WalletId.BIATEC]: typeof BiatecWallet;
|
|
486
549
|
[WalletId.CUSTOM]: typeof CustomWallet;
|
|
487
550
|
[WalletId.DEFLY]: typeof DeflyWallet;
|
|
551
|
+
[WalletId.DEFLY_WEB]: typeof DeflyWebWallet;
|
|
488
552
|
[WalletId.EXODUS]: typeof ExodusWallet;
|
|
489
553
|
[WalletId.KIBISIS]: typeof KibisisWallet;
|
|
490
554
|
[WalletId.KMD]: typeof KmdWallet;
|
|
@@ -500,6 +564,7 @@ type WalletOptionsMap = {
|
|
|
500
564
|
[WalletId.BIATEC]: WalletConnectOptions;
|
|
501
565
|
[WalletId.CUSTOM]: CustomWalletOptions;
|
|
502
566
|
[WalletId.DEFLY]: DeflyWalletConnectOptions;
|
|
567
|
+
[WalletId.DEFLY_WEB]: Record<string, never>;
|
|
503
568
|
[WalletId.EXODUS]: ExodusOptions;
|
|
504
569
|
[WalletId.KIBISIS]: Record<string, never>;
|
|
505
570
|
[WalletId.KMD]: KmdOptions;
|
|
@@ -537,6 +602,7 @@ interface BaseWalletConstructor {
|
|
|
537
602
|
getAlgodClient: () => algosdk.Algodv2;
|
|
538
603
|
store: Store<State>;
|
|
539
604
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
605
|
+
networks: Record<string, NetworkConfig>;
|
|
540
606
|
}
|
|
541
607
|
type WalletConstructor<T extends keyof WalletOptionsMap> = BaseWalletConstructor & {
|
|
542
608
|
options?: WalletOptions<T>;
|
|
@@ -636,10 +702,10 @@ type WalletStateMap = Partial<Record<WalletId, WalletState>>;
|
|
|
636
702
|
interface State {
|
|
637
703
|
wallets: WalletStateMap;
|
|
638
704
|
activeWallet: WalletId | null;
|
|
639
|
-
activeNetwork:
|
|
705
|
+
activeNetwork: string;
|
|
640
706
|
algodClient: algosdk.Algodv2;
|
|
641
707
|
}
|
|
642
|
-
declare const
|
|
708
|
+
declare const DEFAULT_STATE: State;
|
|
643
709
|
|
|
644
710
|
interface WalletManagerOptions {
|
|
645
711
|
resetNetwork?: boolean;
|
|
@@ -648,20 +714,20 @@ interface WalletManagerOptions {
|
|
|
648
714
|
}
|
|
649
715
|
interface WalletManagerConfig {
|
|
650
716
|
wallets?: SupportedWallet[];
|
|
651
|
-
|
|
652
|
-
|
|
717
|
+
networks?: Record<string, NetworkConfig>;
|
|
718
|
+
defaultNetwork?: string;
|
|
653
719
|
options?: WalletManagerOptions;
|
|
654
720
|
}
|
|
655
721
|
declare class WalletManager {
|
|
656
722
|
_clients: Map<WalletId, BaseWallet>;
|
|
657
|
-
networkConfig:
|
|
723
|
+
networkConfig: Record<string, NetworkConfig>;
|
|
658
724
|
store: Store<State>;
|
|
659
725
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
660
726
|
options: {
|
|
661
727
|
resetNetwork: boolean;
|
|
662
728
|
};
|
|
663
729
|
private logger;
|
|
664
|
-
constructor({ wallets,
|
|
730
|
+
constructor({ wallets, networks, defaultNetwork, options }?: WalletManagerConfig);
|
|
665
731
|
private initializeLogger;
|
|
666
732
|
private determineLogLevel;
|
|
667
733
|
get algodClient(): algosdk.Algodv2;
|
|
@@ -676,8 +742,9 @@ declare class WalletManager {
|
|
|
676
742
|
private initNetworkConfig;
|
|
677
743
|
private createAlgodClient;
|
|
678
744
|
getAlgodClient: () => algosdk.Algodv2;
|
|
679
|
-
setActiveNetwork: (networkId:
|
|
680
|
-
get activeNetwork():
|
|
745
|
+
setActiveNetwork: (networkId: string) => Promise<void>;
|
|
746
|
+
get activeNetwork(): string;
|
|
747
|
+
get networks(): Record<string, NetworkConfig>;
|
|
681
748
|
get activeWallet(): BaseWallet | null;
|
|
682
749
|
get activeWalletAccounts(): WalletAccount[] | null;
|
|
683
750
|
get activeWalletAddresses(): string[] | null;
|
|
@@ -713,4 +780,4 @@ declare const webpackFallback: {
|
|
|
713
780
|
'magic-sdk': boolean;
|
|
714
781
|
};
|
|
715
782
|
|
|
716
|
-
export { BaseWallet, type BaseWalletConstructor, type CustomProvider, CustomWallet, type CustomWalletOptions, DeflyWallet, type DeflyWalletConnectOptions, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LiquidWallet, LogLevel, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, NetworkId, PeraWallet$1 as PeraWallet, type PeraWalletConnectOptions$1 as PeraWalletConnectOptions, SessionError, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended,
|
|
783
|
+
export { BaseWallet, type BaseWalletConstructor, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORKS, DEFAULT_STATE, DeflyWallet, type DeflyWalletConnectOptions, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LiquidWallet, LogLevel, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, NetworkId, PeraWallet$1 as PeraWallet, type PeraWalletConnectOptions$1 as PeraWalletConnectOptions, SessionError, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended, webpackFallback };
|