@iota/dapp-kit 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/cjs/components/AccountDropdownMenu.css +50 -16
- package/dist/cjs/components/AccountDropdownMenu.css.css +39 -16
- package/dist/cjs/components/AccountDropdownMenu.css.css.map +3 -3
- package/dist/cjs/components/AccountDropdownMenu.css.d.ts +3 -0
- package/dist/cjs/components/AccountDropdownMenu.css.d.ts.map +1 -1
- package/dist/cjs/components/AccountDropdownMenu.css.js +12 -6
- package/dist/cjs/components/AccountDropdownMenu.css.js.map +2 -2
- package/dist/cjs/components/AccountDropdownMenu.css.map +3 -3
- package/dist/cjs/components/AccountDropdownMenu.d.ts.map +1 -1
- package/dist/cjs/components/AccountDropdownMenu.js +184 -86
- package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
- package/dist/cjs/components/ConnectButton.css +50 -16
- package/dist/cjs/components/ConnectButton.css.map +3 -3
- package/dist/cjs/components/ConnectButton.js +259 -161
- package/dist/cjs/components/ConnectButton.js.map +4 -4
- package/dist/cjs/components/IotaNameNftImage.css +11 -0
- package/dist/cjs/components/IotaNameNftImage.css.css +11 -0
- package/dist/cjs/components/IotaNameNftImage.css.css.map +7 -0
- package/dist/cjs/components/IotaNameNftImage.css.d.ts +2 -0
- package/dist/cjs/components/IotaNameNftImage.css.d.ts.map +1 -0
- package/dist/cjs/components/IotaNameNftImage.css.js +27 -0
- package/dist/cjs/components/IotaNameNftImage.css.js.map +7 -0
- package/dist/cjs/components/IotaNameNftImage.css.map +7 -0
- package/dist/cjs/components/IotaNameNftImage.d.ts +8 -0
- package/dist/cjs/components/IotaNameNftImage.d.ts.map +1 -0
- package/dist/cjs/components/IotaNameNftImage.js +165 -0
- package/dist/cjs/components/IotaNameNftImage.js.map +7 -0
- package/dist/cjs/hooks/useGetDefaultIotaName.d.ts +1 -1
- package/dist/cjs/hooks/useGetDefaultIotaName.d.ts.map +1 -1
- package/dist/cjs/hooks/useGetDefaultIotaName.js +26 -16
- package/dist/cjs/hooks/useGetDefaultIotaName.js.map +4 -4
- package/dist/cjs/hooks/useGetIotaNameAvatar.d.ts +2 -0
- package/dist/cjs/hooks/useGetIotaNameAvatar.d.ts.map +1 -0
- package/dist/cjs/hooks/useGetIotaNameAvatar.js +144 -0
- package/dist/cjs/hooks/useGetIotaNameAvatar.js.map +7 -0
- package/dist/cjs/hooks/useIotaNamesClient.d.ts +7 -0
- package/dist/cjs/hooks/useIotaNamesClient.d.ts.map +1 -0
- package/dist/cjs/hooks/useIotaNamesClient.js +71 -0
- package/dist/cjs/hooks/useIotaNamesClient.js.map +7 -0
- package/dist/cjs/index.css +50 -16
- package/dist/cjs/index.css.map +3 -3
- package/dist/cjs/index.js +171 -76
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/components/AccountDropdownMenu.css +50 -16
- package/dist/esm/components/AccountDropdownMenu.css.css +39 -16
- package/dist/esm/components/AccountDropdownMenu.css.css.map +3 -3
- package/dist/esm/components/AccountDropdownMenu.css.d.ts +3 -0
- package/dist/esm/components/AccountDropdownMenu.css.d.ts.map +1 -1
- package/dist/esm/components/AccountDropdownMenu.css.js +12 -6
- package/dist/esm/components/AccountDropdownMenu.css.js.map +2 -2
- package/dist/esm/components/AccountDropdownMenu.css.map +3 -3
- package/dist/esm/components/AccountDropdownMenu.d.ts.map +1 -1
- package/dist/esm/components/AccountDropdownMenu.js +177 -79
- package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
- package/dist/esm/components/ConnectButton.css +50 -16
- package/dist/esm/components/ConnectButton.css.map +3 -3
- package/dist/esm/components/ConnectButton.js +236 -138
- package/dist/esm/components/ConnectButton.js.map +4 -4
- package/dist/esm/components/IotaNameNftImage.css +11 -0
- package/dist/esm/components/IotaNameNftImage.css.css +11 -0
- package/dist/esm/components/IotaNameNftImage.css.css.map +7 -0
- package/dist/esm/components/IotaNameNftImage.css.d.ts +2 -0
- package/dist/esm/components/IotaNameNftImage.css.d.ts.map +1 -0
- package/dist/esm/components/IotaNameNftImage.css.js +6 -0
- package/dist/esm/components/IotaNameNftImage.css.js.map +7 -0
- package/dist/esm/components/IotaNameNftImage.css.map +7 -0
- package/dist/esm/components/IotaNameNftImage.d.ts +8 -0
- package/dist/esm/components/IotaNameNftImage.d.ts.map +1 -0
- package/dist/esm/components/IotaNameNftImage.js +144 -0
- package/dist/esm/components/IotaNameNftImage.js.map +7 -0
- package/dist/esm/hooks/useGetDefaultIotaName.d.ts +1 -1
- package/dist/esm/hooks/useGetDefaultIotaName.d.ts.map +1 -1
- package/dist/esm/hooks/useGetDefaultIotaName.js +26 -16
- package/dist/esm/hooks/useGetDefaultIotaName.js.map +4 -4
- package/dist/esm/hooks/useGetIotaNameAvatar.d.ts +2 -0
- package/dist/esm/hooks/useGetIotaNameAvatar.d.ts.map +1 -0
- package/dist/esm/hooks/useGetIotaNameAvatar.js +123 -0
- package/dist/esm/hooks/useGetIotaNameAvatar.js.map +7 -0
- package/dist/esm/hooks/useIotaNamesClient.d.ts +7 -0
- package/dist/esm/hooks/useIotaNamesClient.d.ts.map +1 -0
- package/dist/esm/hooks/useIotaNamesClient.js +50 -0
- package/dist/esm/hooks/useIotaNamesClient.js.map +7 -0
- package/dist/esm/index.css +50 -16
- package/dist/esm/index.css.map +3 -3
- package/dist/esm/index.js +142 -47
- package/dist/esm/index.js.map +4 -4
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/AccountDropdownMenu.css.ts +24 -1
- package/src/components/AccountDropdownMenu.tsx +12 -2
- package/src/components/IotaNameNftImage.css.ts +14 -0
- package/src/components/IotaNameNftImage.tsx +30 -0
- package/src/hooks/useGetDefaultIotaName.ts +6 -22
- package/src/hooks/useGetIotaNameAvatar.ts +72 -0
- package/src/hooks/useIotaNamesClient.ts +29 -0
|
@@ -217,13 +217,16 @@ function useSwitchAccount({
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// src/components/AccountDropdownMenu.css.ts
|
|
220
|
+
var accountIdentity = "AccountDropdownMenu_accountIdentity__1x0gmpf8";
|
|
221
|
+
var accountName = "AccountDropdownMenu_accountName__1x0gmpf1";
|
|
222
|
+
var accountNameMenuItem = "AccountDropdownMenu_accountNameMenuItem__1x0gmpf2";
|
|
220
223
|
var connectedAccount = "AccountDropdownMenu_connectedAccount__1x0gmpf0";
|
|
221
|
-
var menuContainer = "
|
|
222
|
-
var menuContent = "
|
|
223
|
-
var menuItem = "
|
|
224
|
-
var scrollableContent = "
|
|
225
|
-
var separator = "
|
|
226
|
-
var switchAccountMenuItem = "
|
|
224
|
+
var menuContainer = "AccountDropdownMenu_menuContainer__1x0gmpf3";
|
|
225
|
+
var menuContent = "AccountDropdownMenu_menuContent__1x0gmpf4";
|
|
226
|
+
var menuItem = "AccountDropdownMenu_menuItem__1x0gmpf6";
|
|
227
|
+
var scrollableContent = "AccountDropdownMenu_scrollableContent__1x0gmpf5";
|
|
228
|
+
var separator = "AccountDropdownMenu_separator__1x0gmpf9";
|
|
229
|
+
var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__1x0gmpf7";
|
|
227
230
|
|
|
228
231
|
// src/components/icons/CheckIcon.tsx
|
|
229
232
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -252,9 +255,150 @@ function ChevronIcon(props) {
|
|
|
252
255
|
) });
|
|
253
256
|
}
|
|
254
257
|
|
|
258
|
+
// src/components/IotaNameNftImage.tsx
|
|
259
|
+
var import_react6 = require("react");
|
|
260
|
+
|
|
261
|
+
// src/hooks/useGetIotaNameAvatar.ts
|
|
262
|
+
var import_iota_names_sdk3 = require("@iota/iota-names-sdk");
|
|
263
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
264
|
+
|
|
265
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
266
|
+
var import_iota_names_sdk2 = require("@iota/iota-names-sdk");
|
|
267
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
268
|
+
|
|
269
|
+
// src/hooks/useIotaNamesClient.ts
|
|
270
|
+
var import_graphql = require("@iota/iota-sdk/graphql");
|
|
271
|
+
var import_iota_names_sdk = require("@iota/iota-names-sdk");
|
|
272
|
+
var import_client2 = require("@iota/iota-sdk/client");
|
|
273
|
+
var import_react5 = require("react");
|
|
274
|
+
|
|
275
|
+
// src/hooks/useIotaClient.ts
|
|
276
|
+
var import_react4 = require("react");
|
|
277
|
+
|
|
278
|
+
// src/components/IotaClientProvider.tsx
|
|
279
|
+
var import_client = require("@iota/iota-sdk/client");
|
|
280
|
+
var import_react3 = require("react");
|
|
281
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
282
|
+
var IotaClientContext = (0, import_react3.createContext)(null);
|
|
283
|
+
var DEFAULT_NETWORKS = {
|
|
284
|
+
localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet)?.url }
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// src/hooks/useIotaClient.ts
|
|
288
|
+
function useIotaClientContext() {
|
|
289
|
+
const iotaClient = (0, import_react4.useContext)(IotaClientContext);
|
|
290
|
+
if (!iotaClient) {
|
|
291
|
+
throw new Error(
|
|
292
|
+
"Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider"
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
return iotaClient;
|
|
296
|
+
}
|
|
297
|
+
function useIotaClient() {
|
|
298
|
+
return useIotaClientContext().client;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/hooks/useIotaNamesClient.ts
|
|
302
|
+
function useIotaNamesClient() {
|
|
303
|
+
const { network: networkId } = useIotaClientContext();
|
|
304
|
+
const network = (0, import_client2.getNetwork)(networkId);
|
|
305
|
+
const iotaNamesClient = (0, import_react5.useMemo)(() => {
|
|
306
|
+
if (!network.graphql) return null;
|
|
307
|
+
return new import_iota_names_sdk.IotaNamesClient({
|
|
308
|
+
graphQlClient: new import_graphql.IotaGraphQLClient({ url: network.graphql }),
|
|
309
|
+
network: network.id
|
|
310
|
+
});
|
|
311
|
+
}, [network.id, network.graphql]);
|
|
312
|
+
return {
|
|
313
|
+
iotaNamesClient,
|
|
314
|
+
networkId: network.id,
|
|
315
|
+
isSupported: !!iotaNamesClient?.config
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
320
|
+
function useGetDefaultIotaName(address, iotaNamesEnabled) {
|
|
321
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
322
|
+
return (0, import_react_query3.useQuery)({
|
|
323
|
+
queryKey: ["iota-name", "default-name", address, networkId],
|
|
324
|
+
queryFn: async () => {
|
|
325
|
+
if (!address) return null;
|
|
326
|
+
const name = await iotaNamesClient?.getPublicName(address);
|
|
327
|
+
return name ? (0, import_iota_names_sdk2.normalizeIotaName)(name) : name;
|
|
328
|
+
},
|
|
329
|
+
enabled: !!address && iotaNamesEnabled && isSupported,
|
|
330
|
+
staleTime: 1e3 * 60 * 10
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// src/hooks/useGetIotaNameAvatar.ts
|
|
335
|
+
function useGetIotaNameAvatar(address, iotaNamesEnabled) {
|
|
336
|
+
const client = useIotaClient();
|
|
337
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
338
|
+
const { data: name } = useGetDefaultIotaName(address, iotaNamesEnabled);
|
|
339
|
+
return (0, import_react_query4.useQuery)({
|
|
340
|
+
// eslint-disable-next-line @tanstack/query/exhaustive-deps
|
|
341
|
+
queryKey: ["iota-name", "avatar", name, networkId],
|
|
342
|
+
queryFn: async () => {
|
|
343
|
+
if (!name || !address || !iotaNamesClient) return null;
|
|
344
|
+
const nameRecord = await iotaNamesClient.getNameRecord(name);
|
|
345
|
+
if (!nameRecord) return null;
|
|
346
|
+
const avatarObjectId = nameRecord.avatar ?? ((0, import_iota_names_sdk3.isSubname)(name) ? await findSubnameNftId() : nameRecord.nftId);
|
|
347
|
+
if (!avatarObjectId) return null;
|
|
348
|
+
const objectResponse = await client.getObject({
|
|
349
|
+
id: avatarObjectId,
|
|
350
|
+
options: { showDisplay: true }
|
|
351
|
+
});
|
|
352
|
+
return objectResponse?.data?.display?.data?.image_url ?? null;
|
|
353
|
+
async function findSubnameNftId() {
|
|
354
|
+
let subnameType;
|
|
355
|
+
try {
|
|
356
|
+
subnameType = (0, import_iota_names_sdk3.getSubnameRegistrationType)(
|
|
357
|
+
iotaNamesClient.getPackage("packageId", "v1")
|
|
358
|
+
);
|
|
359
|
+
} catch {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
const { data } = await client.getOwnedObjects({
|
|
363
|
+
owner: address,
|
|
364
|
+
filter: { StructType: subnameType },
|
|
365
|
+
options: { showDisplay: true }
|
|
366
|
+
});
|
|
367
|
+
return data.find((object) => {
|
|
368
|
+
try {
|
|
369
|
+
return (0, import_iota_names_sdk3.normalizeIotaName)(object.data?.display?.data?.name ?? "") === name;
|
|
370
|
+
} catch {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
})?.data?.objectId ?? null;
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
enabled: iotaNamesEnabled && isSupported && !!name && !!address,
|
|
377
|
+
staleTime: 1e3 * 60 * 5
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// src/components/IotaNameNftImage.css.ts
|
|
382
|
+
var image = "IotaNameNftImage_image__qs9r060";
|
|
383
|
+
|
|
384
|
+
// src/components/IotaNameNftImage.tsx
|
|
385
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
386
|
+
function IotaNameNftImage({
|
|
387
|
+
address,
|
|
388
|
+
iotaNamesEnabled,
|
|
389
|
+
alt = "name NFT avatar"
|
|
390
|
+
}) {
|
|
391
|
+
const { data: imageUrl, isLoading } = useGetIotaNameAvatar(address, iotaNamesEnabled);
|
|
392
|
+
const [imgError, setImgError] = (0, import_react6.useState)(false);
|
|
393
|
+
if (!iotaNamesEnabled || isLoading || !imageUrl || imgError) {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: imageUrl, alt, className: image, onError: () => setImgError(true) });
|
|
397
|
+
}
|
|
398
|
+
|
|
255
399
|
// src/components/styling/StyleMarker.tsx
|
|
256
400
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
257
|
-
var
|
|
401
|
+
var import_react7 = require("react");
|
|
258
402
|
|
|
259
403
|
// src/constants/styleDataAttribute.ts
|
|
260
404
|
var styleDataAttributeName = "data-dapp-kit";
|
|
@@ -263,25 +407,25 @@ var styleDataAttribute = { [styleDataAttributeName]: "" };
|
|
|
263
407
|
|
|
264
408
|
// src/components/styling/StyleMarker.tsx
|
|
265
409
|
var import_StyleMarker_css = __toESM(require_StyleMarker_css());
|
|
266
|
-
var
|
|
267
|
-
var StyleMarker = (0,
|
|
410
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
411
|
+
var StyleMarker = (0, import_react7.forwardRef)(({ children, ...props }, forwardedRef) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_slot.Slot, { ref: forwardedRef, ...props, ...styleDataAttribute, children }));
|
|
268
412
|
StyleMarker.displayName = "StyleMarker";
|
|
269
413
|
|
|
270
414
|
// src/components/ui/Button.tsx
|
|
271
415
|
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
272
416
|
var import_clsx = __toESM(require("clsx"));
|
|
273
|
-
var
|
|
417
|
+
var import_react8 = require("react");
|
|
274
418
|
|
|
275
419
|
// src/components/ui/Button.css.ts
|
|
276
420
|
var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
277
421
|
var buttonVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "Button_buttonVariants__ctbx2n0", variantClassNames: { variant: { primary: "Button_buttonVariants_variant_primary__ctbx2n1", outline: "Button_buttonVariants_variant_outline__ctbx2n2" }, size: { md: "Button_buttonVariants_size_md__ctbx2n3", lg: "Button_buttonVariants_size_lg__ctbx2n4" } }, defaultVariants: { variant: "primary", size: "md" }, compoundVariants: [] });
|
|
278
422
|
|
|
279
423
|
// src/components/ui/Button.tsx
|
|
280
|
-
var
|
|
281
|
-
var Button = (0,
|
|
424
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
425
|
+
var Button = (0, import_react8.forwardRef)(
|
|
282
426
|
({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
|
|
283
427
|
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
284
|
-
return /* @__PURE__ */ (0,
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
285
429
|
Comp,
|
|
286
430
|
{
|
|
287
431
|
...props,
|
|
@@ -296,15 +440,15 @@ Button.displayName = "Button";
|
|
|
296
440
|
// src/components/ui/Text.tsx
|
|
297
441
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
298
442
|
var import_clsx2 = __toESM(require("clsx"));
|
|
299
|
-
var
|
|
443
|
+
var import_react9 = require("react");
|
|
300
444
|
|
|
301
445
|
// src/components/ui/Text.css.ts
|
|
302
446
|
var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
303
447
|
var textVariants = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "Text__aprhbd0", variantClassNames: { size: { sm: "Text_textVariants_size_sm__aprhbd1" }, weight: { normal: "Text_textVariants_weight_normal__aprhbd2", medium: "Text_textVariants_weight_medium__aprhbd3", bold: "Text_textVariants_weight_bold__aprhbd4" }, color: { muted: "Text_textVariants_color_muted__aprhbd5", danger: "Text_textVariants_color_danger__aprhbd6" }, mono: { true: "Text_textVariants_mono_true__aprhbd7" } }, defaultVariants: { size: "sm", weight: "normal" }, compoundVariants: [] });
|
|
304
448
|
|
|
305
449
|
// src/components/ui/Text.tsx
|
|
306
|
-
var
|
|
307
|
-
var Text = (0,
|
|
450
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
451
|
+
var Text = (0, import_react9.forwardRef)(
|
|
308
452
|
({
|
|
309
453
|
children,
|
|
310
454
|
className,
|
|
@@ -316,77 +460,21 @@ var Text = (0, import_react5.forwardRef)(
|
|
|
316
460
|
mono,
|
|
317
461
|
...textProps
|
|
318
462
|
}, forwardedRef) => {
|
|
319
|
-
return /* @__PURE__ */ (0,
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
320
464
|
import_react_slot3.Slot,
|
|
321
465
|
{
|
|
322
466
|
...textProps,
|
|
323
467
|
ref: forwardedRef,
|
|
324
468
|
className: (0, import_clsx2.default)(textVariants({ size, weight, color, mono }), className),
|
|
325
|
-
children: asChild ? children : /* @__PURE__ */ (0,
|
|
469
|
+
children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tag, { children })
|
|
326
470
|
}
|
|
327
471
|
);
|
|
328
472
|
}
|
|
329
473
|
);
|
|
330
474
|
Text.displayName = "Text";
|
|
331
475
|
|
|
332
|
-
// src/hooks/useGetDefaultIotaName.ts
|
|
333
|
-
var import_client2 = require("@iota/iota-sdk/client");
|
|
334
|
-
var import_react_query3 = require("@tanstack/react-query");
|
|
335
|
-
var import_iota_names_sdk = require("@iota/iota-names-sdk");
|
|
336
|
-
|
|
337
|
-
// src/hooks/useIotaClient.ts
|
|
338
|
-
var import_react7 = require("react");
|
|
339
|
-
|
|
340
|
-
// src/components/IotaClientProvider.tsx
|
|
341
|
-
var import_client = require("@iota/iota-sdk/client");
|
|
342
|
-
var import_react6 = require("react");
|
|
343
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
344
|
-
var IotaClientContext = (0, import_react6.createContext)(null);
|
|
345
|
-
var DEFAULT_NETWORKS = {
|
|
346
|
-
localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet)?.url }
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
// src/hooks/useIotaClient.ts
|
|
350
|
-
function useIotaClientContext() {
|
|
351
|
-
const iotaClient = (0, import_react7.useContext)(IotaClientContext);
|
|
352
|
-
if (!iotaClient) {
|
|
353
|
-
throw new Error(
|
|
354
|
-
"Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider"
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
return iotaClient;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// src/hooks/useGetDefaultIotaName.ts
|
|
361
|
-
var import_react8 = require("react");
|
|
362
|
-
var import_graphql = require("@iota/iota-sdk/graphql");
|
|
363
|
-
function useGetDefaultIotaName(address, iotaNamesEnabled) {
|
|
364
|
-
const iotaContext = useIotaClientContext();
|
|
365
|
-
const network = (0, import_client2.getNetwork)(iotaContext.network);
|
|
366
|
-
const iotaNamesClient = (0, import_react8.useMemo)(() => {
|
|
367
|
-
const iotaGraphQLClient = new import_graphql.IotaGraphQLClient({
|
|
368
|
-
url: network.graphql
|
|
369
|
-
});
|
|
370
|
-
return new import_iota_names_sdk.IotaNamesClient({
|
|
371
|
-
graphQlClient: iotaGraphQLClient,
|
|
372
|
-
network: network.id
|
|
373
|
-
});
|
|
374
|
-
}, [network.id]);
|
|
375
|
-
const iotaNamesSupported = !!iotaNamesClient.config;
|
|
376
|
-
return (0, import_react_query3.useQuery)({
|
|
377
|
-
queryKey: ["iota-name", "default-name", address],
|
|
378
|
-
queryFn: async () => {
|
|
379
|
-
if (!address) return null;
|
|
380
|
-
const name = await iotaNamesClient?.getPublicName(address);
|
|
381
|
-
return name ? (0, import_iota_names_sdk.normalizeIotaName)(name) : name;
|
|
382
|
-
},
|
|
383
|
-
enabled: !!iotaNamesClient && !!address && iotaNamesEnabled && iotaNamesSupported,
|
|
384
|
-
staleTime: 1e3 * 60 * 10
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
|
|
388
476
|
// src/components/AccountDropdownMenu.tsx
|
|
389
|
-
var
|
|
477
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
390
478
|
function AccountDropdownMenu({
|
|
391
479
|
currentAccount,
|
|
392
480
|
size = "lg",
|
|
@@ -396,13 +484,20 @@ function AccountDropdownMenu({
|
|
|
396
484
|
const accounts = useAccounts();
|
|
397
485
|
const { data: iotaName } = useGetDefaultIotaName(currentAccount.address, iotaNamesEnabled);
|
|
398
486
|
const displayAccount = iotaName ?? currentAccount.label ?? (0, import_utils.formatAddress)(currentAccount.address);
|
|
399
|
-
return /* @__PURE__ */ (0,
|
|
400
|
-
/* @__PURE__ */ (0,
|
|
401
|
-
/* @__PURE__ */ (0,
|
|
402
|
-
|
|
487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu.Root, { modal: false, children: [
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { size, className: connectedAccount, children: [
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
490
|
+
IotaNameNftImage,
|
|
491
|
+
{
|
|
492
|
+
address: currentAccount.address,
|
|
493
|
+
iotaNamesEnabled
|
|
494
|
+
}
|
|
495
|
+
),
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { mono: true, weight: "bold", className: accountName, children: displayAccount }),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChevronIcon, {})
|
|
403
498
|
] }) }) }),
|
|
404
|
-
/* @__PURE__ */ (0,
|
|
405
|
-
/* @__PURE__ */ (0,
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StyleMarker, { className: menuContainer, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu.Content, { className: menuContent, children: [
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: scrollableContent, children: accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
406
501
|
AccountDropdownMenuItem,
|
|
407
502
|
{
|
|
408
503
|
account,
|
|
@@ -411,8 +506,8 @@ function AccountDropdownMenu({
|
|
|
411
506
|
},
|
|
412
507
|
account.address
|
|
413
508
|
)) }),
|
|
414
|
-
/* @__PURE__ */ (0,
|
|
415
|
-
/* @__PURE__ */ (0,
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenu.Separator, { className: separator }),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
416
511
|
DropdownMenu.Item,
|
|
417
512
|
{
|
|
418
513
|
className: (0, import_clsx3.default)(menuItem),
|
|
@@ -431,14 +526,17 @@ function AccountDropdownMenuItem({
|
|
|
431
526
|
const { mutate: switchAccount } = useSwitchAccount();
|
|
432
527
|
const { data: iotaName } = useGetDefaultIotaName(account.address, iotaNamesEnabled);
|
|
433
528
|
const displayAccount = iotaName ?? account.label ?? (0, import_utils.formatAddress)(account.address);
|
|
434
|
-
return /* @__PURE__ */ (0,
|
|
529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
435
530
|
DropdownMenu.Item,
|
|
436
531
|
{
|
|
437
532
|
className: (0, import_clsx3.default)(menuItem, switchAccountMenuItem),
|
|
438
533
|
onSelect: () => switchAccount({ account }),
|
|
439
534
|
children: [
|
|
440
|
-
/* @__PURE__ */ (0,
|
|
441
|
-
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: accountIdentity, children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IotaNameNftImage, { address: account.address, iotaNamesEnabled }),
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { mono: true, className: accountNameMenuItem, children: displayAccount })
|
|
538
|
+
] }),
|
|
539
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon, {}) : null
|
|
442
540
|
]
|
|
443
541
|
}
|
|
444
542
|
);
|
|
@@ -447,11 +545,11 @@ function AccountDropdownMenuItem({
|
|
|
447
545
|
// src/components/connect-modal/ConnectModal.tsx
|
|
448
546
|
var Dialog = __toESM(require("@radix-ui/react-dialog"));
|
|
449
547
|
var import_clsx7 = __toESM(require("clsx"));
|
|
450
|
-
var
|
|
548
|
+
var import_react12 = require("react");
|
|
451
549
|
|
|
452
550
|
// src/hooks/wallet/useConnectWallet.ts
|
|
453
551
|
var import_wallet_standard = require("@iota/wallet-standard");
|
|
454
|
-
var
|
|
552
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
455
553
|
function useConnectWallet({
|
|
456
554
|
onConnected,
|
|
457
555
|
mutationKey,
|
|
@@ -459,7 +557,7 @@ function useConnectWallet({
|
|
|
459
557
|
} = {}) {
|
|
460
558
|
const setWalletConnected = useWalletStore((state) => state.setWalletConnected);
|
|
461
559
|
const setConnectionStatus = useWalletStore((state) => state.setConnectionStatus);
|
|
462
|
-
return (0,
|
|
560
|
+
return (0, import_react_query5.useMutation)({
|
|
463
561
|
mutationKey: walletMutationKeys.connectWallet(mutationKey),
|
|
464
562
|
mutationFn: async ({ wallet, accountAddress, ...connectArgs }) => {
|
|
465
563
|
try {
|
|
@@ -505,9 +603,9 @@ function getWalletUniqueIdentifier(wallet) {
|
|
|
505
603
|
}
|
|
506
604
|
|
|
507
605
|
// src/components/icons/BackIcon.tsx
|
|
508
|
-
var
|
|
606
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
509
607
|
function BackIcon(props) {
|
|
510
|
-
return /* @__PURE__ */ (0,
|
|
608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: 24, height: 24, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
511
609
|
"path",
|
|
512
610
|
{
|
|
513
611
|
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",
|
|
@@ -517,9 +615,9 @@ function BackIcon(props) {
|
|
|
517
615
|
}
|
|
518
616
|
|
|
519
617
|
// src/components/icons/CloseIcon.tsx
|
|
520
|
-
var
|
|
618
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
521
619
|
function CloseIcon(props) {
|
|
522
|
-
return /* @__PURE__ */ (0,
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: 10, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
523
621
|
"path",
|
|
524
622
|
{
|
|
525
623
|
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",
|
|
@@ -531,15 +629,15 @@ function CloseIcon(props) {
|
|
|
531
629
|
// src/components/ui/Heading.tsx
|
|
532
630
|
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
533
631
|
var import_clsx4 = __toESM(require("clsx"));
|
|
534
|
-
var
|
|
632
|
+
var import_react10 = require("react");
|
|
535
633
|
|
|
536
634
|
// src/components/ui/Heading.css.ts
|
|
537
635
|
var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
538
636
|
var headingVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "Heading__12b5l8i0", variantClassNames: { size: { sm: "Heading_headingVariants_size_sm__12b5l8i1", md: "Heading_headingVariants_size_md__12b5l8i2", lg: "Heading_headingVariants_size_lg__12b5l8i3", xl: "Heading_headingVariants_size_xl__12b5l8i4" }, weight: { normal: "Heading_headingVariants_weight_normal__12b5l8i5", bold: "Heading_headingVariants_weight_bold__12b5l8i6" }, truncate: { true: "Heading_headingVariants_truncate_true__12b5l8i7" } }, defaultVariants: { size: "lg", weight: "bold" }, compoundVariants: [] });
|
|
539
637
|
|
|
540
638
|
// src/components/ui/Heading.tsx
|
|
541
|
-
var
|
|
542
|
-
var Heading = (0,
|
|
639
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
640
|
+
var Heading = (0, import_react10.forwardRef)(
|
|
543
641
|
({
|
|
544
642
|
children,
|
|
545
643
|
className,
|
|
@@ -550,13 +648,13 @@ var Heading = (0, import_react9.forwardRef)(
|
|
|
550
648
|
truncate,
|
|
551
649
|
...headingProps
|
|
552
650
|
}, forwardedRef) => {
|
|
553
|
-
return /* @__PURE__ */ (0,
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
554
652
|
import_react_slot4.Slot,
|
|
555
653
|
{
|
|
556
654
|
...headingProps,
|
|
557
655
|
ref: forwardedRef,
|
|
558
656
|
className: (0, import_clsx4.default)(headingVariants({ size, weight, truncate }), className),
|
|
559
|
-
children: asChild ? children : /* @__PURE__ */ (0,
|
|
657
|
+
children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Tag, { children })
|
|
560
658
|
}
|
|
561
659
|
);
|
|
562
660
|
}
|
|
@@ -566,17 +664,17 @@ Heading.displayName = "Heading";
|
|
|
566
664
|
// src/components/ui/IconButton.tsx
|
|
567
665
|
var import_react_slot5 = require("@radix-ui/react-slot");
|
|
568
666
|
var import_clsx5 = __toESM(require("clsx"));
|
|
569
|
-
var
|
|
667
|
+
var import_react11 = require("react");
|
|
570
668
|
|
|
571
669
|
// src/components/ui/IconButton.css.ts
|
|
572
670
|
var container = "IconButton_container__ap1qll0";
|
|
573
671
|
|
|
574
672
|
// src/components/ui/IconButton.tsx
|
|
575
|
-
var
|
|
576
|
-
var IconButton = (0,
|
|
673
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
674
|
+
var IconButton = (0, import_react11.forwardRef)(
|
|
577
675
|
({ className, asChild = false, ...props }, forwardedRef) => {
|
|
578
676
|
const Comp = asChild ? import_react_slot5.Slot : "button";
|
|
579
|
-
return /* @__PURE__ */ (0,
|
|
677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, { ...props, className: (0, import_clsx5.default)(container, className), ref: forwardedRef });
|
|
580
678
|
}
|
|
581
679
|
);
|
|
582
680
|
IconButton.displayName = "Button";
|
|
@@ -602,14 +700,14 @@ var title2 = "ConnectionStatus_title__c5q1ll2";
|
|
|
602
700
|
var walletIcon = "ConnectionStatus_walletIcon__c5q1ll1";
|
|
603
701
|
|
|
604
702
|
// src/components/connect-modal/views/ConnectionStatus.tsx
|
|
605
|
-
var
|
|
703
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
606
704
|
function ConnectionStatus({
|
|
607
705
|
selectedWallet,
|
|
608
706
|
hadConnectionError,
|
|
609
707
|
onRetryConnection
|
|
610
708
|
}) {
|
|
611
|
-
return /* @__PURE__ */ (0,
|
|
612
|
-
selectedWallet.icon && /* @__PURE__ */ (0,
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: container2, children: [
|
|
710
|
+
selectedWallet.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
613
711
|
"img",
|
|
614
712
|
{
|
|
615
713
|
className: walletIcon,
|
|
@@ -617,12 +715,12 @@ function ConnectionStatus({
|
|
|
617
715
|
alt: `${selectedWallet.name} logo`
|
|
618
716
|
}
|
|
619
717
|
),
|
|
620
|
-
/* @__PURE__ */ (0,
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: title2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Heading, { as: "h2", size: "xl", children: [
|
|
621
719
|
"Opening ",
|
|
622
720
|
selectedWallet.name
|
|
623
721
|
] }) }),
|
|
624
|
-
/* @__PURE__ */ (0,
|
|
625
|
-
hadConnectionError ? /* @__PURE__ */ (0,
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: connectionStatus, children: hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: "danger", children: "Connection failed" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: "muted", children: "Confirm connection in the wallet..." }) }),
|
|
723
|
+
hadConnectionError ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: retryButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
626
724
|
Button,
|
|
627
725
|
{
|
|
628
726
|
type: "button",
|
|
@@ -638,11 +736,11 @@ function ConnectionStatus({
|
|
|
638
736
|
var container3 = "InfoSection_container__1d1nrmt0";
|
|
639
737
|
|
|
640
738
|
// src/components/connect-modal/InfoSection.tsx
|
|
641
|
-
var
|
|
739
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
642
740
|
function InfoSection({ title: title3, children }) {
|
|
643
|
-
return /* @__PURE__ */ (0,
|
|
644
|
-
/* @__PURE__ */ (0,
|
|
645
|
-
/* @__PURE__ */ (0,
|
|
741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: container3, children: [
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { as: "h3", size: "sm", weight: "normal", children: title3 }),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { weight: "medium", color: "muted", children })
|
|
646
744
|
] });
|
|
647
745
|
}
|
|
648
746
|
|
|
@@ -652,15 +750,15 @@ var content2 = "GettingStarted_content__qu36t91";
|
|
|
652
750
|
var installButtonContainer = "GettingStarted_installButtonContainer__qu36t92";
|
|
653
751
|
|
|
654
752
|
// src/components/connect-modal/views/GettingStarted.tsx
|
|
655
|
-
var
|
|
753
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
656
754
|
function GettingStarted() {
|
|
657
|
-
return /* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
661
|
-
/* @__PURE__ */ (0,
|
|
662
|
-
/* @__PURE__ */ (0,
|
|
663
|
-
/* @__PURE__ */ (0,
|
|
755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: container4, children: [
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { as: "h2", children: "Get Started with IOTA" }),
|
|
757
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: content2, children: [
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InfoSection, { title: "Install the IOTA Wallet Extension", children: "We recommend pinning IOTA Wallet to your taskbar for quicker access." }),
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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." }),
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InfoSection, { title: "Refresh Your Browser", children: "Once you set up your wallet, refresh this window browser to load up the extension." }),
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: installButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
664
762
|
"a",
|
|
665
763
|
{
|
|
666
764
|
href: "https://chrome.google.com/webstore/detail/iota-wallet/iidjkmdceolghepehaaddojmnjnkkija",
|
|
@@ -678,13 +776,13 @@ var container5 = "WhatIsAWallet_container__1kdcimq0";
|
|
|
678
776
|
var content3 = "WhatIsAWallet_content__1kdcimq1";
|
|
679
777
|
|
|
680
778
|
// src/components/connect-modal/views/WhatIsAWallet.tsx
|
|
681
|
-
var
|
|
779
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
682
780
|
function WhatIsAWallet() {
|
|
683
|
-
return /* @__PURE__ */ (0,
|
|
684
|
-
/* @__PURE__ */ (0,
|
|
685
|
-
/* @__PURE__ */ (0,
|
|
686
|
-
/* @__PURE__ */ (0,
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: container5, children: [
|
|
782
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading, { as: "h2", children: "What is a Wallet" }),
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: content3, children: [
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(InfoSection, { title: "Easy Login", children: "No need to create new accounts and passwords for every website. Just connect your wallet and get going." }),
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(InfoSection, { title: "Store your Digital Assets", children: "Send, receive, store, and display your digital assets like NFTs & coins." })
|
|
688
786
|
] })
|
|
689
787
|
] });
|
|
690
788
|
}
|
|
@@ -695,9 +793,9 @@ function useWallets() {
|
|
|
695
793
|
}
|
|
696
794
|
|
|
697
795
|
// src/components/icons/IotaIcon.tsx
|
|
698
|
-
var
|
|
796
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
699
797
|
function IotaIcon(props) {
|
|
700
|
-
return /* @__PURE__ */ (0,
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
701
799
|
"svg",
|
|
702
800
|
{
|
|
703
801
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -706,7 +804,7 @@ function IotaIcon(props) {
|
|
|
706
804
|
fill: "none",
|
|
707
805
|
viewBox: "0 0 24 24",
|
|
708
806
|
...props,
|
|
709
|
-
children: /* @__PURE__ */ (0,
|
|
807
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
710
808
|
"path",
|
|
711
809
|
{
|
|
712
810
|
fill: "#171d26",
|
|
@@ -731,27 +829,27 @@ var walletIcon2 = "WalletListItem_walletIcon__1vrvezk3";
|
|
|
731
829
|
var walletItem = "WalletListItem_walletItem__1vrvezk1";
|
|
732
830
|
|
|
733
831
|
// src/components/connect-modal/wallet-list/WalletListItem.tsx
|
|
734
|
-
var
|
|
832
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
735
833
|
function WalletListItem({ name, icon: icon2, onClick, isSelected = false }) {
|
|
736
|
-
return /* @__PURE__ */ (0,
|
|
834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { className: container7, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
737
835
|
"button",
|
|
738
836
|
{
|
|
739
837
|
className: (0, import_clsx6.clsx)(walletItem, { [selectedWalletItem]: isSelected }),
|
|
740
838
|
type: "button",
|
|
741
839
|
onClick,
|
|
742
840
|
children: [
|
|
743
|
-
icon2 && typeof icon2 === "string" ? /* @__PURE__ */ (0,
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
841
|
+
icon2 && typeof icon2 === "string" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { className: walletIcon2, src: icon2, alt: `${name} logo` }) : icon2,
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: name }) })
|
|
745
843
|
]
|
|
746
844
|
}
|
|
747
845
|
) });
|
|
748
846
|
}
|
|
749
847
|
|
|
750
848
|
// src/components/connect-modal/wallet-list/WalletList.tsx
|
|
751
|
-
var
|
|
849
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
752
850
|
function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
753
851
|
const wallets = useWallets();
|
|
754
|
-
return /* @__PURE__ */ (0,
|
|
852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: container6, children: wallets.length > 0 ? wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
755
853
|
WalletListItem,
|
|
756
854
|
{
|
|
757
855
|
name: wallet.name,
|
|
@@ -760,11 +858,11 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
|
760
858
|
onClick: () => onSelect(wallet)
|
|
761
859
|
},
|
|
762
860
|
getWalletUniqueIdentifier(wallet)
|
|
763
|
-
)) : /* @__PURE__ */ (0,
|
|
861
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
764
862
|
WalletListItem,
|
|
765
863
|
{
|
|
766
864
|
name: "IOTA Wallet",
|
|
767
|
-
icon: /* @__PURE__ */ (0,
|
|
865
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IotaIcon, { className: icon }),
|
|
768
866
|
onClick: onPlaceholderClick,
|
|
769
867
|
isSelected: true
|
|
770
868
|
}
|
|
@@ -772,7 +870,7 @@ function WalletList({ selectedWalletName, onPlaceholderClick, onSelect }) {
|
|
|
772
870
|
}
|
|
773
871
|
|
|
774
872
|
// src/components/connect-modal/ConnectModal.tsx
|
|
775
|
-
var
|
|
873
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
776
874
|
function ConnectModal({
|
|
777
875
|
trigger,
|
|
778
876
|
open,
|
|
@@ -780,9 +878,9 @@ function ConnectModal({
|
|
|
780
878
|
onOpenChange,
|
|
781
879
|
onConnected
|
|
782
880
|
}) {
|
|
783
|
-
const [isModalOpen, setModalOpen] = (0,
|
|
784
|
-
const [currentView, setCurrentView] = (0,
|
|
785
|
-
const [selectedWallet, setSelectedWallet] = (0,
|
|
881
|
+
const [isModalOpen, setModalOpen] = (0, import_react12.useState)(open ?? defaultOpen);
|
|
882
|
+
const [currentView, setCurrentView] = (0, import_react12.useState)();
|
|
883
|
+
const [selectedWallet, setSelectedWallet] = (0, import_react12.useState)();
|
|
786
884
|
const { mutate, isError } = useConnectWallet({
|
|
787
885
|
onConnected
|
|
788
886
|
});
|
|
@@ -809,13 +907,13 @@ function ConnectModal({
|
|
|
809
907
|
let modalContent;
|
|
810
908
|
switch (currentView) {
|
|
811
909
|
case "what-is-a-wallet":
|
|
812
|
-
modalContent = /* @__PURE__ */ (0,
|
|
910
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(WhatIsAWallet, {});
|
|
813
911
|
break;
|
|
814
912
|
case "getting-started":
|
|
815
|
-
modalContent = /* @__PURE__ */ (0,
|
|
913
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(GettingStarted, {});
|
|
816
914
|
break;
|
|
817
915
|
case "connection-status":
|
|
818
|
-
modalContent = /* @__PURE__ */ (0,
|
|
916
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
819
917
|
ConnectionStatus,
|
|
820
918
|
{
|
|
821
919
|
selectedWallet,
|
|
@@ -825,21 +923,21 @@ function ConnectModal({
|
|
|
825
923
|
);
|
|
826
924
|
break;
|
|
827
925
|
default:
|
|
828
|
-
modalContent = /* @__PURE__ */ (0,
|
|
926
|
+
modalContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(WhatIsAWallet, {});
|
|
829
927
|
}
|
|
830
|
-
return /* @__PURE__ */ (0,
|
|
831
|
-
/* @__PURE__ */ (0,
|
|
832
|
-
/* @__PURE__ */ (0,
|
|
833
|
-
/* @__PURE__ */ (0,
|
|
928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Dialog.Root, { open: open ?? isModalOpen, onOpenChange: handleOpenChange, children: [
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Dialog.Trigger, { asChild: true, children: trigger }),
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Dialog.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Dialog.Overlay, { className: overlay, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Dialog.Content, { className: content, "aria-describedby": void 0, children: [
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
834
932
|
"div",
|
|
835
933
|
{
|
|
836
934
|
className: (0, import_clsx7.default)(walletListContainer, {
|
|
837
935
|
[walletListContainerWithViewSelected]: !!currentView
|
|
838
936
|
}),
|
|
839
937
|
children: [
|
|
840
|
-
/* @__PURE__ */ (0,
|
|
841
|
-
/* @__PURE__ */ (0,
|
|
842
|
-
/* @__PURE__ */ (0,
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: walletListContent, children: [
|
|
939
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Dialog.Title, { className: title, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Heading, { as: "h2", children: "Connect a Wallet" }) }),
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
843
941
|
WalletList,
|
|
844
942
|
{
|
|
845
943
|
selectedWalletName: getWalletUniqueIdentifier(
|
|
@@ -855,7 +953,7 @@ function ConnectModal({
|
|
|
855
953
|
}
|
|
856
954
|
)
|
|
857
955
|
] }),
|
|
858
|
-
/* @__PURE__ */ (0,
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
859
957
|
"button",
|
|
860
958
|
{
|
|
861
959
|
className: whatIsAWalletButton,
|
|
@@ -867,33 +965,33 @@ function ConnectModal({
|
|
|
867
965
|
]
|
|
868
966
|
}
|
|
869
967
|
),
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
871
969
|
"div",
|
|
872
970
|
{
|
|
873
971
|
className: (0, import_clsx7.default)(viewContainer, {
|
|
874
972
|
[selectedViewContainer]: !!currentView
|
|
875
973
|
}),
|
|
876
974
|
children: [
|
|
877
|
-
/* @__PURE__ */ (0,
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: backButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
878
976
|
IconButton,
|
|
879
977
|
{
|
|
880
978
|
type: "button",
|
|
881
979
|
"aria-label": "Back",
|
|
882
980
|
onClick: () => resetSelection(),
|
|
883
|
-
children: /* @__PURE__ */ (0,
|
|
981
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BackIcon, {})
|
|
884
982
|
}
|
|
885
983
|
) }),
|
|
886
984
|
modalContent
|
|
887
985
|
]
|
|
888
986
|
}
|
|
889
987
|
),
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Dialog.Close, { className: closeButtonContainer, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IconButton, { type: "button", "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CloseIcon, {}) }) })
|
|
891
989
|
] }) }) }) })
|
|
892
990
|
] });
|
|
893
991
|
}
|
|
894
992
|
|
|
895
993
|
// src/components/ConnectButton.tsx
|
|
896
|
-
var
|
|
994
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
897
995
|
function ConnectButton({
|
|
898
996
|
connectText = "Connect Wallet",
|
|
899
997
|
size,
|
|
@@ -902,18 +1000,18 @@ function ConnectButton({
|
|
|
902
1000
|
...buttonProps
|
|
903
1001
|
}) {
|
|
904
1002
|
const currentAccount = useCurrentAccount();
|
|
905
|
-
return currentAccount ? /* @__PURE__ */ (0,
|
|
1003
|
+
return currentAccount ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
906
1004
|
AccountDropdownMenu,
|
|
907
1005
|
{
|
|
908
1006
|
currentAccount,
|
|
909
1007
|
size,
|
|
910
1008
|
iotaNamesEnabled
|
|
911
1009
|
}
|
|
912
|
-
) : /* @__PURE__ */ (0,
|
|
1010
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
913
1011
|
ConnectModal,
|
|
914
1012
|
{
|
|
915
1013
|
onConnected,
|
|
916
|
-
trigger: /* @__PURE__ */ (0,
|
|
1014
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleMarker, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { ...buttonProps, size, children: connectText }) })
|
|
917
1015
|
}
|
|
918
1016
|
);
|
|
919
1017
|
}
|