@reown/appkit-common 1.6.2 → 1.6.3-rc.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/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/utils/EmitterUtil.js +28 -0
- package/dist/esm/src/utils/EmitterUtil.js.map +1 -0
- package/dist/esm/src/utils/ParseUtil.js +6 -0
- package/dist/esm/src/utils/ParseUtil.js.map +1 -1
- package/dist/esm/src/utils/SafeLocalStorage.js +7 -1
- package/dist/esm/src/utils/SafeLocalStorage.js.map +1 -1
- package/dist/esm/tests/SafeLocalStorage.test.js +2 -2
- package/dist/esm/tests/SafeLocalStorage.test.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/src/utils/EmitterUtil.d.ts +12 -0
- package/dist/types/src/utils/ParseUtil.d.ts +1 -0
- package/dist/types/src/utils/SafeLocalStorage.d.ts +9 -5
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export { ContractUtil } from './src/utils/ContractUtil.js';
|
|
|
6
6
|
export { erc20ABI } from './src/contracts/erc20.js';
|
|
7
7
|
export { NavigationUtil } from './src/utils/NavigationUtil.js';
|
|
8
8
|
export { ConstantsUtil } from './src/utils/ConstantsUtil.js';
|
|
9
|
+
export { Emitter } from './src/utils/EmitterUtil.js';
|
|
9
10
|
export { ParseUtil } from './src/utils/ParseUtil.js';
|
|
10
|
-
export { SafeLocalStorage, SafeLocalStorageKeys } from './src/utils/SafeLocalStorage.js';
|
|
11
|
+
export { SafeLocalStorage, SafeLocalStorageKeys, type SafeLocalStorageKey, getSafeConnectorIdKey } from './src/utils/SafeLocalStorage.js';
|
|
11
12
|
export { getW3mThemeVariables } from './src/utils/ThemeUtil.js';
|
|
12
13
|
export { isReownName } from './src/utils/NamesUtil.js';
|
|
13
14
|
export type * from './src/utils/ThemeUtil.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type EventName = string;
|
|
2
|
+
type EventCallback<T> = (data?: T) => void;
|
|
3
|
+
type EventData = Record<EventName, any>;
|
|
4
|
+
export declare class Emitter {
|
|
5
|
+
private static eventListeners;
|
|
6
|
+
on<T extends EventName>(eventName: T, callback: EventCallback<EventData[T]>): void;
|
|
7
|
+
off<T extends EventName>(eventName: T, callback: EventCallback<EventData[T]>): void;
|
|
8
|
+
emit<T extends EventName>(eventName: T, data?: EventData[T]): void;
|
|
9
|
+
clear(eventName: EventName): void;
|
|
10
|
+
clearAll(): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -9,6 +9,7 @@ type ParsedCaipNetworkId = {
|
|
|
9
9
|
chainId: ChainId;
|
|
10
10
|
};
|
|
11
11
|
export declare const ParseUtil: {
|
|
12
|
+
validateCaipAddress(address: string): CaipAddress;
|
|
12
13
|
parseCaipAddress(caipAddress: CaipAddress): ParsedCaipAddress;
|
|
13
14
|
parseCaipNetworkId(caipNetworkId: CaipNetworkId): ParsedCaipNetworkId;
|
|
14
15
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import type { ChainNamespace } from './TypeUtil.js';
|
|
2
|
+
export type NamespacedConnectorKey = `@appkit/${ChainNamespace}:connected_connector_id`;
|
|
1
3
|
export type SafeLocalStorageItems = {
|
|
2
4
|
'@appkit/wallet_id': string;
|
|
3
5
|
'@appkit/wallet_name': string;
|
|
4
6
|
'@appkit/solana_wallet': string;
|
|
5
7
|
'@appkit/solana_caip_chain': string;
|
|
6
8
|
'@appkit/active_caip_network_id': string;
|
|
7
|
-
'@appkit/connected_connector_id': string;
|
|
8
9
|
'@appkit/connected_social': string;
|
|
9
10
|
'@appkit/connected_social_username': string;
|
|
10
11
|
'@appkit/recent_wallets': string;
|
|
11
12
|
'@appkit/active_namespace': string;
|
|
13
|
+
'@appkit/connected_namespaces': string;
|
|
12
14
|
'@appkit/connection_status': string;
|
|
13
15
|
'@appkit/siwx-auth-token': string;
|
|
14
16
|
'@appkit/siwx-nonce-token': string;
|
|
@@ -20,19 +22,21 @@ export declare const SafeLocalStorageKeys: {
|
|
|
20
22
|
readonly SOLANA_WALLET: "@appkit/solana_wallet";
|
|
21
23
|
readonly SOLANA_CAIP_CHAIN: "@appkit/solana_caip_chain";
|
|
22
24
|
readonly ACTIVE_CAIP_NETWORK_ID: "@appkit/active_caip_network_id";
|
|
23
|
-
readonly CONNECTED_CONNECTOR_ID: "@appkit/connected_connector_id";
|
|
24
25
|
readonly CONNECTED_SOCIAL: "@appkit/connected_social";
|
|
25
26
|
readonly CONNECTED_SOCIAL_USERNAME: "@appkit/connected_social_username";
|
|
26
27
|
readonly RECENT_WALLETS: "@appkit/recent_wallets";
|
|
27
28
|
readonly DEEPLINK_CHOICE: "WALLETCONNECT_DEEPLINK_CHOICE";
|
|
28
29
|
readonly ACTIVE_NAMESPACE: "@appkit/active_namespace";
|
|
30
|
+
readonly CONNECTED_NAMESPACES: "@appkit/connected_namespaces";
|
|
29
31
|
readonly CONNECTION_STATUS: "@appkit/connection_status";
|
|
30
32
|
readonly SIWX_AUTH_TOKEN: "@appkit/siwx-auth-token";
|
|
31
33
|
readonly SIWX_NONCE_TOKEN: "@appkit/siwx-nonce-token";
|
|
32
34
|
};
|
|
35
|
+
export type SafeLocalStorageKey = keyof SafeLocalStorageItems | NamespacedConnectorKey;
|
|
36
|
+
export declare function getSafeConnectorIdKey(namespace?: ChainNamespace): NamespacedConnectorKey;
|
|
33
37
|
export declare const SafeLocalStorage: {
|
|
34
|
-
setItem
|
|
35
|
-
getItem
|
|
36
|
-
removeItem
|
|
38
|
+
setItem(key: SafeLocalStorageKey, value?: string): void;
|
|
39
|
+
getItem(key: SafeLocalStorageKey): string | undefined;
|
|
40
|
+
removeItem(key: SafeLocalStorageKey): void;
|
|
37
41
|
clear(): void;
|
|
38
42
|
};
|