@xyo-network/react-connected-accounts 2.75.6 → 2.76.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. package/dist/neutral/classes/EnabledWallets.d.cts +39 -0
  2. package/dist/neutral/classes/EnabledWallets.d.cts.map +1 -0
  3. package/dist/neutral/classes/EnabledWallets.d.mts +39 -0
  4. package/dist/neutral/classes/EnabledWallets.d.mts.map +1 -0
  5. package/dist/neutral/classes/EnabledWallets.d.ts +39 -0
  6. package/dist/neutral/classes/EnabledWallets.d.ts.map +1 -0
  7. package/dist/neutral/classes/index.d.cts +2 -0
  8. package/dist/neutral/classes/index.d.cts.map +1 -0
  9. package/dist/neutral/classes/index.d.mts +2 -0
  10. package/dist/neutral/classes/index.d.mts.map +1 -0
  11. package/dist/neutral/classes/index.d.ts +2 -0
  12. package/dist/neutral/classes/index.d.ts.map +1 -0
  13. package/dist/neutral/components/ConnectedAccountsFlexbox.d.cts +8 -0
  14. package/dist/neutral/components/ConnectedAccountsFlexbox.d.cts.map +1 -0
  15. package/dist/neutral/components/ConnectedAccountsFlexbox.d.mts +8 -0
  16. package/dist/neutral/components/ConnectedAccountsFlexbox.d.mts.map +1 -0
  17. package/dist/neutral/components/ConnectedAccountsFlexbox.d.ts +8 -0
  18. package/dist/neutral/components/ConnectedAccountsFlexbox.d.ts.map +1 -0
  19. package/dist/neutral/components/index.d.cts +3 -0
  20. package/dist/neutral/components/index.d.cts.map +1 -0
  21. package/dist/neutral/components/index.d.mts +3 -0
  22. package/dist/neutral/components/index.d.mts.map +1 -0
  23. package/dist/neutral/components/index.d.ts +3 -0
  24. package/dist/neutral/components/index.d.ts.map +1 -0
  25. package/dist/neutral/components/wallet/dialogs/connect/CheckboxFormControl.d.cts +7 -0
  26. package/dist/neutral/components/wallet/dialogs/connect/CheckboxFormControl.d.cts.map +1 -0
  27. package/dist/neutral/components/wallet/dialogs/connect/CheckboxFormControl.d.mts +7 -0
  28. package/dist/neutral/components/wallet/dialogs/connect/CheckboxFormControl.d.mts.map +1 -0
  29. package/dist/neutral/components/wallet/dialogs/connect/CheckboxFormControl.d.ts +7 -0
  30. package/dist/neutral/components/wallet/dialogs/connect/CheckboxFormControl.d.ts.map +1 -0
  31. package/dist/neutral/components/wallet/dialogs/connect/Dialog.d.cts +9 -0
  32. package/dist/neutral/components/wallet/dialogs/connect/Dialog.d.cts.map +1 -0
  33. package/dist/neutral/components/wallet/dialogs/connect/Dialog.d.mts +9 -0
  34. package/dist/neutral/components/wallet/dialogs/connect/Dialog.d.mts.map +1 -0
  35. package/dist/neutral/components/wallet/dialogs/connect/Dialog.d.ts +9 -0
  36. package/dist/neutral/components/wallet/dialogs/connect/Dialog.d.ts.map +1 -0
  37. package/dist/neutral/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.cts +8 -0
  38. package/dist/neutral/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.cts.map +1 -0
  39. package/dist/neutral/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.mts +8 -0
  40. package/dist/neutral/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.mts.map +1 -0
  41. package/dist/neutral/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.ts +8 -0
  42. package/dist/neutral/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.ts.map +1 -0
  43. package/dist/neutral/components/wallet/dialogs/connect/Permissions.d.cts +6 -0
  44. package/dist/neutral/components/wallet/dialogs/connect/Permissions.d.cts.map +1 -0
  45. package/dist/neutral/components/wallet/dialogs/connect/Permissions.d.mts +6 -0
  46. package/dist/neutral/components/wallet/dialogs/connect/Permissions.d.mts.map +1 -0
  47. package/dist/neutral/components/wallet/dialogs/connect/Permissions.d.ts +6 -0
  48. package/dist/neutral/components/wallet/dialogs/connect/Permissions.d.ts.map +1 -0
  49. package/dist/neutral/components/wallet/dialogs/connect/index.d.cts +3 -0
  50. package/dist/neutral/components/wallet/dialogs/connect/index.d.cts.map +1 -0
  51. package/dist/neutral/components/wallet/dialogs/connect/index.d.mts +3 -0
  52. package/dist/neutral/components/wallet/dialogs/connect/index.d.mts.map +1 -0
  53. package/dist/neutral/components/wallet/dialogs/connect/index.d.ts +3 -0
  54. package/dist/neutral/components/wallet/dialogs/connect/index.d.ts.map +1 -0
  55. package/dist/neutral/components/wallet/dialogs/index.d.cts +3 -0
  56. package/dist/neutral/components/wallet/dialogs/index.d.cts.map +1 -0
  57. package/dist/neutral/components/wallet/dialogs/index.d.mts +3 -0
  58. package/dist/neutral/components/wallet/dialogs/index.d.mts.map +1 -0
  59. package/dist/neutral/components/wallet/dialogs/index.d.ts +3 -0
  60. package/dist/neutral/components/wallet/dialogs/index.d.ts.map +1 -0
  61. package/dist/neutral/components/wallet/dialogs/revoke/Dialog.d.cts +8 -0
  62. package/dist/neutral/components/wallet/dialogs/revoke/Dialog.d.cts.map +1 -0
  63. package/dist/neutral/components/wallet/dialogs/revoke/Dialog.d.mts +8 -0
  64. package/dist/neutral/components/wallet/dialogs/revoke/Dialog.d.mts.map +1 -0
  65. package/dist/neutral/components/wallet/dialogs/revoke/Dialog.d.ts +8 -0
  66. package/dist/neutral/components/wallet/dialogs/revoke/Dialog.d.ts.map +1 -0
  67. package/dist/neutral/components/wallet/dialogs/revoke/index.d.cts +2 -0
  68. package/dist/neutral/components/wallet/dialogs/revoke/index.d.cts.map +1 -0
  69. package/dist/neutral/components/wallet/dialogs/revoke/index.d.mts +2 -0
  70. package/dist/neutral/components/wallet/dialogs/revoke/index.d.mts.map +1 -0
  71. package/dist/neutral/components/wallet/dialogs/revoke/index.d.ts +2 -0
  72. package/dist/neutral/components/wallet/dialogs/revoke/index.d.ts.map +1 -0
  73. package/dist/neutral/components/wallet/index.d.cts +3 -0
  74. package/dist/neutral/components/wallet/index.d.cts.map +1 -0
  75. package/dist/neutral/components/wallet/index.d.mts +3 -0
  76. package/dist/neutral/components/wallet/index.d.mts.map +1 -0
  77. package/dist/neutral/components/wallet/index.d.ts +3 -0
  78. package/dist/neutral/components/wallet/index.d.ts.map +1 -0
  79. package/dist/neutral/components/wallet/lib/ActiveProvider.d.cts +7 -0
  80. package/dist/neutral/components/wallet/lib/ActiveProvider.d.cts.map +1 -0
  81. package/dist/neutral/components/wallet/lib/ActiveProvider.d.mts +7 -0
  82. package/dist/neutral/components/wallet/lib/ActiveProvider.d.mts.map +1 -0
  83. package/dist/neutral/components/wallet/lib/ActiveProvider.d.ts +7 -0
  84. package/dist/neutral/components/wallet/lib/ActiveProvider.d.ts.map +1 -0
  85. package/dist/neutral/components/wallet/lib/TableHeadData.d.cts +3 -0
  86. package/dist/neutral/components/wallet/lib/TableHeadData.d.cts.map +1 -0
  87. package/dist/neutral/components/wallet/lib/TableHeadData.d.mts +3 -0
  88. package/dist/neutral/components/wallet/lib/TableHeadData.d.mts.map +1 -0
  89. package/dist/neutral/components/wallet/lib/TableHeadData.d.ts +3 -0
  90. package/dist/neutral/components/wallet/lib/TableHeadData.d.ts.map +1 -0
  91. package/dist/neutral/components/wallet/lib/index.d.cts +3 -0
  92. package/dist/neutral/components/wallet/lib/index.d.cts.map +1 -0
  93. package/dist/neutral/components/wallet/lib/index.d.mts +3 -0
  94. package/dist/neutral/components/wallet/lib/index.d.mts.map +1 -0
  95. package/dist/neutral/components/wallet/lib/index.d.ts +3 -0
  96. package/dist/neutral/components/wallet/lib/index.d.ts.map +1 -0
  97. package/dist/neutral/components/wallet/table/ConnectedWalletsTable.d.cts +10 -0
  98. package/dist/neutral/components/wallet/table/ConnectedWalletsTable.d.cts.map +1 -0
  99. package/dist/neutral/components/wallet/table/ConnectedWalletsTable.d.mts +10 -0
  100. package/dist/neutral/components/wallet/table/ConnectedWalletsTable.d.mts.map +1 -0
  101. package/dist/neutral/components/wallet/table/ConnectedWalletsTable.d.ts +10 -0
  102. package/dist/neutral/components/wallet/table/ConnectedWalletsTable.d.ts.map +1 -0
  103. package/dist/neutral/components/wallet/table/ConnectedWalletsTableRow.d.cts +12 -0
  104. package/dist/neutral/components/wallet/table/ConnectedWalletsTableRow.d.cts.map +1 -0
  105. package/dist/neutral/components/wallet/table/ConnectedWalletsTableRow.d.mts +12 -0
  106. package/dist/neutral/components/wallet/table/ConnectedWalletsTableRow.d.mts.map +1 -0
  107. package/dist/neutral/components/wallet/table/ConnectedWalletsTableRow.d.ts +12 -0
  108. package/dist/neutral/components/wallet/table/ConnectedWalletsTableRow.d.ts.map +1 -0
  109. package/dist/neutral/components/wallet/table/cells/Accounts.d.cts +4 -0
  110. package/dist/neutral/components/wallet/table/cells/Accounts.d.cts.map +1 -0
  111. package/dist/neutral/components/wallet/table/cells/Accounts.d.mts +4 -0
  112. package/dist/neutral/components/wallet/table/cells/Accounts.d.mts.map +1 -0
  113. package/dist/neutral/components/wallet/table/cells/Accounts.d.ts +4 -0
  114. package/dist/neutral/components/wallet/table/cells/Accounts.d.ts.map +1 -0
  115. package/dist/neutral/components/wallet/table/cells/Actions.d.cts +4 -0
  116. package/dist/neutral/components/wallet/table/cells/Actions.d.cts.map +1 -0
  117. package/dist/neutral/components/wallet/table/cells/Actions.d.mts +4 -0
  118. package/dist/neutral/components/wallet/table/cells/Actions.d.mts.map +1 -0
  119. package/dist/neutral/components/wallet/table/cells/Actions.d.ts +4 -0
  120. package/dist/neutral/components/wallet/table/cells/Actions.d.ts.map +1 -0
  121. package/dist/neutral/components/wallet/table/cells/Cells.d.cts +4 -0
  122. package/dist/neutral/components/wallet/table/cells/Cells.d.cts.map +1 -0
  123. package/dist/neutral/components/wallet/table/cells/Cells.d.mts +4 -0
  124. package/dist/neutral/components/wallet/table/cells/Cells.d.mts.map +1 -0
  125. package/dist/neutral/components/wallet/table/cells/Cells.d.ts +4 -0
  126. package/dist/neutral/components/wallet/table/cells/Cells.d.ts.map +1 -0
  127. package/dist/neutral/components/wallet/table/cells/ChainName.d.cts +4 -0
  128. package/dist/neutral/components/wallet/table/cells/ChainName.d.cts.map +1 -0
  129. package/dist/neutral/components/wallet/table/cells/ChainName.d.mts +4 -0
  130. package/dist/neutral/components/wallet/table/cells/ChainName.d.mts.map +1 -0
  131. package/dist/neutral/components/wallet/table/cells/ChainName.d.ts +4 -0
  132. package/dist/neutral/components/wallet/table/cells/ChainName.d.ts.map +1 -0
  133. package/dist/neutral/components/wallet/table/cells/State.d.cts +4 -0
  134. package/dist/neutral/components/wallet/table/cells/State.d.cts.map +1 -0
  135. package/dist/neutral/components/wallet/table/cells/State.d.mts +4 -0
  136. package/dist/neutral/components/wallet/table/cells/State.d.mts.map +1 -0
  137. package/dist/neutral/components/wallet/table/cells/State.d.ts +4 -0
  138. package/dist/neutral/components/wallet/table/cells/State.d.ts.map +1 -0
  139. package/dist/neutral/components/wallet/table/cells/Wallet.d.cts +4 -0
  140. package/dist/neutral/components/wallet/table/cells/Wallet.d.cts.map +1 -0
  141. package/dist/neutral/components/wallet/table/cells/Wallet.d.mts +4 -0
  142. package/dist/neutral/components/wallet/table/cells/Wallet.d.mts.map +1 -0
  143. package/dist/neutral/components/wallet/table/cells/Wallet.d.ts +4 -0
  144. package/dist/neutral/components/wallet/table/cells/Wallet.d.ts.map +1 -0
  145. package/dist/neutral/components/wallet/table/cells/index.d.cts +7 -0
  146. package/dist/neutral/components/wallet/table/cells/index.d.cts.map +1 -0
  147. package/dist/neutral/components/wallet/table/cells/index.d.mts +7 -0
  148. package/dist/neutral/components/wallet/table/cells/index.d.mts.map +1 -0
  149. package/dist/neutral/components/wallet/table/cells/index.d.ts +7 -0
  150. package/dist/neutral/components/wallet/table/cells/index.d.ts.map +1 -0
  151. package/dist/neutral/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.cts +15 -0
  152. package/dist/neutral/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.cts.map +1 -0
  153. package/dist/neutral/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.mts +15 -0
  154. package/dist/neutral/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.mts.map +1 -0
  155. package/dist/neutral/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.ts +15 -0
  156. package/dist/neutral/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.ts.map +1 -0
  157. package/dist/neutral/components/wallet/table/cells/lib/index.d.cts +2 -0
  158. package/dist/neutral/components/wallet/table/cells/lib/index.d.cts.map +1 -0
  159. package/dist/neutral/components/wallet/table/cells/lib/index.d.mts +2 -0
  160. package/dist/neutral/components/wallet/table/cells/lib/index.d.mts.map +1 -0
  161. package/dist/neutral/components/wallet/table/cells/lib/index.d.ts +2 -0
  162. package/dist/neutral/components/wallet/table/cells/lib/index.d.ts.map +1 -0
  163. package/dist/neutral/components/wallet/table/hooks/index.d.cts +2 -0
  164. package/dist/neutral/components/wallet/table/hooks/index.d.cts.map +1 -0
  165. package/dist/neutral/components/wallet/table/hooks/index.d.mts +2 -0
  166. package/dist/neutral/components/wallet/table/hooks/index.d.mts.map +1 -0
  167. package/dist/neutral/components/wallet/table/hooks/index.d.ts +2 -0
  168. package/dist/neutral/components/wallet/table/hooks/index.d.ts.map +1 -0
  169. package/dist/neutral/components/wallet/table/hooks/useActiveProviderDialogState.d.cts +4 -0
  170. package/dist/neutral/components/wallet/table/hooks/useActiveProviderDialogState.d.cts.map +1 -0
  171. package/dist/neutral/components/wallet/table/hooks/useActiveProviderDialogState.d.mts +4 -0
  172. package/dist/neutral/components/wallet/table/hooks/useActiveProviderDialogState.d.mts.map +1 -0
  173. package/dist/neutral/components/wallet/table/hooks/useActiveProviderDialogState.d.ts +4 -0
  174. package/dist/neutral/components/wallet/table/hooks/useActiveProviderDialogState.d.ts.map +1 -0
  175. package/dist/neutral/components/wallet/table/index.d.cts +5 -0
  176. package/dist/neutral/components/wallet/table/index.d.cts.map +1 -0
  177. package/dist/neutral/components/wallet/table/index.d.mts +5 -0
  178. package/dist/neutral/components/wallet/table/index.d.mts.map +1 -0
  179. package/dist/neutral/components/wallet/table/index.d.ts +5 -0
  180. package/dist/neutral/components/wallet/table/index.d.ts.map +1 -0
  181. package/dist/neutral/hooks/index.d.cts +3 -0
  182. package/dist/neutral/hooks/index.d.cts.map +1 -0
  183. package/dist/neutral/hooks/index.d.mts +3 -0
  184. package/dist/neutral/hooks/index.d.mts.map +1 -0
  185. package/dist/neutral/hooks/index.d.ts +3 -0
  186. package/dist/neutral/hooks/index.d.ts.map +1 -0
  187. package/dist/neutral/hooks/useDetectWallets.d.cts +6 -0
  188. package/dist/neutral/hooks/useDetectWallets.d.cts.map +1 -0
  189. package/dist/neutral/hooks/useDetectWallets.d.mts +6 -0
  190. package/dist/neutral/hooks/useDetectWallets.d.mts.map +1 -0
  191. package/dist/neutral/hooks/useDetectWallets.d.ts +6 -0
  192. package/dist/neutral/hooks/useDetectWallets.d.ts.map +1 -0
  193. package/dist/neutral/hooks/useEnabledWallets.d.cts +15 -0
  194. package/dist/neutral/hooks/useEnabledWallets.d.cts.map +1 -0
  195. package/dist/neutral/hooks/useEnabledWallets.d.mts +15 -0
  196. package/dist/neutral/hooks/useEnabledWallets.d.mts.map +1 -0
  197. package/dist/neutral/hooks/useEnabledWallets.d.ts +15 -0
  198. package/dist/neutral/hooks/useEnabledWallets.d.ts.map +1 -0
  199. package/dist/neutral/img/index.d.cts +3 -0
  200. package/dist/neutral/img/index.d.cts.map +1 -0
  201. package/dist/neutral/img/index.d.mts +3 -0
  202. package/dist/neutral/img/index.d.mts.map +1 -0
  203. package/dist/neutral/img/index.d.ts +3 -0
  204. package/dist/neutral/img/index.d.ts.map +1 -0
  205. package/dist/neutral/index.cjs +578 -0
  206. package/dist/neutral/index.cjs.map +1 -0
  207. package/dist/neutral/index.d.cts +4 -0
  208. package/dist/neutral/index.d.cts.map +1 -0
  209. package/dist/neutral/index.d.mts +4 -0
  210. package/dist/neutral/index.d.mts.map +1 -0
  211. package/dist/neutral/index.d.ts +4 -0
  212. package/dist/neutral/index.d.ts.map +1 -0
  213. package/dist/neutral/index.js +545 -0
  214. package/dist/neutral/index.js.map +1 -0
  215. package/dist/neutral/xyo-color-logo-LHR2SMEM.svg +1 -0
  216. package/dist/neutral/xyo-color-logo-text-only-QPAW5BSQ.svg +1 -0
  217. package/package.json +7 -7
@@ -0,0 +1,578 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ CheckboxFormControl: () => CheckboxFormControl,
34
+ ConnectWalletDialog: () => ConnectWalletDialog,
35
+ ConnectedAccountsFlexbox: () => ConnectedAccountsFlexbox,
36
+ ConnectedWalletState: () => ConnectedWalletState,
37
+ ConnectedWalletTableCells: () => ConnectedWalletTableCells,
38
+ ConnectedWalletsAccountsTableCell: () => ConnectedWalletsAccountsTableCell,
39
+ ConnectedWalletsActionsTableCell: () => ConnectedWalletsActionsTableCell,
40
+ ConnectedWalletsChainNameTableCell: () => ConnectedWalletsChainNameTableCell,
41
+ ConnectedWalletsTable: () => ConnectedWalletsTable,
42
+ ConnectedWalletsWalletTableCell: () => ConnectedWalletsWalletTableCell,
43
+ EnabledEthWalletConnections: () => EnabledEthWalletConnections,
44
+ RevokeWalletConnectionDialog: () => RevokeWalletConnectionDialog,
45
+ WalletConnectionsTableRow: () => WalletConnectionsTableRow,
46
+ useActiveProviderDialogState: () => useActiveProviderDialogState,
47
+ useDetectedWallets: () => useDetectedWallets,
48
+ useEnabledWallets: () => useEnabledWallets,
49
+ useEnabledWalletsInner: () => useEnabledWalletsInner
50
+ });
51
+ module.exports = __toCommonJS(src_exports);
52
+
53
+ // src/classes/EnabledWallets.ts
54
+ var DEFAULT_LOCAL_STORAGE_KEY = "XYO|EnabledWallets";
55
+ var EnabledEthWalletConnections = class {
56
+ // control whether or not enabled/disabled preferences are persisted (i.e. in localStorage)
57
+ persistPreferences = true;
58
+ // Map of wallet names and their enabled/disabled state
59
+ enabledWallets = {};
60
+ // Map of wallet names, their enabled/disabled state, and their wallet class
61
+ ethWalletsState = {};
62
+ // list of listeners that want to be notified on wallet changes
63
+ listeners = [];
64
+ // key to use in localStorage when persisting preferences
65
+ localStorageKey = DEFAULT_LOCAL_STORAGE_KEY;
66
+ constructor(localStorageKey = DEFAULT_LOCAL_STORAGE_KEY) {
67
+ this.localStorageKey = localStorageKey;
68
+ this.reviveSettings();
69
+ }
70
+ get wallets() {
71
+ return this.ethWalletsState;
72
+ }
73
+ disableWallet(rdns) {
74
+ this.toggleEnabledWallet(rdns, false);
75
+ }
76
+ enableWallet(rdns) {
77
+ this.toggleEnabledWallet(rdns, true);
78
+ }
79
+ /**
80
+ * Given a new set of wallets, set their enabled state based off previous preferences
81
+ */
82
+ resetWallets(wallets) {
83
+ const newWallets = {};
84
+ const addWallet = ([walletName, wallet]) => {
85
+ newWallets[walletName] = {
86
+ // preserve the existing enabled state
87
+ enabled: walletName in this.enabledWallets ? this.enabledWallets[walletName] : true,
88
+ wallet
89
+ };
90
+ };
91
+ Object.entries(wallets).forEach(addWallet.bind(this));
92
+ this.ethWalletsState = newWallets;
93
+ this.emitChange();
94
+ }
95
+ subscribe(listener) {
96
+ this.listeners = [...this.listeners, listener];
97
+ return () => {
98
+ this.listeners = this.listeners.filter((existingListener) => existingListener !== listener);
99
+ };
100
+ }
101
+ toggleEnabledWallet(rdns, enabled) {
102
+ if (rdns && this.ethWalletsState[rdns]) {
103
+ this.ethWalletsState[rdns].enabled = enabled;
104
+ this.ethWalletsState = { ...this.ethWalletsState };
105
+ this.emitChange();
106
+ }
107
+ }
108
+ emitChange() {
109
+ for (const listener of this.listeners) {
110
+ listener();
111
+ }
112
+ this.persistSettings();
113
+ }
114
+ isPersistance(method) {
115
+ if (this.persistPreferences) {
116
+ method();
117
+ }
118
+ }
119
+ persistSettings() {
120
+ this.isPersistance(() => {
121
+ const enabledWallets = Object.entries(this.ethWalletsState).reduce((acc, [rdns, { enabled }]) => {
122
+ acc[rdns] = enabled;
123
+ return acc;
124
+ }, {});
125
+ localStorage.setItem(this.localStorageKey, JSON.stringify(enabledWallets));
126
+ });
127
+ }
128
+ reviveSettings() {
129
+ this.isPersistance(() => {
130
+ const existingEntries = localStorage.getItem(this.localStorageKey);
131
+ try {
132
+ const entries = existingEntries ? JSON.parse(existingEntries) : {};
133
+ this.enabledWallets = entries;
134
+ } catch (e) {
135
+ console.warn(`Error parsing saved enabled wallet entries: ${e.message}`);
136
+ }
137
+ });
138
+ }
139
+ };
140
+
141
+ // src/components/ConnectedAccountsFlexbox.tsx
142
+ var import_material13 = require("@mui/material");
143
+ var import_react_flexbox6 = require("@xylabs/react-flexbox");
144
+ var import_react7 = require("react");
145
+
146
+ // src/hooks/useDetectWallets.tsx
147
+ var import_react_crypto = require("@xylabs/react-crypto");
148
+ var import_react = require("react");
149
+ var sortWallets = (wallets) => (
150
+ // eslint-disable-next-line unicorn/no-array-reduce
151
+ Object.values(wallets).reduce((acc, wallet) => {
152
+ wallet.allowedAccounts.length > 0 ? acc.unshift(wallet) : acc.push(wallet);
153
+ return acc;
154
+ }, [])
155
+ );
156
+ var useDetectedWallets = () => {
157
+ const wallets = (0, import_react_crypto.useWalletDiscovery)();
158
+ const [refresh, setRefresh] = (0, import_react.useState)(0);
159
+ const [sortedWallets, setSortedWallets] = (0, import_react.useState)([]);
160
+ (0, import_react.useEffect)(() => {
161
+ setSortedWallets(sortWallets(wallets));
162
+ }, [wallets, refresh]);
163
+ (0, import_react.useEffect)(() => {
164
+ const listener = () => {
165
+ setRefresh((refresh2) => refresh2 + 1);
166
+ };
167
+ window.addEventListener(import_react_crypto.AccountsChangedEventName, listener);
168
+ return () => {
169
+ window.removeEventListener(import_react_crypto.AccountsChangedEventName, listener);
170
+ };
171
+ }, [wallets]);
172
+ const totalConnectedAccounts = (0, import_react.useMemo)(
173
+ () => Object.values(sortedWallets).reduce((acc, wallet) => acc + wallet.allowedAccounts.length, 0),
174
+ [sortedWallets]
175
+ );
176
+ return { sortedWallets, totalConnectedAccounts };
177
+ };
178
+
179
+ // src/hooks/useEnabledWallets.tsx
180
+ var import_react_crypto2 = require("@xylabs/react-crypto");
181
+ var import_react2 = require("react");
182
+ var enabledEthWallets;
183
+ var useEnabledWalletsInner = (enabledWalletsRdns) => {
184
+ const discoveredWallets = (0, import_react_crypto2.useWalletDiscovery)();
185
+ const wallets = (0, import_react2.useMemo)(() => {
186
+ if (enabledEthWallets === void 0)
187
+ enabledEthWallets = new EnabledEthWalletConnections();
188
+ enabledEthWallets.resetWallets(discoveredWallets);
189
+ for (const [rdns, enabled] of Object.entries(enabledWalletsRdns ?? {}))
190
+ enabledEthWallets?.toggleEnabledWallet(rdns, enabled);
191
+ return enabledEthWallets;
192
+ }, [discoveredWallets, enabledWalletsRdns]);
193
+ return (0, import_react2.useSyncExternalStore)(wallets.subscribe.bind(wallets), () => wallets.wallets);
194
+ };
195
+ var useEnabledWallets = (enabledWalletsRdns) => {
196
+ const wallets = useEnabledWalletsInner(enabledWalletsRdns);
197
+ const enabledWallets = (0, import_react2.useMemo)(
198
+ () => (
199
+ // eslint-disable-next-line unicorn/no-array-reduce
200
+ Object.entries(wallets).reduce((acc, [walletName, wallet]) => {
201
+ if (wallet.enabled)
202
+ acc[walletName] = wallet;
203
+ return acc;
204
+ }, {})
205
+ ),
206
+ [wallets]
207
+ );
208
+ return {
209
+ disableWallet: enabledEthWallets?.disableWallet.bind(enabledEthWallets),
210
+ enableWallet: enabledEthWallets?.enableWallet.bind(enabledEthWallets),
211
+ enabledWallets,
212
+ wallets
213
+ };
214
+ };
215
+
216
+ // src/components/wallet/dialogs/connect/CheckboxFormControl.tsx
217
+ var import_material = require("@mui/material");
218
+ var import_jsx_runtime = require("react/jsx-runtime");
219
+ var CheckboxFormControl = ({ onCheckChanged, ...props }) => {
220
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.FormControl, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.FormLabel, { children: [
221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Checkbox, { onChange: (_, checked) => onCheckChanged?.(checked) }),
222
+ "Do not show this again."
223
+ ] }) });
224
+ };
225
+
226
+ // src/components/wallet/dialogs/connect/Dialog.tsx
227
+ var import_material4 = require("@mui/material");
228
+
229
+ // src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx
230
+ var import_icons_material = require("@mui/icons-material");
231
+ var import_material2 = require("@mui/material");
232
+ var import_react_crypto3 = require("@xylabs/react-crypto");
233
+ var import_react_flexbox = require("@xylabs/react-flexbox");
234
+
235
+ // src/img/index.ts
236
+ var import_xyo_color_logo = __toESM(require("./xyo-color-logo-LHR2SMEM.svg"), 1);
237
+ var import_xyo_color_logo_text_only = __toESM(require("./xyo-color-logo-text-only-QPAW5BSQ.svg"), 1);
238
+
239
+ // src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx
240
+ var import_jsx_runtime2 = require("react/jsx-runtime");
241
+ var LinkedProvidersFlexbox = ({ icon, providerName, ...props }) => {
242
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexRow, { gap: 4, justifyContent: "space-evenly", ...props, children: [
243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexCol, { gap: 0.5, children: [
244
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { alt: "XYO Logo", src: import_xyo_color_logo.default, style: { height: "48px" } }),
245
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "subtitle1", children: "XYO App" })
246
+ ] }),
247
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SyncAlt, { fontSize: "large" }),
248
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexCol, { gap: 0.5, children: [
249
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_crypto3.ConstrainedImage, { constrainedValue: "48px", src: icon, alt: providerName, style: { height: "48px", maxWidth: "48px" } }),
250
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "subtitle1", children: providerName })
251
+ ] })
252
+ ] });
253
+ };
254
+
255
+ // src/components/wallet/dialogs/connect/Permissions.tsx
256
+ var import_material3 = require("@mui/material");
257
+ var import_react_flexbox2 = require("@xylabs/react-flexbox");
258
+ var import_jsx_runtime3 = require("react/jsx-runtime");
259
+ var WalletPermissionsFlexbox = (props) => {
260
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_flexbox2.FlexCol, { gap: 4, ...props, children: [
261
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Typography, { fontWeight: "bold", sx: { textAlign: "center" }, children: "This will allow XYO to:" }),
262
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ul", { children: [
263
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: "View your wallet account(s) and address(es)" }),
264
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: "Read-only access to browse the public blockchain(s) you select" })
265
+ ] }),
266
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_material3.Typography, { variant: "subtitle1", sx: { textAlign: "center" }, children: [
267
+ "You control what accounts to share and what blockchains to view. You can see or revoke access via your wallet's settings at anytime. View more on XYO's sovereign data philosophy",
268
+ " ",
269
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
270
+ import_material3.Link,
271
+ {
272
+ href: "https://cointelegraph.com/innovation-circle/decentralization-and-sovereignty-debunking-our-approach-to-digital-sovereignty",
273
+ sx: { fontWeight: "bold" },
274
+ target: "_blank",
275
+ children: "here"
276
+ }
277
+ ),
278
+ "."
279
+ ] })
280
+ ] });
281
+ };
282
+
283
+ // src/components/wallet/dialogs/connect/Dialog.tsx
284
+ var import_jsx_runtime4 = require("react/jsx-runtime");
285
+ var ConnectWalletDialog = ({ activeProvider, onIgnoreConnectDialog, ...props }) => {
286
+ const { icon, providerName } = activeProvider ?? {};
287
+ const onConnect = async () => {
288
+ try {
289
+ await activeProvider?.connectWallet?.();
290
+ props.onClose?.({}, "escapeKeyDown");
291
+ } catch (e) {
292
+ console.warn(`Error connecting to wallet: ${e.message}`);
293
+ }
294
+ };
295
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material4.Dialog, { PaperProps: { sx: { display: "flex", gap: 4 } }, ...props, children: [
296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.DialogTitle, { sx: { textAlign: "center" }, children: "XYO Wants To Access The Blockchain on Your Behalf" }),
297
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material4.DialogContent, { sx: { display: "flex", flexDirection: "column", gap: 4 }, children: [
298
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LinkedProvidersFlexbox, { icon, providerName }),
299
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(WalletPermissionsFlexbox, {}),
300
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckboxFormControl, { onCheckChanged: onIgnoreConnectDialog })
301
+ ] }),
302
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material4.DialogActions, { children: [
303
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Button, { variant: "outlined", onClick: () => props.onClose?.({}, "escapeKeyDown"), children: "Close" }),
304
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Button, { variant: "contained", onClick: onConnect, children: "Connect" })
305
+ ] })
306
+ ] });
307
+ };
308
+
309
+ // src/components/wallet/dialogs/revoke/Dialog.tsx
310
+ var import_material5 = require("@mui/material");
311
+ var import_react_crypto4 = require("@xylabs/react-crypto");
312
+ var import_react_flexbox3 = require("@xylabs/react-flexbox");
313
+ var import_jsx_runtime5 = require("react/jsx-runtime");
314
+ var RevokeWalletConnectionDialog = ({ activeProvider, ...props }) => {
315
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Dialog, { ...props, children: [
316
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox3.FlexRow, { gap: 2, justifyContent: "start", pl: 2, children: [
317
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_crypto4.ConstrainedImage, { src: activeProvider?.icon, constrainedValue: "24px" }),
318
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.DialogTitle, { sx: { pl: 0 }, children: [
319
+ "Revoke ",
320
+ activeProvider?.providerName,
321
+ " Access"
322
+ ] })
323
+ ] }),
324
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.DialogContent, { children: [
325
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Typography, { children: [
326
+ "Revoking access to your wallet must be done from the wallet's browser extension. Wallets grant access to specific domains please consult ",
327
+ activeProvider?.providerName,
328
+ "'s documentation on how to revoke access to this website:"
329
+ ] }),
330
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.Typography, { children: window.location.origin })
331
+ ] }),
332
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.DialogActions, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.Button, { variant: "contained", onClick: () => props.onClose?.({}, "escapeKeyDown"), children: "Close" }) })
333
+ ] });
334
+ };
335
+
336
+ // src/components/wallet/table/cells/Accounts.tsx
337
+ var import_material6 = require("@mui/material");
338
+ var import_jsx_runtime6 = require("react/jsx-runtime");
339
+ var ConnectedWalletsAccountsTableCell = ({
340
+ additionalAccounts,
341
+ currentAccount,
342
+ totalAccounts,
343
+ tableCellProps
344
+ }) => {
345
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material6.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
346
+ import_material6.Tooltip,
347
+ {
348
+ sx: { cursor: totalAccounts > 0 ? "pointer" : "auto" },
349
+ title: [...currentAccount ?? [], ...additionalAccounts ?? []].map((address, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: address }, index)),
350
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material6.Typography, { children: totalAccounts })
351
+ }
352
+ ) });
353
+ };
354
+
355
+ // src/components/wallet/table/cells/Actions.tsx
356
+ var import_icons_material2 = require("@mui/icons-material");
357
+ var import_material7 = require("@mui/material");
358
+ var import_react_flexbox4 = require("@xylabs/react-flexbox");
359
+ var import_jsx_runtime7 = require("react/jsx-runtime");
360
+ var ConnectedWalletsActionsTableCell = ({ connected, onConnect, onRevoke, tableCellProps }) => {
361
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material7.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_flexbox4.FlexRow, { gap: 2, justifyContent: "start", children: [
362
+ connected ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material7.Typography, { sx: { display: "inline-flex", gap: 0.5 }, children: [
363
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_material2.Check, {}),
364
+ "Connected"
365
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material7.Button, { variant: "contained", onClick: onConnect, children: "Connect" }),
366
+ connected ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material7.IconButton, { onClick: onRevoke, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_material2.InfoOutlined, {}) }) : null
367
+ ] }) });
368
+ };
369
+
370
+ // src/components/wallet/table/cells/ChainName.tsx
371
+ var import_material8 = require("@mui/material");
372
+ var import_jsx_runtime8 = require("react/jsx-runtime");
373
+ var ConnectedWalletsChainNameTableCell = ({ chainName, tableCellProps }) => {
374
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material8.TableCell, { ...tableCellProps, children: chainName });
375
+ };
376
+
377
+ // src/components/wallet/table/cells/State.tsx
378
+ var import_material9 = require("@mui/material");
379
+ var import_react3 = require("react");
380
+ var import_jsx_runtime9 = require("react/jsx-runtime");
381
+ var ConnectedWalletState = ({ connected, walletRdns, tableCellProps }) => {
382
+ const { disableWallet, enableWallet, wallets } = useEnabledWallets();
383
+ const enabled = (0, import_react3.useMemo)(() => walletRdns ? wallets[walletRdns].enabled : false, [wallets, walletRdns]);
384
+ const handleClick = (event) => {
385
+ const checked = event.target?.checked;
386
+ if (walletRdns) {
387
+ checked ? enableWallet?.(walletRdns) : disableWallet?.(walletRdns);
388
+ }
389
+ };
390
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material9.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material9.Switch, { disabled: !connected, checked: connected && enabled, onChange: handleClick }) });
391
+ };
392
+
393
+ // src/components/wallet/table/cells/Wallet.tsx
394
+ var import_material10 = require("@mui/material");
395
+ var import_react_crypto5 = require("@xylabs/react-crypto");
396
+ var import_react_flexbox5 = require("@xylabs/react-flexbox");
397
+ var import_jsx_runtime10 = require("react/jsx-runtime");
398
+ var ConnectedWalletsWalletTableCell = ({ icon, walletName, tableCellProps }) => {
399
+ const theme = (0, import_material10.useTheme)();
400
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material10.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_flexbox5.FlexRow, { gap: 2, justifyContent: "start", children: [
401
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_crypto5.ConstrainedImage, { constrainedValue: theme.spacing(4), src: icon }),
402
+ walletName
403
+ ] }) });
404
+ };
405
+
406
+ // src/components/wallet/table/cells/Cells.tsx
407
+ var ConnectedWalletTableCells = [
408
+ ConnectedWalletsWalletTableCell,
409
+ ConnectedWalletsChainNameTableCell,
410
+ ConnectedWalletsAccountsTableCell,
411
+ ConnectedWalletsActionsTableCell,
412
+ ConnectedWalletState
413
+ ];
414
+
415
+ // src/components/wallet/table/ConnectedWalletsTable.tsx
416
+ var import_material12 = require("@mui/material");
417
+ var import_react6 = require("react");
418
+
419
+ // src/components/wallet/lib/TableHeadData.ts
420
+ var WalletsTableHeadCells = [
421
+ {
422
+ disablePadding: false,
423
+ id: "wallet",
424
+ label: "Wallet",
425
+ numeric: false,
426
+ showOnMobile: true
427
+ },
428
+ {
429
+ disablePadding: false,
430
+ id: "chain",
431
+ label: "Chain",
432
+ numeric: false,
433
+ showOnMobile: true
434
+ },
435
+ {
436
+ disablePadding: false,
437
+ id: "accounts",
438
+ label: "Accounts",
439
+ numeric: true,
440
+ showOnMobile: true
441
+ },
442
+ {
443
+ disablePadding: false,
444
+ id: "actions",
445
+ label: "Actions",
446
+ numeric: false,
447
+ showOnMobile: true
448
+ },
449
+ {
450
+ disablePadding: false,
451
+ id: "enabled",
452
+ label: "Enabled",
453
+ numeric: false,
454
+ showOnMobile: true
455
+ }
456
+ ];
457
+
458
+ // src/components/wallet/table/ConnectedWalletsTableRow.tsx
459
+ var import_material11 = require("@mui/material");
460
+ var import_react_crypto6 = require("@xylabs/react-crypto");
461
+ var import_react4 = require("react");
462
+ var import_jsx_runtime11 = require("react/jsx-runtime");
463
+ var WalletConnectionsTableRow = ({
464
+ ignoreConnectDialog,
465
+ onConnectClick,
466
+ onRevoke,
467
+ wallet,
468
+ ...props
469
+ }) => {
470
+ const { currentAccount: currentAccountFromWallet, additionalAccounts, chainName, connectWallet, providerInfo } = (0, import_react_crypto6.useEthWallet)(wallet);
471
+ const currentAccount = currentAccountFromWallet?.toString() ? [currentAccountFromWallet.toString()] : [];
472
+ const totalAccounts = (additionalAccounts?.length ?? 0) + (currentAccount?.length ?? 0);
473
+ const connected = !!(currentAccount?.length ?? 0 > 0);
474
+ const { icon, name, rdns } = (0, import_react4.useMemo)(() => providerInfo ?? { icon: void 0, name: void 0, rdns: void 0 }, [providerInfo]);
475
+ const activeProvider = (0, import_react4.useMemo)(
476
+ () => ({
477
+ connectWallet,
478
+ icon,
479
+ providerName: name
480
+ }),
481
+ [connectWallet, icon, name]
482
+ );
483
+ const onRevokeLocal = (0, import_react4.useCallback)(() => {
484
+ onRevoke?.(activeProvider);
485
+ }, [activeProvider, onRevoke]);
486
+ const onConnectLocal = (0, import_react4.useCallback)(async () => {
487
+ if (ignoreConnectDialog) {
488
+ await connectWallet?.();
489
+ } else {
490
+ onConnectClick?.(activeProvider);
491
+ }
492
+ }, [activeProvider, connectWallet, ignoreConnectDialog, onConnectClick]);
493
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material11.TableRow, { ...props, children: Object.values(ConnectedWalletTableCells).map((Cell, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
494
+ Cell,
495
+ {
496
+ additionalAccounts,
497
+ chainName,
498
+ connected,
499
+ currentAccount,
500
+ icon,
501
+ onConnect: onConnectLocal,
502
+ onRevoke: onRevokeLocal,
503
+ totalAccounts,
504
+ walletName: name,
505
+ walletRdns: rdns
506
+ },
507
+ index
508
+ )) });
509
+ };
510
+
511
+ // src/components/wallet/table/hooks/useActiveProviderDialogState.tsx
512
+ var import_react5 = require("react");
513
+ var useActiveProviderDialogState = (setActiveProvider) => {
514
+ const [show, setShow] = (0, import_react5.useState)(false);
515
+ const onSetActiveProvider = (activeProvider) => {
516
+ setShow(true);
517
+ setActiveProvider(activeProvider);
518
+ };
519
+ const onClose = () => {
520
+ setShow(false);
521
+ setActiveProvider({});
522
+ };
523
+ return [show, onSetActiveProvider, onClose];
524
+ };
525
+
526
+ // src/components/wallet/table/ConnectedWalletsTable.tsx
527
+ var import_jsx_runtime12 = require("react/jsx-runtime");
528
+ var ConnectedWalletsTable = ({ ignoreConnectDialog, onIgnoreConnectDialog, wallets, ...props }) => {
529
+ const [activeProvider, setActiveProvider] = (0, import_react6.useState)();
530
+ const [showConnect, onSetActiveProviderConnect, onConnectClose] = useActiveProviderDialogState(setActiveProvider);
531
+ const [showRevoke, onSetActiveProviderRevoke, onRevokeClose] = useActiveProviderDialogState(setActiveProvider);
532
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
533
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_material12.Table, { ...props, children: [
534
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableRow, { children: WalletsTableHeadCells.map(({ disablePadding, id, label, align, width }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableCell, { align, padding: disablePadding ? "none" : "normal", width: width ?? "auto", children: label }, id)) }) }),
535
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableBody, { children: (wallets ?? []).map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
536
+ WalletConnectionsTableRow,
537
+ {
538
+ ignoreConnectDialog,
539
+ onConnectClick: onSetActiveProviderConnect,
540
+ onRevoke: onSetActiveProviderRevoke,
541
+ wallet
542
+ },
543
+ wallet.providerInfo?.rdns
544
+ )) })
545
+ ] }),
546
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RevokeWalletConnectionDialog, { open: showRevoke, onClose: onRevokeClose, activeProvider }),
547
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
548
+ ConnectWalletDialog,
549
+ {
550
+ activeProvider,
551
+ onClose: onConnectClose,
552
+ open: showConnect,
553
+ onIgnoreConnectDialog
554
+ }
555
+ )
556
+ ] });
557
+ };
558
+
559
+ // src/components/ConnectedAccountsFlexbox.tsx
560
+ var import_jsx_runtime13 = require("react/jsx-runtime");
561
+ var ConnectedAccountsFlexbox = (0, import_react7.forwardRef)(
562
+ ({ ignoreConnectDialog, onIgnoreConnectDialog, ...props }, ref) => {
563
+ const theme = (0, import_material13.useTheme)();
564
+ const { totalConnectedAccounts, sortedWallets } = useDetectedWallets();
565
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_flexbox6.FlexCol, { alignItems: "stretch", justifyContent: "start", gap: 2, ref, ...props, children: [
566
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_flexbox6.FlexCol, { alignItems: "start", children: [
567
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material13.Typography, { variant: "h2", sx: { mb: 0.5 }, children: "Detected Web3 Wallets" }),
568
+ totalConnectedAccounts ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material13.Typography, { variant: "subtitle1", color: theme.palette.secondary.main, sx: { opacity: 0.5 }, children: [
569
+ "Total Connected Accounts: ",
570
+ totalConnectedAccounts
571
+ ] }) : null
572
+ ] }),
573
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ConnectedWalletsTable, { wallets: sortedWallets, ignoreConnectDialog, onIgnoreConnectDialog })
574
+ ] });
575
+ }
576
+ );
577
+ ConnectedAccountsFlexbox.displayName = "ConnectedAccountsFlexbox";
578
+ //# sourceMappingURL=index.cjs.map