@latticexyz/entrykit 2.2.18-88af9325733387259f29dfdafd2fdbc23f2ab499 → 2.2.18-90aac1d4acce19ac592d47a090732dd11c1c3e7a
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Gt(e){return{...e,appName:e.appName??document.title,appIcon:e.appIcon??document.querySelector("link[rel~='icon']")?.getAttribute("href")??"/favico.ico"}}import{Root as ar,DialogPortal as ir,DialogContent as sr}from"@radix-ui/react-dialog";import{forwardRef as Zt,useEffect as Jt,useRef as Te,useState as Ee}from"react";import er from"react-dom";var ve=`*, ::before, ::after {
|
|
2
2
|
--tw-border-spacing-x: 0;
|
|
3
3
|
--tw-border-spacing-y: 0;
|
|
4
4
|
--tw-translate-x: 0;
|
|
@@ -569,22 +569,10 @@ video {
|
|
|
569
569
|
position: relative;
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
-
.sticky {
|
|
573
|
-
position: sticky;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
572
|
.inset-0 {
|
|
577
573
|
inset: 0px;
|
|
578
574
|
}
|
|
579
575
|
|
|
580
|
-
.bottom-0 {
|
|
581
|
-
bottom: 0px;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
.left-0 {
|
|
585
|
-
left: 0px;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
576
|
.right-0 {
|
|
589
577
|
right: 0px;
|
|
590
578
|
}
|
|
@@ -633,10 +621,6 @@ video {
|
|
|
633
621
|
margin-left: -0.75rem;
|
|
634
622
|
}
|
|
635
623
|
|
|
636
|
-
.-mt-2 {
|
|
637
|
-
margin-top: -0.5rem;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
624
|
.block {
|
|
641
625
|
display: block;
|
|
642
626
|
}
|
|
@@ -665,14 +649,6 @@ video {
|
|
|
665
649
|
display: contents;
|
|
666
650
|
}
|
|
667
651
|
|
|
668
|
-
.hidden {
|
|
669
|
-
display: none;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
.h-12 {
|
|
673
|
-
height: 3rem;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
652
|
.h-16 {
|
|
677
653
|
height: 4rem;
|
|
678
654
|
}
|
|
@@ -685,10 +661,6 @@ video {
|
|
|
685
661
|
height: 1.5rem;
|
|
686
662
|
}
|
|
687
663
|
|
|
688
|
-
.h-64 {
|
|
689
|
-
height: 16rem;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
664
|
.h-\\[1\\.25em\\] {
|
|
693
665
|
height: 1.25em;
|
|
694
666
|
}
|
|
@@ -701,8 +673,8 @@ video {
|
|
|
701
673
|
height: 100%;
|
|
702
674
|
}
|
|
703
675
|
|
|
704
|
-
.max-h-
|
|
705
|
-
max-height:
|
|
676
|
+
.max-h-32 {
|
|
677
|
+
max-height: 8rem;
|
|
706
678
|
}
|
|
707
679
|
|
|
708
680
|
.min-h-\\[22rem\\] {
|
|
@@ -717,10 +689,6 @@ video {
|
|
|
717
689
|
width: 4rem;
|
|
718
690
|
}
|
|
719
691
|
|
|
720
|
-
.w-24 {
|
|
721
|
-
width: 6rem;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
692
|
.w-28 {
|
|
725
693
|
width: 7rem;
|
|
726
694
|
}
|
|
@@ -765,26 +733,11 @@ video {
|
|
|
765
733
|
flex-grow: 1;
|
|
766
734
|
}
|
|
767
735
|
|
|
768
|
-
.-translate-y-2 {
|
|
769
|
-
--tw-translate-y: -0.5rem;
|
|
770
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
.-translate-y-4 {
|
|
774
|
-
--tw-translate-y: -1rem;
|
|
775
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
776
|
-
}
|
|
777
|
-
|
|
778
736
|
.translate-x-2 {
|
|
779
737
|
--tw-translate-x: 0.5rem;
|
|
780
738
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
781
739
|
}
|
|
782
740
|
|
|
783
|
-
.translate-y-0 {
|
|
784
|
-
--tw-translate-y: 0px;
|
|
785
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
786
|
-
}
|
|
787
|
-
|
|
788
741
|
.scale-100 {
|
|
789
742
|
--tw-scale-x: 1;
|
|
790
743
|
--tw-scale-y: 1;
|
|
@@ -864,18 +817,17 @@ video {
|
|
|
864
817
|
gap: 1.5rem;
|
|
865
818
|
}
|
|
866
819
|
|
|
867
|
-
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
|
|
868
|
-
--tw-space-y-reverse: 0;
|
|
869
|
-
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
870
|
-
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
|
871
|
-
}
|
|
872
|
-
|
|
873
820
|
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
|
874
821
|
--tw-divide-y-reverse: 0;
|
|
875
822
|
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
876
823
|
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
877
824
|
}
|
|
878
825
|
|
|
826
|
+
.divide-neutral-700 > :not([hidden]) ~ :not([hidden]) {
|
|
827
|
+
--tw-divide-opacity: 1;
|
|
828
|
+
border-color: rgb(64 64 64 / var(--tw-divide-opacity));
|
|
829
|
+
}
|
|
830
|
+
|
|
879
831
|
.divide-neutral-800 > :not([hidden]) ~ :not([hidden]) {
|
|
880
832
|
--tw-divide-opacity: 1;
|
|
881
833
|
border-color: rgb(38 38 38 / var(--tw-divide-opacity));
|
|
@@ -885,20 +837,24 @@ video {
|
|
|
885
837
|
align-self: auto;
|
|
886
838
|
}
|
|
887
839
|
|
|
840
|
+
.self-end {
|
|
841
|
+
align-self: flex-end;
|
|
842
|
+
}
|
|
843
|
+
|
|
888
844
|
.self-center {
|
|
889
845
|
align-self: center;
|
|
890
846
|
}
|
|
891
847
|
|
|
892
|
-
.overflow-
|
|
893
|
-
overflow:
|
|
848
|
+
.overflow-y-scroll {
|
|
849
|
+
overflow-y: scroll;
|
|
894
850
|
}
|
|
895
851
|
|
|
896
|
-
.
|
|
897
|
-
|
|
852
|
+
.whitespace-break-spaces {
|
|
853
|
+
white-space: break-spaces;
|
|
898
854
|
}
|
|
899
855
|
|
|
900
|
-
.
|
|
901
|
-
|
|
856
|
+
.break-all {
|
|
857
|
+
word-break: break-all;
|
|
902
858
|
}
|
|
903
859
|
|
|
904
860
|
.rounded-full {
|
|
@@ -913,11 +869,20 @@ video {
|
|
|
913
869
|
border-width: 4px;
|
|
914
870
|
}
|
|
915
871
|
|
|
872
|
+
.border-l-4 {
|
|
873
|
+
border-left-width: 4px;
|
|
874
|
+
}
|
|
875
|
+
|
|
916
876
|
.border-neutral-300 {
|
|
917
877
|
--tw-border-opacity: 1;
|
|
918
878
|
border-color: rgb(212 212 212 / var(--tw-border-opacity));
|
|
919
879
|
}
|
|
920
880
|
|
|
881
|
+
.border-red-500 {
|
|
882
|
+
--tw-border-opacity: 1;
|
|
883
|
+
border-color: rgb(239 68 68 / var(--tw-border-opacity));
|
|
884
|
+
}
|
|
885
|
+
|
|
921
886
|
.border-transparent {
|
|
922
887
|
border-color: transparent;
|
|
923
888
|
}
|
|
@@ -926,20 +891,6 @@ video {
|
|
|
926
891
|
background-color: rgb(0 0 0 / 0.1);
|
|
927
892
|
}
|
|
928
893
|
|
|
929
|
-
.bg-blue-600 {
|
|
930
|
-
--tw-bg-opacity: 1;
|
|
931
|
-
background-color: rgb(37 99 235 / var(--tw-bg-opacity));
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
.bg-blue-700 {
|
|
935
|
-
--tw-bg-opacity: 1;
|
|
936
|
-
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
.bg-blue-700\\/60 {
|
|
940
|
-
background-color: rgb(29 78 216 / 0.6);
|
|
941
|
-
}
|
|
942
|
-
|
|
943
894
|
.bg-neutral-100 {
|
|
944
895
|
--tw-bg-opacity: 1;
|
|
945
896
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity));
|
|
@@ -974,18 +925,9 @@ video {
|
|
|
974
925
|
background-color: rgb(234 88 12 / var(--tw-bg-opacity));
|
|
975
926
|
}
|
|
976
927
|
|
|
977
|
-
.bg-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
.from-transparent {
|
|
982
|
-
--tw-gradient-from: transparent var(--tw-gradient-from-position);
|
|
983
|
-
--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);
|
|
984
|
-
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
.to-blue-700 {
|
|
988
|
-
--tw-gradient-to: #1d4ed8 var(--tw-gradient-to-position);
|
|
928
|
+
.bg-red-100 {
|
|
929
|
+
--tw-bg-opacity: 1;
|
|
930
|
+
background-color: rgb(254 226 226 / var(--tw-bg-opacity));
|
|
989
931
|
}
|
|
990
932
|
|
|
991
933
|
.bg-cover {
|
|
@@ -1020,6 +962,10 @@ video {
|
|
|
1020
962
|
padding: 1rem;
|
|
1021
963
|
}
|
|
1022
964
|
|
|
965
|
+
.p-5 {
|
|
966
|
+
padding: 1.25rem;
|
|
967
|
+
}
|
|
968
|
+
|
|
1023
969
|
.p-6 {
|
|
1024
970
|
padding: 1.5rem;
|
|
1025
971
|
}
|
|
@@ -1028,6 +974,11 @@ video {
|
|
|
1028
974
|
padding: .75em;
|
|
1029
975
|
}
|
|
1030
976
|
|
|
977
|
+
.px-3 {
|
|
978
|
+
padding-left: 0.75rem;
|
|
979
|
+
padding-right: 0.75rem;
|
|
980
|
+
}
|
|
981
|
+
|
|
1031
982
|
.px-8 {
|
|
1032
983
|
padding-left: 2rem;
|
|
1033
984
|
padding-right: 2rem;
|
|
@@ -1043,14 +994,6 @@ video {
|
|
|
1043
994
|
padding-bottom: 2rem;
|
|
1044
995
|
}
|
|
1045
996
|
|
|
1046
|
-
.pb-8 {
|
|
1047
|
-
padding-bottom: 2rem;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
.pt-8 {
|
|
1051
|
-
padding-top: 2rem;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
997
|
.text-left {
|
|
1055
998
|
text-align: left;
|
|
1056
999
|
}
|
|
@@ -1077,11 +1020,6 @@ video {
|
|
|
1077
1020
|
line-height: 1.5rem;
|
|
1078
1021
|
}
|
|
1079
1022
|
|
|
1080
|
-
.text-lg {
|
|
1081
|
-
font-size: 1.125rem;
|
|
1082
|
-
line-height: 1.75rem;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
1023
|
.text-sm {
|
|
1086
1024
|
font-size: 0.875rem;
|
|
1087
1025
|
line-height: 1.25rem;
|
|
@@ -1092,14 +1030,14 @@ video {
|
|
|
1092
1030
|
line-height: 1rem;
|
|
1093
1031
|
}
|
|
1094
1032
|
|
|
1095
|
-
.font-bold {
|
|
1096
|
-
font-weight: 700;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
1033
|
.font-medium {
|
|
1100
1034
|
font-weight: 500;
|
|
1101
1035
|
}
|
|
1102
1036
|
|
|
1037
|
+
.font-semibold {
|
|
1038
|
+
font-weight: 600;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1103
1041
|
.leading-none {
|
|
1104
1042
|
line-height: 1;
|
|
1105
1043
|
}
|
|
@@ -1118,11 +1056,26 @@ video {
|
|
|
1118
1056
|
color: rgb(163 163 163 / var(--tw-text-opacity));
|
|
1119
1057
|
}
|
|
1120
1058
|
|
|
1059
|
+
.text-neutral-500 {
|
|
1060
|
+
--tw-text-opacity: 1;
|
|
1061
|
+
color: rgb(115 115 115 / var(--tw-text-opacity));
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
.text-neutral-700 {
|
|
1065
|
+
--tw-text-opacity: 1;
|
|
1066
|
+
color: rgb(64 64 64 / var(--tw-text-opacity));
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1121
1069
|
.text-orange-500 {
|
|
1122
1070
|
--tw-text-opacity: 1;
|
|
1123
1071
|
color: rgb(249 115 22 / var(--tw-text-opacity));
|
|
1124
1072
|
}
|
|
1125
1073
|
|
|
1074
|
+
.text-red-900 {
|
|
1075
|
+
--tw-text-opacity: 1;
|
|
1076
|
+
color: rgb(127 29 29 / var(--tw-text-opacity));
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1126
1079
|
.text-transparent {
|
|
1127
1080
|
color: transparent;
|
|
1128
1081
|
}
|
|
@@ -1132,14 +1085,6 @@ video {
|
|
|
1132
1085
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1133
1086
|
}
|
|
1134
1087
|
|
|
1135
|
-
.text-white\\/20 {
|
|
1136
|
-
color: rgb(255 255 255 / 0.2);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
.text-white\\/80 {
|
|
1140
|
-
color: rgb(255 255 255 / 0.8);
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
1088
|
.opacity-0 {
|
|
1144
1089
|
opacity: 0;
|
|
1145
1090
|
}
|
|
@@ -1267,11 +1212,6 @@ video {
|
|
|
1267
1212
|
content: var(--tw-content);
|
|
1268
1213
|
}
|
|
1269
1214
|
|
|
1270
|
-
.hover\\:bg-blue-500:hover {
|
|
1271
|
-
--tw-bg-opacity: 1;
|
|
1272
|
-
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
1215
|
.hover\\:bg-neutral-200:hover {
|
|
1276
1216
|
--tw-bg-opacity: 1;
|
|
1277
1217
|
background-color: rgb(229 229 229 / var(--tw-bg-opacity));
|
|
@@ -1282,13 +1222,14 @@ video {
|
|
|
1282
1222
|
background-color: rgb(251 146 60 / var(--tw-bg-opacity));
|
|
1283
1223
|
}
|
|
1284
1224
|
|
|
1285
|
-
.hover\\:text-
|
|
1225
|
+
.hover\\:text-neutral-500:hover {
|
|
1286
1226
|
--tw-text-opacity: 1;
|
|
1287
|
-
color: rgb(
|
|
1227
|
+
color: rgb(115 115 115 / var(--tw-text-opacity));
|
|
1288
1228
|
}
|
|
1289
1229
|
|
|
1290
|
-
.hover\\:text-white
|
|
1291
|
-
|
|
1230
|
+
.hover\\:text-white:hover {
|
|
1231
|
+
--tw-text-opacity: 1;
|
|
1232
|
+
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1292
1233
|
}
|
|
1293
1234
|
|
|
1294
1235
|
.hover\\:brightness-125:hover {
|
|
@@ -1321,13 +1262,13 @@ video {
|
|
|
1321
1262
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1322
1263
|
}
|
|
1323
1264
|
|
|
1324
|
-
.
|
|
1325
|
-
|
|
1265
|
+
.group:hover .group-hover\\:text-black {
|
|
1266
|
+
--tw-text-opacity: 1;
|
|
1267
|
+
color: rgb(0 0 0 / var(--tw-text-opacity));
|
|
1326
1268
|
}
|
|
1327
1269
|
|
|
1328
|
-
.aria-busy\\:
|
|
1329
|
-
|
|
1330
|
-
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
|
1270
|
+
.aria-busy\\:pointer-events-none[aria-busy="true"] {
|
|
1271
|
+
pointer-events: none;
|
|
1331
1272
|
}
|
|
1332
1273
|
|
|
1333
1274
|
.aria-disabled\\:pointer-events-none[aria-disabled="true"] {
|
|
@@ -1338,14 +1279,6 @@ video {
|
|
|
1338
1279
|
opacity: 0.5;
|
|
1339
1280
|
}
|
|
1340
1281
|
|
|
1341
|
-
.group[aria-busy="true"] .group-aria-busy\\:inline {
|
|
1342
|
-
display: inline;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
.group[aria-busy="true"] .group-aria-busy\\:hidden {
|
|
1346
|
-
display: none;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
1282
|
.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:translate-x-0 {
|
|
1350
1283
|
--tw-translate-x: 0px;
|
|
1351
1284
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1426,10 +1359,25 @@ video {
|
|
|
1426
1359
|
background-color: rgb(38 38 38 / var(--tw-bg-opacity));
|
|
1427
1360
|
}
|
|
1428
1361
|
|
|
1362
|
+
.dark\\:bg-red-900:where([data-theme="dark"], [data-theme="dark"] *) {
|
|
1363
|
+
--tw-bg-opacity: 1;
|
|
1364
|
+
background-color: rgb(127 29 29 / var(--tw-bg-opacity));
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1429
1367
|
.dark\\:bg-white\\/10:where([data-theme="dark"], [data-theme="dark"] *) {
|
|
1430
1368
|
background-color: rgb(255 255 255 / 0.1);
|
|
1431
1369
|
}
|
|
1432
1370
|
|
|
1371
|
+
.dark\\:text-neutral-400:where([data-theme="dark"], [data-theme="dark"] *) {
|
|
1372
|
+
--tw-text-opacity: 1;
|
|
1373
|
+
color: rgb(163 163 163 / var(--tw-text-opacity));
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
.dark\\:text-red-50:where([data-theme="dark"], [data-theme="dark"] *) {
|
|
1377
|
+
--tw-text-opacity: 1;
|
|
1378
|
+
color: rgb(254 242 242 / var(--tw-text-opacity));
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1433
1381
|
.dark\\:text-white:where([data-theme="dark"], [data-theme="dark"] *) {
|
|
1434
1382
|
--tw-text-opacity: 1;
|
|
1435
1383
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
@@ -1439,7 +1387,12 @@ video {
|
|
|
1439
1387
|
--tw-bg-opacity: 1;
|
|
1440
1388
|
background-color: rgb(64 64 64 / var(--tw-bg-opacity));
|
|
1441
1389
|
}
|
|
1442
|
-
`;import{useResizeObserver as Ur}from"usehooks-ts";import{mergeRefs as Nr}from"react-merge-refs";import{createContext as jt,useContext as Zt}from"react";import{jsx as Jt}from"react/jsx-runtime";var Ie=jt(null);function Me({frame:e,children:t}){if(Zt(Ie))throw new Error("`FrameProvider` can only be used once.");return Jt(Ie.Provider,{value:{frame:e},children:t})}import{useMediaQuery as kr}from"usehooks-ts";import"@rainbow-me/rainbowkit/styles.css";import{createContext as wr,useContext as Qe}from"react";import{RainbowKitProvider as vr,midnightTheme as xr}from"@rainbow-me/rainbowkit";import{useChains as Cr}from"wagmi";import{transactionQueue as mr}from"@latticexyz/common/actions";import{createClient as ur,fallback as fr,http as Ke,keccak256 as gr,stringToHex as hr,webSocket as yr}from"viem";import{privateKeyToAccount as br}from"viem/accounts";import{createTransport as lr,numberToHex as dr,parseEther as cr}from"viem";import{entryPoint07Address as Le}from"viem/account-abstraction";import{formatUserOperationRequest as er}from"viem/account-abstraction";async function Oe(e){return er({callGasLimit:20000000n,preVerificationGas:200000n,verificationGasLimit:2000000n,paymasterVerificationGasLimit:200000n,paymasterPostOpGasLimit:200000n})}import{parseEventLogs as tr}from"viem";import{formatUserOperation as rr,toPackedUserOperation as or,getUserOperationHash as nr,entryPoint07Address as He,entryPoint07Abi as ze}from"viem/account-abstraction";import{waitForTransactionReceipt as ar,writeContract as ir}from"viem/actions";import{getAction as qe}from"viem/utils";async function Be({executor:e,rpcUserOp:t}){let r=rr(t),o=or(r),n=nr({userOperation:r,chainId:e.chain.id,entryPointVersion:"0.7",entryPointAddress:He}),a=await qe(e,ir,"writeContract")({abi:ze,address:He,functionName:"handleOps",args:[[o],e.account.address],chain:e.chain,account:e.account}),i=await qe(e,ar,"waitForTransactionReceipt")({hash:a});return{success:tr({logs:i.logs,abi:ze,eventName:"UserOperationEvent"})[0].args.success,userOpHash:n,receipt:i}}import Fe from"debug";var ge=Fe("mud:entrykit"),sr=Fe("mud:entrykit");ge.log=console.debug.bind(console);sr.log=console.error.bind(console);var T=ge.extend("quarry");import{setBalance as pr}from"viem/actions";function De({executor:e}){return()=>{T("using a local user op executor",e.account.address),e.chain.id===31337&&(T("setting executor balance"),pr(e.extend(()=>({mode:"anvil"})),{address:e.account.address,value:cr("100")}));let t=new Map;return lr({key:"userOpExecutor",type:"userOpExecutor",name:"User Operation Executor Transport",request:async({method:o,params:n})=>{if(o==="eth_chainId")return dr(e.chain.id);if(o==="eth_supportedEntryPoints")return[Le];if(o==="eth_sendUserOperation"){let[a,i]=n;if(i===Le){let l=await Be({executor:e,rpcUserOp:a});return t.set(l.userOpHash,l),l.userOpHash}}if(o==="eth_getUserOperationReceipt"){let[a]=n;return t.get(a)??null}if(o==="eth_estimateUserOperationGas")return await Oe(n);throw new Error("Method not implemented.")}})}}function Y(e){let t=e.rpcUrls.bundler?.http[0],r=t?Ke(t):e.id===31337?De({executor:ur({chain:e,transport:fr([yr(),Ke()]),account:br(gr(hr("local user op executor"))),pollingInterval:10}).extend(mr())}):null;if(!r)throw new Error(`Chain ${e.id} config did not include a bundler RPC URL.`);return r}import{jsx as Ge}from"react/jsx-runtime";var he=wr(null);function Ve({config:e,children:t}){if(Qe(he))throw new Error("`EntryKitProvider` can only be used once.");let n=Cr().find(({id:a})=>a===e.chainId);if(!n)throw new Error(`Could not find configured chain for chain ID ${e.chainId}.`);return Y(n),Ge(vr,{initialChain:0,appInfo:{appName:e.appName},theme:xr({borderRadius:"none"}),children:Ge(he.Provider,{value:{...e,chain:n},children:t})})}function s(){let e=Qe(he);if(!e)throw new Error("`useEntryKitConfig` can only be used within a `EntryKitProvider`.");return e}function We(){let{theme:e}=s(),t=kr("(prefers-color-scheme: dark)");return e??(t?"dark":"light")}import{jsx as B,jsxs as Rr}from"react/jsx-runtime";function Er({onSize:e,...t}){let r=Ye(null);return Ur({ref:r,onResize:e}),B("div",{ref:r,...t,style:{...t.style,display:"inline-grid"}})}var X=Sr(function({mode:t,children:r},o){let n=Ye(null),[a,i]=_e(!1),l=a?n.current:null,[c,f]=_e({width:void 0,height:void 0}),m=l?.contentDocument,d=We();Pr(()=>{m&&m.body.setAttribute("data-theme",d)},[m,d]);let p=t==="modal"?{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",zIndex:"2147483646"}:c.width&&c.height?{all:"unset",display:"inline-grid",width:`${c.width}px`,height:`${c.height}px`}:{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",opacity:0,pointerEvents:"none"};return B("iframe",{ref:Nr([o,n]),style:p,onLoad:()=>i(!0),srcDoc:"<!doctype html><title>\u2026</title>",children:m?Ar.createPortal(Rr(Me,{frame:l,children:[B("div",{children:t==="modal"?r:B(Er,{onSize:f,children:r})}),B("style",{dangerouslySetInnerHTML:{__html:Te}})]}),m.body):null})});import{twMerge as Xe}from"tailwind-merge";import{jsx as I,jsxs as Or}from"react/jsx-runtime";function $e({open:e,onOpenChange:t,children:r}){return I(Tr,{open:e,onOpenChange:t,children:I(Ir,{children:Or(X,{mode:"modal",children:[I("div",{className:Xe("fixed inset-0","bg-neutral-800/85","animate-in animate-duration-300 fade-in")}),I("div",{className:Xe("fixed inset-0","grid items-end sm:items-center","animate-in animate-duration-300 fade-in slide-in-from-bottom-16"),children:I("div",{children:I(Mr,{className:"outline-none w-full max-w-[26rem] mx-auto","aria-describedby":void 0,onOpenAutoFocus:o=>{o.preventDefault()},children:r})})})]})})})}import{useCallback as ye,useMemo as Hr}from"react";import{useStore as zr}from"zustand";import{createStore as qr}from"zustand/vanilla";var $=qr(()=>({open:!1}));function x(){let e=zr($,n=>n.open),t=ye(()=>{$.setState({open:!0})},[]),r=ye(()=>{$.setState({open:!1})},[]),o=ye(n=>{$.setState({open:n})},[]);return Hr(()=>({accountModalOpen:e,openAccountModal:t,closeAccountModal:r,toggleAccountModal:o}),[e,t,r,o])}import{twMerge as Ft}from"tailwind-merge";import{useAccount as Bn,useConnectorClient as Fn}from"wagmi";import{useAccount as Wr}from"wagmi";import{twMerge as L}from"tailwind-merge";import{twMerge as Br}from"tailwind-merge";import{jsx as je,jsxs as Fr}from"react/jsx-runtime";function S({className:e,...t}){return Fr("svg",{className:Br("-my-[0.125em] h-[1.25em] w-[1.25em] animate-spin",e),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t,children:[je("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),je("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}import{jsx as F,jsxs as Dr}from"react/jsx-runtime";var Lr=({variant:e="secondary"}={})=>L("group/button self-center leading-none outline-none border-4 border-transparent","transition hover:brightness-125 active:brightness-150","focus:border-orange-500","aria-disabled:pointer-events-none aria-busy:pointer-events-none","aria-disabled:opacity-50","p-[.75em] font-medium",{primary:L("bg-orange-600 text-white focus:border-yellow-400"),secondary:L("bg-neutral-700 text-white focus:border-orange-500"),tertiary:L("bg-neutral-800 text-white focus:border-orange-500")}[e]),y=({pending:e,variant:t,type:r,className:o,children:n,disabled:a,...i})=>F("button",{type:r||"button",className:L(Lr({variant:t,pending:e}),o),"aria-busy":e,"aria-disabled":a,disabled:a||e,...i,children:Dr("span",{className:"grid grid-cols-[1fr_auto_1fr] gap-2",children:[F("span",{className:"flex items-center justify-end text-[.75em]",children:F("span",{className:"transition opacity-0 translate-x-2 group-aria-busy/button:opacity-100 group-aria-busy/button:translate-x-0 duration-100 group-aria-busy/button:duration-300",children:F(S,{})})}),F("span",{children:n})]})});import{useConnectModal as _r}from"@rainbow-me/rainbowkit";import{twMerge as Kr}from"tailwind-merge";import{jsx as be,jsxs as Gr}from"react/jsx-runtime";function P({className:e,...t}){return Gr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8",fill:"currentColor",shapeRendering:"crispEdges",className:Kr("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...t,children:[be("path",{d:"M0 0h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm2-1h1v1H7zm0 1h1v1H7zM6 7h1v1H6zm1-2h1v1H7zm0-1h1v1H7zm0-1h1v1H7z"}),be("path",{d:"M2 2h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm1-3h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm0 1h1v1H5zm0 1h1v1H5zm0 1h1v1H5zM4 5h1v1H4zM3 5h1v1H3z",opacity:".5"}),be("path",{d:"M7 2h1v1H7zm0-1h1v1H7zM1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z"})]})}import{useQuery as Qr}from"@tanstack/react-query";function j(e){return Qr({enabled:!!e,retry:!1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,queryKey:["preloadImage",e],queryFn:()=>new Promise((t,r)=>{if(!e)throw new Error("usePreloadImage: Must provide `url` to preload image.");let o=new Image;o.onload=()=>t(o),o.onerror=()=>r(new Error(`usePreloadImage: Could not load image.
|
|
1443
1390
|
|
|
1444
|
-
URL: ${e}`)),o.src=e})})}import{jsx as Z,jsxs as Vr}from"react/jsx-runtime";function Ze(){let{appName:e,appIcon:t}=s(),{data:r,isLoading:o}=j(t);return Vr("div",{className:"flex-grow flex flex-col items-center justify-center gap-2",children:[Z("div",{className:"w-16 h-16 m-2",children:o?null:r?Z("img",{src:t,className:"w-full h-full object-cover"}):Z(P,{className:"w-full h-full text-orange-500 dark:bg-neutral-800"})}),Z("div",{className:"text-2xl text-white text-center",children:e})]})}import{twMerge as Yr}from"tailwind-merge";import{useEffect as Xr,useState as $r}from"react";import{jsx as J,jsxs as jr}from"react/jsx-runtime";function Je(){let e=Wr(),{openConnectModal:t,connectModalOpen:r}=_r(),[o,n]=$r(!1);return Xr(()=>{!r&&!o&&(t?.(),n(!0))},[r,o,t]),jr("div",{className:Yr("flex flex-col gap-6 p-6","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:[J("div",{className:"p-4",children:J(Ze,{})}),J("div",{className:"self-center flex flex-col gap-2 w-60",children:J(y,{variant:"secondary",className:"self-auto flex justify-center",disabled:e.status==="connecting",onClick:t,autoFocus:!0,children:"Connect wallet"},"create")})]})}import{useEffect as Et,useMemo as Hn,useRef as zn,useState as qn}from"react";import{twMerge as Ne}from"tailwind-merge";import{parseEther as Zr}from"viem";var N=Zr("0.01");import{useClient as so}from"wagmi";import{queryOptions as lo,useQuery as co}from"@tanstack/react-query";import{numberToHex as ro}from"viem";import{defineStore as Jr}from"@latticexyz/store";import{parseAbi as eo}from"viem";var we=eo(["error SpenderSystem_AlreadyRegistered(address spender, address user)","error SpenderSystem_HasOwnBalance(address spender)","function registerSpender(address spender)"]),to=Jr({namespaces:{root:{namespace:"",tables:{Allowance:{schema:{user:"address",allowance:"uint256"},key:["user"]},Grantor:{schema:{grantor:"address",allowance:"uint256"},key:["grantor"]},PassHolder:{schema:{user:"address",passId:"bytes32",lastRenewed:"uint256",lastClaimed:"uint256"},key:["user","passId"]},PassConfig:{schema:{passId:"bytes32",claimAmount:"uint256",claimInterval:"uint256",validityPeriod:"uint256",grantor:"address"},key:["passId"]},Spender:{schema:{spender:"address",user:"address"},key:["spender"]},SystemConfig:{schema:{entryPoint:"address"},key:[]}}}}}),M=to.namespaces.root.tables;import{getRecord as oo,getStaticDataLocation as no}from"@latticexyz/store/internal";import{getKeyTuple as ao}from"@latticexyz/protocol-parser/internal";import{setStorageAt as io}from"viem/actions";function h(e){let t=e.contracts??{};if("quarryPaymaster"in t&&t.quarryPaymaster!=null&&"address"in t.quarryPaymaster)return{type:"quarry",address:t.quarryPaymaster.address};if("paymaster"in t&&t.paymaster!=null&&"address"in t.paymaster)return{type:"simple",address:t.paymaster.address}}async function et({client:e,userAddress:t}){let r=h(e.chain);return r?.type!=="quarry"?null:(await oo(e,{address:r.address,table:M.Allowance,key:{user:t},blockTag:"pending"})).allowance}async function tt({client:e,userAddress:t,allowance:r}){let o=h(e.chain);if(o?.type!=="quarry")return;let n=no(M.Allowance.tableId,ao(M.Allowance,{user:t}));await io(e.extend(()=>({mode:"anvil"})),{address:o.address,index:n,value:ro(r,{size:32})})}function ve({client:e,userAddress:t}){let r=["getAllowance",e?.uid,t];return lo(e&&t?{queryKey:r,queryFn:()=>et({client:e,userAddress:t})}:{queryKey:r,enabled:!1})}function rt(e){let{chainId:t}=s(),r=so({chainId:t});return co(ve({client:r,userAddress:e}))}import{useClient as Ps}from"wagmi";import{queryOptions as mo,useQuery as Us}from"@tanstack/react-query";import{getRecord as po}from"@latticexyz/store/internal";async function ot({client:e,userAddress:t,sessionAddress:r}){let o=h(e.chain);return o?.type!=="quarry"?null:(await po(e,{address:o.address,table:M.Spender,key:{spender:r},blockTag:"pending"})).user.toLowerCase()===t.toLowerCase()}function nt({client:e,userAddress:t,sessionAddress:r}){let o=["getSpender",e?.uid,t,r];return mo(e&&t&&r?{queryKey:o,queryFn:()=>ot({client:e,userAddress:t,sessionAddress:r})}:{queryKey:o,enabled:!1})}import{useClient as Vs}from"wagmi";import{queryOptions as yo,useQuery as _s}from"@tanstack/react-query";import{getRecord as ho}from"@latticexyz/store/internal";import{resourceToHex as uo}from"@latticexyz/common";import{parseAbi as fo}from"viem";import go from"@latticexyz/world/mud.config";var at={pollingInterval:250},D=uo({type:"system",namespace:"",name:"unlimited"}),it=go.namespaces.world.tables,st=fo(["function registerDelegation(address delegatee, bytes32 delegationControlId, bytes initCallData)"]);async function lt({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){return(await ho(e,{address:t,table:it.UserDelegationControl,key:{delegator:r,delegatee:o},blockTag:"pending"})).delegationControlId===D}function dt({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){let n=["getDelegation",e?.uid,t,r,o];return yo(e&&r&&o?{queryKey:n,queryFn:()=>lt({client:e,worldAddress:t,userAddress:r,sessionAddress:o})}:{queryKey:n,enabled:!1})}import{queryOptions as Ao,useQuery as Uo,useQueryClient as No}from"@tanstack/react-query";import{useClient as Eo,useConfig as Ro}from"wagmi";import{useClient as dl}from"wagmi";import{queryOptions as Po,useQuery as ul}from"@tanstack/react-query";import{toSimpleSmartAccount as So}from"permissionless/accounts";import{isHex as xo}from"viem";import{createStore as bo}from"zustand/vanilla";import{persist as wo}from"zustand/middleware";var K=bo(wo(()=>({signers:{}}),{name:"mud:entrykit",partialize:({signers:e})=>({signers:e})}));function vo(e){e.key===K.persist.getOptions().name&&K.persist.rehydrate()}window.addEventListener("storage",vo);import{generatePrivateKey as Co,privateKeyToAccount as ko}from"viem/accounts";function ct(e){let t=e.toLowerCase(),r=K.getState().signers[t]??(()=>{let o=localStorage.getItem(`mud:appSigner:privateKey:${e.toLowerCase()}`)?.replace(/^"(.*)"$/,"$1"),n=xo(o)?o:Co();return K.setState(a=>({signers:{...a.signers,[t]:n}})),n})();return ko(r)}async function pt({client:e,userAddress:t}){let r=ct(t);return await So({client:e,owner:r})}function ee({client:e,userAddress:t}){let r=["getSessionAccount",e?.uid,t];return Po(e&&t?{queryKey:r,queryFn:()=>pt({client:e,userAddress:t}),staleTime:1/0,retry:!1}:{queryKey:r,enabled:!1})}import{getBalanceQueryOptions as To}from"wagmi/query";function Io({queryClient:e,config:t,client:r,userAddress:o,worldAddress:n}){let a=["getPrerequisites",r?.uid,o];return Ao(r&&o?{queryKey:a,async queryFn(){let i=h(r.chain),{address:l}=await e.fetchQuery(ee({client:r,userAddress:o})),[c,f,m,d]=await Promise.all([i?null:e.fetchQuery(To(t,{chainId:r.chain.id,address:l})),i?.type==="quarry"?e.fetchQuery(ve({client:r,userAddress:o})):null,i?.type==="quarry"?e.fetchQuery(nt({client:r,userAddress:o,sessionAddress:l})):null,e.fetchQuery(dt({client:r,worldAddress:n,userAddress:o,sessionAddress:l}))]),p=f==null||f>=N,g=m??!0,_=c==null||c.value>=N;return{sessionAddress:l,hasAllowance:p,isSpender:g,hasGasBalance:_,hasDelegation:d,complete:p&&g&&d}},retry:!1}:{queryKey:a,enabled:!1})}function O(e){let t=No(),r=Ro(),{chainId:o,worldAddress:n}=s(),a=Eo({chainId:o});return Uo(Io({queryClient:t,config:r,client:a,userAddress:e,worldAddress:n}),t)}import{useDisconnect as Bo}from"wagmi";import{useQuery as Mo}from"@tanstack/react-query";function te(e){let t=e?.toLowerCase();return Mo({enabled:!!t,queryKey:["ens",t],queryFn:async()=>{let r=await fetch(`https://api.ensideas.com/ens/resolve/${t}`).then(o=>o.json());return{address:r.address??void 0,name:r.name??void 0,displayName:r.displayName??void 0,avatar:r.avatar??void 0}}})}import{jsx as xe,jsxs as Oo}from"react/jsx-runtime";function H({hex:e}){return e.length<=10?xe("span",{title:e,children:e}):Oo("span",{title:e,children:[xe("span",{className:"after:select-none after:content-['\u2026']",children:e.slice(0,6)}),xe("span",{className:"tracking-[-1ch] text-transparent",children:e.slice(6,-4)}),e.slice(-4)]})}import{findCause as Ho}from"@latticexyz/common";import{createStore as zo}from"zustand/vanilla";var re=zo(()=>({lastId:0,errors:[]}));function oe({error:e,retry:t,dismiss:r}){if(!Ho(e,({name:o})=>o==="UserRejectedRequestError"))return re.setState(o=>{if(o.errors.some(a=>a.error===e))return{};let n=o.lastId+1;return{lastId:n,errors:[...o.errors,{id:n,error:e,dismiss:r?()=>{Ce(e),r()}:void 0,retry:t?async()=>{Ce(e),await t()}:void 0}]}}),()=>{Ce(e)}}function Ce(e){re.setState(t=>({errors:t.errors.filter(r=>r.error!==e)}))}import{useEffect as qo}from"react";function A(e){let{error:t,reset:r}=e;return qo(()=>{if(t)return oe({error:t,dismiss:r})},[t,r]),e}import{jsx as G,jsxs as ke}from"react/jsx-runtime";function mt({isActive:e,isExpanded:t,userAddress:r}){let{data:o}=te(r),{disconnect:n,isPending:a}=A(Bo()),{closeAccountModal:i}=x();return ke("div",{className:"flex flex-col gap-4",children:[ke("div",{className:"flex justify-between gap-4",children:[ke("div",{children:[G("div",{children:"Account"}),G("div",{className:"font-mono text-white",children:o?.name??G(H,{hex:r})})]}),G(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:a,onClick:()=>{i(),n()},children:"Sign out"})]}),t?G("p",{className:"text-sm",children:"Each of your onchain actions in this app is associated with your account."}):null]})}import{parseEther as Lo}from"viem";import{useMutation as Do,useQueryClient as Ko}from"@tanstack/react-query";import{http as Fo}from"viem";function ut(){return({chain:e})=>{if(!e)throw new Error("No chain provided to issuer transport.");let t="quarryPassIssuer"in e.rpcUrls?e.rpcUrls.quarryPassIssuer.http[0]:void 0;if(!t)throw new Error(`No \`quarryPassIssuer\` RPC URL found for chain ${e.id}.`);return Fo(t)({chain:e,retryCount:0})}}async function ft({chain:e,userAddress:t}){let r=ut()({chain:e});T("Issuing gas pass to",t),await r.request({method:"quarry_issuePass",params:["0x01",t]}),T("Claiming gas allowance for",t),await r.request({method:"quarry_claimAllowance",params:["0x01",t]})}import{useClient as Go}from"wagmi";function gt(){let e=Ko(),{chain:t}=s(),r=Go({chainId:t.id}),o=["claimGasPass",t.id];return Do({retry:0,mutationKey:o,mutationFn:async n=>{if(t.id===31337){if(!r)throw new Error("No client?");await tt({client:r,userAddress:n,allowance:Lo("1")})}else await ft({chain:t,userAddress:n});await Promise.all([e.invalidateQueries({queryKey:["getAllowance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])}})}import{twMerge as Qo}from"tailwind-merge";import{jsx as ne,jsxs as Vo}from"react/jsx-runtime";function ht({className:e,...t}){return Vo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 263 428",fill:"currentColor",className:Qo("w-[0.6em] h-[1em]",e),...t,children:[ne("path",{d:"M132 321V428L263 243L132 321Z"}),ne("path",{d:"M0 243L132 321V428",fillOpacity:"0.5"}),ne("path",{d:"M132 0V296L263 218"}),ne("path",{d:"M0 218L132 296V0L0 218Z",fillOpacity:"0.5"})]})}import{formatEther as Wo}from"viem";function yt(e){let t=Wo(e),r=Math.floor(parseFloat(t)).toString().length;return parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:Math.max(0,6-r)})}import{formatEther as _o}from"viem";import{jsx as Yo,jsxs as Xo}from"react/jsx-runtime";function ae({wei:e}){return Xo("span",{className:"inline-flex items-center gap-1",title:_o(e),children:[yt(e)," ",Yo(ht,{})]})}import{useEffect as jo}from"react";import{useEffect as $o}from"react";function z(e){let{error:t,refetch:r}=e;return $o(()=>{if(t)return oe({error:t,retry:r,dismiss:()=>{}})},[t,r]),e}import{jsx as q,jsxs as Se}from"react/jsx-runtime";function bt({isActive:e,isExpanded:t,userAddress:r}){let o=z(rt(r)),n=A(gt());return jo(()=>{let a=setTimeout(()=>{e&&n.status==="idle"&&o.isSuccess&&o.data!=null&&o.data<N&&n.mutate(r)});return()=>clearTimeout(a)},[o.data,o.isSuccess,n,e,r]),Se("div",{className:"flex flex-col gap-4",children:[Se("div",{className:"flex justify-between gap-4",children:[Se("div",{children:[q("div",{children:"Allowance"}),q("div",{className:"font-mono text-white",children:o.data!=null?q(ae,{wei:o.data}):q(S,{className:"text-sm"})})]}),q(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:o.status==="pending"||n.status==="pending",onClick:()=>n.mutate(r),children:"Top up"})]}),t?q("p",{className:"text-sm",children:"Your allowance is used to pay for onchain computation."}):null]})}import{encodeFunctionData as vt}from"viem";import{useMutation as dn,useQueryClient as cn}from"@tanstack/react-query";import{getAction as Ae}from"viem/utils";import{sendUserOperation as pn,waitForUserOperationReceipt as mn}from"viem/account-abstraction";import{waitForTransactionReceipt as un}from"viem/actions";import{useClient as fn}from"wagmi";import{resourceToHex as xt}from"@latticexyz/common";import gn from"@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";import{writeContract as an}from"viem/actions";import{getAction as sn}from"viem/utils";import{toHex as Zo}from"viem";import{signTypedData as Jo}from"viem/actions";import{callWithSignatureTypes as en}from"@latticexyz/world-module-callwithsignature/internal";import{getRecord as tn}from"@latticexyz/store/internal";import rn from"@latticexyz/world-module-callwithsignature/mud.config";import{hexToResource as on}from"@latticexyz/common";import{getAction as nn}from"viem/utils";async function wt({userClient:e,worldAddress:t,systemId:r,callData:o,nonce:n,client:a}){let i=n??(a?(await tn(a,{address:t,table:rn.tables.CallWithSignatureNonces,key:{signer:e.account.address},blockTag:"pending"})).nonce:0n),{namespace:l,name:c}=on(r);return await nn(e,Jo,"signTypedData")({account:e.account,domain:{verifyingContract:t,salt:Zo(e.chain.id,{size:32})},types:en,primaryType:"Call",message:{signer:e.account.address,systemNamespace:l,systemName:c,callData:o,nonce:i}})}import ln from"@latticexyz/world-module-callwithsignature/out/CallWithSignatureSystem.sol/CallWithSignatureSystem.abi.json";async function Pe({sessionClient:e,...t}){let r=await wt(t);return sn(e,an,"writeContract")({address:t.worldAddress,abi:ln,functionName:"callWithSignature",args:[t.userClient.account.address,t.systemId,t.callData,r]})}function Ct({userClient:e}){let t=cn(),{chainId:r,worldAddress:o}=s(),n=fn({chainId:r}),a=["setupSession",n?.chain.id,e.account.address];return dn({retry:0,mutationKey:a,mutationFn:async({sessionClient:i,registerSpender:l,registerDelegation:c})=>{if(!n)throw new Error("Client not ready.");let f=h(n.chain),m=i.account.address;if(console.log("setting up session"),e.account.type==="smart"){let d=[];if(l&&f?.type==="quarry"&&(console.log("registering spender"),d.push({to:f.address,abi:we,functionName:"registerSpender",args:[m]})),c&&(console.log("registering delegation"),d.push({to:o,abi:st,functionName:"registerDelegation",args:[m,D,"0x"]})),!d.length)return;console.log("setting up account with",d,e);let p=await Ae(e,pn,"sendUserOperation")({calls:d});console.log("got user op hash",p);let g=await Ae(e,mn,"waitForUserOperationReceipt")({hash:p});console.log("got user op receipt",g),g.success||console.error("not successful?",g)}else{let d=[];if(l&&f?.type==="quarry"){console.log("registering spender");let p=await Pe({client:n,userClient:e,sessionClient:i,worldAddress:f.address,systemId:xt({type:"system",namespace:"",name:"SpenderSystem"}),callData:vt({abi:we,functionName:"registerSpender",args:[m]})});console.log("got spender tx",p),d.push(p)}if(c){console.log("registering delegation");let p=await Pe({client:n,userClient:e,sessionClient:i,worldAddress:o,systemId:xt({type:"system",namespace:"",name:"Registration"}),callData:vt({abi:gn,functionName:"registerDelegation",args:[m,D,"0x"]})});console.log("got delegation tx",p),d.push(p)}if(!d.length)return;console.log("waiting for",d.length,"receipts");for(let p of d){let g=await Ae(n,un,"waitForTransactionReceipt")({hash:p});console.log("got tx receipt",g),g.status==="reverted"&&console.error("tx reverted?",g)}}await Promise.all([t.invalidateQueries({queryKey:["getSpender"]}),t.invalidateQueries({queryKey:["getDelegation"]}),t.invalidateQueries({queryKey:["getPrerequisites"]})])}})}import{useEffect as An}from"react";import{useClient as xn}from"wagmi";import{queryOptions as Cn,useQuery as kn,useQueryClient as Sn}from"@tanstack/react-query";import{smartAccountActions as bn}from"permissionless";import{callFrom as wn}from"@latticexyz/world/internal";import{createBundlerClient as hn}from"viem/account-abstraction";var yn=new Set([31337,17420,17069,690]);function kt(e){let t=e.chain??e.client?.chain,r=t?h(t):void 0;return hn({...at,paymaster:r?{getPaymasterData:async()=>({paymaster:r.address,paymasterData:"0x"})}:void 0,userOperation:{estimateFeesPerGas:t&&yn.has(t.id)?async()=>({maxFeePerGas:100000n,maxPriorityFeePerGas:0n}):void 0},...e})}async function St({userAddress:e,sessionAccount:t,worldAddress:r}){let o=t.client;if(!vn(o))throw new Error("Session account client had no associated chain.");let n=Y(o.chain);return kt({transport:n,client:o,account:t}).extend(bn).extend(wn({worldAddress:r,delegatorAddress:e,publicClient:o})).extend(()=>({userAddress:e}))}function vn(e){return e.chain!=null}function Pn({queryClient:e,client:t,userAddress:r,worldAddress:o}){let n=["getSessionClient",t?.uid,r,o];return Cn(r?{queryKey:n,async queryFn(){let a=await e.fetchQuery(ee({client:t,userAddress:r}));return await St({sessionAccount:a,userAddress:r,worldAddress:o})},staleTime:1/0,retry:!1}:{queryKey:n,enabled:!1})}function ie(e){let t=Sn(),{chainId:r,worldAddress:o}=s(),n=xn({chainId:r});return kn(Pn({queryClient:t,client:n,userAddress:e,worldAddress:o}))}import{jsx as Q,jsxs as Ue}from"react/jsx-runtime";function Pt({isActive:e,isExpanded:t,userClient:r,registerSpender:o,registerDelegation:n}){let a=z(ie(r.account.address)),i=A(Ct({userClient:r})),l=!n&&!n;return An(()=>{let c=setTimeout(()=>{e&&i.status==="idle"&&a.data&&!l&&i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n})});return()=>clearTimeout(c)},[l,e,n,o,a,i]),Ue("div",{className:"flex flex-col gap-4",children:[Ue("div",{className:"flex justify-between gap-4",children:[Ue("div",{children:[Q("div",{children:"Session"}),Q("div",{className:"font-mono text-white",children:l?"Enabled":"Set up"})]}),l?Q(y,{variant:"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,disabled:!0,children:"Enabled"}):Q(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:!a.data||i.status==="pending",onClick:a.data?()=>i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n}):void 0,children:"Enable"})]}),t?Q("p",{className:"text-sm",children:"You can perform actions in this app without interruptions for approvals."}):null]})}import{useBalance as In,useWatchBlockNumber as Mn}from"wagmi";var At={"1":{bridgeUrl:"https://relay.link/bridge/ethereum"},"10":{bridgeUrl:"https://relay.link/bridge/optimism"},"56":{bridgeUrl:"https://relay.link/bridge/bnb"},"100":{bridgeUrl:"https://relay.link/bridge/gnosis"},"111":{bridgeUrl:"https://testnets.relay.link/bridge/bob"},"137":{bridgeUrl:"https://relay.link/bridge/polygon"},"185":{bridgeUrl:"https://relay.link/bridge/mint"},"288":{bridgeUrl:"https://relay.link/bridge/boba"},"324":{bridgeUrl:"https://relay.link/bridge/zksync"},"360":{bridgeUrl:"https://relay.link/bridge/shape"},"480":{bridgeUrl:"https://relay.link/bridge/world-chain"},"690":{bridgeUrl:"https://relay.link/bridge/redstone"},"919":{bridgeUrl:"https://testnets.relay.link/bridge/mode-testnet"},"1101":{bridgeUrl:"https://relay.link/bridge/polygon-zkevm"},"1135":{bridgeUrl:"https://relay.link/bridge/lisk"},"1301":{bridgeUrl:"https://testnets.relay.link/bridge/unichain-sepolia"},"1329":{bridgeUrl:"https://relay.link/bridge/sei"},"1625":{bridgeUrl:"https://relay.link/bridge/gravity"},"1868":{bridgeUrl:"https://relay.link/bridge/soneium"},"1993":{bridgeUrl:"https://testnets.relay.link/bridge/b3"},"1996":{bridgeUrl:"https://relay.link/bridge/sanko"},"2741":{bridgeUrl:"https://relay.link/bridge/abstract"},"2911":{bridgeUrl:"https://relay.link/bridge/hychain"},"4202":{bridgeUrl:"https://testnets.relay.link/bridge/lisk-sepolia"},"4321":{bridgeUrl:"https://relay.link/bridge/echos"},"5000":{bridgeUrl:"https://relay.link/bridge/mantle"},"5112":{bridgeUrl:"https://relay.link/bridge/ham"},"7560":{bridgeUrl:"https://relay.link/bridge/cyber"},"7865":{bridgeUrl:"https://relay.link/bridge/powerloom"},"7897":{bridgeUrl:"https://relay.link/bridge/arena-z"},"8333":{bridgeUrl:"https://relay.link/bridge/B3"},"8453":{bridgeUrl:"https://relay.link/bridge/base"},"9897":{bridgeUrl:"https://testnets.relay.link/bridge/arena-z-testnet"},"11011":{bridgeUrl:"https://testnets.relay.link/bridge/shape-sepolia"},"11124":{bridgeUrl:"https://testnets.relay.link/bridge/abstract"},"13746":{bridgeUrl:"https://testnets.relay.link/bridge/game7-testnet"},"17000":{bridgeUrl:"https://testnets.relay.link/bridge/holesky"},"17069":{bridgeUrl:"https://testnets.relay.link/bridge/garnet"},"17071":{bridgeUrl:"https://relay.link/bridge/onchain-points"},"33139":{bridgeUrl:"https://relay.link/bridge/apechain"},"33979":{bridgeUrl:"https://relay.link/bridge/funki"},"34443":{bridgeUrl:"https://relay.link/bridge/mode"},"42161":{bridgeUrl:"https://relay.link/bridge/arbitrum"},"42170":{bridgeUrl:"https://relay.link/bridge/arbitrum-nova"},"43114":{bridgeUrl:"https://relay.link/bridge/avalanche"},"55244":{bridgeUrl:"https://relay.link/bridge/superposition"},"57073":{bridgeUrl:"https://relay.link/bridge/ink"},"59144":{bridgeUrl:"https://relay.link/bridge/linea"},"60808":{bridgeUrl:"https://relay.link/bridge/bob"},"70700":{bridgeUrl:"https://relay.link/bridge/apex"},"70701":{bridgeUrl:"https://relay.link/bridge/boss"},"70800":{bridgeUrl:"https://testnets.relay.link/bridge/apex-testnet"},"70805":{bridgeUrl:"https://testnets.relay.link/bridge/cloud"},"80002":{bridgeUrl:"https://testnets.relay.link/bridge/amoy"},"81457":{bridgeUrl:"https://relay.link/bridge/blast"},"84532":{bridgeUrl:"https://testnets.relay.link/bridge/base-sepolia"},"167009":{bridgeUrl:"https://testnets.relay.link/bridge/hekla"},"421614":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-sepolia"},"534352":{bridgeUrl:"https://relay.link/bridge/scroll"},"543210":{bridgeUrl:"https://relay.link/bridge/zero-network"},"660279":{bridgeUrl:"https://relay.link/bridge/xai"},"911867":{bridgeUrl:"https://testnets.relay.link/bridge/odyssey"},"984122":{bridgeUrl:"https://relay.link/bridge/forma"},"1118190":{bridgeUrl:"https://testnets.relay.link/bridge/eclipse-testnet"},"3397901":{bridgeUrl:"https://testnets.relay.link/bridge/funki-testnet"},"4457845":{bridgeUrl:"https://testnets.relay.link/bridge/zero-sepolia"},"7777777":{bridgeUrl:"https://relay.link/bridge/zora"},"8253038":{bridgeUrl:"https://relay.link/bridge/bitcoin"},"9092725":{bridgeUrl:"https://testnets.relay.link/bridge/bitcoin-testnet4"},"9286185":{bridgeUrl:"https://relay.link/bridge/eclipse"},"11155111":{bridgeUrl:"https://testnets.relay.link/bridge/sepolia"},"11155420":{bridgeUrl:"https://testnets.relay.link/bridge/op-sepolia"},"666666666":{bridgeUrl:"https://relay.link/bridge/degen"},"792703809":{bridgeUrl:"https://relay.link/bridge/solana"},"888888888":{bridgeUrl:"https://relay.link/bridge/ancient8"},"999999999":{bridgeUrl:"https://testnets.relay.link/bridge/zora-sepolia"},"1380012617":{bridgeUrl:"https://relay.link/bridge/rari"},"1936682084":{bridgeUrl:"https://testnets.relay.link/bridge/solana-devnet"},"88153591557":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-blueberry"}};import{useQueryClient as Nn,useMutation as En}from"@tanstack/react-query";import{setBalance as Rn}from"viem/actions";import{useClient as Tn}from"wagmi";function Ut(){let e=Nn(),{chainId:t}=s(),r=Tn({chainId:t});return En({retry:0,mutationKey:["setBalance",t],mutationFn:async o=>(r&&(await Rn({...r,mode:"anvil"},o),await Promise.all([e.invalidateQueries({queryKey:["balance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])),null)})}import{Fragment as On,jsx as w,jsxs as V}from"react/jsx-runtime";function Nt({isActive:e,isExpanded:t,sessionAddress:r}){let{chain:o}=s(),n=z(In({chainId:o.id,address:r}));Mn({onBlockNumber:()=>n.refetch()});let a=A(Ut()),i=At[o.id];return V("div",{className:"flex flex-col gap-4",children:[V("div",{className:"flex justify-between gap-4",children:[V("div",{children:[w("div",{children:"Gas balance"}),w("div",{className:"font-mono text-white",children:n.data!=null?w(ae,{wei:n.data.value}):w(S,{className:"text-sm"})})]}),o.id===31337?w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending"||a.status==="pending",onClick:()=>a.mutate({address:r,value:N+(n.data?.value??0n)}),children:"Top up"}):i!=null?w("a",{href:`${i.bridgeUrl}?${new URLSearchParams({toAddress:r})}`,target:"_blank",rel:"noopener noreferrer",children:w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending",children:"Top up"})}):null]}),t?V(On,{children:[w("p",{className:"text-sm",children:"Your session's gas balance is used to pay for onchain computation."}),V("p",{className:"text-sm",children:["Send funds to"," ",w("span",{className:"font-mono text-white",children:w(H,{hex:r})})," ","on ",o.name," to top up your session balance."]})]}):null]})}import{jsx as E}from"react/jsx-runtime";function Rt({userClient:e,initialUserAddress:t}){let{chain:r}=s(),o=h(r),n=e.account.address,{data:a,error:i}=O(n);Et(()=>{i&&console.error("Could not get prerequisites",i)},[i]);let{closeAccountModal:l}=x(),c=n!==t,f=zn(a);Et(()=>{a!=null&&(f.current==null&&(f.current=a),a.complete&&(c||!f.current.complete)&&l())},[l,c,a]);let{sessionAddress:m,hasAllowance:d,isSpender:p,hasDelegation:g,hasGasBalance:_}=a??{},U=Hn(()=>{if(!n)return[{id:"wallet",isComplete:!1,content:()=>null}];let u=[{id:"wallet",isComplete:!0,content:v=>E(mt,{...v,userAddress:n})}];return o?o.type==="quarry"&&u.push({id:"allowance",isComplete:!!d,content:v=>E(bt,{...v,userAddress:n})}):m!=null&&u.push({id:"gasBalance",isComplete:!!_,content:v=>E(Nt,{...v,sessionAddress:m})}),u.push({id:"session",isComplete:!!p&&!!g,content:v=>E(Pt,{...v,userClient:e,registerSpender:!p,registerDelegation:!g})}),u},[d,g,_,p,o,m,n,e]),[Ee]=qn(null),Wt=U.find(u=>u.content!=null&&!u.isComplete),me=U.filter(u=>u.isComplete),ue=(Ee!=null?U.find(u=>u.id===Ee):null)??Wt??(me.length<U.length?me.at(-1):null),Re=ue?U.indexOf(ue):-1;return E("div",{className:Ne("px-8 flex flex-col divide-y divide-neutral-800","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:U.map((u,v)=>{let fe=u===ue,_t=fe||me.length===U.length,Yt=!u.isComplete&&Re!==-1&&v>Re;return E("div",{className:Ne("py-8 flex flex-col justify-center",fe?"flex-grow":null),children:E("div",{className:Ne("flex flex-col",Yt?"opacity-30 pointer-events-none":null),children:u.content({isActive:fe,isExpanded:_t})})},u.id)})})}import{useRef as Ln}from"react";import{jsx as Tt}from"react/jsx-runtime";function It(){let{chainId:e}=s(),t=Fn({chainId:e}),{address:r}=Bn(),o=Ln(r);return t.status!=="success"?Tt(Je,{}):Tt(Rt,{userClient:t.data,initialUserAddress:o.current})}import{DialogClose as Yn,DialogTitle as Xn}from"@radix-ui/react-dialog";import{twMerge as Dn}from"tailwind-merge";import{jsx as Kn}from"react/jsx-runtime";function Mt({className:e,children:t,...r}){return Kn("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:Dn("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...r,children:t})}import{jsx as Ot}from"react/jsx-runtime";function Ht(e){return Ot(Mt,{strokeWidth:"2",stroke:"currentColor",...e,children:Ot("path",{d:"M6 18L18 6M6 6L18 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{ErrorBoundary as $n}from"react-error-boundary";import{wait as Gn}from"@latticexyz/common/utils";import{useEffect as Qn}from"react";import{twMerge as se}from"tailwind-merge";import{Fragment as Vn,jsx as b,jsxs as W}from"react/jsx-runtime";function le({error:e,retry:t,dismiss:r}){return Qn(()=>{e&&console.error(e)},[e]),W("div",{className:"pointer-events-none absolute inset-0 overflow-clip",children:[b("div",{className:se("absolute inset-0 bg-blue-700/60","transition duration-300",e?"opacity-100 pointer-events-auto":"opacity-0")}),b("div",{className:se("absolute inset-0 pb-8","transition duration-300",e?"translate-y-0 opacity-100 pointer-events-auto":"-translate-y-4 opacity-0"),children:e?b(Vn,{children:W("div",{className:"w-full max-h-full bg-blue-700 text-white/80 overflow-auto",children:[W("div",{className:"space-y-6 px-8 pt-8",children:[b("div",{className:"text-white text-lg font-bold",children:"Oops! It broke :("}),b("div",{className:"font-mono text-xs whitespace-pre-wrap",children:e.message.trim()}),b("div",{className:"text-sm",children:"See the console for more info."})]}),W("div",{className:"pointer-events-none sticky bottom-0 left-0 -mt-2",children:[b("div",{className:"w-full h-12 bg-gradient-to-b from-transparent to-blue-700"}),t?b("div",{className:"bg-blue-700 text-center",children:W("button",{type:"button",className:se("pointer-events-auto group w-24 p-1 -translate-y-2 transition","bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500","text-white text-sm font-medium","aria-busy:pointer-events-none"),onClick:async o=>{o.currentTarget.ariaBusy="true",await Gn(500),t(),o.currentTarget&&(o.currentTarget.ariaBusy=null)},children:[b("span",{className:"group-aria-busy:hidden",children:"Retry"}),b("span",{className:"hidden group-aria-busy:inline",children:"Retrying\u2026"})]})}):r?b("div",{className:"bg-blue-700 text-center",children:b("button",{type:"button",className:se("pointer-events-auto group w-24 p-1 -translate-y-2 transition","bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500","text-white text-sm font-medium","aria-busy:pointer-events-none"),onClick:r,children:"Dismiss"})}):null]})]})}):null})]})}import{jsx as zt}from"react/jsx-runtime";function qt({error:e,resetErrorBoundary:t}){return zt("div",{className:"h-64",children:zt(le,{error:e,retry:t})})}import{useStore as Wn}from"zustand";import{jsx as _n}from"react/jsx-runtime";function Bt(){let e=Wn(re,t=>t.errors.at(0));return _n(le,{error:e?.error,retry:e?.retry,dismiss:e?.dismiss})}import{jsx as C,jsxs as de}from"react/jsx-runtime";function Lt(){let{accountModalOpen:e,toggleAccountModal:t}=x();return de($e,{open:e,onOpenChange:t,children:[C(Xn,{className:"sr-only",children:"Connect with EntryKit"}),e?de("div",{className:Ft("relative py-2 ring-1","bg-neutral-900 text-neutral-400 ring-neutral-700/50","links:font-medium links:underline links:underline-offset-4","links:text-white","links:decoration-neutral-500 hover:links:decoration-orange-500"),children:[C("div",{className:"absolute top-0 right-0",children:C(Yn,{className:Ft("pointer-events-auto leading-none p-2 transition","text-white/20 hover:text-white/40"),title:"Close",children:C(Ht,{className:"m-0"})})}),de($n,{FallbackComponent:qt,children:[C(It,{}),C(Bt,{})]}),de("a",{href:"https://mud.dev",target:"_blank",rel:"noreferrer noopener",className:"group self-center p-3 flex items-center justify-center gap-2 links-unset text-sm font-mono transition text-neutral-400 hover:text-white",children:[C("span",{className:"block w-4 h-4",children:C(P,{className:"w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300"})}),C("span",{children:"Powered by MUD"})]})]}):null]})}import{jsx as Zn,jsxs as Jn}from"react/jsx-runtime";function jn({config:e,children:t}){return Jn(Ve,{config:e,children:[t,Zn(Lt,{})]})}import{useAccount as ta}from"wagmi";import{twMerge as R}from"tailwind-merge";import{twMerge as Dt}from"tailwind-merge";import{Fragment as ea,jsx as ce,jsxs as Kt}from"react/jsx-runtime";function Gt({address:e}){let{data:t}=te(e),r=j(t?.avatar);return Kt(ea,{children:[Kt("span",{className:"flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center",children:[ce("img",{src:t?.avatar&&r.isSuccess?t.avatar:void 0,className:Dt("col-start-1 row-start-1","inline-flex w-full h-full rounded-full bg-black/10 dark:bg-white/10 bg-cover bg-no-repeat bg-center","transtion duration-300",r.isSuccess?"opacity-100":"opacity-0")}),ce(P,{className:Dt("col-start-1 row-start-1 text-orange-500","transition duration-300",t&&(!t.avatar||r.isError)?"opacity-100":"opacity-0")})]}),ce("span",{className:"flex-grow",children:t?.name??ce(H,{hex:e})})]})}import{useRef as ra}from"react";import{jsx as k,jsxs as Vt}from"react/jsx-runtime";var Qt=R("w-48 p-3 inline-flex outline-none transition","border border-transparent","text-base leading-none"),oa=R("bg-neutral-100 border-neutral-300 text-black","dark:bg-neutral-800 dark:border-neutral-700 dark:text-white"),na=R("cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700");function aa(){let{openAccountModal:e,accountModalOpen:t}=x(),{status:r,address:o}=ta(),n=ra(o),a=O(o),i=r==="connected"||r==="reconnecting"&&o,l=o!==n.current,c=a.isSuccess?a.data.complete:l?!1:i,f=(()=>{if(a.isSuccess){if(!a.data.hasAllowance)return"Top up";if(!a.data.hasDelegation||!a.data.isSpender)return"Set up"}return"Sign in"})();return k(X,{mode:"child",children:c?k("button",{type:"button",className:R(Qt,oa,na),onClick:e,children:k("span",{className:"flex-grow inline-flex gap-2.5 items-center text-left font-medium",children:o?k(Gt,{address:o}):null})},"connected"):Vt("button",{type:"button",className:R(Qt,"group","items-center justify-center gap-2.5","bg-orange-500 text-white font-medium","hover:bg-orange-400","active:bg-orange-600"),"aria-busy":t,onClick:e,children:[Vt("span",{className:"pointer-events-none inline-grid place-items-center -ml-3",children:[k("span",{className:R("col-start-1 row-start-1 leading-none","scale-100 opacity-100 transition duration-300","group-aria-busy:scale-125 group-aria-busy:opacity-0"),children:k(P,{})}),k("span",{"aria-hidden":!0,className:R("col-start-1 row-start-1","scale-50 opacity-0 transition duration-300 delay-50","group-aria-busy:scale-100 group-aria-busy:opacity-100"),children:k(S,{})})]}),k("span",{className:"font-medium",children:f})]},"sign in")})}import{useConnectorClient as ia}from"wagmi";function sa(){let{chainId:e}=s(),t=ia({chainId:e});t.error&&console.error("Error retrieving user client",t.error);let r=t.data?.account.address,o=O(r),n=ie(r);return t.isSuccess?!o.isSuccess||!o.data.complete?{...o,data:void 0}:n:{...t,data:void 0}}import{connectorsForWallets as da}from"@rainbow-me/rainbowkit";import{createConfig as ca}from"wagmi";import{getDefaultWallets as la}from"@rainbow-me/rainbowkit";function pe(e){let{wallets:t}=la();return[...t]}function pa(e){let t=pe(e),r=da(t,{appName:e.appName,projectId:e.walletConnectProjectId});return ca({connectors:r,chains:e.chains,transports:e.transports,pollingInterval:e.pollingInterval})}import{connectorsForWallets as ma}from"@rainbow-me/rainbowkit";function $m({wallets:e,...t}){return ma(e??pe(t),{appName:t.appName,projectId:t.walletConnectProjectId})}export{aa as AccountButton,jn as EntryKitProvider,pa as createWagmiConfig,Xt as defineConfig,$m as getConnectors,pe as getWallets,x as useAccountModal,s as useEntryKitConfig,sa as useSessionClient};
|
|
1391
|
+
.group:hover .dark\\:group-hover\\:text-white:where([data-theme="dark"], [data-theme="dark"] *) {
|
|
1392
|
+
--tw-text-opacity: 1;
|
|
1393
|
+
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1394
|
+
}
|
|
1395
|
+
`;import{useResizeObserver as tr}from"usehooks-ts";import{mergeRefs as rr}from"react-merge-refs";import{createContext as Vt,useContext as Wt}from"react";import{jsx as _t}from"react/jsx-runtime";var Ce=Vt(null);function ke({frame:e,children:t}){if(Wt(Ce))throw new Error("`FrameProvider` can only be used once.");return _t(Ce.Provider,{value:{frame:e},children:t})}import{useMediaQuery as $t}from"usehooks-ts";import"@rainbow-me/rainbowkit/styles.css";import{createContext as Yt,useContext as Ue}from"react";import{RainbowKitProvider as Xt,lightTheme as Se,midnightTheme as Ae}from"@rainbow-me/rainbowkit";import{useChains as jt}from"wagmi";import{jsx as Pe}from"react/jsx-runtime";var ne=Yt(null);function Ne({config:e,children:t}){if(Ue(ne))throw new Error("`EntryKitProvider` can only be used once.");let n=jt().find(({id:a})=>a===e.chainId);if(!n)throw new Error(`Could not find configured chain for chain ID ${e.chainId}.`);return Pe(Xt,{initialChain:0,appInfo:{appName:e.appName},theme:e.theme==="light"?Se({borderRadius:"none"}):e.theme==="dark"?Ae({borderRadius:"none"}):{lightMode:Se({borderRadius:"none"}),darkMode:Ae({borderRadius:"none"})},children:Pe(ne.Provider,{value:{...e,chain:n},children:t})})}function l(){let e=Ue(ne);if(!e)throw new Error("`useEntryKitConfig` can only be used within a `EntryKitProvider`.");return e}function Re(){let{theme:e}=l(),t=$t("(prefers-color-scheme: dark)");return e??(t?"dark":"light")}import{jsx as O,jsxs as nr}from"react/jsx-runtime";function or({onSize:e,...t}){let r=Te(null);return tr({ref:r,onResize:e}),O("div",{ref:r,...t,style:{...t.style,display:"inline-grid"}})}var G=Zt(function({mode:t,children:r},o){let n=Te(null),[a,i]=Ee(!1),s=a?n.current:null,[c,g]=Ee({width:void 0,height:void 0}),m=s?.contentDocument,d=Re();Jt(()=>{m&&m.body.setAttribute("data-theme",d)},[m,d]);let p=t==="modal"?{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",zIndex:"2147483646"}:c.width&&c.height?{all:"unset",display:"inline-grid",width:`${c.width}px`,height:`${c.height}px`}:{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",opacity:0,pointerEvents:"none"};return O("iframe",{ref:rr([o,n]),style:p,onLoad:()=>i(!0),srcDoc:"<!doctype html><title>\u2026</title>",children:m?er.createPortal(nr(ke,{frame:s,children:[O("div",{children:t==="modal"?r:O(or,{onSize:g,children:r})}),O("style",{dangerouslySetInnerHTML:{__html:ve}})]}),m.body):null})});import{twMerge as Me}from"tailwind-merge";import{jsx as R,jsxs as lr}from"react/jsx-runtime";function Ie({open:e,onOpenChange:t,children:r}){return R(ar,{open:e,onOpenChange:t,children:R(ir,{children:lr(G,{mode:"modal",children:[R("div",{className:Me("fixed inset-0","bg-neutral-800/85","animate-in animate-duration-300 fade-in")}),R("div",{className:Me("fixed inset-0","grid items-end sm:items-center","animate-in animate-duration-300 fade-in slide-in-from-bottom-16"),children:R("div",{children:R(sr,{className:"outline-none w-full max-w-[26rem] mx-auto","aria-describedby":void 0,onOpenAutoFocus:o=>{o.preventDefault()},children:r})})})]})})})}import{useCallback as ae,useMemo as dr}from"react";import{useStore as cr}from"zustand";import{createStore as pr}from"zustand/vanilla";var Q=pr(()=>({open:!1}));function C(){let e=cr(Q,n=>n.open),t=ae(()=>{Q.setState({open:!0})},[]),r=ae(()=>{Q.setState({open:!1})},[]),o=ae(n=>{Q.setState({open:n})},[]);return dr(()=>({accountModalOpen:e,openAccountModal:t,closeAccountModal:r,toggleAccountModal:o}),[e,t,r,o])}import{twMerge as It}from"tailwind-merge";import{useAccount as Un,useConnectorClient as Nn}from"wagmi";import{useAccount as xr}from"wagmi";import{twMerge as q}from"tailwind-merge";import{twMerge as mr}from"tailwind-merge";import{jsx as He,jsxs as ur}from"react/jsx-runtime";function b({className:e,...t}){return ur("svg",{className:mr("-my-[0.125em] h-[1.25em] w-[1.25em] animate-spin",e),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t,children:[He("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),He("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}import{jsx as z,jsxs as fr}from"react/jsx-runtime";var gr=({variant:e="secondary"}={})=>q("group/button self-center leading-none outline-none border-4 border-transparent","transition hover:brightness-125 active:brightness-150","focus:border-orange-500","aria-disabled:pointer-events-none aria-busy:pointer-events-none","aria-disabled:opacity-50","p-[.75em] font-medium",{primary:q("bg-orange-600 text-white focus:border-yellow-400"),secondary:q("bg-neutral-700 text-white focus:border-orange-500"),tertiary:q("bg-neutral-800 text-white focus:border-orange-500")}[e]),y=({pending:e,variant:t,type:r,className:o,children:n,disabled:a,...i})=>z("button",{type:r||"button",className:q(gr({variant:t,pending:e}),o),"aria-busy":e,"aria-disabled":a,disabled:a||e,...i,children:fr("span",{className:"grid grid-cols-[1fr_auto_1fr] gap-2",children:[z("span",{className:"flex items-center justify-end text-[.75em]",children:z("span",{className:"transition opacity-0 translate-x-2 group-aria-busy/button:opacity-100 group-aria-busy/button:translate-x-0 duration-100 group-aria-busy/button:duration-300",children:z(b,{})})}),z("span",{children:n})]})});import{useConnectModal as vr}from"@rainbow-me/rainbowkit";import{twMerge as hr}from"tailwind-merge";import{jsx as ie,jsxs as yr}from"react/jsx-runtime";function A({className:e,...t}){return yr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8",fill:"currentColor",shapeRendering:"crispEdges",className:hr("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...t,children:[ie("path",{d:"M0 0h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm2-1h1v1H7zm0 1h1v1H7zM6 7h1v1H6zm1-2h1v1H7zm0-1h1v1H7zm0-1h1v1H7z"}),ie("path",{d:"M2 2h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm1-3h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm0 1h1v1H5zm0 1h1v1H5zm0 1h1v1H5zM4 5h1v1H4zM3 5h1v1H3z",opacity:".5"}),ie("path",{d:"M7 2h1v1H7zm0-1h1v1H7zM1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z"})]})}import{useQuery as br}from"@tanstack/react-query";function V(e){return br({enabled:!!e,retry:!1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,queryKey:["preloadImage",e],queryFn:()=>new Promise((t,r)=>{if(!e)throw new Error("usePreloadImage: Must provide `url` to preload image.");let o=new Image;o.onload=()=>t(o),o.onerror=()=>r(new Error(`usePreloadImage: Could not load image.
|
|
1396
|
+
|
|
1397
|
+
URL: ${e}`)),o.src=e})})}import{jsx as W,jsxs as wr}from"react/jsx-runtime";function Oe(){let{appName:e,appIcon:t}=l(),{data:r,isLoading:o}=V(t);return wr("div",{className:"flex-grow flex flex-col items-center justify-center gap-2",children:[W("div",{className:"w-16 h-16 m-2",children:o?null:r?W("img",{src:t,className:"w-full h-full object-cover"}):W(A,{className:"w-full h-full text-orange-500 dark:bg-neutral-800"})}),W("div",{className:"text-2xl text-white text-center",children:e})]})}import{twMerge as Cr}from"tailwind-merge";import{useEffect as kr,useState as Sr}from"react";import{jsx as _,jsxs as Ar}from"react/jsx-runtime";function ze(){let e=xr(),{openConnectModal:t,connectModalOpen:r}=vr(),[o,n]=Sr(!1);return kr(()=>{!r&&!o&&(t?.(),n(!0))},[r,o,t]),Ar("div",{className:Cr("flex flex-col gap-6 p-6","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:[_("div",{className:"p-4",children:_(Oe,{})}),_("div",{className:"self-center flex flex-col gap-2 w-60",children:_(y,{variant:"secondary",className:"self-auto flex justify-center",disabled:e.status==="connecting",onClick:t,autoFocus:!0,children:"Connect wallet"},"create")})]})}import{useEffect as kn,useMemo as Sn,useRef as An,useState as Pn}from"react";import{twMerge as ye}from"tailwind-merge";import{parseEther as Pr}from"viem";var P=Pr("0.01");import{useClient as Or}from"wagmi";import{queryOptions as zr,useQuery as qr}from"@tanstack/react-query";import{numberToHex as Er}from"viem";import{defineStore as Ur}from"@latticexyz/store";import{parseAbi as Nr}from"viem";var se=Nr(["error SpenderSystem_AlreadyRegistered(address spender, address user)","error SpenderSystem_HasOwnBalance(address spender)","function registerSpender(address spender)"]),Rr=Ur({namespaces:{root:{namespace:"",tables:{Allowance:{schema:{user:"address",allowance:"uint256"},key:["user"]},Grantor:{schema:{grantor:"address",allowance:"uint256"},key:["grantor"]},PassHolder:{schema:{user:"address",passId:"bytes32",lastRenewed:"uint256",lastClaimed:"uint256"},key:["user","passId"]},PassConfig:{schema:{passId:"bytes32",claimAmount:"uint256",claimInterval:"uint256",validityPeriod:"uint256",grantor:"address"},key:["passId"]},Spender:{schema:{spender:"address",user:"address"},key:["spender"]},SystemConfig:{schema:{entryPoint:"address"},key:[]}}}}}),E=Rr.namespaces.root.tables;import{getRecord as Tr,getStaticDataLocation as Mr}from"@latticexyz/store/internal";import{getKeyTuple as Ir}from"@latticexyz/protocol-parser/internal";import{setStorageAt as Hr}from"viem/actions";function h(e){let t=e.contracts??{};if("quarryPaymaster"in t&&t.quarryPaymaster!=null&&"address"in t.quarryPaymaster)return{type:"quarry",address:t.quarryPaymaster.address};if("paymaster"in t&&t.paymaster!=null&&"address"in t.paymaster)return{type:"simple",address:t.paymaster.address}}async function qe({client:e,userAddress:t}){let r=h(e.chain);return r?.type!=="quarry"?null:(await Tr(e,{address:r.address,table:E.Allowance,key:{user:t},blockTag:"pending"})).allowance}async function Be({client:e,userAddress:t,allowance:r}){let o=h(e.chain);if(o?.type!=="quarry")return;let n=Mr(E.Allowance.tableId,Ir(E.Allowance,{user:t}));await Hr(e.extend(()=>({mode:"anvil"})),{address:o.address,index:n,value:Er(r,{size:32})})}function le({client:e,userAddress:t}){let r=["getAllowance",e?.chain.id,t];return zr(e&&t?{queryKey:r,queryFn:()=>qe({client:e,userAddress:t})}:{queryKey:r,enabled:!1})}function Le(e){let{chainId:t}=l(),r=Or({chainId:t});return qr(le({client:r,userAddress:e}))}import{useClient as Li}from"wagmi";import{queryOptions as Lr,useQuery as Ki}from"@tanstack/react-query";import{getRecord as Br}from"@latticexyz/store/internal";async function Fe({client:e,userAddress:t,sessionAddress:r}){let o=h(e.chain);return o?.type!=="quarry"?null:(await Br(e,{address:o.address,table:E.Spender,key:{spender:r},blockTag:"pending"})).user.toLowerCase()===t.toLowerCase()}function Ke({client:e,userAddress:t,sessionAddress:r}){let o=["getSpender",e?.chain.id,t,r];return Lr(e&&t&&r?{queryKey:o,queryFn:()=>Fe({client:e,userAddress:t,sessionAddress:r})}:{queryKey:o,enabled:!1})}import{useClient as as}from"wagmi";import{queryOptions as Qr,useQuery as ss}from"@tanstack/react-query";import{getRecord as Gr}from"@latticexyz/store/internal";import{resourceToHex as Fr}from"@latticexyz/common";import{parseAbi as Kr}from"viem";import Dr from"@latticexyz/world/mud.config";var De={pollingInterval:250},B=Fr({type:"system",namespace:"",name:"unlimited"}),Ge=Dr.namespaces.world.tables,Qe=Kr(["function registerDelegation(address delegatee, bytes32 delegationControlId, bytes initCallData)"]);async function Ve({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){return(await Gr(e,{address:t,table:Ge.UserDelegationControl,key:{delegator:r,delegatee:o},blockTag:"pending"})).delegationControlId===B}function We({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){let n=["getDelegation",e?.chain.id,t,r,o];return Qr(e&&r&&o?{queryKey:n,queryFn:()=>Ve({client:e,worldAddress:t,userAddress:r,sessionAddress:o})}:{queryKey:n,enabled:!1})}import{queryOptions as to,useQuery as ro,useQueryClient as oo}from"@tanstack/react-query";import{useClient as no,useConfig as ao}from"wagmi";import{useClient as Zr}from"wagmi";import{queryOptions as Jr,useQuery as eo}from"@tanstack/react-query";import{toSimpleSmartAccount as $r}from"permissionless/accounts";import{isHex as Yr}from"viem";import{createStore as Vr}from"zustand/vanilla";import{persist as Wr}from"zustand/middleware";var L=Vr(Wr(()=>({signers:{}}),{name:"mud:entrykit",partialize:({signers:e})=>({signers:e})}));function _r(e){e.key===L.persist.getOptions().name&&L.persist.rehydrate()}window.addEventListener("storage",_r);import{generatePrivateKey as Xr,privateKeyToAccount as jr}from"viem/accounts";function _e(e){let t=e.toLowerCase(),r=L.getState().signers[t]??(()=>{let o=localStorage.getItem(`mud:appSigner:privateKey:${e.toLowerCase()}`)?.replace(/^"(.*)"$/,"$1"),n=Yr(o)?o:Xr();return L.setState(a=>({signers:{...a.signers,[t]:n}})),n})();return jr(r)}async function Ye({client:e,userAddress:t}){let r=_e(t);return await $r({client:e,owner:r})}function de({client:e,userAddress:t}){let r=["getSessionAccount",e?.chain.id,t];return Jr(e&&t?{queryKey:r,queryFn:()=>Ye({client:e,userAddress:t}),staleTime:1/0}:{queryKey:r,enabled:!1})}function Xe(e){let{chainId:t}=l(),r=Zr({chainId:t});return eo(de({userAddress:e,client:r}))}import{getBalanceQueryOptions as io}from"wagmi/query";function so({queryClient:e,config:t,client:r,userAddress:o,worldAddress:n}){let a=["getPrerequisites",r?.chain.id,o];return to(r&&o?{queryKey:a,queryFn:async()=>{let i=h(r.chain),{address:s}=await e.fetchQuery(de({client:r,userAddress:o})),[c,g,m,d]=await Promise.all([i?null:e.fetchQuery(io(t,{chainId:r.chain.id,address:s})),i?.type==="quarry"?e.fetchQuery(le({client:r,userAddress:o})):null,i?.type==="quarry"?e.fetchQuery(Ke({client:r,userAddress:o,sessionAddress:s})):null,e.fetchQuery(We({client:r,worldAddress:n,userAddress:o,sessionAddress:s}))]),p=g==null||g>=P,f=m??!0,x=c==null||c.value>=P;return{sessionAddress:s,hasAllowance:p,isSpender:f,hasGasBalance:x,hasDelegation:d,complete:p&&f&&d}}}:{queryKey:a,enabled:!1})}function T(e){let t=oo(),{chainId:r,worldAddress:o}=l(),n=ao(),a=no({chainId:r});return ro(so({config:n,queryClient:t,client:a,userAddress:e,worldAddress:o}),t)}import{useDisconnect as po}from"wagmi";import{useQuery as lo}from"@tanstack/react-query";function Y(e){let t=e?.toLowerCase();return lo({enabled:!!t,queryKey:["ens",t],queryFn:async()=>{let r=await fetch(`https://api.ensideas.com/ens/resolve/${t}`).then(o=>o.json());return{address:r.address??void 0,name:r.name??void 0,displayName:r.displayName??void 0,avatar:r.avatar??void 0}}})}import{jsx as ce,jsxs as co}from"react/jsx-runtime";function M({hex:e}){return e.length<=10?ce("span",{title:e,children:e}):co("span",{title:e,children:[ce("span",{className:"after:select-none after:content-['\u2026']",children:e.slice(0,6)}),ce("span",{className:"tracking-[-1ch] text-transparent",children:e.slice(6,-4)}),e.slice(-4)]})}import{jsx as F,jsxs as pe}from"react/jsx-runtime";function je({isActive:e,isExpanded:t,userAddress:r}){let{data:o}=Y(r),{disconnect:n,isPending:a}=po(),{closeAccountModal:i}=C();return pe("div",{className:"flex flex-col gap-4",children:[pe("div",{className:"flex justify-between gap-4",children:[pe("div",{children:[F("div",{children:"Account"}),F("div",{className:"font-mono text-white",children:o?.name??F(M,{hex:r})})]}),F(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:a,onClick:()=>{i(),n()},children:"Sign out"})]}),t?F("p",{className:"text-sm",children:"Each of your onchain actions in this app is associated with your account."}):null]})}import{parseEther as go}from"viem";import{useMutation as fo,useQueryClient as ho}from"@tanstack/react-query";import{http as mo}from"viem";function $e(){return({chain:e})=>{if(!e)throw new Error("No chain provided to issuer transport.");let t="quarryPassIssuer"in e.rpcUrls?e.rpcUrls.quarryPassIssuer.http[0]:void 0;if(!t)throw new Error(`No \`quarryPassIssuer\` RPC URL found for chain ${e.id}.`);return mo(t)({chain:e,retryCount:0})}}import Ze from"debug";var me=Ze("mud:entrykit"),uo=Ze("mud:entrykit");me.log=console.debug.bind(console);uo.log=console.error.bind(console);var I=me.extend("quarry");async function Je({chain:e,userAddress:t}){let r=$e()({chain:e});I("Issuing gas pass to",t),await r.request({method:"quarry_issuePass",params:["0x01",t]}),I("Claiming gas allowance for",t),await r.request({method:"quarry_claimAllowance",params:["0x01",t]})}import{useClient as yo}from"wagmi";function et(){let e=ho(),{chain:t}=l(),r=yo({chainId:t.id}),o=["claimGasPass",t.id];return fo({mutationKey:o,onError:n=>console.error(n),mutationFn:async n=>{if(t.id===31337){if(!r)throw new Error("No client?");await Be({client:r,userAddress:n,allowance:go("1")})}else await Je({chain:t,userAddress:n});await Promise.all([e.invalidateQueries({queryKey:["getAllowance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])},retry:0})}import{twMerge as bo}from"tailwind-merge";import{jsx as X,jsxs as wo}from"react/jsx-runtime";function tt({className:e,...t}){return wo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 263 428",fill:"currentColor",className:bo("w-[0.6em] h-[1em]",e),...t,children:[X("path",{d:"M132 321V428L263 243L132 321Z"}),X("path",{d:"M0 243L132 321V428",fillOpacity:"0.5"}),X("path",{d:"M132 0V296L263 218"}),X("path",{d:"M0 218L132 296V0L0 218Z",fillOpacity:"0.5"})]})}import{formatEther as xo}from"viem";function rt(e){let t=xo(e),r=Math.floor(parseFloat(t)).toString().length;return parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:Math.max(0,6-r)})}import{formatEther as vo}from"viem";import{jsx as Co,jsxs as ko}from"react/jsx-runtime";function j({wei:e}){return ko("span",{className:"inline-flex items-center gap-1",title:vo(e),children:[rt(e)," ",Co(tt,{})]})}import{useEffect as So}from"react";import{jsx as H,jsxs as ue}from"react/jsx-runtime";function ot({isActive:e,isExpanded:t,userAddress:r}){let o=Le(r),n=et();return So(()=>{let a=setTimeout(()=>{e&&n.status==="idle"&&o.isSuccess&&o.data!=null&&o.data<P&&n.mutate(r)});return()=>clearTimeout(a)},[o.data,o.isSuccess,n,e,r]),ue("div",{className:"flex flex-col gap-4",children:[ue("div",{className:"flex justify-between gap-4",children:[ue("div",{children:[H("div",{children:"Allowance"}),H("div",{className:"font-mono text-white",children:o.data!=null?H(j,{wei:o.data}):H(b,{className:"text-sm"})})]}),H(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:o.status==="pending"||n.status==="pending",onClick:()=>n.mutate(r),children:"Top up"})]}),t?H("p",{className:"text-sm",children:"Your allowance is used to pay for onchain computation."}):null]})}import{encodeFunctionData as at}from"viem";import{useMutation as Oo,useQueryClient as zo}from"@tanstack/react-query";import{getAction as fe}from"viem/utils";import{sendUserOperation as qo,waitForUserOperationReceipt as Bo}from"viem/account-abstraction";import{waitForTransactionReceipt as Lo}from"viem/actions";import{useClient as Fo}from"wagmi";import{resourceToHex as it}from"@latticexyz/common";import Ko from"@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";import{writeContract as Mo}from"viem/actions";import{getAction as Io}from"viem/utils";import{toHex as Ao}from"viem";import{signTypedData as Po}from"viem/actions";import{callWithSignatureTypes as Uo}from"@latticexyz/world-module-callwithsignature/internal";import{getRecord as No}from"@latticexyz/store/internal";import Ro from"@latticexyz/world-module-callwithsignature/mud.config";import{hexToResource as Eo}from"@latticexyz/common";import{getAction as To}from"viem/utils";async function nt({userClient:e,worldAddress:t,systemId:r,callData:o,nonce:n,client:a}){let i=n??(a?(await No(a,{address:t,table:Ro.tables.CallWithSignatureNonces,key:{signer:e.account.address},blockTag:"pending"})).nonce:0n),{namespace:s,name:c}=Eo(r);return await To(e,Po,"signTypedData")({account:e.account,domain:{verifyingContract:t,salt:Ao(e.chain.id,{size:32})},types:Uo,primaryType:"Call",message:{signer:e.account.address,systemNamespace:s,systemName:c,callData:o,nonce:i}})}import Ho from"@latticexyz/world-module-callwithsignature/out/CallWithSignatureSystem.sol/CallWithSignatureSystem.abi.json";async function ge({sessionClient:e,...t}){let r=await nt(t);return Io(e,Mo,"writeContract")({address:t.worldAddress,abi:Ho,functionName:"callWithSignature",args:[t.userClient.account.address,t.systemId,t.callData,r]})}function st({userClient:e}){let t=zo(),{chainId:r,worldAddress:o}=l(),n=Fo({chainId:r}),a=["setupSession",n?.chain.id,e.account.address];return Oo({mutationKey:a,onError:i=>console.error(i),mutationFn:async({sessionClient:i,registerSpender:s,registerDelegation:c})=>{if(!n)throw new Error("Client not ready.");let g=h(n.chain),m=i.account.address;if(console.log("setting up session"),e.account.type==="smart"){let d=[];if(s&&g?.type==="quarry"&&(console.log("registering spender"),d.push({to:g.address,abi:se,functionName:"registerSpender",args:[m]})),c&&(console.log("registering delegation"),d.push({to:o,abi:Qe,functionName:"registerDelegation",args:[m,B,"0x"]})),!d.length)return;console.log("setting up account with",d,e);let p=await fe(e,qo,"sendUserOperation")({calls:d});console.log("got user op hash",p);let f=await fe(e,Bo,"waitForUserOperationReceipt")({hash:p});console.log("got user op receipt",f),f.success||console.error("not successful?",f)}else{let d=[];if(s&&g?.type==="quarry"){console.log("registering spender");let p=await ge({client:n,userClient:e,sessionClient:i,worldAddress:g.address,systemId:it({type:"system",namespace:"",name:"SpenderSystem"}),callData:at({abi:se,functionName:"registerSpender",args:[m]})});console.log("got spender tx",p),d.push(p)}if(c){console.log("registering delegation");let p=await ge({client:n,userClient:e,sessionClient:i,worldAddress:o,systemId:it({type:"system",namespace:"",name:"Registration"}),callData:at({abi:Ko,functionName:"registerDelegation",args:[m,B,"0x"]})});console.log("got delegation tx",p),d.push(p)}if(!d.length)return;console.log("waiting for",d.length,"receipts");for(let p of d){let f=await fe(n,Lo,"waitForTransactionReceipt")({hash:p});console.log("got tx receipt",f),f.status==="reverted"&&console.error("tx reverted?",f)}}await Promise.all([t.invalidateQueries({queryKey:["getSpender"]}),t.invalidateQueries({queryKey:["getDelegation"]}),t.invalidateQueries({queryKey:["getPrerequisites"]})])},retry:0})}import{useEffect as fn}from"react";import{useClient as pn}from"wagmi";import{queryOptions as mn,useQuery as un}from"@tanstack/react-query";import{smartAccountActions as dn}from"permissionless";import{callFrom as cn}from"@latticexyz/world/internal";import{createBundlerClient as Do}from"viem/account-abstraction";var Go=new Set([31337,17420,17069,690]);function lt(e){let t=e.chain??e.client?.chain,r=t?h(t):void 0;return Do({...De,paymaster:r?{getPaymasterData:async()=>({paymaster:r.address,paymasterData:"0x"})}:void 0,userOperation:{estimateFeesPerGas:t&&Go.has(t.id)?async()=>({maxFeePerGas:100000n,maxPriorityFeePerGas:0n}):void 0},...e})}import{transactionQueue as tn}from"@latticexyz/common/actions";import{createClient as rn,fallback as on,http as ht,keccak256 as nn,stringToHex as an,webSocket as sn}from"viem";import{privateKeyToAccount as ln}from"viem/accounts";import{createTransport as $o,numberToHex as Zo,parseEther as Jo}from"viem";import{entryPoint07Address as gt}from"viem/account-abstraction";import{formatUserOperationRequest as Qo}from"viem/account-abstraction";async function dt(e){return Qo({callGasLimit:20000000n,preVerificationGas:200000n,verificationGasLimit:2000000n,paymasterVerificationGasLimit:200000n,paymasterPostOpGasLimit:200000n})}import{parseEventLogs as Vo}from"viem";import{formatUserOperation as Wo,toPackedUserOperation as _o,getUserOperationHash as Yo,entryPoint07Address as ct,entryPoint07Abi as pt}from"viem/account-abstraction";import{waitForTransactionReceipt as Xo,writeContract as jo}from"viem/actions";import{getAction as mt}from"viem/utils";async function ut({executor:e,rpcUserOp:t}){let r=Wo(t),o=_o(r),n=Yo({userOperation:r,chainId:e.chain.id,entryPointVersion:"0.7",entryPointAddress:ct}),a=await mt(e,jo,"writeContract")({abi:pt,address:ct,functionName:"handleOps",args:[[o],e.account.address],chain:e.chain,account:e.account}),i=await mt(e,Xo,"waitForTransactionReceipt")({hash:a});return{success:Vo({logs:i.logs,abi:pt,eventName:"UserOperationEvent"})[0].args.success,userOpHash:n,receipt:i}}import{setBalance as en}from"viem/actions";function ft({executor:e}){return()=>{I("using a local user op executor",e.account.address),e.chain.id===31337&&(I("setting executor balance"),en(e.extend(()=>({mode:"anvil"})),{address:e.account.address,value:Jo("100")}));let t=new Map;return $o({key:"userOpExecutor",type:"userOpExecutor",name:"User Operation Executor Transport",request:async({method:o,params:n})=>{if(o==="eth_chainId")return Zo(e.chain.id);if(o==="eth_supportedEntryPoints")return[gt];if(o==="eth_sendUserOperation"){let[a,i]=n;if(i===gt){let s=await ut({executor:e,rpcUserOp:a});return t.set(s.userOpHash,s),s.userOpHash}}if(o==="eth_getUserOperationReceipt"){let[a]=n;return t.get(a)??null}if(o==="eth_estimateUserOperationGas")return await dt(n);throw new Error("Method not implemented.")}})}}function yt(e){let t=e.rpcUrls.bundler?.http[0],r=t?ht(t):e.id===31337?ft({executor:rn({chain:e,transport:on([sn(),ht()]),account:ln(nn(an("local user op executor"))),pollingInterval:10}).extend(tn())}):null;if(!r)throw new Error(`Chain ${e.id} config did not include a bundler RPC URL.`);return r}async function bt({client:e,userAddress:t,sessionAccount:r,worldAddress:o}){let n=yt(e.chain);return lt({transport:n,client:e,account:r}).extend(dn).extend(cn({worldAddress:o,delegatorAddress:t,publicClient:e})).extend(()=>({userAddress:t}))}function gn({sessionAccount:e,client:t,userAddress:r,worldAddress:o}){let n=["getSessionClient",t?.uid,r,e?.address,o];return mn(t&&r&&e?{queryKey:n,queryFn:()=>bt({sessionAccount:e,client:t,userAddress:r,worldAddress:o}),staleTime:1/0}:{queryKey:n,enabled:!1})}function $(e){let{chainId:t,worldAddress:r}=l(),o=pn({chainId:t}),{data:n}=Xe(e);return un(gn({sessionAccount:n,userAddress:e,client:o,worldAddress:r}))}import{jsx as K,jsxs as he}from"react/jsx-runtime";function wt({isActive:e,isExpanded:t,userClient:r,registerSpender:o,registerDelegation:n}){let a=$(r.account.address),i=st({userClient:r}),s=!n&&!n;return fn(()=>{let c=setTimeout(()=>{e&&i.status==="idle"&&a.data&&!s&&i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n})});return()=>clearTimeout(c)},[s,e,n,o,a,i]),he("div",{className:"flex flex-col gap-4",children:[he("div",{className:"flex justify-between gap-4",children:[he("div",{children:[K("div",{children:"Session"}),K("div",{className:"font-mono text-white",children:s?"Enabled":"Set up"})]}),s?K(y,{variant:"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,disabled:!0,children:"Enabled"}):K(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:!a.data||i.status==="pending",onClick:a.data?()=>i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n}):void 0,children:"Enable"})]}),t?K("p",{className:"text-sm",children:"You can perform actions in this app without interruptions for approvals."}):null]})}import{useBalance as vn}from"wagmi";var xt={"1":{bridgeUrl:"https://relay.link/bridge/ethereum"},"10":{bridgeUrl:"https://relay.link/bridge/optimism"},"56":{bridgeUrl:"https://relay.link/bridge/bnb"},"100":{bridgeUrl:"https://relay.link/bridge/gnosis"},"111":{bridgeUrl:"https://testnets.relay.link/bridge/bob"},"137":{bridgeUrl:"https://relay.link/bridge/polygon"},"185":{bridgeUrl:"https://relay.link/bridge/mint"},"288":{bridgeUrl:"https://relay.link/bridge/boba"},"324":{bridgeUrl:"https://relay.link/bridge/zksync"},"360":{bridgeUrl:"https://relay.link/bridge/shape"},"480":{bridgeUrl:"https://relay.link/bridge/world-chain"},"690":{bridgeUrl:"https://relay.link/bridge/redstone"},"919":{bridgeUrl:"https://testnets.relay.link/bridge/mode-testnet"},"1101":{bridgeUrl:"https://relay.link/bridge/polygon-zkevm"},"1135":{bridgeUrl:"https://relay.link/bridge/lisk"},"1301":{bridgeUrl:"https://testnets.relay.link/bridge/unichain-sepolia"},"1329":{bridgeUrl:"https://relay.link/bridge/sei"},"1625":{bridgeUrl:"https://relay.link/bridge/gravity"},"1868":{bridgeUrl:"https://relay.link/bridge/soneium"},"1993":{bridgeUrl:"https://testnets.relay.link/bridge/b3"},"1996":{bridgeUrl:"https://relay.link/bridge/sanko"},"2741":{bridgeUrl:"https://relay.link/bridge/abstract"},"2911":{bridgeUrl:"https://relay.link/bridge/hychain"},"4202":{bridgeUrl:"https://testnets.relay.link/bridge/lisk-sepolia"},"4321":{bridgeUrl:"https://relay.link/bridge/echos"},"5000":{bridgeUrl:"https://relay.link/bridge/mantle"},"5112":{bridgeUrl:"https://relay.link/bridge/ham"},"7560":{bridgeUrl:"https://relay.link/bridge/cyber"},"7865":{bridgeUrl:"https://relay.link/bridge/powerloom"},"7897":{bridgeUrl:"https://relay.link/bridge/arena-z"},"8333":{bridgeUrl:"https://relay.link/bridge/B3"},"8453":{bridgeUrl:"https://relay.link/bridge/base"},"9897":{bridgeUrl:"https://testnets.relay.link/bridge/arena-z-testnet"},"11011":{bridgeUrl:"https://testnets.relay.link/bridge/shape-sepolia"},"11124":{bridgeUrl:"https://testnets.relay.link/bridge/abstract"},"13746":{bridgeUrl:"https://testnets.relay.link/bridge/game7-testnet"},"17000":{bridgeUrl:"https://testnets.relay.link/bridge/holesky"},"17069":{bridgeUrl:"https://testnets.relay.link/bridge/garnet"},"17071":{bridgeUrl:"https://relay.link/bridge/onchain-points"},"33139":{bridgeUrl:"https://relay.link/bridge/apechain"},"33979":{bridgeUrl:"https://relay.link/bridge/funki"},"34443":{bridgeUrl:"https://relay.link/bridge/mode"},"42161":{bridgeUrl:"https://relay.link/bridge/arbitrum"},"42170":{bridgeUrl:"https://relay.link/bridge/arbitrum-nova"},"43114":{bridgeUrl:"https://relay.link/bridge/avalanche"},"55244":{bridgeUrl:"https://relay.link/bridge/superposition"},"57073":{bridgeUrl:"https://relay.link/bridge/ink"},"59144":{bridgeUrl:"https://relay.link/bridge/linea"},"60808":{bridgeUrl:"https://relay.link/bridge/bob"},"70700":{bridgeUrl:"https://relay.link/bridge/apex"},"70701":{bridgeUrl:"https://relay.link/bridge/boss"},"70800":{bridgeUrl:"https://testnets.relay.link/bridge/apex-testnet"},"70805":{bridgeUrl:"https://testnets.relay.link/bridge/cloud"},"80002":{bridgeUrl:"https://testnets.relay.link/bridge/amoy"},"81457":{bridgeUrl:"https://relay.link/bridge/blast"},"84532":{bridgeUrl:"https://testnets.relay.link/bridge/base-sepolia"},"167009":{bridgeUrl:"https://testnets.relay.link/bridge/hekla"},"421614":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-sepolia"},"534352":{bridgeUrl:"https://relay.link/bridge/scroll"},"543210":{bridgeUrl:"https://relay.link/bridge/zero-network"},"660279":{bridgeUrl:"https://relay.link/bridge/xai"},"911867":{bridgeUrl:"https://testnets.relay.link/bridge/odyssey"},"984122":{bridgeUrl:"https://relay.link/bridge/forma"},"1118190":{bridgeUrl:"https://testnets.relay.link/bridge/eclipse-testnet"},"3397901":{bridgeUrl:"https://testnets.relay.link/bridge/funki-testnet"},"4457845":{bridgeUrl:"https://testnets.relay.link/bridge/zero-sepolia"},"7777777":{bridgeUrl:"https://relay.link/bridge/zora"},"8253038":{bridgeUrl:"https://relay.link/bridge/bitcoin"},"9092725":{bridgeUrl:"https://testnets.relay.link/bridge/bitcoin-testnet4"},"9286185":{bridgeUrl:"https://relay.link/bridge/eclipse"},"11155111":{bridgeUrl:"https://testnets.relay.link/bridge/sepolia"},"11155420":{bridgeUrl:"https://testnets.relay.link/bridge/op-sepolia"},"666666666":{bridgeUrl:"https://relay.link/bridge/degen"},"792703809":{bridgeUrl:"https://relay.link/bridge/solana"},"888888888":{bridgeUrl:"https://relay.link/bridge/ancient8"},"999999999":{bridgeUrl:"https://testnets.relay.link/bridge/zora-sepolia"},"1380012617":{bridgeUrl:"https://relay.link/bridge/rari"},"1936682084":{bridgeUrl:"https://testnets.relay.link/bridge/solana-devnet"},"88153591557":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-blueberry"}};import{useQueryClient as yn,useMutation as bn}from"@tanstack/react-query";import{setBalance as wn}from"viem/actions";import{useClient as xn}from"wagmi";function vt(){let e=yn(),{chainId:t}=l(),r=xn({chainId:t});return bn({mutationKey:["setBalance",t],onError:o=>console.error(o),mutationFn:async o=>(r&&(await wn({...r,mode:"anvil"},o),await Promise.all([e.invalidateQueries({queryKey:["balance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])),null),retry:0})}import{Fragment as Cn,jsx as w,jsxs as D}from"react/jsx-runtime";function Ct({isActive:e,isExpanded:t,sessionAddress:r}){let{chain:o}=l(),n=vn({chainId:o.id,address:r,query:{refetchInterval:2e3}}),a=vt(),i=xt[o.id];return D("div",{className:"flex flex-col gap-4",children:[D("div",{className:"flex justify-between gap-4",children:[D("div",{children:[w("div",{children:"Gas balance"}),w("div",{className:"font-mono text-white",children:n.data!=null?w(j,{wei:n.data.value}):w(b,{className:"text-sm"})})]}),o.id===31337?w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending"||a.status==="pending",onClick:()=>a.mutate({address:r,value:P+(n.data?.value??0n)}),children:"Top up"}):i!=null?w("a",{href:`${i.bridgeUrl}?${new URLSearchParams({toAddress:r})}`,target:"_blank",rel:"noopener noreferrer",children:w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending",children:"Top up"})}):null]}),t?D(Cn,{children:[w("p",{className:"text-sm",children:"Your session's gas balance is used to pay for onchain computation."}),D("p",{className:"text-sm",children:["Send funds to"," ",w("span",{className:"font-mono text-white",children:w(M,{hex:r})})," ","on ",o.name," to top up your session balance."]})]}):null]})}import{jsx as U}from"react/jsx-runtime";function kt({userClient:e,initialUserAddress:t}){let{chain:r}=l(),o=h(r),n=e.account.address,{data:a}=T(n),{closeAccountModal:i}=C(),s=n!==t,c=An(a);kn(()=>{a!=null&&(c.current==null&&(c.current=a),a.complete&&(s||!c.current.complete)&&i())},[i,s,a]);let{sessionAddress:g,hasAllowance:m,isSpender:d,hasDelegation:p,hasGasBalance:f}=a??{},x=Sn(()=>{if(!n)return[{id:"wallet",isComplete:!1,content:()=>null}];let u=[{id:"wallet",isComplete:!0,content:v=>U(je,{...v,userAddress:n})}];return o?o.type==="quarry"&&u.push({id:"allowance",isComplete:!!m,content:v=>U(ot,{...v,userAddress:n})}):g!=null&&u.push({id:"gasBalance",isComplete:!!f,content:v=>U(Ct,{...v,sessionAddress:g})}),u.push({id:"session",isComplete:!!d&&!!p,content:v=>U(wt,{...v,userClient:e,registerSpender:!d,registerDelegation:!p})}),u},[m,p,f,d,o,g,n,e]),[we]=Pn(null),Ft=x.find(u=>u.content!=null&&!u.isComplete),te=x.filter(u=>u.isComplete),re=(we!=null?x.find(u=>u.id===we):null)??Ft??(te.length<x.length?te.at(-1):null),xe=re?x.indexOf(re):-1;return U("div",{className:ye("px-8 flex flex-col divide-y divide-neutral-800","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:x.map((u,v)=>{let oe=u===re,Kt=oe||te.length===x.length,Dt=!u.isComplete&&xe!==-1&&v>xe;return U("div",{className:ye("py-8 flex flex-col justify-center",oe?"flex-grow":null),children:U("div",{className:ye("flex flex-col",Dt?"opacity-30 pointer-events-none":null),children:u.content({isActive:oe,isExpanded:Kt})})},u.id)})})}import{useRef as Rn}from"react";import{jsx as St}from"react/jsx-runtime";function At(){let{chainId:e}=l(),t=Nn({chainId:e}),{address:r}=Un(),o=Rn(r);return t.status!=="success"?St(ze,{}):St(kt,{userClient:t.data,initialUserAddress:o.current})}import{useState as Hn}from"react";import{ErrorBoundary as On}from"react-error-boundary";import{twMerge as En}from"tailwind-merge";import{BaseError as Tn,UserRejectedRequestError as Mn}from"viem";import{jsx as Pt,jsxs as In}from"react/jsx-runtime";function Ut({title:e,error:t}){if(!t||t instanceof Tn&&t.walk(n=>n instanceof Mn)!=null)return null;let r=e??"Error",o=typeof t=="string"?t:t instanceof Error?String(t):"Something unexpected happened.";return In("div",{className:En("text-sm border-l-4 border-red-500","bg-red-100 text-red-900","dark:bg-red-900 dark:text-red-50"),children:[Pt("div",{className:"p-3 font-semibold",children:r}),Pt("div",{className:"px-3 whitespace-break-spaces break-all max-h-32 overflow-y-scroll",children:o})]})}import{wait as zn}from"@latticexyz/common/utils";import{twMerge as qn}from"tailwind-merge";import{useIsMounted as Bn}from"usehooks-ts";import{jsx as Z,jsxs as Nt}from"react/jsx-runtime";function Rt({children:e}){let t=Bn(),[r,o]=Hn(1);return Z(On,{fallbackRender:({error:n,resetErrorBoundary:a})=>Nt("div",{className:qn("flex-grow flex flex-col justify-center p-5 gap-2"),children:[Z(Ut,{error:n instanceof Error?n.stack??n.message:n}),r>0?Nt("button",{type:"button",onClick:async i=>{i.currentTarget.ariaBusy="true",await zn(1e3),a(),t()&&(o(s=>s-1),i.currentTarget.ariaBusy=null)},className:"group aria-busy:pointer-events-none self-end flex items-center gap-1",children:[Z(b,{className:"transition opacity-0 group-aria-busy:opacity-100 text-xs text-neutral-500 dark:text-neutral-400"}),Z("span",{className:"text-sm text-neutral-500 dark:text-neutral-400 group-hover:text-black dark:group-hover:text-white",children:"Retry?"})]}):null]}),children:e})}import{DialogClose as Kn,DialogTitle as Dn}from"@radix-ui/react-dialog";import{twMerge as Ln}from"tailwind-merge";import{jsx as Fn}from"react/jsx-runtime";function Et({className:e,children:t,...r}){return Fn("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:Ln("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...r,children:t})}import{jsx as Tt}from"react/jsx-runtime";function Mt(e){return Tt(Et,{strokeWidth:"2",stroke:"currentColor",...e,children:Tt("path",{d:"M6 18L18 6M6 6L18 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as k,jsxs as be}from"react/jsx-runtime";function Ht(){let{accountModalOpen:e,toggleAccountModal:t}=C();return be(Ie,{open:e,onOpenChange:t,children:[k(Dn,{className:"sr-only",children:"Connect with EntryKit"}),e?be("div",{className:It("relative py-2 ring-1","bg-neutral-900 text-neutral-400 ring-neutral-700/50 divide-neutral-700","links:font-medium links:underline links:underline-offset-4","links:text-white","links:decoration-neutral-500 hover:links:decoration-orange-500"),children:[k(Rt,{children:k(At,{})}),be("a",{href:"https://mud.dev",target:"_blank",rel:"noreferrer noopener",className:"group self-center p-3 flex items-center justify-center gap-2 links-unset text-sm font-mono transition text-neutral-400 hover:text-white",children:[k("span",{className:"block w-4 h-4",children:k(A,{className:"w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300"})}),k("span",{children:"Powered by MUD"})]}),k("div",{className:"absolute top-0 right-0",children:k(Kn,{className:It("pointer-events-auto leading-none p-2 transition","text-neutral-700 hover:text-neutral-500"),title:"Close",children:k(Mt,{className:"m-0"})})})]}):null]})}import{jsx as Qn,jsxs as Vn}from"react/jsx-runtime";function Gn({config:e,children:t}){return Vn(Ne,{config:e,children:[t,Qn(Ht,{})]})}import{useAccount as _n}from"wagmi";import{twMerge as N}from"tailwind-merge";import{twMerge as Ot}from"tailwind-merge";import{Fragment as Wn,jsx as J,jsxs as zt}from"react/jsx-runtime";function qt({address:e}){let{data:t}=Y(e),r=V(t?.avatar);return zt(Wn,{children:[zt("span",{className:"flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center",children:[J("img",{src:t?.avatar&&r.isSuccess?t.avatar:void 0,className:Ot("col-start-1 row-start-1","inline-flex w-full h-full rounded-full bg-black/10 dark:bg-white/10 bg-cover bg-no-repeat bg-center","transtion duration-300",r.isSuccess?"opacity-100":"opacity-0")}),J(A,{className:Ot("col-start-1 row-start-1 text-orange-500","transition duration-300",t&&(!t.avatar||r.isError)?"opacity-100":"opacity-0")})]}),J("span",{className:"flex-grow",children:t?.name??J(M,{hex:e})})]})}import{useRef as Yn}from"react";import{jsx as S,jsxs as Lt}from"react/jsx-runtime";var Bt=N("w-48 p-3 inline-flex outline-none transition","border border-transparent","text-base leading-none"),Xn=N("bg-neutral-100 border-neutral-300 text-black","dark:bg-neutral-800 dark:border-neutral-700 dark:text-white"),jn=N("cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700");function $n(){let{openAccountModal:e,accountModalOpen:t}=C(),{status:r,address:o}=_n(),n=Yn(o),a=T(o),i=r==="connected"||r==="reconnecting"&&o,s=o!==n.current,c=a.isSuccess?a.data.complete:s?!1:i,g=(()=>{if(a.isSuccess){if(!a.data.hasAllowance)return"Top up";if(!a.data.hasDelegation||!a.data.isSpender)return"Set up"}return"Sign in"})();return S(G,{mode:"child",children:c?S("button",{type:"button",className:N(Bt,Xn,jn),onClick:e,children:S("span",{className:"flex-grow inline-flex gap-2.5 items-center text-left font-medium",children:o?S(qt,{address:o}):null})},"connected"):Lt("button",{type:"button",className:N(Bt,"group","items-center justify-center gap-2.5","bg-orange-500 text-white font-medium","hover:bg-orange-400","active:bg-orange-600"),"aria-busy":t,onClick:e,children:[Lt("span",{className:"pointer-events-none inline-grid place-items-center -ml-3",children:[S("span",{className:N("col-start-1 row-start-1 leading-none","scale-100 opacity-100 transition duration-300","group-aria-busy:scale-125 group-aria-busy:opacity-0"),children:S(A,{})}),S("span",{"aria-hidden":!0,className:N("col-start-1 row-start-1","scale-50 opacity-0 transition duration-300 delay-50","group-aria-busy:scale-100 group-aria-busy:opacity-100"),children:S(b,{})})]}),S("span",{className:"font-medium",children:g})]},"sign in")})}import{useConnectorClient as Zn}from"wagmi";function Jn(){let{chainId:e}=l(),t=Zn({chainId:e});t.error&&console.error("Error retrieving user client",t.error);let r=t.data?.account.address,o=T(r),n=$(r);return t.isSuccess?!o.isSuccess||!o.data.complete?{...o,data:void 0}:n:{...t,data:void 0}}import{connectorsForWallets as ta}from"@rainbow-me/rainbowkit";import{createConfig as ra}from"wagmi";import{getDefaultWallets as ea}from"@rainbow-me/rainbowkit";function ee(e){let{wallets:t}=ea();return[...t]}function oa(e){let t=ee(e),r=ta(t,{appName:e.appName,projectId:e.walletConnectProjectId});return ra({connectors:r,chains:e.chains,transports:e.transports,pollingInterval:e.pollingInterval})}import{connectorsForWallets as na}from"@rainbow-me/rainbowkit";function wm({wallets:e,...t}){return na(e??ee(t),{appName:t.appName,projectId:t.walletConnectProjectId})}export{$n as AccountButton,Gn as EntryKitProvider,oa as createWagmiConfig,Gt as defineConfig,wm as getConnectors,ee as getWallets,C as useAccountModal,l as useEntryKitConfig,Jn as useSessionClient};
|
|
1445
1398
|
//# sourceMappingURL=internal.js.map
|