@xyo-network/xl1-react-client-sdk 2.1.0 → 2.1.2
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/dist/browser/client/components/connected/AutoSignChainPanel.d.ts +46 -0
- package/dist/browser/client/components/connected/AutoSignChainPanel.d.ts.map +1 -0
- package/dist/browser/client/components/connected/hooks/useConnectAccount.d.ts +2 -2
- package/dist/browser/client/components/connected/index.d.ts +1 -0
- package/dist/browser/client/components/connected/index.d.ts.map +1 -1
- package/dist/browser/client/index.mjs +844 -528
- package/dist/browser/client/index.mjs.map +4 -4
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.mjs +852 -535
- package/dist/browser/index.mjs.map +4 -4
- package/dist/browser/shared/decorators/IframeWalletWarningDecorator.d.ts.map +1 -1
- package/dist/browser/shared/index-browser.d.ts +3 -0
- package/dist/browser/shared/index-browser.d.ts.map +1 -0
- package/dist/browser/shared/index.d.ts +0 -1
- package/dist/browser/shared/index.d.ts.map +1 -1
- package/dist/browser/shared/index.mjs +0 -22
- package/dist/browser/shared/index.mjs.map +4 -4
- package/package.json +4 -4
|
@@ -348,157 +348,45 @@ var ApprovedLakeSelector = ({
|
|
|
348
348
|
] });
|
|
349
349
|
};
|
|
350
350
|
|
|
351
|
-
// src/client/components/connected/
|
|
352
|
-
import {
|
|
353
|
-
Alert as Alert2,
|
|
354
|
-
AlertTitle,
|
|
355
|
-
Button,
|
|
356
|
-
Stack as Stack3,
|
|
357
|
-
Typography as Typography3
|
|
358
|
-
} from "@mui/material";
|
|
359
|
-
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
360
|
-
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
361
|
-
import { isDefined as isDefined4, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
362
|
-
import { useEffect as useEffect3 } from "react";
|
|
363
|
-
|
|
364
|
-
// src/client/components/connected/hooks/useConnectAccount.ts
|
|
365
|
-
import { asAddress, assertEx } from "@xylabs/sdk-js";
|
|
366
|
-
import { MainNetwork } from "@xyo-network/xl1-sdk";
|
|
367
|
-
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
368
|
-
var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
369
|
-
const [connectError, setConnectError] = useState3();
|
|
370
|
-
const {
|
|
371
|
-
gateway,
|
|
372
|
-
error,
|
|
373
|
-
timedout
|
|
374
|
-
} = useGatewayFromWallet(gatewayName, timeout);
|
|
375
|
-
const [accountPermissions, accountPermissionsError] = useAccountPermissions();
|
|
376
|
-
const [address, setAddress] = useState3();
|
|
377
|
-
const connectSigner = useCallback2(async () => {
|
|
378
|
-
try {
|
|
379
|
-
setConnectError(void 0);
|
|
380
|
-
const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`);
|
|
381
|
-
const signer = assertedGateway.signer;
|
|
382
|
-
const address2 = await signer.address();
|
|
383
|
-
setAddress(address2);
|
|
384
|
-
return address2;
|
|
385
|
-
} catch (e) {
|
|
386
|
-
setConnectError(e);
|
|
387
|
-
}
|
|
388
|
-
}, [gateway, gatewayName]);
|
|
389
|
-
return {
|
|
390
|
-
address: asAddress(accountPermissions?.[0] ?? address),
|
|
391
|
-
connectSigner,
|
|
392
|
-
error: error ?? accountPermissionsError ?? connectError,
|
|
393
|
-
gateway,
|
|
394
|
-
timedout
|
|
395
|
-
};
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
399
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
400
|
-
var DefaultConnectComponent = (props) => /* @__PURE__ */ jsx3(ButtonEx2, { variant: "contained", size: "small", ...props });
|
|
401
|
-
var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */ jsxs3(Alert2, { severity: "warning", children: [
|
|
402
|
-
/* @__PURE__ */ jsx3(AlertTitle, { children: "XL1 Wallet Not Found" }),
|
|
403
|
-
/* @__PURE__ */ jsx3(Typography3, { gutterBottom: true, children: "Please ensure that your XL1 Wallet is installed to connect your account." }),
|
|
404
|
-
/* @__PURE__ */ jsx3(
|
|
405
|
-
Button,
|
|
406
|
-
{
|
|
407
|
-
sx: { display: "flex", justifySelf: "end" },
|
|
408
|
-
size: "small",
|
|
409
|
-
variant: "outlined",
|
|
410
|
-
href: "https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm",
|
|
411
|
-
target: "_blank",
|
|
412
|
-
rel: "noopener",
|
|
413
|
-
children: "Get XL1 Wallet"
|
|
414
|
-
}
|
|
415
|
-
)
|
|
416
|
-
] });
|
|
417
|
-
var ConnectAccountsStack = ({
|
|
418
|
-
AccountComponent = ConnectedAccount,
|
|
419
|
-
ConnectComponent = DefaultConnectComponent,
|
|
420
|
-
NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,
|
|
421
|
-
onAccountConnected,
|
|
422
|
-
onCancel,
|
|
423
|
-
timeout,
|
|
424
|
-
...props
|
|
425
|
-
}) => {
|
|
426
|
-
const {
|
|
427
|
-
address,
|
|
428
|
-
connectSigner,
|
|
429
|
-
error,
|
|
430
|
-
timedout
|
|
431
|
-
} = useConnectAccount(void 0, timeout);
|
|
432
|
-
useEffect3(() => {
|
|
433
|
-
if (isDefined4(error) && isDefined4(onCancel)) {
|
|
434
|
-
onCancel();
|
|
435
|
-
}
|
|
436
|
-
}, [error, onCancel]);
|
|
437
|
-
useEffect3(() => {
|
|
438
|
-
if (isDefined4(address) && isDefined4(onAccountConnected)) {
|
|
439
|
-
onAccountConnected(address);
|
|
440
|
-
}
|
|
441
|
-
}, [address, onAccountConnected]);
|
|
442
|
-
return /* @__PURE__ */ jsxs3(
|
|
443
|
-
Stack3,
|
|
444
|
-
{
|
|
445
|
-
direction: "row",
|
|
446
|
-
spacing: 2,
|
|
447
|
-
...props,
|
|
448
|
-
sx: { alignItems: "start", ...props.sx },
|
|
449
|
-
children: [
|
|
450
|
-
isDefined4(address) ? /* @__PURE__ */ jsx3(AccountComponent, { address }) : null,
|
|
451
|
-
isUndefined3(address) && !timedout ? /* @__PURE__ */ jsx3(ConnectComponent, { onClick: () => void connectSigner(), children: "Connect" }) : null,
|
|
452
|
-
isUndefined3(address) && timedout ? /* @__PURE__ */ jsx3(NoWalletInstalledComponent, {}) : null,
|
|
453
|
-
/* @__PURE__ */ jsx3(ErrorRender2, { error, scope: "ConnectSigner:error" })
|
|
454
|
-
]
|
|
455
|
-
}
|
|
456
|
-
);
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
// src/client/components/connected/DataLakeAddToChainPanel.tsx
|
|
351
|
+
// src/client/components/connected/AutoSignChainPanel.tsx
|
|
460
352
|
import { OpenInNew } from "@mui/icons-material";
|
|
461
353
|
import {
|
|
462
|
-
Alert as
|
|
354
|
+
Alert as Alert4,
|
|
463
355
|
Chip as Chip2,
|
|
464
356
|
Divider as Divider2,
|
|
465
357
|
Link,
|
|
466
|
-
Stack as
|
|
467
|
-
|
|
468
|
-
Typography as Typography5
|
|
358
|
+
Stack as Stack5,
|
|
359
|
+
Typography as Typography4
|
|
469
360
|
} from "@mui/material";
|
|
470
|
-
import { ButtonEx as
|
|
471
|
-
import { ErrorRender as
|
|
472
|
-
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
473
|
-
import { isDefined as isDefined7, isDefinedNotNull as isDefinedNotNull4 } from "@xylabs/sdk-js";
|
|
361
|
+
import { ButtonEx as ButtonEx4 } from "@xylabs/react-button";
|
|
362
|
+
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
474
363
|
import {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
} from "@
|
|
364
|
+
isDefined as isDefined6,
|
|
365
|
+
isDefinedNotNull as isDefinedNotNull4,
|
|
366
|
+
toHex
|
|
367
|
+
} from "@xylabs/sdk-js";
|
|
368
|
+
import { asSchema, PayloadBuilder } from "@xyo-network/sdk-js";
|
|
369
|
+
import { ExplorerLinks, SequenceNetwork } from "@xyo-network/xl1-sdk";
|
|
479
370
|
import {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
SequenceNetwork
|
|
485
|
-
} from "@xyo-network/xl1-sdk";
|
|
486
|
-
import { useMemo, useState as useState5 } from "react";
|
|
371
|
+
useCallback as useCallback3,
|
|
372
|
+
useMemo,
|
|
373
|
+
useState as useState4
|
|
374
|
+
} from "react";
|
|
487
375
|
|
|
488
376
|
// src/client/components/connected/RequestPermissionsButton.tsx
|
|
489
|
-
import { Alert as
|
|
490
|
-
import { ButtonEx as
|
|
377
|
+
import { Alert as Alert3, Stack as Stack4 } from "@mui/material";
|
|
378
|
+
import { ButtonEx as ButtonEx3 } from "@xylabs/react-button";
|
|
491
379
|
import { PopoverErrorRender } from "@xylabs/react-error";
|
|
492
|
-
import { isDefined as
|
|
380
|
+
import { isDefined as isDefined5, isDefinedNotNull as isDefinedNotNull3 } from "@xylabs/sdk-js";
|
|
493
381
|
import {
|
|
494
|
-
useCallback as
|
|
495
|
-
useEffect as
|
|
496
|
-
useState as
|
|
382
|
+
useCallback as useCallback2,
|
|
383
|
+
useEffect as useEffect3,
|
|
384
|
+
useState as useState3
|
|
497
385
|
} from "react";
|
|
498
386
|
|
|
499
387
|
// src/client/components/connected/PermissionsReviewDialog.tsx
|
|
500
388
|
import {
|
|
501
|
-
Alert as
|
|
389
|
+
Alert as Alert2,
|
|
502
390
|
Box,
|
|
503
391
|
Chip,
|
|
504
392
|
Dialog,
|
|
@@ -506,20 +394,20 @@ import {
|
|
|
506
394
|
DialogContent,
|
|
507
395
|
DialogTitle,
|
|
508
396
|
Divider,
|
|
509
|
-
Stack as
|
|
510
|
-
Typography as
|
|
397
|
+
Stack as Stack3,
|
|
398
|
+
Typography as Typography3
|
|
511
399
|
} from "@mui/material";
|
|
512
|
-
import { ButtonEx as
|
|
513
|
-
import { ErrorRender as
|
|
514
|
-
import { isDefined as
|
|
515
|
-
import
|
|
516
|
-
import { jsx as
|
|
400
|
+
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
401
|
+
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
402
|
+
import { isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
403
|
+
import React2 from "react";
|
|
404
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
517
405
|
var renderCaveatValue = (caveat) => {
|
|
518
406
|
if (caveat.type === "restrictReturnedAccounts" && Array.isArray(caveat.value)) {
|
|
519
407
|
if (caveat.value.length === 0) {
|
|
520
|
-
return /* @__PURE__ */
|
|
408
|
+
return /* @__PURE__ */ jsx3(Typography3, { variant: "caption", sx: { color: "text.secondary" }, children: "(no address restriction \u2014 every selected account is returned)" });
|
|
521
409
|
}
|
|
522
|
-
return /* @__PURE__ */
|
|
410
|
+
return /* @__PURE__ */ jsx3(Stack3, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 }, children: caveat.value.map((address) => /* @__PURE__ */ jsx3(
|
|
523
411
|
Chip,
|
|
524
412
|
{
|
|
525
413
|
label: String(address),
|
|
@@ -531,13 +419,13 @@ var renderCaveatValue = (caveat) => {
|
|
|
531
419
|
}
|
|
532
420
|
if (caveat.type === "dataLakeAccess" && typeof caveat.value === "object" && caveat.value !== null) {
|
|
533
421
|
const value = caveat.value;
|
|
534
|
-
return /* @__PURE__ */
|
|
535
|
-
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ jsxs3(Stack3, { sx: { gap: 0.5 }, children: [
|
|
423
|
+
isDefined4(value.perOriginId) ? /* @__PURE__ */ jsxs3(Stack3, { direction: "row", sx: { alignItems: "center", gap: 1 }, children: [
|
|
424
|
+
/* @__PURE__ */ jsx3(Typography3, { variant: "caption", sx: { color: "text.secondary" }, children: "id:" }),
|
|
425
|
+
/* @__PURE__ */ jsx3(Typography3, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: value.perOriginId })
|
|
538
426
|
] }) : null,
|
|
539
|
-
|
|
540
|
-
|
|
427
|
+
isDefined4(value.narrowedSchemas) && value.narrowedSchemas.length > 0 ? /* @__PURE__ */ jsxs3(
|
|
428
|
+
Stack3,
|
|
541
429
|
{
|
|
542
430
|
direction: "row",
|
|
543
431
|
sx: {
|
|
@@ -546,8 +434,8 @@ var renderCaveatValue = (caveat) => {
|
|
|
546
434
|
gap: 0.5
|
|
547
435
|
},
|
|
548
436
|
children: [
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
value.narrowedSchemas.map((schema) => /* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ jsx3(Typography3, { variant: "caption", sx: { color: "text.secondary" }, children: "schemas:" }),
|
|
438
|
+
value.narrowedSchemas.map((schema) => /* @__PURE__ */ jsx3(
|
|
551
439
|
Chip,
|
|
552
440
|
{
|
|
553
441
|
label: schema,
|
|
@@ -561,8 +449,8 @@ var renderCaveatValue = (caveat) => {
|
|
|
561
449
|
) : null
|
|
562
450
|
] });
|
|
563
451
|
}
|
|
564
|
-
return /* @__PURE__ */
|
|
565
|
-
|
|
452
|
+
return /* @__PURE__ */ jsx3(
|
|
453
|
+
Typography3,
|
|
566
454
|
{
|
|
567
455
|
component: "pre",
|
|
568
456
|
variant: "body2",
|
|
@@ -578,9 +466,9 @@ var renderCaveatValue = (caveat) => {
|
|
|
578
466
|
};
|
|
579
467
|
var renderPermission = (permission) => {
|
|
580
468
|
const caveats = permission.caveats ?? [];
|
|
581
|
-
return /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
|
|
469
|
+
return /* @__PURE__ */ jsxs3(Stack3, { sx: { gap: 1 }, children: [
|
|
470
|
+
/* @__PURE__ */ jsxs3(
|
|
471
|
+
Stack3,
|
|
584
472
|
{
|
|
585
473
|
direction: "row",
|
|
586
474
|
sx: {
|
|
@@ -589,8 +477,8 @@ var renderPermission = (permission) => {
|
|
|
589
477
|
gap: 1
|
|
590
478
|
},
|
|
591
479
|
children: [
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
|
|
480
|
+
/* @__PURE__ */ jsx3(Typography3, { variant: "subtitle2", sx: { fontFamily: "monospace" }, children: permission.parentCapability }),
|
|
481
|
+
isDefined4(permission.date) ? /* @__PURE__ */ jsxs3(Typography3, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
594
482
|
"granted",
|
|
595
483
|
" ",
|
|
596
484
|
new Date(permission.date).toLocaleString()
|
|
@@ -598,9 +486,9 @@ var renderPermission = (permission) => {
|
|
|
598
486
|
]
|
|
599
487
|
}
|
|
600
488
|
),
|
|
601
|
-
caveats.length === 0 ? /* @__PURE__ */
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
/* @__PURE__ */
|
|
489
|
+
caveats.length === 0 ? /* @__PURE__ */ jsx3(Typography3, { variant: "caption", sx: { color: "text.secondary" }, children: "(no caveats)" }) : /* @__PURE__ */ jsx3(Stack3, { sx: { gap: 1, pl: 1 }, children: caveats.map((caveat) => /* @__PURE__ */ jsxs3(Stack3, { sx: { gap: 0.5 }, children: [
|
|
490
|
+
/* @__PURE__ */ jsx3(Chip, { label: caveat.type, size: "small", sx: { alignSelf: "flex-start" } }),
|
|
491
|
+
/* @__PURE__ */ jsx3(Box, { sx: { pl: 1 }, children: renderCaveatValue(caveat) })
|
|
604
492
|
] }, caveat.type)) })
|
|
605
493
|
] });
|
|
606
494
|
};
|
|
@@ -612,19 +500,19 @@ var PermissionsReviewDialog = ({
|
|
|
612
500
|
requesting,
|
|
613
501
|
error
|
|
614
502
|
}) => {
|
|
615
|
-
return /* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
granted.length === 0 ? /* @__PURE__ */
|
|
619
|
-
index > 0 ? /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ jsxs3(Dialog, { open, onClose, fullWidth: true, maxWidth: "sm", children: [
|
|
504
|
+
/* @__PURE__ */ jsx3(DialogTitle, { children: "Granted permissions" }),
|
|
505
|
+
/* @__PURE__ */ jsx3(DialogContent, { dividers: true, children: /* @__PURE__ */ jsxs3(Stack3, { sx: { gap: 2 }, children: [
|
|
506
|
+
granted.length === 0 ? /* @__PURE__ */ jsx3(Alert2, { severity: "info", children: "No permissions are currently granted to this origin." }) : granted.map((permission, index) => /* @__PURE__ */ jsxs3(React2.Fragment, { children: [
|
|
507
|
+
index > 0 ? /* @__PURE__ */ jsx3(Divider, {}) : null,
|
|
620
508
|
renderPermission(permission)
|
|
621
509
|
] }, permission.parentCapability)),
|
|
622
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ jsx3(ErrorRender2, { error, scope: "PermissionsReviewDialog" })
|
|
623
511
|
] }) }),
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
|
|
512
|
+
/* @__PURE__ */ jsxs3(DialogActions, { children: [
|
|
513
|
+
/* @__PURE__ */ jsx3(ButtonEx2, { variant: "text", size: "small", onClick: onClose, children: "Close" }),
|
|
514
|
+
/* @__PURE__ */ jsx3(
|
|
515
|
+
ButtonEx2,
|
|
628
516
|
{
|
|
629
517
|
variant: "contained",
|
|
630
518
|
size: "small",
|
|
@@ -639,7 +527,7 @@ var PermissionsReviewDialog = ({
|
|
|
639
527
|
};
|
|
640
528
|
|
|
641
529
|
// src/client/components/connected/RequestPermissionsButton.tsx
|
|
642
|
-
import { Fragment, jsx as
|
|
530
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
643
531
|
var RequestPermissionsButton = ({
|
|
644
532
|
permissions,
|
|
645
533
|
timeout,
|
|
@@ -651,13 +539,13 @@ var RequestPermissionsButton = ({
|
|
|
651
539
|
isLoading,
|
|
652
540
|
timedout
|
|
653
541
|
} = useClientFromWallet(timeout);
|
|
654
|
-
const [granted, setGranted] =
|
|
655
|
-
const [fetchError, setFetchError] =
|
|
656
|
-
const [requestError, setRequestError] =
|
|
657
|
-
const [requesting, setRequesting] =
|
|
658
|
-
const [dialogOpen, setDialogOpen] =
|
|
542
|
+
const [granted, setGranted] = useState3();
|
|
543
|
+
const [fetchError, setFetchError] = useState3();
|
|
544
|
+
const [requestError, setRequestError] = useState3();
|
|
545
|
+
const [requesting, setRequesting] = useState3(false);
|
|
546
|
+
const [dialogOpen, setDialogOpen] = useState3(false);
|
|
659
547
|
const permissionsApi = client?.permissions;
|
|
660
|
-
const refreshGranted =
|
|
548
|
+
const refreshGranted = useCallback2(async () => {
|
|
661
549
|
if (!isDefinedNotNull3(permissionsApi)) return;
|
|
662
550
|
setFetchError(void 0);
|
|
663
551
|
try {
|
|
@@ -668,12 +556,12 @@ var RequestPermissionsButton = ({
|
|
|
668
556
|
setFetchError(e);
|
|
669
557
|
}
|
|
670
558
|
}, [permissionsApi]);
|
|
671
|
-
|
|
559
|
+
useEffect3(() => {
|
|
672
560
|
if (isDefinedNotNull3(permissionsApi) && granted === void 0) {
|
|
673
561
|
void refreshGranted();
|
|
674
562
|
}
|
|
675
563
|
}, [permissionsApi, granted, refreshGranted]);
|
|
676
|
-
const requestPermissions =
|
|
564
|
+
const requestPermissions = useCallback2(async () => {
|
|
677
565
|
if (!isDefinedNotNull3(permissionsApi)) return;
|
|
678
566
|
setRequestError(void 0);
|
|
679
567
|
setRequesting(true);
|
|
@@ -686,7 +574,7 @@ var RequestPermissionsButton = ({
|
|
|
686
574
|
setRequesting(false);
|
|
687
575
|
}
|
|
688
576
|
}, [permissionsApi, permissions, refreshGranted]);
|
|
689
|
-
const hasGranted =
|
|
577
|
+
const hasGranted = isDefined5(granted) && granted.length > 0;
|
|
690
578
|
const handleClick = () => {
|
|
691
579
|
if (hasGranted) {
|
|
692
580
|
setDialogOpen(true);
|
|
@@ -694,58 +582,485 @@ var RequestPermissionsButton = ({
|
|
|
694
582
|
}
|
|
695
583
|
void requestPermissions();
|
|
696
584
|
};
|
|
585
|
+
return /* @__PURE__ */ jsxs4(
|
|
586
|
+
Stack4,
|
|
587
|
+
{
|
|
588
|
+
...props,
|
|
589
|
+
sx: {
|
|
590
|
+
gap: 2,
|
|
591
|
+
alignItems: "start",
|
|
592
|
+
...props.sx
|
|
593
|
+
},
|
|
594
|
+
children: [
|
|
595
|
+
timedout ? /* @__PURE__ */ jsx4(Alert3, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
596
|
+
/* @__PURE__ */ jsxs4(Stack4, { direction: "row", sx: { gap: 1, alignItems: "center" }, children: [
|
|
597
|
+
/* @__PURE__ */ jsx4(
|
|
598
|
+
ButtonEx3,
|
|
599
|
+
{
|
|
600
|
+
variant: "contained",
|
|
601
|
+
size: "small",
|
|
602
|
+
disabled: !isDefinedNotNull3(permissionsApi) || requesting,
|
|
603
|
+
busy: isLoading || requesting,
|
|
604
|
+
onClick: handleClick,
|
|
605
|
+
children: hasGranted ? "Review permissions" : /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
606
|
+
"Request",
|
|
607
|
+
" ",
|
|
608
|
+
permissions.length,
|
|
609
|
+
" ",
|
|
610
|
+
"permission",
|
|
611
|
+
permissions.length === 1 ? "" : "s"
|
|
612
|
+
] })
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
/* @__PURE__ */ jsx4(PopoverErrorRender, { error: clientError ?? fetchError ?? requestError, scope: "RequestPermissionsButton" })
|
|
616
|
+
] }),
|
|
617
|
+
/* @__PURE__ */ jsx4(
|
|
618
|
+
PermissionsReviewDialog,
|
|
619
|
+
{
|
|
620
|
+
open: dialogOpen,
|
|
621
|
+
onClose: () => setDialogOpen(false),
|
|
622
|
+
granted: granted ?? [],
|
|
623
|
+
onReRequest: () => void requestPermissions(),
|
|
624
|
+
requesting,
|
|
625
|
+
error: requestError
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
);
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// src/client/components/connected/AutoSignChainPanel.tsx
|
|
634
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
635
|
+
var SIGN_TRANSACTION_METHOD = "xyoSigner_signTransaction";
|
|
636
|
+
var CAVEAT_CHAIN_ID = "chainId";
|
|
637
|
+
var CAVEAT_SIGNER = "signer";
|
|
638
|
+
var CAVEAT_SCHEMA_ALLOWLIST = "schemaAllowlist";
|
|
639
|
+
var CAVEAT_EXPIRATION = "expiration";
|
|
640
|
+
var CAVEAT_GAS_CAP = "gasCap";
|
|
641
|
+
var CAVEAT_TX_COUNT_LIMIT = "txCountLimit";
|
|
642
|
+
var SIGNER_PERMISSIONS = [
|
|
643
|
+
{ xyoWallet_getAccounts: { restrictReturnedAccounts: [] } },
|
|
644
|
+
{ xyoSigner_address: {} }
|
|
645
|
+
];
|
|
646
|
+
var DEFAULT_GAS_CAP_ATTO = 10n ** 18n;
|
|
647
|
+
var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
648
|
+
var SEQUENCE_CHAIN_ID = "4b43a753c8024c0e5000e8ac948ac0063ac624bc";
|
|
649
|
+
var DEFAULT_EXPLORER_URL = "https://beta.explore.xyo.network";
|
|
650
|
+
var EMPTY_RESULTS = [];
|
|
651
|
+
var DEFAULT_SCHEMA_PATTERNS = ["network.xyo.game.*"];
|
|
652
|
+
function buildAutoSignRequest({
|
|
653
|
+
address,
|
|
654
|
+
chainId,
|
|
655
|
+
expiresAt,
|
|
656
|
+
gasCapAtto,
|
|
657
|
+
maxTxCount,
|
|
658
|
+
patterns
|
|
659
|
+
}) {
|
|
660
|
+
return {
|
|
661
|
+
[SIGN_TRANSACTION_METHOD]: {
|
|
662
|
+
[CAVEAT_CHAIN_ID]: { chainId },
|
|
663
|
+
[CAVEAT_SIGNER]: { address },
|
|
664
|
+
[CAVEAT_SCHEMA_ALLOWLIST]: { patterns },
|
|
665
|
+
[CAVEAT_EXPIRATION]: { expiresAt },
|
|
666
|
+
[CAVEAT_GAS_CAP]: { limit: toHex(gasCapAtto), spent: toHex(0n) },
|
|
667
|
+
[CAVEAT_TX_COUNT_LIMIT]: { max: maxTxCount, used: 0 }
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
var FireSection = ({
|
|
672
|
+
attempts,
|
|
673
|
+
burstSize,
|
|
674
|
+
canFire,
|
|
675
|
+
firing,
|
|
676
|
+
offChainSchema,
|
|
677
|
+
onFire,
|
|
678
|
+
txUrl
|
|
679
|
+
}) => /* @__PURE__ */ jsxs5(Stack5, { sx: { gap: 1 }, children: [
|
|
680
|
+
/* @__PURE__ */ jsxs5(Typography4, { variant: "subtitle2", children: [
|
|
681
|
+
"4. Fire",
|
|
682
|
+
" ",
|
|
683
|
+
burstSize,
|
|
684
|
+
" ",
|
|
685
|
+
"addPayloadsToChain call",
|
|
686
|
+
burstSize === 1 ? "" : "s"
|
|
687
|
+
] }),
|
|
688
|
+
/* @__PURE__ */ jsxs5(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
689
|
+
"Each call signs a transaction that references a fresh",
|
|
690
|
+
" ",
|
|
691
|
+
/* @__PURE__ */ jsx5("code", { children: offChainSchema }),
|
|
692
|
+
" ",
|
|
693
|
+
"payload (its hash + schema are committed in the signed bound witness). With a matching auto-sign grant in place these should complete with",
|
|
694
|
+
" ",
|
|
695
|
+
/* @__PURE__ */ jsx5("strong", { children: "no wallet popup" }),
|
|
696
|
+
"; if a guardrail (schema / count / gas / expiry) denies a call, the wallet falls back to its normal Sign popup for that call."
|
|
697
|
+
] }),
|
|
698
|
+
/* @__PURE__ */ jsx5(
|
|
699
|
+
ButtonEx4,
|
|
700
|
+
{
|
|
701
|
+
variant: "contained",
|
|
702
|
+
size: "small",
|
|
703
|
+
disabled: !canFire,
|
|
704
|
+
busy: firing,
|
|
705
|
+
onClick: onFire,
|
|
706
|
+
children: "Fire transactions"
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
attempts.map((attempt) => /* @__PURE__ */ jsxs5(
|
|
710
|
+
Stack5,
|
|
711
|
+
{
|
|
712
|
+
direction: "row",
|
|
713
|
+
sx: {
|
|
714
|
+
alignItems: "center",
|
|
715
|
+
flexWrap: "wrap",
|
|
716
|
+
gap: 1
|
|
717
|
+
},
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsx5(
|
|
720
|
+
Chip2,
|
|
721
|
+
{
|
|
722
|
+
label: `#${attempt.index + 1}`,
|
|
723
|
+
size: "small",
|
|
724
|
+
color: isDefined6(attempt.error) ? "error" : "success"
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
isDefined6(attempt.txHash) ? /* @__PURE__ */ jsxs5(
|
|
728
|
+
Link,
|
|
729
|
+
{
|
|
730
|
+
href: txUrl(attempt.txHash),
|
|
731
|
+
target: "_blank",
|
|
732
|
+
rel: "noopener noreferrer",
|
|
733
|
+
variant: "body2",
|
|
734
|
+
sx: {
|
|
735
|
+
alignItems: "center",
|
|
736
|
+
display: "inline-flex",
|
|
737
|
+
gap: 0.5,
|
|
738
|
+
fontFamily: "monospace",
|
|
739
|
+
wordBreak: "break-all"
|
|
740
|
+
},
|
|
741
|
+
children: [
|
|
742
|
+
attempt.txHash,
|
|
743
|
+
/* @__PURE__ */ jsx5(OpenInNew, { sx: { fontSize: 14 } })
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
) : /* @__PURE__ */ jsx5(Typography4, { variant: "body2", sx: { color: "error.main", wordBreak: "break-all" }, children: attempt.error })
|
|
747
|
+
]
|
|
748
|
+
},
|
|
749
|
+
attempt.index
|
|
750
|
+
))
|
|
751
|
+
] });
|
|
752
|
+
async function runBurst(gateway, offChainSchema, burstSize, onProgress) {
|
|
753
|
+
const schema = asSchema(offChainSchema, true);
|
|
754
|
+
const collected = [];
|
|
755
|
+
for (let index = 0; index < burstSize; index++) {
|
|
756
|
+
try {
|
|
757
|
+
const content = new PayloadBuilder({ schema }).fields({ move: index, ts: Date.now() }).build();
|
|
758
|
+
const [txHash] = await gateway.addPayloadsToChain([], [content]);
|
|
759
|
+
collected.push({ index, txHash });
|
|
760
|
+
} catch (e) {
|
|
761
|
+
collected.push({ index, error: e.message });
|
|
762
|
+
}
|
|
763
|
+
onProgress([...collected]);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
var AutoSignChainPanel = ({
|
|
767
|
+
burstSize = 3,
|
|
768
|
+
chainId = SEQUENCE_CHAIN_ID,
|
|
769
|
+
explorerUrl = DEFAULT_EXPLORER_URL,
|
|
770
|
+
gatewayName = SequenceNetwork.id,
|
|
771
|
+
maxTxCount = 100,
|
|
772
|
+
offChainSchema = "network.xyo.game.move",
|
|
773
|
+
schemaPatterns = DEFAULT_SCHEMA_PATTERNS,
|
|
774
|
+
timeout,
|
|
775
|
+
...props
|
|
776
|
+
}) => {
|
|
777
|
+
const { client, error: clientError } = useClientFromWallet(timeout);
|
|
778
|
+
const {
|
|
779
|
+
gateway,
|
|
780
|
+
error: gatewayError,
|
|
781
|
+
timedout
|
|
782
|
+
} = useGatewayFromWallet(gatewayName, timeout);
|
|
783
|
+
const [resolvedAddress, setResolvedAddress] = useState4();
|
|
784
|
+
const [resolving, setResolving] = useState4(false);
|
|
785
|
+
const [resolveError, setResolveError] = useState4();
|
|
786
|
+
const [granting, setGranting] = useState4(false);
|
|
787
|
+
const [grantError, setGrantError] = useState4();
|
|
788
|
+
const [granted, setGranted] = useState4(false);
|
|
789
|
+
const [firing, setFiring] = useState4(false);
|
|
790
|
+
const [attempts, setAttempts] = useState4(EMPTY_RESULTS);
|
|
791
|
+
const permissionsApi = client?.permissions;
|
|
792
|
+
const explorer = useMemo(() => new ExplorerLinks(explorerUrl, gatewayName), [explorerUrl, gatewayName]);
|
|
793
|
+
const handleResolve = useCallback3(async () => {
|
|
794
|
+
if (!isDefinedNotNull4(gateway)) return;
|
|
795
|
+
const signer = gateway.signer;
|
|
796
|
+
if (!isDefinedNotNull4(signer)) return;
|
|
797
|
+
setResolveError(void 0);
|
|
798
|
+
setResolving(true);
|
|
799
|
+
try {
|
|
800
|
+
setResolvedAddress(await signer.address());
|
|
801
|
+
} catch (e) {
|
|
802
|
+
setResolveError(e);
|
|
803
|
+
} finally {
|
|
804
|
+
setResolving(false);
|
|
805
|
+
}
|
|
806
|
+
}, [gateway]);
|
|
807
|
+
const handleGrant = useCallback3(async () => {
|
|
808
|
+
if (!isDefinedNotNull4(permissionsApi) || !isDefined6(resolvedAddress)) return;
|
|
809
|
+
setGrantError(void 0);
|
|
810
|
+
setGranting(true);
|
|
811
|
+
try {
|
|
812
|
+
await permissionsApi.requestPermissions([buildAutoSignRequest({
|
|
813
|
+
address: resolvedAddress,
|
|
814
|
+
chainId,
|
|
815
|
+
expiresAt: Date.now() + DEFAULT_TTL_MS,
|
|
816
|
+
gasCapAtto: DEFAULT_GAS_CAP_ATTO,
|
|
817
|
+
maxTxCount,
|
|
818
|
+
patterns: schemaPatterns
|
|
819
|
+
})]);
|
|
820
|
+
setGranted(true);
|
|
821
|
+
} catch (e) {
|
|
822
|
+
setGrantError(e);
|
|
823
|
+
} finally {
|
|
824
|
+
setGranting(false);
|
|
825
|
+
}
|
|
826
|
+
}, [permissionsApi, resolvedAddress, chainId, maxTxCount, schemaPatterns]);
|
|
827
|
+
const handleFire = useCallback3(async () => {
|
|
828
|
+
if (!isDefinedNotNull4(gateway)) return;
|
|
829
|
+
setFiring(true);
|
|
830
|
+
setAttempts(EMPTY_RESULTS);
|
|
831
|
+
try {
|
|
832
|
+
await runBurst(gateway, offChainSchema, burstSize, setAttempts);
|
|
833
|
+
} finally {
|
|
834
|
+
setFiring(false);
|
|
835
|
+
}
|
|
836
|
+
}, [gateway, burstSize, offChainSchema]);
|
|
837
|
+
const canResolve = isDefinedNotNull4(gateway) && !resolving;
|
|
838
|
+
const canGrant = isDefinedNotNull4(permissionsApi) && isDefined6(resolvedAddress) && !granting;
|
|
839
|
+
const canFire = isDefinedNotNull4(gateway) && isDefined6(resolvedAddress) && !firing;
|
|
697
840
|
return /* @__PURE__ */ jsxs5(
|
|
698
841
|
Stack5,
|
|
699
842
|
{
|
|
700
843
|
...props,
|
|
701
|
-
sx: {
|
|
702
|
-
gap:
|
|
703
|
-
alignItems: "
|
|
704
|
-
...props.sx
|
|
705
|
-
},
|
|
844
|
+
sx: {
|
|
845
|
+
gap: 3,
|
|
846
|
+
alignItems: "stretch",
|
|
847
|
+
...props.sx
|
|
848
|
+
},
|
|
849
|
+
children: [
|
|
850
|
+
timedout ? /* @__PURE__ */ jsx5(Alert4, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
851
|
+
/* @__PURE__ */ jsxs5(Stack5, { sx: { gap: 1 }, children: [
|
|
852
|
+
/* @__PURE__ */ jsx5(Typography4, { variant: "subtitle2", children: "1. Grant signer + account access" }),
|
|
853
|
+
/* @__PURE__ */ jsx5(RequestPermissionsButton, { permissions: SIGNER_PERMISSIONS, timeout })
|
|
854
|
+
] }),
|
|
855
|
+
/* @__PURE__ */ jsx5(Divider2, {}),
|
|
856
|
+
/* @__PURE__ */ jsxs5(Stack5, { sx: { gap: 1, alignItems: "start" }, children: [
|
|
857
|
+
/* @__PURE__ */ jsx5(Typography4, { variant: "subtitle2", children: "2. Resolve account" }),
|
|
858
|
+
/* @__PURE__ */ jsx5(
|
|
859
|
+
ButtonEx4,
|
|
860
|
+
{
|
|
861
|
+
variant: "contained",
|
|
862
|
+
size: "small",
|
|
863
|
+
disabled: !canResolve,
|
|
864
|
+
busy: resolving,
|
|
865
|
+
onClick: () => void handleResolve(),
|
|
866
|
+
children: "Resolve account"
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
isDefined6(resolvedAddress) ? /* @__PURE__ */ jsxs5(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
870
|
+
"Account:",
|
|
871
|
+
" ",
|
|
872
|
+
/* @__PURE__ */ jsx5("code", { children: resolvedAddress })
|
|
873
|
+
] }) : null,
|
|
874
|
+
/* @__PURE__ */ jsx5(ErrorRender3, { error: resolveError, scope: "AutoSignChainPanel.resolve" })
|
|
875
|
+
] }),
|
|
876
|
+
/* @__PURE__ */ jsx5(Divider2, {}),
|
|
877
|
+
/* @__PURE__ */ jsxs5(Stack5, { sx: { gap: 1, alignItems: "start" }, children: [
|
|
878
|
+
/* @__PURE__ */ jsx5(Typography4, { variant: "subtitle2", children: "3. Grant auto-sign" }),
|
|
879
|
+
/* @__PURE__ */ jsxs5(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
880
|
+
"Pins the grant to the resolved account on chain",
|
|
881
|
+
" ",
|
|
882
|
+
/* @__PURE__ */ jsx5("code", { children: chainId }),
|
|
883
|
+
", allowlists",
|
|
884
|
+
" ",
|
|
885
|
+
/* @__PURE__ */ jsx5("code", { children: schemaPatterns.join(", ") }),
|
|
886
|
+
", and caps it at",
|
|
887
|
+
" ",
|
|
888
|
+
maxTxCount,
|
|
889
|
+
" ",
|
|
890
|
+
"tx, 1 XL1 gas, 24h."
|
|
891
|
+
] }),
|
|
892
|
+
/* @__PURE__ */ jsx5(
|
|
893
|
+
ButtonEx4,
|
|
894
|
+
{
|
|
895
|
+
variant: "contained",
|
|
896
|
+
size: "small",
|
|
897
|
+
disabled: !canGrant,
|
|
898
|
+
busy: granting,
|
|
899
|
+
onClick: () => void handleGrant(),
|
|
900
|
+
children: "Grant auto-sign"
|
|
901
|
+
}
|
|
902
|
+
),
|
|
903
|
+
granted ? /* @__PURE__ */ jsx5(Chip2, { label: "Auto-sign granted", size: "small", color: "success" }) : null,
|
|
904
|
+
/* @__PURE__ */ jsx5(ErrorRender3, { error: grantError, scope: "AutoSignChainPanel.grant" })
|
|
905
|
+
] }),
|
|
906
|
+
/* @__PURE__ */ jsx5(Divider2, {}),
|
|
907
|
+
/* @__PURE__ */ jsx5(
|
|
908
|
+
FireSection,
|
|
909
|
+
{
|
|
910
|
+
attempts,
|
|
911
|
+
burstSize,
|
|
912
|
+
canFire,
|
|
913
|
+
firing,
|
|
914
|
+
offChainSchema,
|
|
915
|
+
onFire: () => void handleFire(),
|
|
916
|
+
txUrl: (hash) => explorer.transaction(hash)
|
|
917
|
+
}
|
|
918
|
+
),
|
|
919
|
+
/* @__PURE__ */ jsx5(ErrorRender3, { error: clientError ?? gatewayError, scope: "AutoSignChainPanel.wallet" })
|
|
920
|
+
]
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
926
|
+
import {
|
|
927
|
+
Alert as Alert5,
|
|
928
|
+
AlertTitle,
|
|
929
|
+
Button,
|
|
930
|
+
Stack as Stack6,
|
|
931
|
+
Typography as Typography5
|
|
932
|
+
} from "@mui/material";
|
|
933
|
+
import { ButtonEx as ButtonEx5 } from "@xylabs/react-button";
|
|
934
|
+
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
935
|
+
import { isDefined as isDefined7, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
936
|
+
import { useEffect as useEffect4 } from "react";
|
|
937
|
+
|
|
938
|
+
// src/client/components/connected/hooks/useConnectAccount.ts
|
|
939
|
+
import { asAddress, assertEx } from "@xylabs/sdk-js";
|
|
940
|
+
import { MainNetwork } from "@xyo-network/xl1-sdk";
|
|
941
|
+
import { useCallback as useCallback4, useState as useState5 } from "react";
|
|
942
|
+
var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
943
|
+
const [connectError, setConnectError] = useState5();
|
|
944
|
+
const {
|
|
945
|
+
gateway,
|
|
946
|
+
error,
|
|
947
|
+
timedout
|
|
948
|
+
} = useGatewayFromWallet(gatewayName, timeout);
|
|
949
|
+
const [accountPermissions, accountPermissionsError] = useAccountPermissions();
|
|
950
|
+
const [address, setAddress] = useState5();
|
|
951
|
+
const connectSigner = useCallback4(async () => {
|
|
952
|
+
try {
|
|
953
|
+
setConnectError(void 0);
|
|
954
|
+
const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`);
|
|
955
|
+
const signer = assertedGateway.signer;
|
|
956
|
+
const address2 = await signer.address();
|
|
957
|
+
setAddress(address2);
|
|
958
|
+
return address2;
|
|
959
|
+
} catch (e) {
|
|
960
|
+
setConnectError(e);
|
|
961
|
+
}
|
|
962
|
+
}, [gateway, gatewayName]);
|
|
963
|
+
return {
|
|
964
|
+
address: asAddress(accountPermissions?.[0] ?? address),
|
|
965
|
+
connectSigner,
|
|
966
|
+
error: error ?? accountPermissionsError ?? connectError,
|
|
967
|
+
gateway,
|
|
968
|
+
timedout
|
|
969
|
+
};
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
973
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
974
|
+
var DefaultConnectComponent = (props) => /* @__PURE__ */ jsx6(ButtonEx5, { variant: "contained", size: "small", ...props });
|
|
975
|
+
var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */ jsxs6(Alert5, { severity: "warning", children: [
|
|
976
|
+
/* @__PURE__ */ jsx6(AlertTitle, { children: "XL1 Wallet Not Found" }),
|
|
977
|
+
/* @__PURE__ */ jsx6(Typography5, { gutterBottom: true, children: "Please ensure that your XL1 Wallet is installed to connect your account." }),
|
|
978
|
+
/* @__PURE__ */ jsx6(
|
|
979
|
+
Button,
|
|
980
|
+
{
|
|
981
|
+
sx: { display: "flex", justifySelf: "end" },
|
|
982
|
+
size: "small",
|
|
983
|
+
variant: "outlined",
|
|
984
|
+
href: "https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm",
|
|
985
|
+
target: "_blank",
|
|
986
|
+
rel: "noopener",
|
|
987
|
+
children: "Get XL1 Wallet"
|
|
988
|
+
}
|
|
989
|
+
)
|
|
990
|
+
] });
|
|
991
|
+
var ConnectAccountsStack = ({
|
|
992
|
+
AccountComponent = ConnectedAccount,
|
|
993
|
+
ConnectComponent = DefaultConnectComponent,
|
|
994
|
+
NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,
|
|
995
|
+
onAccountConnected,
|
|
996
|
+
onCancel,
|
|
997
|
+
timeout,
|
|
998
|
+
...props
|
|
999
|
+
}) => {
|
|
1000
|
+
const {
|
|
1001
|
+
address,
|
|
1002
|
+
connectSigner,
|
|
1003
|
+
error,
|
|
1004
|
+
timedout
|
|
1005
|
+
} = useConnectAccount(void 0, timeout);
|
|
1006
|
+
useEffect4(() => {
|
|
1007
|
+
if (isDefined7(error) && isDefined7(onCancel)) {
|
|
1008
|
+
onCancel();
|
|
1009
|
+
}
|
|
1010
|
+
}, [error, onCancel]);
|
|
1011
|
+
useEffect4(() => {
|
|
1012
|
+
if (isDefined7(address) && isDefined7(onAccountConnected)) {
|
|
1013
|
+
onAccountConnected(address);
|
|
1014
|
+
}
|
|
1015
|
+
}, [address, onAccountConnected]);
|
|
1016
|
+
return /* @__PURE__ */ jsxs6(
|
|
1017
|
+
Stack6,
|
|
1018
|
+
{
|
|
1019
|
+
direction: "row",
|
|
1020
|
+
spacing: 2,
|
|
1021
|
+
...props,
|
|
1022
|
+
sx: { alignItems: "start", ...props.sx },
|
|
706
1023
|
children: [
|
|
707
|
-
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
{
|
|
712
|
-
variant: "contained",
|
|
713
|
-
size: "small",
|
|
714
|
-
disabled: !isDefinedNotNull3(permissionsApi) || requesting,
|
|
715
|
-
busy: isLoading || requesting,
|
|
716
|
-
onClick: handleClick,
|
|
717
|
-
children: hasGranted ? "Review permissions" : /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
718
|
-
"Request",
|
|
719
|
-
" ",
|
|
720
|
-
permissions.length,
|
|
721
|
-
" ",
|
|
722
|
-
"permission",
|
|
723
|
-
permissions.length === 1 ? "" : "s"
|
|
724
|
-
] })
|
|
725
|
-
}
|
|
726
|
-
),
|
|
727
|
-
/* @__PURE__ */ jsx5(PopoverErrorRender, { error: clientError ?? fetchError ?? requestError, scope: "RequestPermissionsButton" })
|
|
728
|
-
] }),
|
|
729
|
-
/* @__PURE__ */ jsx5(
|
|
730
|
-
PermissionsReviewDialog,
|
|
731
|
-
{
|
|
732
|
-
open: dialogOpen,
|
|
733
|
-
onClose: () => setDialogOpen(false),
|
|
734
|
-
granted: granted ?? [],
|
|
735
|
-
onReRequest: () => void requestPermissions(),
|
|
736
|
-
requesting,
|
|
737
|
-
error: requestError
|
|
738
|
-
}
|
|
739
|
-
)
|
|
1024
|
+
isDefined7(address) ? /* @__PURE__ */ jsx6(AccountComponent, { address }) : null,
|
|
1025
|
+
isUndefined3(address) && !timedout ? /* @__PURE__ */ jsx6(ConnectComponent, { onClick: () => void connectSigner(), children: "Connect" }) : null,
|
|
1026
|
+
isUndefined3(address) && timedout ? /* @__PURE__ */ jsx6(NoWalletInstalledComponent, {}) : null,
|
|
1027
|
+
/* @__PURE__ */ jsx6(ErrorRender4, { error, scope: "ConnectSigner:error" })
|
|
740
1028
|
]
|
|
741
1029
|
}
|
|
742
1030
|
);
|
|
743
1031
|
};
|
|
744
1032
|
|
|
745
1033
|
// src/client/components/connected/DataLakeAddToChainPanel.tsx
|
|
746
|
-
import {
|
|
747
|
-
|
|
748
|
-
|
|
1034
|
+
import { OpenInNew as OpenInNew2 } from "@mui/icons-material";
|
|
1035
|
+
import {
|
|
1036
|
+
Alert as Alert6,
|
|
1037
|
+
Chip as Chip3,
|
|
1038
|
+
Divider as Divider3,
|
|
1039
|
+
Link as Link2,
|
|
1040
|
+
Stack as Stack7,
|
|
1041
|
+
TextField,
|
|
1042
|
+
Typography as Typography6
|
|
1043
|
+
} from "@mui/material";
|
|
1044
|
+
import { ButtonEx as ButtonEx6 } from "@xylabs/react-button";
|
|
1045
|
+
import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
|
|
1046
|
+
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
1047
|
+
import { isDefined as isDefined8, isDefinedNotNull as isDefinedNotNull5 } from "@xylabs/sdk-js";
|
|
1048
|
+
import {
|
|
1049
|
+
asSchema as asSchema2,
|
|
1050
|
+
isAnyPayload,
|
|
1051
|
+
PayloadBuilder as PayloadBuilder2
|
|
1052
|
+
} from "@xyo-network/sdk-js";
|
|
1053
|
+
import {
|
|
1054
|
+
DataLakesGetMethod,
|
|
1055
|
+
DataLakesInsertMethod,
|
|
1056
|
+
ExplorerLinks as ExplorerLinks2,
|
|
1057
|
+
HashSchema,
|
|
1058
|
+
SequenceNetwork as SequenceNetwork2
|
|
1059
|
+
} from "@xyo-network/xl1-sdk";
|
|
1060
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
1061
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1062
|
+
var DEFAULT_EXPLORER_URL2 = "https://explore.xyo.network";
|
|
1063
|
+
var DEFAULT_PAYLOAD_SCHEMA = asSchema2("network.xyo.observation.v2", true);
|
|
749
1064
|
var PANEL_PERMISSIONS = [
|
|
750
1065
|
{ xyoWallet_getAccounts: { restrictReturnedAccounts: [] } },
|
|
751
1066
|
{ xyoSigner_address: {} },
|
|
@@ -753,7 +1068,7 @@ var PANEL_PERMISSIONS = [
|
|
|
753
1068
|
{ [DataLakesInsertMethod]: { dataLakeAccess: {} } }
|
|
754
1069
|
];
|
|
755
1070
|
async function buildDefaultPayload(schema) {
|
|
756
|
-
const builder = new
|
|
1071
|
+
const builder = new PayloadBuilder2({ schema }).fields({ value: 1 });
|
|
757
1072
|
const payload = builder.build();
|
|
758
1073
|
return JSON.stringify(payload, null, 2);
|
|
759
1074
|
}
|
|
@@ -776,9 +1091,9 @@ var TestPayloadSection = ({
|
|
|
776
1091
|
onChange,
|
|
777
1092
|
parse,
|
|
778
1093
|
value
|
|
779
|
-
}) => /* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
1094
|
+
}) => /* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 1 }, children: [
|
|
1095
|
+
/* @__PURE__ */ jsx7(Typography6, { variant: "subtitle2", children: "2. Test payload" }),
|
|
1096
|
+
/* @__PURE__ */ jsx7(
|
|
782
1097
|
TextField,
|
|
783
1098
|
{
|
|
784
1099
|
label: "Payload (single JSON object)",
|
|
@@ -791,11 +1106,11 @@ var TestPayloadSection = ({
|
|
|
791
1106
|
slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
|
|
792
1107
|
}
|
|
793
1108
|
),
|
|
794
|
-
parse.ok ? /* @__PURE__ */
|
|
1109
|
+
parse.ok ? /* @__PURE__ */ jsxs7(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
795
1110
|
"Parsed payload \u2014 schema:",
|
|
796
1111
|
" ",
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
] }) : /* @__PURE__ */
|
|
1112
|
+
/* @__PURE__ */ jsx7("code", { children: parse.payload.schema ?? "(none)" })
|
|
1113
|
+
] }) : /* @__PURE__ */ jsx7(Alert6, { severity: "error", variant: "outlined", children: /* @__PURE__ */ jsx7(Typography6, { variant: "body2", children: parse.error }) })
|
|
799
1114
|
] });
|
|
800
1115
|
var InsertSection = ({
|
|
801
1116
|
canInsert,
|
|
@@ -806,9 +1121,9 @@ var InsertSection = ({
|
|
|
806
1121
|
selectedLakeId,
|
|
807
1122
|
storedHash,
|
|
808
1123
|
timeout
|
|
809
|
-
}) => /* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
1124
|
+
}) => /* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 1 }, children: [
|
|
1125
|
+
/* @__PURE__ */ jsx7(Typography6, { variant: "subtitle2", children: "3. Insert into runner lake" }),
|
|
1126
|
+
/* @__PURE__ */ jsx7(
|
|
812
1127
|
ApprovedLakeSelector,
|
|
813
1128
|
{
|
|
814
1129
|
capability: "runner",
|
|
@@ -817,8 +1132,8 @@ var InsertSection = ({
|
|
|
817
1132
|
timeout
|
|
818
1133
|
}
|
|
819
1134
|
),
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
|
|
1135
|
+
/* @__PURE__ */ jsx7(
|
|
1136
|
+
ButtonEx6,
|
|
822
1137
|
{
|
|
823
1138
|
variant: "contained",
|
|
824
1139
|
size: "small",
|
|
@@ -828,8 +1143,8 @@ var InsertSection = ({
|
|
|
828
1143
|
children: "Insert into lake"
|
|
829
1144
|
}
|
|
830
1145
|
),
|
|
831
|
-
|
|
832
|
-
|
|
1146
|
+
isDefined8(storedHash) ? /* @__PURE__ */ jsxs7(
|
|
1147
|
+
Stack7,
|
|
833
1148
|
{
|
|
834
1149
|
direction: "row",
|
|
835
1150
|
sx: {
|
|
@@ -838,12 +1153,12 @@ var InsertSection = ({
|
|
|
838
1153
|
gap: 1
|
|
839
1154
|
},
|
|
840
1155
|
children: [
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ jsx7(Chip3, { label: "Stored", size: "small", color: "success" }),
|
|
1157
|
+
/* @__PURE__ */ jsx7(Typography6, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: storedHash })
|
|
843
1158
|
]
|
|
844
1159
|
}
|
|
845
1160
|
) : null,
|
|
846
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ jsx7(ErrorRender5, { error: insertError, scope: "DataLakeAddToChainPanel.insert" })
|
|
847
1162
|
] });
|
|
848
1163
|
var AddToChainSection = ({
|
|
849
1164
|
addingToChain,
|
|
@@ -854,16 +1169,16 @@ var AddToChainSection = ({
|
|
|
854
1169
|
onAddToChain,
|
|
855
1170
|
signedTx,
|
|
856
1171
|
txHash
|
|
857
|
-
}) => /* @__PURE__ */
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
1172
|
+
}) => /* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 1 }, children: [
|
|
1173
|
+
/* @__PURE__ */ jsx7(Typography6, { variant: "subtitle2", children: "4. Add HashPayload to chain" }),
|
|
1174
|
+
/* @__PURE__ */ jsxs7(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
860
1175
|
"References the lake-stored payload via",
|
|
861
1176
|
" ",
|
|
862
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ jsx7("code", { children: "network.xyo.hash" }),
|
|
863
1178
|
"; the payload itself rides along as the `offChain` argument."
|
|
864
1179
|
] }),
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
|
|
1180
|
+
/* @__PURE__ */ jsx7(
|
|
1181
|
+
ButtonEx6,
|
|
867
1182
|
{
|
|
868
1183
|
variant: "contained",
|
|
869
1184
|
size: "small",
|
|
@@ -873,9 +1188,9 @@ var AddToChainSection = ({
|
|
|
873
1188
|
children: "Add to chain"
|
|
874
1189
|
}
|
|
875
1190
|
),
|
|
876
|
-
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
|
|
1191
|
+
isDefined8(txHash) && isDefined8(explorerTxUrl) ? /* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 0.5 }, children: [
|
|
1192
|
+
/* @__PURE__ */ jsxs7(
|
|
1193
|
+
Stack7,
|
|
879
1194
|
{
|
|
880
1195
|
direction: "row",
|
|
881
1196
|
sx: {
|
|
@@ -884,13 +1199,13 @@ var AddToChainSection = ({
|
|
|
884
1199
|
gap: 1
|
|
885
1200
|
},
|
|
886
1201
|
children: [
|
|
887
|
-
/* @__PURE__ */
|
|
888
|
-
/* @__PURE__ */
|
|
1202
|
+
/* @__PURE__ */ jsx7(Chip3, { label: "Submitted", size: "small", color: "success" }),
|
|
1203
|
+
/* @__PURE__ */ jsx7(Typography6, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: txHash })
|
|
889
1204
|
]
|
|
890
1205
|
}
|
|
891
1206
|
),
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
|
|
1207
|
+
/* @__PURE__ */ jsxs7(
|
|
1208
|
+
Link2,
|
|
894
1209
|
{
|
|
895
1210
|
href: explorerTxUrl,
|
|
896
1211
|
target: "_blank",
|
|
@@ -902,22 +1217,22 @@ var AddToChainSection = ({
|
|
|
902
1217
|
},
|
|
903
1218
|
children: [
|
|
904
1219
|
"View on explorer",
|
|
905
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ jsx7(OpenInNew2, { sx: { fontSize: 14 } })
|
|
906
1221
|
]
|
|
907
1222
|
}
|
|
908
1223
|
),
|
|
909
|
-
|
|
1224
|
+
isDefined8(signedTx) ? /* @__PURE__ */ jsxs7(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
910
1225
|
"Signed transaction recorded \u2014 open the explorer link above to verify inclusion on",
|
|
911
1226
|
" ",
|
|
912
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ jsx7("code", { children: gatewayName }),
|
|
913
1228
|
"."
|
|
914
1229
|
] }) : null
|
|
915
1230
|
] }) : null,
|
|
916
|
-
/* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ jsx7(ErrorRender5, { error: chainError, scope: "DataLakeAddToChainPanel.addToChain" })
|
|
917
1232
|
] });
|
|
918
1233
|
var DataLakeAddToChainPanel = ({
|
|
919
|
-
explorerUrl =
|
|
920
|
-
gatewayName =
|
|
1234
|
+
explorerUrl = DEFAULT_EXPLORER_URL2,
|
|
1235
|
+
gatewayName = SequenceNetwork2.id,
|
|
921
1236
|
initialPayloadJson,
|
|
922
1237
|
payloadSchema = DEFAULT_PAYLOAD_SCHEMA,
|
|
923
1238
|
timeout,
|
|
@@ -929,27 +1244,27 @@ var DataLakeAddToChainPanel = ({
|
|
|
929
1244
|
error: gatewayError,
|
|
930
1245
|
timedout
|
|
931
1246
|
} = useGatewayFromWallet(gatewayName, timeout);
|
|
932
|
-
const [payloadText, setPayloadText] =
|
|
1247
|
+
const [payloadText, setPayloadText] = useState6(initialPayloadJson ?? "");
|
|
933
1248
|
usePromise2(async () => setPayloadText(await buildDefaultPayload(payloadSchema)), [payloadSchema]);
|
|
934
|
-
const parse =
|
|
935
|
-
const [selectedLakeId, setSelectedLakeId] =
|
|
936
|
-
const [storedPayload, setStoredPayload] =
|
|
937
|
-
const [inserting, setInserting] =
|
|
938
|
-
const [insertError, setInsertError] =
|
|
939
|
-
const [txHash, setTxHash] =
|
|
940
|
-
const [signedTx, setSignedTx] =
|
|
941
|
-
const [addingToChain, setAddingToChain] =
|
|
942
|
-
const [chainError, setChainError] =
|
|
1249
|
+
const parse = useMemo2(() => parsePayload(payloadText), [payloadText]);
|
|
1250
|
+
const [selectedLakeId, setSelectedLakeId] = useState6("");
|
|
1251
|
+
const [storedPayload, setStoredPayload] = useState6();
|
|
1252
|
+
const [inserting, setInserting] = useState6(false);
|
|
1253
|
+
const [insertError, setInsertError] = useState6();
|
|
1254
|
+
const [txHash, setTxHash] = useState6();
|
|
1255
|
+
const [signedTx, setSignedTx] = useState6();
|
|
1256
|
+
const [addingToChain, setAddingToChain] = useState6(false);
|
|
1257
|
+
const [chainError, setChainError] = useState6();
|
|
943
1258
|
const dataLakes = client?.dataLakes;
|
|
944
|
-
const [storedHash] = usePromise2(async () =>
|
|
945
|
-
const canInsert = parse.ok && selectedLakeId.length > 0 &&
|
|
946
|
-
const canAddToChain =
|
|
947
|
-
const explorerTxUrl =
|
|
948
|
-
if (!
|
|
949
|
-
return new
|
|
1259
|
+
const [storedHash] = usePromise2(async () => isDefined8(storedPayload) ? await PayloadBuilder2.dataHash(storedPayload) : void 0, [storedPayload]);
|
|
1260
|
+
const canInsert = parse.ok && selectedLakeId.length > 0 && isDefinedNotNull5(dataLakes) && !inserting;
|
|
1261
|
+
const canAddToChain = isDefined8(storedHash) && isDefined8(storedPayload) && isDefinedNotNull5(gateway) && !addingToChain;
|
|
1262
|
+
const explorerTxUrl = useMemo2(() => {
|
|
1263
|
+
if (!isDefined8(txHash)) return;
|
|
1264
|
+
return new ExplorerLinks2(explorerUrl, gatewayName).transaction(txHash);
|
|
950
1265
|
}, [txHash, explorerUrl, gatewayName]);
|
|
951
1266
|
const handleInsert = async () => {
|
|
952
|
-
if (!canInsert || !parse.ok || !
|
|
1267
|
+
if (!canInsert || !parse.ok || !isDefinedNotNull5(dataLakes)) return;
|
|
953
1268
|
setInsertError(void 0);
|
|
954
1269
|
setStoredPayload(void 0);
|
|
955
1270
|
setTxHash(void 0);
|
|
@@ -958,7 +1273,7 @@ var DataLakeAddToChainPanel = ({
|
|
|
958
1273
|
setInserting(true);
|
|
959
1274
|
try {
|
|
960
1275
|
const [stored] = await dataLakes.insert(selectedLakeId, [parse.payload]);
|
|
961
|
-
if (!
|
|
1276
|
+
if (!isDefined8(stored)) {
|
|
962
1277
|
setInsertError(new Error("Lake returned no entries for this insert \u2014 the lake may disallow the payload's schema."));
|
|
963
1278
|
return;
|
|
964
1279
|
}
|
|
@@ -974,7 +1289,7 @@ var DataLakeAddToChainPanel = ({
|
|
|
974
1289
|
}
|
|
975
1290
|
};
|
|
976
1291
|
const handleAddToChain = async () => {
|
|
977
|
-
if (!canAddToChain || !
|
|
1292
|
+
if (!canAddToChain || !isDefinedNotNull5(gateway) || !isDefined8(storedPayload) || !isDefined8(storedHash)) return;
|
|
978
1293
|
setChainError(void 0);
|
|
979
1294
|
setTxHash(void 0);
|
|
980
1295
|
setSignedTx(void 0);
|
|
@@ -990,8 +1305,8 @@ var DataLakeAddToChainPanel = ({
|
|
|
990
1305
|
setAddingToChain(false);
|
|
991
1306
|
}
|
|
992
1307
|
};
|
|
993
|
-
return /* @__PURE__ */
|
|
994
|
-
|
|
1308
|
+
return /* @__PURE__ */ jsxs7(
|
|
1309
|
+
Stack7,
|
|
995
1310
|
{
|
|
996
1311
|
...props,
|
|
997
1312
|
sx: {
|
|
@@ -1000,15 +1315,15 @@ var DataLakeAddToChainPanel = ({
|
|
|
1000
1315
|
...props.sx
|
|
1001
1316
|
},
|
|
1002
1317
|
children: [
|
|
1003
|
-
timedout ? /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1318
|
+
timedout ? /* @__PURE__ */ jsx7(Alert6, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1319
|
+
/* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 1 }, children: [
|
|
1320
|
+
/* @__PURE__ */ jsx7(Typography6, { variant: "subtitle2", children: "1. Grant signer + data-lake access" }),
|
|
1321
|
+
/* @__PURE__ */ jsx7(RequestPermissionsButton, { permissions: PANEL_PERMISSIONS, timeout })
|
|
1007
1322
|
] }),
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
/* @__PURE__ */
|
|
1011
|
-
/* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ jsx7(Divider3, {}),
|
|
1324
|
+
/* @__PURE__ */ jsx7(TestPayloadSection, { value: payloadText, onChange: setPayloadText, parse }),
|
|
1325
|
+
/* @__PURE__ */ jsx7(Divider3, {}),
|
|
1326
|
+
/* @__PURE__ */ jsx7(
|
|
1012
1327
|
InsertSection,
|
|
1013
1328
|
{
|
|
1014
1329
|
canInsert,
|
|
@@ -1021,8 +1336,8 @@ var DataLakeAddToChainPanel = ({
|
|
|
1021
1336
|
timeout
|
|
1022
1337
|
}
|
|
1023
1338
|
),
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ jsx7(Divider3, {}),
|
|
1340
|
+
/* @__PURE__ */ jsx7(
|
|
1026
1341
|
AddToChainSection,
|
|
1027
1342
|
{
|
|
1028
1343
|
addingToChain,
|
|
@@ -1035,7 +1350,7 @@ var DataLakeAddToChainPanel = ({
|
|
|
1035
1350
|
txHash
|
|
1036
1351
|
}
|
|
1037
1352
|
),
|
|
1038
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ jsx7(ErrorRender5, { error: clientError ?? gatewayError ?? void 0, scope: "DataLakeAddToChainPanel.wallet" })
|
|
1039
1354
|
]
|
|
1040
1355
|
}
|
|
1041
1356
|
);
|
|
@@ -1043,15 +1358,15 @@ var DataLakeAddToChainPanel = ({
|
|
|
1043
1358
|
|
|
1044
1359
|
// src/client/components/connected/DataLakeGetButton.tsx
|
|
1045
1360
|
import {
|
|
1046
|
-
Alert as
|
|
1047
|
-
Stack as
|
|
1048
|
-
Typography as
|
|
1361
|
+
Alert as Alert7,
|
|
1362
|
+
Stack as Stack8,
|
|
1363
|
+
Typography as Typography7
|
|
1049
1364
|
} from "@mui/material";
|
|
1050
|
-
import { ButtonEx as
|
|
1051
|
-
import { ErrorRender as
|
|
1052
|
-
import { isDefined as
|
|
1053
|
-
import { useState as
|
|
1054
|
-
import { jsx as
|
|
1365
|
+
import { ButtonEx as ButtonEx7 } from "@xylabs/react-button";
|
|
1366
|
+
import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
|
|
1367
|
+
import { isDefined as isDefined9, isDefinedNotNull as isDefinedNotNull6 } from "@xylabs/sdk-js";
|
|
1368
|
+
import { useState as useState7 } from "react";
|
|
1369
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1055
1370
|
var DataLakeGetButton = ({
|
|
1056
1371
|
id,
|
|
1057
1372
|
hashes,
|
|
@@ -1064,14 +1379,14 @@ var DataLakeGetButton = ({
|
|
|
1064
1379
|
isLoading,
|
|
1065
1380
|
timedout
|
|
1066
1381
|
} = useClientFromWallet(timeout);
|
|
1067
|
-
const [result, setResult] =
|
|
1068
|
-
const [requestError, setRequestError] =
|
|
1069
|
-
const [requesting, setRequesting] =
|
|
1382
|
+
const [result, setResult] = useState7();
|
|
1383
|
+
const [requestError, setRequestError] = useState7();
|
|
1384
|
+
const [requesting, setRequesting] = useState7(false);
|
|
1070
1385
|
const dataLakes = client?.dataLakes;
|
|
1071
|
-
const supported =
|
|
1386
|
+
const supported = isDefinedNotNull6(dataLakes);
|
|
1072
1387
|
const argsReady = id.length > 0 && hashes.length > 0;
|
|
1073
1388
|
const handleClick = async () => {
|
|
1074
|
-
if (!
|
|
1389
|
+
if (!isDefinedNotNull6(dataLakes)) return;
|
|
1075
1390
|
setRequestError(void 0);
|
|
1076
1391
|
setResult(void 0);
|
|
1077
1392
|
setRequesting(true);
|
|
@@ -1084,8 +1399,8 @@ var DataLakeGetButton = ({
|
|
|
1084
1399
|
setRequesting(false);
|
|
1085
1400
|
}
|
|
1086
1401
|
};
|
|
1087
|
-
return /* @__PURE__ */
|
|
1088
|
-
|
|
1402
|
+
return /* @__PURE__ */ jsxs8(
|
|
1403
|
+
Stack8,
|
|
1089
1404
|
{
|
|
1090
1405
|
...props,
|
|
1091
1406
|
sx: {
|
|
@@ -1094,10 +1409,10 @@ var DataLakeGetButton = ({
|
|
|
1094
1409
|
...props.sx
|
|
1095
1410
|
},
|
|
1096
1411
|
children: [
|
|
1097
|
-
timedout ? /* @__PURE__ */
|
|
1098
|
-
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
|
|
1412
|
+
timedout ? /* @__PURE__ */ jsx8(Alert7, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1413
|
+
isDefinedNotNull6(client) && !supported ? /* @__PURE__ */ jsx8(Alert7, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1414
|
+
/* @__PURE__ */ jsxs8(
|
|
1415
|
+
ButtonEx7,
|
|
1101
1416
|
{
|
|
1102
1417
|
variant: "contained",
|
|
1103
1418
|
size: "small",
|
|
@@ -1114,11 +1429,11 @@ var DataLakeGetButton = ({
|
|
|
1114
1429
|
]
|
|
1115
1430
|
}
|
|
1116
1431
|
),
|
|
1117
|
-
argsReady ? null : /* @__PURE__ */
|
|
1118
|
-
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
1121
|
-
|
|
1432
|
+
argsReady ? null : /* @__PURE__ */ jsx8(Typography7, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one hash to enable the button." }),
|
|
1433
|
+
isDefined9(result) ? /* @__PURE__ */ jsxs8(Stack8, { sx: { gap: 0.5 }, children: [
|
|
1434
|
+
/* @__PURE__ */ jsx8(Typography7, { variant: "subtitle2", children: result.length === 0 ? "No payloads returned" : `Payloads (${result.length})` }),
|
|
1435
|
+
/* @__PURE__ */ jsx8(
|
|
1436
|
+
Typography7,
|
|
1122
1437
|
{
|
|
1123
1438
|
component: "pre",
|
|
1124
1439
|
variant: "body2",
|
|
@@ -1131,7 +1446,7 @@ var DataLakeGetButton = ({
|
|
|
1131
1446
|
}
|
|
1132
1447
|
)
|
|
1133
1448
|
] }) : null,
|
|
1134
|
-
/* @__PURE__ */
|
|
1449
|
+
/* @__PURE__ */ jsx8(ErrorRender6, { error: clientError ?? requestError, scope: "DataLakeGetButton" })
|
|
1135
1450
|
]
|
|
1136
1451
|
}
|
|
1137
1452
|
);
|
|
@@ -1139,20 +1454,20 @@ var DataLakeGetButton = ({
|
|
|
1139
1454
|
|
|
1140
1455
|
// src/client/components/connected/DataLakeGetPanel.tsx
|
|
1141
1456
|
import {
|
|
1142
|
-
Stack as
|
|
1457
|
+
Stack as Stack9,
|
|
1143
1458
|
TextField as TextField2,
|
|
1144
|
-
Typography as
|
|
1459
|
+
Typography as Typography8
|
|
1145
1460
|
} from "@mui/material";
|
|
1146
|
-
import { useMemo as
|
|
1147
|
-
import { jsx as
|
|
1461
|
+
import { useMemo as useMemo3, useState as useState8 } from "react";
|
|
1462
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1148
1463
|
var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
1149
|
-
const [selectedId, setSelectedId] =
|
|
1150
|
-
const [hashesText, setHashesText] =
|
|
1151
|
-
const hashes =
|
|
1464
|
+
const [selectedId, setSelectedId] = useState8("");
|
|
1465
|
+
const [hashesText, setHashesText] = useState8("");
|
|
1466
|
+
const hashes = useMemo3(() => {
|
|
1152
1467
|
return hashesText.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
1153
1468
|
}, [hashesText]);
|
|
1154
|
-
return /* @__PURE__ */
|
|
1155
|
-
|
|
1469
|
+
return /* @__PURE__ */ jsxs9(
|
|
1470
|
+
Stack9,
|
|
1156
1471
|
{
|
|
1157
1472
|
...props,
|
|
1158
1473
|
sx: {
|
|
@@ -1161,7 +1476,7 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
|
1161
1476
|
...props.sx
|
|
1162
1477
|
},
|
|
1163
1478
|
children: [
|
|
1164
|
-
/* @__PURE__ */
|
|
1479
|
+
/* @__PURE__ */ jsx9(
|
|
1165
1480
|
ApprovedLakeSelector,
|
|
1166
1481
|
{
|
|
1167
1482
|
capability: "viewer",
|
|
@@ -1170,7 +1485,7 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
|
1170
1485
|
timeout
|
|
1171
1486
|
}
|
|
1172
1487
|
),
|
|
1173
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ jsx9(
|
|
1174
1489
|
TextField2,
|
|
1175
1490
|
{
|
|
1176
1491
|
label: "Hashes (one per line)",
|
|
@@ -1183,8 +1498,8 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
|
1183
1498
|
slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
|
|
1184
1499
|
}
|
|
1185
1500
|
),
|
|
1186
|
-
/* @__PURE__ */
|
|
1187
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ jsx9(Typography8, { variant: "caption", sx: { color: "text.secondary" }, children: hashes.length === 0 ? "No hashes parsed." : `${hashes.length} hash${hashes.length === 1 ? "" : "es"} ready.` }),
|
|
1502
|
+
/* @__PURE__ */ jsx9(DataLakeGetButton, { id: selectedId, hashes, timeout })
|
|
1188
1503
|
]
|
|
1189
1504
|
}
|
|
1190
1505
|
);
|
|
@@ -1192,15 +1507,15 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
|
1192
1507
|
|
|
1193
1508
|
// src/client/components/connected/DataLakeInsertButton.tsx
|
|
1194
1509
|
import {
|
|
1195
|
-
Alert as
|
|
1196
|
-
Stack as
|
|
1197
|
-
Typography as
|
|
1510
|
+
Alert as Alert8,
|
|
1511
|
+
Stack as Stack10,
|
|
1512
|
+
Typography as Typography9
|
|
1198
1513
|
} from "@mui/material";
|
|
1199
|
-
import { ButtonEx as
|
|
1200
|
-
import { ErrorRender as
|
|
1201
|
-
import { isDefined as
|
|
1202
|
-
import { useState as
|
|
1203
|
-
import { jsx as
|
|
1514
|
+
import { ButtonEx as ButtonEx8 } from "@xylabs/react-button";
|
|
1515
|
+
import { ErrorRender as ErrorRender7 } from "@xylabs/react-error";
|
|
1516
|
+
import { isDefined as isDefined10, isDefinedNotNull as isDefinedNotNull7 } from "@xylabs/sdk-js";
|
|
1517
|
+
import { useState as useState9 } from "react";
|
|
1518
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1204
1519
|
var DataLakeInsertButton = ({
|
|
1205
1520
|
id,
|
|
1206
1521
|
payloads,
|
|
@@ -1213,14 +1528,14 @@ var DataLakeInsertButton = ({
|
|
|
1213
1528
|
isLoading,
|
|
1214
1529
|
timedout
|
|
1215
1530
|
} = useClientFromWallet(timeout);
|
|
1216
|
-
const [result, setResult] =
|
|
1217
|
-
const [requestError, setRequestError] =
|
|
1218
|
-
const [requesting, setRequesting] =
|
|
1531
|
+
const [result, setResult] = useState9();
|
|
1532
|
+
const [requestError, setRequestError] = useState9();
|
|
1533
|
+
const [requesting, setRequesting] = useState9(false);
|
|
1219
1534
|
const dataLakes = client?.dataLakes;
|
|
1220
|
-
const supported =
|
|
1535
|
+
const supported = isDefinedNotNull7(dataLakes);
|
|
1221
1536
|
const argsReady = id.length > 0 && payloads.length > 0;
|
|
1222
1537
|
const handleClick = async () => {
|
|
1223
|
-
if (!
|
|
1538
|
+
if (!isDefinedNotNull7(dataLakes)) return;
|
|
1224
1539
|
setRequestError(void 0);
|
|
1225
1540
|
setResult(void 0);
|
|
1226
1541
|
setRequesting(true);
|
|
@@ -1233,8 +1548,8 @@ var DataLakeInsertButton = ({
|
|
|
1233
1548
|
setRequesting(false);
|
|
1234
1549
|
}
|
|
1235
1550
|
};
|
|
1236
|
-
return /* @__PURE__ */
|
|
1237
|
-
|
|
1551
|
+
return /* @__PURE__ */ jsxs10(
|
|
1552
|
+
Stack10,
|
|
1238
1553
|
{
|
|
1239
1554
|
...props,
|
|
1240
1555
|
sx: {
|
|
@@ -1243,10 +1558,10 @@ var DataLakeInsertButton = ({
|
|
|
1243
1558
|
...props.sx
|
|
1244
1559
|
},
|
|
1245
1560
|
children: [
|
|
1246
|
-
timedout ? /* @__PURE__ */
|
|
1247
|
-
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
|
|
1561
|
+
timedout ? /* @__PURE__ */ jsx10(Alert8, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1562
|
+
isDefinedNotNull7(client) && !supported ? /* @__PURE__ */ jsx10(Alert8, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1563
|
+
/* @__PURE__ */ jsxs10(
|
|
1564
|
+
ButtonEx8,
|
|
1250
1565
|
{
|
|
1251
1566
|
variant: "contained",
|
|
1252
1567
|
size: "small",
|
|
@@ -1263,11 +1578,11 @@ var DataLakeInsertButton = ({
|
|
|
1263
1578
|
]
|
|
1264
1579
|
}
|
|
1265
1580
|
),
|
|
1266
|
-
argsReady ? null : /* @__PURE__ */
|
|
1267
|
-
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
|
|
1581
|
+
argsReady ? null : /* @__PURE__ */ jsx10(Typography9, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one payload to enable the button." }),
|
|
1582
|
+
isDefined10(result) ? /* @__PURE__ */ jsxs10(Stack10, { sx: { gap: 0.5 }, children: [
|
|
1583
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "subtitle2", children: result.length === 0 ? "No payloads written (wallet filtered all)" : `Inserted (${result.length})` }),
|
|
1584
|
+
/* @__PURE__ */ jsx10(
|
|
1585
|
+
Typography9,
|
|
1271
1586
|
{
|
|
1272
1587
|
component: "pre",
|
|
1273
1588
|
variant: "body2",
|
|
@@ -1280,7 +1595,7 @@ var DataLakeInsertButton = ({
|
|
|
1280
1595
|
}
|
|
1281
1596
|
)
|
|
1282
1597
|
] }) : null,
|
|
1283
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ jsx10(ErrorRender7, { error: clientError ?? requestError, scope: "DataLakeInsertButton" })
|
|
1284
1599
|
]
|
|
1285
1600
|
}
|
|
1286
1601
|
);
|
|
@@ -1288,13 +1603,13 @@ var DataLakeInsertButton = ({
|
|
|
1288
1603
|
|
|
1289
1604
|
// src/client/components/connected/DataLakeInsertPanel.tsx
|
|
1290
1605
|
import {
|
|
1291
|
-
Alert as
|
|
1292
|
-
Stack as
|
|
1606
|
+
Alert as Alert9,
|
|
1607
|
+
Stack as Stack11,
|
|
1293
1608
|
TextField as TextField3,
|
|
1294
|
-
Typography as
|
|
1609
|
+
Typography as Typography10
|
|
1295
1610
|
} from "@mui/material";
|
|
1296
|
-
import { useMemo as
|
|
1297
|
-
import { jsx as
|
|
1611
|
+
import { useMemo as useMemo4, useState as useState10 } from "react";
|
|
1612
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1298
1613
|
function buildDefaultPayload2() {
|
|
1299
1614
|
return JSON.stringify(
|
|
1300
1615
|
{
|
|
@@ -1319,11 +1634,11 @@ function parsePayload2(raw) {
|
|
|
1319
1634
|
}
|
|
1320
1635
|
}
|
|
1321
1636
|
var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
1322
|
-
const [selectedId, setSelectedId] =
|
|
1323
|
-
const [payloadText, setPayloadText] =
|
|
1324
|
-
const parse =
|
|
1325
|
-
return /* @__PURE__ */
|
|
1326
|
-
|
|
1637
|
+
const [selectedId, setSelectedId] = useState10("");
|
|
1638
|
+
const [payloadText, setPayloadText] = useState10(buildDefaultPayload2);
|
|
1639
|
+
const parse = useMemo4(() => parsePayload2(payloadText), [payloadText]);
|
|
1640
|
+
return /* @__PURE__ */ jsxs11(
|
|
1641
|
+
Stack11,
|
|
1327
1642
|
{
|
|
1328
1643
|
...props,
|
|
1329
1644
|
sx: {
|
|
@@ -1332,7 +1647,7 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
|
1332
1647
|
...props.sx
|
|
1333
1648
|
},
|
|
1334
1649
|
children: [
|
|
1335
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__PURE__ */ jsx11(
|
|
1336
1651
|
ApprovedLakeSelector,
|
|
1337
1652
|
{
|
|
1338
1653
|
capability: "runner",
|
|
@@ -1341,7 +1656,7 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
|
1341
1656
|
timeout
|
|
1342
1657
|
}
|
|
1343
1658
|
),
|
|
1344
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ jsx11(
|
|
1345
1660
|
TextField3,
|
|
1346
1661
|
{
|
|
1347
1662
|
label: "Payload (JSON object or array)",
|
|
@@ -1354,15 +1669,15 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
|
1354
1669
|
slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
|
|
1355
1670
|
}
|
|
1356
1671
|
),
|
|
1357
|
-
parse.ok ? /* @__PURE__ */
|
|
1672
|
+
parse.ok ? /* @__PURE__ */ jsxs11(Typography10, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
1358
1673
|
parse.payloads.length,
|
|
1359
1674
|
" ",
|
|
1360
1675
|
"payload",
|
|
1361
1676
|
parse.payloads.length === 1 ? "" : "s",
|
|
1362
1677
|
" ",
|
|
1363
1678
|
"parsed."
|
|
1364
|
-
] }) : /* @__PURE__ */
|
|
1365
|
-
/* @__PURE__ */
|
|
1679
|
+
] }) : /* @__PURE__ */ jsx11(Alert9, { severity: "error", variant: "outlined", children: /* @__PURE__ */ jsx11(Typography10, { variant: "body2", children: parse.error }) }),
|
|
1680
|
+
/* @__PURE__ */ jsx11(
|
|
1366
1681
|
DataLakeInsertButton,
|
|
1367
1682
|
{
|
|
1368
1683
|
id: selectedId,
|
|
@@ -1377,15 +1692,15 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
|
1377
1692
|
|
|
1378
1693
|
// src/client/components/connected/DataLakeListButton.tsx
|
|
1379
1694
|
import {
|
|
1380
|
-
Alert as
|
|
1381
|
-
Stack as
|
|
1382
|
-
Typography as
|
|
1695
|
+
Alert as Alert10,
|
|
1696
|
+
Stack as Stack12,
|
|
1697
|
+
Typography as Typography11
|
|
1383
1698
|
} from "@mui/material";
|
|
1384
|
-
import { ButtonEx as
|
|
1385
|
-
import { ErrorRender as
|
|
1386
|
-
import { isDefined as
|
|
1387
|
-
import { useState as
|
|
1388
|
-
import { jsx as
|
|
1699
|
+
import { ButtonEx as ButtonEx9 } from "@xylabs/react-button";
|
|
1700
|
+
import { ErrorRender as ErrorRender8 } from "@xylabs/react-error";
|
|
1701
|
+
import { isDefined as isDefined11, isDefinedNotNull as isDefinedNotNull8 } from "@xylabs/sdk-js";
|
|
1702
|
+
import { useState as useState11 } from "react";
|
|
1703
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1389
1704
|
var DataLakeListButton = ({ timeout, ...props }) => {
|
|
1390
1705
|
const {
|
|
1391
1706
|
client,
|
|
@@ -1393,13 +1708,13 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1393
1708
|
isLoading,
|
|
1394
1709
|
timedout
|
|
1395
1710
|
} = useClientFromWallet(timeout);
|
|
1396
|
-
const [lakes, setLakes] =
|
|
1397
|
-
const [requestError, setRequestError] =
|
|
1398
|
-
const [requesting, setRequesting] =
|
|
1711
|
+
const [lakes, setLakes] = useState11();
|
|
1712
|
+
const [requestError, setRequestError] = useState11();
|
|
1713
|
+
const [requesting, setRequesting] = useState11(false);
|
|
1399
1714
|
const dataLakes = client?.dataLakes;
|
|
1400
|
-
const supported =
|
|
1715
|
+
const supported = isDefinedNotNull8(dataLakes);
|
|
1401
1716
|
const handleClick = async () => {
|
|
1402
|
-
if (!
|
|
1717
|
+
if (!isDefinedNotNull8(dataLakes)) return;
|
|
1403
1718
|
setRequestError(void 0);
|
|
1404
1719
|
setLakes(void 0);
|
|
1405
1720
|
setRequesting(true);
|
|
@@ -1412,8 +1727,8 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1412
1727
|
setRequesting(false);
|
|
1413
1728
|
}
|
|
1414
1729
|
};
|
|
1415
|
-
return /* @__PURE__ */
|
|
1416
|
-
|
|
1730
|
+
return /* @__PURE__ */ jsxs12(
|
|
1731
|
+
Stack12,
|
|
1417
1732
|
{
|
|
1418
1733
|
...props,
|
|
1419
1734
|
sx: {
|
|
@@ -1422,10 +1737,10 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1422
1737
|
...props.sx
|
|
1423
1738
|
},
|
|
1424
1739
|
children: [
|
|
1425
|
-
timedout ? /* @__PURE__ */
|
|
1426
|
-
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
|
|
1740
|
+
timedout ? /* @__PURE__ */ jsx12(Alert10, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1741
|
+
isDefinedNotNull8(client) && !supported ? /* @__PURE__ */ jsx12(Alert10, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1742
|
+
/* @__PURE__ */ jsx12(
|
|
1743
|
+
ButtonEx9,
|
|
1429
1744
|
{
|
|
1430
1745
|
variant: "contained",
|
|
1431
1746
|
size: "small",
|
|
@@ -1435,10 +1750,10 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1435
1750
|
children: "List approved data lakes"
|
|
1436
1751
|
}
|
|
1437
1752
|
),
|
|
1438
|
-
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
/* @__PURE__ */
|
|
1441
|
-
|
|
1753
|
+
isDefined11(lakes) ? /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 0.5 }, children: [
|
|
1754
|
+
/* @__PURE__ */ jsx12(Typography11, { variant: "subtitle2", children: lakes.length === 0 ? "No approved lakes" : `Approved lakes (${lakes.length})` }),
|
|
1755
|
+
/* @__PURE__ */ jsx12(
|
|
1756
|
+
Typography11,
|
|
1442
1757
|
{
|
|
1443
1758
|
component: "pre",
|
|
1444
1759
|
variant: "body2",
|
|
@@ -1451,7 +1766,7 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1451
1766
|
}
|
|
1452
1767
|
)
|
|
1453
1768
|
] }) : null,
|
|
1454
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx12(ErrorRender8, { error: clientError ?? requestError, scope: "DataLakeListButton" })
|
|
1455
1770
|
]
|
|
1456
1771
|
}
|
|
1457
1772
|
);
|
|
@@ -1459,9 +1774,9 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1459
1774
|
|
|
1460
1775
|
// src/client/components/connected/DataLakeOperationsPanel.tsx
|
|
1461
1776
|
import {
|
|
1462
|
-
Divider as
|
|
1463
|
-
Stack as
|
|
1464
|
-
Typography as
|
|
1777
|
+
Divider as Divider4,
|
|
1778
|
+
Stack as Stack15,
|
|
1779
|
+
Typography as Typography13
|
|
1465
1780
|
} from "@mui/material";
|
|
1466
1781
|
|
|
1467
1782
|
// src/client/components/connected/DataLakeRequestAccessPanel.tsx
|
|
@@ -1472,22 +1787,22 @@ import {
|
|
|
1472
1787
|
InputLabel as InputLabel2,
|
|
1473
1788
|
MenuItem as MenuItem2,
|
|
1474
1789
|
Select as Select2,
|
|
1475
|
-
Stack as
|
|
1790
|
+
Stack as Stack14
|
|
1476
1791
|
} from "@mui/material";
|
|
1477
|
-
import { asSchema as
|
|
1478
|
-
import { useMemo as
|
|
1792
|
+
import { asSchema as asSchema3 } from "@xyo-network/sdk-js";
|
|
1793
|
+
import { useMemo as useMemo5, useState as useState13 } from "react";
|
|
1479
1794
|
|
|
1480
1795
|
// src/client/components/connected/DataLakeRequestAccessButton.tsx
|
|
1481
1796
|
import {
|
|
1482
|
-
Alert as
|
|
1483
|
-
Stack as
|
|
1484
|
-
Typography as
|
|
1797
|
+
Alert as Alert11,
|
|
1798
|
+
Stack as Stack13,
|
|
1799
|
+
Typography as Typography12
|
|
1485
1800
|
} from "@mui/material";
|
|
1486
|
-
import { ButtonEx as
|
|
1487
|
-
import { ErrorRender as
|
|
1488
|
-
import { isDefined as
|
|
1489
|
-
import { useState as
|
|
1490
|
-
import { jsx as
|
|
1801
|
+
import { ButtonEx as ButtonEx10 } from "@xylabs/react-button";
|
|
1802
|
+
import { ErrorRender as ErrorRender9 } from "@xylabs/react-error";
|
|
1803
|
+
import { isDefined as isDefined12, isDefinedNotNull as isDefinedNotNull9 } from "@xylabs/sdk-js";
|
|
1804
|
+
import { useState as useState12 } from "react";
|
|
1805
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1491
1806
|
var DataLakeRequestAccessButton = ({
|
|
1492
1807
|
options,
|
|
1493
1808
|
timeout,
|
|
@@ -1499,13 +1814,13 @@ var DataLakeRequestAccessButton = ({
|
|
|
1499
1814
|
isLoading,
|
|
1500
1815
|
timedout
|
|
1501
1816
|
} = useClientFromWallet(timeout);
|
|
1502
|
-
const [granted, setGranted] =
|
|
1503
|
-
const [requestError, setRequestError] =
|
|
1504
|
-
const [requesting, setRequesting] =
|
|
1817
|
+
const [granted, setGranted] = useState12();
|
|
1818
|
+
const [requestError, setRequestError] = useState12();
|
|
1819
|
+
const [requesting, setRequesting] = useState12(false);
|
|
1505
1820
|
const dataLakes = client?.dataLakes;
|
|
1506
|
-
const supported =
|
|
1821
|
+
const supported = isDefinedNotNull9(dataLakes);
|
|
1507
1822
|
const handleClick = async () => {
|
|
1508
|
-
if (!
|
|
1823
|
+
if (!isDefinedNotNull9(dataLakes)) return;
|
|
1509
1824
|
setRequestError(void 0);
|
|
1510
1825
|
setGranted(void 0);
|
|
1511
1826
|
setRequesting(true);
|
|
@@ -1518,8 +1833,8 @@ var DataLakeRequestAccessButton = ({
|
|
|
1518
1833
|
setRequesting(false);
|
|
1519
1834
|
}
|
|
1520
1835
|
};
|
|
1521
|
-
return /* @__PURE__ */
|
|
1522
|
-
|
|
1836
|
+
return /* @__PURE__ */ jsxs13(
|
|
1837
|
+
Stack13,
|
|
1523
1838
|
{
|
|
1524
1839
|
...props,
|
|
1525
1840
|
sx: {
|
|
@@ -1528,10 +1843,10 @@ var DataLakeRequestAccessButton = ({
|
|
|
1528
1843
|
...props.sx
|
|
1529
1844
|
},
|
|
1530
1845
|
children: [
|
|
1531
|
-
timedout ? /* @__PURE__ */
|
|
1532
|
-
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
|
|
1846
|
+
timedout ? /* @__PURE__ */ jsx13(Alert11, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1847
|
+
isDefinedNotNull9(client) && !supported ? /* @__PURE__ */ jsx13(Alert11, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1848
|
+
/* @__PURE__ */ jsx13(
|
|
1849
|
+
ButtonEx10,
|
|
1535
1850
|
{
|
|
1536
1851
|
variant: "contained",
|
|
1537
1852
|
size: "small",
|
|
@@ -1541,38 +1856,38 @@ var DataLakeRequestAccessButton = ({
|
|
|
1541
1856
|
children: "Request data lake access"
|
|
1542
1857
|
}
|
|
1543
1858
|
),
|
|
1544
|
-
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1859
|
+
isDefined12(granted) ? /* @__PURE__ */ jsxs13(Stack13, { sx: { gap: 0.5 }, children: [
|
|
1860
|
+
/* @__PURE__ */ jsx13(Typography12, { variant: "subtitle2", children: "Granted:" }),
|
|
1861
|
+
/* @__PURE__ */ jsxs13(Typography12, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: [
|
|
1547
1862
|
"id:",
|
|
1548
1863
|
" ",
|
|
1549
1864
|
granted.id
|
|
1550
1865
|
] }),
|
|
1551
|
-
/* @__PURE__ */
|
|
1866
|
+
/* @__PURE__ */ jsx13(Typography12, { variant: "body2", sx: { color: "text.secondary" }, children: "If you picked multiple lakes, call `list()` to enumerate all granted ids." })
|
|
1552
1867
|
] }) : null,
|
|
1553
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsx13(ErrorRender9, { error: clientError ?? requestError, scope: "DataLakeRequestAccessButton" })
|
|
1554
1869
|
]
|
|
1555
1870
|
}
|
|
1556
1871
|
);
|
|
1557
1872
|
};
|
|
1558
1873
|
|
|
1559
1874
|
// src/client/components/connected/DataLakeRequestAccessPanel.tsx
|
|
1560
|
-
import { jsx as
|
|
1561
|
-
var observationSchema =
|
|
1562
|
-
var locationSchema =
|
|
1875
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1876
|
+
var observationSchema = asSchema3("network.xyo.observation.v2", true);
|
|
1877
|
+
var locationSchema = asSchema3("network.xyo.location", true);
|
|
1563
1878
|
var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
|
|
1564
|
-
const [capability, setCapability] =
|
|
1565
|
-
const [includeSchemas, setIncludeSchemas] =
|
|
1879
|
+
const [capability, setCapability] = useState13("read+write");
|
|
1880
|
+
const [includeSchemas, setIncludeSchemas] = useState13(true);
|
|
1566
1881
|
const supportsSchemasFilter = capability !== "viewer";
|
|
1567
|
-
const options =
|
|
1882
|
+
const options = useMemo5(() => {
|
|
1568
1883
|
const cap = capability === "read+write" ? { read: true, write: true } : capability;
|
|
1569
1884
|
if (supportsSchemasFilter && includeSchemas) {
|
|
1570
1885
|
return { capability: cap, schemas: [observationSchema, locationSchema] };
|
|
1571
1886
|
}
|
|
1572
1887
|
return { capability: cap };
|
|
1573
1888
|
}, [capability, includeSchemas, supportsSchemasFilter]);
|
|
1574
|
-
return /* @__PURE__ */
|
|
1575
|
-
|
|
1889
|
+
return /* @__PURE__ */ jsxs14(
|
|
1890
|
+
Stack14,
|
|
1576
1891
|
{
|
|
1577
1892
|
...props,
|
|
1578
1893
|
sx: {
|
|
@@ -1581,26 +1896,26 @@ var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
|
|
|
1581
1896
|
...props.sx
|
|
1582
1897
|
},
|
|
1583
1898
|
children: [
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ jsxs14(FormControl2, { size: "small", fullWidth: true, children: [
|
|
1900
|
+
/* @__PURE__ */ jsx14(InputLabel2, { children: "Capability" }),
|
|
1901
|
+
/* @__PURE__ */ jsxs14(
|
|
1587
1902
|
Select2,
|
|
1588
1903
|
{
|
|
1589
1904
|
value: capability,
|
|
1590
1905
|
label: "Capability",
|
|
1591
1906
|
onChange: (event) => setCapability(event.target.value),
|
|
1592
1907
|
children: [
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsx14(MenuItem2, { value: "viewer", children: "Read only (viewer)" }),
|
|
1909
|
+
/* @__PURE__ */ jsx14(MenuItem2, { value: "runner", children: "Write only (runner)" }),
|
|
1910
|
+
/* @__PURE__ */ jsx14(MenuItem2, { value: "read+write", children: "Read + Write" })
|
|
1596
1911
|
]
|
|
1597
1912
|
}
|
|
1598
1913
|
)
|
|
1599
1914
|
] }),
|
|
1600
|
-
/* @__PURE__ */
|
|
1915
|
+
/* @__PURE__ */ jsx14(
|
|
1601
1916
|
FormControlLabel,
|
|
1602
1917
|
{
|
|
1603
|
-
control: /* @__PURE__ */
|
|
1918
|
+
control: /* @__PURE__ */ jsx14(
|
|
1604
1919
|
Checkbox,
|
|
1605
1920
|
{
|
|
1606
1921
|
checked: supportsSchemasFilter && includeSchemas,
|
|
@@ -1612,17 +1927,17 @@ var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
|
|
|
1612
1927
|
label: "Include schemas filter (observation + location)"
|
|
1613
1928
|
}
|
|
1614
1929
|
),
|
|
1615
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ jsx14(DataLakeRequestAccessButton, { options, timeout })
|
|
1616
1931
|
]
|
|
1617
1932
|
}
|
|
1618
1933
|
);
|
|
1619
1934
|
};
|
|
1620
1935
|
|
|
1621
1936
|
// src/client/components/connected/DataLakeOperationsPanel.tsx
|
|
1622
|
-
import { jsx as
|
|
1937
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1623
1938
|
var DataLakeOperationsPanel = ({ timeout, ...props }) => {
|
|
1624
|
-
return /* @__PURE__ */
|
|
1625
|
-
|
|
1939
|
+
return /* @__PURE__ */ jsxs15(
|
|
1940
|
+
Stack15,
|
|
1626
1941
|
{
|
|
1627
1942
|
...props,
|
|
1628
1943
|
sx: {
|
|
@@ -1631,24 +1946,24 @@ var DataLakeOperationsPanel = ({ timeout, ...props }) => {
|
|
|
1631
1946
|
...props.sx
|
|
1632
1947
|
},
|
|
1633
1948
|
children: [
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
1949
|
+
/* @__PURE__ */ jsxs15(Stack15, { sx: { gap: 1 }, children: [
|
|
1950
|
+
/* @__PURE__ */ jsx15(Typography13, { variant: "subtitle2", children: "Request data lake access" }),
|
|
1951
|
+
/* @__PURE__ */ jsx15(DataLakeRequestAccessPanel, { timeout })
|
|
1637
1952
|
] }),
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
/* @__PURE__ */
|
|
1953
|
+
/* @__PURE__ */ jsx15(Divider4, {}),
|
|
1954
|
+
/* @__PURE__ */ jsxs15(Stack15, { sx: { gap: 1 }, children: [
|
|
1955
|
+
/* @__PURE__ */ jsx15(Typography13, { variant: "subtitle2", children: "List approved lakes" }),
|
|
1956
|
+
/* @__PURE__ */ jsx15(DataLakeListButton, { timeout })
|
|
1642
1957
|
] }),
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1958
|
+
/* @__PURE__ */ jsx15(Divider4, {}),
|
|
1959
|
+
/* @__PURE__ */ jsxs15(Stack15, { sx: { gap: 1 }, children: [
|
|
1960
|
+
/* @__PURE__ */ jsx15(Typography13, { variant: "subtitle2", children: "Insert payloads" }),
|
|
1961
|
+
/* @__PURE__ */ jsx15(DataLakeInsertPanel, { timeout })
|
|
1647
1962
|
] }),
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1651
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ jsx15(Divider4, {}),
|
|
1964
|
+
/* @__PURE__ */ jsxs15(Stack15, { sx: { gap: 1 }, children: [
|
|
1965
|
+
/* @__PURE__ */ jsx15(Typography13, { variant: "subtitle2", children: "Get payloads by hash" }),
|
|
1966
|
+
/* @__PURE__ */ jsx15(DataLakeGetPanel, { timeout })
|
|
1652
1967
|
] })
|
|
1653
1968
|
]
|
|
1654
1969
|
}
|
|
@@ -1657,36 +1972,36 @@ var DataLakeOperationsPanel = ({ timeout, ...props }) => {
|
|
|
1657
1972
|
|
|
1658
1973
|
// src/client/components/connected/SignTransactionButton.tsx
|
|
1659
1974
|
import {
|
|
1660
|
-
Alert as
|
|
1661
|
-
Chip as
|
|
1662
|
-
Divider as
|
|
1663
|
-
Stack as
|
|
1664
|
-
Typography as
|
|
1975
|
+
Alert as Alert12,
|
|
1976
|
+
Chip as Chip4,
|
|
1977
|
+
Divider as Divider5,
|
|
1978
|
+
Stack as Stack16,
|
|
1979
|
+
Typography as Typography14
|
|
1665
1980
|
} from "@mui/material";
|
|
1666
|
-
import { ButtonEx as
|
|
1981
|
+
import { ButtonEx as ButtonEx11 } from "@xylabs/react-button";
|
|
1667
1982
|
import { PopoverErrorRender as PopoverErrorRender2 } from "@xylabs/react-error";
|
|
1668
1983
|
import {
|
|
1669
1984
|
assertEx as assertEx2,
|
|
1670
|
-
isDefined as
|
|
1671
|
-
isDefinedNotNull as
|
|
1985
|
+
isDefined as isDefined13,
|
|
1986
|
+
isDefinedNotNull as isDefinedNotNull10
|
|
1672
1987
|
} from "@xylabs/sdk-js";
|
|
1673
|
-
import { PayloadBuilder as
|
|
1988
|
+
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/sdk-js";
|
|
1674
1989
|
import {
|
|
1675
1990
|
asXL1BlockNumber,
|
|
1676
1991
|
buildUnsignedTransaction,
|
|
1677
1992
|
HashSchema as HashSchema2,
|
|
1678
|
-
SequenceNetwork as
|
|
1993
|
+
SequenceNetwork as SequenceNetwork3
|
|
1679
1994
|
} from "@xyo-network/xl1-sdk";
|
|
1680
|
-
import { useCallback as
|
|
1681
|
-
import { jsx as
|
|
1995
|
+
import { useCallback as useCallback5, useState as useState14 } from "react";
|
|
1996
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1682
1997
|
var EMPTY_PAYLOADS = [];
|
|
1683
|
-
var
|
|
1998
|
+
var SIGNER_PERMISSIONS2 = [
|
|
1684
1999
|
{ xyoWallet_getAccounts: { restrictReturnedAccounts: [] } },
|
|
1685
2000
|
{ xyoSigner_address: {} }
|
|
1686
2001
|
];
|
|
1687
2002
|
var SignTransactionButton = ({
|
|
1688
2003
|
anchorOnChain = true,
|
|
1689
|
-
gatewayName =
|
|
2004
|
+
gatewayName = SequenceNetwork3.id,
|
|
1690
2005
|
privateReferencedPayloads = EMPTY_PAYLOADS,
|
|
1691
2006
|
referencedPayloads = EMPTY_PAYLOADS,
|
|
1692
2007
|
timeout,
|
|
@@ -1697,14 +2012,14 @@ var SignTransactionButton = ({
|
|
|
1697
2012
|
error: gatewayError,
|
|
1698
2013
|
timedout
|
|
1699
2014
|
} = useGatewayFromWallet(gatewayName, timeout);
|
|
1700
|
-
const [signing, setSigning] =
|
|
1701
|
-
const [signError, setSignError] =
|
|
1702
|
-
const [signedHash, setSignedHash] =
|
|
2015
|
+
const [signing, setSigning] = useState14(false);
|
|
2016
|
+
const [signError, setSignError] = useState14();
|
|
2017
|
+
const [signedHash, setSignedHash] = useState14();
|
|
1703
2018
|
const signer = gateway?.signer;
|
|
1704
2019
|
const viewer = gateway?.connection?.viewer;
|
|
1705
|
-
const canSign =
|
|
1706
|
-
const handleSign =
|
|
1707
|
-
if (!
|
|
2020
|
+
const canSign = isDefinedNotNull10(signer) && isDefinedNotNull10(viewer) && !signing;
|
|
2021
|
+
const handleSign = useCallback5(async () => {
|
|
2022
|
+
if (!isDefinedNotNull10(gateway)) return;
|
|
1708
2023
|
const resolvedSigner = assertEx2(gateway.signer, () => "No signer available on gateway");
|
|
1709
2024
|
const resolvedViewer = assertEx2(gateway.connection?.viewer, () => "No viewer available on gateway connection");
|
|
1710
2025
|
setSignError(void 0);
|
|
@@ -1715,8 +2030,8 @@ var SignTransactionButton = ({
|
|
|
1715
2030
|
const nbf = asXL1BlockNumber(await resolvedViewer.currentBlockNumber(), true);
|
|
1716
2031
|
const exp = asXL1BlockNumber(nbf + 10, true);
|
|
1717
2032
|
const from = await resolvedSigner.address();
|
|
1718
|
-
const referencedHashes = await
|
|
1719
|
-
const onChainPayloads = anchorOnChain &&
|
|
2033
|
+
const referencedHashes = await PayloadBuilder3.hashes(referencedPayloads);
|
|
2034
|
+
const onChainPayloads = anchorOnChain && isDefined13(referencedHashes[0]) ? [{ schema: HashSchema2, hash: referencedHashes[0] }] : [];
|
|
1720
2035
|
let tx = await buildUnsignedTransaction(
|
|
1721
2036
|
chain,
|
|
1722
2037
|
onChainPayloads,
|
|
@@ -1726,7 +2041,7 @@ var SignTransactionButton = ({
|
|
|
1726
2041
|
from
|
|
1727
2042
|
);
|
|
1728
2043
|
if (privateReferencedPayloads.length > 0) {
|
|
1729
|
-
const privateHashes = await
|
|
2044
|
+
const privateHashes = await PayloadBuilder3.hashes(privateReferencedPayloads);
|
|
1730
2045
|
const [bw, payloads] = tx;
|
|
1731
2046
|
tx = [
|
|
1732
2047
|
{
|
|
@@ -1738,15 +2053,15 @@ var SignTransactionButton = ({
|
|
|
1738
2053
|
];
|
|
1739
2054
|
}
|
|
1740
2055
|
const [signedBoundWitness] = await resolvedSigner.signTransaction(tx);
|
|
1741
|
-
setSignedHash(await
|
|
2056
|
+
setSignedHash(await PayloadBuilder3.hash(signedBoundWitness));
|
|
1742
2057
|
} catch (e) {
|
|
1743
2058
|
setSignError(e);
|
|
1744
2059
|
} finally {
|
|
1745
2060
|
setSigning(false);
|
|
1746
2061
|
}
|
|
1747
2062
|
}, [anchorOnChain, gateway, privateReferencedPayloads, referencedPayloads]);
|
|
1748
|
-
return /* @__PURE__ */
|
|
1749
|
-
|
|
2063
|
+
return /* @__PURE__ */ jsxs16(
|
|
2064
|
+
Stack16,
|
|
1750
2065
|
{
|
|
1751
2066
|
...props,
|
|
1752
2067
|
sx: {
|
|
@@ -1755,15 +2070,15 @@ var SignTransactionButton = ({
|
|
|
1755
2070
|
...props.sx
|
|
1756
2071
|
},
|
|
1757
2072
|
children: [
|
|
1758
|
-
timedout ? /* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
/* @__PURE__ */
|
|
1761
|
-
/* @__PURE__ */
|
|
2073
|
+
timedout ? /* @__PURE__ */ jsx16(Alert12, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
2074
|
+
/* @__PURE__ */ jsxs16(Stack16, { sx: { gap: 1 }, children: [
|
|
2075
|
+
/* @__PURE__ */ jsx16(Typography14, { variant: "subtitle2", children: "1. Grant signer + account access" }),
|
|
2076
|
+
/* @__PURE__ */ jsx16(RequestPermissionsButton, { permissions: SIGNER_PERMISSIONS2, timeout })
|
|
1762
2077
|
] }),
|
|
1763
|
-
/* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
2078
|
+
/* @__PURE__ */ jsx16(Divider5, {}),
|
|
2079
|
+
/* @__PURE__ */ jsxs16(Stack16, { sx: { gap: 1, alignItems: "start" }, children: [
|
|
2080
|
+
/* @__PURE__ */ jsx16(Typography14, { variant: "subtitle2", children: "2. Sign the transaction" }),
|
|
2081
|
+
/* @__PURE__ */ jsxs16(Typography14, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
1767
2082
|
"Opens the wallet's Sign page with",
|
|
1768
2083
|
" ",
|
|
1769
2084
|
anchorOnChain ? "1 on-chain anchor, " : "no on-chain payloads, ",
|
|
@@ -1777,9 +2092,9 @@ var SignTransactionButton = ({
|
|
|
1777
2092
|
privateReferencedPayloads.length === 1 ? "" : "s",
|
|
1778
2093
|
". The signed transaction is returned here and not broadcast."
|
|
1779
2094
|
] }),
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1782
|
-
|
|
2095
|
+
/* @__PURE__ */ jsxs16(Stack16, { direction: "row", sx: { gap: 1, alignItems: "center" }, children: [
|
|
2096
|
+
/* @__PURE__ */ jsx16(
|
|
2097
|
+
ButtonEx11,
|
|
1783
2098
|
{
|
|
1784
2099
|
variant: "contained",
|
|
1785
2100
|
size: "small",
|
|
@@ -1789,10 +2104,10 @@ var SignTransactionButton = ({
|
|
|
1789
2104
|
children: "Sign transaction"
|
|
1790
2105
|
}
|
|
1791
2106
|
),
|
|
1792
|
-
/* @__PURE__ */
|
|
2107
|
+
/* @__PURE__ */ jsx16(PopoverErrorRender2, { error: gatewayError ?? signError, scope: "SignTransactionButton" })
|
|
1793
2108
|
] }),
|
|
1794
|
-
|
|
1795
|
-
|
|
2109
|
+
isDefined13(signedHash) ? /* @__PURE__ */ jsxs16(
|
|
2110
|
+
Stack16,
|
|
1796
2111
|
{
|
|
1797
2112
|
direction: "row",
|
|
1798
2113
|
sx: {
|
|
@@ -1801,8 +2116,8 @@ var SignTransactionButton = ({
|
|
|
1801
2116
|
gap: 1
|
|
1802
2117
|
},
|
|
1803
2118
|
children: [
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsx16(Chip4, { label: "Signed", size: "small", color: "success" }),
|
|
2120
|
+
/* @__PURE__ */ jsx16(Typography14, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: signedHash })
|
|
1806
2121
|
]
|
|
1807
2122
|
}
|
|
1808
2123
|
) : null
|
|
@@ -1824,14 +2139,14 @@ var InPageGatewaysContext = createContextEx2();
|
|
|
1824
2139
|
import { DefaultNetworks as DefaultNetworks2 } from "@xyo-network/xl1-sdk";
|
|
1825
2140
|
import {
|
|
1826
2141
|
startTransition,
|
|
1827
|
-
useCallback as
|
|
2142
|
+
useCallback as useCallback6,
|
|
1828
2143
|
useEffect as useEffect5,
|
|
1829
|
-
useMemo as
|
|
1830
|
-
useState as
|
|
2144
|
+
useMemo as useMemo6,
|
|
2145
|
+
useState as useState15
|
|
1831
2146
|
} from "react";
|
|
1832
2147
|
|
|
1833
2148
|
// src/client/context/in-page/lib/buildGateway.ts
|
|
1834
|
-
import { assertEx as assertEx3, isDefined as
|
|
2149
|
+
import { assertEx as assertEx3, isDefined as isDefined14 } from "@xylabs/sdk-js";
|
|
1835
2150
|
import {
|
|
1836
2151
|
basicRemoteRunnerLocator,
|
|
1837
2152
|
basicRemoteViewerLocator,
|
|
@@ -1847,17 +2162,17 @@ var buildGateway = async (gatewayName, signerTransport) => {
|
|
|
1847
2162
|
url: `${resolvedNetwork.url}/rpc`
|
|
1848
2163
|
}
|
|
1849
2164
|
};
|
|
1850
|
-
const locator =
|
|
2165
|
+
const locator = isDefined14(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport) : await basicRemoteViewerLocator(gatewayName, remoteConfig);
|
|
1851
2166
|
return await locator.getInstance(XyoGatewayMoniker);
|
|
1852
2167
|
};
|
|
1853
2168
|
|
|
1854
2169
|
// src/client/context/in-page/Provider.tsx
|
|
1855
|
-
import { jsx as
|
|
2170
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1856
2171
|
var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
1857
|
-
const [gateways, setGateways] =
|
|
1858
|
-
const [errors, setErrors] =
|
|
1859
|
-
const [previousSignerTransport, setPreviousSignerTransport] =
|
|
1860
|
-
const clearAll =
|
|
2172
|
+
const [gateways, setGateways] = useState15({});
|
|
2173
|
+
const [errors, setErrors] = useState15({});
|
|
2174
|
+
const [previousSignerTransport, setPreviousSignerTransport] = useState15(signerTransport);
|
|
2175
|
+
const clearAll = useCallback6(() => {
|
|
1861
2176
|
setGateways({});
|
|
1862
2177
|
setErrors({});
|
|
1863
2178
|
}, []);
|
|
@@ -1895,7 +2210,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
|
1895
2210
|
cancelled = true;
|
|
1896
2211
|
};
|
|
1897
2212
|
}, [signerTransport]);
|
|
1898
|
-
const value =
|
|
2213
|
+
const value = useMemo6(() => {
|
|
1899
2214
|
const value2 = {
|
|
1900
2215
|
clearAll,
|
|
1901
2216
|
errors,
|
|
@@ -1904,7 +2219,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
|
1904
2219
|
};
|
|
1905
2220
|
return value2;
|
|
1906
2221
|
}, [clearAll, errors, gateways]);
|
|
1907
|
-
return /* @__PURE__ */
|
|
2222
|
+
return /* @__PURE__ */ jsx17(InPageGatewaysContext, { value, children });
|
|
1908
2223
|
};
|
|
1909
2224
|
|
|
1910
2225
|
// src/client/context/in-page/useProvidedInPageGateways.ts
|
|
@@ -1912,10 +2227,10 @@ import { useContextEx } from "@xylabs/react-shared";
|
|
|
1912
2227
|
var useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required);
|
|
1913
2228
|
|
|
1914
2229
|
// src/client/context/providers/GatewayProvider.tsx
|
|
1915
|
-
import { ErrorRender as
|
|
1916
|
-
import { isDefinedNotNull as
|
|
1917
|
-
import { useMemo as
|
|
1918
|
-
import { jsx as
|
|
2230
|
+
import { ErrorRender as ErrorRender10 } from "@xylabs/react-error";
|
|
2231
|
+
import { isDefinedNotNull as isDefinedNotNull11, isNull as isNull2 } from "@xylabs/sdk-js";
|
|
2232
|
+
import { useMemo as useMemo7 } from "react";
|
|
2233
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1919
2234
|
var GatewayProvider = ({ gatewayName, children }) => {
|
|
1920
2235
|
const {
|
|
1921
2236
|
gateway: gatewayFromWallet,
|
|
@@ -1928,7 +2243,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
1928
2243
|
} = useProvidedInPageGateways(true);
|
|
1929
2244
|
const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : void 0;
|
|
1930
2245
|
const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : void 0;
|
|
1931
|
-
const { defaultGateway, gateways } =
|
|
2246
|
+
const { defaultGateway, gateways } = useMemo7(() => {
|
|
1932
2247
|
if (isNull2(gatewayFromWallet)) {
|
|
1933
2248
|
return {
|
|
1934
2249
|
defaultGateway: gatewayFromConfig,
|
|
@@ -1937,7 +2252,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
1937
2252
|
walletGateway: null
|
|
1938
2253
|
}
|
|
1939
2254
|
};
|
|
1940
|
-
} else if (
|
|
2255
|
+
} else if (isDefinedNotNull11(gatewayFromWallet)) {
|
|
1941
2256
|
return {
|
|
1942
2257
|
defaultGateway: gatewayFromWallet,
|
|
1943
2258
|
gateways: {
|
|
@@ -1954,7 +2269,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
1954
2269
|
}
|
|
1955
2270
|
};
|
|
1956
2271
|
}, [gatewayFromConfig, gatewayFromWallet]);
|
|
1957
|
-
const value =
|
|
2272
|
+
const value = useMemo7(() => {
|
|
1958
2273
|
const value2 = {
|
|
1959
2274
|
defaultGateway,
|
|
1960
2275
|
error: gatewayFromWalletError ?? gatewayFromConfigError,
|
|
@@ -1970,22 +2285,22 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
1970
2285
|
gateways,
|
|
1971
2286
|
clearAll
|
|
1972
2287
|
]);
|
|
1973
|
-
return /* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
2288
|
+
return /* @__PURE__ */ jsxs17(GatewayContext, { value, children: [
|
|
2289
|
+
/* @__PURE__ */ jsx18(ErrorRender10, { error: gatewayFromConfigError }),
|
|
1975
2290
|
children
|
|
1976
2291
|
] });
|
|
1977
2292
|
};
|
|
1978
2293
|
|
|
1979
2294
|
// src/client/context/providers/WalletGatewayProvider.tsx
|
|
1980
|
-
import { ErrorRender as
|
|
1981
|
-
import { useMemo as
|
|
1982
|
-
import { jsx as
|
|
2295
|
+
import { ErrorRender as ErrorRender11 } from "@xylabs/react-error";
|
|
2296
|
+
import { useMemo as useMemo8 } from "react";
|
|
2297
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1983
2298
|
var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
1984
2299
|
const {
|
|
1985
2300
|
gateway: gatewayFromWallet,
|
|
1986
2301
|
error: gatewayFromWalletError
|
|
1987
2302
|
} = useGatewayFromWallet(gatewayName);
|
|
1988
|
-
const { defaultGateway, gateways } =
|
|
2303
|
+
const { defaultGateway, gateways } = useMemo8(() => {
|
|
1989
2304
|
return {
|
|
1990
2305
|
defaultGateway: gatewayFromWallet,
|
|
1991
2306
|
gateways: {
|
|
@@ -1994,7 +2309,7 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
|
1994
2309
|
}
|
|
1995
2310
|
};
|
|
1996
2311
|
}, [gatewayFromWallet]);
|
|
1997
|
-
const value =
|
|
2312
|
+
const value = useMemo8(() => {
|
|
1998
2313
|
const value2 = {
|
|
1999
2314
|
defaultGateway,
|
|
2000
2315
|
error: gatewayFromWalletError,
|
|
@@ -2007,8 +2322,8 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
|
2007
2322
|
gatewayFromWalletError,
|
|
2008
2323
|
gateways
|
|
2009
2324
|
]);
|
|
2010
|
-
return /* @__PURE__ */
|
|
2011
|
-
/* @__PURE__ */
|
|
2325
|
+
return /* @__PURE__ */ jsxs18(GatewayContext, { value, children: [
|
|
2326
|
+
/* @__PURE__ */ jsx19(ErrorRender11, { error: gatewayFromWalletError }),
|
|
2012
2327
|
children
|
|
2013
2328
|
] });
|
|
2014
2329
|
};
|
|
@@ -2018,6 +2333,7 @@ import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
|
2018
2333
|
var useProvidedGateway = (required = true) => useContextEx2(GatewayContext, "Gateway", required);
|
|
2019
2334
|
export {
|
|
2020
2335
|
ApprovedLakeSelector,
|
|
2336
|
+
AutoSignChainPanel,
|
|
2021
2337
|
ConnectAccountsStack,
|
|
2022
2338
|
ConnectedAccount,
|
|
2023
2339
|
DataLakeAddToChainPanel,
|