@mysten/dapp-kit 0.4.0 → 0.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -4
  3. package/dist/cjs/components/AccountDropdownMenu.d.ts +4 -0
  4. package/dist/cjs/components/AccountDropdownMenu.js +28 -13
  5. package/dist/cjs/components/AccountDropdownMenu.js.map +2 -2
  6. package/dist/cjs/components/ConnectButton.js +26 -12
  7. package/dist/cjs/components/ConnectButton.js.map +2 -2
  8. package/dist/cjs/components/SuiClientProvider.d.ts +4 -4
  9. package/dist/cjs/components/SuiClientProvider.js +1 -0
  10. package/dist/cjs/components/SuiClientProvider.js.map +2 -2
  11. package/dist/cjs/components/WalletProvider.js.map +2 -2
  12. package/dist/cjs/hooks/networkConfig.d.ts +10 -0
  13. package/dist/cjs/hooks/networkConfig.js +74 -0
  14. package/dist/cjs/hooks/networkConfig.js.map +7 -0
  15. package/dist/cjs/hooks/useResolveSuiNSNames.d.ts +7 -5
  16. package/dist/cjs/hooks/useResolveSuiNSNames.js +4 -3
  17. package/dist/cjs/hooks/useResolveSuiNSNames.js.map +2 -2
  18. package/dist/cjs/hooks/useSuiClient.js.map +2 -2
  19. package/dist/cjs/hooks/useSuiClientInfiniteQuery.js.map +2 -2
  20. package/dist/cjs/hooks/useSuiClientMutation.js.map +2 -2
  21. package/dist/cjs/hooks/useSuiClientQuery.js.map +2 -2
  22. package/dist/cjs/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
  23. package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  24. package/dist/cjs/index.css +127 -127
  25. package/dist/cjs/index.css.map +3 -3
  26. package/dist/cjs/index.d.ts +13 -10
  27. package/dist/cjs/index.js +601 -555
  28. package/dist/cjs/index.js.map +4 -4
  29. package/dist/esm/components/AccountDropdownMenu.d.ts +4 -0
  30. package/dist/esm/components/AccountDropdownMenu.js +28 -13
  31. package/dist/esm/components/AccountDropdownMenu.js.map +2 -2
  32. package/dist/esm/components/ConnectButton.js +26 -12
  33. package/dist/esm/components/ConnectButton.js.map +2 -2
  34. package/dist/esm/components/SuiClientProvider.d.ts +4 -4
  35. package/dist/esm/components/SuiClientProvider.js +1 -0
  36. package/dist/esm/components/SuiClientProvider.js.map +2 -2
  37. package/dist/esm/components/WalletProvider.js.map +2 -2
  38. package/dist/esm/hooks/networkConfig.d.ts +10 -0
  39. package/dist/esm/hooks/networkConfig.js +51 -0
  40. package/dist/esm/hooks/networkConfig.js.map +7 -0
  41. package/dist/esm/hooks/useResolveSuiNSNames.d.ts +7 -5
  42. package/dist/esm/hooks/useResolveSuiNSNames.js +4 -3
  43. package/dist/esm/hooks/useResolveSuiNSNames.js.map +2 -2
  44. package/dist/esm/hooks/useSuiClient.js.map +2 -2
  45. package/dist/esm/hooks/useSuiClientInfiniteQuery.js.map +2 -2
  46. package/dist/esm/hooks/useSuiClientMutation.js.map +2 -2
  47. package/dist/esm/hooks/useSuiClientQuery.js.map +2 -2
  48. package/dist/esm/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
  49. package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  50. package/dist/esm/index.css +127 -127
  51. package/dist/esm/index.css.map +3 -3
  52. package/dist/esm/index.d.ts +13 -10
  53. package/dist/esm/index.js +608 -562
  54. package/dist/esm/index.js.map +4 -4
  55. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +1 -1
  58. package/src/components/AccountDropdownMenu.tsx +26 -8
  59. package/src/components/SuiClientProvider.tsx +11 -2
  60. package/src/hooks/networkConfig.ts +45 -0
  61. package/src/hooks/useResolveSuiNSNames.ts +12 -2
  62. package/src/index.ts +13 -10
package/dist/cjs/index.js CHANGED
@@ -68,12 +68,14 @@ __export(src_exports, {
68
68
  SuiClientContext: () => SuiClientContext,
69
69
  SuiClientProvider: () => SuiClientProvider,
70
70
  WalletProvider: () => WalletProvider,
71
+ createNetworkConfig: () => createNetworkConfig,
71
72
  lightTheme: () => lightTheme,
72
73
  useAccounts: () => useAccounts,
73
74
  useConnectWallet: () => useConnectWallet,
74
75
  useCurrentAccount: () => useCurrentAccount,
75
76
  useCurrentWallet: () => useCurrentWallet,
76
77
  useDisconnectWallet: () => useDisconnectWallet,
78
+ useResolveSuiNSName: () => useResolveSuiNSName,
77
79
  useSignAndExecuteTransactionBlock: () => useSignAndExecuteTransactionBlock,
78
80
  useSignPersonalMessage: () => useSignPersonalMessage,
79
81
  useSignTransactionBlock: () => useSignTransactionBlock,
@@ -87,134 +89,13 @@ __export(src_exports, {
87
89
  });
88
90
  module.exports = __toCommonJS(src_exports);
89
91
 
90
- // src/hooks/useSuiClient.ts
91
- var import_react2 = require("react");
92
-
93
- // src/components/SuiClientProvider.tsx
94
- var import_client = require("@mysten/sui.js/client");
95
- var import_react = require("react");
96
- var import_jsx_runtime = require("react/jsx-runtime");
97
- var SuiClientContext = (0, import_react.createContext)(null);
98
- var DEFAULT_NETWORKS = {
99
- localnet: { url: (0, import_client.getFullnodeUrl)("localnet") }
100
- };
101
- var DEFAULT_CREATE_CLIENT = function createClient(_name, config) {
102
- if ((0, import_client.isSuiClient)(config)) {
103
- return config;
104
- }
105
- return new import_client.SuiClient(config);
106
- };
107
- function SuiClientProvider(props) {
108
- const { onNetworkChange, network, children } = props;
109
- const networks = props.networks ?? DEFAULT_NETWORKS;
110
- const createClient2 = props.createClient ?? DEFAULT_CREATE_CLIENT;
111
- const [selectedNetwork, setSelectedNetwork] = (0, import_react.useState)(
112
- props.network ?? props.defaultNetwork ?? Object.keys(networks)[0]
113
- );
114
- const currentNetwork = props.network ?? selectedNetwork;
115
- const client = (0, import_react.useMemo)(() => {
116
- return createClient2(currentNetwork, networks[currentNetwork]);
117
- }, [createClient2, currentNetwork, networks]);
118
- const ctx = (0, import_react.useMemo)(() => {
119
- return {
120
- client,
121
- networks,
122
- network: currentNetwork,
123
- selectNetwork: (newNetwork) => {
124
- if (currentNetwork === newNetwork) {
125
- return;
126
- }
127
- if (!network && newNetwork !== selectedNetwork) {
128
- setSelectedNetwork(newNetwork);
129
- }
130
- onNetworkChange?.(newNetwork);
131
- }
132
- };
133
- }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);
134
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuiClientContext.Provider, { value: ctx, children });
135
- }
136
-
137
- // src/hooks/useSuiClient.ts
138
- function useSuiClientContext() {
139
- const suiClient = (0, import_react2.useContext)(SuiClientContext);
140
- if (!suiClient) {
141
- throw new Error(
142
- "Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider"
143
- );
144
- }
145
- return suiClient;
146
- }
147
- function useSuiClient() {
148
- return useSuiClientContext().client;
149
- }
150
-
151
- // src/hooks/wallet/useWalletStore.ts
152
- var import_react4 = require("react");
153
- var import_zustand = require("zustand");
154
-
155
- // src/contexts/walletContext.ts
156
- var import_react3 = require("react");
157
- var WalletContext = (0, import_react3.createContext)(null);
158
-
159
- // src/hooks/wallet/useWalletStore.ts
160
- function useWalletStore(selector) {
161
- const store = (0, import_react4.useContext)(WalletContext);
162
- if (!store) {
163
- throw new Error(
164
- "Could not find WalletContext. Ensure that you have set up the WalletProvider."
165
- );
166
- }
167
- return (0, import_zustand.useStore)(store, selector);
168
- }
169
-
170
- // src/hooks/wallet/useCurrentAccount.ts
171
- function useCurrentAccount() {
172
- return useWalletStore((state) => state.currentAccount);
173
- }
174
-
175
- // src/components/AccountDropdownMenu.tsx
176
- var import_utils = require("@mysten/sui.js/utils");
177
- var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
178
- var import_clsx3 = __toESM(require("clsx"));
92
+ // src/components/connect-modal/ConnectModal.tsx
93
+ var Dialog = __toESM(require("@radix-ui/react-dialog"));
94
+ var import_clsx6 = __toESM(require("clsx"));
95
+ var import_react8 = require("react");
179
96
 
180
- // src/hooks/useSuiClientQuery.ts
97
+ // src/hooks/wallet/useConnectWallet.ts
181
98
  var import_react_query = require("@tanstack/react-query");
182
- function useSuiClientQuery(...args) {
183
- const [method, params, { queryKey = [], ...options } = {}] = args;
184
- const suiContext = useSuiClientContext();
185
- return (0, import_react_query.useQuery)({
186
- ...options,
187
- queryKey: [suiContext.network, method, params, ...queryKey],
188
- queryFn: async () => {
189
- return await suiContext.client[method](params);
190
- }
191
- });
192
- }
193
-
194
- // src/hooks/useResolveSuiNSNames.ts
195
- function useResolveSuiNSName(address) {
196
- const { data, ...rest } = useSuiClientQuery(
197
- "resolveNameServiceNames",
198
- {
199
- address,
200
- limit: 1
201
- },
202
- {
203
- enabled: !!address,
204
- refetchOnWindowFocus: false,
205
- retry: false
206
- }
207
- );
208
- return { data: data?.data?.[0] ?? null, ...rest };
209
- }
210
-
211
- // src/hooks/wallet/useAccounts.ts
212
- function useAccounts() {
213
- return useWalletStore((state) => state.accounts);
214
- }
215
-
216
- // src/hooks/wallet/useDisconnectWallet.ts
217
- var import_react_query2 = require("@tanstack/react-query");
218
99
 
219
100
  // src/constants/walletMutationKeys.ts
220
101
  var walletMutationKeys = {
@@ -232,237 +113,32 @@ function formMutationKeyFn(baseEntity) {
232
113
  };
233
114
  }
234
115
 
235
- // src/errors/walletErrors.ts
236
- var WalletNotConnectedError = class extends Error {
237
- };
238
- var WalletNoAccountSelectedError = class extends Error {
239
- };
240
- var WalletFeatureNotSupportedError = class extends Error {
241
- };
242
- var WalletAccountNotFoundError = class extends Error {
243
- };
244
-
245
- // src/hooks/wallet/useCurrentWallet.ts
246
- function useCurrentWallet() {
247
- return useWalletStore((state) => state.currentWallet);
248
- }
249
-
250
- // src/hooks/wallet/useDisconnectWallet.ts
251
- function useDisconnectWallet({
252
- mutationKey,
253
- ...mutationOptions
254
- } = {}) {
255
- const currentWallet = useCurrentWallet();
256
- const setWalletDisconnected = useWalletStore((state) => state.setWalletDisconnected);
257
- return (0, import_react_query2.useMutation)({
258
- mutationKey: walletMutationKeys.disconnectWallet(mutationKey),
259
- mutationFn: async () => {
260
- if (!currentWallet) {
261
- throw new WalletNotConnectedError("No wallet is connected.");
262
- }
263
- try {
264
- await currentWallet.features["standard:disconnect"]?.disconnect();
265
- } catch (error) {
266
- console.error("Failed to disconnect the application from the current wallet.", error);
267
- }
268
- setWalletDisconnected();
269
- },
270
- ...mutationOptions
271
- });
272
- }
273
-
274
- // src/hooks/wallet/useSwitchAccount.ts
275
- var import_react_query3 = require("@tanstack/react-query");
276
- function useSwitchAccount({
277
- mutationKey,
278
- ...mutationOptions
279
- } = {}) {
280
- const currentWallet = useCurrentWallet();
281
- const setAccountSwitched = useWalletStore((state) => state.setAccountSwitched);
282
- return (0, import_react_query3.useMutation)({
283
- mutationKey: walletMutationKeys.switchAccount(mutationKey),
284
- mutationFn: async ({ account }) => {
285
- if (!currentWallet) {
286
- throw new WalletNotConnectedError("No wallet is connected.");
287
- }
288
- const accountToSelect = currentWallet.accounts.find(
289
- (walletAccount) => walletAccount.address === account.address
290
- );
291
- if (!accountToSelect) {
292
- throw new WalletAccountNotFoundError(
293
- `No account with address ${account.address} is connected to ${currentWallet.name}.`
294
- );
295
- }
296
- setAccountSwitched(accountToSelect);
297
- },
298
- ...mutationOptions
299
- });
300
- }
301
-
302
- // src/components/AccountDropdownMenu.css.ts
303
- var connectedAccount = "AccountDropdownMenu_connectedAccount__div2ql0";
304
- var menuContent = "AccountDropdownMenu_menuContent__div2ql1";
305
- var menuItem = "AccountDropdownMenu_menuItem__div2ql2";
306
- var separator = "AccountDropdownMenu_separator__div2ql4";
307
- var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
308
-
309
- // src/components/icons/CheckIcon.tsx
310
- var import_jsx_runtime2 = require("react/jsx-runtime");
311
- function CheckIcon(props) {
312
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
313
- "path",
314
- {
315
- fill: "currentColor",
316
- d: "m11.726 5.048-4.73 5.156-1.722-1.879a.72.72 0 0 0-.529-.23.722.722 0 0 0-.525.24.858.858 0 0 0-.22.573.86.86 0 0 0 .211.576l2.255 2.458c.14.153.332.24.53.24.2 0 .391-.087.532-.24l5.261-5.735A.86.86 0 0 0 13 5.63a.858.858 0 0 0-.22-.572.722.722 0 0 0-.525-.24.72.72 0 0 0-.529.23Z"
317
- }
318
- ) });
319
- }
320
-
321
- // src/components/icons/ChevronIcon.tsx
322
- var import_jsx_runtime3 = require("react/jsx-runtime");
323
- function ChevronIcon(props) {
324
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
325
- "path",
326
- {
327
- stroke: "#A0B6C3",
328
- strokeLinecap: "round",
329
- strokeLinejoin: "round",
330
- strokeWidth: 1.5,
331
- d: "m4 6 4 4 4-4"
332
- }
333
- ) });
334
- }
335
-
336
- // src/components/styling/StyleMarker.tsx
337
- var import_react_slot = require("@radix-ui/react-slot");
338
- var import_react5 = require("react");
339
-
340
- // src/constants/styleDataAttribute.ts
341
- var styleDataAttributeName = "data-dapp-kit";
342
- var styleDataAttributeSelector = `[${styleDataAttributeName}]`;
343
- var styleDataAttribute = { [styleDataAttributeName]: "" };
344
-
345
- // src/components/styling/StyleMarker.tsx
346
- var import_StyleMarker_css = __toESM(require_StyleMarker_css());
347
- var import_jsx_runtime4 = require("react/jsx-runtime");
348
- var StyleMarker = (0, import_react5.forwardRef)(({ children }, forwardedRef) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_slot.Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
349
- StyleMarker.displayName = "StyleMarker";
350
-
351
- // src/components/ui/Button.tsx
352
- var import_react_slot2 = require("@radix-ui/react-slot");
353
- var import_clsx = __toESM(require("clsx"));
354
- var import_react6 = require("react");
355
-
356
- // src/components/ui/Button.css.ts
357
- var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
358
- var buttonVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "Button_buttonVariants__x1s81q0", variantClassNames: { variant: { primary: "Button_buttonVariants_variant_primary__x1s81q1", outline: "Button_buttonVariants_variant_outline__x1s81q2" }, size: { md: "Button_buttonVariants_size_md__x1s81q3", lg: "Button_buttonVariants_size_lg__x1s81q4" } }, defaultVariants: { variant: "primary", size: "md" }, compoundVariants: [] });
359
-
360
- // src/components/ui/Button.tsx
361
- var import_jsx_runtime5 = require("react/jsx-runtime");
362
- var Button = (0, import_react6.forwardRef)(
363
- ({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
364
- const Comp = asChild ? import_react_slot2.Slot : "button";
365
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
366
- Comp,
367
- {
368
- ...props,
369
- className: (0, import_clsx.default)(buttonVariants({ variant, size }), className),
370
- ref: forwardedRef
371
- }
372
- );
373
- }
374
- );
375
- Button.displayName = "Button";
376
-
377
- // src/components/ui/Text.tsx
378
- var import_react_slot3 = require("@radix-ui/react-slot");
379
- var import_clsx2 = __toESM(require("clsx"));
380
- var import_react7 = require("react");
116
+ // src/hooks/wallet/useWalletStore.ts
117
+ var import_react2 = require("react");
118
+ var import_zustand = require("zustand");
381
119
 
382
- // src/components/ui/Text.css.ts
383
- var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
384
- var textVariants = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "Text__2bv1ur0", variantClassNames: { size: { sm: "Text_textVariants_size_sm__2bv1ur1" }, weight: { normal: "Text_textVariants_weight_normal__2bv1ur2", medium: "Text_textVariants_weight_medium__2bv1ur3", bold: "Text_textVariants_weight_bold__2bv1ur4" }, color: { muted: "Text_textVariants_color_muted__2bv1ur5", danger: "Text_textVariants_color_danger__2bv1ur6" }, mono: { true: "Text_textVariants_mono_true__2bv1ur7" } }, defaultVariants: { size: "sm", weight: "normal" }, compoundVariants: [] });
120
+ // src/contexts/walletContext.ts
121
+ var import_react = require("react");
122
+ var WalletContext = (0, import_react.createContext)(null);
385
123
 
386
- // src/components/ui/Text.tsx
387
- var import_jsx_runtime6 = require("react/jsx-runtime");
388
- var Text = (0, import_react7.forwardRef)(
389
- ({
390
- children,
391
- className,
392
- asChild = false,
393
- as: Tag = "div",
394
- size,
395
- weight,
396
- color,
397
- mono,
398
- ...textProps
399
- }, forwardedRef) => {
400
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
401
- import_react_slot3.Slot,
402
- {
403
- ...textProps,
404
- ref: forwardedRef,
405
- className: (0, import_clsx2.default)(textVariants({ size, weight, color, mono }), className),
406
- children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tag, { children })
407
- }
124
+ // src/hooks/wallet/useWalletStore.ts
125
+ function useWalletStore(selector) {
126
+ const store = (0, import_react2.useContext)(WalletContext);
127
+ if (!store) {
128
+ throw new Error(
129
+ "Could not find WalletContext. Ensure that you have set up the WalletProvider."
408
130
  );
409
131
  }
410
- );
411
- Text.displayName = "Text";
412
-
413
- // src/components/AccountDropdownMenu.tsx
414
- var import_jsx_runtime7 = require("react/jsx-runtime");
415
- function AccountDropdownMenu({ currentAccount }) {
416
- const { mutate: disconnectWallet } = useDisconnectWallet();
417
- const { mutate: switchAccount } = useSwitchAccount();
418
- const { data: domain } = useResolveSuiNSName(
419
- currentAccount.label ? null : currentAccount.address
420
- );
421
- const accounts = useAccounts();
422
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu.Root, { modal: false, children: [
423
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { size: "lg", className: connectedAccount, children: [
424
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { mono: true, weight: "bold", children: currentAccount.label ?? domain ?? (0, import_utils.formatAddress)(currentAccount.address) }),
425
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronIcon, {})
426
- ] }) }) }),
427
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu.Content, { className: menuContent, children: [
428
- accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
429
- DropdownMenu.Item,
430
- {
431
- className: (0, import_clsx3.default)(menuItem, switchAccountMenuItem),
432
- onSelect: () => switchAccount({ account }),
433
- children: [
434
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { mono: true, children: account.label ?? (0, import_utils.formatAddress)(account.address) }),
435
- currentAccount.address === account.address ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, {}) : null
436
- ]
437
- },
438
- account.address
439
- )),
440
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Separator, { className: separator }),
441
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
442
- DropdownMenu.Item,
443
- {
444
- className: (0, import_clsx3.default)(menuItem),
445
- onSelect: () => disconnectWallet(),
446
- children: "Disconnect"
447
- }
448
- )
449
- ] }) }) })
450
- ] });
132
+ return (0, import_zustand.useStore)(store, selector);
451
133
  }
452
134
 
453
- // src/components/connect-modal/ConnectModal.tsx
454
- var Dialog = __toESM(require("@radix-ui/react-dialog"));
455
- var import_clsx7 = __toESM(require("clsx"));
456
- var import_react10 = require("react");
457
-
458
135
  // src/hooks/wallet/useConnectWallet.ts
459
- var import_react_query4 = require("@tanstack/react-query");
460
136
  function useConnectWallet({
461
137
  mutationKey,
462
138
  ...mutationOptions
463
139
  } = {}) {
464
140
  const setWalletConnected = useWalletStore((state) => state.setWalletConnected);
465
- return (0, import_react_query4.useMutation)({
141
+ return (0, import_react_query.useMutation)({
466
142
  mutationKey: walletMutationKeys.connectWallet(mutationKey),
467
143
  mutationFn: async ({ wallet, accountAddress, ...standardConnectInput }) => {
468
144
  const connectResult = await wallet.features["standard:connect"].connect(standardConnectInput);
@@ -488,9 +164,9 @@ function getSelectedAccount(connectedAccounts, accountAddress) {
488
164
  }
489
165
 
490
166
  // src/components/icons/BackIcon.tsx
491
- var import_jsx_runtime8 = require("react/jsx-runtime");
167
+ var import_jsx_runtime = require("react/jsx-runtime");
492
168
  function BackIcon(props) {
493
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
169
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
494
170
  "path",
495
171
  {
496
172
  d: "M7.57 12.262c0 .341.13.629.403.895l5.175 5.059c.204.205.45.307.751.307.609 0 1.101-.485 1.101-1.087 0-.293-.123-.574-.349-.8L10.14 12.27l4.511-4.375A1.13 1.13 0 0 0 15 7.087C15 6.485 14.508 6 13.9 6c-.295 0-.54.103-.752.308l-5.175 5.058c-.28.28-.404.56-.404.896Z",
@@ -500,9 +176,9 @@ function BackIcon(props) {
500
176
  }
501
177
 
502
178
  // src/components/icons/CloseIcon.tsx
503
- var import_jsx_runtime9 = require("react/jsx-runtime");
179
+ var import_jsx_runtime2 = require("react/jsx-runtime");
504
180
  function CloseIcon(props) {
505
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
181
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
506
182
  "path",
507
183
  {
508
184
  d: "M9.708.292a.999.999 0 0 0-1.413 0l-3.289 3.29L1.717.291A.999.999 0 0 0 .305 1.705l3.289 3.289-3.29 3.289a.999.999 0 1 0 1.413 1.412l3.29-3.289 3.288 3.29a.999.999 0 0 0 1.413-1.413l-3.29-3.29 3.29-3.288a.999.999 0 0 0 0-1.413Z",
@@ -511,18 +187,33 @@ function CloseIcon(props) {
511
187
  ) });
512
188
  }
513
189
 
190
+ // src/components/styling/StyleMarker.tsx
191
+ var import_react_slot = require("@radix-ui/react-slot");
192
+ var import_react3 = require("react");
193
+
194
+ // src/constants/styleDataAttribute.ts
195
+ var styleDataAttributeName = "data-dapp-kit";
196
+ var styleDataAttributeSelector = `[${styleDataAttributeName}]`;
197
+ var styleDataAttribute = { [styleDataAttributeName]: "" };
198
+
199
+ // src/components/styling/StyleMarker.tsx
200
+ var import_StyleMarker_css = __toESM(require_StyleMarker_css());
201
+ var import_jsx_runtime3 = require("react/jsx-runtime");
202
+ var StyleMarker = (0, import_react3.forwardRef)(({ children }, forwardedRef) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_slot.Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
203
+ StyleMarker.displayName = "StyleMarker";
204
+
514
205
  // src/components/ui/Heading.tsx
515
- var import_react_slot4 = require("@radix-ui/react-slot");
516
- var import_clsx4 = __toESM(require("clsx"));
517
- var import_react8 = require("react");
206
+ var import_react_slot2 = require("@radix-ui/react-slot");
207
+ var import_clsx = __toESM(require("clsx"));
208
+ var import_react4 = require("react");
518
209
 
519
210
  // src/components/ui/Heading.css.ts
520
- var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
521
- var headingVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "Heading__1aa835k0", variantClassNames: { size: { sm: "Heading_headingVariants_size_sm__1aa835k1", md: "Heading_headingVariants_size_md__1aa835k2", lg: "Heading_headingVariants_size_lg__1aa835k3", xl: "Heading_headingVariants_size_xl__1aa835k4" }, weight: { normal: "Heading_headingVariants_weight_normal__1aa835k5", bold: "Heading_headingVariants_weight_bold__1aa835k6" }, truncate: { true: "Heading_headingVariants_truncate_true__1aa835k7" } }, defaultVariants: { size: "lg", weight: "bold" }, compoundVariants: [] });
211
+ var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
212
+ var headingVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "Heading__1aa835k0", variantClassNames: { size: { sm: "Heading_headingVariants_size_sm__1aa835k1", md: "Heading_headingVariants_size_md__1aa835k2", lg: "Heading_headingVariants_size_lg__1aa835k3", xl: "Heading_headingVariants_size_xl__1aa835k4" }, weight: { normal: "Heading_headingVariants_weight_normal__1aa835k5", bold: "Heading_headingVariants_weight_bold__1aa835k6" }, truncate: { true: "Heading_headingVariants_truncate_true__1aa835k7" } }, defaultVariants: { size: "lg", weight: "bold" }, compoundVariants: [] });
522
213
 
523
214
  // src/components/ui/Heading.tsx
524
- var import_jsx_runtime10 = require("react/jsx-runtime");
525
- var Heading = (0, import_react8.forwardRef)(
215
+ var import_jsx_runtime4 = require("react/jsx-runtime");
216
+ var Heading = (0, import_react4.forwardRef)(
526
217
  ({
527
218
  children,
528
219
  className,
@@ -533,13 +224,13 @@ var Heading = (0, import_react8.forwardRef)(
533
224
  truncate,
534
225
  ...headingProps
535
226
  }, forwardedRef) => {
536
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
537
- import_react_slot4.Slot,
227
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
228
+ import_react_slot2.Slot,
538
229
  {
539
230
  ...headingProps,
540
231
  ref: forwardedRef,
541
- className: (0, import_clsx4.default)(headingVariants({ size, weight, truncate }), className),
542
- children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tag, { children })
232
+ className: (0, import_clsx.default)(headingVariants({ size, weight, truncate }), className),
233
+ children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Tag, { children })
543
234
  }
544
235
  );
545
236
  }
@@ -547,35 +238,97 @@ var Heading = (0, import_react8.forwardRef)(
547
238
  Heading.displayName = "Heading";
548
239
 
549
240
  // src/components/ui/IconButton.tsx
550
- var import_react_slot5 = require("@radix-ui/react-slot");
551
- var import_clsx5 = __toESM(require("clsx"));
552
- var import_react9 = require("react");
241
+ var import_react_slot3 = require("@radix-ui/react-slot");
242
+ var import_clsx2 = __toESM(require("clsx"));
243
+ var import_react5 = require("react");
553
244
 
554
245
  // src/components/ui/IconButton.css.ts
555
246
  var container = "IconButton_container__s6n7bq0";
556
247
 
557
248
  // src/components/ui/IconButton.tsx
558
- var import_jsx_runtime11 = require("react/jsx-runtime");
559
- var IconButton = (0, import_react9.forwardRef)(
249
+ var import_jsx_runtime5 = require("react/jsx-runtime");
250
+ var IconButton = (0, import_react5.forwardRef)(
560
251
  ({ className, asChild = false, ...props }, forwardedRef) => {
561
- const Comp = asChild ? import_react_slot5.Slot : "button";
562
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Comp, { ...props, className: (0, import_clsx5.default)(container, className), ref: forwardedRef });
252
+ const Comp = asChild ? import_react_slot3.Slot : "button";
253
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Comp, { ...props, className: (0, import_clsx2.default)(container, className), ref: forwardedRef });
254
+ }
255
+ );
256
+ IconButton.displayName = "Button";
257
+
258
+ // src/components/connect-modal/ConnectModal.css.ts
259
+ var backButtonContainer = "ConnectModal_backButtonContainer__gz8z96";
260
+ var closeButtonContainer = "ConnectModal_closeButtonContainer__gz8z97";
261
+ var content = "ConnectModal_content__gz8z92";
262
+ var overlay = "ConnectModal_overlay__gz8z90";
263
+ var selectedViewContainer = "ConnectModal_selectedViewContainer__gz8z95";
264
+ var title = "ConnectModal_title__gz8z91";
265
+ var viewContainer = "ConnectModal_viewContainer__gz8z94";
266
+ var walletListContainer = "ConnectModal_walletListContainer__gz8z99";
267
+ var walletListContainerWithViewSelected = "ConnectModal_walletListContainerWithViewSelected__gz8z9a";
268
+ var walletListContent = "ConnectModal_walletListContent__gz8z98";
269
+ var whatIsAWalletButton = "ConnectModal_whatIsAWalletButton__gz8z93";
270
+
271
+ // src/components/ui/Button.tsx
272
+ var import_react_slot4 = require("@radix-ui/react-slot");
273
+ var import_clsx3 = __toESM(require("clsx"));
274
+ var import_react6 = require("react");
275
+
276
+ // src/components/ui/Button.css.ts
277
+ var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
278
+ var buttonVariants = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "Button_buttonVariants__x1s81q0", variantClassNames: { variant: { primary: "Button_buttonVariants_variant_primary__x1s81q1", outline: "Button_buttonVariants_variant_outline__x1s81q2" }, size: { md: "Button_buttonVariants_size_md__x1s81q3", lg: "Button_buttonVariants_size_lg__x1s81q4" } }, defaultVariants: { variant: "primary", size: "md" }, compoundVariants: [] });
279
+
280
+ // src/components/ui/Button.tsx
281
+ var import_jsx_runtime6 = require("react/jsx-runtime");
282
+ var Button = (0, import_react6.forwardRef)(
283
+ ({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
284
+ const Comp = asChild ? import_react_slot4.Slot : "button";
285
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
286
+ Comp,
287
+ {
288
+ ...props,
289
+ className: (0, import_clsx3.default)(buttonVariants({ variant, size }), className),
290
+ ref: forwardedRef
291
+ }
292
+ );
293
+ }
294
+ );
295
+ Button.displayName = "Button";
296
+
297
+ // src/components/ui/Text.tsx
298
+ var import_react_slot5 = require("@radix-ui/react-slot");
299
+ var import_clsx4 = __toESM(require("clsx"));
300
+ var import_react7 = require("react");
301
+
302
+ // src/components/ui/Text.css.ts
303
+ var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
304
+ var textVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "Text__2bv1ur0", variantClassNames: { size: { sm: "Text_textVariants_size_sm__2bv1ur1" }, weight: { normal: "Text_textVariants_weight_normal__2bv1ur2", medium: "Text_textVariants_weight_medium__2bv1ur3", bold: "Text_textVariants_weight_bold__2bv1ur4" }, color: { muted: "Text_textVariants_color_muted__2bv1ur5", danger: "Text_textVariants_color_danger__2bv1ur6" }, mono: { true: "Text_textVariants_mono_true__2bv1ur7" } }, defaultVariants: { size: "sm", weight: "normal" }, compoundVariants: [] });
305
+
306
+ // src/components/ui/Text.tsx
307
+ var import_jsx_runtime7 = require("react/jsx-runtime");
308
+ var Text = (0, import_react7.forwardRef)(
309
+ ({
310
+ children,
311
+ className,
312
+ asChild = false,
313
+ as: Tag = "div",
314
+ size,
315
+ weight,
316
+ color,
317
+ mono,
318
+ ...textProps
319
+ }, forwardedRef) => {
320
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
321
+ import_react_slot5.Slot,
322
+ {
323
+ ...textProps,
324
+ ref: forwardedRef,
325
+ className: (0, import_clsx4.default)(textVariants({ size, weight, color, mono }), className),
326
+ children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tag, { children })
327
+ }
328
+ );
563
329
  }
564
330
  );
565
- IconButton.displayName = "Button";
566
-
567
- // src/components/connect-modal/ConnectModal.css.ts
568
- var backButtonContainer = "ConnectModal_backButtonContainer__gz8z96";
569
- var closeButtonContainer = "ConnectModal_closeButtonContainer__gz8z97";
570
- var content = "ConnectModal_content__gz8z92";
571
- var overlay = "ConnectModal_overlay__gz8z90";
572
- var selectedViewContainer = "ConnectModal_selectedViewContainer__gz8z95";
573
- var title = "ConnectModal_title__gz8z91";
574
- var viewContainer = "ConnectModal_viewContainer__gz8z94";
575
- var walletListContainer = "ConnectModal_walletListContainer__gz8z99";
576
- var walletListContainerWithViewSelected = "ConnectModal_walletListContainerWithViewSelected__gz8z9a";
577
- var walletListContent = "ConnectModal_walletListContent__gz8z98";
578
- var whatIsAWalletButton = "ConnectModal_whatIsAWalletButton__gz8z93";
331
+ Text.displayName = "Text";
579
332
 
580
333
  // src/components/connect-modal/views/ConnectionStatus.css.ts
581
334
  var connectionStatus = "ConnectionStatus_connectionStatus__nckm2d3";
@@ -585,14 +338,14 @@ var title2 = "ConnectionStatus_title__nckm2d2";
585
338
  var walletIcon = "ConnectionStatus_walletIcon__nckm2d1";
586
339
 
587
340
  // src/components/connect-modal/views/ConnectionStatus.tsx
588
- var import_jsx_runtime12 = require("react/jsx-runtime");
341
+ var import_jsx_runtime8 = require("react/jsx-runtime");
589
342
  function ConnectionStatus({
590
343
  selectedWallet,
591
344
  hadConnectionError,
592
345
  onRetryConnection
593
346
  }) {
594
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: container2, children: [
595
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
347
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: container2, children: [
348
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
596
349
  "img",
597
350
  {
598
351
  className: walletIcon,
@@ -600,12 +353,12 @@ function ConnectionStatus({
600
353
  alt: `${selectedWallet.name} logo`
601
354
  }
602
355
  ),
603
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: title2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Heading, { as: "h2", size: "xl", children: [
356
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: title2, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Heading, { as: "h2", size: "xl", children: [
604
357
  "Opening ",
605
358
  selectedWallet.name
606
359
  ] }) }),
607
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
608
- hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: retryButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
360
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
361
+ hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: retryButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
609
362
  ] });
610
363
  }
611
364
 
@@ -613,11 +366,11 @@ function ConnectionStatus({
613
366
  var container3 = "InfoSection_container__1wtioi70";
614
367
 
615
368
  // src/components/connect-modal/InfoSection.tsx
616
- var import_jsx_runtime13 = require("react/jsx-runtime");
369
+ var import_jsx_runtime9 = require("react/jsx-runtime");
617
370
  function InfoSection({ title: title3, children }) {
618
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: container3, children: [
619
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
620
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { weight: "medium", color: "muted", children })
371
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: container3, children: [
372
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
373
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { weight: "medium", color: "muted", children })
621
374
  ] });
622
375
  }
623
376
 
@@ -627,15 +380,15 @@ var content2 = "GettingStarted_content__1fp07e11";
627
380
  var installButtonContainer = "GettingStarted_installButtonContainer__1fp07e12";
628
381
 
629
382
  // src/components/connect-modal/views/GettingStarted.tsx
630
- var import_jsx_runtime14 = require("react/jsx-runtime");
383
+ var import_jsx_runtime10 = require("react/jsx-runtime");
631
384
  function GettingStarted() {
632
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: container4, children: [
633
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { as: "h2", children: "Get Started with Sui" }),
634
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: content2, children: [
635
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
636
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InfoSection, { title: "Create or Import a Wallet", children: "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone." }),
637
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
638
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: installButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
385
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: container4, children: [
386
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { as: "h2", children: "Get Started with Sui" }),
387
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: content2, children: [
388
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
389
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InfoSection, { title: "Create or Import a Wallet", children: "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone." }),
390
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
391
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: installButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
639
392
  "a",
640
393
  {
641
394
  href: "https://chrome.google.com/webstore/detail/sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",
@@ -653,13 +406,13 @@ var container5 = "WhatIsAWallet_container__1ktpkq90";
653
406
  var content3 = "WhatIsAWallet_content__1ktpkq91";
654
407
 
655
408
  // src/components/connect-modal/views/WhatIsAWallet.tsx
656
- var import_jsx_runtime15 = require("react/jsx-runtime");
409
+ var import_jsx_runtime11 = require("react/jsx-runtime");
657
410
  function WhatIsAWallet() {
658
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: container5, children: [
659
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { as: "h2", children: "What is a Wallet" }),
660
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: content3, children: [
661
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
662
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
411
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: container5, children: [
412
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { as: "h2", children: "What is a Wallet" }),
413
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: content3, children: [
414
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
415
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
663
416
  ] })
664
417
  ] });
665
418
  }
@@ -670,11 +423,11 @@ function useWallets() {
670
423
  }
671
424
 
672
425
  // src/components/icons/SuiIcon.tsx
673
- var import_jsx_runtime16 = require("react/jsx-runtime");
426
+ var import_jsx_runtime12 = require("react/jsx-runtime");
674
427
  function SuiIcon(props) {
675
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
676
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
677
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
428
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
429
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
430
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
678
431
  "path",
679
432
  {
680
433
  fillRule: "evenodd",
@@ -690,7 +443,7 @@ function SuiIcon(props) {
690
443
  var container6 = "WalletList_container__1v2s6cz0";
691
444
 
692
445
  // src/components/connect-modal/wallet-list/WalletListItem.tsx
693
- var import_clsx6 = require("clsx");
446
+ var import_clsx5 = require("clsx");
694
447
 
695
448
  // src/components/connect-modal/wallet-list/WalletListItem.css.ts
696
449
  var container7 = "WalletListItem_container__1dqqtqs0";
@@ -699,27 +452,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1dqqtqs3";
699
452
  var walletItem = "WalletListItem_walletItem__1dqqtqs1";
700
453
 
701
454
  // src/components/connect-modal/wallet-list/WalletListItem.tsx
702
- var import_jsx_runtime17 = require("react/jsx-runtime");
455
+ var import_jsx_runtime13 = require("react/jsx-runtime");
703
456
  function WalletListItem({ name, icon, onClick, isSelected = false }) {
704
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: container7, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
457
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { className: container7, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
705
458
  "button",
706
459
  {
707
- className: (0, import_clsx6.clsx)(walletItem, { [selectedWalletItem]: isSelected }),
460
+ className: (0, import_clsx5.clsx)(walletItem, { [selectedWalletItem]: isSelected }),
708
461
  type: "button",
709
462
  onClick,
710
463
  children: [
711
- typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
712
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: name }) })
464
+ typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
465
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: name }) })
713
466
  ]
714
467
  }
715
468
  ) });
716
469
  }
717
470
 
718
471
  // src/components/connect-modal/wallet-list/WalletList.tsx
719
- var import_jsx_runtime18 = require("react/jsx-runtime");
472
+ var import_jsx_runtime14 = require("react/jsx-runtime");
720
473
  function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
721
474
  const wallets = useWallets();
722
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
475
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
723
476
  WalletListItem,
724
477
  {
725
478
  name: wallet.name,
@@ -728,11 +481,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
728
481
  onClick: () => onSelect(wallet)
729
482
  },
730
483
  wallet.name
731
- )) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
484
+ )) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
732
485
  WalletListItem,
733
486
  {
734
487
  name: "Sui Wallet",
735
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SuiIcon, {}),
488
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SuiIcon, {}),
736
489
  onClick: onPlaceholderClick,
737
490
  isSelected: true
738
491
  }
@@ -740,11 +493,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
740
493
  }
741
494
 
742
495
  // src/components/connect-modal/ConnectModal.tsx
743
- var import_jsx_runtime19 = require("react/jsx-runtime");
496
+ var import_jsx_runtime15 = require("react/jsx-runtime");
744
497
  function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
745
- const [isModalOpen, setModalOpen] = (0, import_react10.useState)(open ?? defaultOpen);
746
- const [currentView, setCurrentView] = (0, import_react10.useState)();
747
- const [selectedWallet, setSelectedWallet] = (0, import_react10.useState)();
498
+ const [isModalOpen, setModalOpen] = (0, import_react8.useState)(open ?? defaultOpen);
499
+ const [currentView, setCurrentView] = (0, import_react8.useState)();
500
+ const [selectedWallet, setSelectedWallet] = (0, import_react8.useState)();
748
501
  const { mutate, isError } = useConnectWallet();
749
502
  const resetSelection = () => {
750
503
  setSelectedWallet(void 0);
@@ -769,13 +522,13 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
769
522
  let modalContent;
770
523
  switch (currentView) {
771
524
  case "what-is-a-wallet":
772
- modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WhatIsAWallet, {});
525
+ modalContent = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WhatIsAWallet, {});
773
526
  break;
774
527
  case "getting-started":
775
- modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GettingStarted, {});
528
+ modalContent = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GettingStarted, {});
776
529
  break;
777
530
  case "connection-status":
778
- modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
531
+ modalContent = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
779
532
  ConnectionStatus,
780
533
  {
781
534
  selectedWallet,
@@ -785,62 +538,330 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
785
538
  );
786
539
  break;
787
540
  default:
788
- modalContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WhatIsAWallet, {});
541
+ modalContent = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WhatIsAWallet, {});
789
542
  }
790
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
791
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Trigger, { asChild: true, children: trigger }) }),
792
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
793
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
543
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
544
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog.Trigger, { asChild: true, children: trigger }) }),
545
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
546
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
547
+ "div",
548
+ {
549
+ className: (0, import_clsx6.default)(walletListContainer, {
550
+ [walletListContainerWithViewSelected]: !!currentView
551
+ }),
552
+ children: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: walletListContent, children: [
554
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { as: "h2", children: "Connect a Wallet" }) }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
556
+ WalletList,
557
+ {
558
+ selectedWalletName: selectedWallet?.name,
559
+ onPlaceholderClick: () => setCurrentView("getting-started"),
560
+ onSelect: (wallet) => {
561
+ if (selectedWallet?.name !== wallet.name) {
562
+ setSelectedWallet(wallet);
563
+ connectWallet(wallet);
564
+ }
565
+ }
566
+ }
567
+ )
568
+ ] }),
569
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
570
+ "button",
571
+ {
572
+ className: whatIsAWalletButton,
573
+ onClick: () => setCurrentView("what-is-a-wallet"),
574
+ type: "button",
575
+ children: "What is a Wallet?"
576
+ }
577
+ )
578
+ ]
579
+ }
580
+ ),
581
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
794
582
  "div",
795
583
  {
796
- className: (0, import_clsx7.default)(walletListContainer, {
797
- [walletListContainerWithViewSelected]: !!currentView
798
- }),
799
- children: [
800
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: walletListContent, children: [
801
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { as: "h2", children: "Connect a Wallet" }) }),
802
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
803
- WalletList,
804
- {
805
- selectedWalletName: selectedWallet?.name,
806
- onPlaceholderClick: () => setCurrentView("getting-started"),
807
- onSelect: (wallet) => {
808
- if (selectedWallet?.name !== wallet.name) {
809
- setSelectedWallet(wallet);
810
- connectWallet(wallet);
811
- }
812
- }
813
- }
814
- )
815
- ] }),
816
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
817
- "button",
818
- {
819
- className: whatIsAWalletButton,
820
- onClick: () => setCurrentView("what-is-a-wallet"),
821
- type: "button",
822
- children: "What is a Wallet?"
823
- }
824
- )
825
- ]
826
- }
827
- ),
828
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
829
- "div",
584
+ className: (0, import_clsx6.default)(viewContainer, {
585
+ [selectedViewContainer]: !!currentView
586
+ }),
587
+ children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: backButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BackIcon, {}) }) }),
589
+ modalContent
590
+ ]
591
+ }
592
+ ),
593
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CloseIcon, {}) }) })
594
+ ] }) }) }) })
595
+ ] });
596
+ }
597
+
598
+ // src/hooks/wallet/useCurrentAccount.ts
599
+ function useCurrentAccount() {
600
+ return useWalletStore((state) => state.currentAccount);
601
+ }
602
+
603
+ // src/components/AccountDropdownMenu.tsx
604
+ var import_utils = require("@mysten/sui.js/utils");
605
+ var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
606
+ var import_clsx7 = __toESM(require("clsx"));
607
+
608
+ // src/hooks/useSuiClientQuery.ts
609
+ var import_react_query2 = require("@tanstack/react-query");
610
+
611
+ // src/hooks/useSuiClient.ts
612
+ var import_react10 = require("react");
613
+
614
+ // src/components/SuiClientProvider.tsx
615
+ var import_client = require("@mysten/sui.js/client");
616
+ var import_react9 = require("react");
617
+ var import_jsx_runtime16 = require("react/jsx-runtime");
618
+ var SuiClientContext = (0, import_react9.createContext)(null);
619
+ var DEFAULT_NETWORKS = {
620
+ localnet: { url: (0, import_client.getFullnodeUrl)("localnet") }
621
+ };
622
+ var DEFAULT_CREATE_CLIENT = function createClient(_name, config) {
623
+ if ((0, import_client.isSuiClient)(config)) {
624
+ return config;
625
+ }
626
+ return new import_client.SuiClient(config);
627
+ };
628
+ function SuiClientProvider(props) {
629
+ const { onNetworkChange, network, children } = props;
630
+ const networks = props.networks ?? DEFAULT_NETWORKS;
631
+ const createClient2 = props.createClient ?? DEFAULT_CREATE_CLIENT;
632
+ const [selectedNetwork, setSelectedNetwork] = (0, import_react9.useState)(
633
+ props.network ?? props.defaultNetwork ?? Object.keys(networks)[0]
634
+ );
635
+ const currentNetwork = props.network ?? selectedNetwork;
636
+ const client = (0, import_react9.useMemo)(() => {
637
+ return createClient2(currentNetwork, networks[currentNetwork]);
638
+ }, [createClient2, currentNetwork, networks]);
639
+ const ctx = (0, import_react9.useMemo)(() => {
640
+ return {
641
+ client,
642
+ networks,
643
+ network: currentNetwork,
644
+ config: networks[currentNetwork] instanceof import_client.SuiClient ? null : networks[currentNetwork],
645
+ selectNetwork: (newNetwork) => {
646
+ if (currentNetwork === newNetwork) {
647
+ return;
648
+ }
649
+ if (!network && newNetwork !== selectedNetwork) {
650
+ setSelectedNetwork(newNetwork);
651
+ }
652
+ onNetworkChange?.(newNetwork);
653
+ }
654
+ };
655
+ }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);
656
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SuiClientContext.Provider, { value: ctx, children });
657
+ }
658
+
659
+ // src/hooks/useSuiClient.ts
660
+ function useSuiClientContext() {
661
+ const suiClient = (0, import_react10.useContext)(SuiClientContext);
662
+ if (!suiClient) {
663
+ throw new Error(
664
+ "Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider"
665
+ );
666
+ }
667
+ return suiClient;
668
+ }
669
+ function useSuiClient() {
670
+ return useSuiClientContext().client;
671
+ }
672
+
673
+ // src/hooks/useSuiClientQuery.ts
674
+ function useSuiClientQuery(...args) {
675
+ const [method, params, { queryKey = [], ...options } = {}] = args;
676
+ const suiContext = useSuiClientContext();
677
+ return (0, import_react_query2.useQuery)({
678
+ ...options,
679
+ queryKey: [suiContext.network, method, params, ...queryKey],
680
+ queryFn: async () => {
681
+ return await suiContext.client[method](params);
682
+ }
683
+ });
684
+ }
685
+
686
+ // src/hooks/useResolveSuiNSNames.ts
687
+ function useResolveSuiNSName(address, options) {
688
+ const { data, ...rest } = useSuiClientQuery(
689
+ "resolveNameServiceNames",
690
+ {
691
+ address,
692
+ limit: 1
693
+ },
694
+ {
695
+ refetchOnWindowFocus: false,
696
+ retry: false,
697
+ ...options,
698
+ enabled: !!address && options?.enabled !== false
699
+ }
700
+ );
701
+ return { data: data?.data?.[0] ?? null, ...rest };
702
+ }
703
+
704
+ // src/hooks/wallet/useAccounts.ts
705
+ function useAccounts() {
706
+ return useWalletStore((state) => state.accounts);
707
+ }
708
+
709
+ // src/hooks/wallet/useDisconnectWallet.ts
710
+ var import_react_query3 = require("@tanstack/react-query");
711
+
712
+ // src/errors/walletErrors.ts
713
+ var WalletNotConnectedError = class extends Error {
714
+ };
715
+ var WalletNoAccountSelectedError = class extends Error {
716
+ };
717
+ var WalletFeatureNotSupportedError = class extends Error {
718
+ };
719
+ var WalletAccountNotFoundError = class extends Error {
720
+ };
721
+
722
+ // src/hooks/wallet/useCurrentWallet.ts
723
+ function useCurrentWallet() {
724
+ return useWalletStore((state) => state.currentWallet);
725
+ }
726
+
727
+ // src/hooks/wallet/useDisconnectWallet.ts
728
+ function useDisconnectWallet({
729
+ mutationKey,
730
+ ...mutationOptions
731
+ } = {}) {
732
+ const currentWallet = useCurrentWallet();
733
+ const setWalletDisconnected = useWalletStore((state) => state.setWalletDisconnected);
734
+ return (0, import_react_query3.useMutation)({
735
+ mutationKey: walletMutationKeys.disconnectWallet(mutationKey),
736
+ mutationFn: async () => {
737
+ if (!currentWallet) {
738
+ throw new WalletNotConnectedError("No wallet is connected.");
739
+ }
740
+ try {
741
+ await currentWallet.features["standard:disconnect"]?.disconnect();
742
+ } catch (error) {
743
+ console.error("Failed to disconnect the application from the current wallet.", error);
744
+ }
745
+ setWalletDisconnected();
746
+ },
747
+ ...mutationOptions
748
+ });
749
+ }
750
+
751
+ // src/hooks/wallet/useSwitchAccount.ts
752
+ var import_react_query4 = require("@tanstack/react-query");
753
+ function useSwitchAccount({
754
+ mutationKey,
755
+ ...mutationOptions
756
+ } = {}) {
757
+ const currentWallet = useCurrentWallet();
758
+ const setAccountSwitched = useWalletStore((state) => state.setAccountSwitched);
759
+ return (0, import_react_query4.useMutation)({
760
+ mutationKey: walletMutationKeys.switchAccount(mutationKey),
761
+ mutationFn: async ({ account }) => {
762
+ if (!currentWallet) {
763
+ throw new WalletNotConnectedError("No wallet is connected.");
764
+ }
765
+ const accountToSelect = currentWallet.accounts.find(
766
+ (walletAccount) => walletAccount.address === account.address
767
+ );
768
+ if (!accountToSelect) {
769
+ throw new WalletAccountNotFoundError(
770
+ `No account with address ${account.address} is connected to ${currentWallet.name}.`
771
+ );
772
+ }
773
+ setAccountSwitched(accountToSelect);
774
+ },
775
+ ...mutationOptions
776
+ });
777
+ }
778
+
779
+ // src/components/AccountDropdownMenu.css.ts
780
+ var connectedAccount = "AccountDropdownMenu_connectedAccount__div2ql0";
781
+ var menuContent = "AccountDropdownMenu_menuContent__div2ql1";
782
+ var menuItem = "AccountDropdownMenu_menuItem__div2ql2";
783
+ var separator = "AccountDropdownMenu_separator__div2ql4";
784
+ var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
785
+
786
+ // src/components/icons/CheckIcon.tsx
787
+ var import_jsx_runtime17 = require("react/jsx-runtime");
788
+ function CheckIcon(props) {
789
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
790
+ "path",
791
+ {
792
+ fill: "currentColor",
793
+ d: "m11.726 5.048-4.73 5.156-1.722-1.879a.72.72 0 0 0-.529-.23.722.722 0 0 0-.525.24.858.858 0 0 0-.22.573.86.86 0 0 0 .211.576l2.255 2.458c.14.153.332.24.53.24.2 0 .391-.087.532-.24l5.261-5.735A.86.86 0 0 0 13 5.63a.858.858 0 0 0-.22-.572.722.722 0 0 0-.525-.24.72.72 0 0 0-.529.23Z"
794
+ }
795
+ ) });
796
+ }
797
+
798
+ // src/components/icons/ChevronIcon.tsx
799
+ var import_jsx_runtime18 = require("react/jsx-runtime");
800
+ function ChevronIcon(props) {
801
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
802
+ "path",
803
+ {
804
+ stroke: "#A0B6C3",
805
+ strokeLinecap: "round",
806
+ strokeLinejoin: "round",
807
+ strokeWidth: 1.5,
808
+ d: "m4 6 4 4 4-4"
809
+ }
810
+ ) });
811
+ }
812
+
813
+ // src/components/AccountDropdownMenu.tsx
814
+ var import_jsx_runtime19 = require("react/jsx-runtime");
815
+ function AccountDropdownMenu({ currentAccount }) {
816
+ const { mutate: disconnectWallet } = useDisconnectWallet();
817
+ const { data: domain } = useResolveSuiNSName(
818
+ currentAccount.label ? null : currentAccount.address
819
+ );
820
+ const accounts = useAccounts();
821
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenu.Root, { modal: false, children: [
822
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Button, { size: "lg", className: connectedAccount, children: [
823
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { mono: true, weight: "bold", children: currentAccount.label ?? domain ?? (0, import_utils.formatAddress)(currentAccount.address) }),
824
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronIcon, {})
825
+ ] }) }) }),
826
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenu.Content, { className: menuContent, children: [
827
+ accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
828
+ AccountDropdownMenuItem,
829
+ {
830
+ account,
831
+ active: currentAccount.address === account.address
832
+ },
833
+ account.address
834
+ )),
835
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenu.Separator, { className: separator }),
836
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
837
+ DropdownMenu.Item,
830
838
  {
831
- className: (0, import_clsx7.default)(viewContainer, {
832
- [selectedViewContainer]: !!currentView
833
- }),
834
- children: [
835
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: backButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BackIcon, {}) }) }),
836
- modalContent
837
- ]
839
+ className: (0, import_clsx7.default)(menuItem),
840
+ onSelect: () => disconnectWallet(),
841
+ children: "Disconnect"
838
842
  }
839
- ),
840
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon, {}) }) })
841
- ] }) }) }) })
843
+ )
844
+ ] }) }) })
842
845
  ] });
843
846
  }
847
+ function AccountDropdownMenuItem({
848
+ account,
849
+ active
850
+ }) {
851
+ const { mutate: switchAccount } = useSwitchAccount();
852
+ const { data: domain } = useResolveSuiNSName(account.label ? null : account.address);
853
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
854
+ DropdownMenu.Item,
855
+ {
856
+ className: (0, import_clsx7.default)(menuItem, switchAccountMenuItem),
857
+ onSelect: () => switchAccount({ account }),
858
+ children: [
859
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { mono: true, children: account.label ?? domain ?? (0, import_utils.formatAddress)(account.address) }),
860
+ active ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CheckIcon, {}) : null
861
+ ]
862
+ }
863
+ );
864
+ }
844
865
 
845
866
  // src/components/ConnectButton.tsx
846
867
  var import_jsx_runtime20 = require("react/jsx-runtime");
@@ -1338,74 +1359,57 @@ function WalletConnectionManager({
1338
1359
  return children;
1339
1360
  }
1340
1361
 
1341
- // src/hooks/wallet/useSignPersonalMessage.ts
1362
+ // src/hooks/networkConfig.ts
1363
+ function createNetworkConfig(networkConfig) {
1364
+ function useNetworkConfig() {
1365
+ const { config } = useSuiClientContext();
1366
+ if (!config) {
1367
+ throw new Error("No network config found");
1368
+ }
1369
+ return config;
1370
+ }
1371
+ function useNetworkVariables() {
1372
+ const { variables } = useNetworkConfig();
1373
+ return variables ?? {};
1374
+ }
1375
+ function useNetworkVariable(name) {
1376
+ const variables = useNetworkVariables();
1377
+ return variables[name];
1378
+ }
1379
+ return {
1380
+ networkConfig,
1381
+ useNetworkConfig,
1382
+ useNetworkVariables,
1383
+ useNetworkVariable
1384
+ };
1385
+ }
1386
+
1387
+ // src/hooks/useSuiClientInfiniteQuery.ts
1342
1388
  var import_react_query5 = require("@tanstack/react-query");
1343
- function useSignPersonalMessage({
1344
- mutationKey,
1345
- ...mutationOptions
1346
- } = {}) {
1347
- const currentWallet = useCurrentWallet();
1348
- const currentAccount = useCurrentAccount();
1349
- return (0, import_react_query5.useMutation)({
1350
- mutationKey: walletMutationKeys.signPersonalMessage(mutationKey),
1351
- mutationFn: async (signPersonalMessageArgs) => {
1352
- if (!currentWallet) {
1353
- throw new WalletNotConnectedError("No wallet is connected.");
1354
- }
1355
- const signerAccount = signPersonalMessageArgs.account ?? currentAccount;
1356
- if (!signerAccount) {
1357
- throw new WalletNoAccountSelectedError(
1358
- "No wallet account is selected to sign the personal message with."
1359
- );
1360
- }
1361
- const walletFeature = currentWallet.features["sui:signPersonalMessage"];
1362
- if (!walletFeature) {
1363
- throw new WalletFeatureNotSupportedError(
1364
- "This wallet doesn't support the `signPersonalMessage` feature."
1365
- );
1366
- }
1367
- return await walletFeature.signPersonalMessage({
1368
- ...signPersonalMessageArgs,
1369
- account: signerAccount
1370
- });
1389
+ function useSuiClientInfiniteQuery(method, params, { queryKey = [], enabled = !!params, ...options } = {}) {
1390
+ const suiContext = useSuiClientContext();
1391
+ return (0, import_react_query5.useInfiniteQuery)({
1392
+ ...options,
1393
+ queryKey: [suiContext.network, method, params, ...queryKey],
1394
+ enabled,
1395
+ queryFn: async () => {
1396
+ return await suiContext.client[method](params);
1371
1397
  },
1372
- ...mutationOptions
1398
+ getNextPageParam: (lastPage) => {
1399
+ return lastPage.nextCursor ?? null;
1400
+ }
1373
1401
  });
1374
1402
  }
1375
1403
 
1376
- // src/hooks/wallet/useSignTransactionBlock.ts
1404
+ // src/hooks/useSuiClientMutation.ts
1377
1405
  var import_react_query6 = require("@tanstack/react-query");
1378
- function useSignTransactionBlock({
1379
- mutationKey,
1380
- ...mutationOptions
1381
- } = {}) {
1382
- const currentWallet = useCurrentWallet();
1383
- const currentAccount = useCurrentAccount();
1406
+ function useSuiClientMutation(method, options = {}) {
1407
+ const suiContext = useSuiClientContext();
1384
1408
  return (0, import_react_query6.useMutation)({
1385
- mutationKey: walletMutationKeys.signTransactionBlock(mutationKey),
1386
- mutationFn: async (signTransactionBlockArgs) => {
1387
- if (!currentWallet) {
1388
- throw new WalletNotConnectedError("No wallet is connected.");
1389
- }
1390
- const signerAccount = signTransactionBlockArgs.account ?? currentAccount;
1391
- if (!signerAccount) {
1392
- throw new WalletNoAccountSelectedError(
1393
- "No wallet account is selected to sign the transaction block with."
1394
- );
1395
- }
1396
- const walletFeature = currentWallet.features["sui:signTransactionBlock"];
1397
- if (!walletFeature) {
1398
- throw new WalletFeatureNotSupportedError(
1399
- "This wallet doesn't support the `SignTransactionBlock` feature."
1400
- );
1401
- }
1402
- return await walletFeature.signTransactionBlock({
1403
- ...signTransactionBlockArgs,
1404
- account: signerAccount,
1405
- chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0]
1406
- });
1407
- },
1408
- ...mutationOptions
1409
+ ...options,
1410
+ mutationFn: async (params) => {
1411
+ return await suiContext.client[method](params);
1412
+ }
1409
1413
  });
1410
1414
  }
1411
1415
 
@@ -1468,32 +1472,74 @@ function useSignAndExecuteTransactionBlock({
1468
1472
  });
1469
1473
  }
1470
1474
 
1471
- // src/hooks/useSuiClientMutation.ts
1475
+ // src/hooks/wallet/useSignPersonalMessage.ts
1472
1476
  var import_react_query8 = require("@tanstack/react-query");
1473
- function useSuiClientMutation(method, options = {}) {
1474
- const suiContext = useSuiClientContext();
1477
+ function useSignPersonalMessage({
1478
+ mutationKey,
1479
+ ...mutationOptions
1480
+ } = {}) {
1481
+ const currentWallet = useCurrentWallet();
1482
+ const currentAccount = useCurrentAccount();
1475
1483
  return (0, import_react_query8.useMutation)({
1476
- ...options,
1477
- mutationFn: async (params) => {
1478
- return await suiContext.client[method](params);
1479
- }
1484
+ mutationKey: walletMutationKeys.signPersonalMessage(mutationKey),
1485
+ mutationFn: async (signPersonalMessageArgs) => {
1486
+ if (!currentWallet) {
1487
+ throw new WalletNotConnectedError("No wallet is connected.");
1488
+ }
1489
+ const signerAccount = signPersonalMessageArgs.account ?? currentAccount;
1490
+ if (!signerAccount) {
1491
+ throw new WalletNoAccountSelectedError(
1492
+ "No wallet account is selected to sign the personal message with."
1493
+ );
1494
+ }
1495
+ const walletFeature = currentWallet.features["sui:signPersonalMessage"];
1496
+ if (!walletFeature) {
1497
+ throw new WalletFeatureNotSupportedError(
1498
+ "This wallet doesn't support the `signPersonalMessage` feature."
1499
+ );
1500
+ }
1501
+ return await walletFeature.signPersonalMessage({
1502
+ ...signPersonalMessageArgs,
1503
+ account: signerAccount
1504
+ });
1505
+ },
1506
+ ...mutationOptions
1480
1507
  });
1481
1508
  }
1482
1509
 
1483
- // src/hooks/useSuiClientInfiniteQuery.ts
1510
+ // src/hooks/wallet/useSignTransactionBlock.ts
1484
1511
  var import_react_query9 = require("@tanstack/react-query");
1485
- function useSuiClientInfiniteQuery(method, params, { queryKey = [], enabled = !!params, ...options } = {}) {
1486
- const suiContext = useSuiClientContext();
1487
- return (0, import_react_query9.useInfiniteQuery)({
1488
- ...options,
1489
- queryKey: [suiContext.network, method, params, ...queryKey],
1490
- enabled,
1491
- queryFn: async () => {
1492
- return await suiContext.client[method](params);
1512
+ function useSignTransactionBlock({
1513
+ mutationKey,
1514
+ ...mutationOptions
1515
+ } = {}) {
1516
+ const currentWallet = useCurrentWallet();
1517
+ const currentAccount = useCurrentAccount();
1518
+ return (0, import_react_query9.useMutation)({
1519
+ mutationKey: walletMutationKeys.signTransactionBlock(mutationKey),
1520
+ mutationFn: async (signTransactionBlockArgs) => {
1521
+ if (!currentWallet) {
1522
+ throw new WalletNotConnectedError("No wallet is connected.");
1523
+ }
1524
+ const signerAccount = signTransactionBlockArgs.account ?? currentAccount;
1525
+ if (!signerAccount) {
1526
+ throw new WalletNoAccountSelectedError(
1527
+ "No wallet account is selected to sign the transaction block with."
1528
+ );
1529
+ }
1530
+ const walletFeature = currentWallet.features["sui:signTransactionBlock"];
1531
+ if (!walletFeature) {
1532
+ throw new WalletFeatureNotSupportedError(
1533
+ "This wallet doesn't support the `SignTransactionBlock` feature."
1534
+ );
1535
+ }
1536
+ return await walletFeature.signTransactionBlock({
1537
+ ...signTransactionBlockArgs,
1538
+ account: signerAccount,
1539
+ chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0]
1540
+ });
1493
1541
  },
1494
- getNextPageParam: (lastPage) => {
1495
- return lastPage.nextCursor ?? null;
1496
- }
1542
+ ...mutationOptions
1497
1543
  });
1498
1544
  }
1499
1545
  //# sourceMappingURL=index.js.map