@mysten/dapp-kit 0.3.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 (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +4 -4
  3. package/dist/cjs/components/AccountDropdownMenu.d.ts +4 -0
  4. package/dist/cjs/components/AccountDropdownMenu.js +116 -42
  5. package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
  6. package/dist/cjs/components/ConnectButton.js +183 -110
  7. package/dist/cjs/components/ConnectButton.js.map +4 -4
  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 +1 -2
  12. package/dist/cjs/components/WalletProvider.js.map +2 -2
  13. package/dist/cjs/hooks/networkConfig.d.ts +10 -0
  14. package/dist/cjs/hooks/networkConfig.js +74 -0
  15. package/dist/cjs/hooks/networkConfig.js.map +7 -0
  16. package/dist/cjs/hooks/useResolveSuiNSNames.d.ts +107 -0
  17. package/dist/cjs/hooks/useResolveSuiNSNames.js +83 -0
  18. package/dist/cjs/hooks/useResolveSuiNSNames.js.map +7 -0
  19. package/dist/cjs/hooks/useSuiClient.js.map +2 -2
  20. package/dist/cjs/hooks/useSuiClientInfiniteQuery.js.map +2 -2
  21. package/dist/cjs/hooks/useSuiClientMutation.js.map +2 -2
  22. package/dist/cjs/hooks/useSuiClientQuery.js.map +2 -2
  23. package/dist/cjs/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
  24. package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  25. package/dist/cjs/index.css +127 -127
  26. package/dist/cjs/index.css.map +3 -3
  27. package/dist/cjs/index.d.ts +13 -10
  28. package/dist/cjs/index.js +594 -529
  29. package/dist/cjs/index.js.map +4 -4
  30. package/dist/cjs/walletStore.js +1 -2
  31. package/dist/cjs/walletStore.js.map +2 -2
  32. package/dist/esm/components/AccountDropdownMenu.d.ts +4 -0
  33. package/dist/esm/components/AccountDropdownMenu.js +106 -32
  34. package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
  35. package/dist/esm/components/ConnectButton.js +156 -83
  36. package/dist/esm/components/ConnectButton.js.map +4 -4
  37. package/dist/esm/components/SuiClientProvider.d.ts +4 -4
  38. package/dist/esm/components/SuiClientProvider.js +1 -0
  39. package/dist/esm/components/SuiClientProvider.js.map +2 -2
  40. package/dist/esm/components/WalletProvider.js +1 -2
  41. package/dist/esm/components/WalletProvider.js.map +2 -2
  42. package/dist/esm/hooks/networkConfig.d.ts +10 -0
  43. package/dist/esm/hooks/networkConfig.js +51 -0
  44. package/dist/esm/hooks/networkConfig.js.map +7 -0
  45. package/dist/esm/hooks/useResolveSuiNSNames.d.ts +107 -0
  46. package/dist/esm/hooks/useResolveSuiNSNames.js +60 -0
  47. package/dist/esm/hooks/useResolveSuiNSNames.js.map +7 -0
  48. package/dist/esm/hooks/useSuiClient.js.map +2 -2
  49. package/dist/esm/hooks/useSuiClientInfiniteQuery.js.map +2 -2
  50. package/dist/esm/hooks/useSuiClientMutation.js.map +2 -2
  51. package/dist/esm/hooks/useSuiClientQuery.js.map +2 -2
  52. package/dist/esm/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
  53. package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  54. package/dist/esm/index.css +127 -127
  55. package/dist/esm/index.css.map +3 -3
  56. package/dist/esm/index.d.ts +13 -10
  57. package/dist/esm/index.js +609 -544
  58. package/dist/esm/index.js.map +4 -4
  59. package/dist/esm/walletStore.js +1 -2
  60. package/dist/esm/walletStore.js.map +2 -2
  61. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +1 -1
  64. package/src/components/AccountDropdownMenu.tsx +31 -9
  65. package/src/components/SuiClientProvider.tsx +11 -2
  66. package/src/hooks/networkConfig.ts +45 -0
  67. package/src/hooks/useResolveSuiNSNames.ts +31 -0
  68. package/src/index.ts +13 -10
  69. package/src/walletStore.ts +3 -4
package/dist/esm/index.js CHANGED
@@ -54,102 +54,12 @@ var require_StyleMarker_css = __commonJS({
54
54
  }
55
55
  });
56
56
 
57
- // src/hooks/useSuiClient.ts
58
- import { useContext } from "react";
59
-
60
- // src/components/SuiClientProvider.tsx
61
- import { getFullnodeUrl, isSuiClient, SuiClient } from "@mysten/sui.js/client";
62
- import { createContext, useMemo, useState } from "react";
63
- import { jsx } from "react/jsx-runtime";
64
- var SuiClientContext = createContext(null);
65
- var DEFAULT_NETWORKS = {
66
- localnet: { url: getFullnodeUrl("localnet") }
67
- };
68
- var DEFAULT_CREATE_CLIENT = function createClient(_name, config) {
69
- if (isSuiClient(config)) {
70
- return config;
71
- }
72
- return new SuiClient(config);
73
- };
74
- function SuiClientProvider(props) {
75
- const { onNetworkChange, network, children } = props;
76
- const networks = props.networks ?? DEFAULT_NETWORKS;
77
- const createClient2 = props.createClient ?? DEFAULT_CREATE_CLIENT;
78
- const [selectedNetwork, setSelectedNetwork] = useState(
79
- props.network ?? props.defaultNetwork ?? Object.keys(networks)[0]
80
- );
81
- const currentNetwork = props.network ?? selectedNetwork;
82
- const client = useMemo(() => {
83
- return createClient2(currentNetwork, networks[currentNetwork]);
84
- }, [createClient2, currentNetwork, networks]);
85
- const ctx = useMemo(() => {
86
- return {
87
- client,
88
- networks,
89
- network: currentNetwork,
90
- selectNetwork: (newNetwork) => {
91
- if (currentNetwork === newNetwork) {
92
- return;
93
- }
94
- if (!network && newNetwork !== selectedNetwork) {
95
- setSelectedNetwork(newNetwork);
96
- }
97
- onNetworkChange?.(newNetwork);
98
- }
99
- };
100
- }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);
101
- return /* @__PURE__ */ jsx(SuiClientContext.Provider, { value: ctx, children });
102
- }
103
-
104
- // src/hooks/useSuiClient.ts
105
- function useSuiClientContext() {
106
- const suiClient = useContext(SuiClientContext);
107
- if (!suiClient) {
108
- throw new Error(
109
- "Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider"
110
- );
111
- }
112
- return suiClient;
113
- }
114
- function useSuiClient() {
115
- return useSuiClientContext().client;
116
- }
117
-
118
- // src/hooks/wallet/useWalletStore.ts
119
- import { useContext as useContext2 } from "react";
120
- import { useStore } from "zustand";
121
-
122
- // src/contexts/walletContext.ts
123
- import { createContext as createContext2 } from "react";
124
- var WalletContext = createContext2(null);
125
-
126
- // src/hooks/wallet/useWalletStore.ts
127
- function useWalletStore(selector) {
128
- const store = useContext2(WalletContext);
129
- if (!store) {
130
- throw new Error(
131
- "Could not find WalletContext. Ensure that you have set up the WalletProvider."
132
- );
133
- }
134
- return useStore(store, selector);
135
- }
136
-
137
- // src/hooks/wallet/useCurrentAccount.ts
138
- function useCurrentAccount() {
139
- return useWalletStore((state) => state.currentAccount);
140
- }
141
-
142
- // src/components/AccountDropdownMenu.tsx
143
- import { formatAddress } from "@mysten/sui.js/utils";
144
- import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
145
- import clsx3 from "clsx";
146
-
147
- // src/hooks/wallet/useAccounts.ts
148
- function useAccounts() {
149
- return useWalletStore((state) => state.accounts);
150
- }
57
+ // src/components/connect-modal/ConnectModal.tsx
58
+ import * as Dialog from "@radix-ui/react-dialog";
59
+ import clsx6 from "clsx";
60
+ import { useState } from "react";
151
61
 
152
- // src/hooks/wallet/useDisconnectWallet.ts
62
+ // src/hooks/wallet/useConnectWallet.ts
153
63
  import { useMutation } from "@tanstack/react-query";
154
64
 
155
65
  // src/constants/walletMutationKeys.ts
@@ -168,234 +78,32 @@ function formMutationKeyFn(baseEntity) {
168
78
  };
169
79
  }
170
80
 
171
- // src/errors/walletErrors.ts
172
- var WalletNotConnectedError = class extends Error {
173
- };
174
- var WalletNoAccountSelectedError = class extends Error {
175
- };
176
- var WalletFeatureNotSupportedError = class extends Error {
177
- };
178
- var WalletAccountNotFoundError = class extends Error {
179
- };
180
-
181
- // src/hooks/wallet/useCurrentWallet.ts
182
- function useCurrentWallet() {
183
- return useWalletStore((state) => state.currentWallet);
184
- }
185
-
186
- // src/hooks/wallet/useDisconnectWallet.ts
187
- function useDisconnectWallet({
188
- mutationKey,
189
- ...mutationOptions
190
- } = {}) {
191
- const currentWallet = useCurrentWallet();
192
- const setWalletDisconnected = useWalletStore((state) => state.setWalletDisconnected);
193
- return useMutation({
194
- mutationKey: walletMutationKeys.disconnectWallet(mutationKey),
195
- mutationFn: async () => {
196
- if (!currentWallet) {
197
- throw new WalletNotConnectedError("No wallet is connected.");
198
- }
199
- try {
200
- await currentWallet.features["standard:disconnect"]?.disconnect();
201
- } catch (error) {
202
- console.error("Failed to disconnect the application from the current wallet.", error);
203
- }
204
- setWalletDisconnected();
205
- },
206
- ...mutationOptions
207
- });
208
- }
209
-
210
- // src/hooks/wallet/useSwitchAccount.ts
211
- import { useMutation as useMutation2 } from "@tanstack/react-query";
212
- function useSwitchAccount({
213
- mutationKey,
214
- ...mutationOptions
215
- } = {}) {
216
- const currentWallet = useCurrentWallet();
217
- const setAccountSwitched = useWalletStore((state) => state.setAccountSwitched);
218
- return useMutation2({
219
- mutationKey: walletMutationKeys.switchAccount(mutationKey),
220
- mutationFn: async ({ account }) => {
221
- if (!currentWallet) {
222
- throw new WalletNotConnectedError("No wallet is connected.");
223
- }
224
- const accountToSelect = currentWallet.accounts.find(
225
- (walletAccount) => walletAccount.address === account.address
226
- );
227
- if (!accountToSelect) {
228
- throw new WalletAccountNotFoundError(
229
- `No account with address ${account.address} is connected to ${currentWallet.name}.`
230
- );
231
- }
232
- setAccountSwitched(accountToSelect);
233
- },
234
- ...mutationOptions
235
- });
236
- }
237
-
238
- // src/components/AccountDropdownMenu.css.ts
239
- var connectedAccount = "AccountDropdownMenu_connectedAccount__div2ql0";
240
- var menuContent = "AccountDropdownMenu_menuContent__div2ql1";
241
- var menuItem = "AccountDropdownMenu_menuItem__div2ql2";
242
- var separator = "AccountDropdownMenu_separator__div2ql4";
243
- var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
244
-
245
- // src/components/icons/CheckIcon.tsx
246
- import { jsx as jsx2 } from "react/jsx-runtime";
247
- function CheckIcon(props) {
248
- return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx2(
249
- "path",
250
- {
251
- fill: "currentColor",
252
- 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"
253
- }
254
- ) });
255
- }
256
-
257
- // src/components/icons/ChevronIcon.tsx
258
- import { jsx as jsx3 } from "react/jsx-runtime";
259
- function ChevronIcon(props) {
260
- return /* @__PURE__ */ jsx3("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx3(
261
- "path",
262
- {
263
- stroke: "#A0B6C3",
264
- strokeLinecap: "round",
265
- strokeLinejoin: "round",
266
- strokeWidth: 1.5,
267
- d: "m4 6 4 4 4-4"
268
- }
269
- ) });
270
- }
271
-
272
- // src/components/styling/StyleMarker.tsx
273
- import { Slot } from "@radix-ui/react-slot";
274
- import { forwardRef } from "react";
275
-
276
- // src/constants/styleDataAttribute.ts
277
- var styleDataAttributeName = "data-dapp-kit";
278
- var styleDataAttributeSelector = `[${styleDataAttributeName}]`;
279
- var styleDataAttribute = { [styleDataAttributeName]: "" };
280
-
281
- // src/components/styling/StyleMarker.tsx
282
- var import_StyleMarker_css = __toESM(require_StyleMarker_css());
283
- import { jsx as jsx4 } from "react/jsx-runtime";
284
- var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */ jsx4(Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
285
- StyleMarker.displayName = "StyleMarker";
286
-
287
- // src/components/ui/Button.tsx
288
- import { Slot as Slot2 } from "@radix-ui/react-slot";
289
- import clsx from "clsx";
290
- import { forwardRef as forwardRef2 } from "react";
291
-
292
- // src/components/ui/Button.css.ts
293
- import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
294
- var buttonVariants = _7a468({ 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: [] });
295
-
296
- // src/components/ui/Button.tsx
297
- import { jsx as jsx5 } from "react/jsx-runtime";
298
- var Button = forwardRef2(
299
- ({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
300
- const Comp = asChild ? Slot2 : "button";
301
- return /* @__PURE__ */ jsx5(
302
- Comp,
303
- {
304
- ...props,
305
- className: clsx(buttonVariants({ variant, size }), className),
306
- ref: forwardedRef
307
- }
308
- );
309
- }
310
- );
311
- Button.displayName = "Button";
312
-
313
- // src/components/ui/Text.tsx
314
- import { Slot as Slot3 } from "@radix-ui/react-slot";
315
- import clsx2 from "clsx";
316
- import { forwardRef as forwardRef3 } from "react";
81
+ // src/hooks/wallet/useWalletStore.ts
82
+ import { useContext } from "react";
83
+ import { useStore } from "zustand";
317
84
 
318
- // src/components/ui/Text.css.ts
319
- import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
320
- var textVariants = _7a4682({ 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: [] });
85
+ // src/contexts/walletContext.ts
86
+ import { createContext } from "react";
87
+ var WalletContext = createContext(null);
321
88
 
322
- // src/components/ui/Text.tsx
323
- import { jsx as jsx6 } from "react/jsx-runtime";
324
- var Text = forwardRef3(
325
- ({
326
- children,
327
- className,
328
- asChild = false,
329
- as: Tag = "div",
330
- size,
331
- weight,
332
- color,
333
- mono,
334
- ...textProps
335
- }, forwardedRef) => {
336
- return /* @__PURE__ */ jsx6(
337
- Slot3,
338
- {
339
- ...textProps,
340
- ref: forwardedRef,
341
- className: clsx2(textVariants({ size, weight, color, mono }), className),
342
- children: asChild ? children : /* @__PURE__ */ jsx6(Tag, { children })
343
- }
89
+ // src/hooks/wallet/useWalletStore.ts
90
+ function useWalletStore(selector) {
91
+ const store = useContext(WalletContext);
92
+ if (!store) {
93
+ throw new Error(
94
+ "Could not find WalletContext. Ensure that you have set up the WalletProvider."
344
95
  );
345
96
  }
346
- );
347
- Text.displayName = "Text";
348
-
349
- // src/components/AccountDropdownMenu.tsx
350
- import { jsx as jsx7, jsxs } from "react/jsx-runtime";
351
- function AccountDropdownMenu({ currentAccount }) {
352
- const { mutate: disconnectWallet } = useDisconnectWallet();
353
- const { mutate: switchAccount } = useSwitchAccount();
354
- const accounts = useAccounts();
355
- return /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, children: [
356
- /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsx7(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "lg", className: connectedAccount, children: [
357
- /* @__PURE__ */ jsx7(Text, { mono: true, weight: "bold", children: formatAddress(currentAccount.address) }),
358
- /* @__PURE__ */ jsx7(ChevronIcon, {})
359
- ] }) }) }),
360
- /* @__PURE__ */ jsx7(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
361
- accounts.map((account) => /* @__PURE__ */ jsxs(
362
- DropdownMenu.Item,
363
- {
364
- className: clsx3(menuItem, switchAccountMenuItem),
365
- onSelect: () => switchAccount({ account }),
366
- children: [
367
- /* @__PURE__ */ jsx7(Text, { mono: true, children: formatAddress(account.address) }),
368
- currentAccount.address === account.address ? /* @__PURE__ */ jsx7(CheckIcon, {}) : null
369
- ]
370
- },
371
- account.address
372
- )),
373
- /* @__PURE__ */ jsx7(DropdownMenu.Separator, { className: separator }),
374
- /* @__PURE__ */ jsx7(
375
- DropdownMenu.Item,
376
- {
377
- className: clsx3(menuItem),
378
- onSelect: () => disconnectWallet(),
379
- children: "Disconnect"
380
- }
381
- )
382
- ] }) }) })
383
- ] });
97
+ return useStore(store, selector);
384
98
  }
385
99
 
386
- // src/components/connect-modal/ConnectModal.tsx
387
- import * as Dialog from "@radix-ui/react-dialog";
388
- import clsx7 from "clsx";
389
- import { useState as useState2 } from "react";
390
-
391
100
  // src/hooks/wallet/useConnectWallet.ts
392
- import { useMutation as useMutation3 } from "@tanstack/react-query";
393
101
  function useConnectWallet({
394
102
  mutationKey,
395
103
  ...mutationOptions
396
104
  } = {}) {
397
105
  const setWalletConnected = useWalletStore((state) => state.setWalletConnected);
398
- return useMutation3({
106
+ return useMutation({
399
107
  mutationKey: walletMutationKeys.connectWallet(mutationKey),
400
108
  mutationFn: async ({ wallet, accountAddress, ...standardConnectInput }) => {
401
109
  const connectResult = await wallet.features["standard:connect"].connect(standardConnectInput);
@@ -421,9 +129,9 @@ function getSelectedAccount(connectedAccounts, accountAddress) {
421
129
  }
422
130
 
423
131
  // src/components/icons/BackIcon.tsx
424
- import { jsx as jsx8 } from "react/jsx-runtime";
132
+ import { jsx } from "react/jsx-runtime";
425
133
  function BackIcon(props) {
426
- return /* @__PURE__ */ jsx8("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx8(
134
+ return /* @__PURE__ */ jsx("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx(
427
135
  "path",
428
136
  {
429
137
  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",
@@ -433,9 +141,9 @@ function BackIcon(props) {
433
141
  }
434
142
 
435
143
  // src/components/icons/CloseIcon.tsx
436
- import { jsx as jsx9 } from "react/jsx-runtime";
144
+ import { jsx as jsx2 } from "react/jsx-runtime";
437
145
  function CloseIcon(props) {
438
- return /* @__PURE__ */ jsx9("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx9(
146
+ return /* @__PURE__ */ jsx2("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx2(
439
147
  "path",
440
148
  {
441
149
  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",
@@ -444,18 +152,33 @@ function CloseIcon(props) {
444
152
  ) });
445
153
  }
446
154
 
155
+ // src/components/styling/StyleMarker.tsx
156
+ import { Slot } from "@radix-ui/react-slot";
157
+ import { forwardRef } from "react";
158
+
159
+ // src/constants/styleDataAttribute.ts
160
+ var styleDataAttributeName = "data-dapp-kit";
161
+ var styleDataAttributeSelector = `[${styleDataAttributeName}]`;
162
+ var styleDataAttribute = { [styleDataAttributeName]: "" };
163
+
164
+ // src/components/styling/StyleMarker.tsx
165
+ var import_StyleMarker_css = __toESM(require_StyleMarker_css());
166
+ import { jsx as jsx3 } from "react/jsx-runtime";
167
+ var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */ jsx3(Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
168
+ StyleMarker.displayName = "StyleMarker";
169
+
447
170
  // src/components/ui/Heading.tsx
448
- import { Slot as Slot4 } from "@radix-ui/react-slot";
449
- import clsx4 from "clsx";
450
- import { forwardRef as forwardRef4 } from "react";
171
+ import { Slot as Slot2 } from "@radix-ui/react-slot";
172
+ import clsx from "clsx";
173
+ import { forwardRef as forwardRef2 } from "react";
451
174
 
452
175
  // src/components/ui/Heading.css.ts
453
- import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
454
- var headingVariants = _7a4683({ 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: [] });
176
+ import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
177
+ var headingVariants = _7a468({ 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: [] });
455
178
 
456
179
  // src/components/ui/Heading.tsx
457
- import { jsx as jsx10 } from "react/jsx-runtime";
458
- var Heading = forwardRef4(
180
+ import { jsx as jsx4 } from "react/jsx-runtime";
181
+ var Heading = forwardRef2(
459
182
  ({
460
183
  children,
461
184
  className,
@@ -466,13 +189,13 @@ var Heading = forwardRef4(
466
189
  truncate,
467
190
  ...headingProps
468
191
  }, forwardedRef) => {
469
- return /* @__PURE__ */ jsx10(
470
- Slot4,
192
+ return /* @__PURE__ */ jsx4(
193
+ Slot2,
471
194
  {
472
195
  ...headingProps,
473
196
  ref: forwardedRef,
474
- className: clsx4(headingVariants({ size, weight, truncate }), className),
475
- children: asChild ? children : /* @__PURE__ */ jsx10(Tag, { children })
197
+ className: clsx(headingVariants({ size, weight, truncate }), className),
198
+ children: asChild ? children : /* @__PURE__ */ jsx4(Tag, { children })
476
199
  }
477
200
  );
478
201
  }
@@ -480,35 +203,97 @@ var Heading = forwardRef4(
480
203
  Heading.displayName = "Heading";
481
204
 
482
205
  // src/components/ui/IconButton.tsx
483
- import { Slot as Slot5 } from "@radix-ui/react-slot";
484
- import clsx5 from "clsx";
485
- import { forwardRef as forwardRef5 } from "react";
206
+ import { Slot as Slot3 } from "@radix-ui/react-slot";
207
+ import clsx2 from "clsx";
208
+ import { forwardRef as forwardRef3 } from "react";
486
209
 
487
210
  // src/components/ui/IconButton.css.ts
488
211
  var container = "IconButton_container__s6n7bq0";
489
212
 
490
213
  // src/components/ui/IconButton.tsx
491
- import { jsx as jsx11 } from "react/jsx-runtime";
492
- var IconButton = forwardRef5(
214
+ import { jsx as jsx5 } from "react/jsx-runtime";
215
+ var IconButton = forwardRef3(
493
216
  ({ className, asChild = false, ...props }, forwardedRef) => {
494
- const Comp = asChild ? Slot5 : "button";
495
- return /* @__PURE__ */ jsx11(Comp, { ...props, className: clsx5(container, className), ref: forwardedRef });
217
+ const Comp = asChild ? Slot3 : "button";
218
+ return /* @__PURE__ */ jsx5(Comp, { ...props, className: clsx2(container, className), ref: forwardedRef });
219
+ }
220
+ );
221
+ IconButton.displayName = "Button";
222
+
223
+ // src/components/connect-modal/ConnectModal.css.ts
224
+ var backButtonContainer = "ConnectModal_backButtonContainer__gz8z96";
225
+ var closeButtonContainer = "ConnectModal_closeButtonContainer__gz8z97";
226
+ var content = "ConnectModal_content__gz8z92";
227
+ var overlay = "ConnectModal_overlay__gz8z90";
228
+ var selectedViewContainer = "ConnectModal_selectedViewContainer__gz8z95";
229
+ var title = "ConnectModal_title__gz8z91";
230
+ var viewContainer = "ConnectModal_viewContainer__gz8z94";
231
+ var walletListContainer = "ConnectModal_walletListContainer__gz8z99";
232
+ var walletListContainerWithViewSelected = "ConnectModal_walletListContainerWithViewSelected__gz8z9a";
233
+ var walletListContent = "ConnectModal_walletListContent__gz8z98";
234
+ var whatIsAWalletButton = "ConnectModal_whatIsAWalletButton__gz8z93";
235
+
236
+ // src/components/ui/Button.tsx
237
+ import { Slot as Slot4 } from "@radix-ui/react-slot";
238
+ import clsx3 from "clsx";
239
+ import { forwardRef as forwardRef4 } from "react";
240
+
241
+ // src/components/ui/Button.css.ts
242
+ import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
243
+ var buttonVariants = _7a4682({ 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: [] });
244
+
245
+ // src/components/ui/Button.tsx
246
+ import { jsx as jsx6 } from "react/jsx-runtime";
247
+ var Button = forwardRef4(
248
+ ({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
249
+ const Comp = asChild ? Slot4 : "button";
250
+ return /* @__PURE__ */ jsx6(
251
+ Comp,
252
+ {
253
+ ...props,
254
+ className: clsx3(buttonVariants({ variant, size }), className),
255
+ ref: forwardedRef
256
+ }
257
+ );
258
+ }
259
+ );
260
+ Button.displayName = "Button";
261
+
262
+ // src/components/ui/Text.tsx
263
+ import { Slot as Slot5 } from "@radix-ui/react-slot";
264
+ import clsx4 from "clsx";
265
+ import { forwardRef as forwardRef5 } from "react";
266
+
267
+ // src/components/ui/Text.css.ts
268
+ import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
269
+ var textVariants = _7a4683({ 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: [] });
270
+
271
+ // src/components/ui/Text.tsx
272
+ import { jsx as jsx7 } from "react/jsx-runtime";
273
+ var Text = forwardRef5(
274
+ ({
275
+ children,
276
+ className,
277
+ asChild = false,
278
+ as: Tag = "div",
279
+ size,
280
+ weight,
281
+ color,
282
+ mono,
283
+ ...textProps
284
+ }, forwardedRef) => {
285
+ return /* @__PURE__ */ jsx7(
286
+ Slot5,
287
+ {
288
+ ...textProps,
289
+ ref: forwardedRef,
290
+ className: clsx4(textVariants({ size, weight, color, mono }), className),
291
+ children: asChild ? children : /* @__PURE__ */ jsx7(Tag, { children })
292
+ }
293
+ );
496
294
  }
497
295
  );
498
- IconButton.displayName = "Button";
499
-
500
- // src/components/connect-modal/ConnectModal.css.ts
501
- var backButtonContainer = "ConnectModal_backButtonContainer__gz8z96";
502
- var closeButtonContainer = "ConnectModal_closeButtonContainer__gz8z97";
503
- var content = "ConnectModal_content__gz8z92";
504
- var overlay = "ConnectModal_overlay__gz8z90";
505
- var selectedViewContainer = "ConnectModal_selectedViewContainer__gz8z95";
506
- var title = "ConnectModal_title__gz8z91";
507
- var viewContainer = "ConnectModal_viewContainer__gz8z94";
508
- var walletListContainer = "ConnectModal_walletListContainer__gz8z99";
509
- var walletListContainerWithViewSelected = "ConnectModal_walletListContainerWithViewSelected__gz8z9a";
510
- var walletListContent = "ConnectModal_walletListContent__gz8z98";
511
- var whatIsAWalletButton = "ConnectModal_whatIsAWalletButton__gz8z93";
296
+ Text.displayName = "Text";
512
297
 
513
298
  // src/components/connect-modal/views/ConnectionStatus.css.ts
514
299
  var connectionStatus = "ConnectionStatus_connectionStatus__nckm2d3";
@@ -518,14 +303,14 @@ var title2 = "ConnectionStatus_title__nckm2d2";
518
303
  var walletIcon = "ConnectionStatus_walletIcon__nckm2d1";
519
304
 
520
305
  // src/components/connect-modal/views/ConnectionStatus.tsx
521
- import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
306
+ import { jsx as jsx8, jsxs } from "react/jsx-runtime";
522
307
  function ConnectionStatus({
523
308
  selectedWallet,
524
309
  hadConnectionError,
525
310
  onRetryConnection
526
311
  }) {
527
- return /* @__PURE__ */ jsxs2("div", { className: container2, children: [
528
- /* @__PURE__ */ jsx12(
312
+ return /* @__PURE__ */ jsxs("div", { className: container2, children: [
313
+ /* @__PURE__ */ jsx8(
529
314
  "img",
530
315
  {
531
316
  className: walletIcon,
@@ -533,12 +318,12 @@ function ConnectionStatus({
533
318
  alt: `${selectedWallet.name} logo`
534
319
  }
535
320
  ),
536
- /* @__PURE__ */ jsx12("div", { className: title2, children: /* @__PURE__ */ jsxs2(Heading, { as: "h2", size: "xl", children: [
321
+ /* @__PURE__ */ jsx8("div", { className: title2, children: /* @__PURE__ */ jsxs(Heading, { as: "h2", size: "xl", children: [
537
322
  "Opening ",
538
323
  selectedWallet.name
539
324
  ] }) }),
540
- /* @__PURE__ */ jsx12("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ jsx12(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ jsx12(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
541
- hadConnectionError ? /* @__PURE__ */ jsx12("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx12(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
325
+ /* @__PURE__ */ jsx8("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ jsx8(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ jsx8(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
326
+ hadConnectionError ? /* @__PURE__ */ jsx8("div", { className: retryButtonContainer, children: /* @__PURE__ */ jsx8(Button, { type: "button", variant: "outline", onClick: () => onRetryConnection(selectedWallet), children: "Retry Connection" }) }) : null
542
327
  ] });
543
328
  }
544
329
 
@@ -546,11 +331,11 @@ function ConnectionStatus({
546
331
  var container3 = "InfoSection_container__1wtioi70";
547
332
 
548
333
  // src/components/connect-modal/InfoSection.tsx
549
- import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
334
+ import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
550
335
  function InfoSection({ title: title3, children }) {
551
- return /* @__PURE__ */ jsxs3("section", { className: container3, children: [
552
- /* @__PURE__ */ jsx13(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
553
- /* @__PURE__ */ jsx13(Text, { weight: "medium", color: "muted", children })
336
+ return /* @__PURE__ */ jsxs2("section", { className: container3, children: [
337
+ /* @__PURE__ */ jsx9(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
338
+ /* @__PURE__ */ jsx9(Text, { weight: "medium", color: "muted", children })
554
339
  ] });
555
340
  }
556
341
 
@@ -560,15 +345,15 @@ var content2 = "GettingStarted_content__1fp07e11";
560
345
  var installButtonContainer = "GettingStarted_installButtonContainer__1fp07e12";
561
346
 
562
347
  // src/components/connect-modal/views/GettingStarted.tsx
563
- import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
348
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
564
349
  function GettingStarted() {
565
- return /* @__PURE__ */ jsxs4("div", { className: container4, children: [
566
- /* @__PURE__ */ jsx14(Heading, { as: "h2", children: "Get Started with Sui" }),
567
- /* @__PURE__ */ jsxs4("div", { className: content2, children: [
568
- /* @__PURE__ */ jsx14(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
569
- /* @__PURE__ */ jsx14(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." }),
570
- /* @__PURE__ */ jsx14(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
571
- /* @__PURE__ */ jsx14("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx14(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx14(
350
+ return /* @__PURE__ */ jsxs3("div", { className: container4, children: [
351
+ /* @__PURE__ */ jsx10(Heading, { as: "h2", children: "Get Started with Sui" }),
352
+ /* @__PURE__ */ jsxs3("div", { className: content2, children: [
353
+ /* @__PURE__ */ jsx10(InfoSection, { title: "Install the Sui Wallet Extension", children: "We recommend pinning Sui Wallet to your taskbar for quicker access." }),
354
+ /* @__PURE__ */ jsx10(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." }),
355
+ /* @__PURE__ */ jsx10(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
356
+ /* @__PURE__ */ jsx10("div", { className: installButtonContainer, children: /* @__PURE__ */ jsx10(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx10(
572
357
  "a",
573
358
  {
574
359
  href: "https://chrome.google.com/webstore/detail/sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",
@@ -586,13 +371,13 @@ var container5 = "WhatIsAWallet_container__1ktpkq90";
586
371
  var content3 = "WhatIsAWallet_content__1ktpkq91";
587
372
 
588
373
  // src/components/connect-modal/views/WhatIsAWallet.tsx
589
- import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
374
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
590
375
  function WhatIsAWallet() {
591
- return /* @__PURE__ */ jsxs5("div", { className: container5, children: [
592
- /* @__PURE__ */ jsx15(Heading, { as: "h2", children: "What is a Wallet" }),
593
- /* @__PURE__ */ jsxs5("div", { className: content3, children: [
594
- /* @__PURE__ */ jsx15(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
595
- /* @__PURE__ */ jsx15(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
376
+ return /* @__PURE__ */ jsxs4("div", { className: container5, children: [
377
+ /* @__PURE__ */ jsx11(Heading, { as: "h2", children: "What is a Wallet" }),
378
+ /* @__PURE__ */ jsxs4("div", { className: content3, children: [
379
+ /* @__PURE__ */ jsx11(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
380
+ /* @__PURE__ */ jsx11(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
596
381
  ] })
597
382
  ] });
598
383
  }
@@ -603,11 +388,11 @@ function useWallets() {
603
388
  }
604
389
 
605
390
  // src/components/icons/SuiIcon.tsx
606
- import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
391
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
607
392
  function SuiIcon(props) {
608
- return /* @__PURE__ */ jsxs6("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
609
- /* @__PURE__ */ jsx16("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
610
- /* @__PURE__ */ jsx16(
393
+ return /* @__PURE__ */ jsxs5("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
394
+ /* @__PURE__ */ jsx12("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
395
+ /* @__PURE__ */ jsx12(
611
396
  "path",
612
397
  {
613
398
  fillRule: "evenodd",
@@ -623,7 +408,7 @@ function SuiIcon(props) {
623
408
  var container6 = "WalletList_container__1v2s6cz0";
624
409
 
625
410
  // src/components/connect-modal/wallet-list/WalletListItem.tsx
626
- import { clsx as clsx6 } from "clsx";
411
+ import { clsx as clsx5 } from "clsx";
627
412
 
628
413
  // src/components/connect-modal/wallet-list/WalletListItem.css.ts
629
414
  var container7 = "WalletListItem_container__1dqqtqs0";
@@ -632,27 +417,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1dqqtqs3";
632
417
  var walletItem = "WalletListItem_walletItem__1dqqtqs1";
633
418
 
634
419
  // src/components/connect-modal/wallet-list/WalletListItem.tsx
635
- import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
420
+ import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
636
421
  function WalletListItem({ name, icon, onClick, isSelected = false }) {
637
- return /* @__PURE__ */ jsx17("li", { className: container7, children: /* @__PURE__ */ jsxs7(
422
+ return /* @__PURE__ */ jsx13("li", { className: container7, children: /* @__PURE__ */ jsxs6(
638
423
  "button",
639
424
  {
640
- className: clsx6(walletItem, { [selectedWalletItem]: isSelected }),
425
+ className: clsx5(walletItem, { [selectedWalletItem]: isSelected }),
641
426
  type: "button",
642
427
  onClick,
643
428
  children: [
644
- typeof icon === "string" ? /* @__PURE__ */ jsx17("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
645
- /* @__PURE__ */ jsx17(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx17("div", { children: name }) })
429
+ typeof icon === "string" ? /* @__PURE__ */ jsx13("img", { className: walletIcon2, src: icon, alt: `${name} logo` }) : icon,
430
+ /* @__PURE__ */ jsx13(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ jsx13("div", { children: name }) })
646
431
  ]
647
432
  }
648
433
  ) });
649
434
  }
650
435
 
651
436
  // src/components/connect-modal/wallet-list/WalletList.tsx
652
- import { jsx as jsx18 } from "react/jsx-runtime";
437
+ import { jsx as jsx14 } from "react/jsx-runtime";
653
438
  function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
654
439
  const wallets = useWallets();
655
- return /* @__PURE__ */ jsx18("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx18(
440
+ return /* @__PURE__ */ jsx14("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ jsx14(
656
441
  WalletListItem,
657
442
  {
658
443
  name: wallet.name,
@@ -661,11 +446,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
661
446
  onClick: () => onSelect(wallet)
662
447
  },
663
448
  wallet.name
664
- )) : /* @__PURE__ */ jsx18(
449
+ )) : /* @__PURE__ */ jsx14(
665
450
  WalletListItem,
666
451
  {
667
452
  name: "Sui Wallet",
668
- icon: /* @__PURE__ */ jsx18(SuiIcon, {}),
453
+ icon: /* @__PURE__ */ jsx14(SuiIcon, {}),
669
454
  onClick: onPlaceholderClick,
670
455
  isSelected: true
671
456
  }
@@ -673,11 +458,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
673
458
  }
674
459
 
675
460
  // src/components/connect-modal/ConnectModal.tsx
676
- import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
461
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
677
462
  function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
678
- const [isModalOpen, setModalOpen] = useState2(open ?? defaultOpen);
679
- const [currentView, setCurrentView] = useState2();
680
- const [selectedWallet, setSelectedWallet] = useState2();
463
+ const [isModalOpen, setModalOpen] = useState(open ?? defaultOpen);
464
+ const [currentView, setCurrentView] = useState();
465
+ const [selectedWallet, setSelectedWallet] = useState();
681
466
  const { mutate, isError } = useConnectWallet();
682
467
  const resetSelection = () => {
683
468
  setSelectedWallet(void 0);
@@ -702,13 +487,13 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
702
487
  let modalContent;
703
488
  switch (currentView) {
704
489
  case "what-is-a-wallet":
705
- modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
490
+ modalContent = /* @__PURE__ */ jsx15(WhatIsAWallet, {});
706
491
  break;
707
492
  case "getting-started":
708
- modalContent = /* @__PURE__ */ jsx19(GettingStarted, {});
493
+ modalContent = /* @__PURE__ */ jsx15(GettingStarted, {});
709
494
  break;
710
495
  case "connection-status":
711
- modalContent = /* @__PURE__ */ jsx19(
496
+ modalContent = /* @__PURE__ */ jsx15(
712
497
  ConnectionStatus,
713
498
  {
714
499
  selectedWallet,
@@ -718,62 +503,330 @@ function ConnectModal({ trigger, open, defaultOpen, onOpenChange }) {
718
503
  );
719
504
  break;
720
505
  default:
721
- modalContent = /* @__PURE__ */ jsx19(WhatIsAWallet, {});
506
+ modalContent = /* @__PURE__ */ jsx15(WhatIsAWallet, {});
722
507
  }
723
- return /* @__PURE__ */ jsxs8(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
724
- /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Dialog.Trigger, { asChild: true, children: trigger }) }),
725
- /* @__PURE__ */ jsx19(Dialog.Portal, { children: /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ jsxs8(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
726
- /* @__PURE__ */ jsxs8(
508
+ return /* @__PURE__ */ jsxs7(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
509
+ /* @__PURE__ */ jsx15(StyleMarker, { children: /* @__PURE__ */ jsx15(Dialog.Trigger, { asChild: true, children: trigger }) }),
510
+ /* @__PURE__ */ jsx15(Dialog.Portal, { children: /* @__PURE__ */ jsx15(StyleMarker, { children: /* @__PURE__ */ jsx15(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ jsxs7(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
511
+ /* @__PURE__ */ jsxs7(
512
+ "div",
513
+ {
514
+ className: clsx6(walletListContainer, {
515
+ [walletListContainerWithViewSelected]: !!currentView
516
+ }),
517
+ children: [
518
+ /* @__PURE__ */ jsxs7("div", { className: walletListContent, children: [
519
+ /* @__PURE__ */ jsx15(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx15(Heading, { as: "h2", children: "Connect a Wallet" }) }),
520
+ /* @__PURE__ */ jsx15(
521
+ WalletList,
522
+ {
523
+ selectedWalletName: selectedWallet?.name,
524
+ onPlaceholderClick: () => setCurrentView("getting-started"),
525
+ onSelect: (wallet) => {
526
+ if (selectedWallet?.name !== wallet.name) {
527
+ setSelectedWallet(wallet);
528
+ connectWallet(wallet);
529
+ }
530
+ }
531
+ }
532
+ )
533
+ ] }),
534
+ /* @__PURE__ */ jsx15(
535
+ "button",
536
+ {
537
+ className: whatIsAWalletButton,
538
+ onClick: () => setCurrentView("what-is-a-wallet"),
539
+ type: "button",
540
+ children: "What is a Wallet?"
541
+ }
542
+ )
543
+ ]
544
+ }
545
+ ),
546
+ /* @__PURE__ */ jsxs7(
727
547
  "div",
728
548
  {
729
- className: clsx7(walletListContainer, {
730
- [walletListContainerWithViewSelected]: !!currentView
731
- }),
732
- children: [
733
- /* @__PURE__ */ jsxs8("div", { className: walletListContent, children: [
734
- /* @__PURE__ */ jsx19(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ jsx19(Heading, { as: "h2", children: "Connect a Wallet" }) }),
735
- /* @__PURE__ */ jsx19(
736
- WalletList,
737
- {
738
- selectedWalletName: selectedWallet?.name,
739
- onPlaceholderClick: () => setCurrentView("getting-started"),
740
- onSelect: (wallet) => {
741
- if (selectedWallet?.name !== wallet.name) {
742
- setSelectedWallet(wallet);
743
- connectWallet(wallet);
744
- }
745
- }
746
- }
747
- )
748
- ] }),
749
- /* @__PURE__ */ jsx19(
750
- "button",
751
- {
752
- className: whatIsAWalletButton,
753
- onClick: () => setCurrentView("what-is-a-wallet"),
754
- type: "button",
755
- children: "What is a Wallet?"
756
- }
757
- )
758
- ]
759
- }
760
- ),
761
- /* @__PURE__ */ jsxs8(
762
- "div",
549
+ className: clsx6(viewContainer, {
550
+ [selectedViewContainer]: !!currentView
551
+ }),
552
+ children: [
553
+ /* @__PURE__ */ jsx15("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx15(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ jsx15(BackIcon, {}) }) }),
554
+ modalContent
555
+ ]
556
+ }
557
+ ),
558
+ /* @__PURE__ */ jsx15(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx15(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx15(CloseIcon, {}) }) })
559
+ ] }) }) }) })
560
+ ] });
561
+ }
562
+
563
+ // src/hooks/wallet/useCurrentAccount.ts
564
+ function useCurrentAccount() {
565
+ return useWalletStore((state) => state.currentAccount);
566
+ }
567
+
568
+ // src/components/AccountDropdownMenu.tsx
569
+ import { formatAddress } from "@mysten/sui.js/utils";
570
+ import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
571
+ import clsx7 from "clsx";
572
+
573
+ // src/hooks/useSuiClientQuery.ts
574
+ import { useQuery } from "@tanstack/react-query";
575
+
576
+ // src/hooks/useSuiClient.ts
577
+ import { useContext as useContext2 } from "react";
578
+
579
+ // src/components/SuiClientProvider.tsx
580
+ import { getFullnodeUrl, isSuiClient, SuiClient } from "@mysten/sui.js/client";
581
+ import { createContext as createContext2, useMemo, useState as useState2 } from "react";
582
+ import { jsx as jsx16 } from "react/jsx-runtime";
583
+ var SuiClientContext = createContext2(null);
584
+ var DEFAULT_NETWORKS = {
585
+ localnet: { url: getFullnodeUrl("localnet") }
586
+ };
587
+ var DEFAULT_CREATE_CLIENT = function createClient(_name, config) {
588
+ if (isSuiClient(config)) {
589
+ return config;
590
+ }
591
+ return new SuiClient(config);
592
+ };
593
+ function SuiClientProvider(props) {
594
+ const { onNetworkChange, network, children } = props;
595
+ const networks = props.networks ?? DEFAULT_NETWORKS;
596
+ const createClient2 = props.createClient ?? DEFAULT_CREATE_CLIENT;
597
+ const [selectedNetwork, setSelectedNetwork] = useState2(
598
+ props.network ?? props.defaultNetwork ?? Object.keys(networks)[0]
599
+ );
600
+ const currentNetwork = props.network ?? selectedNetwork;
601
+ const client = useMemo(() => {
602
+ return createClient2(currentNetwork, networks[currentNetwork]);
603
+ }, [createClient2, currentNetwork, networks]);
604
+ const ctx = useMemo(() => {
605
+ return {
606
+ client,
607
+ networks,
608
+ network: currentNetwork,
609
+ config: networks[currentNetwork] instanceof SuiClient ? null : networks[currentNetwork],
610
+ selectNetwork: (newNetwork) => {
611
+ if (currentNetwork === newNetwork) {
612
+ return;
613
+ }
614
+ if (!network && newNetwork !== selectedNetwork) {
615
+ setSelectedNetwork(newNetwork);
616
+ }
617
+ onNetworkChange?.(newNetwork);
618
+ }
619
+ };
620
+ }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);
621
+ return /* @__PURE__ */ jsx16(SuiClientContext.Provider, { value: ctx, children });
622
+ }
623
+
624
+ // src/hooks/useSuiClient.ts
625
+ function useSuiClientContext() {
626
+ const suiClient = useContext2(SuiClientContext);
627
+ if (!suiClient) {
628
+ throw new Error(
629
+ "Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider"
630
+ );
631
+ }
632
+ return suiClient;
633
+ }
634
+ function useSuiClient() {
635
+ return useSuiClientContext().client;
636
+ }
637
+
638
+ // src/hooks/useSuiClientQuery.ts
639
+ function useSuiClientQuery(...args) {
640
+ const [method, params, { queryKey = [], ...options } = {}] = args;
641
+ const suiContext = useSuiClientContext();
642
+ return useQuery({
643
+ ...options,
644
+ queryKey: [suiContext.network, method, params, ...queryKey],
645
+ queryFn: async () => {
646
+ return await suiContext.client[method](params);
647
+ }
648
+ });
649
+ }
650
+
651
+ // src/hooks/useResolveSuiNSNames.ts
652
+ function useResolveSuiNSName(address, options) {
653
+ const { data, ...rest } = useSuiClientQuery(
654
+ "resolveNameServiceNames",
655
+ {
656
+ address,
657
+ limit: 1
658
+ },
659
+ {
660
+ refetchOnWindowFocus: false,
661
+ retry: false,
662
+ ...options,
663
+ enabled: !!address && options?.enabled !== false
664
+ }
665
+ );
666
+ return { data: data?.data?.[0] ?? null, ...rest };
667
+ }
668
+
669
+ // src/hooks/wallet/useAccounts.ts
670
+ function useAccounts() {
671
+ return useWalletStore((state) => state.accounts);
672
+ }
673
+
674
+ // src/hooks/wallet/useDisconnectWallet.ts
675
+ import { useMutation as useMutation2 } from "@tanstack/react-query";
676
+
677
+ // src/errors/walletErrors.ts
678
+ var WalletNotConnectedError = class extends Error {
679
+ };
680
+ var WalletNoAccountSelectedError = class extends Error {
681
+ };
682
+ var WalletFeatureNotSupportedError = class extends Error {
683
+ };
684
+ var WalletAccountNotFoundError = class extends Error {
685
+ };
686
+
687
+ // src/hooks/wallet/useCurrentWallet.ts
688
+ function useCurrentWallet() {
689
+ return useWalletStore((state) => state.currentWallet);
690
+ }
691
+
692
+ // src/hooks/wallet/useDisconnectWallet.ts
693
+ function useDisconnectWallet({
694
+ mutationKey,
695
+ ...mutationOptions
696
+ } = {}) {
697
+ const currentWallet = useCurrentWallet();
698
+ const setWalletDisconnected = useWalletStore((state) => state.setWalletDisconnected);
699
+ return useMutation2({
700
+ mutationKey: walletMutationKeys.disconnectWallet(mutationKey),
701
+ mutationFn: async () => {
702
+ if (!currentWallet) {
703
+ throw new WalletNotConnectedError("No wallet is connected.");
704
+ }
705
+ try {
706
+ await currentWallet.features["standard:disconnect"]?.disconnect();
707
+ } catch (error) {
708
+ console.error("Failed to disconnect the application from the current wallet.", error);
709
+ }
710
+ setWalletDisconnected();
711
+ },
712
+ ...mutationOptions
713
+ });
714
+ }
715
+
716
+ // src/hooks/wallet/useSwitchAccount.ts
717
+ import { useMutation as useMutation3 } from "@tanstack/react-query";
718
+ function useSwitchAccount({
719
+ mutationKey,
720
+ ...mutationOptions
721
+ } = {}) {
722
+ const currentWallet = useCurrentWallet();
723
+ const setAccountSwitched = useWalletStore((state) => state.setAccountSwitched);
724
+ return useMutation3({
725
+ mutationKey: walletMutationKeys.switchAccount(mutationKey),
726
+ mutationFn: async ({ account }) => {
727
+ if (!currentWallet) {
728
+ throw new WalletNotConnectedError("No wallet is connected.");
729
+ }
730
+ const accountToSelect = currentWallet.accounts.find(
731
+ (walletAccount) => walletAccount.address === account.address
732
+ );
733
+ if (!accountToSelect) {
734
+ throw new WalletAccountNotFoundError(
735
+ `No account with address ${account.address} is connected to ${currentWallet.name}.`
736
+ );
737
+ }
738
+ setAccountSwitched(accountToSelect);
739
+ },
740
+ ...mutationOptions
741
+ });
742
+ }
743
+
744
+ // src/components/AccountDropdownMenu.css.ts
745
+ var connectedAccount = "AccountDropdownMenu_connectedAccount__div2ql0";
746
+ var menuContent = "AccountDropdownMenu_menuContent__div2ql1";
747
+ var menuItem = "AccountDropdownMenu_menuItem__div2ql2";
748
+ var separator = "AccountDropdownMenu_separator__div2ql4";
749
+ var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
750
+
751
+ // src/components/icons/CheckIcon.tsx
752
+ import { jsx as jsx17 } from "react/jsx-runtime";
753
+ function CheckIcon(props) {
754
+ return /* @__PURE__ */ jsx17("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx17(
755
+ "path",
756
+ {
757
+ fill: "currentColor",
758
+ 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"
759
+ }
760
+ ) });
761
+ }
762
+
763
+ // src/components/icons/ChevronIcon.tsx
764
+ import { jsx as jsx18 } from "react/jsx-runtime";
765
+ function ChevronIcon(props) {
766
+ return /* @__PURE__ */ jsx18("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx18(
767
+ "path",
768
+ {
769
+ stroke: "#A0B6C3",
770
+ strokeLinecap: "round",
771
+ strokeLinejoin: "round",
772
+ strokeWidth: 1.5,
773
+ d: "m4 6 4 4 4-4"
774
+ }
775
+ ) });
776
+ }
777
+
778
+ // src/components/AccountDropdownMenu.tsx
779
+ import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
780
+ function AccountDropdownMenu({ currentAccount }) {
781
+ const { mutate: disconnectWallet } = useDisconnectWallet();
782
+ const { data: domain } = useResolveSuiNSName(
783
+ currentAccount.label ? null : currentAccount.address
784
+ );
785
+ const accounts = useAccounts();
786
+ return /* @__PURE__ */ jsxs8(DropdownMenu.Root, { modal: false, children: [
787
+ /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsx19(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs8(Button, { size: "lg", className: connectedAccount, children: [
788
+ /* @__PURE__ */ jsx19(Text, { mono: true, weight: "bold", children: currentAccount.label ?? domain ?? formatAddress(currentAccount.address) }),
789
+ /* @__PURE__ */ jsx19(ChevronIcon, {})
790
+ ] }) }) }),
791
+ /* @__PURE__ */ jsx19(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx19(StyleMarker, { children: /* @__PURE__ */ jsxs8(DropdownMenu.Content, { className: menuContent, children: [
792
+ accounts.map((account) => /* @__PURE__ */ jsx19(
793
+ AccountDropdownMenuItem,
794
+ {
795
+ account,
796
+ active: currentAccount.address === account.address
797
+ },
798
+ account.address
799
+ )),
800
+ /* @__PURE__ */ jsx19(DropdownMenu.Separator, { className: separator }),
801
+ /* @__PURE__ */ jsx19(
802
+ DropdownMenu.Item,
763
803
  {
764
- className: clsx7(viewContainer, {
765
- [selectedViewContainer]: !!currentView
766
- }),
767
- children: [
768
- /* @__PURE__ */ jsx19("div", { className: backButtonContainer, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Back", onClick: () => resetSelection(), children: /* @__PURE__ */ jsx19(BackIcon, {}) }) }),
769
- modalContent
770
- ]
804
+ className: clsx7(menuItem),
805
+ onSelect: () => disconnectWallet(),
806
+ children: "Disconnect"
771
807
  }
772
- ),
773
- /* @__PURE__ */ jsx19(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ jsx19(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ jsx19(CloseIcon, {}) }) })
774
- ] }) }) }) })
808
+ )
809
+ ] }) }) })
775
810
  ] });
776
811
  }
812
+ function AccountDropdownMenuItem({
813
+ account,
814
+ active
815
+ }) {
816
+ const { mutate: switchAccount } = useSwitchAccount();
817
+ const { data: domain } = useResolveSuiNSName(account.label ? null : account.address);
818
+ return /* @__PURE__ */ jsxs8(
819
+ DropdownMenu.Item,
820
+ {
821
+ className: clsx7(menuItem, switchAccountMenuItem),
822
+ onSelect: () => switchAccount({ account }),
823
+ children: [
824
+ /* @__PURE__ */ jsx19(Text, { mono: true, children: account.label ?? domain ?? formatAddress(account.address) }),
825
+ active ? /* @__PURE__ */ jsx19(CheckIcon, {}) : null
826
+ ]
827
+ }
828
+ );
829
+ }
777
830
 
778
831
  // src/components/ConnectButton.tsx
779
832
  import { jsx as jsx20 } from "react/jsx-runtime";
@@ -1107,10 +1160,9 @@ function createWalletStore({ wallets, storage, storageKey }) {
1107
1160
  },
1108
1161
  updateWalletAccounts(accounts) {
1109
1162
  const currentAccount = get().currentAccount;
1110
- const isCurrentAccountStillAuthorized = currentAccount ? accounts.some(({ address }) => address === currentAccount.address) : false;
1111
1163
  set(() => ({
1112
1164
  accounts,
1113
- currentAccount: isCurrentAccountStillAuthorized ? currentAccount : accounts[0]
1165
+ currentAccount: currentAccount ? accounts.find(({ address }) => address === currentAccount.address) : accounts[0]
1114
1166
  }));
1115
1167
  }
1116
1168
  }),
@@ -1272,190 +1324,203 @@ function WalletConnectionManager({
1272
1324
  return children;
1273
1325
  }
1274
1326
 
1275
- // src/hooks/wallet/useSignPersonalMessage.ts
1327
+ // src/hooks/networkConfig.ts
1328
+ function createNetworkConfig(networkConfig) {
1329
+ function useNetworkConfig() {
1330
+ const { config } = useSuiClientContext();
1331
+ if (!config) {
1332
+ throw new Error("No network config found");
1333
+ }
1334
+ return config;
1335
+ }
1336
+ function useNetworkVariables() {
1337
+ const { variables } = useNetworkConfig();
1338
+ return variables ?? {};
1339
+ }
1340
+ function useNetworkVariable(name) {
1341
+ const variables = useNetworkVariables();
1342
+ return variables[name];
1343
+ }
1344
+ return {
1345
+ networkConfig,
1346
+ useNetworkConfig,
1347
+ useNetworkVariables,
1348
+ useNetworkVariable
1349
+ };
1350
+ }
1351
+
1352
+ // src/hooks/useSuiClientInfiniteQuery.ts
1353
+ import { useInfiniteQuery } from "@tanstack/react-query";
1354
+ function useSuiClientInfiniteQuery(method, params, { queryKey = [], enabled = !!params, ...options } = {}) {
1355
+ const suiContext = useSuiClientContext();
1356
+ return useInfiniteQuery({
1357
+ ...options,
1358
+ queryKey: [suiContext.network, method, params, ...queryKey],
1359
+ enabled,
1360
+ queryFn: async () => {
1361
+ return await suiContext.client[method](params);
1362
+ },
1363
+ getNextPageParam: (lastPage) => {
1364
+ return lastPage.nextCursor ?? null;
1365
+ }
1366
+ });
1367
+ }
1368
+
1369
+ // src/hooks/useSuiClientMutation.ts
1276
1370
  import { useMutation as useMutation4 } from "@tanstack/react-query";
1277
- function useSignPersonalMessage({
1371
+ function useSuiClientMutation(method, options = {}) {
1372
+ const suiContext = useSuiClientContext();
1373
+ return useMutation4({
1374
+ ...options,
1375
+ mutationFn: async (params) => {
1376
+ return await suiContext.client[method](params);
1377
+ }
1378
+ });
1379
+ }
1380
+
1381
+ // src/hooks/wallet/useSignAndExecuteTransactionBlock.ts
1382
+ import { useMutation as useMutation5 } from "@tanstack/react-query";
1383
+ function useSignAndExecuteTransactionBlock({
1278
1384
  mutationKey,
1385
+ executeFromWallet,
1279
1386
  ...mutationOptions
1280
1387
  } = {}) {
1281
1388
  const currentWallet = useCurrentWallet();
1282
1389
  const currentAccount = useCurrentAccount();
1283
- return useMutation4({
1284
- mutationKey: walletMutationKeys.signPersonalMessage(mutationKey),
1285
- mutationFn: async (signPersonalMessageArgs) => {
1390
+ const client = useSuiClient();
1391
+ return useMutation5({
1392
+ mutationKey: walletMutationKeys.signAndExecuteTransactionBlock(mutationKey),
1393
+ mutationFn: async ({ requestType, options, ...signTransactionBlockArgs }) => {
1286
1394
  if (!currentWallet) {
1287
1395
  throw new WalletNotConnectedError("No wallet is connected.");
1288
1396
  }
1289
- const signerAccount = signPersonalMessageArgs.account ?? currentAccount;
1397
+ const signerAccount = signTransactionBlockArgs.account ?? currentAccount;
1290
1398
  if (!signerAccount) {
1291
1399
  throw new WalletNoAccountSelectedError(
1292
- "No wallet account is selected to sign the personal message with."
1400
+ "No wallet account is selected to sign and execute the transaction block with."
1293
1401
  );
1294
1402
  }
1295
- const walletFeature = currentWallet.features["sui:signPersonalMessage"];
1403
+ if (executeFromWallet) {
1404
+ const walletFeature2 = currentWallet.features["sui:signAndExecuteTransactionBlock"];
1405
+ if (!walletFeature2) {
1406
+ throw new WalletFeatureNotSupportedError(
1407
+ "This wallet doesn't support the `signAndExecuteTransactionBlock` feature."
1408
+ );
1409
+ }
1410
+ return walletFeature2.signAndExecuteTransactionBlock({
1411
+ ...signTransactionBlockArgs,
1412
+ account: signerAccount,
1413
+ chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0],
1414
+ requestType,
1415
+ options
1416
+ });
1417
+ }
1418
+ const walletFeature = currentWallet.features["sui:signTransactionBlock"];
1296
1419
  if (!walletFeature) {
1297
1420
  throw new WalletFeatureNotSupportedError(
1298
- "This wallet doesn't support the `signPersonalMessage` feature."
1421
+ "This wallet doesn't support the `signTransactionBlock` feature."
1299
1422
  );
1300
1423
  }
1301
- return await walletFeature.signPersonalMessage({
1302
- ...signPersonalMessageArgs,
1303
- account: signerAccount
1424
+ const { signature, transactionBlockBytes } = await walletFeature.signTransactionBlock({
1425
+ ...signTransactionBlockArgs,
1426
+ account: signerAccount,
1427
+ chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0]
1428
+ });
1429
+ return client.executeTransactionBlock({
1430
+ transactionBlock: transactionBlockBytes,
1431
+ signature,
1432
+ requestType,
1433
+ options
1304
1434
  });
1305
1435
  },
1306
1436
  ...mutationOptions
1307
1437
  });
1308
1438
  }
1309
1439
 
1310
- // src/hooks/wallet/useSignTransactionBlock.ts
1311
- import { useMutation as useMutation5 } from "@tanstack/react-query";
1312
- function useSignTransactionBlock({
1440
+ // src/hooks/wallet/useSignPersonalMessage.ts
1441
+ import { useMutation as useMutation6 } from "@tanstack/react-query";
1442
+ function useSignPersonalMessage({
1313
1443
  mutationKey,
1314
1444
  ...mutationOptions
1315
1445
  } = {}) {
1316
1446
  const currentWallet = useCurrentWallet();
1317
1447
  const currentAccount = useCurrentAccount();
1318
- return useMutation5({
1319
- mutationKey: walletMutationKeys.signTransactionBlock(mutationKey),
1320
- mutationFn: async (signTransactionBlockArgs) => {
1448
+ return useMutation6({
1449
+ mutationKey: walletMutationKeys.signPersonalMessage(mutationKey),
1450
+ mutationFn: async (signPersonalMessageArgs) => {
1321
1451
  if (!currentWallet) {
1322
1452
  throw new WalletNotConnectedError("No wallet is connected.");
1323
1453
  }
1324
- const signerAccount = signTransactionBlockArgs.account ?? currentAccount;
1454
+ const signerAccount = signPersonalMessageArgs.account ?? currentAccount;
1325
1455
  if (!signerAccount) {
1326
1456
  throw new WalletNoAccountSelectedError(
1327
- "No wallet account is selected to sign the transaction block with."
1457
+ "No wallet account is selected to sign the personal message with."
1328
1458
  );
1329
1459
  }
1330
- const walletFeature = currentWallet.features["sui:signTransactionBlock"];
1460
+ const walletFeature = currentWallet.features["sui:signPersonalMessage"];
1331
1461
  if (!walletFeature) {
1332
1462
  throw new WalletFeatureNotSupportedError(
1333
- "This wallet doesn't support the `SignTransactionBlock` feature."
1463
+ "This wallet doesn't support the `signPersonalMessage` feature."
1334
1464
  );
1335
1465
  }
1336
- return await walletFeature.signTransactionBlock({
1337
- ...signTransactionBlockArgs,
1338
- account: signerAccount,
1339
- chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0]
1466
+ return await walletFeature.signPersonalMessage({
1467
+ ...signPersonalMessageArgs,
1468
+ account: signerAccount
1340
1469
  });
1341
1470
  },
1342
1471
  ...mutationOptions
1343
1472
  });
1344
1473
  }
1345
1474
 
1346
- // src/hooks/wallet/useSignAndExecuteTransactionBlock.ts
1347
- import { useMutation as useMutation6 } from "@tanstack/react-query";
1348
- function useSignAndExecuteTransactionBlock({
1475
+ // src/hooks/wallet/useSignTransactionBlock.ts
1476
+ import { useMutation as useMutation7 } from "@tanstack/react-query";
1477
+ function useSignTransactionBlock({
1349
1478
  mutationKey,
1350
- executeFromWallet,
1351
1479
  ...mutationOptions
1352
1480
  } = {}) {
1353
1481
  const currentWallet = useCurrentWallet();
1354
1482
  const currentAccount = useCurrentAccount();
1355
- const client = useSuiClient();
1356
- return useMutation6({
1357
- mutationKey: walletMutationKeys.signAndExecuteTransactionBlock(mutationKey),
1358
- mutationFn: async ({ requestType, options, ...signTransactionBlockArgs }) => {
1483
+ return useMutation7({
1484
+ mutationKey: walletMutationKeys.signTransactionBlock(mutationKey),
1485
+ mutationFn: async (signTransactionBlockArgs) => {
1359
1486
  if (!currentWallet) {
1360
1487
  throw new WalletNotConnectedError("No wallet is connected.");
1361
1488
  }
1362
1489
  const signerAccount = signTransactionBlockArgs.account ?? currentAccount;
1363
1490
  if (!signerAccount) {
1364
1491
  throw new WalletNoAccountSelectedError(
1365
- "No wallet account is selected to sign and execute the transaction block with."
1492
+ "No wallet account is selected to sign the transaction block with."
1366
1493
  );
1367
1494
  }
1368
- if (executeFromWallet) {
1369
- const walletFeature2 = currentWallet.features["sui:signAndExecuteTransactionBlock"];
1370
- if (!walletFeature2) {
1371
- throw new WalletFeatureNotSupportedError(
1372
- "This wallet doesn't support the `signAndExecuteTransactionBlock` feature."
1373
- );
1374
- }
1375
- return walletFeature2.signAndExecuteTransactionBlock({
1376
- ...signTransactionBlockArgs,
1377
- account: signerAccount,
1378
- chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0],
1379
- requestType,
1380
- options
1381
- });
1382
- }
1383
1495
  const walletFeature = currentWallet.features["sui:signTransactionBlock"];
1384
1496
  if (!walletFeature) {
1385
1497
  throw new WalletFeatureNotSupportedError(
1386
- "This wallet doesn't support the `signTransactionBlock` feature."
1498
+ "This wallet doesn't support the `SignTransactionBlock` feature."
1387
1499
  );
1388
1500
  }
1389
- const { signature, transactionBlockBytes } = await walletFeature.signTransactionBlock({
1501
+ return await walletFeature.signTransactionBlock({
1390
1502
  ...signTransactionBlockArgs,
1391
1503
  account: signerAccount,
1392
1504
  chain: signTransactionBlockArgs.chain ?? signerAccount.chains[0]
1393
1505
  });
1394
- return client.executeTransactionBlock({
1395
- transactionBlock: transactionBlockBytes,
1396
- signature,
1397
- requestType,
1398
- options
1399
- });
1400
1506
  },
1401
1507
  ...mutationOptions
1402
1508
  });
1403
1509
  }
1404
-
1405
- // src/hooks/useSuiClientMutation.ts
1406
- import { useMutation as useMutation7 } from "@tanstack/react-query";
1407
- function useSuiClientMutation(method, options = {}) {
1408
- const suiContext = useSuiClientContext();
1409
- return useMutation7({
1410
- ...options,
1411
- mutationFn: async (params) => {
1412
- return await suiContext.client[method](params);
1413
- }
1414
- });
1415
- }
1416
-
1417
- // src/hooks/useSuiClientQuery.ts
1418
- import { useQuery } from "@tanstack/react-query";
1419
- function useSuiClientQuery(...args) {
1420
- const [method, params, { queryKey = [], ...options } = {}] = args;
1421
- const suiContext = useSuiClientContext();
1422
- return useQuery({
1423
- ...options,
1424
- queryKey: [suiContext.network, method, params, ...queryKey],
1425
- queryFn: async () => {
1426
- return await suiContext.client[method](params);
1427
- }
1428
- });
1429
- }
1430
-
1431
- // src/hooks/useSuiClientInfiniteQuery.ts
1432
- import { useInfiniteQuery } from "@tanstack/react-query";
1433
- function useSuiClientInfiniteQuery(method, params, { queryKey = [], enabled = !!params, ...options } = {}) {
1434
- const suiContext = useSuiClientContext();
1435
- return useInfiniteQuery({
1436
- ...options,
1437
- queryKey: [suiContext.network, method, params, ...queryKey],
1438
- enabled,
1439
- queryFn: async () => {
1440
- return await suiContext.client[method](params);
1441
- },
1442
- getNextPageParam: (lastPage) => {
1443
- return lastPage.nextCursor ?? null;
1444
- }
1445
- });
1446
- }
1447
1510
  export {
1448
1511
  ConnectButton,
1449
1512
  ConnectModal,
1450
1513
  SuiClientContext,
1451
1514
  SuiClientProvider,
1452
1515
  WalletProvider,
1516
+ createNetworkConfig,
1453
1517
  lightTheme,
1454
1518
  useAccounts,
1455
1519
  useConnectWallet,
1456
1520
  useCurrentAccount,
1457
1521
  useCurrentWallet,
1458
1522
  useDisconnectWallet,
1523
+ useResolveSuiNSName,
1459
1524
  useSignAndExecuteTransactionBlock,
1460
1525
  useSignPersonalMessage,
1461
1526
  useSignTransactionBlock,