@txnlab/use-wallet 4.4.0-beta.1 → 4.5.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/LICENSE +21 -0
- package/dist/index.cjs +637 -491
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -8
- package/dist/index.d.ts +113 -8
- package/dist/index.js +636 -494
- package/dist/index.js.map +1 -1
- package/package.json +16 -16
- package/LICENSE.md +0 -20
package/dist/index.d.cts
CHANGED
|
@@ -73,12 +73,14 @@ declare enum NetworkId {
|
|
|
73
73
|
|
|
74
74
|
declare abstract class BaseWallet {
|
|
75
75
|
readonly id: WalletId;
|
|
76
|
+
/** Unique key for this wallet instance. Used for state storage and session isolation. */
|
|
77
|
+
readonly walletKey: WalletKey;
|
|
76
78
|
readonly metadata: WalletMetadata;
|
|
77
79
|
protected store: Store<State>;
|
|
78
80
|
protected getAlgodClient: () => algosdk.Algodv2;
|
|
79
81
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
80
82
|
protected logger: ReturnType<typeof logger.createScopedLogger>;
|
|
81
|
-
protected constructor({ id, metadata, store, subscribe, getAlgodClient }: WalletConstructor<WalletId>);
|
|
83
|
+
protected constructor({ id, walletKey, metadata, store, subscribe, getAlgodClient }: WalletConstructor<WalletId>);
|
|
82
84
|
static defaultMetadata: WalletMetadata;
|
|
83
85
|
abstract connect(args?: Record<string, any>): Promise<WalletAccount[]>;
|
|
84
86
|
abstract disconnect(): Promise<void>;
|
|
@@ -99,7 +101,7 @@ declare abstract class BaseWallet {
|
|
|
99
101
|
get isActive(): boolean;
|
|
100
102
|
get activeNetworkConfig(): NetworkConfig;
|
|
101
103
|
protected onDisconnect: () => void;
|
|
102
|
-
protected manageWalletConnectSession: (action: "backup" | "restore",
|
|
104
|
+
protected manageWalletConnectSession: (action: "backup" | "restore", targetWalletKey?: WalletKey) => void;
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
type CustomProvider = {
|
|
@@ -464,7 +466,19 @@ interface SignClientOptions {
|
|
|
464
466
|
metadata?: SignClientTypes.Metadata;
|
|
465
467
|
}
|
|
466
468
|
type WalletConnectModalOptions = Pick<WalletConnectModalConfig, 'enableExplorer' | 'explorerRecommendedWalletIds' | 'privacyPolicyUrl' | 'termsOfServiceUrl' | 'themeMode' | 'themeVariables'>;
|
|
467
|
-
type
|
|
469
|
+
type WalletConnectBaseOptions = SignClientOptions & WalletConnectModalOptions;
|
|
470
|
+
interface WalletConnectOptions extends WalletConnectBaseOptions {
|
|
471
|
+
/**
|
|
472
|
+
* Optional skin to apply to this WalletConnect instance.
|
|
473
|
+
* Can be either:
|
|
474
|
+
* - A string ID referencing a built-in skin (e.g., 'biatec')
|
|
475
|
+
* - A full skin object with id, name, and icon
|
|
476
|
+
*
|
|
477
|
+
* When a skin is applied, the wallet will use the skin's metadata
|
|
478
|
+
* and a unique walletKey for state isolation.
|
|
479
|
+
*/
|
|
480
|
+
skin?: WalletConnectSkinOption;
|
|
481
|
+
}
|
|
468
482
|
type SignTxnsResponse = Array<Uint8Array | number[] | string | null | undefined>;
|
|
469
483
|
declare class SessionError extends Error {
|
|
470
484
|
constructor(message: string);
|
|
@@ -624,6 +638,9 @@ declare class Web3AuthWallet extends BaseWallet {
|
|
|
624
638
|
private usingSFA;
|
|
625
639
|
protected store: Store<State>;
|
|
626
640
|
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.WEB3AUTH>);
|
|
641
|
+
private loadMetadata;
|
|
642
|
+
private saveMetadata;
|
|
643
|
+
private clearMetadata;
|
|
627
644
|
static defaultMetadata: {
|
|
628
645
|
name: string;
|
|
629
646
|
icon: string;
|
|
@@ -738,7 +755,17 @@ declare class Web3AuthWallet extends BaseWallet {
|
|
|
738
755
|
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
739
756
|
}
|
|
740
757
|
|
|
758
|
+
/**
|
|
759
|
+
* @deprecated BiatecWallet is deprecated and will be removed in v5.
|
|
760
|
+
* Use WalletConnect with the 'biatec' skin instead:
|
|
761
|
+
*
|
|
762
|
+
* ```typescript
|
|
763
|
+
* { id: WalletId.WALLETCONNECT, options: { projectId: '...', skin: 'biatec' } }
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
741
766
|
declare class BiatecWallet extends WalletConnect {
|
|
767
|
+
private static deprecationWarningShown;
|
|
768
|
+
constructor(args: WalletConstructor<WalletId.BIATEC>);
|
|
742
769
|
static defaultMetadata: {
|
|
743
770
|
name: string;
|
|
744
771
|
icon: string;
|
|
@@ -783,6 +810,30 @@ declare enum WalletId {
|
|
|
783
810
|
WEB3AUTH = "web3auth",
|
|
784
811
|
W3_WALLET = "w3-wallet"
|
|
785
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* Metadata for a WalletConnect skin. Used to customize the appearance of
|
|
815
|
+
* a WalletConnect-based wallet in the UI.
|
|
816
|
+
*/
|
|
817
|
+
interface WalletConnectSkin {
|
|
818
|
+
/** Unique identifier for the skin (e.g., 'biatec', 'voiwallet') */
|
|
819
|
+
id: string;
|
|
820
|
+
/** Display name for the wallet */
|
|
821
|
+
name: string;
|
|
822
|
+
/** Wallet icon as a data URI or URL */
|
|
823
|
+
icon: string;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Skin option can be either:
|
|
827
|
+
* - A string ID referencing a built-in skin (e.g., 'biatec')
|
|
828
|
+
* - A full WalletConnectSkin object for custom skins
|
|
829
|
+
*/
|
|
830
|
+
type WalletConnectSkinOption = string | WalletConnectSkin;
|
|
831
|
+
/**
|
|
832
|
+
* Composite key type that can be either:
|
|
833
|
+
* - A standard WalletId (for backward compatibility)
|
|
834
|
+
* - A composite string for skinned WalletConnect instances (e.g., 'walletconnect:biatec')
|
|
835
|
+
*/
|
|
836
|
+
type WalletKey = WalletId | `${WalletId.WALLETCONNECT}:${string}`;
|
|
786
837
|
type WalletMap = {
|
|
787
838
|
[WalletId.BIATEC]: typeof BiatecWallet;
|
|
788
839
|
[WalletId.CUSTOM]: typeof CustomWallet;
|
|
@@ -837,6 +888,8 @@ type WalletMetadata = {
|
|
|
837
888
|
};
|
|
838
889
|
interface BaseWalletConstructor {
|
|
839
890
|
id: WalletId;
|
|
891
|
+
/** Optional wallet key override. Defaults to id. Used for skinned WalletConnect instances. */
|
|
892
|
+
walletKey?: WalletKey;
|
|
840
893
|
metadata: Partial<WalletMetadata> | undefined;
|
|
841
894
|
getAlgodClient: () => algosdk.Algodv2;
|
|
842
895
|
store: Store<State>;
|
|
@@ -976,11 +1029,11 @@ type WalletState = {
|
|
|
976
1029
|
accounts: WalletAccount[];
|
|
977
1030
|
activeAccount: WalletAccount | null;
|
|
978
1031
|
};
|
|
979
|
-
type WalletStateMap = Partial<Record<
|
|
1032
|
+
type WalletStateMap = Partial<Record<WalletKey, WalletState>>;
|
|
980
1033
|
type ManagerStatus = 'initializing' | 'ready';
|
|
981
1034
|
interface State {
|
|
982
1035
|
wallets: WalletStateMap;
|
|
983
|
-
activeWallet:
|
|
1036
|
+
activeWallet: WalletKey | null;
|
|
984
1037
|
activeNetwork: string;
|
|
985
1038
|
algodClient: algosdk.Algodv2;
|
|
986
1039
|
managerStatus: ManagerStatus;
|
|
@@ -1001,7 +1054,7 @@ interface WalletManagerConfig {
|
|
|
1001
1054
|
options?: WalletManagerOptions;
|
|
1002
1055
|
}
|
|
1003
1056
|
declare class WalletManager {
|
|
1004
|
-
_clients: Map<
|
|
1057
|
+
_clients: Map<WalletKey, BaseWallet>;
|
|
1005
1058
|
private baseNetworkConfig;
|
|
1006
1059
|
store: Store<State>;
|
|
1007
1060
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
@@ -1018,9 +1071,15 @@ declare class WalletManager {
|
|
|
1018
1071
|
private savePersistedState;
|
|
1019
1072
|
get status(): ManagerStatus;
|
|
1020
1073
|
get isReady(): boolean;
|
|
1074
|
+
/**
|
|
1075
|
+
* Derive the wallet key from wallet config.
|
|
1076
|
+
* For WalletConnect with a skin option, returns 'walletconnect:skinId'.
|
|
1077
|
+
* For other wallets, returns the wallet ID.
|
|
1078
|
+
*/
|
|
1079
|
+
private deriveWalletKey;
|
|
1021
1080
|
private initializeWallets;
|
|
1022
1081
|
get wallets(): BaseWallet[];
|
|
1023
|
-
getWallet(
|
|
1082
|
+
getWallet(walletKey: WalletKey): BaseWallet | undefined;
|
|
1024
1083
|
resumeSessions(): Promise<void>;
|
|
1025
1084
|
disconnect(): Promise<void>;
|
|
1026
1085
|
private initNetworkConfig;
|
|
@@ -1126,8 +1185,54 @@ declare const webpackFallback: {
|
|
|
1126
1185
|
'@perawallet/connect': boolean;
|
|
1127
1186
|
'@walletconnect/modal': boolean;
|
|
1128
1187
|
'@walletconnect/sign-client': boolean;
|
|
1188
|
+
'@web3auth/base': boolean;
|
|
1189
|
+
'@web3auth/base-provider': boolean;
|
|
1190
|
+
'@web3auth/modal': boolean;
|
|
1191
|
+
'@web3auth/single-factor-auth': boolean;
|
|
1129
1192
|
'lute-connect': boolean;
|
|
1130
1193
|
'magic-sdk': boolean;
|
|
1131
1194
|
};
|
|
1132
1195
|
|
|
1133
|
-
|
|
1196
|
+
/**
|
|
1197
|
+
* Built-in skins that ship with the library.
|
|
1198
|
+
* PRs to add new WalletConnect-compatible wallets should add entries here.
|
|
1199
|
+
*/
|
|
1200
|
+
declare const BUILTIN_SKINS: Record<string, WalletConnectSkin>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Register a custom WalletConnect skin at runtime.
|
|
1203
|
+
* This allows developers to add their own wallet skins without PRing the library.
|
|
1204
|
+
*
|
|
1205
|
+
* @param skin - The skin definition to register
|
|
1206
|
+
* @throws Error if attempting to override a built-in skin
|
|
1207
|
+
*
|
|
1208
|
+
* @example
|
|
1209
|
+
* ```typescript
|
|
1210
|
+
* import { registerSkin } from '@txnlab/use-wallet'
|
|
1211
|
+
*
|
|
1212
|
+
* registerSkin({
|
|
1213
|
+
* id: 'mywallet',
|
|
1214
|
+
* name: 'My Custom Wallet',
|
|
1215
|
+
* icon: 'data:image/svg+xml;base64,...'
|
|
1216
|
+
* })
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|
|
1219
|
+
declare function registerSkin(skin: WalletConnectSkin): void;
|
|
1220
|
+
/**
|
|
1221
|
+
* Get a skin by its ID from either built-in or custom registries.
|
|
1222
|
+
*
|
|
1223
|
+
* @param skinId - The skin identifier
|
|
1224
|
+
* @returns The skin definition, or undefined if not found
|
|
1225
|
+
*/
|
|
1226
|
+
declare function getSkin(skinId: string): WalletConnectSkin | undefined;
|
|
1227
|
+
/**
|
|
1228
|
+
* Resolve a skin option to a full WalletConnectSkin object.
|
|
1229
|
+
*
|
|
1230
|
+
* If the option is a string, looks up the skin in the registries.
|
|
1231
|
+
* If the option is a full skin object, registers it as a custom skin and returns it.
|
|
1232
|
+
*
|
|
1233
|
+
* @param skinOption - Either a skin ID string or a full skin definition
|
|
1234
|
+
* @returns The resolved skin, or undefined if not found (when string ID provided)
|
|
1235
|
+
*/
|
|
1236
|
+
declare function resolveSkin(skinOption: WalletConnectSkinOption): WalletConnectSkin | undefined;
|
|
1237
|
+
|
|
1238
|
+
export { type AlgodConfig, BUILTIN_SKINS, BaseWallet, type BaseWalletConstructor, BiatecWallet, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORK_CONFIG, DEFAULT_STATE, DEFLY_WEB_PROVIDER_ID, DeflyWallet, type DeflyWalletConnectOptions, DeflyWebWallet, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LogLevel, type LuteConnectOptions, LuteWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type ManagerStatus, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, type NetworkConfig, NetworkConfigBuilder, NetworkId, PeraWallet, type PeraWalletConnectOptions, ScopeType, SecureKeyContainer, SessionError, type SignData, SignDataError, type SignDataResponse, type SignMetadata, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type Siwa, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, W3Wallet, type W3WalletProvider, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConnectSkin, type WalletConnectSkinOption, type WalletConstructor, WalletId, type WalletIdConfig, type WalletKey, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type Web3AuthCredentials, type Web3AuthCustomAuth, type Web3AuthOptions, Web3AuthWallet, type WindowExtended, getSkin, registerSkin, resolveSkin, webpackFallback, withSecureKey, withSecureKeySync, zeroMemory, zeroString };
|
package/dist/index.d.ts
CHANGED
|
@@ -73,12 +73,14 @@ declare enum NetworkId {
|
|
|
73
73
|
|
|
74
74
|
declare abstract class BaseWallet {
|
|
75
75
|
readonly id: WalletId;
|
|
76
|
+
/** Unique key for this wallet instance. Used for state storage and session isolation. */
|
|
77
|
+
readonly walletKey: WalletKey;
|
|
76
78
|
readonly metadata: WalletMetadata;
|
|
77
79
|
protected store: Store<State>;
|
|
78
80
|
protected getAlgodClient: () => algosdk.Algodv2;
|
|
79
81
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
80
82
|
protected logger: ReturnType<typeof logger.createScopedLogger>;
|
|
81
|
-
protected constructor({ id, metadata, store, subscribe, getAlgodClient }: WalletConstructor<WalletId>);
|
|
83
|
+
protected constructor({ id, walletKey, metadata, store, subscribe, getAlgodClient }: WalletConstructor<WalletId>);
|
|
82
84
|
static defaultMetadata: WalletMetadata;
|
|
83
85
|
abstract connect(args?: Record<string, any>): Promise<WalletAccount[]>;
|
|
84
86
|
abstract disconnect(): Promise<void>;
|
|
@@ -99,7 +101,7 @@ declare abstract class BaseWallet {
|
|
|
99
101
|
get isActive(): boolean;
|
|
100
102
|
get activeNetworkConfig(): NetworkConfig;
|
|
101
103
|
protected onDisconnect: () => void;
|
|
102
|
-
protected manageWalletConnectSession: (action: "backup" | "restore",
|
|
104
|
+
protected manageWalletConnectSession: (action: "backup" | "restore", targetWalletKey?: WalletKey) => void;
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
type CustomProvider = {
|
|
@@ -464,7 +466,19 @@ interface SignClientOptions {
|
|
|
464
466
|
metadata?: SignClientTypes.Metadata;
|
|
465
467
|
}
|
|
466
468
|
type WalletConnectModalOptions = Pick<WalletConnectModalConfig, 'enableExplorer' | 'explorerRecommendedWalletIds' | 'privacyPolicyUrl' | 'termsOfServiceUrl' | 'themeMode' | 'themeVariables'>;
|
|
467
|
-
type
|
|
469
|
+
type WalletConnectBaseOptions = SignClientOptions & WalletConnectModalOptions;
|
|
470
|
+
interface WalletConnectOptions extends WalletConnectBaseOptions {
|
|
471
|
+
/**
|
|
472
|
+
* Optional skin to apply to this WalletConnect instance.
|
|
473
|
+
* Can be either:
|
|
474
|
+
* - A string ID referencing a built-in skin (e.g., 'biatec')
|
|
475
|
+
* - A full skin object with id, name, and icon
|
|
476
|
+
*
|
|
477
|
+
* When a skin is applied, the wallet will use the skin's metadata
|
|
478
|
+
* and a unique walletKey for state isolation.
|
|
479
|
+
*/
|
|
480
|
+
skin?: WalletConnectSkinOption;
|
|
481
|
+
}
|
|
468
482
|
type SignTxnsResponse = Array<Uint8Array | number[] | string | null | undefined>;
|
|
469
483
|
declare class SessionError extends Error {
|
|
470
484
|
constructor(message: string);
|
|
@@ -624,6 +638,9 @@ declare class Web3AuthWallet extends BaseWallet {
|
|
|
624
638
|
private usingSFA;
|
|
625
639
|
protected store: Store<State>;
|
|
626
640
|
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.WEB3AUTH>);
|
|
641
|
+
private loadMetadata;
|
|
642
|
+
private saveMetadata;
|
|
643
|
+
private clearMetadata;
|
|
627
644
|
static defaultMetadata: {
|
|
628
645
|
name: string;
|
|
629
646
|
icon: string;
|
|
@@ -738,7 +755,17 @@ declare class Web3AuthWallet extends BaseWallet {
|
|
|
738
755
|
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
739
756
|
}
|
|
740
757
|
|
|
758
|
+
/**
|
|
759
|
+
* @deprecated BiatecWallet is deprecated and will be removed in v5.
|
|
760
|
+
* Use WalletConnect with the 'biatec' skin instead:
|
|
761
|
+
*
|
|
762
|
+
* ```typescript
|
|
763
|
+
* { id: WalletId.WALLETCONNECT, options: { projectId: '...', skin: 'biatec' } }
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
741
766
|
declare class BiatecWallet extends WalletConnect {
|
|
767
|
+
private static deprecationWarningShown;
|
|
768
|
+
constructor(args: WalletConstructor<WalletId.BIATEC>);
|
|
742
769
|
static defaultMetadata: {
|
|
743
770
|
name: string;
|
|
744
771
|
icon: string;
|
|
@@ -783,6 +810,30 @@ declare enum WalletId {
|
|
|
783
810
|
WEB3AUTH = "web3auth",
|
|
784
811
|
W3_WALLET = "w3-wallet"
|
|
785
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* Metadata for a WalletConnect skin. Used to customize the appearance of
|
|
815
|
+
* a WalletConnect-based wallet in the UI.
|
|
816
|
+
*/
|
|
817
|
+
interface WalletConnectSkin {
|
|
818
|
+
/** Unique identifier for the skin (e.g., 'biatec', 'voiwallet') */
|
|
819
|
+
id: string;
|
|
820
|
+
/** Display name for the wallet */
|
|
821
|
+
name: string;
|
|
822
|
+
/** Wallet icon as a data URI or URL */
|
|
823
|
+
icon: string;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Skin option can be either:
|
|
827
|
+
* - A string ID referencing a built-in skin (e.g., 'biatec')
|
|
828
|
+
* - A full WalletConnectSkin object for custom skins
|
|
829
|
+
*/
|
|
830
|
+
type WalletConnectSkinOption = string | WalletConnectSkin;
|
|
831
|
+
/**
|
|
832
|
+
* Composite key type that can be either:
|
|
833
|
+
* - A standard WalletId (for backward compatibility)
|
|
834
|
+
* - A composite string for skinned WalletConnect instances (e.g., 'walletconnect:biatec')
|
|
835
|
+
*/
|
|
836
|
+
type WalletKey = WalletId | `${WalletId.WALLETCONNECT}:${string}`;
|
|
786
837
|
type WalletMap = {
|
|
787
838
|
[WalletId.BIATEC]: typeof BiatecWallet;
|
|
788
839
|
[WalletId.CUSTOM]: typeof CustomWallet;
|
|
@@ -837,6 +888,8 @@ type WalletMetadata = {
|
|
|
837
888
|
};
|
|
838
889
|
interface BaseWalletConstructor {
|
|
839
890
|
id: WalletId;
|
|
891
|
+
/** Optional wallet key override. Defaults to id. Used for skinned WalletConnect instances. */
|
|
892
|
+
walletKey?: WalletKey;
|
|
840
893
|
metadata: Partial<WalletMetadata> | undefined;
|
|
841
894
|
getAlgodClient: () => algosdk.Algodv2;
|
|
842
895
|
store: Store<State>;
|
|
@@ -976,11 +1029,11 @@ type WalletState = {
|
|
|
976
1029
|
accounts: WalletAccount[];
|
|
977
1030
|
activeAccount: WalletAccount | null;
|
|
978
1031
|
};
|
|
979
|
-
type WalletStateMap = Partial<Record<
|
|
1032
|
+
type WalletStateMap = Partial<Record<WalletKey, WalletState>>;
|
|
980
1033
|
type ManagerStatus = 'initializing' | 'ready';
|
|
981
1034
|
interface State {
|
|
982
1035
|
wallets: WalletStateMap;
|
|
983
|
-
activeWallet:
|
|
1036
|
+
activeWallet: WalletKey | null;
|
|
984
1037
|
activeNetwork: string;
|
|
985
1038
|
algodClient: algosdk.Algodv2;
|
|
986
1039
|
managerStatus: ManagerStatus;
|
|
@@ -1001,7 +1054,7 @@ interface WalletManagerConfig {
|
|
|
1001
1054
|
options?: WalletManagerOptions;
|
|
1002
1055
|
}
|
|
1003
1056
|
declare class WalletManager {
|
|
1004
|
-
_clients: Map<
|
|
1057
|
+
_clients: Map<WalletKey, BaseWallet>;
|
|
1005
1058
|
private baseNetworkConfig;
|
|
1006
1059
|
store: Store<State>;
|
|
1007
1060
|
subscribe: (callback: (state: State) => void) => () => void;
|
|
@@ -1018,9 +1071,15 @@ declare class WalletManager {
|
|
|
1018
1071
|
private savePersistedState;
|
|
1019
1072
|
get status(): ManagerStatus;
|
|
1020
1073
|
get isReady(): boolean;
|
|
1074
|
+
/**
|
|
1075
|
+
* Derive the wallet key from wallet config.
|
|
1076
|
+
* For WalletConnect with a skin option, returns 'walletconnect:skinId'.
|
|
1077
|
+
* For other wallets, returns the wallet ID.
|
|
1078
|
+
*/
|
|
1079
|
+
private deriveWalletKey;
|
|
1021
1080
|
private initializeWallets;
|
|
1022
1081
|
get wallets(): BaseWallet[];
|
|
1023
|
-
getWallet(
|
|
1082
|
+
getWallet(walletKey: WalletKey): BaseWallet | undefined;
|
|
1024
1083
|
resumeSessions(): Promise<void>;
|
|
1025
1084
|
disconnect(): Promise<void>;
|
|
1026
1085
|
private initNetworkConfig;
|
|
@@ -1126,8 +1185,54 @@ declare const webpackFallback: {
|
|
|
1126
1185
|
'@perawallet/connect': boolean;
|
|
1127
1186
|
'@walletconnect/modal': boolean;
|
|
1128
1187
|
'@walletconnect/sign-client': boolean;
|
|
1188
|
+
'@web3auth/base': boolean;
|
|
1189
|
+
'@web3auth/base-provider': boolean;
|
|
1190
|
+
'@web3auth/modal': boolean;
|
|
1191
|
+
'@web3auth/single-factor-auth': boolean;
|
|
1129
1192
|
'lute-connect': boolean;
|
|
1130
1193
|
'magic-sdk': boolean;
|
|
1131
1194
|
};
|
|
1132
1195
|
|
|
1133
|
-
|
|
1196
|
+
/**
|
|
1197
|
+
* Built-in skins that ship with the library.
|
|
1198
|
+
* PRs to add new WalletConnect-compatible wallets should add entries here.
|
|
1199
|
+
*/
|
|
1200
|
+
declare const BUILTIN_SKINS: Record<string, WalletConnectSkin>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Register a custom WalletConnect skin at runtime.
|
|
1203
|
+
* This allows developers to add their own wallet skins without PRing the library.
|
|
1204
|
+
*
|
|
1205
|
+
* @param skin - The skin definition to register
|
|
1206
|
+
* @throws Error if attempting to override a built-in skin
|
|
1207
|
+
*
|
|
1208
|
+
* @example
|
|
1209
|
+
* ```typescript
|
|
1210
|
+
* import { registerSkin } from '@txnlab/use-wallet'
|
|
1211
|
+
*
|
|
1212
|
+
* registerSkin({
|
|
1213
|
+
* id: 'mywallet',
|
|
1214
|
+
* name: 'My Custom Wallet',
|
|
1215
|
+
* icon: 'data:image/svg+xml;base64,...'
|
|
1216
|
+
* })
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|
|
1219
|
+
declare function registerSkin(skin: WalletConnectSkin): void;
|
|
1220
|
+
/**
|
|
1221
|
+
* Get a skin by its ID from either built-in or custom registries.
|
|
1222
|
+
*
|
|
1223
|
+
* @param skinId - The skin identifier
|
|
1224
|
+
* @returns The skin definition, or undefined if not found
|
|
1225
|
+
*/
|
|
1226
|
+
declare function getSkin(skinId: string): WalletConnectSkin | undefined;
|
|
1227
|
+
/**
|
|
1228
|
+
* Resolve a skin option to a full WalletConnectSkin object.
|
|
1229
|
+
*
|
|
1230
|
+
* If the option is a string, looks up the skin in the registries.
|
|
1231
|
+
* If the option is a full skin object, registers it as a custom skin and returns it.
|
|
1232
|
+
*
|
|
1233
|
+
* @param skinOption - Either a skin ID string or a full skin definition
|
|
1234
|
+
* @returns The resolved skin, or undefined if not found (when string ID provided)
|
|
1235
|
+
*/
|
|
1236
|
+
declare function resolveSkin(skinOption: WalletConnectSkinOption): WalletConnectSkin | undefined;
|
|
1237
|
+
|
|
1238
|
+
export { type AlgodConfig, BUILTIN_SKINS, BaseWallet, type BaseWalletConstructor, BiatecWallet, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORK_CONFIG, DEFAULT_STATE, DEFLY_WEB_PROVIDER_ID, DeflyWallet, type DeflyWalletConnectOptions, DeflyWebWallet, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LogLevel, type LuteConnectOptions, LuteWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type ManagerStatus, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, type NetworkConfig, NetworkConfigBuilder, NetworkId, PeraWallet, type PeraWalletConnectOptions, ScopeType, SecureKeyContainer, SessionError, type SignData, SignDataError, type SignDataResponse, type SignMetadata, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type Siwa, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, W3Wallet, type W3WalletProvider, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConnectSkin, type WalletConnectSkinOption, type WalletConstructor, WalletId, type WalletIdConfig, type WalletKey, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type Web3AuthCredentials, type Web3AuthCustomAuth, type Web3AuthOptions, Web3AuthWallet, type WindowExtended, getSkin, registerSkin, resolveSkin, webpackFallback, withSecureKey, withSecureKeySync, zeroMemory, zeroString };
|