@xyo-network/xl1-react-client-sdk 2.0.0 → 2.0.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.
@@ -457,17 +457,600 @@ var ConnectAccountsStack = ({
457
457
  );
458
458
  };
459
459
 
460
- // src/client/components/connected/DataLakeGetButton.tsx
460
+ // src/client/components/connected/DataLakeAddToChainPanel.tsx
461
+ import { OpenInNew } from "@mui/icons-material";
462
+ import {
463
+ Alert as Alert5,
464
+ Chip as Chip2,
465
+ Divider as Divider2,
466
+ Link,
467
+ Stack as Stack6,
468
+ TextField,
469
+ Typography as Typography5
470
+ } from "@mui/material";
471
+ import { ButtonEx as ButtonEx5 } from "@xylabs/react-button";
472
+ import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
473
+ import { usePromise as usePromise2 } from "@xylabs/react-promise";
474
+ import { isDefined as isDefined7, isDefinedNotNull as isDefinedNotNull4 } from "@xylabs/sdk-js";
475
+ import {
476
+ asSchema,
477
+ isAnyPayload,
478
+ PayloadBuilder
479
+ } from "@xyo-network/sdk-js";
480
+ import {
481
+ DataLakesGetMethod,
482
+ DataLakesInsertMethod,
483
+ ExplorerLinks,
484
+ HashSchema,
485
+ SequenceNetwork
486
+ } from "@xyo-network/xl1-sdk";
487
+ import { useMemo, useState as useState5 } from "react";
488
+
489
+ // src/client/components/connected/RequestPermissionsButton.tsx
490
+ import { Alert as Alert4, Stack as Stack5 } from "@mui/material";
491
+ import { ButtonEx as ButtonEx4 } from "@xylabs/react-button";
492
+ import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
493
+ import { isDefined as isDefined6, isDefinedNotNull as isDefinedNotNull3 } from "@xylabs/sdk-js";
494
+ import {
495
+ useCallback as useCallback3,
496
+ useEffect as useEffect4,
497
+ useState as useState4
498
+ } from "react";
499
+
500
+ // src/client/components/connected/PermissionsReviewDialog.tsx
461
501
  import {
462
502
  Alert as Alert3,
503
+ Box,
504
+ Chip,
505
+ Dialog,
506
+ DialogActions,
507
+ DialogContent,
508
+ DialogTitle,
509
+ Divider,
463
510
  Stack as Stack4,
464
511
  Typography as Typography4
465
512
  } from "@mui/material";
466
513
  import { ButtonEx as ButtonEx3 } from "@xylabs/react-button";
467
514
  import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
468
- import { isDefined as isDefined5, isDefinedNotNull as isDefinedNotNull3 } from "@xylabs/sdk-js";
469
- import { useState as useState4 } from "react";
515
+ import { isDefined as isDefined5 } from "@xylabs/sdk-js";
516
+ import React3 from "react";
470
517
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
518
+ var renderCaveatValue = (caveat) => {
519
+ if (caveat.type === "restrictReturnedAccounts" && Array.isArray(caveat.value)) {
520
+ if (caveat.value.length === 0) {
521
+ return /* @__PURE__ */ jsx4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: "(no address restriction \u2014 every selected account is returned)" });
522
+ }
523
+ return /* @__PURE__ */ jsx4(Stack4, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 }, children: caveat.value.map((address) => /* @__PURE__ */ jsx4(
524
+ Chip,
525
+ {
526
+ label: String(address),
527
+ size: "small",
528
+ sx: { fontFamily: "monospace" }
529
+ },
530
+ String(address)
531
+ )) });
532
+ }
533
+ if (caveat.type === "dataLakeAccess" && typeof caveat.value === "object" && caveat.value !== null) {
534
+ const value = caveat.value;
535
+ return /* @__PURE__ */ jsxs4(Stack4, { sx: { gap: 0.5 }, children: [
536
+ isDefined5(value.perOriginId) ? /* @__PURE__ */ jsxs4(Stack4, { direction: "row", sx: { alignItems: "center", gap: 1 }, children: [
537
+ /* @__PURE__ */ jsx4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: "id:" }),
538
+ /* @__PURE__ */ jsx4(Typography4, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: value.perOriginId })
539
+ ] }) : null,
540
+ isDefined5(value.narrowedSchemas) && value.narrowedSchemas.length > 0 ? /* @__PURE__ */ jsxs4(
541
+ Stack4,
542
+ {
543
+ direction: "row",
544
+ sx: {
545
+ alignItems: "center",
546
+ flexWrap: "wrap",
547
+ gap: 0.5
548
+ },
549
+ children: [
550
+ /* @__PURE__ */ jsx4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: "schemas:" }),
551
+ value.narrowedSchemas.map((schema) => /* @__PURE__ */ jsx4(
552
+ Chip,
553
+ {
554
+ label: schema,
555
+ size: "small",
556
+ variant: "outlined"
557
+ },
558
+ schema
559
+ ))
560
+ ]
561
+ }
562
+ ) : null
563
+ ] });
564
+ }
565
+ return /* @__PURE__ */ jsx4(
566
+ Typography4,
567
+ {
568
+ component: "pre",
569
+ variant: "body2",
570
+ sx: {
571
+ fontFamily: "monospace",
572
+ m: 0,
573
+ whiteSpace: "pre-wrap",
574
+ wordBreak: "break-all"
575
+ },
576
+ children: JSON.stringify(caveat.value, null, 2)
577
+ }
578
+ );
579
+ };
580
+ var renderPermission = (permission) => {
581
+ const caveats = permission.caveats ?? [];
582
+ return /* @__PURE__ */ jsxs4(Stack4, { sx: { gap: 1 }, children: [
583
+ /* @__PURE__ */ jsxs4(
584
+ Stack4,
585
+ {
586
+ direction: "row",
587
+ sx: {
588
+ alignItems: "center",
589
+ flexWrap: "wrap",
590
+ gap: 1
591
+ },
592
+ children: [
593
+ /* @__PURE__ */ jsx4(Typography4, { variant: "subtitle2", sx: { fontFamily: "monospace" }, children: permission.parentCapability }),
594
+ isDefined5(permission.date) ? /* @__PURE__ */ jsxs4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: [
595
+ "granted",
596
+ " ",
597
+ new Date(permission.date).toLocaleString()
598
+ ] }) : null
599
+ ]
600
+ }
601
+ ),
602
+ caveats.length === 0 ? /* @__PURE__ */ jsx4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: "(no caveats)" }) : /* @__PURE__ */ jsx4(Stack4, { sx: { gap: 1, pl: 1 }, children: caveats.map((caveat) => /* @__PURE__ */ jsxs4(Stack4, { sx: { gap: 0.5 }, children: [
603
+ /* @__PURE__ */ jsx4(Chip, { label: caveat.type, size: "small", sx: { alignSelf: "flex-start" } }),
604
+ /* @__PURE__ */ jsx4(Box, { sx: { pl: 1 }, children: renderCaveatValue(caveat) })
605
+ ] }, caveat.type)) })
606
+ ] });
607
+ };
608
+ var PermissionsReviewDialog = ({
609
+ granted,
610
+ onClose,
611
+ onReRequest,
612
+ open,
613
+ requesting,
614
+ error
615
+ }) => {
616
+ return /* @__PURE__ */ jsxs4(Dialog, { open, onClose, fullWidth: true, maxWidth: "sm", children: [
617
+ /* @__PURE__ */ jsx4(DialogTitle, { children: "Granted permissions" }),
618
+ /* @__PURE__ */ jsx4(DialogContent, { dividers: true, children: /* @__PURE__ */ jsxs4(Stack4, { sx: { gap: 2 }, children: [
619
+ granted.length === 0 ? /* @__PURE__ */ jsx4(Alert3, { severity: "info", children: "No permissions are currently granted to this origin." }) : granted.map((permission, index) => /* @__PURE__ */ jsxs4(React3.Fragment, { children: [
620
+ index > 0 ? /* @__PURE__ */ jsx4(Divider, {}) : null,
621
+ renderPermission(permission)
622
+ ] }, permission.parentCapability)),
623
+ /* @__PURE__ */ jsx4(ErrorRender3, { error, scope: "PermissionsReviewDialog" })
624
+ ] }) }),
625
+ /* @__PURE__ */ jsxs4(DialogActions, { children: [
626
+ /* @__PURE__ */ jsx4(ButtonEx3, { variant: "text", size: "small", onClick: onClose, children: "Close" }),
627
+ /* @__PURE__ */ jsx4(
628
+ ButtonEx3,
629
+ {
630
+ variant: "contained",
631
+ size: "small",
632
+ disabled: requesting,
633
+ busy: requesting,
634
+ onClick: onReRequest,
635
+ children: "Re-request permissions"
636
+ }
637
+ )
638
+ ] })
639
+ ] });
640
+ };
641
+
642
+ // src/client/components/connected/RequestPermissionsButton.tsx
643
+ import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
644
+ var RequestPermissionsButton = ({
645
+ permissions,
646
+ timeout,
647
+ ...props
648
+ }) => {
649
+ const {
650
+ client,
651
+ error: clientError,
652
+ isLoading,
653
+ timedout
654
+ } = useClientFromWallet(timeout);
655
+ const [granted, setGranted] = useState4();
656
+ const [fetchError, setFetchError] = useState4();
657
+ const [requestError, setRequestError] = useState4();
658
+ const [requesting, setRequesting] = useState4(false);
659
+ const [dialogOpen, setDialogOpen] = useState4(false);
660
+ const permissionsApi = client?.permissions;
661
+ const refreshGranted = useCallback3(async () => {
662
+ if (!isDefinedNotNull3(permissionsApi)) return;
663
+ setFetchError(void 0);
664
+ try {
665
+ const result = await permissionsApi.getPermissions();
666
+ setGranted(result ?? []);
667
+ } catch (e) {
668
+ setGranted([]);
669
+ setFetchError(e);
670
+ }
671
+ }, [permissionsApi]);
672
+ useEffect4(() => {
673
+ if (isDefinedNotNull3(permissionsApi) && granted === void 0) {
674
+ void refreshGranted();
675
+ }
676
+ }, [permissionsApi, granted, refreshGranted]);
677
+ const requestPermissions = useCallback3(async () => {
678
+ if (!isDefinedNotNull3(permissionsApi)) return;
679
+ setRequestError(void 0);
680
+ setRequesting(true);
681
+ try {
682
+ await permissionsApi.requestPermissions(permissions);
683
+ void refreshGranted();
684
+ } catch (e) {
685
+ setRequestError(e);
686
+ } finally {
687
+ setRequesting(false);
688
+ }
689
+ }, [permissionsApi, permissions, refreshGranted]);
690
+ const hasGranted = isDefined6(granted) && granted.length > 0;
691
+ const handleClick = () => {
692
+ if (hasGranted) {
693
+ setDialogOpen(true);
694
+ return;
695
+ }
696
+ void requestPermissions();
697
+ };
698
+ return /* @__PURE__ */ jsxs5(
699
+ Stack5,
700
+ {
701
+ ...props,
702
+ sx: {
703
+ gap: 2,
704
+ alignItems: "start",
705
+ ...props.sx
706
+ },
707
+ children: [
708
+ timedout ? /* @__PURE__ */ jsx5(Alert4, { severity: "warning", children: "Wallet not detected." }) : null,
709
+ /* @__PURE__ */ jsx5(
710
+ ButtonEx4,
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(ErrorRender4, { error: clientError ?? fetchError ?? requestError, scope: "RequestPermissionsButton" }),
728
+ /* @__PURE__ */ jsx5(
729
+ PermissionsReviewDialog,
730
+ {
731
+ open: dialogOpen,
732
+ onClose: () => setDialogOpen(false),
733
+ granted: granted ?? [],
734
+ onReRequest: () => void requestPermissions(),
735
+ requesting,
736
+ error: requestError
737
+ }
738
+ )
739
+ ]
740
+ }
741
+ );
742
+ };
743
+
744
+ // src/client/components/connected/DataLakeAddToChainPanel.tsx
745
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
746
+ var DEFAULT_EXPLORER_URL = "https://explore.xyo.network";
747
+ var DEFAULT_PAYLOAD_SCHEMA = asSchema("network.xyo.observation.v2", true);
748
+ var PANEL_PERMISSIONS = [
749
+ { xyoWallet_getAccounts: { restrictReturnedAccounts: [] } },
750
+ { xyoSigner_address: {} },
751
+ { [DataLakesGetMethod]: { dataLakeAccess: {} } },
752
+ { [DataLakesInsertMethod]: { dataLakeAccess: {} } }
753
+ ];
754
+ async function buildDefaultPayload(schema) {
755
+ const builder = new PayloadBuilder({ schema }).fields({ value: 1 });
756
+ const payload = builder.build();
757
+ return JSON.stringify(payload, null, 2);
758
+ }
759
+ function parsePayload(raw) {
760
+ const trimmed = raw.trim();
761
+ if (trimmed.length === 0) return { ok: false, error: "Payload is empty." };
762
+ try {
763
+ const parsed = JSON.parse(trimmed);
764
+ if (Array.isArray(parsed)) {
765
+ if (parsed.length === 1) return { ok: true, payload: parsed[0] };
766
+ return { ok: false, error: "Provide a single payload object (this flow chains one payload onto the chain at a time)." };
767
+ }
768
+ if (parsed !== null && typeof parsed === "object") return { ok: true, payload: parsed };
769
+ return { ok: false, error: "Payload must be a JSON object." };
770
+ } catch (e) {
771
+ return { ok: false, error: `Invalid JSON: ${e.message}` };
772
+ }
773
+ }
774
+ var TestPayloadSection = ({
775
+ onChange,
776
+ parse,
777
+ value
778
+ }) => /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 1 }, children: [
779
+ /* @__PURE__ */ jsx6(Typography5, { variant: "subtitle2", children: "2. Test payload" }),
780
+ /* @__PURE__ */ jsx6(
781
+ TextField,
782
+ {
783
+ label: "Payload (single JSON object)",
784
+ value,
785
+ onChange: (e) => onChange(e.target.value),
786
+ multiline: true,
787
+ minRows: 6,
788
+ maxRows: 16,
789
+ size: "small",
790
+ slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
791
+ }
792
+ ),
793
+ parse.ok ? /* @__PURE__ */ jsxs6(Typography5, { variant: "caption", sx: { color: "text.secondary" }, children: [
794
+ "Parsed payload \u2014 schema:",
795
+ " ",
796
+ /* @__PURE__ */ jsx6("code", { children: parse.payload.schema ?? "(none)" })
797
+ ] }) : /* @__PURE__ */ jsx6(Alert5, { severity: "error", variant: "outlined", children: /* @__PURE__ */ jsx6(Typography5, { variant: "body2", children: parse.error }) })
798
+ ] });
799
+ var InsertSection = ({
800
+ canInsert,
801
+ inserting,
802
+ insertError,
803
+ onInsert,
804
+ onLakeChange,
805
+ selectedLakeId,
806
+ storedHash,
807
+ timeout
808
+ }) => /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 1 }, children: [
809
+ /* @__PURE__ */ jsx6(Typography5, { variant: "subtitle2", children: "3. Insert into runner lake" }),
810
+ /* @__PURE__ */ jsx6(
811
+ ApprovedLakeSelector,
812
+ {
813
+ capability: "runner",
814
+ selectedId: selectedLakeId,
815
+ onChange: onLakeChange,
816
+ timeout
817
+ }
818
+ ),
819
+ /* @__PURE__ */ jsx6(
820
+ ButtonEx5,
821
+ {
822
+ variant: "contained",
823
+ size: "small",
824
+ disabled: !canInsert,
825
+ busy: inserting,
826
+ onClick: onInsert,
827
+ children: "Insert into lake"
828
+ }
829
+ ),
830
+ isDefined7(storedHash) ? /* @__PURE__ */ jsxs6(
831
+ Stack6,
832
+ {
833
+ direction: "row",
834
+ sx: {
835
+ alignItems: "center",
836
+ flexWrap: "wrap",
837
+ gap: 1
838
+ },
839
+ children: [
840
+ /* @__PURE__ */ jsx6(Chip2, { label: "Stored", size: "small", color: "success" }),
841
+ /* @__PURE__ */ jsx6(Typography5, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: storedHash })
842
+ ]
843
+ }
844
+ ) : null,
845
+ /* @__PURE__ */ jsx6(ErrorRender5, { error: insertError, scope: "DataLakeAddToChainPanel.insert" })
846
+ ] });
847
+ var AddToChainSection = ({
848
+ addingToChain,
849
+ canAddToChain,
850
+ chainError,
851
+ explorerTxUrl,
852
+ gatewayName,
853
+ onAddToChain,
854
+ signedTx,
855
+ txHash
856
+ }) => /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 1 }, children: [
857
+ /* @__PURE__ */ jsx6(Typography5, { variant: "subtitle2", children: "4. Add HashPayload to chain" }),
858
+ /* @__PURE__ */ jsxs6(Typography5, { variant: "caption", sx: { color: "text.secondary" }, children: [
859
+ "References the lake-stored payload via",
860
+ " ",
861
+ /* @__PURE__ */ jsx6("code", { children: "network.xyo.hash" }),
862
+ "; the payload itself rides along as the `offChain` argument."
863
+ ] }),
864
+ /* @__PURE__ */ jsx6(
865
+ ButtonEx5,
866
+ {
867
+ variant: "contained",
868
+ size: "small",
869
+ disabled: !canAddToChain,
870
+ busy: addingToChain,
871
+ onClick: onAddToChain,
872
+ children: "Add to chain"
873
+ }
874
+ ),
875
+ isDefined7(txHash) && isDefined7(explorerTxUrl) ? /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 0.5 }, children: [
876
+ /* @__PURE__ */ jsxs6(
877
+ Stack6,
878
+ {
879
+ direction: "row",
880
+ sx: {
881
+ alignItems: "center",
882
+ flexWrap: "wrap",
883
+ gap: 1
884
+ },
885
+ children: [
886
+ /* @__PURE__ */ jsx6(Chip2, { label: "Submitted", size: "small", color: "success" }),
887
+ /* @__PURE__ */ jsx6(Typography5, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: txHash })
888
+ ]
889
+ }
890
+ ),
891
+ /* @__PURE__ */ jsxs6(
892
+ Link,
893
+ {
894
+ href: explorerTxUrl,
895
+ target: "_blank",
896
+ rel: "noopener noreferrer",
897
+ sx: {
898
+ alignItems: "center",
899
+ display: "inline-flex",
900
+ gap: 0.5
901
+ },
902
+ children: [
903
+ "View on explorer",
904
+ /* @__PURE__ */ jsx6(OpenInNew, { sx: { fontSize: 14 } })
905
+ ]
906
+ }
907
+ ),
908
+ isDefined7(signedTx) ? /* @__PURE__ */ jsxs6(Typography5, { variant: "caption", sx: { color: "text.secondary" }, children: [
909
+ "Signed transaction recorded \u2014 open the explorer link above to verify inclusion on",
910
+ " ",
911
+ /* @__PURE__ */ jsx6("code", { children: gatewayName }),
912
+ "."
913
+ ] }) : null
914
+ ] }) : null,
915
+ /* @__PURE__ */ jsx6(ErrorRender5, { error: chainError, scope: "DataLakeAddToChainPanel.addToChain" })
916
+ ] });
917
+ var DataLakeAddToChainPanel = ({
918
+ explorerUrl = DEFAULT_EXPLORER_URL,
919
+ gatewayName = SequenceNetwork.id,
920
+ initialPayloadJson,
921
+ payloadSchema = DEFAULT_PAYLOAD_SCHEMA,
922
+ timeout,
923
+ ...props
924
+ }) => {
925
+ const { client, error: clientError } = useClientFromWallet(timeout);
926
+ const {
927
+ gateway,
928
+ error: gatewayError,
929
+ timedout
930
+ } = useGatewayFromWallet(gatewayName, timeout);
931
+ const [payloadText, setPayloadText] = useState5(initialPayloadJson ?? "");
932
+ usePromise2(async () => setPayloadText(await buildDefaultPayload(payloadSchema)), [payloadSchema]);
933
+ const parse = useMemo(() => parsePayload(payloadText), [payloadText]);
934
+ const [selectedLakeId, setSelectedLakeId] = useState5("");
935
+ const [storedPayload, setStoredPayload] = useState5();
936
+ const [inserting, setInserting] = useState5(false);
937
+ const [insertError, setInsertError] = useState5();
938
+ const [txHash, setTxHash] = useState5();
939
+ const [signedTx, setSignedTx] = useState5();
940
+ const [addingToChain, setAddingToChain] = useState5(false);
941
+ const [chainError, setChainError] = useState5();
942
+ const dataLakes = client?.dataLakes;
943
+ const [storedHash] = usePromise2(async () => isDefined7(storedPayload) ? await PayloadBuilder.dataHash(storedPayload) : void 0, [storedPayload]);
944
+ const canInsert = parse.ok && selectedLakeId.length > 0 && isDefinedNotNull4(dataLakes) && !inserting;
945
+ const canAddToChain = isDefined7(storedHash) && isDefined7(storedPayload) && isDefinedNotNull4(gateway) && !addingToChain;
946
+ const explorerTxUrl = useMemo(() => {
947
+ if (!isDefined7(txHash)) return;
948
+ return new ExplorerLinks(explorerUrl, gatewayName).transaction(txHash);
949
+ }, [txHash, explorerUrl, gatewayName]);
950
+ const handleInsert = async () => {
951
+ if (!canInsert || !parse.ok || !isDefinedNotNull4(dataLakes)) return;
952
+ setInsertError(void 0);
953
+ setStoredPayload(void 0);
954
+ setTxHash(void 0);
955
+ setSignedTx(void 0);
956
+ setChainError(void 0);
957
+ setInserting(true);
958
+ try {
959
+ const [stored] = await dataLakes.insert(selectedLakeId, [parse.payload]);
960
+ if (!isDefined7(stored)) {
961
+ setInsertError(new Error("Lake returned no entries for this insert \u2014 the lake may disallow the payload's schema."));
962
+ return;
963
+ }
964
+ if (!isAnyPayload(stored)) {
965
+ setInsertError(new Error("Lake returned a non-payload value (binary blob); this flow only handles payload-shaped content."));
966
+ return;
967
+ }
968
+ setStoredPayload(parse.payload);
969
+ } catch (e) {
970
+ setInsertError(e);
971
+ } finally {
972
+ setInserting(false);
973
+ }
974
+ };
975
+ const handleAddToChain = async () => {
976
+ if (!canAddToChain || !isDefinedNotNull4(gateway) || !isDefined7(storedPayload) || !isDefined7(storedHash)) return;
977
+ setChainError(void 0);
978
+ setTxHash(void 0);
979
+ setSignedTx(void 0);
980
+ setAddingToChain(true);
981
+ try {
982
+ const hashPayload = { schema: HashSchema, hash: storedHash };
983
+ const [hash, signed] = await gateway.addPayloadsToChain([hashPayload], [storedPayload]);
984
+ setTxHash(hash);
985
+ setSignedTx(signed);
986
+ } catch (e) {
987
+ setChainError(e);
988
+ } finally {
989
+ setAddingToChain(false);
990
+ }
991
+ };
992
+ return /* @__PURE__ */ jsxs6(
993
+ Stack6,
994
+ {
995
+ ...props,
996
+ sx: {
997
+ gap: 3,
998
+ alignItems: "stretch",
999
+ ...props.sx
1000
+ },
1001
+ children: [
1002
+ timedout ? /* @__PURE__ */ jsx6(Alert5, { severity: "warning", children: "Wallet not detected." }) : null,
1003
+ /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 1 }, children: [
1004
+ /* @__PURE__ */ jsx6(Typography5, { variant: "subtitle2", children: "1. Grant signer + data-lake access" }),
1005
+ /* @__PURE__ */ jsx6(RequestPermissionsButton, { permissions: PANEL_PERMISSIONS, timeout })
1006
+ ] }),
1007
+ /* @__PURE__ */ jsx6(Divider2, {}),
1008
+ /* @__PURE__ */ jsx6(TestPayloadSection, { value: payloadText, onChange: setPayloadText, parse }),
1009
+ /* @__PURE__ */ jsx6(Divider2, {}),
1010
+ /* @__PURE__ */ jsx6(
1011
+ InsertSection,
1012
+ {
1013
+ canInsert,
1014
+ inserting,
1015
+ insertError,
1016
+ onInsert: () => void handleInsert(),
1017
+ onLakeChange: setSelectedLakeId,
1018
+ selectedLakeId,
1019
+ storedHash,
1020
+ timeout
1021
+ }
1022
+ ),
1023
+ /* @__PURE__ */ jsx6(Divider2, {}),
1024
+ /* @__PURE__ */ jsx6(
1025
+ AddToChainSection,
1026
+ {
1027
+ addingToChain,
1028
+ canAddToChain,
1029
+ chainError,
1030
+ explorerTxUrl,
1031
+ gatewayName,
1032
+ onAddToChain: () => void handleAddToChain(),
1033
+ signedTx,
1034
+ txHash
1035
+ }
1036
+ ),
1037
+ /* @__PURE__ */ jsx6(ErrorRender5, { error: clientError ?? gatewayError ?? void 0, scope: "DataLakeAddToChainPanel.wallet" })
1038
+ ]
1039
+ }
1040
+ );
1041
+ };
1042
+
1043
+ // src/client/components/connected/DataLakeGetButton.tsx
1044
+ import {
1045
+ Alert as Alert6,
1046
+ Stack as Stack7,
1047
+ Typography as Typography6
1048
+ } from "@mui/material";
1049
+ import { ButtonEx as ButtonEx6 } from "@xylabs/react-button";
1050
+ import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
1051
+ import { isDefined as isDefined8, isDefinedNotNull as isDefinedNotNull5 } from "@xylabs/sdk-js";
1052
+ import { useState as useState6 } from "react";
1053
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
471
1054
  var DataLakeGetButton = ({
472
1055
  id,
473
1056
  hashes,
@@ -480,14 +1063,14 @@ var DataLakeGetButton = ({
480
1063
  isLoading,
481
1064
  timedout
482
1065
  } = useClientFromWallet(timeout);
483
- const [result, setResult] = useState4();
484
- const [requestError, setRequestError] = useState4();
485
- const [requesting, setRequesting] = useState4(false);
1066
+ const [result, setResult] = useState6();
1067
+ const [requestError, setRequestError] = useState6();
1068
+ const [requesting, setRequesting] = useState6(false);
486
1069
  const dataLakes = client?.dataLakes;
487
- const supported = isDefinedNotNull3(dataLakes);
1070
+ const supported = isDefinedNotNull5(dataLakes);
488
1071
  const argsReady = id.length > 0 && hashes.length > 0;
489
1072
  const handleClick = async () => {
490
- if (!isDefinedNotNull3(dataLakes)) return;
1073
+ if (!isDefinedNotNull5(dataLakes)) return;
491
1074
  setRequestError(void 0);
492
1075
  setResult(void 0);
493
1076
  setRequesting(true);
@@ -500,8 +1083,8 @@ var DataLakeGetButton = ({
500
1083
  setRequesting(false);
501
1084
  }
502
1085
  };
503
- return /* @__PURE__ */ jsxs4(
504
- Stack4,
1086
+ return /* @__PURE__ */ jsxs7(
1087
+ Stack7,
505
1088
  {
506
1089
  ...props,
507
1090
  sx: {
@@ -510,10 +1093,10 @@ var DataLakeGetButton = ({
510
1093
  ...props.sx
511
1094
  },
512
1095
  children: [
513
- timedout ? /* @__PURE__ */ jsx4(Alert3, { severity: "warning", children: "Wallet not detected." }) : null,
514
- isDefinedNotNull3(client) && !supported ? /* @__PURE__ */ jsx4(Alert3, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
515
- /* @__PURE__ */ jsxs4(
516
- ButtonEx3,
1096
+ timedout ? /* @__PURE__ */ jsx7(Alert6, { severity: "warning", children: "Wallet not detected." }) : null,
1097
+ isDefinedNotNull5(client) && !supported ? /* @__PURE__ */ jsx7(Alert6, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
1098
+ /* @__PURE__ */ jsxs7(
1099
+ ButtonEx6,
517
1100
  {
518
1101
  variant: "contained",
519
1102
  size: "small",
@@ -530,11 +1113,11 @@ var DataLakeGetButton = ({
530
1113
  ]
531
1114
  }
532
1115
  ),
533
- argsReady ? null : /* @__PURE__ */ jsx4(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one hash to enable the button." }),
534
- isDefined5(result) ? /* @__PURE__ */ jsxs4(Stack4, { sx: { gap: 0.5 }, children: [
535
- /* @__PURE__ */ jsx4(Typography4, { variant: "subtitle2", children: result.length === 0 ? "No payloads returned" : `Payloads (${result.length})` }),
536
- /* @__PURE__ */ jsx4(
537
- Typography4,
1116
+ argsReady ? null : /* @__PURE__ */ jsx7(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one hash to enable the button." }),
1117
+ isDefined8(result) ? /* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 0.5 }, children: [
1118
+ /* @__PURE__ */ jsx7(Typography6, { variant: "subtitle2", children: result.length === 0 ? "No payloads returned" : `Payloads (${result.length})` }),
1119
+ /* @__PURE__ */ jsx7(
1120
+ Typography6,
538
1121
  {
539
1122
  component: "pre",
540
1123
  variant: "body2",
@@ -547,7 +1130,7 @@ var DataLakeGetButton = ({
547
1130
  }
548
1131
  )
549
1132
  ] }) : null,
550
- /* @__PURE__ */ jsx4(ErrorRender3, { error: clientError ?? requestError, scope: "DataLakeGetButton" })
1133
+ /* @__PURE__ */ jsx7(ErrorRender6, { error: clientError ?? requestError, scope: "DataLakeGetButton" })
551
1134
  ]
552
1135
  }
553
1136
  );
@@ -555,20 +1138,20 @@ var DataLakeGetButton = ({
555
1138
 
556
1139
  // src/client/components/connected/DataLakeGetPanel.tsx
557
1140
  import {
558
- Stack as Stack5,
559
- TextField,
560
- Typography as Typography5
1141
+ Stack as Stack8,
1142
+ TextField as TextField2,
1143
+ Typography as Typography7
561
1144
  } from "@mui/material";
562
- import { useMemo, useState as useState5 } from "react";
563
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1145
+ import { useMemo as useMemo2, useState as useState7 } from "react";
1146
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
564
1147
  var DataLakeGetPanel = ({ timeout, ...props }) => {
565
- const [selectedId, setSelectedId] = useState5("");
566
- const [hashesText, setHashesText] = useState5("");
567
- const hashes = useMemo(() => {
1148
+ const [selectedId, setSelectedId] = useState7("");
1149
+ const [hashesText, setHashesText] = useState7("");
1150
+ const hashes = useMemo2(() => {
568
1151
  return hashesText.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
569
1152
  }, [hashesText]);
570
- return /* @__PURE__ */ jsxs5(
571
- Stack5,
1153
+ return /* @__PURE__ */ jsxs8(
1154
+ Stack8,
572
1155
  {
573
1156
  ...props,
574
1157
  sx: {
@@ -577,7 +1160,7 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
577
1160
  ...props.sx
578
1161
  },
579
1162
  children: [
580
- /* @__PURE__ */ jsx5(
1163
+ /* @__PURE__ */ jsx8(
581
1164
  ApprovedLakeSelector,
582
1165
  {
583
1166
  capability: "viewer",
@@ -586,8 +1169,8 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
586
1169
  timeout
587
1170
  }
588
1171
  ),
589
- /* @__PURE__ */ jsx5(
590
- TextField,
1172
+ /* @__PURE__ */ jsx8(
1173
+ TextField2,
591
1174
  {
592
1175
  label: "Hashes (one per line)",
593
1176
  value: hashesText,
@@ -599,8 +1182,8 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
599
1182
  slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
600
1183
  }
601
1184
  ),
602
- /* @__PURE__ */ jsx5(Typography5, { variant: "caption", sx: { color: "text.secondary" }, children: hashes.length === 0 ? "No hashes parsed." : `${hashes.length} hash${hashes.length === 1 ? "" : "es"} ready.` }),
603
- /* @__PURE__ */ jsx5(DataLakeGetButton, { id: selectedId, hashes, timeout })
1185
+ /* @__PURE__ */ jsx8(Typography7, { variant: "caption", sx: { color: "text.secondary" }, children: hashes.length === 0 ? "No hashes parsed." : `${hashes.length} hash${hashes.length === 1 ? "" : "es"} ready.` }),
1186
+ /* @__PURE__ */ jsx8(DataLakeGetButton, { id: selectedId, hashes, timeout })
604
1187
  ]
605
1188
  }
606
1189
  );
@@ -608,15 +1191,15 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
608
1191
 
609
1192
  // src/client/components/connected/DataLakeInsertButton.tsx
610
1193
  import {
611
- Alert as Alert4,
612
- Stack as Stack6,
613
- Typography as Typography6
1194
+ Alert as Alert7,
1195
+ Stack as Stack9,
1196
+ Typography as Typography8
614
1197
  } from "@mui/material";
615
- import { ButtonEx as ButtonEx4 } from "@xylabs/react-button";
616
- import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
617
- import { isDefined as isDefined6, isDefinedNotNull as isDefinedNotNull4 } from "@xylabs/sdk-js";
618
- import { useState as useState6 } from "react";
619
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1198
+ import { ButtonEx as ButtonEx7 } from "@xylabs/react-button";
1199
+ import { ErrorRender as ErrorRender7 } from "@xylabs/react-error";
1200
+ import { isDefined as isDefined9, isDefinedNotNull as isDefinedNotNull6 } from "@xylabs/sdk-js";
1201
+ import { useState as useState8 } from "react";
1202
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
620
1203
  var DataLakeInsertButton = ({
621
1204
  id,
622
1205
  payloads,
@@ -629,14 +1212,14 @@ var DataLakeInsertButton = ({
629
1212
  isLoading,
630
1213
  timedout
631
1214
  } = useClientFromWallet(timeout);
632
- const [result, setResult] = useState6();
633
- const [requestError, setRequestError] = useState6();
634
- const [requesting, setRequesting] = useState6(false);
1215
+ const [result, setResult] = useState8();
1216
+ const [requestError, setRequestError] = useState8();
1217
+ const [requesting, setRequesting] = useState8(false);
635
1218
  const dataLakes = client?.dataLakes;
636
- const supported = isDefinedNotNull4(dataLakes);
1219
+ const supported = isDefinedNotNull6(dataLakes);
637
1220
  const argsReady = id.length > 0 && payloads.length > 0;
638
1221
  const handleClick = async () => {
639
- if (!isDefinedNotNull4(dataLakes)) return;
1222
+ if (!isDefinedNotNull6(dataLakes)) return;
640
1223
  setRequestError(void 0);
641
1224
  setResult(void 0);
642
1225
  setRequesting(true);
@@ -649,8 +1232,8 @@ var DataLakeInsertButton = ({
649
1232
  setRequesting(false);
650
1233
  }
651
1234
  };
652
- return /* @__PURE__ */ jsxs6(
653
- Stack6,
1235
+ return /* @__PURE__ */ jsxs9(
1236
+ Stack9,
654
1237
  {
655
1238
  ...props,
656
1239
  sx: {
@@ -659,10 +1242,10 @@ var DataLakeInsertButton = ({
659
1242
  ...props.sx
660
1243
  },
661
1244
  children: [
662
- timedout ? /* @__PURE__ */ jsx6(Alert4, { severity: "warning", children: "Wallet not detected." }) : null,
663
- isDefinedNotNull4(client) && !supported ? /* @__PURE__ */ jsx6(Alert4, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
664
- /* @__PURE__ */ jsxs6(
665
- ButtonEx4,
1245
+ timedout ? /* @__PURE__ */ jsx9(Alert7, { severity: "warning", children: "Wallet not detected." }) : null,
1246
+ isDefinedNotNull6(client) && !supported ? /* @__PURE__ */ jsx9(Alert7, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
1247
+ /* @__PURE__ */ jsxs9(
1248
+ ButtonEx7,
666
1249
  {
667
1250
  variant: "contained",
668
1251
  size: "small",
@@ -679,11 +1262,11 @@ var DataLakeInsertButton = ({
679
1262
  ]
680
1263
  }
681
1264
  ),
682
- argsReady ? null : /* @__PURE__ */ jsx6(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one payload to enable the button." }),
683
- isDefined6(result) ? /* @__PURE__ */ jsxs6(Stack6, { sx: { gap: 0.5 }, children: [
684
- /* @__PURE__ */ jsx6(Typography6, { variant: "subtitle2", children: result.length === 0 ? "No payloads written (wallet filtered all)" : `Inserted (${result.length})` }),
685
- /* @__PURE__ */ jsx6(
686
- Typography6,
1265
+ argsReady ? null : /* @__PURE__ */ jsx9(Typography8, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one payload to enable the button." }),
1266
+ isDefined9(result) ? /* @__PURE__ */ jsxs9(Stack9, { sx: { gap: 0.5 }, children: [
1267
+ /* @__PURE__ */ jsx9(Typography8, { variant: "subtitle2", children: result.length === 0 ? "No payloads written (wallet filtered all)" : `Inserted (${result.length})` }),
1268
+ /* @__PURE__ */ jsx9(
1269
+ Typography8,
687
1270
  {
688
1271
  component: "pre",
689
1272
  variant: "body2",
@@ -696,7 +1279,7 @@ var DataLakeInsertButton = ({
696
1279
  }
697
1280
  )
698
1281
  ] }) : null,
699
- /* @__PURE__ */ jsx6(ErrorRender4, { error: clientError ?? requestError, scope: "DataLakeInsertButton" })
1282
+ /* @__PURE__ */ jsx9(ErrorRender7, { error: clientError ?? requestError, scope: "DataLakeInsertButton" })
700
1283
  ]
701
1284
  }
702
1285
  );
@@ -704,14 +1287,14 @@ var DataLakeInsertButton = ({
704
1287
 
705
1288
  // src/client/components/connected/DataLakeInsertPanel.tsx
706
1289
  import {
707
- Alert as Alert5,
708
- Stack as Stack7,
709
- TextField as TextField2,
710
- Typography as Typography7
1290
+ Alert as Alert8,
1291
+ Stack as Stack10,
1292
+ TextField as TextField3,
1293
+ Typography as Typography9
711
1294
  } from "@mui/material";
712
- import { useMemo as useMemo2, useState as useState7 } from "react";
713
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
714
- function buildDefaultPayload() {
1295
+ import { useMemo as useMemo3, useState as useState9 } from "react";
1296
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1297
+ function buildDefaultPayload2() {
715
1298
  return JSON.stringify(
716
1299
  {
717
1300
  schema: "network.xyo.observation.v2",
@@ -722,7 +1305,7 @@ function buildDefaultPayload() {
722
1305
  2
723
1306
  );
724
1307
  }
725
- function parsePayload(raw) {
1308
+ function parsePayload2(raw) {
726
1309
  const trimmed = raw.trim();
727
1310
  if (trimmed.length === 0) return { ok: false, error: "Payload is empty." };
728
1311
  try {
@@ -735,11 +1318,11 @@ function parsePayload(raw) {
735
1318
  }
736
1319
  }
737
1320
  var DataLakeInsertPanel = ({ timeout, ...props }) => {
738
- const [selectedId, setSelectedId] = useState7("");
739
- const [payloadText, setPayloadText] = useState7(buildDefaultPayload);
740
- const parse = useMemo2(() => parsePayload(payloadText), [payloadText]);
741
- return /* @__PURE__ */ jsxs7(
742
- Stack7,
1321
+ const [selectedId, setSelectedId] = useState9("");
1322
+ const [payloadText, setPayloadText] = useState9(buildDefaultPayload2);
1323
+ const parse = useMemo3(() => parsePayload2(payloadText), [payloadText]);
1324
+ return /* @__PURE__ */ jsxs10(
1325
+ Stack10,
743
1326
  {
744
1327
  ...props,
745
1328
  sx: {
@@ -748,7 +1331,7 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
748
1331
  ...props.sx
749
1332
  },
750
1333
  children: [
751
- /* @__PURE__ */ jsx7(
1334
+ /* @__PURE__ */ jsx10(
752
1335
  ApprovedLakeSelector,
753
1336
  {
754
1337
  capability: "runner",
@@ -757,8 +1340,8 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
757
1340
  timeout
758
1341
  }
759
1342
  ),
760
- /* @__PURE__ */ jsx7(
761
- TextField2,
1343
+ /* @__PURE__ */ jsx10(
1344
+ TextField3,
762
1345
  {
763
1346
  label: "Payload (JSON object or array)",
764
1347
  value: payloadText,
@@ -770,15 +1353,15 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
770
1353
  slotProps: { input: { sx: { fontFamily: "monospace", fontSize: 12 } } }
771
1354
  }
772
1355
  ),
773
- parse.ok ? /* @__PURE__ */ jsxs7(Typography7, { variant: "caption", sx: { color: "text.secondary" }, children: [
1356
+ parse.ok ? /* @__PURE__ */ jsxs10(Typography9, { variant: "caption", sx: { color: "text.secondary" }, children: [
774
1357
  parse.payloads.length,
775
1358
  " ",
776
1359
  "payload",
777
1360
  parse.payloads.length === 1 ? "" : "s",
778
1361
  " ",
779
1362
  "parsed."
780
- ] }) : /* @__PURE__ */ jsx7(Alert5, { severity: "error", variant: "outlined", children: /* @__PURE__ */ jsx7(Typography7, { variant: "body2", children: parse.error }) }),
781
- /* @__PURE__ */ jsx7(
1363
+ ] }) : /* @__PURE__ */ jsx10(Alert8, { severity: "error", variant: "outlined", children: /* @__PURE__ */ jsx10(Typography9, { variant: "body2", children: parse.error }) }),
1364
+ /* @__PURE__ */ jsx10(
782
1365
  DataLakeInsertButton,
783
1366
  {
784
1367
  id: selectedId,
@@ -793,15 +1376,15 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
793
1376
 
794
1377
  // src/client/components/connected/DataLakeListButton.tsx
795
1378
  import {
796
- Alert as Alert6,
797
- Stack as Stack8,
798
- Typography as Typography8
1379
+ Alert as Alert9,
1380
+ Stack as Stack11,
1381
+ Typography as Typography10
799
1382
  } from "@mui/material";
800
- import { ButtonEx as ButtonEx5 } from "@xylabs/react-button";
801
- import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
802
- import { isDefined as isDefined7, isDefinedNotNull as isDefinedNotNull5 } from "@xylabs/sdk-js";
803
- import { useState as useState8 } from "react";
804
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1383
+ import { ButtonEx as ButtonEx8 } from "@xylabs/react-button";
1384
+ import { ErrorRender as ErrorRender8 } from "@xylabs/react-error";
1385
+ import { isDefined as isDefined10, isDefinedNotNull as isDefinedNotNull7 } from "@xylabs/sdk-js";
1386
+ import { useState as useState10 } from "react";
1387
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
805
1388
  var DataLakeListButton = ({ timeout, ...props }) => {
806
1389
  const {
807
1390
  client,
@@ -809,13 +1392,13 @@ var DataLakeListButton = ({ timeout, ...props }) => {
809
1392
  isLoading,
810
1393
  timedout
811
1394
  } = useClientFromWallet(timeout);
812
- const [lakes, setLakes] = useState8();
813
- const [requestError, setRequestError] = useState8();
814
- const [requesting, setRequesting] = useState8(false);
1395
+ const [lakes, setLakes] = useState10();
1396
+ const [requestError, setRequestError] = useState10();
1397
+ const [requesting, setRequesting] = useState10(false);
815
1398
  const dataLakes = client?.dataLakes;
816
- const supported = isDefinedNotNull5(dataLakes);
1399
+ const supported = isDefinedNotNull7(dataLakes);
817
1400
  const handleClick = async () => {
818
- if (!isDefinedNotNull5(dataLakes)) return;
1401
+ if (!isDefinedNotNull7(dataLakes)) return;
819
1402
  setRequestError(void 0);
820
1403
  setLakes(void 0);
821
1404
  setRequesting(true);
@@ -828,8 +1411,8 @@ var DataLakeListButton = ({ timeout, ...props }) => {
828
1411
  setRequesting(false);
829
1412
  }
830
1413
  };
831
- return /* @__PURE__ */ jsxs8(
832
- Stack8,
1414
+ return /* @__PURE__ */ jsxs11(
1415
+ Stack11,
833
1416
  {
834
1417
  ...props,
835
1418
  sx: {
@@ -838,10 +1421,10 @@ var DataLakeListButton = ({ timeout, ...props }) => {
838
1421
  ...props.sx
839
1422
  },
840
1423
  children: [
841
- timedout ? /* @__PURE__ */ jsx8(Alert6, { severity: "warning", children: "Wallet not detected." }) : null,
842
- isDefinedNotNull5(client) && !supported ? /* @__PURE__ */ jsx8(Alert6, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
843
- /* @__PURE__ */ jsx8(
844
- ButtonEx5,
1424
+ timedout ? /* @__PURE__ */ jsx11(Alert9, { severity: "warning", children: "Wallet not detected." }) : null,
1425
+ isDefinedNotNull7(client) && !supported ? /* @__PURE__ */ jsx11(Alert9, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
1426
+ /* @__PURE__ */ jsx11(
1427
+ ButtonEx8,
845
1428
  {
846
1429
  variant: "contained",
847
1430
  size: "small",
@@ -851,10 +1434,10 @@ var DataLakeListButton = ({ timeout, ...props }) => {
851
1434
  children: "List approved data lakes"
852
1435
  }
853
1436
  ),
854
- isDefined7(lakes) ? /* @__PURE__ */ jsxs8(Stack8, { sx: { gap: 0.5 }, children: [
855
- /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", children: lakes.length === 0 ? "No approved lakes" : `Approved lakes (${lakes.length})` }),
856
- /* @__PURE__ */ jsx8(
857
- Typography8,
1437
+ isDefined10(lakes) ? /* @__PURE__ */ jsxs11(Stack11, { sx: { gap: 0.5 }, children: [
1438
+ /* @__PURE__ */ jsx11(Typography10, { variant: "subtitle2", children: lakes.length === 0 ? "No approved lakes" : `Approved lakes (${lakes.length})` }),
1439
+ /* @__PURE__ */ jsx11(
1440
+ Typography10,
858
1441
  {
859
1442
  component: "pre",
860
1443
  variant: "body2",
@@ -867,7 +1450,7 @@ var DataLakeListButton = ({ timeout, ...props }) => {
867
1450
  }
868
1451
  )
869
1452
  ] }) : null,
870
- /* @__PURE__ */ jsx8(ErrorRender5, { error: clientError ?? requestError, scope: "DataLakeListButton" })
1453
+ /* @__PURE__ */ jsx11(ErrorRender8, { error: clientError ?? requestError, scope: "DataLakeListButton" })
871
1454
  ]
872
1455
  }
873
1456
  );
@@ -875,9 +1458,9 @@ var DataLakeListButton = ({ timeout, ...props }) => {
875
1458
 
876
1459
  // src/client/components/connected/DataLakeOperationsPanel.tsx
877
1460
  import {
878
- Divider,
879
- Stack as Stack11,
880
- Typography as Typography10
1461
+ Divider as Divider3,
1462
+ Stack as Stack14,
1463
+ Typography as Typography12
881
1464
  } from "@mui/material";
882
1465
 
883
1466
  // src/client/components/connected/DataLakeRequestAccessPanel.tsx
@@ -888,22 +1471,22 @@ import {
888
1471
  InputLabel as InputLabel2,
889
1472
  MenuItem as MenuItem2,
890
1473
  Select as Select2,
891
- Stack as Stack10
1474
+ Stack as Stack13
892
1475
  } from "@mui/material";
893
- import { asSchema } from "@xyo-network/sdk-js";
894
- import { useMemo as useMemo3, useState as useState10 } from "react";
1476
+ import { asSchema as asSchema2 } from "@xyo-network/sdk-js";
1477
+ import { useMemo as useMemo4, useState as useState12 } from "react";
895
1478
 
896
1479
  // src/client/components/connected/DataLakeRequestAccessButton.tsx
897
1480
  import {
898
- Alert as Alert7,
899
- Stack as Stack9,
900
- Typography as Typography9
1481
+ Alert as Alert10,
1482
+ Stack as Stack12,
1483
+ Typography as Typography11
901
1484
  } from "@mui/material";
902
- import { ButtonEx as ButtonEx6 } from "@xylabs/react-button";
903
- import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
904
- import { isDefined as isDefined8, isDefinedNotNull as isDefinedNotNull6 } from "@xylabs/sdk-js";
905
- import { useState as useState9 } from "react";
906
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1485
+ import { ButtonEx as ButtonEx9 } from "@xylabs/react-button";
1486
+ import { ErrorRender as ErrorRender9 } from "@xylabs/react-error";
1487
+ import { isDefined as isDefined11, isDefinedNotNull as isDefinedNotNull8 } from "@xylabs/sdk-js";
1488
+ import { useState as useState11 } from "react";
1489
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
907
1490
  var DataLakeRequestAccessButton = ({
908
1491
  options,
909
1492
  timeout,
@@ -915,13 +1498,13 @@ var DataLakeRequestAccessButton = ({
915
1498
  isLoading,
916
1499
  timedout
917
1500
  } = useClientFromWallet(timeout);
918
- const [granted, setGranted] = useState9();
919
- const [requestError, setRequestError] = useState9();
920
- const [requesting, setRequesting] = useState9(false);
1501
+ const [granted, setGranted] = useState11();
1502
+ const [requestError, setRequestError] = useState11();
1503
+ const [requesting, setRequesting] = useState11(false);
921
1504
  const dataLakes = client?.dataLakes;
922
- const supported = isDefinedNotNull6(dataLakes);
1505
+ const supported = isDefinedNotNull8(dataLakes);
923
1506
  const handleClick = async () => {
924
- if (!isDefinedNotNull6(dataLakes)) return;
1507
+ if (!isDefinedNotNull8(dataLakes)) return;
925
1508
  setRequestError(void 0);
926
1509
  setGranted(void 0);
927
1510
  setRequesting(true);
@@ -933,9 +1516,9 @@ var DataLakeRequestAccessButton = ({
933
1516
  } finally {
934
1517
  setRequesting(false);
935
1518
  }
936
- };
937
- return /* @__PURE__ */ jsxs9(
938
- Stack9,
1519
+ };
1520
+ return /* @__PURE__ */ jsxs12(
1521
+ Stack12,
939
1522
  {
940
1523
  ...props,
941
1524
  sx: {
@@ -944,10 +1527,10 @@ var DataLakeRequestAccessButton = ({
944
1527
  ...props.sx
945
1528
  },
946
1529
  children: [
947
- timedout ? /* @__PURE__ */ jsx9(Alert7, { severity: "warning", children: "Wallet not detected." }) : null,
948
- isDefinedNotNull6(client) && !supported ? /* @__PURE__ */ jsx9(Alert7, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
949
- /* @__PURE__ */ jsx9(
950
- ButtonEx6,
1530
+ timedout ? /* @__PURE__ */ jsx12(Alert10, { severity: "warning", children: "Wallet not detected." }) : null,
1531
+ isDefinedNotNull8(client) && !supported ? /* @__PURE__ */ jsx12(Alert10, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
1532
+ /* @__PURE__ */ jsx12(
1533
+ ButtonEx9,
951
1534
  {
952
1535
  variant: "contained",
953
1536
  size: "small",
@@ -957,38 +1540,38 @@ var DataLakeRequestAccessButton = ({
957
1540
  children: "Request data lake access"
958
1541
  }
959
1542
  ),
960
- isDefined8(granted) ? /* @__PURE__ */ jsxs9(Stack9, { sx: { gap: 0.5 }, children: [
961
- /* @__PURE__ */ jsx9(Typography9, { variant: "subtitle2", children: "Granted:" }),
962
- /* @__PURE__ */ jsxs9(Typography9, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: [
1543
+ isDefined11(granted) ? /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 0.5 }, children: [
1544
+ /* @__PURE__ */ jsx12(Typography11, { variant: "subtitle2", children: "Granted:" }),
1545
+ /* @__PURE__ */ jsxs12(Typography11, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: [
963
1546
  "id:",
964
1547
  " ",
965
1548
  granted.id
966
1549
  ] }),
967
- /* @__PURE__ */ jsx9(Typography9, { variant: "body2", sx: { color: "text.secondary" }, children: "If you picked multiple lakes, call `list()` to enumerate all granted ids." })
1550
+ /* @__PURE__ */ jsx12(Typography11, { variant: "body2", sx: { color: "text.secondary" }, children: "If you picked multiple lakes, call `list()` to enumerate all granted ids." })
968
1551
  ] }) : null,
969
- /* @__PURE__ */ jsx9(ErrorRender6, { error: clientError ?? requestError, scope: "DataLakeRequestAccessButton" })
1552
+ /* @__PURE__ */ jsx12(ErrorRender9, { error: clientError ?? requestError, scope: "DataLakeRequestAccessButton" })
970
1553
  ]
971
1554
  }
972
1555
  );
973
1556
  };
974
1557
 
975
1558
  // src/client/components/connected/DataLakeRequestAccessPanel.tsx
976
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
977
- var observationSchema = asSchema("network.xyo.observation.v2", true);
978
- var locationSchema = asSchema("network.xyo.location", true);
1559
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1560
+ var observationSchema = asSchema2("network.xyo.observation.v2", true);
1561
+ var locationSchema = asSchema2("network.xyo.location", true);
979
1562
  var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
980
- const [capability, setCapability] = useState10("read+write");
981
- const [includeSchemas, setIncludeSchemas] = useState10(true);
1563
+ const [capability, setCapability] = useState12("read+write");
1564
+ const [includeSchemas, setIncludeSchemas] = useState12(true);
982
1565
  const supportsSchemasFilter = capability !== "viewer";
983
- const options = useMemo3(() => {
1566
+ const options = useMemo4(() => {
984
1567
  const cap = capability === "read+write" ? { read: true, write: true } : capability;
985
1568
  if (supportsSchemasFilter && includeSchemas) {
986
1569
  return { capability: cap, schemas: [observationSchema, locationSchema] };
987
1570
  }
988
1571
  return { capability: cap };
989
1572
  }, [capability, includeSchemas, supportsSchemasFilter]);
990
- return /* @__PURE__ */ jsxs10(
991
- Stack10,
1573
+ return /* @__PURE__ */ jsxs13(
1574
+ Stack13,
992
1575
  {
993
1576
  ...props,
994
1577
  sx: {
@@ -997,26 +1580,26 @@ var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
997
1580
  ...props.sx
998
1581
  },
999
1582
  children: [
1000
- /* @__PURE__ */ jsxs10(FormControl2, { size: "small", fullWidth: true, children: [
1001
- /* @__PURE__ */ jsx10(InputLabel2, { children: "Capability" }),
1002
- /* @__PURE__ */ jsxs10(
1583
+ /* @__PURE__ */ jsxs13(FormControl2, { size: "small", fullWidth: true, children: [
1584
+ /* @__PURE__ */ jsx13(InputLabel2, { children: "Capability" }),
1585
+ /* @__PURE__ */ jsxs13(
1003
1586
  Select2,
1004
1587
  {
1005
1588
  value: capability,
1006
1589
  label: "Capability",
1007
1590
  onChange: (event) => setCapability(event.target.value),
1008
1591
  children: [
1009
- /* @__PURE__ */ jsx10(MenuItem2, { value: "viewer", children: "Read only (viewer)" }),
1010
- /* @__PURE__ */ jsx10(MenuItem2, { value: "runner", children: "Write only (runner)" }),
1011
- /* @__PURE__ */ jsx10(MenuItem2, { value: "read+write", children: "Read + Write" })
1592
+ /* @__PURE__ */ jsx13(MenuItem2, { value: "viewer", children: "Read only (viewer)" }),
1593
+ /* @__PURE__ */ jsx13(MenuItem2, { value: "runner", children: "Write only (runner)" }),
1594
+ /* @__PURE__ */ jsx13(MenuItem2, { value: "read+write", children: "Read + Write" })
1012
1595
  ]
1013
1596
  }
1014
1597
  )
1015
1598
  ] }),
1016
- /* @__PURE__ */ jsx10(
1599
+ /* @__PURE__ */ jsx13(
1017
1600
  FormControlLabel,
1018
1601
  {
1019
- control: /* @__PURE__ */ jsx10(
1602
+ control: /* @__PURE__ */ jsx13(
1020
1603
  Checkbox,
1021
1604
  {
1022
1605
  checked: supportsSchemasFilter && includeSchemas,
@@ -1028,17 +1611,17 @@ var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
1028
1611
  label: "Include schemas filter (observation + location)"
1029
1612
  }
1030
1613
  ),
1031
- /* @__PURE__ */ jsx10(DataLakeRequestAccessButton, { options, timeout })
1614
+ /* @__PURE__ */ jsx13(DataLakeRequestAccessButton, { options, timeout })
1032
1615
  ]
1033
1616
  }
1034
1617
  );
1035
1618
  };
1036
1619
 
1037
1620
  // src/client/components/connected/DataLakeOperationsPanel.tsx
1038
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1621
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
1039
1622
  var DataLakeOperationsPanel = ({ timeout, ...props }) => {
1040
- return /* @__PURE__ */ jsxs11(
1041
- Stack11,
1623
+ return /* @__PURE__ */ jsxs14(
1624
+ Stack14,
1042
1625
  {
1043
1626
  ...props,
1044
1627
  sx: {
@@ -1047,283 +1630,30 @@ var DataLakeOperationsPanel = ({ timeout, ...props }) => {
1047
1630
  ...props.sx
1048
1631
  },
1049
1632
  children: [
1050
- /* @__PURE__ */ jsxs11(Stack11, { sx: { gap: 1 }, children: [
1051
- /* @__PURE__ */ jsx11(Typography10, { variant: "subtitle2", children: "Request data lake access" }),
1052
- /* @__PURE__ */ jsx11(DataLakeRequestAccessPanel, { timeout })
1633
+ /* @__PURE__ */ jsxs14(Stack14, { sx: { gap: 1 }, children: [
1634
+ /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle2", children: "Request data lake access" }),
1635
+ /* @__PURE__ */ jsx14(DataLakeRequestAccessPanel, { timeout })
1053
1636
  ] }),
1054
- /* @__PURE__ */ jsx11(Divider, {}),
1055
- /* @__PURE__ */ jsxs11(Stack11, { sx: { gap: 1 }, children: [
1056
- /* @__PURE__ */ jsx11(Typography10, { variant: "subtitle2", children: "List approved lakes" }),
1057
- /* @__PURE__ */ jsx11(DataLakeListButton, { timeout })
1637
+ /* @__PURE__ */ jsx14(Divider3, {}),
1638
+ /* @__PURE__ */ jsxs14(Stack14, { sx: { gap: 1 }, children: [
1639
+ /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle2", children: "List approved lakes" }),
1640
+ /* @__PURE__ */ jsx14(DataLakeListButton, { timeout })
1058
1641
  ] }),
1059
- /* @__PURE__ */ jsx11(Divider, {}),
1060
- /* @__PURE__ */ jsxs11(Stack11, { sx: { gap: 1 }, children: [
1061
- /* @__PURE__ */ jsx11(Typography10, { variant: "subtitle2", children: "Insert payloads" }),
1062
- /* @__PURE__ */ jsx11(DataLakeInsertPanel, { timeout })
1642
+ /* @__PURE__ */ jsx14(Divider3, {}),
1643
+ /* @__PURE__ */ jsxs14(Stack14, { sx: { gap: 1 }, children: [
1644
+ /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle2", children: "Insert payloads" }),
1645
+ /* @__PURE__ */ jsx14(DataLakeInsertPanel, { timeout })
1063
1646
  ] }),
1064
- /* @__PURE__ */ jsx11(Divider, {}),
1065
- /* @__PURE__ */ jsxs11(Stack11, { sx: { gap: 1 }, children: [
1066
- /* @__PURE__ */ jsx11(Typography10, { variant: "subtitle2", children: "Get payloads by hash" }),
1067
- /* @__PURE__ */ jsx11(DataLakeGetPanel, { timeout })
1647
+ /* @__PURE__ */ jsx14(Divider3, {}),
1648
+ /* @__PURE__ */ jsxs14(Stack14, { sx: { gap: 1 }, children: [
1649
+ /* @__PURE__ */ jsx14(Typography12, { variant: "subtitle2", children: "Get payloads by hash" }),
1650
+ /* @__PURE__ */ jsx14(DataLakeGetPanel, { timeout })
1068
1651
  ] })
1069
1652
  ]
1070
1653
  }
1071
1654
  );
1072
1655
  };
1073
1656
 
1074
- // src/client/components/connected/PermissionsReviewDialog.tsx
1075
- import {
1076
- Alert as Alert8,
1077
- Box,
1078
- Chip,
1079
- Dialog,
1080
- DialogActions,
1081
- DialogContent,
1082
- DialogTitle,
1083
- Divider as Divider2,
1084
- Stack as Stack12,
1085
- Typography as Typography11
1086
- } from "@mui/material";
1087
- import { ButtonEx as ButtonEx7 } from "@xylabs/react-button";
1088
- import { ErrorRender as ErrorRender7 } from "@xylabs/react-error";
1089
- import { isDefined as isDefined9 } from "@xylabs/sdk-js";
1090
- import React10 from "react";
1091
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1092
- var renderCaveatValue = (caveat) => {
1093
- if (caveat.type === "restrictReturnedAccounts" && Array.isArray(caveat.value)) {
1094
- if (caveat.value.length === 0) {
1095
- return /* @__PURE__ */ jsx12(Typography11, { variant: "caption", sx: { color: "text.secondary" }, children: "(no address restriction \u2014 every selected account is returned)" });
1096
- }
1097
- return /* @__PURE__ */ jsx12(Stack12, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 }, children: caveat.value.map((address) => /* @__PURE__ */ jsx12(
1098
- Chip,
1099
- {
1100
- label: String(address),
1101
- size: "small",
1102
- sx: { fontFamily: "monospace" }
1103
- },
1104
- String(address)
1105
- )) });
1106
- }
1107
- if (caveat.type === "dataLakeAccess" && typeof caveat.value === "object" && caveat.value !== null) {
1108
- const value = caveat.value;
1109
- return /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 0.5 }, children: [
1110
- isDefined9(value.perOriginId) ? /* @__PURE__ */ jsxs12(Stack12, { direction: "row", sx: { alignItems: "center", gap: 1 }, children: [
1111
- /* @__PURE__ */ jsx12(Typography11, { variant: "caption", sx: { color: "text.secondary" }, children: "id:" }),
1112
- /* @__PURE__ */ jsx12(Typography11, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: value.perOriginId })
1113
- ] }) : null,
1114
- isDefined9(value.narrowedSchemas) && value.narrowedSchemas.length > 0 ? /* @__PURE__ */ jsxs12(
1115
- Stack12,
1116
- {
1117
- direction: "row",
1118
- sx: {
1119
- alignItems: "center",
1120
- flexWrap: "wrap",
1121
- gap: 0.5
1122
- },
1123
- children: [
1124
- /* @__PURE__ */ jsx12(Typography11, { variant: "caption", sx: { color: "text.secondary" }, children: "schemas:" }),
1125
- value.narrowedSchemas.map((schema) => /* @__PURE__ */ jsx12(
1126
- Chip,
1127
- {
1128
- label: schema,
1129
- size: "small",
1130
- variant: "outlined"
1131
- },
1132
- schema
1133
- ))
1134
- ]
1135
- }
1136
- ) : null
1137
- ] });
1138
- }
1139
- return /* @__PURE__ */ jsx12(
1140
- Typography11,
1141
- {
1142
- component: "pre",
1143
- variant: "body2",
1144
- sx: {
1145
- fontFamily: "monospace",
1146
- m: 0,
1147
- whiteSpace: "pre-wrap",
1148
- wordBreak: "break-all"
1149
- },
1150
- children: JSON.stringify(caveat.value, null, 2)
1151
- }
1152
- );
1153
- };
1154
- var renderPermission = (permission) => {
1155
- const caveats = permission.caveats ?? [];
1156
- return /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 1 }, children: [
1157
- /* @__PURE__ */ jsxs12(
1158
- Stack12,
1159
- {
1160
- direction: "row",
1161
- sx: {
1162
- alignItems: "center",
1163
- flexWrap: "wrap",
1164
- gap: 1
1165
- },
1166
- children: [
1167
- /* @__PURE__ */ jsx12(Typography11, { variant: "subtitle2", sx: { fontFamily: "monospace" }, children: permission.parentCapability }),
1168
- isDefined9(permission.date) ? /* @__PURE__ */ jsxs12(Typography11, { variant: "caption", sx: { color: "text.secondary" }, children: [
1169
- "granted",
1170
- " ",
1171
- new Date(permission.date).toLocaleString()
1172
- ] }) : null
1173
- ]
1174
- }
1175
- ),
1176
- caveats.length === 0 ? /* @__PURE__ */ jsx12(Typography11, { variant: "caption", sx: { color: "text.secondary" }, children: "(no caveats)" }) : /* @__PURE__ */ jsx12(Stack12, { sx: { gap: 1, pl: 1 }, children: caveats.map((caveat) => /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 0.5 }, children: [
1177
- /* @__PURE__ */ jsx12(Chip, { label: caveat.type, size: "small", sx: { alignSelf: "flex-start" } }),
1178
- /* @__PURE__ */ jsx12(Box, { sx: { pl: 1 }, children: renderCaveatValue(caveat) })
1179
- ] }, caveat.type)) })
1180
- ] });
1181
- };
1182
- var PermissionsReviewDialog = ({
1183
- granted,
1184
- onClose,
1185
- onReRequest,
1186
- open,
1187
- requesting,
1188
- error
1189
- }) => {
1190
- return /* @__PURE__ */ jsxs12(Dialog, { open, onClose, fullWidth: true, maxWidth: "sm", children: [
1191
- /* @__PURE__ */ jsx12(DialogTitle, { children: "Granted permissions" }),
1192
- /* @__PURE__ */ jsx12(DialogContent, { dividers: true, children: /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 2 }, children: [
1193
- granted.length === 0 ? /* @__PURE__ */ jsx12(Alert8, { severity: "info", children: "No permissions are currently granted to this origin." }) : granted.map((permission, index) => /* @__PURE__ */ jsxs12(React10.Fragment, { children: [
1194
- index > 0 ? /* @__PURE__ */ jsx12(Divider2, {}) : null,
1195
- renderPermission(permission)
1196
- ] }, permission.parentCapability)),
1197
- /* @__PURE__ */ jsx12(ErrorRender7, { error, scope: "PermissionsReviewDialog" })
1198
- ] }) }),
1199
- /* @__PURE__ */ jsxs12(DialogActions, { children: [
1200
- /* @__PURE__ */ jsx12(ButtonEx7, { variant: "text", size: "small", onClick: onClose, children: "Close" }),
1201
- /* @__PURE__ */ jsx12(
1202
- ButtonEx7,
1203
- {
1204
- variant: "contained",
1205
- size: "small",
1206
- disabled: requesting,
1207
- busy: requesting,
1208
- onClick: onReRequest,
1209
- children: "Re-request permissions"
1210
- }
1211
- )
1212
- ] })
1213
- ] });
1214
- };
1215
-
1216
- // src/client/components/connected/RequestPermissionsButton.tsx
1217
- import { Alert as Alert9, Stack as Stack13 } from "@mui/material";
1218
- import { ButtonEx as ButtonEx8 } from "@xylabs/react-button";
1219
- import { ErrorRender as ErrorRender8 } from "@xylabs/react-error";
1220
- import { isDefined as isDefined10, isDefinedNotNull as isDefinedNotNull7 } from "@xylabs/sdk-js";
1221
- import {
1222
- useCallback as useCallback3,
1223
- useEffect as useEffect4,
1224
- useState as useState11
1225
- } from "react";
1226
- import { Fragment, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1227
- var RequestPermissionsButton = ({
1228
- permissions,
1229
- timeout,
1230
- ...props
1231
- }) => {
1232
- const {
1233
- client,
1234
- error: clientError,
1235
- isLoading,
1236
- timedout
1237
- } = useClientFromWallet(timeout);
1238
- const [granted, setGranted] = useState11();
1239
- const [fetchError, setFetchError] = useState11();
1240
- const [requestError, setRequestError] = useState11();
1241
- const [requesting, setRequesting] = useState11(false);
1242
- const [dialogOpen, setDialogOpen] = useState11(false);
1243
- const permissionsApi = client?.permissions;
1244
- const refreshGranted = useCallback3(async () => {
1245
- if (!isDefinedNotNull7(permissionsApi)) return;
1246
- setFetchError(void 0);
1247
- try {
1248
- const result = await permissionsApi.getPermissions();
1249
- setGranted(result ?? []);
1250
- } catch (e) {
1251
- setGranted([]);
1252
- setFetchError(e);
1253
- }
1254
- }, [permissionsApi]);
1255
- useEffect4(() => {
1256
- if (isDefinedNotNull7(permissionsApi) && granted === void 0) {
1257
- void refreshGranted();
1258
- }
1259
- }, [permissionsApi, granted, refreshGranted]);
1260
- const requestPermissions = useCallback3(async () => {
1261
- if (!isDefinedNotNull7(permissionsApi)) return;
1262
- setRequestError(void 0);
1263
- setRequesting(true);
1264
- try {
1265
- await permissionsApi.requestPermissions(permissions);
1266
- void refreshGranted();
1267
- } catch (e) {
1268
- setRequestError(e);
1269
- } finally {
1270
- setRequesting(false);
1271
- }
1272
- }, [permissionsApi, permissions, refreshGranted]);
1273
- const hasGranted = isDefined10(granted) && granted.length > 0;
1274
- const handleClick = () => {
1275
- if (hasGranted) {
1276
- setDialogOpen(true);
1277
- return;
1278
- }
1279
- void requestPermissions();
1280
- };
1281
- return /* @__PURE__ */ jsxs13(
1282
- Stack13,
1283
- {
1284
- ...props,
1285
- sx: {
1286
- gap: 2,
1287
- alignItems: "start",
1288
- ...props.sx
1289
- },
1290
- children: [
1291
- timedout ? /* @__PURE__ */ jsx13(Alert9, { severity: "warning", children: "Wallet not detected." }) : null,
1292
- /* @__PURE__ */ jsx13(
1293
- ButtonEx8,
1294
- {
1295
- variant: "contained",
1296
- size: "small",
1297
- disabled: !isDefinedNotNull7(permissionsApi) || requesting,
1298
- busy: isLoading || requesting,
1299
- onClick: handleClick,
1300
- children: hasGranted ? "Review permissions" : /* @__PURE__ */ jsxs13(Fragment, { children: [
1301
- "Request",
1302
- " ",
1303
- permissions.length,
1304
- " ",
1305
- "permission",
1306
- permissions.length === 1 ? "" : "s"
1307
- ] })
1308
- }
1309
- ),
1310
- /* @__PURE__ */ jsx13(ErrorRender8, { error: clientError ?? fetchError ?? requestError, scope: "RequestPermissionsButton" }),
1311
- /* @__PURE__ */ jsx13(
1312
- PermissionsReviewDialog,
1313
- {
1314
- open: dialogOpen,
1315
- onClose: () => setDialogOpen(false),
1316
- granted: granted ?? [],
1317
- onReRequest: () => void requestPermissions(),
1318
- requesting,
1319
- error: requestError
1320
- }
1321
- )
1322
- ]
1323
- }
1324
- );
1325
- };
1326
-
1327
1657
  // src/client/context/GatewayContext.ts
1328
1658
  import { createContextEx } from "@xylabs/react-shared";
1329
1659
  var GatewayContext = createContextEx();
@@ -1338,12 +1668,12 @@ import {
1338
1668
  startTransition,
1339
1669
  useCallback as useCallback4,
1340
1670
  useEffect as useEffect5,
1341
- useMemo as useMemo4,
1342
- useState as useState12
1671
+ useMemo as useMemo5,
1672
+ useState as useState13
1343
1673
  } from "react";
1344
1674
 
1345
1675
  // src/client/context/in-page/lib/buildGateway.ts
1346
- import { assertEx as assertEx2, isDefined as isDefined11 } from "@xylabs/sdk-js";
1676
+ import { assertEx as assertEx2, isDefined as isDefined12 } from "@xylabs/sdk-js";
1347
1677
  import {
1348
1678
  basicRemoteRunnerLocator,
1349
1679
  basicRemoteViewerLocator,
@@ -1359,16 +1689,16 @@ var buildGateway = async (gatewayName, signerTransport) => {
1359
1689
  url: `${resolvedNetwork.url}/rpc`
1360
1690
  }
1361
1691
  };
1362
- const locator = isDefined11(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport) : await basicRemoteViewerLocator(gatewayName, remoteConfig);
1692
+ const locator = isDefined12(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport) : await basicRemoteViewerLocator(gatewayName, remoteConfig);
1363
1693
  return await locator.getInstance(XyoGatewayMoniker);
1364
1694
  };
1365
1695
 
1366
1696
  // src/client/context/in-page/Provider.tsx
1367
- import { jsx as jsx14 } from "react/jsx-runtime";
1697
+ import { jsx as jsx15 } from "react/jsx-runtime";
1368
1698
  var InPageGatewaysProvider = ({ signerTransport, children }) => {
1369
- const [gateways, setGateways] = useState12({});
1370
- const [errors, setErrors] = useState12({});
1371
- const [previousSignerTransport, setPreviousSignerTransport] = useState12(signerTransport);
1699
+ const [gateways, setGateways] = useState13({});
1700
+ const [errors, setErrors] = useState13({});
1701
+ const [previousSignerTransport, setPreviousSignerTransport] = useState13(signerTransport);
1372
1702
  const clearAll = useCallback4(() => {
1373
1703
  setGateways({});
1374
1704
  setErrors({});
@@ -1407,7 +1737,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
1407
1737
  cancelled = true;
1408
1738
  };
1409
1739
  }, [signerTransport]);
1410
- const value = useMemo4(() => {
1740
+ const value = useMemo5(() => {
1411
1741
  const value2 = {
1412
1742
  clearAll,
1413
1743
  errors,
@@ -1416,7 +1746,7 @@ var InPageGatewaysProvider = ({ signerTransport, children }) => {
1416
1746
  };
1417
1747
  return value2;
1418
1748
  }, [clearAll, errors, gateways]);
1419
- return /* @__PURE__ */ jsx14(InPageGatewaysContext, { value, children });
1749
+ return /* @__PURE__ */ jsx15(InPageGatewaysContext, { value, children });
1420
1750
  };
1421
1751
 
1422
1752
  // src/client/context/in-page/useProvidedInPageGateways.ts
@@ -1424,10 +1754,10 @@ import { useContextEx } from "@xylabs/react-shared";
1424
1754
  var useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required);
1425
1755
 
1426
1756
  // src/client/context/providers/GatewayProvider.tsx
1427
- import { ErrorRender as ErrorRender9 } from "@xylabs/react-error";
1428
- import { isDefinedNotNull as isDefinedNotNull8, isNull as isNull2 } from "@xylabs/sdk-js";
1429
- import { useMemo as useMemo5 } from "react";
1430
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1757
+ import { ErrorRender as ErrorRender10 } from "@xylabs/react-error";
1758
+ import { isDefinedNotNull as isDefinedNotNull9, isNull as isNull2 } from "@xylabs/sdk-js";
1759
+ import { useMemo as useMemo6 } from "react";
1760
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
1431
1761
  var GatewayProvider = ({ gatewayName, children }) => {
1432
1762
  const {
1433
1763
  gateway: gatewayFromWallet,
@@ -1440,7 +1770,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
1440
1770
  } = useProvidedInPageGateways(true);
1441
1771
  const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : void 0;
1442
1772
  const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : void 0;
1443
- const { defaultGateway, gateways } = useMemo5(() => {
1773
+ const { defaultGateway, gateways } = useMemo6(() => {
1444
1774
  if (isNull2(gatewayFromWallet)) {
1445
1775
  return {
1446
1776
  defaultGateway: gatewayFromConfig,
@@ -1449,7 +1779,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
1449
1779
  walletGateway: null
1450
1780
  }
1451
1781
  };
1452
- } else if (isDefinedNotNull8(gatewayFromWallet)) {
1782
+ } else if (isDefinedNotNull9(gatewayFromWallet)) {
1453
1783
  return {
1454
1784
  defaultGateway: gatewayFromWallet,
1455
1785
  gateways: {
@@ -1466,7 +1796,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
1466
1796
  }
1467
1797
  };
1468
1798
  }, [gatewayFromConfig, gatewayFromWallet]);
1469
- const value = useMemo5(() => {
1799
+ const value = useMemo6(() => {
1470
1800
  const value2 = {
1471
1801
  defaultGateway,
1472
1802
  error: gatewayFromWalletError ?? gatewayFromConfigError,
@@ -1482,22 +1812,22 @@ var GatewayProvider = ({ gatewayName, children }) => {
1482
1812
  gateways,
1483
1813
  clearAll
1484
1814
  ]);
1485
- return /* @__PURE__ */ jsxs14(GatewayContext, { value, children: [
1486
- /* @__PURE__ */ jsx15(ErrorRender9, { error: gatewayFromConfigError }),
1815
+ return /* @__PURE__ */ jsxs15(GatewayContext, { value, children: [
1816
+ /* @__PURE__ */ jsx16(ErrorRender10, { error: gatewayFromConfigError }),
1487
1817
  children
1488
1818
  ] });
1489
1819
  };
1490
1820
 
1491
1821
  // src/client/context/providers/WalletGatewayProvider.tsx
1492
- import { ErrorRender as ErrorRender10 } from "@xylabs/react-error";
1493
- import { useMemo as useMemo6 } from "react";
1494
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
1822
+ import { ErrorRender as ErrorRender11 } from "@xylabs/react-error";
1823
+ import { useMemo as useMemo7 } from "react";
1824
+ import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1495
1825
  var WalletGatewayProvider = ({ gatewayName, children }) => {
1496
1826
  const {
1497
1827
  gateway: gatewayFromWallet,
1498
1828
  error: gatewayFromWalletError
1499
1829
  } = useGatewayFromWallet(gatewayName);
1500
- const { defaultGateway, gateways } = useMemo6(() => {
1830
+ const { defaultGateway, gateways } = useMemo7(() => {
1501
1831
  return {
1502
1832
  defaultGateway: gatewayFromWallet,
1503
1833
  gateways: {
@@ -1506,7 +1836,7 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
1506
1836
  }
1507
1837
  };
1508
1838
  }, [gatewayFromWallet]);
1509
- const value = useMemo6(() => {
1839
+ const value = useMemo7(() => {
1510
1840
  const value2 = {
1511
1841
  defaultGateway,
1512
1842
  error: gatewayFromWalletError,
@@ -1519,8 +1849,8 @@ var WalletGatewayProvider = ({ gatewayName, children }) => {
1519
1849
  gatewayFromWalletError,
1520
1850
  gateways
1521
1851
  ]);
1522
- return /* @__PURE__ */ jsxs15(GatewayContext, { value, children: [
1523
- /* @__PURE__ */ jsx16(ErrorRender10, { error: gatewayFromWalletError }),
1852
+ return /* @__PURE__ */ jsxs16(GatewayContext, { value, children: [
1853
+ /* @__PURE__ */ jsx17(ErrorRender11, { error: gatewayFromWalletError }),
1524
1854
  children
1525
1855
  ] });
1526
1856
  };
@@ -1530,17 +1860,17 @@ import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
1530
1860
  var useProvidedGateway = (required = true) => useContextEx2(GatewayContext, "Gateway", required);
1531
1861
 
1532
1862
  // src/model/types/XyoGlobal.ts
1533
- import { isDefinedNotNull as isDefinedNotNull9, isObject } from "@xylabs/sdk-js";
1863
+ import { isDefinedNotNull as isDefinedNotNull10, isObject } from "@xylabs/sdk-js";
1534
1864
  var isXyoGlobal = (obj) => {
1535
- return isDefinedNotNull9(obj) && isObject(obj) && "client" in obj && "connections" in obj && "errors" in obj && "sessionId" in obj && "walletExtensionId" in obj;
1865
+ return isDefinedNotNull10(obj) && isObject(obj) && "client" in obj && "connections" in obj && "errors" in obj && "sessionId" in obj && "walletExtensionId" in obj;
1536
1866
  };
1537
1867
  var isUninitializedXyoGlobal = (obj) => {
1538
- return isDefinedNotNull9(obj) && isObject(obj) && "connections" in obj && "sessionId" in obj && "walletExtensionId" in obj && !("client" in obj) && "errors" in obj && Array.isArray(obj.errors) && obj.errors.length === 0;
1868
+ return isDefinedNotNull10(obj) && isObject(obj) && "connections" in obj && "sessionId" in obj && "walletExtensionId" in obj && !("client" in obj) && "errors" in obj && Array.isArray(obj.errors) && obj.errors.length === 0;
1539
1869
  };
1540
1870
 
1541
1871
  // src/shared/components/menu-item/ActiveMenuItem.tsx
1542
1872
  import { MenuItem as MenuItem3, useTheme } from "@mui/material";
1543
- import { jsx as jsx17 } from "react/jsx-runtime";
1873
+ import { jsx as jsx18 } from "react/jsx-runtime";
1544
1874
  var ActiveMenuItem = ({
1545
1875
  active,
1546
1876
  children,
@@ -1548,7 +1878,7 @@ var ActiveMenuItem = ({
1548
1878
  ...props
1549
1879
  }) => {
1550
1880
  const theme = useTheme();
1551
- return /* @__PURE__ */ jsx17(
1881
+ return /* @__PURE__ */ jsx18(
1552
1882
  MenuItem3,
1553
1883
  {
1554
1884
  disableRipple: true,
@@ -1580,14 +1910,14 @@ var ActiveMenuItem = ({
1580
1910
 
1581
1911
  // src/shared/components/stack/DetailsStack.tsx
1582
1912
  import {
1583
- Stack as Stack14,
1913
+ Stack as Stack15,
1584
1914
  Tooltip as Tooltip2,
1585
- Typography as Typography12,
1915
+ Typography as Typography13,
1586
1916
  useTheme as useTheme2
1587
1917
  } from "@mui/material";
1588
- import { isDefined as isDefined12 } from "@xylabs/sdk-js";
1589
- import { useMemo as useMemo7 } from "react";
1590
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
1918
+ import { isDefined as isDefined13 } from "@xylabs/sdk-js";
1919
+ import { useMemo as useMemo8 } from "react";
1920
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
1591
1921
  var isComponentType = (value) => typeof value === "function" || typeof value === "object" && value !== null && ("$$typeof" in value || "render" in value);
1592
1922
  var DetailsStack = ({
1593
1923
  IconComponent,
@@ -1597,9 +1927,9 @@ var DetailsStack = ({
1597
1927
  ...props
1598
1928
  }) => {
1599
1929
  const theme = useTheme2();
1600
- const hasTooltip = isDefined12(tooltipTitle);
1601
- const resolvedIconComponent = useMemo7(() => {
1602
- return isComponentType(IconComponent) ? /* @__PURE__ */ jsx18(
1930
+ const hasTooltip = isDefined13(tooltipTitle);
1931
+ const resolvedIconComponent = useMemo8(() => {
1932
+ return isComponentType(IconComponent) ? /* @__PURE__ */ jsx19(
1603
1933
  IconComponent,
1604
1934
  {
1605
1935
  style: {
@@ -1611,8 +1941,8 @@ var DetailsStack = ({
1611
1941
  }
1612
1942
  ) : IconComponent ?? null;
1613
1943
  }, [IconComponent, theme]);
1614
- return /* @__PURE__ */ jsxs16(
1615
- Stack14,
1944
+ return /* @__PURE__ */ jsxs17(
1945
+ Stack15,
1616
1946
  {
1617
1947
  direction: "column",
1618
1948
  ...props,
@@ -1623,8 +1953,8 @@ var DetailsStack = ({
1623
1953
  ...props.sx
1624
1954
  },
1625
1955
  children: [
1626
- /* @__PURE__ */ jsxs16(
1627
- Typography12,
1956
+ /* @__PURE__ */ jsxs17(
1957
+ Typography13,
1628
1958
  {
1629
1959
  sx: {
1630
1960
  display: "flex",
@@ -1634,7 +1964,7 @@ var DetailsStack = ({
1634
1964
  },
1635
1965
  children: [
1636
1966
  heading,
1637
- hasTooltip ? /* @__PURE__ */ jsx18(Tooltip2, { title: tooltipTitle, children: /* @__PURE__ */ jsx18("span", { children: resolvedIconComponent }) }) : resolvedIconComponent
1967
+ hasTooltip ? /* @__PURE__ */ jsx19(Tooltip2, { title: tooltipTitle, children: /* @__PURE__ */ jsx19("span", { children: resolvedIconComponent }) }) : resolvedIconComponent
1638
1968
  ]
1639
1969
  }
1640
1970
  ),
@@ -1646,12 +1976,12 @@ var DetailsStack = ({
1646
1976
 
1647
1977
  // src/shared/components/stack/LabelValueStack.tsx
1648
1978
  import {
1649
- Stack as Stack15,
1650
- Typography as Typography13,
1979
+ Stack as Stack16,
1980
+ Typography as Typography14,
1651
1981
  useTheme as useTheme3
1652
1982
  } from "@mui/material";
1653
1983
  import { ellipsize, isAddress } from "@xylabs/sdk-js";
1654
- import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
1984
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
1655
1985
  var LabelValueStack = ({
1656
1986
  labels,
1657
1987
  values,
@@ -1664,8 +1994,8 @@ var LabelValueStack = ({
1664
1994
  }
1665
1995
  return value;
1666
1996
  };
1667
- return /* @__PURE__ */ jsxs17(
1668
- Stack15,
1997
+ return /* @__PURE__ */ jsxs18(
1998
+ Stack16,
1669
1999
  {
1670
2000
  ...props,
1671
2001
  sx: {
@@ -1674,8 +2004,8 @@ var LabelValueStack = ({
1674
2004
  ...props.sx
1675
2005
  },
1676
2006
  children: [
1677
- /* @__PURE__ */ jsx19(Stack15, { children: labels.map((label) => /* @__PURE__ */ jsxs17(
1678
- Typography13,
2007
+ /* @__PURE__ */ jsx20(Stack16, { children: labels.map((label) => /* @__PURE__ */ jsxs18(
2008
+ Typography14,
1679
2009
  {
1680
2010
  variant: "body2",
1681
2011
  sx: {
@@ -1690,15 +2020,15 @@ var LabelValueStack = ({
1690
2020
  },
1691
2021
  label
1692
2022
  )) }),
1693
- /* @__PURE__ */ jsx19(
1694
- Stack15,
2023
+ /* @__PURE__ */ jsx20(
2024
+ Stack16,
1695
2025
  {
1696
2026
  sx: {
1697
2027
  alignItems: "end",
1698
2028
  flexGrow: 1
1699
2029
  },
1700
- children: values.map((value, index) => /* @__PURE__ */ jsx19(
1701
- Typography13,
2030
+ children: values.map((value, index) => /* @__PURE__ */ jsx20(
2031
+ Typography14,
1702
2032
  {
1703
2033
  title: value,
1704
2034
  variant: "body2",
@@ -1721,15 +2051,15 @@ var LabelValueStack = ({
1721
2051
  };
1722
2052
 
1723
2053
  // src/shared/decorators/IframeWalletWarningDecorator.tsx
1724
- import { Alert as Alert10, Stack as Stack16 } from "@mui/material";
1725
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
2054
+ import { Alert as Alert11, Stack as Stack17 } from "@mui/material";
2055
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
1726
2056
  var inIframe = globalThis.self !== window.top;
1727
2057
  var IframeWalletWarningDecorator = (Story, args) => {
1728
2058
  const hasXyoGlobal = isXyoGlobal(globalThis.xyo);
1729
- return /* @__PURE__ */ jsxs18(Stack16, { sx: { gap: 2 }, children: [
1730
- inIframe ? /* @__PURE__ */ jsx20(Alert10, { severity: "warning", children: "This story is running in an iframe. Please run it in a standalone browser window to test the wallet extension." }) : null,
1731
- hasXyoGlobal ? null : /* @__PURE__ */ jsx20(Alert10, { severity: "warning", children: "No wallet extension found. Please install the Xyo Wallet Chrome Extension." }),
1732
- /* @__PURE__ */ jsx20(Story, { ...args })
2059
+ return /* @__PURE__ */ jsxs19(Stack17, { sx: { gap: 2 }, children: [
2060
+ inIframe ? /* @__PURE__ */ jsx21(Alert11, { severity: "warning", children: "This story is running in an iframe. Please run it in a standalone browser window to test the wallet extension." }) : null,
2061
+ hasXyoGlobal ? null : /* @__PURE__ */ jsx21(Alert11, { severity: "warning", children: "No wallet extension found. Please install the Xyo Wallet Chrome Extension." }),
2062
+ /* @__PURE__ */ jsx21(Story, { ...args })
1733
2063
  ] });
1734
2064
  };
1735
2065
  export {
@@ -1737,6 +2067,7 @@ export {
1737
2067
  ApprovedLakeSelector,
1738
2068
  ConnectAccountsStack,
1739
2069
  ConnectedAccount,
2070
+ DataLakeAddToChainPanel,
1740
2071
  DataLakeGetButton,
1741
2072
  DataLakeGetPanel,
1742
2073
  DataLakeInsertButton,