@w3ux/react-connect-kit 1.3.0 → 1.4.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.
@@ -0,0 +1,2 @@
1
+ import type { WCAccountsContextInterface } from "./types";
2
+ export declare const defaultWcAccountsContext: WCAccountsContextInterface;
@@ -0,0 +1,13 @@
1
+ export const defaultWcAccountsContext = {
2
+ wcAccountExists: (network, address) => false,
3
+ addWcAccount: (network, address, index, callback) => null,
4
+ removeWcAccount: (network, address, callback) => { },
5
+ renameWcAccount: (network, address, newName) => { },
6
+ getWcAccount: (network, address) => null,
7
+ getWcAccounts: (network) => [],
8
+ wcAccounts: [],
9
+ };
10
+
11
+ //# sourceMappingURL=defaults.js.map
12
+
13
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/WCAccountsProvider/defaults.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,wBAAwB,GAA+B;IAClE,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,KAAK;IAC5C,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI;IACzD,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAE,CAAC;IACnD,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,GAAE,CAAC;IAClD,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI;IACxC,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE;IAC9B,UAAU,EAAE,EAAE;CACf,CAAC","file":"defaults.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function, no-unused-vars */\n\nimport type { WCAccountsContextInterface } from \"./types\";\n\nexport const defaultWcAccountsContext: WCAccountsContextInterface = {\n wcAccountExists: (network, address) => false,\n addWcAccount: (network, address, index, callback) => null,\n removeWcAccount: (network, address, callback) => {},\n renameWcAccount: (network, address, newName) => {},\n getWcAccount: (network, address) => null,\n getWcAccounts: (network) => [],\n wcAccounts: [],\n};\n"]}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { WCAccountsContextInterface, WCAccountsProviderProps } from "./types";
3
+ export declare const WCAccountsContext: import("react").Context<WCAccountsContextInterface>;
4
+ export declare const useWcAccounts: () => WCAccountsContextInterface;
5
+ export declare const WCAccountsProvider: ({ children }: WCAccountsProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ellipsisFn, setStateWithRef } from "@w3ux/utils";
3
+ import { createContext, useContext, useRef, useState } from "react";
4
+ import { getLocalWcAccounts, isLocalNetworkAddress } from "./utils";
5
+ import { defaultWcAccountsContext } from "./defaults";
6
+ export const WCAccountsContext = createContext(defaultWcAccountsContext);
7
+ export const useWcAccounts = () => useContext(WCAccountsContext);
8
+ export const WCAccountsProvider = ({ children }) => {
9
+ const [wcAccounts, setWcAccountsState] = useState(getLocalWcAccounts());
10
+ const wcAccountsRef = useRef(wcAccounts);
11
+ const wcAccountExists = (network, address) => !!getLocalWcAccounts().find((a) => isLocalNetworkAddress(network, a, address));
12
+ const addWcAccount = (network, address, index, callback) => {
13
+ let newAccounts = getLocalWcAccounts();
14
+ if (!newAccounts.find((a) => isLocalNetworkAddress(network, a, address))) {
15
+ const account = {
16
+ address,
17
+ network,
18
+ name: ellipsisFn(address),
19
+ source: "wallet_connect",
20
+ index,
21
+ };
22
+ newAccounts = [...newAccounts].concat(account);
23
+ localStorage.setItem("wallet_connect_accounts", JSON.stringify(newAccounts));
24
+ setStateWithRef(newAccounts.filter((a) => a.network === network), setWcAccountsState, wcAccountsRef);
25
+ if (typeof callback === "function") {
26
+ callback();
27
+ }
28
+ return account;
29
+ }
30
+ return null;
31
+ };
32
+ const removeWcAccount = (network, address, callback) => {
33
+ let newAccounts = getLocalWcAccounts();
34
+ newAccounts = newAccounts.filter((a) => {
35
+ if (a.address !== address) {
36
+ return true;
37
+ }
38
+ if (a.network !== network) {
39
+ return true;
40
+ }
41
+ return false;
42
+ });
43
+ if (!newAccounts.length) {
44
+ localStorage.removeItem("wallet_connect_accounts");
45
+ }
46
+ else {
47
+ localStorage.setItem("wallet_connect_accounts", JSON.stringify(newAccounts));
48
+ }
49
+ setStateWithRef(newAccounts.filter((a) => a.network === network), setWcAccountsState, wcAccountsRef);
50
+ if (typeof callback === "function") {
51
+ callback();
52
+ }
53
+ };
54
+ const getWcAccount = (network, address) => {
55
+ const localAccounts = getLocalWcAccounts();
56
+ if (!localAccounts) {
57
+ return null;
58
+ }
59
+ return (localAccounts.find((a) => isLocalNetworkAddress(network, a, address)) ??
60
+ null);
61
+ };
62
+ const renameWcAccount = (network, address, newName) => {
63
+ let newAccounts = getLocalWcAccounts();
64
+ newAccounts = newAccounts.map((a) => isLocalNetworkAddress(network, a, address)
65
+ ? {
66
+ ...a,
67
+ name: newName,
68
+ }
69
+ : a);
70
+ localStorage.setItem("wallet_connect_accounts", JSON.stringify(newAccounts));
71
+ setStateWithRef(newAccounts.filter((a) => a.network === network), setWcAccountsState, wcAccountsRef);
72
+ };
73
+ const getWcAccounts = (network) => wcAccountsRef.current.filter((a) => a.network === network);
74
+ return (_jsx(WCAccountsContext.Provider, { value: {
75
+ wcAccountExists,
76
+ addWcAccount,
77
+ removeWcAccount,
78
+ renameWcAccount,
79
+ getWcAccount,
80
+ getWcAccounts,
81
+ wcAccounts: wcAccountsRef.current,
82
+ }, children: children }));
83
+ };
84
+
85
+ //# sourceMappingURL=index.js.map
86
+
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/WCAccountsProvider/index.tsx"],"names":[],"mapp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OAAO,KAAK,OAAO,CAAC,CAAC;IAE7D,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE;YACL,eAAe;YACf,YAAY;YACZ,eAAe;YACf,eAAe;YACf,YAAY;YACZ,aAAa;YACb,UAAU,EAAE,aAAa,CAAC,OAAO;SAClC,YAEA,QAAQ,GACkB,CAC9B,CAAC;AACJ,CAAC,CAAC","file":"index.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport { ellipsisFn, setStateWithRef } from \"@w3ux/utils\";\nimport { createContext, useContext, useRef, useState } from \"react\";\nimport { getLocalWcAccounts, isLocalNetworkAddress } from \"./utils\";\nimport type {\n WCAccountsContextInterface,\n WCAccountsProviderProps,\n} from \"./types\";\nimport { defaultWcAccountsContext } from \"./defaults\";\nimport { WCAccount } from \"../types\";\n\nexport const WCAccountsContext = createContext<WCAccountsContextInterface>(\n defaultWcAccountsContext\n);\n\nexport const useWcAccounts = () => useContext(WCAccountsContext);\n\nexport const WCAccountsProvider = ({ children }: WCAccountsProviderProps) => {\n const [wcAccounts, setWcAccountsState] =\n useState<WCAccount[]>(getLocalWcAccounts());\n const wcAccountsRef = useRef(wcAccounts);\n\n // Check if a Wallet Connect address exists in imported addresses.\n const wcAccountExists = (network: string, address: string) =>\n !!getLocalWcAccounts().find((a) =>\n isLocalNetworkAddress(network, a, address)\n );\n\n // Adds a wallet connect account to state and local storage.\n const addWcAccount = (\n network: string,\n address: string,\n index: number,\n callback?: () => void\n ) => {\n let newAccounts = getLocalWcAccounts();\n\n if (!newAccounts.find((a) => isLocalNetworkAddress(network, a, address))) {\n const account = {\n address,\n network,\n name: ellipsisFn(address),\n source: \"wallet_connect\",\n index,\n };\n\n newAccounts = [...newAccounts].concat(account);\n localStorage.setItem(\n \"wallet_connect_accounts\",\n JSON.stringify(newAccounts)\n );\n\n // store only those accounts on the current network in state.\n setStateWithRef(\n newAccounts.filter((a) => a.network === network),\n setWcAccountsState,\n wcAccountsRef\n );\n\n // Handle optional callback function.\n if (typeof callback === \"function\") {\n callback();\n }\n\n return account;\n }\n return null;\n };\n\n const removeWcAccount = (\n network: string,\n address: string,\n callback?: () => void\n ) => {\n let newAccounts = getLocalWcAccounts();\n\n newAccounts = newAccounts.filter((a) => {\n if (a.address !== address) {\n return true;\n }\n if (a.network !== network) {\n return true;\n }\n return false;\n });\n\n if (!newAccounts.length) {\n localStorage.removeItem(\"wallet_connect_accounts\");\n } else {\n localStorage.setItem(\n \"wallet_connect_accounts\",\n JSON.stringify(newAccounts)\n );\n }\n setStateWithRef(\n newAccounts.filter((a) => a.network === network),\n setWcAccountsState,\n wcAccountsRef\n );\n\n // Handle optional callback function.\n if (typeof callback === \"function\") {\n callback();\n }\n };\n\n const getWcAccount = (network: string, address: string) => {\n const localAccounts = getLocalWcAccounts();\n if (!localAccounts) {\n return null;\n }\n return (\n localAccounts.find((a) => isLocalNetworkAddress(network, a, address)) ??\n null\n );\n };\n\n const renameWcAccount = (\n network: string,\n address: string,\n newName: string\n ) => {\n let newAccounts = getLocalWcAccounts();\n\n newAccounts = newAccounts.map((a) =>\n isLocalNetworkAddress(network, a, address)\n ? {\n ...a,\n name: newName,\n }\n : a\n );\n localStorage.setItem(\n \"wallet_connect_accounts\",\n JSON.stringify(newAccounts)\n );\n setStateWithRef(\n newAccounts.filter((a) => a.network === network),\n setWcAccountsState,\n wcAccountsRef\n );\n };\n\n // Gets Wallet Connect accounts for a network.\n const getWcAccounts = (network: string) =>\n wcAccountsRef.current.filter((a) => a.network === network);\n\n return (\n <WCAccountsContext.Provider\n value={{\n wcAccountExists,\n addWcAccount,\n removeWcAccount,\n renameWcAccount,\n getWcAccount,\n getWcAccounts,\n wcAccounts: wcAccountsRef.current,\n }}\n >\n {children}\n </WCAccountsContext.Provider>\n );\n};\n"]}
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from "react";
2
+ import { WCAccount } from "../types";
3
+ export interface WCAccountsProviderProps {
4
+ children: ReactNode;
5
+ network: string;
6
+ }
7
+ export interface WCAccountsContextInterface {
8
+ wcAccountExists: (network: string, address: string) => boolean;
9
+ addWcAccount: (network: string, address: string, index: number, callback?: () => void) => WCAccount | null;
10
+ removeWcAccount: (network: string, address: string, callback?: () => void) => void;
11
+ renameWcAccount: (network: string, address: string, newName: string) => void;
12
+ getWcAccount: (network: string, address: string) => WCAccount | null;
13
+ getWcAccounts: (network: string) => WCAccount[];
14
+ wcAccounts: WCAccount[];
15
+ }
@@ -0,0 +1,5 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=types.js.map
4
+
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/WCAccountsProvider/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport { ReactNode } from \"react\";\nimport { WCAccount } from \"../types\";\n\nexport interface WCAccountsProviderProps {\n children: ReactNode;\n network: string;\n}\n\nexport interface WCAccountsContextInterface {\n wcAccountExists: (network: string, address: string) => boolean;\n addWcAccount: (\n network: string,\n address: string,\n index: number,\n callback?: () => void\n ) => WCAccount | null;\n removeWcAccount: (\n network: string,\n address: string,\n callback?: () => void\n ) => void;\n renameWcAccount: (network: string, address: string, newName: string) => void;\n getWcAccount: (network: string, address: string) => WCAccount | null;\n getWcAccounts: (network: string) => WCAccount[];\n wcAccounts: WCAccount[];\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { WCAccount } from "../types";
2
+ export declare const getLocalWcAccounts: (network?: string) => WCAccount[];
3
+ export declare const isLocalNetworkAddress: (chain: string, a: {
4
+ address: string | undefined;
5
+ network: string;
6
+ }, address: string) => boolean;
@@ -0,0 +1,12 @@
1
+ import { localStorageOrDefault } from "@w3ux/utils";
2
+ export const getLocalWcAccounts = (network) => {
3
+ const localAddresses = localStorageOrDefault("wallet_connect_accounts", [], true);
4
+ return network
5
+ ? localAddresses.filter((a) => a.network === network)
6
+ : localAddresses;
7
+ };
8
+ export const isLocalNetworkAddress = (chain, a, address) => a.address === address && a.network === chain;
9
+
10
+ //# sourceMappingURL=utils.js.map
11
+
12
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/WCAccountsProvider/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAIpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,EAAE;IACrD,MAAM,cAAc,GAAG,qBAAqB,CAC1C,yBAAyB,EACzB,EAAE,EACF,IAAI,CACU,CAAC;IAEjB,OAAO,OAAO;QACZ,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC;QACrD,CAAC,CAAC,cAAc,CAAC;AACrB,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAa,EACb,CAAmD,EACnD,OAAe,EACf,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC","file":"utils.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport { localStorageOrDefault } from \"@w3ux/utils\";\nimport { WCAccount } from \"../types\";\n\n// Gets imported Wallet Connect accounts from local storage.\nexport const getLocalWcAccounts = (network?: string) => {\n const localAddresses = localStorageOrDefault(\n \"wallet_connect_accounts\",\n [],\n true\n ) as WCAccount[];\n\n return network\n ? localAddresses.filter((a) => a.network === network)\n : localAddresses;\n};\n\n// Gets whether an address is a local network address.\nexport const isLocalNetworkAddress = (\n chain: string,\n a: { address: string | undefined; network: string },\n address: string\n) => a.address === address && a.network === chain;\n"]}
package/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from "./ExtensionsProvider/index";
2
2
  export * from "./ExtensionAccountsProvider/index";
3
3
  export * from "./LedgerAccountsProvider/index";
4
4
  export * from "./VaultAccountsProvider/index";
5
+ export * from "./WCAccountsProvider/index";
package/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./ExtensionsProvider/index";
2
2
  export * from "./ExtensionAccountsProvider/index";
3
3
  export * from "./LedgerAccountsProvider/index";
4
4
  export * from "./VaultAccountsProvider/index";
5
+ export * from "./WCAccountsProvider/index";
5
6
 
6
7
  //# sourceMappingURL=index.js.map
7
8
 
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC","file":"index.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nexport * from \"./ExtensionsProvider/index\";\nexport * from \"./ExtensionAccountsProvider/index\";\nexport * from \"./LedgerAccountsProvider/index\";\nexport * from \"./VaultAccountsProvider/index\";\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC","file":"index.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nexport * from \"./ExtensionsProvider/index\";\nexport * from \"./ExtensionAccountsProvider/index\";\nexport * from \"./LedgerAccountsProvider/index\";\nexport * from \"./VaultAccountsProvider/index\";\nexport * from \"./WCAccountsProvider/index\";\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@w3ux/react-connect-kit",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "license": "GPL-3.0-only",
5
5
  "dependencies": {
6
6
  "@chainsafe/metamask-polkadot-adapter": "^0.6.0",
7
7
  "@polkadot/util": "^12.6.2",
8
8
  "@polkagate/extension-dapp": "^0.46.13",
9
- "@w3ux/extension-assets": "^0.3.0",
9
+ "@w3ux/extension-assets": "^0.3.1",
10
10
  "@w3ux/hooks": "^1.1.0",
11
11
  "@w3ux/utils": "^0.4.0"
12
12
  },
package/types.d.ts CHANGED
@@ -6,7 +6,7 @@ export * from "./VaultAccountsProvider/types";
6
6
  export type MaybeAddress = string | null;
7
7
  export type AccountSource = "extension" | "external" | "ledger" | "vault";
8
8
  export type ExternalAccountAddedBy = "system" | "user";
9
- export type ImportedAccount = ExtensionAccount | ExternalAccount | LedgerAccount | VaultAccount;
9
+ export type ImportedAccount = ExtensionAccount | ExternalAccount | LedgerAccount | VaultAccount | WCAccount;
10
10
  export interface ExternalAccount {
11
11
  address: string;
12
12
  network: string;
@@ -28,6 +28,13 @@ export interface VaultAccount {
28
28
  source: string;
29
29
  index: number;
30
30
  }
31
+ export interface WCAccount {
32
+ address: string;
33
+ network: string;
34
+ name: string;
35
+ source: string;
36
+ index: number;
37
+ }
31
38
  export type RawExtensions = Map<string, RawExtensionEnable>;
32
39
  export type RawExtensionEnable = (name?: string) => Promise<ExtensionInterface>;
33
40
  export type ExtensionEnableStatus = "valid" | "extension_not_found" | "enable_invalid";
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"names":[],"mappings":"AAYA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC","file":"types.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport {\n ExtensionAccount,\n ExtensionInterface,\n} from \"./ExtensionsProvider/types\";\n\n/*------------------------------------------------------------\n Re-export package inner types.\n ------------------------------------------------------------*/\n\nexport * from \"./ExtensionsProvider/types\";\nexport * from \"./ExtensionAccountsProvider/types\";\nexport * from \"./LedgerAccountsProvider/types\";\nexport * from \"./VaultAccountsProvider/types\";\n\n/*------------------------------------------------------------\n Imported account types.\n ------------------------------------------------------------*/\nexport type MaybeAddress = string | null;\n\nexport type AccountSource = \"extension\" | \"external\" | \"ledger\" | \"vault\";\n\nexport type ExternalAccountAddedBy = \"system\" | \"user\";\n\nexport type ImportedAccount =\n | ExtensionAccount\n | ExternalAccount\n | LedgerAccount\n | VaultAccount;\n\nexport interface ExternalAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n addedBy: ExternalAccountAddedBy;\n}\n\nexport interface LedgerAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n index: number;\n}\n\nexport interface VaultAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n index: number;\n}\n\n/*------------------------------------------------------------\n Extension import process types.\n ------------------------------------------------------------*/\n\nexport type RawExtensions = Map<string, RawExtensionEnable>;\n\nexport type RawExtensionEnable = (name?: string) => Promise<ExtensionInterface>;\n\nexport type ExtensionEnableStatus =\n | \"valid\"\n | \"extension_not_found\"\n | \"enable_invalid\";\n\nexport type ExtensionEnableResults = Map<string, ExtensionEnableResult>;\n\nexport interface ExtensionEnableResult {\n extension?: ExtensionInterface;\n connected: boolean;\n error?: string;\n}\n"]}
1
+ {"version":3,"sources":["../src/types.ts"],"names":[],"mappings":"AAYA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC","file":"types.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport {\n ExtensionAccount,\n ExtensionInterface,\n} from \"./ExtensionsProvider/types\";\n\n/*------------------------------------------------------------\n Re-export package inner types.\n ------------------------------------------------------------*/\n\nexport * from \"./ExtensionsProvider/types\";\nexport * from \"./ExtensionAccountsProvider/types\";\nexport * from \"./LedgerAccountsProvider/types\";\nexport * from \"./VaultAccountsProvider/types\";\n\n/*------------------------------------------------------------\n Imported account types.\n ------------------------------------------------------------*/\nexport type MaybeAddress = string | null;\n\nexport type AccountSource = \"extension\" | \"external\" | \"ledger\" | \"vault\";\n\nexport type ExternalAccountAddedBy = \"system\" | \"user\";\n\nexport type ImportedAccount =\n | ExtensionAccount\n | ExternalAccount\n | LedgerAccount\n | VaultAccount\n | WCAccount;\n\nexport interface ExternalAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n addedBy: ExternalAccountAddedBy;\n}\n\nexport interface LedgerAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n index: number;\n}\n\nexport interface VaultAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n index: number;\n}\n\nexport interface WCAccount {\n address: string;\n network: string;\n name: string;\n source: string;\n index: number;\n}\n\n/*------------------------------------------------------------\n Extension import process types.\n ------------------------------------------------------------*/\n\nexport type RawExtensions = Map<string, RawExtensionEnable>;\n\nexport type RawExtensionEnable = (name?: string) => Promise<ExtensionInterface>;\n\nexport type ExtensionEnableStatus =\n | \"valid\"\n | \"extension_not_found\"\n | \"enable_invalid\";\n\nexport type ExtensionEnableResults = Map<string, ExtensionEnableResult>;\n\nexport interface ExtensionEnableResult {\n extension?: ExtensionInterface;\n connected: boolean;\n error?: string;\n}\n"]}