@latticexyz/entrykit 2.2.22-b94aca694dd82b32bf78de9e6408f61b32e5b8e2 → 2.2.22-bb5f22149ba1a84863dedc68625cc7bc2626c012
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.
|
@@ -22,7 +22,7 @@ import { forwardRef, useEffect, useRef, useState } from "react";
|
|
|
22
22
|
import ReactDOM from "react-dom";
|
|
23
23
|
|
|
24
24
|
// ../../node_modules/.pnpm/tailwindcss@3.4.13/node_modules/tailwindcss/tailwind.css?inline
|
|
25
|
-
var tailwind_default = '*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}/*\n! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: \'\';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user\'s configured `sans` font-family by default.\n5. Use the user\'s configured `sans` font-feature-settings by default.\n6. Use the user\'s configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */ /* 3 */\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user\'s configured `mono` font-family by default.\n2. Use the user\'s configured `mono` font-feature-settings by default.\n3. Use the user\'s configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type=\'button\']),\ninput:where([type=\'reset\']),\ninput:where([type=\'submit\']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type=\'search\'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user\'s configured gray 400 color.\n*/\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role="button"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don\'t get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n.container {\n width: 100%;\n}\n\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\n\n.grid-cols-2.divide-y > :not([hidden]) ~ :not([hidden]):nth-child(-n + 2) {\n border-top-width: 0;\n border-bottom-width: 0;\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.pointer-events-auto {\n pointer-events: auto;\n}\n\n.fixed {\n position: fixed;\n}\n\n.absolute {\n position: absolute;\n}\n\n.relative {\n position: relative;\n}\n\n.sticky {\n position: sticky;\n}\n\n.inset-0 {\n inset: 0px;\n}\n\n.bottom-0 {\n bottom: 0px;\n}\n\n.left-0 {\n left: 0px;\n}\n\n.right-0 {\n right: 0px;\n}\n\n.top-0 {\n top: 0px;\n}\n\n.col-start-1 {\n grid-column-start: 1;\n}\n\n.row-start-1 {\n grid-row-start: 1;\n}\n\n.m-0 {\n margin: 0px;\n}\n\n.m-2 {\n margin: 0.5rem;\n}\n\n.-mx-0\\.5 {\n margin-left: -0.125rem;\n margin-right: -0.125rem;\n}\n\n.-my-1 {\n margin-top: -0.25rem;\n margin-bottom: -0.25rem;\n}\n\n.-my-\\[0\\.125em\\] {\n margin-top: -0.125em;\n margin-bottom: -0.125em;\n}\n\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n\n.-ml-3 {\n margin-left: -0.75rem;\n}\n\n.-mt-2 {\n margin-top: -0.5rem;\n}\n\n.block {\n display: block;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.table {\n display: table;\n}\n\n.grid {\n display: grid;\n}\n\n.inline-grid {\n display: inline-grid;\n}\n\n.contents {\n display: contents;\n}\n\n.hidden {\n display: none;\n}\n\n.h-12 {\n height: 3rem;\n}\n\n.h-16 {\n height: 4rem;\n}\n\n.h-4 {\n height: 1rem;\n}\n\n.h-6 {\n height: 1.5rem;\n}\n\n.h-64 {\n height: 16rem;\n}\n\n.h-\\[1\\.25em\\] {\n height: 1.25em;\n}\n\n.h-\\[1em\\] {\n height: 1em;\n}\n\n.h-full {\n height: 100%;\n}\n\n.max-h-full {\n max-height: 100%;\n}\n\n.min-h-\\[22rem\\] {\n min-height: 22rem;\n}\n\n.min-h-\\[26rem\\] {\n min-height: 26rem;\n}\n\n.w-16 {\n width: 4rem;\n}\n\n.w-24 {\n width: 6rem;\n}\n\n.w-28 {\n width: 7rem;\n}\n\n.w-4 {\n width: 1rem;\n}\n\n.w-48 {\n width: 12rem;\n}\n\n.w-6 {\n width: 1.5rem;\n}\n\n.w-60 {\n width: 15rem;\n}\n\n.w-\\[0\\.6em\\] {\n width: 0.6em;\n}\n\n.w-\\[1\\.25em\\] {\n width: 1.25em;\n}\n\n.w-full {\n width: 100%;\n}\n\n.max-w-\\[26rem\\] {\n max-width: 26rem;\n}\n\n.flex-shrink-0 {\n flex-shrink: 0;\n}\n\n.flex-grow {\n flex-grow: 1;\n}\n\n.-translate-y-2 {\n --tw-translate-y: -0.5rem;\n 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));\n}\n\n.-translate-y-4 {\n --tw-translate-y: -1rem;\n 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));\n}\n\n.translate-x-2 {\n --tw-translate-x: 0.5rem;\n 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));\n}\n\n.translate-y-0 {\n --tw-translate-y: 0px;\n 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));\n}\n\n.scale-100 {\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n 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));\n}\n\n.scale-50 {\n --tw-scale-x: .5;\n --tw-scale-y: .5;\n 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));\n}\n\n@keyframes spin {\n\n to {\n transform: rotate(360deg);\n }\n}\n\n.animate-spin {\n animation: spin 1s linear infinite;\n}\n\n.cursor-pointer {\n cursor: pointer;\n}\n\n.grid-cols-\\[1fr_auto_1fr\\] {\n grid-template-columns: 1fr auto 1fr;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.place-items-center {\n place-items: center;\n}\n\n.items-end {\n align-items: flex-end;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-end {\n justify-content: flex-end;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.gap-1 {\n gap: 0.25rem;\n}\n\n.gap-2 {\n gap: 0.5rem;\n}\n\n.gap-2\\.5 {\n gap: 0.625rem;\n}\n\n.gap-4 {\n gap: 1rem;\n}\n\n.gap-6 {\n gap: 1.5rem;\n}\n\n.space-y-6 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));\n}\n\n.divide-y > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-y-reverse: 0;\n border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));\n border-bottom-width: calc(1px * var(--tw-divide-y-reverse));\n}\n\n.divide-neutral-800 > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-opacity: 1;\n border-color: rgb(38 38 38 / var(--tw-divide-opacity));\n}\n\n.self-auto {\n align-self: auto;\n}\n\n.self-center {\n align-self: center;\n}\n\n.overflow-auto {\n overflow: auto;\n}\n\n.overflow-clip {\n overflow: clip;\n}\n\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.border {\n border-width: 1px;\n}\n\n.border-4 {\n border-width: 4px;\n}\n\n.border-neutral-300 {\n --tw-border-opacity: 1;\n border-color: rgb(212 212 212 / var(--tw-border-opacity));\n}\n\n.border-transparent {\n border-color: transparent;\n}\n\n.bg-black\\/10 {\n background-color: rgb(0 0 0 / 0.1);\n}\n\n.bg-blue-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity));\n}\n\n.bg-blue-700 {\n --tw-bg-opacity: 1;\n background-color: rgb(29 78 216 / var(--tw-bg-opacity));\n}\n\n.bg-blue-700\\/60 {\n background-color: rgb(29 78 216 / 0.6);\n}\n\n.bg-neutral-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(245 245 245 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-700 {\n --tw-bg-opacity: 1;\n background-color: rgb(64 64 64 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-800 {\n --tw-bg-opacity: 1;\n background-color: rgb(38 38 38 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-800\\/85 {\n background-color: rgb(38 38 38 / 0.85);\n}\n\n.bg-neutral-900 {\n --tw-bg-opacity: 1;\n background-color: rgb(23 23 23 / var(--tw-bg-opacity));\n}\n\n.bg-orange-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(249 115 22 / var(--tw-bg-opacity));\n}\n\n.bg-orange-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(234 88 12 / var(--tw-bg-opacity));\n}\n\n.bg-gradient-to-b {\n background-image: linear-gradient(to bottom, var(--tw-gradient-stops));\n}\n\n.from-transparent {\n --tw-gradient-from: transparent var(--tw-gradient-from-position);\n --tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);\n}\n\n.to-blue-700 {\n --tw-gradient-to: #1d4ed8 var(--tw-gradient-to-position);\n}\n\n.bg-cover {\n background-size: cover;\n}\n\n.bg-center {\n background-position: center;\n}\n\n.bg-no-repeat {\n background-repeat: no-repeat;\n}\n\n.object-cover {\n object-fit: cover;\n}\n\n.p-1 {\n padding: 0.25rem;\n}\n\n.p-2 {\n padding: 0.5rem;\n}\n\n.p-3 {\n padding: 0.75rem;\n}\n\n.p-4 {\n padding: 1rem;\n}\n\n.p-6 {\n padding: 1.5rem;\n}\n\n.p-\\[\\.75em\\] {\n padding: .75em;\n}\n\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.py-8 {\n padding-top: 2rem;\n padding-bottom: 2rem;\n}\n\n.pb-8 {\n padding-bottom: 2rem;\n}\n\n.pt-8 {\n padding-top: 2rem;\n}\n\n.text-left {\n text-align: left;\n}\n\n.text-center {\n text-align: center;\n}\n\n.font-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n}\n\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n\n.text-\\[\\.75em\\] {\n font-size: .75em;\n}\n\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.font-bold {\n font-weight: 700;\n}\n\n.font-medium {\n font-weight: 500;\n}\n\n.leading-none {\n line-height: 1;\n}\n\n.tracking-\\[-1ch\\] {\n letter-spacing: -1ch;\n}\n\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n\n.text-neutral-400 {\n --tw-text-opacity: 1;\n color: rgb(163 163 163 / var(--tw-text-opacity));\n}\n\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity));\n}\n\n.text-transparent {\n color: transparent;\n}\n\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.text-white\\/20 {\n color: rgb(255 255 255 / 0.2);\n}\n\n.text-white\\/80 {\n color: rgb(255 255 255 / 0.8);\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.opacity-100 {\n opacity: 1;\n}\n\n.opacity-25 {\n opacity: 0.25;\n}\n\n.opacity-30 {\n opacity: 0.3;\n}\n\n.opacity-75 {\n opacity: 0.75;\n}\n\n.outline-none {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.ring-1 {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n\n.ring-neutral-700\\/50 {\n --tw-ring-color: rgb(64 64 64 / 0.5);\n}\n\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.duration-100 {\n transition-duration: 100ms;\n}\n\n.duration-300 {\n transition-duration: 300ms;\n}\n\n@keyframes enter {\n\n from {\n opacity: var(--tw-enter-opacity, 1);\n transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0));\n }\n}\n\n@keyframes exit {\n\n to {\n opacity: var(--tw-exit-opacity, 1);\n transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));\n }\n}\n\n.animate-in {\n animation-name: enter;\n animation-duration: 150ms;\n --tw-enter-opacity: initial;\n --tw-enter-scale: initial;\n --tw-enter-rotate: initial;\n --tw-enter-translate-x: initial;\n --tw-enter-translate-y: initial;\n}\n\n.fade-in {\n --tw-enter-opacity: 0;\n}\n\n.slide-in-from-bottom-16 {\n --tw-enter-translate-y: 4rem;\n}\n\n.slide-in-from-bottom-8 {\n --tw-enter-translate-y: 2rem;\n}\n\n.animate-duration-300 {\n animation-duration: 300ms;\n}\n\n@property --tw-border-gradient-angle {\n syntax: \'<angle>\';\n inherits: true;\n initial-value: 0deg;\n}\n\n@property --tw-conic-gradient-angle {\n syntax: \'<angle>\';\n inherits: true;\n initial-value: 0deg;\n}\n\n@keyframes border-gradient {\n\n to {\n --tw-border-gradient-angle: 360deg;\n }\n}\n\n.after\\:select-none::after {\n content: var(--tw-content);\n -webkit-user-select: none;\n user-select: none;\n}\n\n.after\\:content-\\[\\\'\\2026\\\'\\]::after {\n --tw-content: \'\u2026\';\n content: var(--tw-content);\n}\n\n.hover\\:bg-blue-500:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n\n.hover\\:bg-neutral-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 229 229 / var(--tw-bg-opacity));\n}\n\n.hover\\:bg-orange-400:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(251 146 60 / var(--tw-bg-opacity));\n}\n\n.hover\\:text-white:hover {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.hover\\:text-white\\/40:hover {\n color: rgb(255 255 255 / 0.4);\n}\n\n.hover\\:brightness-125:hover {\n --tw-brightness: brightness(1.25);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n\n.focus\\:border-orange-500:focus {\n --tw-border-opacity: 1;\n border-color: rgb(249 115 22 / var(--tw-border-opacity));\n}\n\n.focus\\:border-yellow-400:focus {\n --tw-border-opacity: 1;\n border-color: rgb(250 204 21 / var(--tw-border-opacity));\n}\n\n.active\\:bg-orange-600:active {\n --tw-bg-opacity: 1;\n background-color: rgb(234 88 12 / var(--tw-bg-opacity));\n}\n\n.active\\:brightness-150:active {\n --tw-brightness: brightness(1.5);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n\n.group:hover .group-hover\\:rotate-90 {\n --tw-rotate: 90deg;\n 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));\n}\n\n.aria-busy\\:pointer-events-none[aria-busy="true"] {\n pointer-events: none;\n}\n\n.aria-busy\\:bg-blue-500[aria-busy="true"] {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n\n.aria-disabled\\:pointer-events-none[aria-disabled="true"] {\n pointer-events: none;\n}\n\n.aria-disabled\\:opacity-50[aria-disabled="true"] {\n opacity: 0.5;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:inline {\n display: inline;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:hidden {\n display: none;\n}\n\n.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:translate-x-0 {\n --tw-translate-x: 0px;\n 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));\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:scale-100 {\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n 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));\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:scale-125 {\n --tw-scale-x: 1.25;\n --tw-scale-y: 1.25;\n 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));\n}\n\n.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:opacity-100 {\n opacity: 1;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:opacity-0 {\n opacity: 0;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:opacity-100 {\n opacity: 1;\n}\n\n.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:duration-300 {\n transition-duration: 300ms;\n}\n\n.data-\\[highlighted\\]\\:bg-neutral-200[data-highlighted] {\n --tw-bg-opacity: 1;\n background-color: rgb(229 229 229 / var(--tw-bg-opacity));\n}\n\n.links\\:font-medium a[href]:not(.links-unset) {\n font-weight: 500;\n}\n\n.links\\:text-white a[href]:not(.links-unset) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.links\\:underline a[href]:not(.links-unset) {\n text-decoration-line: underline;\n}\n\n.links\\:decoration-neutral-500 a[href]:not(.links-unset) {\n text-decoration-color: #737373;\n}\n\n.links\\:underline-offset-4 a[href]:not(.links-unset) {\n text-underline-offset: 4px;\n}\n\n.hover\\:links\\:decoration-orange-500 a[href]:not(.links-unset):hover {\n text-decoration-color: #f97316;\n}\n\n@media (min-width: 640px) {\n\n .sm\\:items-center {\n align-items: center;\n }\n}\n\n.dark\\:border-neutral-700:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-border-opacity: 1;\n border-color: rgb(64 64 64 / var(--tw-border-opacity));\n}\n\n.dark\\:bg-neutral-800:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-bg-opacity: 1;\n background-color: rgb(38 38 38 / var(--tw-bg-opacity));\n}\n\n.dark\\:bg-white\\/10:where([data-theme="dark"], [data-theme="dark"] *) {\n background-color: rgb(255 255 255 / 0.1);\n}\n\n.dark\\:text-white:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.dark\\:hover\\:bg-neutral-700:hover:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-bg-opacity: 1;\n background-color: rgb(64 64 64 / var(--tw-bg-opacity));\n}\n';
|
|
25
|
+
var tailwind_default = '*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}/*\n! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: \'\';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user\'s configured `sans` font-family by default.\n5. Use the user\'s configured `sans` font-feature-settings by default.\n6. Use the user\'s configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */ /* 3 */\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user\'s configured `mono` font-family by default.\n2. Use the user\'s configured `mono` font-feature-settings by default.\n3. Use the user\'s configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type=\'button\']),\ninput:where([type=\'reset\']),\ninput:where([type=\'submit\']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type=\'search\'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user\'s configured gray 400 color.\n*/\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role="button"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don\'t get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n.container {\n width: 100%;\n}\n\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\n\n.grid-cols-2.divide-y > :not([hidden]) ~ :not([hidden]):nth-child(-n + 2) {\n border-top-width: 0;\n border-bottom-width: 0;\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.pointer-events-auto {\n pointer-events: auto;\n}\n\n.fixed {\n position: fixed;\n}\n\n.absolute {\n position: absolute;\n}\n\n.relative {\n position: relative;\n}\n\n.sticky {\n position: sticky;\n}\n\n.inset-0 {\n inset: 0px;\n}\n\n.bottom-0 {\n bottom: 0px;\n}\n\n.left-0 {\n left: 0px;\n}\n\n.right-0 {\n right: 0px;\n}\n\n.top-0 {\n top: 0px;\n}\n\n.col-start-1 {\n grid-column-start: 1;\n}\n\n.row-start-1 {\n grid-row-start: 1;\n}\n\n.m-0 {\n margin: 0px;\n}\n\n.m-2 {\n margin: 0.5rem;\n}\n\n.-mx-0\\.5 {\n margin-left: -0.125rem;\n margin-right: -0.125rem;\n}\n\n.-my-1 {\n margin-top: -0.25rem;\n margin-bottom: -0.25rem;\n}\n\n.-my-\\[0\\.125em\\] {\n margin-top: -0.125em;\n margin-bottom: -0.125em;\n}\n\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n\n.-ml-3 {\n margin-left: -0.75rem;\n}\n\n.-mr-1 {\n margin-right: -0.25rem;\n}\n\n.-mt-2 {\n margin-top: -0.5rem;\n}\n\n.mt-1 {\n margin-top: 0.25rem;\n}\n\n.mt-4 {\n margin-top: 1rem;\n}\n\n.block {\n display: block;\n}\n\n.inline-block {\n display: inline-block;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.table {\n display: table;\n}\n\n.grid {\n display: grid;\n}\n\n.inline-grid {\n display: inline-grid;\n}\n\n.contents {\n display: contents;\n}\n\n.hidden {\n display: none;\n}\n\n.aspect-square {\n aspect-ratio: 1 / 1;\n}\n\n.h-10 {\n height: 2.5rem;\n}\n\n.h-12 {\n height: 3rem;\n}\n\n.h-16 {\n height: 4rem;\n}\n\n.h-3 {\n height: 0.75rem;\n}\n\n.h-3\\.5 {\n height: 0.875rem;\n}\n\n.h-4 {\n height: 1rem;\n}\n\n.h-6 {\n height: 1.5rem;\n}\n\n.h-64 {\n height: 16rem;\n}\n\n.h-\\[1\\.25em\\] {\n height: 1.25em;\n}\n\n.h-\\[1em\\] {\n height: 1em;\n}\n\n.h-\\[2px\\] {\n height: 2px;\n}\n\n.h-full {\n height: 100%;\n}\n\n.max-h-\\[230px\\] {\n max-height: 230px;\n}\n\n.max-h-full {\n max-height: 100%;\n}\n\n.w-10 {\n width: 2.5rem;\n}\n\n.w-16 {\n width: 4rem;\n}\n\n.w-24 {\n width: 6rem;\n}\n\n.w-28 {\n width: 7rem;\n}\n\n.w-3 {\n width: 0.75rem;\n}\n\n.w-3\\.5 {\n width: 0.875rem;\n}\n\n.w-4 {\n width: 1rem;\n}\n\n.w-48 {\n width: 12rem;\n}\n\n.w-6 {\n width: 1.5rem;\n}\n\n.w-60 {\n width: 15rem;\n}\n\n.w-8 {\n width: 2rem;\n}\n\n.w-\\[0\\.6em\\] {\n width: 0.6em;\n}\n\n.w-\\[1\\.25em\\] {\n width: 1.25em;\n}\n\n.w-\\[352px\\] {\n width: 352px;\n}\n\n.w-full {\n width: 100%;\n}\n\n.max-w-\\[26rem\\] {\n max-width: 26rem;\n}\n\n.flex-shrink-0 {\n flex-shrink: 0;\n}\n\n.flex-grow {\n flex-grow: 1;\n}\n\n.-translate-y-2 {\n --tw-translate-y: -0.5rem;\n 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));\n}\n\n.-translate-y-4 {\n --tw-translate-y: -1rem;\n 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));\n}\n\n.translate-x-2 {\n --tw-translate-x: 0.5rem;\n 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));\n}\n\n.translate-y-0 {\n --tw-translate-y: 0px;\n 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));\n}\n\n.scale-100 {\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n 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));\n}\n\n.scale-50 {\n --tw-scale-x: .5;\n --tw-scale-y: .5;\n 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));\n}\n\n.transform {\n 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));\n}\n\n@keyframes spin {\n\n to {\n transform: rotate(360deg);\n }\n}\n\n.animate-spin {\n animation: spin 1s linear infinite;\n}\n\n.cursor-pointer {\n cursor: pointer;\n}\n\n.cursor-text {\n cursor: text;\n}\n\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.grid-cols-\\[1fr_auto_1fr\\] {\n grid-template-columns: 1fr auto 1fr;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.place-items-center {\n place-items: center;\n}\n\n.items-end {\n align-items: flex-end;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-end {\n justify-content: flex-end;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.gap-1 {\n gap: 0.25rem;\n}\n\n.gap-2 {\n gap: 0.5rem;\n}\n\n.gap-2\\.5 {\n gap: 0.625rem;\n}\n\n.gap-4 {\n gap: 1rem;\n}\n\n.gap-5 {\n gap: 1.25rem;\n}\n\n.gap-6 {\n gap: 1.5rem;\n}\n\n.space-y-6 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));\n}\n\n.divide-y > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-y-reverse: 0;\n border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));\n border-bottom-width: calc(1px * var(--tw-divide-y-reverse));\n}\n\n.divide-neutral-700 > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-opacity: 1;\n border-color: rgb(64 64 64 / var(--tw-divide-opacity));\n}\n\n.divide-neutral-800 > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-opacity: 1;\n border-color: rgb(38 38 38 / var(--tw-divide-opacity));\n}\n\n.self-auto {\n align-self: auto;\n}\n\n.self-center {\n align-self: center;\n}\n\n.overflow-auto {\n overflow: auto;\n}\n\n.overflow-clip {\n overflow: clip;\n}\n\n.overflow-y-auto {\n overflow-y: auto;\n}\n\n.whitespace-nowrap {\n white-space: nowrap;\n}\n\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.border {\n border-width: 1px;\n}\n\n.border-2 {\n border-width: 2px;\n}\n\n.border-4 {\n border-width: 4px;\n}\n\n.border-dashed {\n border-style: dashed;\n}\n\n.border-neutral-300 {\n --tw-border-opacity: 1;\n border-color: rgb(212 212 212 / var(--tw-border-opacity));\n}\n\n.border-neutral-700 {\n --tw-border-opacity: 1;\n border-color: rgb(64 64 64 / var(--tw-border-opacity));\n}\n\n.border-transparent {\n border-color: transparent;\n}\n\n.border-white\\/50 {\n border-color: rgb(255 255 255 / 0.5);\n}\n\n.bg-black\\/10 {\n background-color: rgb(0 0 0 / 0.1);\n}\n\n.bg-blue-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity));\n}\n\n.bg-blue-700 {\n --tw-bg-opacity: 1;\n background-color: rgb(29 78 216 / var(--tw-bg-opacity));\n}\n\n.bg-blue-700\\/60 {\n background-color: rgb(29 78 216 / 0.6);\n}\n\n.bg-green-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(22 163 74 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(245 245 245 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-700 {\n --tw-bg-opacity: 1;\n background-color: rgb(64 64 64 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-800 {\n --tw-bg-opacity: 1;\n background-color: rgb(38 38 38 / var(--tw-bg-opacity));\n}\n\n.bg-neutral-800\\/85 {\n background-color: rgb(38 38 38 / 0.85);\n}\n\n.bg-neutral-900 {\n --tw-bg-opacity: 1;\n background-color: rgb(23 23 23 / var(--tw-bg-opacity));\n}\n\n.bg-orange-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(249 115 22 / var(--tw-bg-opacity));\n}\n\n.bg-orange-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(234 88 12 / var(--tw-bg-opacity));\n}\n\n.bg-red-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(220 38 38 / var(--tw-bg-opacity));\n}\n\n.bg-transparent {\n background-color: transparent;\n}\n\n.bg-gradient-to-b {\n background-image: linear-gradient(to bottom, var(--tw-gradient-stops));\n}\n\n.from-transparent {\n --tw-gradient-from: transparent var(--tw-gradient-from-position);\n --tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);\n}\n\n.to-blue-700 {\n --tw-gradient-to: #1d4ed8 var(--tw-gradient-to-position);\n}\n\n.bg-cover {\n background-size: cover;\n}\n\n.bg-center {\n background-position: center;\n}\n\n.bg-no-repeat {\n background-repeat: no-repeat;\n}\n\n.object-cover {\n object-fit: cover;\n}\n\n.p-1 {\n padding: 0.25rem;\n}\n\n.p-2 {\n padding: 0.5rem;\n}\n\n.p-2\\.5 {\n padding: 0.625rem;\n}\n\n.p-3 {\n padding: 0.75rem;\n}\n\n.p-4 {\n padding: 1rem;\n}\n\n.p-6 {\n padding: 1.5rem;\n}\n\n.p-\\[\\.75em\\] {\n padding: .75em;\n}\n\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.py-8 {\n padding-top: 2rem;\n padding-bottom: 2rem;\n}\n\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n\n.pb-8 {\n padding-bottom: 2rem;\n}\n\n.pt-10 {\n padding-top: 2.5rem;\n}\n\n.pt-8 {\n padding-top: 2rem;\n}\n\n.text-left {\n text-align: left;\n}\n\n.text-center {\n text-align: center;\n}\n\n.font-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n}\n\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n\n.text-\\[\\.75em\\] {\n font-size: .75em;\n}\n\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.font-bold {\n font-weight: 700;\n}\n\n.font-medium {\n font-weight: 500;\n}\n\n.leading-loose {\n line-height: 2;\n}\n\n.leading-none {\n line-height: 1;\n}\n\n.tracking-\\[-1ch\\] {\n letter-spacing: -1ch;\n}\n\n.text-amber-500 {\n --tw-text-opacity: 1;\n color: rgb(245 158 11 / var(--tw-text-opacity));\n}\n\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n\n.text-gray-400 {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity));\n}\n\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity));\n}\n\n.text-neutral-300 {\n --tw-text-opacity: 1;\n color: rgb(212 212 212 / var(--tw-text-opacity));\n}\n\n.text-neutral-400 {\n --tw-text-opacity: 1;\n color: rgb(163 163 163 / var(--tw-text-opacity));\n}\n\n.text-neutral-500 {\n --tw-text-opacity: 1;\n color: rgb(115 115 115 / var(--tw-text-opacity));\n}\n\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity));\n}\n\n.text-transparent {\n color: transparent;\n}\n\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.text-white\\/20 {\n color: rgb(255 255 255 / 0.2);\n}\n\n.text-white\\/50 {\n color: rgb(255 255 255 / 0.5);\n}\n\n.text-white\\/80 {\n color: rgb(255 255 255 / 0.8);\n}\n\n.underline {\n text-decoration-line: underline;\n}\n\n.decoration-neutral-500 {\n text-decoration-color: #737373;\n}\n\n.underline-offset-4 {\n text-underline-offset: 4px;\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.opacity-100 {\n opacity: 1;\n}\n\n.opacity-25 {\n opacity: 0.25;\n}\n\n.opacity-30 {\n opacity: 0.3;\n}\n\n.opacity-50 {\n opacity: 0.5;\n}\n\n.opacity-75 {\n opacity: 0.75;\n}\n\n.outline-none {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.ring-1 {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n\n.ring-2 {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n\n.ring-neutral-700\\/50 {\n --tw-ring-color: rgb(64 64 64 / 0.5);\n}\n\n.ring-transparent {\n --tw-ring-color: transparent;\n}\n\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.transition-colors {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.duration-100 {\n transition-duration: 100ms;\n}\n\n.duration-300 {\n transition-duration: 300ms;\n}\n\n.ease-linear {\n transition-timing-function: linear;\n}\n\n@keyframes enter {\n\n from {\n opacity: var(--tw-enter-opacity, 1);\n transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0));\n }\n}\n\n@keyframes exit {\n\n to {\n opacity: var(--tw-exit-opacity, 1);\n transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));\n }\n}\n\n.animate-in {\n animation-name: enter;\n animation-duration: 150ms;\n --tw-enter-opacity: initial;\n --tw-enter-scale: initial;\n --tw-enter-rotate: initial;\n --tw-enter-translate-x: initial;\n --tw-enter-translate-y: initial;\n}\n\n.animate-out {\n animation-name: exit;\n animation-duration: 150ms;\n --tw-exit-opacity: initial;\n --tw-exit-scale: initial;\n --tw-exit-rotate: initial;\n --tw-exit-translate-x: initial;\n --tw-exit-translate-y: initial;\n}\n\n.fade-in {\n --tw-enter-opacity: 0;\n}\n\n.fade-out {\n --tw-exit-opacity: 0;\n}\n\n.slide-in-from-bottom-16 {\n --tw-enter-translate-y: 4rem;\n}\n\n.slide-in-from-bottom-2 {\n --tw-enter-translate-y: 0.5rem;\n}\n\n.slide-in-from-bottom-8 {\n --tw-enter-translate-y: 2rem;\n}\n\n.slide-in-from-top-2 {\n --tw-enter-translate-y: -0.5rem;\n}\n\n.animate-duration-300 {\n animation-duration: 300ms;\n}\n\n.ease-linear {\n animation-timing-function: linear;\n}\n\n@property --tw-border-gradient-angle {\n syntax: \'<angle>\';\n inherits: true;\n initial-value: 0deg;\n}\n\n@property --tw-conic-gradient-angle {\n syntax: \'<angle>\';\n inherits: true;\n initial-value: 0deg;\n}\n\n@keyframes border-gradient {\n\n to {\n --tw-border-gradient-angle: 360deg;\n }\n}\n\n.placeholder\\:text-neutral-500::placeholder {\n --tw-text-opacity: 1;\n color: rgb(115 115 115 / var(--tw-text-opacity));\n}\n\n.after\\:select-none::after {\n content: var(--tw-content);\n -webkit-user-select: none;\n user-select: none;\n}\n\n.after\\:content-\\[\\\'\\2026\\\'\\]::after {\n --tw-content: \'\u2026\';\n content: var(--tw-content);\n}\n\n.focus-within\\:border-transparent:focus-within {\n border-color: transparent;\n}\n\n.focus-within\\:ring-orange-500:focus-within {\n --tw-ring-opacity: 1;\n --tw-ring-color: rgb(249 115 22 / var(--tw-ring-opacity));\n}\n\n.hover\\:bg-blue-500:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n\n.hover\\:bg-neutral-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 229 229 / var(--tw-bg-opacity));\n}\n\n.hover\\:bg-orange-400:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(251 146 60 / var(--tw-bg-opacity));\n}\n\n.hover\\:text-white:hover {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.hover\\:text-white\\/40:hover {\n color: rgb(255 255 255 / 0.4);\n}\n\n.hover\\:text-white\\/80:hover {\n color: rgb(255 255 255 / 0.8);\n}\n\n.hover\\:decoration-orange-500:hover {\n text-decoration-color: #f97316;\n}\n\n.hover\\:brightness-125:hover {\n --tw-brightness: brightness(1.25);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n\n.focus\\:border-orange-500:focus {\n --tw-border-opacity: 1;\n border-color: rgb(249 115 22 / var(--tw-border-opacity));\n}\n\n.focus\\:border-yellow-400:focus {\n --tw-border-opacity: 1;\n border-color: rgb(250 204 21 / var(--tw-border-opacity));\n}\n\n.focus\\:bg-neutral-700:focus {\n --tw-bg-opacity: 1;\n background-color: rgb(64 64 64 / var(--tw-bg-opacity));\n}\n\n.active\\:bg-orange-600:active {\n --tw-bg-opacity: 1;\n background-color: rgb(234 88 12 / var(--tw-bg-opacity));\n}\n\n.active\\:brightness-150:active {\n --tw-brightness: brightness(1.5);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n\n.group:hover .group-hover\\:pointer-events-none {\n pointer-events: none;\n}\n\n.group:hover .group-hover\\:pointer-events-auto {\n pointer-events: auto;\n}\n\n.group:hover .group-hover\\:inline-block {\n display: inline-block;\n}\n\n.group:hover .group-hover\\:hidden {\n display: none;\n}\n\n.group:hover .group-hover\\:rotate-90 {\n --tw-rotate: 90deg;\n 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));\n}\n\n.group:hover .group-hover\\:opacity-0 {\n opacity: 0;\n}\n\n.group:hover .group-hover\\:opacity-100 {\n opacity: 1;\n}\n\n.peer:placeholder-shown ~ .peer-placeholder-shown\\:text-neutral-500 {\n --tw-text-opacity: 1;\n color: rgb(115 115 115 / var(--tw-text-opacity));\n}\n\n.aria-busy\\:pointer-events-none[aria-busy="true"] {\n pointer-events: none;\n}\n\n.aria-busy\\:bg-blue-500[aria-busy="true"] {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n\n.aria-disabled\\:pointer-events-none[aria-disabled="true"] {\n pointer-events: none;\n}\n\n.aria-disabled\\:opacity-50[aria-disabled="true"] {\n opacity: 0.5;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:inline {\n display: inline;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:hidden {\n display: none;\n}\n\n.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:translate-x-0 {\n --tw-translate-x: 0px;\n 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));\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:scale-100 {\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n 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));\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:scale-125 {\n --tw-scale-x: 1.25;\n --tw-scale-y: 1.25;\n 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));\n}\n\n.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:opacity-100 {\n opacity: 1;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:opacity-0 {\n opacity: 0;\n}\n\n.group[aria-busy="true"] .group-aria-busy\\:opacity-100 {\n opacity: 1;\n}\n\n.group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:duration-300 {\n transition-duration: 300ms;\n}\n\n.group[aria-expanded="true"] .group-aria-expanded\\:inline {\n display: inline;\n}\n\n.group[aria-expanded="true"] .group-aria-expanded\\:hidden {\n display: none;\n}\n\n.data-\\[highlighted\\]\\:bg-neutral-200[data-highlighted] {\n --tw-bg-opacity: 1;\n background-color: rgb(229 229 229 / var(--tw-bg-opacity));\n}\n\n.data-\\[state\\=checked\\]\\:bg-neutral-900[data-state="checked"] {\n --tw-bg-opacity: 1;\n background-color: rgb(23 23 23 / var(--tw-bg-opacity));\n}\n\n.links\\:font-medium a[href]:not(.links-unset) {\n font-weight: 500;\n}\n\n.links\\:text-white a[href]:not(.links-unset) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.links\\:underline a[href]:not(.links-unset) {\n text-decoration-line: underline;\n}\n\n.links\\:decoration-neutral-500 a[href]:not(.links-unset) {\n text-decoration-color: #737373;\n}\n\n.links\\:underline-offset-4 a[href]:not(.links-unset) {\n text-underline-offset: 4px;\n}\n\n.hover\\:links\\:decoration-orange-500 a[href]:not(.links-unset):hover {\n text-decoration-color: #f97316;\n}\n\n@media (min-width: 640px) {\n\n .sm\\:items-center {\n align-items: center;\n }\n}\n\n.dark\\:border-neutral-700:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-border-opacity: 1;\n border-color: rgb(64 64 64 / var(--tw-border-opacity));\n}\n\n.dark\\:bg-neutral-800:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-bg-opacity: 1;\n background-color: rgb(38 38 38 / var(--tw-bg-opacity));\n}\n\n.dark\\:bg-white\\/10:where([data-theme="dark"], [data-theme="dark"] *) {\n background-color: rgb(255 255 255 / 0.1);\n}\n\n.dark\\:text-white:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n.dark\\:hover\\:bg-neutral-700:hover:where([data-theme="dark"], [data-theme="dark"] *) {\n --tw-bg-opacity: 1;\n background-color: rgb(64 64 64 / var(--tw-bg-opacity));\n}\n\n.\\[\\&_\\>_\\:is\\(dt\\2c dd\\)\\]\\:px-1 > :is(dt,dd) {\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n}\n\n.\\[\\&_\\>_dd\\]\\:text-right > dd {\n text-align: right;\n}\n';
|
|
26
26
|
|
|
27
27
|
// src/ui/Shadow.tsx
|
|
28
28
|
import { useResizeObserver } from "usehooks-ts";
|
|
@@ -37,14 +37,17 @@ function FrameProvider({ frame, children }) {
|
|
|
37
37
|
if (value) throw new Error("`FrameProvider` can only be used once.");
|
|
38
38
|
return /* @__PURE__ */ jsx(Context.Provider, { value: { frame }, children });
|
|
39
39
|
}
|
|
40
|
+
function useFrame() {
|
|
41
|
+
const value = useContext(Context);
|
|
42
|
+
if (!value) throw new Error("`useFrame` can only be used within a `FrameProvider`.");
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
40
45
|
|
|
41
46
|
// src/useTheme.ts
|
|
42
47
|
import { useMediaQuery } from "usehooks-ts";
|
|
43
48
|
|
|
44
49
|
// src/EntryKitConfigProvider.tsx
|
|
45
|
-
import "@rainbow-me/rainbowkit/styles.css";
|
|
46
50
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
47
|
-
import { RainbowKitProvider, midnightTheme } from "@rainbow-me/rainbowkit";
|
|
48
51
|
import { useChains } from "wagmi";
|
|
49
52
|
|
|
50
53
|
// src/getBundlerTransport.ts
|
|
@@ -136,8 +139,11 @@ var debug2 = debug.extend("quarry");
|
|
|
136
139
|
|
|
137
140
|
// src/quarry/transports/userOpExecutor.ts
|
|
138
141
|
import { setBalance } from "viem/actions";
|
|
139
|
-
function userOpExecutor({
|
|
140
|
-
|
|
142
|
+
function userOpExecutor({
|
|
143
|
+
executor,
|
|
144
|
+
fallbackDefaultTransport
|
|
145
|
+
}) {
|
|
146
|
+
return (opts) => {
|
|
141
147
|
debug2("using a local user op executor", executor.account.address);
|
|
142
148
|
if (executor.chain.id === 31337) {
|
|
143
149
|
debug2("setting executor balance");
|
|
@@ -172,7 +178,9 @@ function userOpExecutor({ executor }) {
|
|
|
172
178
|
if (method === "eth_estimateUserOperationGas") {
|
|
173
179
|
return await estimateUserOperationGas(params);
|
|
174
180
|
}
|
|
175
|
-
|
|
181
|
+
debug2(`userOpExecutor: method "${method}" not overridden, falling back to fallback transport`);
|
|
182
|
+
const { request: fallbackRequest } = fallbackDefaultTransport(opts);
|
|
183
|
+
return fallbackRequest({ method, params });
|
|
176
184
|
};
|
|
177
185
|
return createTransport({
|
|
178
186
|
key: "userOpExecutor",
|
|
@@ -184,23 +192,31 @@ function userOpExecutor({ executor }) {
|
|
|
184
192
|
}
|
|
185
193
|
|
|
186
194
|
// src/getBundlerTransport.ts
|
|
195
|
+
import { wiresaw } from "@latticexyz/common/internal";
|
|
187
196
|
function getBundlerTransport(chain) {
|
|
197
|
+
if ("wiresaw" in chain.rpcUrls) {
|
|
198
|
+
return wiresaw();
|
|
199
|
+
}
|
|
188
200
|
const bundlerHttpUrl = chain.rpcUrls.bundler?.http[0];
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
if (bundlerHttpUrl) {
|
|
202
|
+
return http(bundlerHttpUrl);
|
|
203
|
+
}
|
|
204
|
+
if (chain.id === 31337) {
|
|
205
|
+
return userOpExecutor({
|
|
206
|
+
executor: createClient({
|
|
207
|
+
chain,
|
|
208
|
+
transport: fallback([webSocket(), http()]),
|
|
209
|
+
account: privateKeyToAccount(keccak256(stringToHex("local user op executor"))),
|
|
210
|
+
pollingInterval: 10
|
|
211
|
+
}).extend(transactionQueue()),
|
|
212
|
+
fallbackDefaultTransport: http()
|
|
213
|
+
});
|
|
199
214
|
}
|
|
200
|
-
|
|
215
|
+
throw new Error(`Chain ${chain.id} config did not include a bundler RPC URL.`);
|
|
201
216
|
}
|
|
202
217
|
|
|
203
218
|
// src/EntryKitConfigProvider.tsx
|
|
219
|
+
import { ConnectKitProvider } from "connectkit";
|
|
204
220
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
205
221
|
var Context2 = createContext2(null);
|
|
206
222
|
function EntryKitConfigProvider({ config, children }) {
|
|
@@ -211,14 +227,14 @@ function EntryKitConfigProvider({ config, children }) {
|
|
|
211
227
|
if (!chain) throw new Error(`Could not find configured chain for chain ID ${config.chainId}.`);
|
|
212
228
|
getBundlerTransport(chain);
|
|
213
229
|
return /* @__PURE__ */ jsx2(
|
|
214
|
-
|
|
230
|
+
ConnectKitProvider,
|
|
215
231
|
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
//
|
|
232
|
+
theme: "midnight",
|
|
233
|
+
options: {
|
|
234
|
+
// Prevent Wagmi trying to switch chains after connection
|
|
235
|
+
// https://github.com/wevm/wagmi/blob/f5b717ccf8a5b283263cadc984ba00b354bcefae/packages/core/src/connectors/injected.ts#L174-L182
|
|
236
|
+
initialChainId: 0
|
|
220
237
|
},
|
|
221
|
-
theme: midnightTheme({ borderRadius: "none" }),
|
|
222
238
|
children: /* @__PURE__ */ jsx2(Context2.Provider, { value: { ...config, chain }, children })
|
|
223
239
|
}
|
|
224
240
|
);
|
|
@@ -269,7 +285,9 @@ var Shadow = forwardRef(function Shadow2({ mode, children }, forwardedRef) {
|
|
|
269
285
|
inset: "0",
|
|
270
286
|
width: "100%",
|
|
271
287
|
height: "100%",
|
|
272
|
-
|
|
288
|
+
// one less than ConnectKit's modal z-index
|
|
289
|
+
// so that ConnectKit can overlap properly
|
|
290
|
+
zIndex: "2147483645"
|
|
273
291
|
} : frameSize.width && frameSize.height ? {
|
|
274
292
|
all: "unset",
|
|
275
293
|
display: "inline-grid",
|
|
@@ -368,13 +386,10 @@ function useAccountModal() {
|
|
|
368
386
|
}
|
|
369
387
|
|
|
370
388
|
// src/AccountModal.tsx
|
|
371
|
-
import { twMerge as
|
|
389
|
+
import { twMerge as twMerge20 } from "tailwind-merge";
|
|
372
390
|
|
|
373
391
|
// src/AccountModalContent.tsx
|
|
374
|
-
import { useAccount as
|
|
375
|
-
|
|
376
|
-
// src/ConnectWallet.tsx
|
|
377
|
-
import { useAccount } from "wagmi";
|
|
392
|
+
import { useAccount as useAccount8, useConnectorClient } from "wagmi";
|
|
378
393
|
|
|
379
394
|
// src/ui/Button.tsx
|
|
380
395
|
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
@@ -441,7 +456,7 @@ var Button = ({ pending, variant, type, className, children, disabled, ...props
|
|
|
441
456
|
};
|
|
442
457
|
|
|
443
458
|
// src/ConnectWallet.tsx
|
|
444
|
-
import {
|
|
459
|
+
import { useModal } from "connectkit";
|
|
445
460
|
|
|
446
461
|
// src/icons/Logo.tsx
|
|
447
462
|
import { twMerge as twMerge4 } from "tailwind-merge";
|
|
@@ -501,7 +516,7 @@ function AppInfo() {
|
|
|
501
516
|
return /* @__PURE__ */ jsxs6("div", { className: "flex-grow flex flex-col items-center justify-center gap-2", children: [
|
|
502
517
|
/* @__PURE__ */ jsx8("div", { className: "w-16 h-16 m-2", children: !appIconLoading ? hasAppIcon ? /* @__PURE__ */ jsx8("img", { src: appIcon, className: "w-full h-full object-cover" }) : (
|
|
503
518
|
// TODO: swap with favicon
|
|
504
|
-
/* @__PURE__ */ jsx8(Logo, { className: "w-full h-full text-orange-500
|
|
519
|
+
/* @__PURE__ */ jsx8(Logo, { className: "w-full h-full text-orange-500 bg-neutral-800" })
|
|
505
520
|
) : null }),
|
|
506
521
|
/* @__PURE__ */ jsx8("div", { className: "text-2xl text-white text-center", children: appName })
|
|
507
522
|
] });
|
|
@@ -509,18 +524,17 @@ function AppInfo() {
|
|
|
509
524
|
|
|
510
525
|
// src/ConnectWallet.tsx
|
|
511
526
|
import { twMerge as twMerge5 } from "tailwind-merge";
|
|
512
|
-
import { useEffect as useEffect3,
|
|
527
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
513
528
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
514
529
|
function ConnectWallet() {
|
|
515
|
-
const
|
|
516
|
-
const
|
|
517
|
-
const [hasAutoOpened, setHasAutoOpened] = useState2(false);
|
|
530
|
+
const { open, setOpen } = useModal();
|
|
531
|
+
const hasAutoOpenedRef = useRef2(false);
|
|
518
532
|
useEffect3(() => {
|
|
519
|
-
if (!
|
|
520
|
-
|
|
521
|
-
|
|
533
|
+
if (!open && !hasAutoOpenedRef.current) {
|
|
534
|
+
setOpen(true);
|
|
535
|
+
hasAutoOpenedRef.current = true;
|
|
522
536
|
}
|
|
523
|
-
}, [
|
|
537
|
+
}, [open, setOpen]);
|
|
524
538
|
return /* @__PURE__ */ jsxs7(
|
|
525
539
|
"div",
|
|
526
540
|
{
|
|
@@ -532,8 +546,7 @@ function ConnectWallet() {
|
|
|
532
546
|
{
|
|
533
547
|
variant: "secondary",
|
|
534
548
|
className: "self-auto flex justify-center",
|
|
535
|
-
|
|
536
|
-
onClick: openConnectModal,
|
|
549
|
+
onClick: () => setOpen(true),
|
|
537
550
|
autoFocus: true,
|
|
538
551
|
children: "Connect wallet"
|
|
539
552
|
},
|
|
@@ -545,8 +558,35 @@ function ConnectWallet() {
|
|
|
545
558
|
}
|
|
546
559
|
|
|
547
560
|
// src/onboarding/ConnectedSteps.tsx
|
|
548
|
-
import { useEffect as
|
|
549
|
-
import { twMerge as
|
|
561
|
+
import { useEffect as useEffect15, useMemo as useMemo4, useRef as useRef5, useState as useState5 } from "react";
|
|
562
|
+
import { twMerge as twMerge18 } from "tailwind-merge";
|
|
563
|
+
|
|
564
|
+
// src/onboarding/usePrerequisites.ts
|
|
565
|
+
import { useClient as useClient6, useConfig } from "wagmi";
|
|
566
|
+
import { getBalanceQueryOptions as getBalanceQueryOptions2 } from "wagmi/query";
|
|
567
|
+
import { queryOptions as queryOptions6, skipToken as skipToken6, useQuery as useQuery7, useQueryClient } from "@tanstack/react-query";
|
|
568
|
+
|
|
569
|
+
// src/getPaymaster.ts
|
|
570
|
+
function getPaymaster(chain) {
|
|
571
|
+
const contracts = chain.contracts ?? {};
|
|
572
|
+
if ("quarryPaymaster" in contracts && contracts.quarryPaymaster != null) {
|
|
573
|
+
if ("address" in contracts.quarryPaymaster) {
|
|
574
|
+
return {
|
|
575
|
+
type: "quarry",
|
|
576
|
+
address: contracts.quarryPaymaster.address,
|
|
577
|
+
isGasPass: !!chain.rpcUrls.quarryPassIssuer?.http?.[0]
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if ("paymaster" in contracts && contracts.paymaster != null) {
|
|
582
|
+
if ("address" in contracts.paymaster) {
|
|
583
|
+
return {
|
|
584
|
+
type: "simple",
|
|
585
|
+
address: contracts.paymaster.address
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
550
590
|
|
|
551
591
|
// src/onboarding/quarry/useAllowance.ts
|
|
552
592
|
import { useClient } from "wagmi";
|
|
@@ -561,7 +601,11 @@ import { parseAbi } from "viem";
|
|
|
561
601
|
var paymasterAbi = parseAbi([
|
|
562
602
|
"error SpenderSystem_AlreadyRegistered(address spender, address user)",
|
|
563
603
|
"error SpenderSystem_HasOwnBalance(address spender)",
|
|
564
|
-
"
|
|
604
|
+
"error BalanceSystem_BalanceTooHigh(address user, uint256 balance, uint256 max)",
|
|
605
|
+
"error BalanceSystem_InsufficientBalance(address user, uint256 amount, uint256 balance)",
|
|
606
|
+
"function registerSpender(address spender)",
|
|
607
|
+
"function depositTo(address to) payable",
|
|
608
|
+
"function withdrawTo(address to, uint256 amount)"
|
|
565
609
|
]);
|
|
566
610
|
var paymasterConfig = defineStore({
|
|
567
611
|
namespaces: {
|
|
@@ -575,6 +619,13 @@ var paymasterConfig = defineStore({
|
|
|
575
619
|
},
|
|
576
620
|
key: ["user"]
|
|
577
621
|
},
|
|
622
|
+
Balance: {
|
|
623
|
+
schema: {
|
|
624
|
+
user: "address",
|
|
625
|
+
balance: "uint256"
|
|
626
|
+
},
|
|
627
|
+
key: ["user"]
|
|
628
|
+
},
|
|
578
629
|
Grantor: {
|
|
579
630
|
schema: {
|
|
580
631
|
grantor: "address",
|
|
@@ -624,29 +675,6 @@ var paymasterTables = paymasterConfig.namespaces.root.tables;
|
|
|
624
675
|
import { getRecord, getStaticDataLocation } from "@latticexyz/store/internal";
|
|
625
676
|
import { getKeyTuple } from "@latticexyz/protocol-parser/internal";
|
|
626
677
|
import { setStorageAt } from "viem/actions";
|
|
627
|
-
|
|
628
|
-
// src/getPaymaster.ts
|
|
629
|
-
function getPaymaster(chain) {
|
|
630
|
-
const contracts = chain.contracts ?? {};
|
|
631
|
-
if ("quarryPaymaster" in contracts && contracts.quarryPaymaster != null) {
|
|
632
|
-
if ("address" in contracts.quarryPaymaster) {
|
|
633
|
-
return {
|
|
634
|
-
type: "quarry",
|
|
635
|
-
address: contracts.quarryPaymaster.address
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
if ("paymaster" in contracts && contracts.paymaster != null) {
|
|
640
|
-
if ("address" in contracts.paymaster) {
|
|
641
|
-
return {
|
|
642
|
-
type: "simple",
|
|
643
|
-
address: contracts.paymaster.address
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
// src/quarry/getAllowance.ts
|
|
650
678
|
async function getAllowance({ client, userAddress }) {
|
|
651
679
|
const paymaster = getPaymaster(client.chain);
|
|
652
680
|
if (paymaster?.type !== "quarry") return null;
|
|
@@ -772,10 +800,6 @@ function getDelegationQueryOptions({
|
|
|
772
800
|
});
|
|
773
801
|
}
|
|
774
802
|
|
|
775
|
-
// src/onboarding/usePrerequisites.ts
|
|
776
|
-
import { queryOptions as queryOptions5, skipToken as skipToken5, useQuery as useQuery6, useQueryClient } from "@tanstack/react-query";
|
|
777
|
-
import { useClient as useClient5, useConfig } from "wagmi";
|
|
778
|
-
|
|
779
803
|
// src/useSessionAccount.ts
|
|
780
804
|
import { useClient as useClient4 } from "wagmi";
|
|
781
805
|
import { queryOptions as queryOptions4, skipToken as skipToken4, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
@@ -851,8 +875,41 @@ function getSessionAccountQueryOptions({
|
|
|
851
875
|
});
|
|
852
876
|
}
|
|
853
877
|
|
|
878
|
+
// src/onboarding/quarry/useBalance.ts
|
|
879
|
+
import { useClient as useClient5 } from "wagmi";
|
|
880
|
+
import { queryOptions as queryOptions5, skipToken as skipToken5, useQuery as useQuery6 } from "@tanstack/react-query";
|
|
881
|
+
|
|
882
|
+
// src/quarry/getBalance.ts
|
|
883
|
+
import { getRecord as getRecord4 } from "@latticexyz/store/internal";
|
|
884
|
+
async function getBalance({ client, userAddress }) {
|
|
885
|
+
const paymaster = getPaymaster(client.chain);
|
|
886
|
+
if (paymaster?.type !== "quarry") return null;
|
|
887
|
+
const record = await getRecord4(client, {
|
|
888
|
+
address: paymaster.address,
|
|
889
|
+
table: paymasterTables.Balance,
|
|
890
|
+
key: { user: userAddress },
|
|
891
|
+
blockTag: "pending"
|
|
892
|
+
});
|
|
893
|
+
return record.balance;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
// src/onboarding/quarry/useBalance.ts
|
|
897
|
+
function getBalanceQueryOptions({
|
|
898
|
+
client,
|
|
899
|
+
userAddress
|
|
900
|
+
}) {
|
|
901
|
+
return queryOptions5({
|
|
902
|
+
queryKey: ["getBalance", client?.uid, userAddress],
|
|
903
|
+
queryFn: client && userAddress ? () => getBalance({ client, userAddress }) : skipToken5
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
function useBalance(userAddress) {
|
|
907
|
+
const { chainId } = useEntryKitConfig();
|
|
908
|
+
const client = useClient5({ chainId });
|
|
909
|
+
return useQuery6(getBalanceQueryOptions({ client, userAddress }));
|
|
910
|
+
}
|
|
911
|
+
|
|
854
912
|
// src/onboarding/usePrerequisites.ts
|
|
855
|
-
import { getBalanceQueryOptions } from "wagmi/query";
|
|
856
913
|
function getPrequisitesQueryOptions({
|
|
857
914
|
queryClient,
|
|
858
915
|
config,
|
|
@@ -860,34 +917,37 @@ function getPrequisitesQueryOptions({
|
|
|
860
917
|
userAddress,
|
|
861
918
|
worldAddress
|
|
862
919
|
}) {
|
|
863
|
-
return
|
|
920
|
+
return queryOptions6({
|
|
864
921
|
queryKey: ["getPrerequisites", client?.uid, userAddress],
|
|
865
922
|
queryFn: client && userAddress ? async () => {
|
|
866
923
|
const paymaster = getPaymaster(client.chain);
|
|
867
924
|
const {
|
|
868
925
|
account: { address: sessionAddress }
|
|
869
926
|
} = await queryClient.fetchQuery(getSessionAccountQueryOptions({ client, userAddress }));
|
|
870
|
-
const [sessionBalance, allowance, spender, hasDelegation] = await Promise.all([
|
|
927
|
+
const [sessionBalance, allowance, spender, quarryBalance, hasDelegation] = await Promise.all([
|
|
871
928
|
!paymaster ? queryClient.fetchQuery(
|
|
872
|
-
|
|
929
|
+
getBalanceQueryOptions2(config, { chainId: client.chain.id, address: sessionAddress })
|
|
873
930
|
) : null,
|
|
874
931
|
paymaster?.type === "quarry" ? queryClient.fetchQuery(getAllowanceQueryOptions({ client, userAddress })) : null,
|
|
875
932
|
paymaster?.type === "quarry" ? queryClient.fetchQuery(getSpenderQueryOptions({ client, userAddress, sessionAddress })) : null,
|
|
933
|
+
paymaster?.type === "quarry" ? queryClient.fetchQuery(getBalanceQueryOptions({ client, userAddress })) : null,
|
|
876
934
|
queryClient.fetchQuery(getDelegationQueryOptions({ client, worldAddress, userAddress, sessionAddress }))
|
|
877
935
|
]);
|
|
878
|
-
const hasAllowance = allowance == null || allowance
|
|
936
|
+
const hasAllowance = allowance == null || allowance > 0n;
|
|
879
937
|
const isSpender = spender == null ? true : spender;
|
|
880
|
-
const hasGasBalance = sessionBalance == null || sessionBalance.value
|
|
938
|
+
const hasGasBalance = sessionBalance == null || sessionBalance.value > 0n;
|
|
939
|
+
const hasQuarryGasBalance = quarryBalance == null || quarryBalance > 0n;
|
|
881
940
|
return {
|
|
882
941
|
sessionAddress,
|
|
883
942
|
hasAllowance,
|
|
884
943
|
isSpender,
|
|
885
944
|
hasGasBalance,
|
|
945
|
+
hasQuarryGasBalance,
|
|
886
946
|
hasDelegation,
|
|
887
947
|
// we intentionally don't enforce an allowance/gas balance here
|
|
888
948
|
complete: isSpender && hasDelegation
|
|
889
949
|
};
|
|
890
|
-
} :
|
|
950
|
+
} : skipToken6,
|
|
891
951
|
retry: false
|
|
892
952
|
});
|
|
893
953
|
}
|
|
@@ -895,8 +955,8 @@ function usePrerequisites(userAddress) {
|
|
|
895
955
|
const queryClient = useQueryClient();
|
|
896
956
|
const config = useConfig();
|
|
897
957
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
898
|
-
const client =
|
|
899
|
-
const prereqs =
|
|
958
|
+
const client = useClient6({ chainId });
|
|
959
|
+
const prereqs = useQuery7(
|
|
900
960
|
getPrequisitesQueryOptions({
|
|
901
961
|
queryClient,
|
|
902
962
|
config,
|
|
@@ -913,10 +973,10 @@ function usePrerequisites(userAddress) {
|
|
|
913
973
|
import { useDisconnect } from "wagmi";
|
|
914
974
|
|
|
915
975
|
// src/useENS.ts
|
|
916
|
-
import { useQuery as
|
|
976
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
917
977
|
function useENS(address) {
|
|
918
978
|
const normalizedAddress = address?.toLowerCase();
|
|
919
|
-
return
|
|
979
|
+
return useQuery8({
|
|
920
980
|
enabled: !!normalizedAddress,
|
|
921
981
|
queryKey: ["ens", normalizedAddress],
|
|
922
982
|
queryFn: async () => {
|
|
@@ -1069,11 +1129,11 @@ async function claimGasPass({ chain, userAddress }) {
|
|
|
1069
1129
|
}
|
|
1070
1130
|
|
|
1071
1131
|
// src/onboarding/quarry/useClaimGasPass.ts
|
|
1072
|
-
import { useClient as
|
|
1132
|
+
import { useClient as useClient7 } from "wagmi";
|
|
1073
1133
|
function useClaimGasPass() {
|
|
1074
1134
|
const queryClient = useQueryClient2();
|
|
1075
1135
|
const { chain } = useEntryKitConfig();
|
|
1076
|
-
const client =
|
|
1136
|
+
const client = useClient7({ chainId: chain.id });
|
|
1077
1137
|
const mutationKey = ["claimGasPass", chain.id];
|
|
1078
1138
|
return useMutation({
|
|
1079
1139
|
retry: 0,
|
|
@@ -1119,8 +1179,12 @@ function EthIcon({ className, ...props }) {
|
|
|
1119
1179
|
import { formatEther } from "viem";
|
|
1120
1180
|
function formatBalance(wei) {
|
|
1121
1181
|
const formatted = formatEther(wei);
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1182
|
+
const parsed = parseFloat(formatted);
|
|
1183
|
+
if (parsed > 0 && parsed < 1e-5) {
|
|
1184
|
+
return "<0.00001";
|
|
1185
|
+
}
|
|
1186
|
+
const magnitude = Math.floor(parsed).toString().length;
|
|
1187
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: Math.max(0, 6 - magnitude) });
|
|
1124
1188
|
}
|
|
1125
1189
|
|
|
1126
1190
|
// src/ui/Balance.tsx
|
|
@@ -1184,6 +1248,9 @@ function Allowance({ isActive, isExpanded, userAddress }) {
|
|
|
1184
1248
|
] });
|
|
1185
1249
|
}
|
|
1186
1250
|
|
|
1251
|
+
// src/onboarding/Session.tsx
|
|
1252
|
+
import { useEffect as useEffect7 } from "react";
|
|
1253
|
+
|
|
1187
1254
|
// src/onboarding/useSetupSession.ts
|
|
1188
1255
|
import { encodeFunctionData } from "viem";
|
|
1189
1256
|
import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
@@ -1197,11 +1264,12 @@ function defineCall(call) {
|
|
|
1197
1264
|
}
|
|
1198
1265
|
|
|
1199
1266
|
// src/onboarding/useSetupSession.ts
|
|
1200
|
-
import { useClient as
|
|
1267
|
+
import { useClient as useClient8 } from "wagmi";
|
|
1201
1268
|
import { resourceToHex as resourceToHex2 } from "@latticexyz/common";
|
|
1202
1269
|
import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";
|
|
1203
1270
|
|
|
1204
1271
|
// src/utils/callWithSignature.ts
|
|
1272
|
+
import { parseErc6492Signature } from "viem";
|
|
1205
1273
|
import { writeContract as viem_writeContract } from "viem/actions";
|
|
1206
1274
|
import { getAction as getAction3 } from "viem/utils";
|
|
1207
1275
|
|
|
@@ -1209,7 +1277,7 @@ import { getAction as getAction3 } from "viem/utils";
|
|
|
1209
1277
|
import { toHex } from "viem";
|
|
1210
1278
|
import { signTypedData } from "viem/actions";
|
|
1211
1279
|
import { callWithSignatureTypes } from "@latticexyz/world-module-callwithsignature/internal";
|
|
1212
|
-
import { getRecord as
|
|
1280
|
+
import { getRecord as getRecord5 } from "@latticexyz/store/internal";
|
|
1213
1281
|
import moduleConfig from "@latticexyz/world-module-callwithsignature/mud.config";
|
|
1214
1282
|
import { hexToResource } from "@latticexyz/common";
|
|
1215
1283
|
import { getAction as getAction2 } from "viem/utils";
|
|
@@ -1221,7 +1289,7 @@ async function signCall({
|
|
|
1221
1289
|
nonce: initialNonce,
|
|
1222
1290
|
client
|
|
1223
1291
|
}) {
|
|
1224
|
-
const nonce = initialNonce ?? (client ? (await
|
|
1292
|
+
const nonce = initialNonce ?? (client ? (await getRecord5(client, {
|
|
1225
1293
|
address: worldAddress,
|
|
1226
1294
|
table: moduleConfig.tables.CallWithSignatureNonces,
|
|
1227
1295
|
key: { signer: userClient.account.address },
|
|
@@ -1256,7 +1324,13 @@ async function callWithSignature({
|
|
|
1256
1324
|
sessionClient,
|
|
1257
1325
|
...opts
|
|
1258
1326
|
}) {
|
|
1259
|
-
const
|
|
1327
|
+
const rawSignature = await signCall(opts);
|
|
1328
|
+
const { address, signature } = parseErc6492Signature(rawSignature);
|
|
1329
|
+
if (address != null) {
|
|
1330
|
+
throw new Error(
|
|
1331
|
+
"ERC-6492 signatures, like from Coinbase Smart Wallet, are not yet supported. Try using a different wallet?"
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1260
1334
|
return getAction3(
|
|
1261
1335
|
sessionClient,
|
|
1262
1336
|
viem_writeContract,
|
|
@@ -1274,7 +1348,7 @@ import { systemsConfig as worldSystemsConfig } from "@latticexyz/world/mud.confi
|
|
|
1274
1348
|
function useSetupSession({ userClient }) {
|
|
1275
1349
|
const queryClient = useQueryClient3();
|
|
1276
1350
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
1277
|
-
const client =
|
|
1351
|
+
const client = useClient8({ chainId });
|
|
1278
1352
|
const mutationKey = ["setupSession", client?.chain.id, userClient.account.address];
|
|
1279
1353
|
return useMutation2({
|
|
1280
1354
|
retry: 0,
|
|
@@ -1380,15 +1454,12 @@ function useSetupSession({ userClient }) {
|
|
|
1380
1454
|
});
|
|
1381
1455
|
}
|
|
1382
1456
|
|
|
1383
|
-
// src/onboarding/Session.tsx
|
|
1384
|
-
import { useEffect as useEffect7 } from "react";
|
|
1385
|
-
|
|
1386
1457
|
// src/useSessionClient.ts
|
|
1387
|
-
import { useClient as
|
|
1458
|
+
import { useClient as useClient9 } from "wagmi";
|
|
1388
1459
|
import {
|
|
1389
|
-
queryOptions as
|
|
1390
|
-
skipToken as
|
|
1391
|
-
useQuery as
|
|
1460
|
+
queryOptions as queryOptions7,
|
|
1461
|
+
skipToken as skipToken7,
|
|
1462
|
+
useQuery as useQuery9,
|
|
1392
1463
|
useQueryClient as useQueryClient4
|
|
1393
1464
|
} from "@tanstack/react-query";
|
|
1394
1465
|
|
|
@@ -1473,7 +1544,7 @@ function getSessionClientQueryOptions({
|
|
|
1473
1544
|
userAddress,
|
|
1474
1545
|
worldAddress
|
|
1475
1546
|
}) {
|
|
1476
|
-
return
|
|
1547
|
+
return queryOptions7({
|
|
1477
1548
|
queryKey: ["getSessionClient", client?.uid, userAddress, worldAddress],
|
|
1478
1549
|
queryFn: userAddress ? async () => {
|
|
1479
1550
|
const { account: sessionAccount, signer: sessionSigner } = await queryClient.fetchQuery(
|
|
@@ -1485,7 +1556,7 @@ function getSessionClientQueryOptions({
|
|
|
1485
1556
|
userAddress,
|
|
1486
1557
|
worldAddress
|
|
1487
1558
|
});
|
|
1488
|
-
} :
|
|
1559
|
+
} : skipToken7,
|
|
1489
1560
|
staleTime: Infinity,
|
|
1490
1561
|
// TODO: replace with function to retry only connection errors
|
|
1491
1562
|
retry: false
|
|
@@ -1494,8 +1565,8 @@ function getSessionClientQueryOptions({
|
|
|
1494
1565
|
function useSessionClient(userAddress) {
|
|
1495
1566
|
const queryClient = useQueryClient4();
|
|
1496
1567
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
1497
|
-
const client =
|
|
1498
|
-
return
|
|
1568
|
+
const client = useClient9({ chainId });
|
|
1569
|
+
return useQuery9(
|
|
1499
1570
|
getSessionClientQueryOptions({
|
|
1500
1571
|
queryClient,
|
|
1501
1572
|
client,
|
|
@@ -1511,9 +1582,11 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1511
1582
|
const sessionClient = useShowQueryError(useSessionClient(userClient.account.address));
|
|
1512
1583
|
const setup = useShowMutationError(useSetupSession({ userClient }));
|
|
1513
1584
|
const hasSession = !registerDelegation && !registerDelegation;
|
|
1585
|
+
const { data: prerequisites } = usePrerequisites(userClient.account.address);
|
|
1586
|
+
const { hasAllowance, hasGasBalance, hasQuarryGasBalance } = prerequisites ?? {};
|
|
1514
1587
|
useEffect7(() => {
|
|
1515
1588
|
const timer = setTimeout(() => {
|
|
1516
|
-
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession) {
|
|
1589
|
+
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession && (hasAllowance || hasGasBalance || hasQuarryGasBalance)) {
|
|
1517
1590
|
setup.mutate({
|
|
1518
1591
|
sessionClient: sessionClient.data,
|
|
1519
1592
|
registerSpender,
|
|
@@ -1522,7 +1595,17 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1522
1595
|
}
|
|
1523
1596
|
});
|
|
1524
1597
|
return () => clearTimeout(timer);
|
|
1525
|
-
}, [
|
|
1598
|
+
}, [
|
|
1599
|
+
hasSession,
|
|
1600
|
+
isActive,
|
|
1601
|
+
registerDelegation,
|
|
1602
|
+
registerSpender,
|
|
1603
|
+
sessionClient,
|
|
1604
|
+
setup,
|
|
1605
|
+
hasAllowance,
|
|
1606
|
+
hasGasBalance,
|
|
1607
|
+
hasQuarryGasBalance
|
|
1608
|
+
]);
|
|
1526
1609
|
return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4", children: [
|
|
1527
1610
|
/* @__PURE__ */ jsxs13("div", { className: "flex justify-between gap-4", children: [
|
|
1528
1611
|
/* @__PURE__ */ jsxs13("div", { children: [
|
|
@@ -1550,8 +1633,10 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1550
1633
|
}
|
|
1551
1634
|
|
|
1552
1635
|
// src/onboarding/GasBalance.tsx
|
|
1636
|
+
import { useEffect as useEffect9, useState as useState2 } from "react";
|
|
1553
1637
|
import { parseEther as parseEther4 } from "viem";
|
|
1554
|
-
import {
|
|
1638
|
+
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
1639
|
+
import { useBalance as useBalance2, useWatchBlockNumber } from "wagmi";
|
|
1555
1640
|
|
|
1556
1641
|
// src/data/relayChains.json
|
|
1557
1642
|
var relayChains_default = {
|
|
@@ -1836,11 +1921,11 @@ var relayChains_default = {
|
|
|
1836
1921
|
// src/onboarding/useSetBalance.ts
|
|
1837
1922
|
import { useQueryClient as useQueryClient5, useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1838
1923
|
import { setBalance as setBalance2 } from "viem/actions";
|
|
1839
|
-
import { useClient as
|
|
1924
|
+
import { useClient as useClient10 } from "wagmi";
|
|
1840
1925
|
function useSetBalance() {
|
|
1841
1926
|
const queryClient = useQueryClient5();
|
|
1842
1927
|
const { chainId } = useEntryKitConfig();
|
|
1843
|
-
const client =
|
|
1928
|
+
const client = useClient10({ chainId });
|
|
1844
1929
|
return useMutation3({
|
|
1845
1930
|
retry: 0,
|
|
1846
1931
|
mutationKey: ["setBalance", chainId],
|
|
@@ -1856,21 +1941,93 @@ function useSetBalance() {
|
|
|
1856
1941
|
});
|
|
1857
1942
|
}
|
|
1858
1943
|
|
|
1944
|
+
// src/errors/usePrevious.ts
|
|
1945
|
+
import { useEffect as useEffect8, useRef as useRef3 } from "react";
|
|
1946
|
+
function usePrevious(value, initialValue) {
|
|
1947
|
+
const ref = useRef3();
|
|
1948
|
+
useEffect8(() => {
|
|
1949
|
+
ref.current = { value };
|
|
1950
|
+
}, [value]);
|
|
1951
|
+
return ref.current ? ref.current.value : initialValue;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// src/icons/IconSVG.tsx
|
|
1955
|
+
import { twMerge as twMerge7 } from "tailwind-merge";
|
|
1956
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1957
|
+
function IconSVG({ className, children, ...props }) {
|
|
1958
|
+
return /* @__PURE__ */ jsx16(
|
|
1959
|
+
"svg",
|
|
1960
|
+
{
|
|
1961
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1962
|
+
viewBox: "0 0 24 24",
|
|
1963
|
+
fill: "currentColor",
|
|
1964
|
+
className: twMerge7("-my-[0.125em] h-[1.25em] w-[1.25em]", className),
|
|
1965
|
+
...props,
|
|
1966
|
+
children
|
|
1967
|
+
}
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// src/icons/CopyIcon.tsx
|
|
1972
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1973
|
+
function CopyIcon(props) {
|
|
1974
|
+
return /* @__PURE__ */ jsx17(IconSVG, { ...props, children: /* @__PURE__ */ jsx17(
|
|
1975
|
+
"path",
|
|
1976
|
+
{
|
|
1977
|
+
d: "M8 5H6C4.89543 5 4 5.89543 4 7V19C4 20.1046 4.89543 21 6 21H16C17.1046 21 18 20.1046 18 19V18M8 5C8 6.10457 8.89543 7 10 7H12C13.1046 7 14 6.10457 14 5M8 5C8 3.89543 8.89543 3 10 3H12C13.1046 3 14 3.89543 14 5M14 5H16C17.1046 5 18 5.89543 18 7V10M20 14H10M10 14L13 11M10 14L13 17",
|
|
1978
|
+
fill: "none",
|
|
1979
|
+
stroke: "currentColor",
|
|
1980
|
+
strokeWidth: "2",
|
|
1981
|
+
strokeLinecap: "round",
|
|
1982
|
+
strokeLinejoin: "round"
|
|
1983
|
+
}
|
|
1984
|
+
) });
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
// src/icons/CheckIcon.tsx
|
|
1988
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1989
|
+
function CheckIcon(props) {
|
|
1990
|
+
return /* @__PURE__ */ jsx18(IconSVG, { ...props, children: /* @__PURE__ */ jsx18(
|
|
1991
|
+
"path",
|
|
1992
|
+
{
|
|
1993
|
+
d: "M5 13L9 17L19 7",
|
|
1994
|
+
fill: "none",
|
|
1995
|
+
stroke: "currentColor",
|
|
1996
|
+
strokeWidth: "2",
|
|
1997
|
+
strokeLinecap: "round",
|
|
1998
|
+
strokeLinejoin: "round"
|
|
1999
|
+
}
|
|
2000
|
+
) });
|
|
2001
|
+
}
|
|
2002
|
+
|
|
1859
2003
|
// src/onboarding/GasBalance.tsx
|
|
1860
|
-
import { Fragment, jsx as
|
|
2004
|
+
import { Fragment, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1861
2005
|
function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
2006
|
+
const queryClient = useQueryClient6();
|
|
1862
2007
|
const { chain } = useEntryKitConfig();
|
|
1863
|
-
const
|
|
2008
|
+
const [copied, setCopied] = useState2(false);
|
|
2009
|
+
const balance = useShowQueryError(useBalance2({ chainId: chain.id, address: sessionAddress }));
|
|
2010
|
+
const prevBalance = usePrevious(balance.data);
|
|
1864
2011
|
useWatchBlockNumber({ onBlockNumber: () => balance.refetch() });
|
|
1865
2012
|
const setBalance3 = useShowMutationError(useSetBalance());
|
|
1866
2013
|
const relayChain = relayChains_default[chain.id];
|
|
2014
|
+
const handleCopy = () => {
|
|
2015
|
+
navigator.clipboard.writeText(sessionAddress);
|
|
2016
|
+
setCopied(true);
|
|
2017
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2018
|
+
};
|
|
2019
|
+
useEffect9(() => {
|
|
2020
|
+
if (balance.data != null && prevBalance?.value === 0n && balance.data.value > 0n) {
|
|
2021
|
+
queryClient.invalidateQueries({ queryKey: ["getPrerequisites"] });
|
|
2022
|
+
}
|
|
2023
|
+
}, [balance.data, prevBalance, setBalance3, sessionAddress, queryClient]);
|
|
1867
2024
|
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4", children: [
|
|
1868
2025
|
/* @__PURE__ */ jsxs14("div", { className: "flex justify-between gap-4", children: [
|
|
1869
2026
|
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1870
|
-
/* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ jsx19("div", { children: "Gas balance" }),
|
|
2028
|
+
/* @__PURE__ */ jsx19("div", { className: "font-mono text-white", children: balance.data != null ? /* @__PURE__ */ jsx19(Balance, { wei: balance.data.value }) : /* @__PURE__ */ jsx19(PendingIcon, { className: "text-sm" }) })
|
|
1872
2029
|
] }),
|
|
1873
|
-
chain.id === 31337 ? /* @__PURE__ */
|
|
2030
|
+
chain.id === 31337 ? /* @__PURE__ */ jsx19(
|
|
1874
2031
|
Button,
|
|
1875
2032
|
{
|
|
1876
2033
|
variant: isActive ? "primary" : "tertiary",
|
|
@@ -1885,13 +2042,13 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
1885
2042
|
}
|
|
1886
2043
|
) : relayChain != null ? (
|
|
1887
2044
|
// TODO: convert this to a <ButtonLink>
|
|
1888
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ jsx19(
|
|
1889
2046
|
"a",
|
|
1890
2047
|
{
|
|
1891
2048
|
href: `${relayChain.bridgeUrl}?${new URLSearchParams({ toAddress: sessionAddress, amount: "0.01" })}`,
|
|
1892
2049
|
target: "_blank",
|
|
1893
2050
|
rel: "noopener noreferrer",
|
|
1894
|
-
children: /* @__PURE__ */
|
|
2051
|
+
children: /* @__PURE__ */ jsx19(
|
|
1895
2052
|
Button,
|
|
1896
2053
|
{
|
|
1897
2054
|
variant: isActive ? "primary" : "tertiary",
|
|
@@ -1906,11 +2063,23 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
1906
2063
|
) : null
|
|
1907
2064
|
] }),
|
|
1908
2065
|
isExpanded ? /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
1909
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ jsx19("p", { className: "text-sm", children: "Your session's gas balance is used to pay for onchain computation." }),
|
|
1910
2067
|
/* @__PURE__ */ jsxs14("p", { className: "text-sm", children: [
|
|
1911
2068
|
"Send funds to",
|
|
1912
2069
|
" ",
|
|
1913
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ jsxs14(
|
|
2071
|
+
"span",
|
|
2072
|
+
{
|
|
2073
|
+
className: "inline-flex items-center gap-1 font-mono text-white cursor-pointer hover:text-white/80 transition-colors",
|
|
2074
|
+
onClick: handleCopy,
|
|
2075
|
+
title: "Click to copy",
|
|
2076
|
+
children: [
|
|
2077
|
+
/* @__PURE__ */ jsx19(TruncatedHex, { hex: sessionAddress }),
|
|
2078
|
+
" ",
|
|
2079
|
+
copied ? /* @__PURE__ */ jsx19(CheckIcon, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx19(CopyIcon, { className: "w-3.5 h-3.5" })
|
|
2080
|
+
]
|
|
2081
|
+
}
|
|
2082
|
+
),
|
|
1914
2083
|
" ",
|
|
1915
2084
|
"on ",
|
|
1916
2085
|
chain.name,
|
|
@@ -1920,133 +2089,754 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
1920
2089
|
] });
|
|
1921
2090
|
}
|
|
1922
2091
|
|
|
1923
|
-
// src/onboarding/
|
|
1924
|
-
import {
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
}
|
|
1958
|
-
];
|
|
2092
|
+
// src/onboarding/quarry/GasBalance.tsx
|
|
2093
|
+
import { useEffect as useEffect14 } from "react";
|
|
2094
|
+
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
2095
|
+
|
|
2096
|
+
// src/onboarding/deposit/DepositFormContainer.tsx
|
|
2097
|
+
import { useState as useState4 } from "react";
|
|
2098
|
+
import { useChains as useChains4, useChainId } from "wagmi";
|
|
2099
|
+
|
|
2100
|
+
// src/onboarding/deposit/DepositViaTransferForm.tsx
|
|
2101
|
+
import { useAccount as useAccount4, useWriteContract, usePrepareTransactionRequest, usePublicClient } from "wagmi";
|
|
2102
|
+
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
2103
|
+
import { useMutation as useMutation4, useQuery as useQuery12 } from "@tanstack/react-query";
|
|
2104
|
+
|
|
2105
|
+
// src/onboarding/deposit/DepositForm.tsx
|
|
2106
|
+
import { useEffect as useEffect11, useRef as useRef4 } from "react";
|
|
2107
|
+
import { useAccount as useAccount3, useBalance as useBalance4, useWatchBlockNumber as useWatchBlockNumber2 } from "wagmi";
|
|
2108
|
+
import { useIsMounted } from "usehooks-ts";
|
|
2109
|
+
import { twMerge as twMerge15 } from "tailwind-merge";
|
|
2110
|
+
|
|
2111
|
+
// src/onboarding/deposit/ChainSelect.tsx
|
|
2112
|
+
import { useEffect as useEffect10, useMemo as useMemo2 } from "react";
|
|
2113
|
+
import { useSwitchChain } from "wagmi";
|
|
2114
|
+
import { twMerge as twMerge12 } from "tailwind-merge";
|
|
2115
|
+
import * as Select from "@radix-ui/react-select";
|
|
2116
|
+
|
|
2117
|
+
// src/icons/ChevronUpIcon.tsx
|
|
2118
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2119
|
+
function ChevronUpIcon(props) {
|
|
2120
|
+
return /* @__PURE__ */ jsx20(IconSVG, { viewBox: "0 0 20 20", ...props, children: /* @__PURE__ */ jsx20(
|
|
2121
|
+
"path",
|
|
2122
|
+
{
|
|
2123
|
+
d: "M14.7071 12.7071C14.3166 13.0976 13.6834 13.0976 13.2929 12.7071L10 9.41421L6.70711 12.7071C6.31658 13.0976 5.68342 13.0976 5.29289 12.7071C4.90237 12.3166 4.90237 11.6834 5.29289 11.2929L9.29289 7.29289C9.68342 6.90237 10.3166 6.90237 10.7071 7.29289L14.7071 11.2929C15.0976 11.6834 15.0976 12.3166 14.7071 12.7071Z",
|
|
2124
|
+
fillRule: "evenodd",
|
|
2125
|
+
clipRule: "evenodd"
|
|
1959
2126
|
}
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
content: (props) => /* @__PURE__ */ jsx17(GasBalance, { ...props, sessionAddress })
|
|
1973
|
-
});
|
|
1974
|
-
}
|
|
1975
|
-
} else if (paymaster.type === "quarry") {
|
|
1976
|
-
steps2.push({
|
|
1977
|
-
id: "allowance",
|
|
1978
|
-
isComplete: !!hasAllowance,
|
|
1979
|
-
content: (props) => /* @__PURE__ */ jsx17(Allowance, { ...props, userAddress })
|
|
1980
|
-
});
|
|
2127
|
+
) });
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// src/icons/ChevronDownIcon.tsx
|
|
2131
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2132
|
+
function ChevronDownIcon(props) {
|
|
2133
|
+
return /* @__PURE__ */ jsx21(IconSVG, { viewBox: "0 0 20 20", ...props, children: /* @__PURE__ */ jsx21(
|
|
2134
|
+
"path",
|
|
2135
|
+
{
|
|
2136
|
+
d: "M5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289L10 10.5858L13.2929 7.29289C13.6834 6.90237 14.3166 6.90237 14.7071 7.29289C15.0976 7.68342 15.0976 8.31658 14.7071 8.70711L10.7071 12.7071C10.3166 13.0976 9.68342 13.0976 9.29289 12.7071L5.29289 8.70711C4.90237 8.31658 4.90237 7.68342 5.29289 7.29289Z",
|
|
2137
|
+
fillRule: "evenodd",
|
|
2138
|
+
clipRule: "evenodd"
|
|
1981
2139
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2140
|
+
) });
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
// src/ui/Slot.tsx
|
|
2144
|
+
import { isValidElement, cloneElement, Children } from "react";
|
|
2145
|
+
import { twMerge as twMerge8 } from "tailwind-merge";
|
|
2146
|
+
function Slot({
|
|
2147
|
+
children,
|
|
2148
|
+
...props
|
|
2149
|
+
}) {
|
|
2150
|
+
if (isValidElement(children)) {
|
|
2151
|
+
return cloneElement(children, {
|
|
2152
|
+
...props,
|
|
2153
|
+
...children.props,
|
|
2154
|
+
style: {
|
|
2155
|
+
...props.style,
|
|
2156
|
+
...children.props.style
|
|
2157
|
+
},
|
|
2158
|
+
className: twMerge8(props.className, children.props.className)
|
|
1986
2159
|
});
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
2160
|
+
}
|
|
2161
|
+
if (Children.count(children) > 1) {
|
|
2162
|
+
Children.only(null);
|
|
2163
|
+
}
|
|
2164
|
+
return null;
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
// src/ui/Input.tsx
|
|
2168
|
+
import { twMerge as twMerge9 } from "tailwind-merge";
|
|
2169
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2170
|
+
function Input({ asChild, className, ...props }) {
|
|
2171
|
+
const Child = asChild ? Slot : "input";
|
|
2172
|
+
return /* @__PURE__ */ jsx22(
|
|
2173
|
+
Child,
|
|
1996
2174
|
{
|
|
1997
|
-
className:
|
|
1998
|
-
|
|
1999
|
-
"
|
|
2000
|
-
"
|
|
2175
|
+
className: twMerge9(
|
|
2176
|
+
"p-2.5 gap-1 border text-lg font-medium transition",
|
|
2177
|
+
"outline-none ring-2 ring-transparent focus-within:ring-orange-500 focus-within:border-transparent",
|
|
2178
|
+
"bg-neutral-900 border-neutral-700 text-white placeholder:text-neutral-500",
|
|
2179
|
+
className
|
|
2001
2180
|
),
|
|
2002
|
-
|
|
2003
|
-
const isActive = step === activeStep;
|
|
2004
|
-
const isExpanded = isActive || completedSteps.length === steps.length;
|
|
2005
|
-
const isDisabled = !step.isComplete && activeStepIndex !== -1 && i > activeStepIndex;
|
|
2006
|
-
return /* @__PURE__ */ jsx17("div", { className: twMerge7("py-8 flex flex-col justify-center", isActive ? "flex-grow" : null), children: /* @__PURE__ */ jsx17("div", { className: twMerge7("flex flex-col", isDisabled ? "opacity-30 pointer-events-none" : null), children: step.content({ isActive, isExpanded }) }) }, step.id);
|
|
2007
|
-
})
|
|
2181
|
+
...props
|
|
2008
2182
|
}
|
|
2009
2183
|
);
|
|
2010
2184
|
}
|
|
2011
2185
|
|
|
2012
|
-
// src/
|
|
2013
|
-
import {
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
const
|
|
2020
|
-
|
|
2021
|
-
|
|
2186
|
+
// src/onboarding/deposit/ChainIcon.tsx
|
|
2187
|
+
import { twMerge as twMerge11 } from "tailwind-merge";
|
|
2188
|
+
|
|
2189
|
+
// src/onboarding/deposit/PreloadedImage.tsx
|
|
2190
|
+
import { twMerge as twMerge10 } from "tailwind-merge";
|
|
2191
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2192
|
+
function PreloadedImage({ url, fallback: fallback2, className }) {
|
|
2193
|
+
const { isSuccess, isLoading } = usePreloadImage(url);
|
|
2194
|
+
return /* @__PURE__ */ jsx23("span", { className: twMerge10("inline-flex w-full h-full items-center justify-center overflow-clip", className), children: !isLoading ? isSuccess ? /* @__PURE__ */ jsx23("img", { src: url, className: "w-full h-full object-cover" }) : fallback2 : null });
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
// src/onboarding/deposit/ChainIcon.tsx
|
|
2198
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
2199
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2200
|
+
var ChainIcon = forwardRef2(function ChainIcon2({ name, url, className }, forwardedRef) {
|
|
2201
|
+
return /* @__PURE__ */ jsx24(
|
|
2202
|
+
"span",
|
|
2203
|
+
{
|
|
2204
|
+
ref: forwardedRef,
|
|
2205
|
+
className: twMerge11("flex-shrink-0 inline-flex w-6 aspect-square rounded-full overflow-clip", className),
|
|
2206
|
+
children: url ? /* @__PURE__ */ jsx24(PreloadedImage, { url }) : (
|
|
2207
|
+
// TODO: better placeholder
|
|
2208
|
+
/* @__PURE__ */ jsx24(
|
|
2209
|
+
"span",
|
|
2210
|
+
{
|
|
2211
|
+
className: twMerge11(
|
|
2212
|
+
"inline-flex items-center justify-center w-full h-full rounded-full",
|
|
2213
|
+
"border-2 border-dashed border-white/50 opacity-50"
|
|
2214
|
+
),
|
|
2215
|
+
children: name?.slice(0, 1)
|
|
2216
|
+
}
|
|
2217
|
+
)
|
|
2218
|
+
)
|
|
2219
|
+
}
|
|
2220
|
+
);
|
|
2221
|
+
});
|
|
2222
|
+
|
|
2223
|
+
// src/onboarding/deposit/useRelay.ts
|
|
2224
|
+
import {
|
|
2225
|
+
MAINNET_RELAY_API,
|
|
2226
|
+
TESTNET_RELAY_API,
|
|
2227
|
+
fetchChainConfigs,
|
|
2228
|
+
createClient as createClient2,
|
|
2229
|
+
LogLevel
|
|
2230
|
+
} from "@reservoir0x/relay-sdk";
|
|
2231
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
2232
|
+
function useRelay() {
|
|
2233
|
+
const { chain } = useEntryKitConfig();
|
|
2234
|
+
const appOrigin = location.host;
|
|
2235
|
+
const baseApiUrl = chain.testnet ? TESTNET_RELAY_API : MAINNET_RELAY_API;
|
|
2236
|
+
return useQuery10({
|
|
2237
|
+
queryKey: ["relayChains", baseApiUrl, appOrigin],
|
|
2238
|
+
queryFn: async () => {
|
|
2239
|
+
debug("fetching relay chains from", baseApiUrl);
|
|
2240
|
+
const chains = await fetchChainConfigs(baseApiUrl);
|
|
2241
|
+
debug("got relay chains", chains);
|
|
2242
|
+
const client = createClient2({
|
|
2243
|
+
baseApiUrl,
|
|
2244
|
+
source: appOrigin,
|
|
2245
|
+
chains,
|
|
2246
|
+
logLevel: LogLevel.Verbose
|
|
2247
|
+
});
|
|
2248
|
+
return { client, chains };
|
|
2249
|
+
},
|
|
2250
|
+
refetchOnMount: false,
|
|
2251
|
+
refetchOnReconnect: false,
|
|
2252
|
+
refetchOnWindowFocus: false,
|
|
2253
|
+
staleTime: Infinity
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
// src/onboarding/deposit/useChainBalances.ts
|
|
2258
|
+
import { useAccount, useConfig as useWagmiConfig } from "wagmi";
|
|
2259
|
+
import { getBalance as getBalance2 } from "wagmi/actions";
|
|
2260
|
+
import { useQuery as useQuery11, skipToken as skipToken8 } from "@tanstack/react-query";
|
|
2261
|
+
import { isNotNull } from "@latticexyz/common/utils";
|
|
2262
|
+
function useChainBalances({ chains }) {
|
|
2263
|
+
const { address: userAddress } = useAccount();
|
|
2264
|
+
const wagmiConfig = useWagmiConfig();
|
|
2265
|
+
const chainIds = chains.map((chain) => chain.id);
|
|
2266
|
+
return useQuery11({
|
|
2267
|
+
queryKey: ["chainBalances", chainIds, userAddress],
|
|
2268
|
+
queryFn: userAddress ? async () => {
|
|
2269
|
+
const chainBalances = await Promise.allSettled(
|
|
2270
|
+
chains.map(async (chain) => {
|
|
2271
|
+
const balance = await getBalance2(wagmiConfig, { chainId: chain.id, address: userAddress });
|
|
2272
|
+
return { chain, balance };
|
|
2273
|
+
})
|
|
2274
|
+
);
|
|
2275
|
+
return chainBalances.map((result) => result.status === "fulfilled" ? result.value : null).filter(isNotNull);
|
|
2276
|
+
} : skipToken8,
|
|
2277
|
+
refetchInterval: 1e3 * 60,
|
|
2278
|
+
retry: 1
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
// src/onboarding/deposit/ChainSelect.tsx
|
|
2283
|
+
import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2284
|
+
function ChainSelect({ value, onChange }) {
|
|
2285
|
+
const theme = useTheme();
|
|
2286
|
+
const { frame } = useFrame();
|
|
2287
|
+
const { chains, switchChain } = useSwitchChain();
|
|
2288
|
+
const relay = useRelay();
|
|
2289
|
+
const relayChains = relay.data?.chains;
|
|
2290
|
+
const sourceChains = useMemo2(() => {
|
|
2291
|
+
return chains.map((sourceChain) => {
|
|
2292
|
+
const relayChain = relayChains?.find((c) => c.id === sourceChain.id);
|
|
2293
|
+
return {
|
|
2294
|
+
...sourceChain,
|
|
2295
|
+
relayChain
|
|
2296
|
+
};
|
|
2297
|
+
}).filter((c) => c.relayChain);
|
|
2298
|
+
}, [chains, relayChains]);
|
|
2299
|
+
const selectedChain = sourceChains.find((c) => c.id === value);
|
|
2300
|
+
const { data: chainsBalances, isLoading } = useShowQueryError(useChainBalances({ chains: sourceChains }));
|
|
2301
|
+
const renderedChains = useMemo2(() => {
|
|
2302
|
+
if (!chainsBalances) return [];
|
|
2303
|
+
const chainsWithBalance = chainsBalances.filter(({ balance }) => balance.value > 0n).map(({ chain, balance }) => ({ chain, balance: balance.value }));
|
|
2304
|
+
return chainsWithBalance.length > 0 ? chainsWithBalance : sourceChains.map((chain) => ({ chain, balance: 0n }));
|
|
2305
|
+
}, [chainsBalances, sourceChains]);
|
|
2306
|
+
useEffect10(() => {
|
|
2307
|
+
if (renderedChains.length > 0 && (!selectedChain || !renderedChains.find((c) => c.chain.id === selectedChain?.id))) {
|
|
2308
|
+
const defaultChain = renderedChains[0].chain;
|
|
2309
|
+
onChange(defaultChain.id);
|
|
2310
|
+
switchChain({ chainId: defaultChain.id });
|
|
2311
|
+
}
|
|
2312
|
+
}, [value, selectedChain, renderedChains, onChange, switchChain]);
|
|
2313
|
+
return /* @__PURE__ */ jsxs15(
|
|
2314
|
+
Select.Root,
|
|
2315
|
+
{
|
|
2316
|
+
value: value.toString(),
|
|
2317
|
+
onValueChange: (value2) => {
|
|
2318
|
+
if (value2) {
|
|
2319
|
+
const chain = renderedChains.find((item) => item.chain.id.toString() === value2)?.chain;
|
|
2320
|
+
if (!chain) throw new Error(`Unknown chain selected: ${value2}`);
|
|
2321
|
+
onChange(chain.id);
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
children: [
|
|
2325
|
+
/* @__PURE__ */ jsx25(Input, { asChild: true, children: /* @__PURE__ */ jsxs15(Select.Trigger, { className: "group inline-flex items-center justify-center", children: [
|
|
2326
|
+
/* @__PURE__ */ jsx25(Select.Value, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
2327
|
+
ChainIcon,
|
|
2328
|
+
{
|
|
2329
|
+
id: selectedChain?.id,
|
|
2330
|
+
name: selectedChain?.name,
|
|
2331
|
+
url: selectedChain?.relayChain?.icon?.[theme],
|
|
2332
|
+
className: "w-8"
|
|
2333
|
+
}
|
|
2334
|
+
) }),
|
|
2335
|
+
/* @__PURE__ */ jsx25(Select.Icon, { asChild: true, children: /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
2336
|
+
/* @__PURE__ */ jsx25(ChevronDownIcon, { className: "text-sm -mr-1 group-aria-expanded:hidden" }),
|
|
2337
|
+
/* @__PURE__ */ jsx25(ChevronUpIcon, { className: "text-sm -mr-1 hidden group-aria-expanded:inline" })
|
|
2338
|
+
] }) })
|
|
2339
|
+
] }) }),
|
|
2340
|
+
frame.contentDocument ? /* @__PURE__ */ jsx25(Select.Portal, { container: frame.contentDocument.body, children: /* @__PURE__ */ jsx25(
|
|
2341
|
+
Select.Content,
|
|
2342
|
+
{
|
|
2343
|
+
position: "popper",
|
|
2344
|
+
className: "w-[352px] max-h-[230px] overflow-y-auto mt-1 animate-in fade-in slide-in-from-top-2",
|
|
2345
|
+
children: /* @__PURE__ */ jsx25(Select.Viewport, { children: /* @__PURE__ */ jsx25(
|
|
2346
|
+
Select.Group,
|
|
2347
|
+
{
|
|
2348
|
+
className: twMerge12(
|
|
2349
|
+
"flex flex-col border divide-y",
|
|
2350
|
+
"bg-neutral-800 text-neutral-300 border-neutral-700 divide-neutral-700"
|
|
2351
|
+
),
|
|
2352
|
+
children: isLoading ? /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ jsx25(PendingIcon, { className: "h-6 w-6 animate-spin text-gray-400" }) }) : renderedChains.map(({ chain, balance }) => {
|
|
2353
|
+
return /* @__PURE__ */ jsxs15(
|
|
2354
|
+
Select.Item,
|
|
2355
|
+
{
|
|
2356
|
+
value: chain.id.toString(),
|
|
2357
|
+
className: twMerge12(
|
|
2358
|
+
"group flex p-2.5 gap-2.5 items-center cursor-pointer outline-none",
|
|
2359
|
+
"text-white focus:bg-neutral-700 data-[state=checked]:bg-neutral-900"
|
|
2360
|
+
),
|
|
2361
|
+
children: [
|
|
2362
|
+
/* @__PURE__ */ jsx25(ChainIcon, { id: chain.id, name: chain.name, url: chain.relayChain?.icon?.[theme] }),
|
|
2363
|
+
/* @__PURE__ */ jsx25("span", { className: "flex-grow flex-shrink-0", children: chain.name }),
|
|
2364
|
+
/* @__PURE__ */ jsx25("span", { className: "flex-shrink-0 font-mono text-sm text-neutral-400", children: /* @__PURE__ */ jsx25(Balance, { wei: balance }) })
|
|
2365
|
+
]
|
|
2366
|
+
},
|
|
2367
|
+
chain.id
|
|
2368
|
+
);
|
|
2369
|
+
})
|
|
2370
|
+
}
|
|
2371
|
+
) })
|
|
2372
|
+
}
|
|
2373
|
+
) }) : null
|
|
2374
|
+
]
|
|
2375
|
+
}
|
|
2376
|
+
);
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
// src/onboarding/deposit/AmountInput.tsx
|
|
2380
|
+
import { formatEther as formatEther3, parseEther as parseEther5 } from "viem";
|
|
2381
|
+
import { twMerge as twMerge13 } from "tailwind-merge";
|
|
2382
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
2383
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2384
|
+
var AmountInput = forwardRef3(function AmountInput2({ initialAmount, onChange }, forwardedRef) {
|
|
2385
|
+
return /* @__PURE__ */ jsx26(Input, { asChild: true, className: "w-full cursor-text flex items-center", children: /* @__PURE__ */ jsxs16("label", { children: [
|
|
2386
|
+
/* @__PURE__ */ jsx26(
|
|
2387
|
+
"input",
|
|
2388
|
+
{
|
|
2389
|
+
ref: forwardedRef,
|
|
2390
|
+
className: twMerge13("peer flex-grow outline-none bg-transparent", "placeholder:text-neutral-500"),
|
|
2391
|
+
placeholder: "0.005",
|
|
2392
|
+
required: true,
|
|
2393
|
+
autoFocus: true,
|
|
2394
|
+
defaultValue: initialAmount == null ? "" : formatEther3(initialAmount),
|
|
2395
|
+
onChange: (event) => {
|
|
2396
|
+
const input = event.currentTarget;
|
|
2397
|
+
if (input.value.trim() === "") {
|
|
2398
|
+
input.setCustomValidity("");
|
|
2399
|
+
onChange(void 0);
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
const value = input.value.trim().replace(/\.$/, ".0");
|
|
2403
|
+
if (!/^\d*(\.\d+)?$/.test(value)) {
|
|
2404
|
+
return input.setCustomValidity("Invalid amount.");
|
|
2405
|
+
}
|
|
2406
|
+
input.setCustomValidity("");
|
|
2407
|
+
onChange(parseEther5(value));
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
),
|
|
2411
|
+
/* @__PURE__ */ jsx26("span", { className: twMerge13("flex-shrink-0 text-2xl", "peer-placeholder-shown:text-neutral-500"), children: /* @__PURE__ */ jsx26(EthIcon, {}) })
|
|
2412
|
+
] }) });
|
|
2413
|
+
});
|
|
2414
|
+
|
|
2415
|
+
// src/onboarding/deposit/SubmitButton.tsx
|
|
2416
|
+
import { useAccount as useAccount2, useBalance as useBalance3, useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
2417
|
+
import { twMerge as twMerge14 } from "tailwind-merge";
|
|
2418
|
+
import { parseEther as parseEther6 } from "viem";
|
|
2419
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2420
|
+
var MAX_DEPOSIT_AMOUNT = "0.1";
|
|
2421
|
+
function SubmitButton({ amount, chainId, className, ...buttonProps }) {
|
|
2422
|
+
const { chainId: userChainId, address: userAddress } = useAccount2();
|
|
2423
|
+
const { data: userBalance } = useBalance3({ address: userAddress });
|
|
2424
|
+
const shouldSwitchChain = chainId != null && chainId !== userChainId;
|
|
2425
|
+
const switchChain = useSwitchChain2();
|
|
2426
|
+
if (shouldSwitchChain) {
|
|
2427
|
+
return /* @__PURE__ */ jsx27(
|
|
2428
|
+
Button,
|
|
2429
|
+
{
|
|
2430
|
+
type: "button",
|
|
2431
|
+
variant: "primary",
|
|
2432
|
+
className: twMerge14("w-full", className),
|
|
2433
|
+
pending: switchChain.isPending,
|
|
2434
|
+
onClick: () => switchChain.switchChain({ chainId }),
|
|
2435
|
+
children: "Switch chain"
|
|
2436
|
+
}
|
|
2437
|
+
);
|
|
2438
|
+
} else if (amount) {
|
|
2439
|
+
if (amount > parseEther6(MAX_DEPOSIT_AMOUNT)) {
|
|
2440
|
+
return /* @__PURE__ */ jsxs17(Button, { type: "button", className: twMerge14("w-full", className), disabled: true, children: [
|
|
2441
|
+
"Max amount is ",
|
|
2442
|
+
MAX_DEPOSIT_AMOUNT,
|
|
2443
|
+
" ETH"
|
|
2444
|
+
] });
|
|
2445
|
+
} else if (amount > (userBalance?.value ?? 0n)) {
|
|
2446
|
+
return /* @__PURE__ */ jsx27(Button, { type: "button", className: twMerge14("w-full", className), disabled: true, children: "Insufficient balance" });
|
|
2447
|
+
}
|
|
2022
2448
|
}
|
|
2023
|
-
return /* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ jsx27(Button, { type: "submit", className: twMerge14("w-full", className), ...buttonProps });
|
|
2024
2450
|
}
|
|
2025
2451
|
|
|
2026
|
-
// src/
|
|
2027
|
-
import {
|
|
2452
|
+
// src/icons/WarningIcon.tsx
|
|
2453
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2454
|
+
function WarningIcon(props) {
|
|
2455
|
+
return /* @__PURE__ */ jsx28(IconSVG, { fill: "none", ...props, children: /* @__PURE__ */ jsx28(
|
|
2456
|
+
"path",
|
|
2457
|
+
{
|
|
2458
|
+
d: "M12 9V11M12 15H12.01M5.07183 19H18.9282C20.4678 19 21.4301 17.3333 20.6603 16L13.7321 4C12.9623 2.66667 11.0378 2.66667 10.268 4L3.33978 16C2.56998 17.3333 3.53223 19 5.07183 19Z",
|
|
2459
|
+
stroke: "currentColor",
|
|
2460
|
+
strokeWidth: "2",
|
|
2461
|
+
strokeLinecap: "round",
|
|
2462
|
+
strokeLinejoin: "round"
|
|
2463
|
+
}
|
|
2464
|
+
) });
|
|
2465
|
+
}
|
|
2028
2466
|
|
|
2029
|
-
// src/
|
|
2030
|
-
import {
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2467
|
+
// src/formatGas.ts
|
|
2468
|
+
import { formatGwei } from "viem";
|
|
2469
|
+
function formatGas(wei) {
|
|
2470
|
+
const formatted = formatGwei(wei);
|
|
2471
|
+
const magnitude = Math.floor(parseFloat(formatted)).toString().length;
|
|
2472
|
+
return parseFloat(formatted).toLocaleString("en-US", { maximumFractionDigits: Math.max(0, 6 - magnitude) });
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
// src/onboarding/deposit/DepositForm.tsx
|
|
2476
|
+
import { Fragment as Fragment3, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2477
|
+
function DepositForm({
|
|
2478
|
+
sourceChain,
|
|
2479
|
+
setSourceChainId,
|
|
2480
|
+
amount,
|
|
2481
|
+
setAmount,
|
|
2482
|
+
estimatedFee,
|
|
2483
|
+
estimatedTime,
|
|
2484
|
+
onSubmit,
|
|
2485
|
+
submitButton
|
|
2486
|
+
}) {
|
|
2487
|
+
const amountInputRef = useRef4(null);
|
|
2488
|
+
const isMounted = useIsMounted();
|
|
2489
|
+
const { address: userAddress, chainId: userChainId } = useAccount3();
|
|
2490
|
+
const balance = useShowQueryError(useBalance4({ chainId: sourceChain.id, address: userAddress }));
|
|
2491
|
+
const quarryBalance = useShowQueryError(useBalance(userAddress));
|
|
2492
|
+
useWatchBlockNumber2({
|
|
2493
|
+
onBlockNumber: () => {
|
|
2494
|
+
balance.refetch();
|
|
2495
|
+
quarryBalance.refetch();
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2498
|
+
const minimumBalance = amount != null ? amount + (estimatedFee?.fee ?? 0n) : void 0;
|
|
2499
|
+
const hasMinimumBalance = balance.data != null ? balance.data.value > (minimumBalance ?? 0n) : void 0;
|
|
2500
|
+
useEffect11(() => {
|
|
2501
|
+
amountInputRef.current?.focus();
|
|
2502
|
+
}, [userChainId]);
|
|
2503
|
+
return /* @__PURE__ */ jsxs18(
|
|
2504
|
+
"form",
|
|
2035
2505
|
{
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2506
|
+
className: "flex flex-col gap-5",
|
|
2507
|
+
onSubmit: async (event) => {
|
|
2508
|
+
event.preventDefault();
|
|
2509
|
+
try {
|
|
2510
|
+
await onSubmit();
|
|
2511
|
+
if (isMounted()) {
|
|
2512
|
+
setAmount(void 0);
|
|
2513
|
+
if (amountInputRef.current) {
|
|
2514
|
+
amountInputRef.current.value = "";
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
} catch (error2) {
|
|
2518
|
+
console.error("Error during deposit", error2);
|
|
2519
|
+
} finally {
|
|
2520
|
+
amountInputRef.current?.focus();
|
|
2521
|
+
}
|
|
2522
|
+
},
|
|
2523
|
+
children: [
|
|
2524
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
2525
|
+
/* @__PURE__ */ jsx29(ChainSelect, { value: sourceChain.id, onChange: setSourceChainId }),
|
|
2526
|
+
/* @__PURE__ */ jsx29(AmountInput, { ref: amountInputRef, initialAmount: amount, onChange: setAmount })
|
|
2527
|
+
] }),
|
|
2528
|
+
/* @__PURE__ */ jsxs18(
|
|
2529
|
+
"dl",
|
|
2530
|
+
{
|
|
2531
|
+
className: twMerge15(
|
|
2532
|
+
"grid grid-cols-2 divide-y text-sm leading-loose [&_>_:is(dt,dd)]:px-1 [&_>_dd]:text-right",
|
|
2533
|
+
"divide-neutral-700 text-neutral-400"
|
|
2534
|
+
),
|
|
2535
|
+
children: [
|
|
2536
|
+
/* @__PURE__ */ jsx29("dt", { children: "Available to deposit" }),
|
|
2537
|
+
/* @__PURE__ */ jsx29("dd", { children: balance.isSuccess ? /* @__PURE__ */ jsx29(Balance, { wei: balance.data.value }) : balance.isError ? /* @__PURE__ */ jsx29("span", { title: String(balance.error), children: /* @__PURE__ */ jsx29(WarningIcon, { className: "inline-block text-amber-500" }) }) : balance.isLoading ? /* @__PURE__ */ jsx29(PendingIcon, { className: "inline-block text-xs" }) : null }),
|
|
2538
|
+
/* @__PURE__ */ jsx29("dt", { children: "Gas balance after deposit" }),
|
|
2539
|
+
/* @__PURE__ */ jsx29("dd", { children: /* @__PURE__ */ jsx29(Balance, { wei: (quarryBalance.data ?? 0n) + (amount ?? 0n) }) }),
|
|
2540
|
+
/* @__PURE__ */ jsx29("dt", { children: "Estimated fee" }),
|
|
2541
|
+
/* @__PURE__ */ jsx29("dd", { children: estimatedFee.fee ? /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
2542
|
+
formatGas(estimatedFee.fee),
|
|
2543
|
+
" gwei"
|
|
2544
|
+
] }) : estimatedFee.error ? /* @__PURE__ */ jsx29("span", { title: String(estimatedFee.error), children: /* @__PURE__ */ jsx29(WarningIcon, { className: "inline-block text-amber-500" }) }) : estimatedFee.isLoading ? /* @__PURE__ */ jsx29(PendingIcon, { className: "inline-block text-xs" }) : null }),
|
|
2545
|
+
/* @__PURE__ */ jsx29("dt", { children: "Time to deposit" }),
|
|
2546
|
+
/* @__PURE__ */ jsx29("dd", { children: estimatedTime })
|
|
2547
|
+
]
|
|
2548
|
+
}
|
|
2549
|
+
),
|
|
2550
|
+
hasMinimumBalance ? submitButton : /* @__PURE__ */ jsx29(SubmitButton, { disabled: true, children: "Not enough funds" })
|
|
2551
|
+
]
|
|
2042
2552
|
}
|
|
2043
2553
|
);
|
|
2044
2554
|
}
|
|
2045
2555
|
|
|
2556
|
+
// src/onboarding/deposit/useDeposits.ts
|
|
2557
|
+
import { createStore as createStore4 } from "zustand/vanilla";
|
|
2558
|
+
import { useStore as useStore2 } from "zustand";
|
|
2559
|
+
import { useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
2560
|
+
var store4 = createStore4(() => ({
|
|
2561
|
+
count: 0,
|
|
2562
|
+
deposits: []
|
|
2563
|
+
}));
|
|
2564
|
+
function useDeposits() {
|
|
2565
|
+
const deposits = useStore2(store4, (state) => state.deposits);
|
|
2566
|
+
const addDeposit = useCallback2((transaction) => {
|
|
2567
|
+
store4.setState((state) => {
|
|
2568
|
+
if (transaction.type === "relay") {
|
|
2569
|
+
const existingDeposit = state.deposits.find(
|
|
2570
|
+
(deposit) => deposit.type === "relay" && deposit.requestId === transaction.requestId
|
|
2571
|
+
);
|
|
2572
|
+
if (existingDeposit) {
|
|
2573
|
+
return state;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
return {
|
|
2577
|
+
count: state.count + 1,
|
|
2578
|
+
deposits: [
|
|
2579
|
+
...state.deposits,
|
|
2580
|
+
{
|
|
2581
|
+
...transaction,
|
|
2582
|
+
uid: `deposit-${state.count}`
|
|
2583
|
+
}
|
|
2584
|
+
]
|
|
2585
|
+
};
|
|
2586
|
+
});
|
|
2587
|
+
}, []);
|
|
2588
|
+
const removeDeposit = useCallback2((uid) => {
|
|
2589
|
+
store4.setState((state) => ({
|
|
2590
|
+
deposits: state.deposits.filter((deposit) => deposit.uid !== uid)
|
|
2591
|
+
}));
|
|
2592
|
+
}, []);
|
|
2593
|
+
return useMemo3(
|
|
2594
|
+
() => ({
|
|
2595
|
+
deposits,
|
|
2596
|
+
addDeposit,
|
|
2597
|
+
removeDeposit
|
|
2598
|
+
}),
|
|
2599
|
+
[addDeposit, deposits, removeDeposit]
|
|
2600
|
+
);
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
// src/onboarding/deposit/DepositViaTransferForm.tsx
|
|
2604
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2605
|
+
function DepositViaTransferForm({ amount, setAmount, sourceChain, setSourceChainId }) {
|
|
2606
|
+
const { chain } = useEntryKitConfig();
|
|
2607
|
+
const paymaster = getPaymaster(chain);
|
|
2608
|
+
const publicClient = usePublicClient();
|
|
2609
|
+
const { address: userAddress } = useAccount4();
|
|
2610
|
+
const { writeContractAsync } = useWriteContract();
|
|
2611
|
+
const { addDeposit } = useDeposits();
|
|
2612
|
+
if (!userAddress) {
|
|
2613
|
+
throw new Error("User address not found");
|
|
2614
|
+
}
|
|
2615
|
+
const { data: gasPrice } = useQuery12({
|
|
2616
|
+
queryKey: ["gasPrice", sourceChain.id],
|
|
2617
|
+
queryFn: async () => {
|
|
2618
|
+
if (!publicClient) throw new Error("Public client not available");
|
|
2619
|
+
return publicClient.getGasPrice();
|
|
2620
|
+
},
|
|
2621
|
+
refetchInterval: 15e3,
|
|
2622
|
+
enabled: !!publicClient
|
|
2623
|
+
});
|
|
2624
|
+
const { data: prepareData, error: prepareError } = usePrepareTransactionRequest({
|
|
2625
|
+
to: paymaster?.address,
|
|
2626
|
+
data: encodeFunctionData2({
|
|
2627
|
+
abi: paymasterAbi,
|
|
2628
|
+
functionName: "depositTo",
|
|
2629
|
+
args: [userAddress]
|
|
2630
|
+
}),
|
|
2631
|
+
value: amount
|
|
2632
|
+
});
|
|
2633
|
+
const deposit = useMutation4({
|
|
2634
|
+
mutationKey: ["depositViaTransfer", amount?.toString()],
|
|
2635
|
+
mutationFn: async () => {
|
|
2636
|
+
if (!paymaster) throw new Error("Paymaster not found");
|
|
2637
|
+
if (!publicClient) throw new Error("Public client not found");
|
|
2638
|
+
if (!amount) throw new Error("Amount cannot be 0");
|
|
2639
|
+
try {
|
|
2640
|
+
const hash = await writeContractAsync({
|
|
2641
|
+
address: paymaster.address,
|
|
2642
|
+
abi: paymasterAbi,
|
|
2643
|
+
functionName: "depositTo",
|
|
2644
|
+
args: [userAddress],
|
|
2645
|
+
value: amount
|
|
2646
|
+
});
|
|
2647
|
+
const receipt = publicClient.waitForTransactionReceipt({ hash }).then((receipt2) => {
|
|
2648
|
+
if (receipt2.status === "reverted") {
|
|
2649
|
+
throw new Error("Transfer transaction reverted.");
|
|
2650
|
+
}
|
|
2651
|
+
return receipt2;
|
|
2652
|
+
});
|
|
2653
|
+
const pendingDeposit = {
|
|
2654
|
+
type: "transfer",
|
|
2655
|
+
amount,
|
|
2656
|
+
chainL1Id: sourceChain.id,
|
|
2657
|
+
chainL2Id: chain.id,
|
|
2658
|
+
hash,
|
|
2659
|
+
receipt,
|
|
2660
|
+
start: /* @__PURE__ */ new Date(),
|
|
2661
|
+
estimatedTime: 1e3 * 12,
|
|
2662
|
+
isComplete: receipt.then(() => void 0)
|
|
2663
|
+
};
|
|
2664
|
+
addDeposit(pendingDeposit);
|
|
2665
|
+
} catch (error2) {
|
|
2666
|
+
console.error("Error while depositing via bridge", error2);
|
|
2667
|
+
throw error2;
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
const estimatedFee = prepareData?.gas && gasPrice ? prepareData.gas * gasPrice : void 0;
|
|
2672
|
+
return /* @__PURE__ */ jsx30(
|
|
2673
|
+
DepositForm,
|
|
2674
|
+
{
|
|
2675
|
+
sourceChain,
|
|
2676
|
+
setSourceChainId,
|
|
2677
|
+
amount,
|
|
2678
|
+
setAmount,
|
|
2679
|
+
estimatedFee: {
|
|
2680
|
+
fee: estimatedFee,
|
|
2681
|
+
isLoading: !prepareData && !prepareError || !gasPrice,
|
|
2682
|
+
error: prepareError instanceof Error ? prepareError : void 0
|
|
2683
|
+
},
|
|
2684
|
+
estimatedTime: "A few seconds",
|
|
2685
|
+
onSubmit: async () => {
|
|
2686
|
+
await deposit.mutateAsync();
|
|
2687
|
+
},
|
|
2688
|
+
submitButton: /* @__PURE__ */ jsx30(
|
|
2689
|
+
SubmitButton,
|
|
2690
|
+
{
|
|
2691
|
+
variant: "primary",
|
|
2692
|
+
amount,
|
|
2693
|
+
chainId: sourceChain.id,
|
|
2694
|
+
disabled: !!prepareError || !amount || !userAddress,
|
|
2695
|
+
pending: deposit.isPending,
|
|
2696
|
+
children: "Deposit"
|
|
2697
|
+
}
|
|
2698
|
+
)
|
|
2699
|
+
}
|
|
2700
|
+
);
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
// src/onboarding/deposit/DepositViaRelayForm.tsx
|
|
2704
|
+
import { encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
2705
|
+
import { useAccount as useAccount5, useWalletClient } from "wagmi";
|
|
2706
|
+
import { useMutation as useMutation5, useQuery as useQuery13 } from "@tanstack/react-query";
|
|
2707
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2708
|
+
var ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2709
|
+
function DepositViaRelayForm({ amount, setAmount, sourceChain, setSourceChainId }) {
|
|
2710
|
+
const { chain, chainId: destinationChainId } = useEntryKitConfig();
|
|
2711
|
+
const paymaster = getPaymaster(chain);
|
|
2712
|
+
const { data: wallet } = useWalletClient();
|
|
2713
|
+
const { address: userAddress } = useAccount5();
|
|
2714
|
+
const { addDeposit } = useDeposits();
|
|
2715
|
+
const { data: relay } = useRelay();
|
|
2716
|
+
const relayClient = relay?.client;
|
|
2717
|
+
const quote = useQuery13({
|
|
2718
|
+
queryKey: ["relayBridgeQuote", sourceChain.id, amount?.toString()],
|
|
2719
|
+
queryFn: async () => {
|
|
2720
|
+
if (!relayClient) throw new Error("No Relay client found.");
|
|
2721
|
+
if (!userAddress) throw new Error("No user address found.");
|
|
2722
|
+
const result = await relayClient.actions.getQuote({
|
|
2723
|
+
chainId: sourceChain.id,
|
|
2724
|
+
toChainId: destinationChainId,
|
|
2725
|
+
currency: ETH_ADDRESS,
|
|
2726
|
+
toCurrency: ETH_ADDRESS,
|
|
2727
|
+
amount: amount?.toString(),
|
|
2728
|
+
tradeType: "EXACT_OUTPUT",
|
|
2729
|
+
recipient: paymaster?.address,
|
|
2730
|
+
wallet,
|
|
2731
|
+
txs: [
|
|
2732
|
+
{
|
|
2733
|
+
to: paymaster?.address,
|
|
2734
|
+
data: encodeFunctionData3({
|
|
2735
|
+
abi: paymasterAbi,
|
|
2736
|
+
functionName: "depositTo",
|
|
2737
|
+
args: [userAddress]
|
|
2738
|
+
}),
|
|
2739
|
+
value: amount?.toString()
|
|
2740
|
+
}
|
|
2741
|
+
]
|
|
2742
|
+
});
|
|
2743
|
+
if (!result) {
|
|
2744
|
+
throw new Error("Failed to get relay quote");
|
|
2745
|
+
}
|
|
2746
|
+
return result;
|
|
2747
|
+
},
|
|
2748
|
+
retry: 1,
|
|
2749
|
+
refetchInterval: 15e3,
|
|
2750
|
+
enabled: !!amount && !!userAddress && !!relayClient
|
|
2751
|
+
});
|
|
2752
|
+
const deposit = useMutation5({
|
|
2753
|
+
mutationKey: ["depositViaRelay", sourceChain.id, amount?.toString()],
|
|
2754
|
+
mutationFn: async ({ quote: quote2, amount: amount2 }) => {
|
|
2755
|
+
if (!relayClient) throw new Error("No Relay client found.");
|
|
2756
|
+
if (!wallet) throw new Error("No wallet found.");
|
|
2757
|
+
try {
|
|
2758
|
+
return new Promise((resolve) => {
|
|
2759
|
+
const pendingDeposit = relayClient.actions.execute({
|
|
2760
|
+
quote: quote2,
|
|
2761
|
+
wallet,
|
|
2762
|
+
onProgress(progress) {
|
|
2763
|
+
const currentStep = progress.currentStep;
|
|
2764
|
+
const requestId = currentStep?.requestId;
|
|
2765
|
+
const currentState = currentStep?.items[0]?.progressState;
|
|
2766
|
+
if (requestId && currentState === "validating") {
|
|
2767
|
+
addDeposit({
|
|
2768
|
+
type: "relay",
|
|
2769
|
+
requestId,
|
|
2770
|
+
amount: amount2,
|
|
2771
|
+
chainL1Id: sourceChain.id,
|
|
2772
|
+
chainL2Id: destinationChainId,
|
|
2773
|
+
start: /* @__PURE__ */ new Date(),
|
|
2774
|
+
estimatedTime: 1e3 * 30,
|
|
2775
|
+
depositPromise: pendingDeposit,
|
|
2776
|
+
isComplete: pendingDeposit.then(() => void 0)
|
|
2777
|
+
});
|
|
2778
|
+
resolve(void 0);
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
});
|
|
2782
|
+
});
|
|
2783
|
+
} catch (error2) {
|
|
2784
|
+
console.error("Error while depositing via Relay", error2);
|
|
2785
|
+
throw error2;
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
});
|
|
2789
|
+
const fees = quote.data?.fees;
|
|
2790
|
+
const gasFee = BigInt(fees?.gas?.amount ?? 0);
|
|
2791
|
+
const relayerFee = BigInt(fees?.relayer?.amount ?? 0);
|
|
2792
|
+
const fee = gasFee + relayerFee;
|
|
2793
|
+
return /* @__PURE__ */ jsx31(
|
|
2794
|
+
DepositForm,
|
|
2795
|
+
{
|
|
2796
|
+
sourceChain,
|
|
2797
|
+
setSourceChainId,
|
|
2798
|
+
amount,
|
|
2799
|
+
setAmount,
|
|
2800
|
+
estimatedFee: {
|
|
2801
|
+
fee: fee != null ? BigInt(fee) : void 0,
|
|
2802
|
+
isLoading: quote.isLoading,
|
|
2803
|
+
error: quote.error instanceof Error ? quote.error : void 0
|
|
2804
|
+
},
|
|
2805
|
+
estimatedTime: "A few seconds",
|
|
2806
|
+
onSubmit: async () => {
|
|
2807
|
+
if (!quote.data || !amount) return;
|
|
2808
|
+
await deposit.mutateAsync({ quote: quote.data, amount });
|
|
2809
|
+
},
|
|
2810
|
+
submitButton: /* @__PURE__ */ jsx31(
|
|
2811
|
+
SubmitButton,
|
|
2812
|
+
{
|
|
2813
|
+
variant: "primary",
|
|
2814
|
+
amount,
|
|
2815
|
+
chainId: sourceChain.id,
|
|
2816
|
+
disabled: quote.isError || !amount,
|
|
2817
|
+
pending: deposit.isPending,
|
|
2818
|
+
children: "Deposit"
|
|
2819
|
+
}
|
|
2820
|
+
)
|
|
2821
|
+
}
|
|
2822
|
+
);
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// src/onboarding/deposit/Deposits.tsx
|
|
2826
|
+
import { useEffect as useEffect13 } from "react";
|
|
2827
|
+
import { useQuery as useQuery16, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
2828
|
+
|
|
2829
|
+
// src/onboarding/deposit/TransferDepositStatus.tsx
|
|
2830
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
2831
|
+
|
|
2832
|
+
// src/onboarding/deposit/DepositStatus.tsx
|
|
2833
|
+
import { useEffect as useEffect12, useState as useState3 } from "react";
|
|
2834
|
+
import { twMerge as twMerge16 } from "tailwind-merge";
|
|
2835
|
+
|
|
2046
2836
|
// src/icons/CloseIcon.tsx
|
|
2047
|
-
import { jsx as
|
|
2837
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2048
2838
|
function CloseIcon(props) {
|
|
2049
|
-
return /* @__PURE__ */
|
|
2839
|
+
return /* @__PURE__ */ jsx32(IconSVG, { strokeWidth: "2", stroke: "currentColor", ...props, children: /* @__PURE__ */ jsx32(
|
|
2050
2840
|
"path",
|
|
2051
2841
|
{
|
|
2052
2842
|
d: "M6 18L18 6M6 6L18 18",
|
|
@@ -2059,52 +2849,583 @@ function CloseIcon(props) {
|
|
|
2059
2849
|
) });
|
|
2060
2850
|
}
|
|
2061
2851
|
|
|
2852
|
+
// src/onboarding/deposit/DepositStatus.tsx
|
|
2853
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2854
|
+
function DepositStatus({ status, progress, children, onDismiss }) {
|
|
2855
|
+
const [appear, setAppear] = useState3(false);
|
|
2856
|
+
useEffect12(() => {
|
|
2857
|
+
setAppear(true);
|
|
2858
|
+
}, []);
|
|
2859
|
+
return /* @__PURE__ */ jsxs19("div", { className: "group bg-neutral-900 flex flex-col animate-in fade-in slide-in-from-bottom-2 animate-out fade-out", children: [
|
|
2860
|
+
/* @__PURE__ */ jsxs19("div", { className: "py-1 text-sm flex items-center gap-2", children: [
|
|
2861
|
+
/* @__PURE__ */ jsx33("div", { className: "flex-grow", children }),
|
|
2862
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex-shrink-0 grid", children: [
|
|
2863
|
+
/* @__PURE__ */ jsx33("span", { className: "col-start-1 row-start-1 transition opacity-100 group-hover:opacity-0 group-hover:pointer-events-none", children: status === "success" ? /* @__PURE__ */ jsx33(CheckIcon, { className: "text-green-600" }) : status === "error" ? /* @__PURE__ */ jsx33(WarningIcon, { className: "text-amber-500" }) : /* @__PURE__ */ jsx33(PendingIcon, { className: "text-neutral-500 transition" }) }),
|
|
2864
|
+
/* @__PURE__ */ jsx33(
|
|
2865
|
+
"button",
|
|
2866
|
+
{
|
|
2867
|
+
type: "button",
|
|
2868
|
+
className: twMerge16(
|
|
2869
|
+
"col-start-1 row-start-1 flex items-center justify-center transition",
|
|
2870
|
+
"opacity-0 pointer-events-none",
|
|
2871
|
+
"group-hover:opacity-100 group-hover:pointer-events-auto",
|
|
2872
|
+
"text-neutral-500 hover:text-white"
|
|
2873
|
+
),
|
|
2874
|
+
title: "Dismiss",
|
|
2875
|
+
onClick: onDismiss,
|
|
2876
|
+
children: /* @__PURE__ */ jsx33(CloseIcon, {})
|
|
2877
|
+
}
|
|
2878
|
+
)
|
|
2879
|
+
] })
|
|
2880
|
+
] }),
|
|
2881
|
+
/* @__PURE__ */ jsx33("div", { className: "w-full h-[2px] -mt-full overflow-clip", children: /* @__PURE__ */ jsx33(
|
|
2882
|
+
"div",
|
|
2883
|
+
{
|
|
2884
|
+
className: twMerge16(
|
|
2885
|
+
"w-full h-full transition ease-linear",
|
|
2886
|
+
status === "success" ? "bg-green-600" : status === "error" ? "bg-red-600" : "bg-blue-600",
|
|
2887
|
+
status === "pending" ? "opacity-100" : "opacity-0"
|
|
2888
|
+
),
|
|
2889
|
+
style: status === "pending" ? {
|
|
2890
|
+
transform: appear ? `translateX(0)` : "translate(-100%)",
|
|
2891
|
+
transitionDuration: `${progress.duration}ms`,
|
|
2892
|
+
transitionDelay: `-${Math.min(progress.duration, progress.elapsed)}ms`
|
|
2893
|
+
} : void 0
|
|
2894
|
+
}
|
|
2895
|
+
) })
|
|
2896
|
+
] });
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
// src/onboarding/deposit/TransferDepositStatus.tsx
|
|
2900
|
+
import { useChains as useChains2 } from "wagmi";
|
|
2901
|
+
import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2902
|
+
function TransferDepositStatus({
|
|
2903
|
+
amount,
|
|
2904
|
+
chainL1Id,
|
|
2905
|
+
hash,
|
|
2906
|
+
receipt: receiptPromise,
|
|
2907
|
+
start,
|
|
2908
|
+
estimatedTime,
|
|
2909
|
+
onDismiss
|
|
2910
|
+
}) {
|
|
2911
|
+
const chains = useChains2();
|
|
2912
|
+
const chain = chains.find((chain2) => chain2.id === chainL1Id);
|
|
2913
|
+
const receipt = useQuery14({
|
|
2914
|
+
queryKey: ["transferDepositStatus", hash],
|
|
2915
|
+
queryFn: () => receiptPromise
|
|
2916
|
+
});
|
|
2917
|
+
return /* @__PURE__ */ jsx34(
|
|
2918
|
+
DepositStatus,
|
|
2919
|
+
{
|
|
2920
|
+
status: receipt.status,
|
|
2921
|
+
progress: {
|
|
2922
|
+
duration: estimatedTime,
|
|
2923
|
+
elapsed: Math.min(estimatedTime, Date.now() - start.getTime())
|
|
2924
|
+
},
|
|
2925
|
+
onDismiss,
|
|
2926
|
+
children: (() => {
|
|
2927
|
+
const blockExplorer = chain.blockExplorers?.default.url;
|
|
2928
|
+
if (receipt.status === "pending") {
|
|
2929
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2930
|
+
"Confirming deposit on",
|
|
2931
|
+
" ",
|
|
2932
|
+
/* @__PURE__ */ jsx34(
|
|
2933
|
+
"a",
|
|
2934
|
+
{
|
|
2935
|
+
href: blockExplorer ? `${blockExplorer}/tx/${hash}` : void 0,
|
|
2936
|
+
target: "_blank",
|
|
2937
|
+
rel: "noreferrer noopener",
|
|
2938
|
+
children: chain.name
|
|
2939
|
+
}
|
|
2940
|
+
),
|
|
2941
|
+
"\u2026"
|
|
2942
|
+
] });
|
|
2943
|
+
}
|
|
2944
|
+
if (receipt.status === "error") {
|
|
2945
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2946
|
+
"Could not find deposit on",
|
|
2947
|
+
" ",
|
|
2948
|
+
/* @__PURE__ */ jsx34(
|
|
2949
|
+
"a",
|
|
2950
|
+
{
|
|
2951
|
+
href: blockExplorer ? `${blockExplorer}/tx/${hash}` : void 0,
|
|
2952
|
+
target: "_blank",
|
|
2953
|
+
rel: "noreferrer noopener",
|
|
2954
|
+
children: chain.name
|
|
2955
|
+
}
|
|
2956
|
+
),
|
|
2957
|
+
"."
|
|
2958
|
+
] });
|
|
2959
|
+
}
|
|
2960
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2961
|
+
"Successfully",
|
|
2962
|
+
" ",
|
|
2963
|
+
/* @__PURE__ */ jsx34(
|
|
2964
|
+
"a",
|
|
2965
|
+
{
|
|
2966
|
+
href: blockExplorer ? `${blockExplorer}/tx/${receipt.data.transactionHash}` : void 0,
|
|
2967
|
+
target: "_blank",
|
|
2968
|
+
rel: "noreferrer noopener",
|
|
2969
|
+
children: "deposited"
|
|
2970
|
+
}
|
|
2971
|
+
),
|
|
2972
|
+
" ",
|
|
2973
|
+
/* @__PURE__ */ jsx34(Balance, { wei: amount })
|
|
2974
|
+
] });
|
|
2975
|
+
})()
|
|
2976
|
+
}
|
|
2977
|
+
);
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
// src/onboarding/deposit/RelayDepositStatus.tsx
|
|
2981
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
2982
|
+
import { useChains as useChains3 } from "wagmi";
|
|
2983
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2984
|
+
function RelayDepositStatus({
|
|
2985
|
+
amount,
|
|
2986
|
+
chainL1Id,
|
|
2987
|
+
chainL2Id,
|
|
2988
|
+
start,
|
|
2989
|
+
estimatedTime,
|
|
2990
|
+
depositPromise,
|
|
2991
|
+
onDismiss
|
|
2992
|
+
}) {
|
|
2993
|
+
const chains = useChains3();
|
|
2994
|
+
const chainL1 = chains.find((chain) => chain.id === chainL1Id);
|
|
2995
|
+
const chainL2 = chains.find((chain) => chain.id === chainL2Id);
|
|
2996
|
+
const deposit = useQuery15({
|
|
2997
|
+
queryKey: ["relayDepositPromise", chainL1Id, chainL2Id, amount.toString(), start.toISOString()],
|
|
2998
|
+
queryFn: () => depositPromise
|
|
2999
|
+
});
|
|
3000
|
+
return /* @__PURE__ */ jsx35(
|
|
3001
|
+
DepositStatus,
|
|
3002
|
+
{
|
|
3003
|
+
status: deposit.status,
|
|
3004
|
+
progress: {
|
|
3005
|
+
duration: estimatedTime,
|
|
3006
|
+
elapsed: Math.min(estimatedTime, Date.now() - start.getTime())
|
|
3007
|
+
},
|
|
3008
|
+
onDismiss,
|
|
3009
|
+
children: (() => {
|
|
3010
|
+
if (deposit.status === "pending") {
|
|
3011
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3012
|
+
"Relay bridge deposit pending on ",
|
|
3013
|
+
chainL1.name,
|
|
3014
|
+
"\u2026"
|
|
3015
|
+
] });
|
|
3016
|
+
}
|
|
3017
|
+
if (deposit.status === "error") {
|
|
3018
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3019
|
+
"Relay bridge deposit to ",
|
|
3020
|
+
chainL2.name,
|
|
3021
|
+
" failed."
|
|
3022
|
+
] });
|
|
3023
|
+
}
|
|
3024
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3025
|
+
"Successfully bridged ",
|
|
3026
|
+
/* @__PURE__ */ jsx35(Balance, { wei: amount }),
|
|
3027
|
+
" to ",
|
|
3028
|
+
chainL2.name,
|
|
3029
|
+
"!"
|
|
3030
|
+
] });
|
|
3031
|
+
})()
|
|
3032
|
+
}
|
|
3033
|
+
);
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
// src/onboarding/deposit/Deposits.tsx
|
|
3037
|
+
import { useAccount as useAccount6, useClient as useClient11 } from "wagmi";
|
|
3038
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3039
|
+
function Deposits() {
|
|
3040
|
+
const queryClient = useQueryClient7();
|
|
3041
|
+
const { chainId } = useEntryKitConfig();
|
|
3042
|
+
const client = useClient11({ chainId });
|
|
3043
|
+
const { address: userAddress } = useAccount6();
|
|
3044
|
+
const { deposits, removeDeposit } = useDeposits();
|
|
3045
|
+
const { data: isComplete } = useQuery16({
|
|
3046
|
+
queryKey: ["depositsComplete", deposits.map((deposit) => deposit.uid)],
|
|
3047
|
+
queryFn: async () => {
|
|
3048
|
+
if (!deposits.length) return false;
|
|
3049
|
+
await Promise.all(deposits.map((deposit) => deposit.isComplete));
|
|
3050
|
+
return true;
|
|
3051
|
+
}
|
|
3052
|
+
});
|
|
3053
|
+
useEffect13(() => {
|
|
3054
|
+
if (isComplete) {
|
|
3055
|
+
queryClient.invalidateQueries({ queryKey: ["balance"] });
|
|
3056
|
+
queryClient.invalidateQueries({ queryKey: ["getBalance", client?.uid, userAddress] });
|
|
3057
|
+
}
|
|
3058
|
+
}, [client?.uid, isComplete, queryClient, userAddress]);
|
|
3059
|
+
if (!deposits.length) return null;
|
|
3060
|
+
return /* @__PURE__ */ jsx36("div", { className: "flex flex-col gap-1 mt-4", children: deposits.map((deposit) => {
|
|
3061
|
+
if (deposit.type === "transfer") {
|
|
3062
|
+
return /* @__PURE__ */ jsx36(TransferDepositStatus, { ...deposit, onDismiss: () => removeDeposit(deposit.uid) }, deposit.uid);
|
|
3063
|
+
} else if (deposit.type === "relay") {
|
|
3064
|
+
return /* @__PURE__ */ jsx36(RelayDepositStatus, { ...deposit, onDismiss: () => removeDeposit(deposit.uid) }, deposit.uid);
|
|
3065
|
+
}
|
|
3066
|
+
}) });
|
|
3067
|
+
}
|
|
3068
|
+
|
|
3069
|
+
// src/onboarding/deposit/DepositFormContainer.tsx
|
|
3070
|
+
import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3071
|
+
function DepositFormContainer() {
|
|
3072
|
+
const { chainId: destinationChainId } = useEntryKitConfig();
|
|
3073
|
+
const chainId = useChainId();
|
|
3074
|
+
const chains = useChains4();
|
|
3075
|
+
const [amount, setAmount] = useState4(void 0);
|
|
3076
|
+
const [sourceChainId, setSourceChainId] = useState4(chainId);
|
|
3077
|
+
const sourceChain = chains.find(({ id }) => id === sourceChainId);
|
|
3078
|
+
return /* @__PURE__ */ jsxs22("div", { className: "pt-10 pb-2", children: [
|
|
3079
|
+
destinationChainId === sourceChainId ? /* @__PURE__ */ jsx37(
|
|
3080
|
+
DepositViaTransferForm,
|
|
3081
|
+
{
|
|
3082
|
+
amount,
|
|
3083
|
+
setAmount,
|
|
3084
|
+
sourceChain,
|
|
3085
|
+
setSourceChainId
|
|
3086
|
+
}
|
|
3087
|
+
) : /* @__PURE__ */ jsx37(
|
|
3088
|
+
DepositViaRelayForm,
|
|
3089
|
+
{
|
|
3090
|
+
amount,
|
|
3091
|
+
setAmount,
|
|
3092
|
+
sourceChain,
|
|
3093
|
+
setSourceChainId
|
|
3094
|
+
}
|
|
3095
|
+
),
|
|
3096
|
+
/* @__PURE__ */ jsx37(Deposits, {})
|
|
3097
|
+
] });
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
// src/icons/ArrowLeftIcon.tsx
|
|
3101
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3102
|
+
function ArrowLeftIcon(props) {
|
|
3103
|
+
return /* @__PURE__ */ jsx38(IconSVG, { ...props, children: /* @__PURE__ */ jsx38(
|
|
3104
|
+
"path",
|
|
3105
|
+
{
|
|
3106
|
+
d: "M19 12H5M12 19l-7-7 7-7",
|
|
3107
|
+
fill: "none",
|
|
3108
|
+
stroke: "currentColor",
|
|
3109
|
+
strokeWidth: "2",
|
|
3110
|
+
strokeLinecap: "round",
|
|
3111
|
+
strokeLinejoin: "round"
|
|
3112
|
+
}
|
|
3113
|
+
) });
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
// src/onboarding/quarry/WithdrawGasBalanceButton.tsx
|
|
3117
|
+
import { getAction as getAction6 } from "viem/utils";
|
|
3118
|
+
import { waitForTransactionReceipt as waitForTransactionReceipt3 } from "viem/actions";
|
|
3119
|
+
import { useAccount as useAccount7, useClient as useClient12, useSwitchChain as useSwitchChain3, useWriteContract as useWriteContract2 } from "wagmi";
|
|
3120
|
+
import { twMerge as twMerge17 } from "tailwind-merge";
|
|
3121
|
+
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
3122
|
+
import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
3123
|
+
import { jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3124
|
+
function WithdrawGasBalanceButton({ userAddress }) {
|
|
3125
|
+
const { writeContractAsync } = useWriteContract2();
|
|
3126
|
+
const { switchChain } = useSwitchChain3();
|
|
3127
|
+
const { chain, chainId } = useEntryKitConfig();
|
|
3128
|
+
const { chainId: userChainId } = useAccount7();
|
|
3129
|
+
const queryClient = useQueryClient8();
|
|
3130
|
+
const client = useClient12({ chainId });
|
|
3131
|
+
const paymaster = getPaymaster(chain);
|
|
3132
|
+
const balance = useShowQueryError(useBalance(userAddress));
|
|
3133
|
+
const shouldSwitchChain = chainId != null && chainId !== userChainId;
|
|
3134
|
+
const withdraw = useMutation6({
|
|
3135
|
+
mutationKey: ["withdraw", userAddress],
|
|
3136
|
+
mutationFn: async () => {
|
|
3137
|
+
if (!client) throw new Error("Client not ready.");
|
|
3138
|
+
if (!paymaster) throw new Error("Paymaster not found");
|
|
3139
|
+
if (!balance.data) throw new Error("No gas balance to withdraw.");
|
|
3140
|
+
try {
|
|
3141
|
+
const hash = await writeContractAsync({
|
|
3142
|
+
address: paymaster.address,
|
|
3143
|
+
abi: paymasterAbi,
|
|
3144
|
+
functionName: "withdrawTo",
|
|
3145
|
+
args: [userAddress, balance.data],
|
|
3146
|
+
chainId
|
|
3147
|
+
});
|
|
3148
|
+
await getAction6(client, waitForTransactionReceipt3, "waitForTransactionReceipt")({ hash });
|
|
3149
|
+
await Promise.all([
|
|
3150
|
+
queryClient.invalidateQueries({ queryKey: ["balance"] }),
|
|
3151
|
+
queryClient.invalidateQueries({ queryKey: ["getPrerequisites"] })
|
|
3152
|
+
]);
|
|
3153
|
+
} catch (error2) {
|
|
3154
|
+
console.error("Error while withdrawing", error2);
|
|
3155
|
+
throw error2;
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
if (balance.data == null || balance.data === 0n) {
|
|
3160
|
+
return null;
|
|
3161
|
+
}
|
|
3162
|
+
return /* @__PURE__ */ jsx39(
|
|
3163
|
+
"button",
|
|
3164
|
+
{
|
|
3165
|
+
onClick: () => {
|
|
3166
|
+
if (shouldSwitchChain) {
|
|
3167
|
+
return switchChain({ chainId });
|
|
3168
|
+
}
|
|
3169
|
+
withdraw.mutate();
|
|
3170
|
+
},
|
|
3171
|
+
className: twMerge17(
|
|
3172
|
+
"text-sm font-medium text-white/50 group whitespace-nowrap",
|
|
3173
|
+
withdraw.isPending ? "opacity-50 pointer-events-none" : "cursor-pointer hover:text-white"
|
|
3174
|
+
),
|
|
3175
|
+
disabled: withdraw.isPending,
|
|
3176
|
+
children: /* @__PURE__ */ jsxs23("span", { className: "inline-block", children: [
|
|
3177
|
+
/* @__PURE__ */ jsxs23(
|
|
3178
|
+
"span",
|
|
3179
|
+
{
|
|
3180
|
+
className: twMerge17(
|
|
3181
|
+
"inline-flex items-center gap-1 underline decoration-neutral-500 underline-offset-4",
|
|
3182
|
+
!withdraw.isPending && "hover:decoration-orange-500",
|
|
3183
|
+
shouldSwitchChain && "group-hover:hidden"
|
|
3184
|
+
),
|
|
3185
|
+
children: [
|
|
3186
|
+
withdraw.isPending && /* @__PURE__ */ jsx39(PendingIcon, { className: "w-3 h-3" }),
|
|
3187
|
+
"Withdraw"
|
|
3188
|
+
]
|
|
3189
|
+
}
|
|
3190
|
+
),
|
|
3191
|
+
shouldSwitchChain && /* @__PURE__ */ jsx39("span", { className: "hidden group-hover:inline-block underline decoration-neutral-500 underline-offset-4 hover:decoration-orange-500", children: "Switch chain" })
|
|
3192
|
+
] })
|
|
3193
|
+
}
|
|
3194
|
+
);
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
// src/onboarding/quarry/GasBalance.tsx
|
|
3198
|
+
import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3199
|
+
function GasBalance2({ isActive, isExpanded, isFocused, setFocused, userAddress }) {
|
|
3200
|
+
const queryClient = useQueryClient9();
|
|
3201
|
+
const balance = useShowQueryError(useBalance(userAddress));
|
|
3202
|
+
const prevBalance = usePrevious(balance.data || 0n);
|
|
3203
|
+
useEffect14(() => {
|
|
3204
|
+
if (balance.data != null && prevBalance === 0n && balance.data > 0n) {
|
|
3205
|
+
queryClient.invalidateQueries({ queryKey: ["getPrerequisites"] });
|
|
3206
|
+
setFocused(false);
|
|
3207
|
+
}
|
|
3208
|
+
}, [balance.data, prevBalance, setFocused, queryClient, userAddress]);
|
|
3209
|
+
if (isFocused) {
|
|
3210
|
+
return /* @__PURE__ */ jsxs24("div", { children: [
|
|
3211
|
+
isFocused && /* @__PURE__ */ jsx40("div", { className: "absolute top-0 left-0", children: /* @__PURE__ */ jsx40(
|
|
3212
|
+
"div",
|
|
3213
|
+
{
|
|
3214
|
+
className: "flex items-center justify-center w-10 h-10 text-white/20 hover:text-white/40 cursor-pointer",
|
|
3215
|
+
onClick: () => setFocused(false),
|
|
3216
|
+
children: /* @__PURE__ */ jsx40(ArrowLeftIcon, { className: "m-0" })
|
|
3217
|
+
}
|
|
3218
|
+
) }),
|
|
3219
|
+
/* @__PURE__ */ jsx40(DepositFormContainer, {})
|
|
3220
|
+
] });
|
|
3221
|
+
}
|
|
3222
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4", children: [
|
|
3223
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex justify-between gap-4", children: [
|
|
3224
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
3225
|
+
/* @__PURE__ */ jsx40("div", { children: "Gas balance" }),
|
|
3226
|
+
/* @__PURE__ */ jsx40("div", { className: "font-mono text-white", children: balance.data != null ? /* @__PURE__ */ jsx40(Balance, { wei: balance.data }) : /* @__PURE__ */ jsx40(PendingIcon, { className: "text-sm" }) })
|
|
3227
|
+
] }),
|
|
3228
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1 justify-center items-center", children: [
|
|
3229
|
+
/* @__PURE__ */ jsx40(
|
|
3230
|
+
Button,
|
|
3231
|
+
{
|
|
3232
|
+
variant: isActive ? "primary" : "tertiary",
|
|
3233
|
+
className: "flex-shrink-0 text-sm p-1 w-28",
|
|
3234
|
+
autoFocus: isActive || isExpanded,
|
|
3235
|
+
pending: balance.status === "pending",
|
|
3236
|
+
onClick: () => setFocused(true),
|
|
3237
|
+
children: "Top up"
|
|
3238
|
+
}
|
|
3239
|
+
),
|
|
3240
|
+
/* @__PURE__ */ jsx40(WithdrawGasBalanceButton, { userAddress })
|
|
3241
|
+
] })
|
|
3242
|
+
] }),
|
|
3243
|
+
isExpanded ? /* @__PURE__ */ jsx40("p", { className: "text-sm", children: "Your gas balance is used to pay for onchain computation." }) : null
|
|
3244
|
+
] });
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
// src/onboarding/ConnectedSteps.tsx
|
|
3248
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3249
|
+
function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
3250
|
+
const { chain } = useEntryKitConfig();
|
|
3251
|
+
const paymaster = getPaymaster(chain);
|
|
3252
|
+
const [focusedId, setFocusedId] = useState5(null);
|
|
3253
|
+
const userAddress = userClient.account.address;
|
|
3254
|
+
const { data: prerequisites, error: prerequisitesError } = usePrerequisites(userAddress);
|
|
3255
|
+
useEffect15(() => {
|
|
3256
|
+
if (prerequisitesError) {
|
|
3257
|
+
console.error("Could not get prerequisites", prerequisitesError);
|
|
3258
|
+
}
|
|
3259
|
+
}, [prerequisitesError]);
|
|
3260
|
+
const { closeAccountModal } = useAccountModal();
|
|
3261
|
+
const isNewConnection = userAddress !== initialUserAddress;
|
|
3262
|
+
const initialPrerequisites = useRef5(prerequisites);
|
|
3263
|
+
useEffect15(() => {
|
|
3264
|
+
if (prerequisites == null) return;
|
|
3265
|
+
if (initialPrerequisites.current == null) {
|
|
3266
|
+
initialPrerequisites.current = prerequisites;
|
|
3267
|
+
}
|
|
3268
|
+
if (prerequisites.complete) {
|
|
3269
|
+
if (isNewConnection || !initialPrerequisites.current.complete) {
|
|
3270
|
+
closeAccountModal();
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
}, [closeAccountModal, isNewConnection, prerequisites]);
|
|
3274
|
+
const { sessionAddress, hasAllowance, isSpender, hasDelegation, hasGasBalance, hasQuarryGasBalance } = prerequisites ?? {};
|
|
3275
|
+
const steps = useMemo4(() => {
|
|
3276
|
+
if (!userAddress) {
|
|
3277
|
+
return [
|
|
3278
|
+
{
|
|
3279
|
+
id: "wallet",
|
|
3280
|
+
isComplete: false,
|
|
3281
|
+
content: () => null
|
|
3282
|
+
}
|
|
3283
|
+
];
|
|
3284
|
+
}
|
|
3285
|
+
const steps2 = [
|
|
3286
|
+
{
|
|
3287
|
+
id: "wallet",
|
|
3288
|
+
isComplete: true,
|
|
3289
|
+
content: (props) => /* @__PURE__ */ jsx41(Wallet, { ...props, userAddress })
|
|
3290
|
+
}
|
|
3291
|
+
];
|
|
3292
|
+
if (!paymaster) {
|
|
3293
|
+
if (sessionAddress != null) {
|
|
3294
|
+
steps2.push({
|
|
3295
|
+
id: "gasBalance",
|
|
3296
|
+
isComplete: !!hasGasBalance,
|
|
3297
|
+
content: (props) => /* @__PURE__ */ jsx41(GasBalance, { ...props, sessionAddress })
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
} else if (paymaster.type === "quarry") {
|
|
3301
|
+
if (paymaster.isGasPass) {
|
|
3302
|
+
steps2.push({
|
|
3303
|
+
id: "allowance",
|
|
3304
|
+
isComplete: !!hasAllowance,
|
|
3305
|
+
content: (props) => /* @__PURE__ */ jsx41(Allowance, { ...props, userAddress })
|
|
3306
|
+
});
|
|
3307
|
+
} else {
|
|
3308
|
+
steps2.push({
|
|
3309
|
+
id: "gasBalanceQuarry",
|
|
3310
|
+
isComplete: !!hasQuarryGasBalance,
|
|
3311
|
+
content: (props) => /* @__PURE__ */ jsx41(GasBalance2, { ...props, userAddress })
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
steps2.push({
|
|
3316
|
+
id: "session",
|
|
3317
|
+
isComplete: !!isSpender && !!hasDelegation,
|
|
3318
|
+
content: (props) => /* @__PURE__ */ jsx41(Session, { ...props, userClient, registerSpender: !isSpender, registerDelegation: !hasDelegation })
|
|
3319
|
+
});
|
|
3320
|
+
return steps2;
|
|
3321
|
+
}, [
|
|
3322
|
+
hasAllowance,
|
|
3323
|
+
hasDelegation,
|
|
3324
|
+
hasGasBalance,
|
|
3325
|
+
hasQuarryGasBalance,
|
|
3326
|
+
isSpender,
|
|
3327
|
+
paymaster,
|
|
3328
|
+
sessionAddress,
|
|
3329
|
+
userAddress,
|
|
3330
|
+
userClient
|
|
3331
|
+
]);
|
|
3332
|
+
const [selectedStepId] = useState5(null);
|
|
3333
|
+
const nextStep = steps.find((step) => step.content != null && !step.isComplete);
|
|
3334
|
+
const completedSteps = steps.filter((step) => step.isComplete);
|
|
3335
|
+
const activeStep = (selectedStepId != null ? steps.find((step) => step.id === selectedStepId) : null) ?? nextStep ?? (completedSteps.length < steps.length ? completedSteps.at(-1) : null);
|
|
3336
|
+
const activeStepIndex = activeStep ? steps.indexOf(activeStep) : -1;
|
|
3337
|
+
return /* @__PURE__ */ jsx41(
|
|
3338
|
+
"div",
|
|
3339
|
+
{
|
|
3340
|
+
className: twMerge18(
|
|
3341
|
+
"px-8 flex flex-col",
|
|
3342
|
+
"divide-y divide-neutral-800",
|
|
3343
|
+
"animate-in animate-duration-300 fade-in slide-in-from-bottom-8"
|
|
3344
|
+
),
|
|
3345
|
+
children: steps.map((step, i) => {
|
|
3346
|
+
const isActive = step === activeStep;
|
|
3347
|
+
const isExpanded = isActive || completedSteps.length === steps.length;
|
|
3348
|
+
const isDisabled = !step.isComplete && activeStepIndex !== -1 && i > activeStepIndex;
|
|
3349
|
+
const isFocused = focusedId === step.id;
|
|
3350
|
+
const content = step.content({
|
|
3351
|
+
isActive,
|
|
3352
|
+
isExpanded,
|
|
3353
|
+
isFocused,
|
|
3354
|
+
setFocused: (focused) => setFocusedId(focused ? step.id : null)
|
|
3355
|
+
});
|
|
3356
|
+
if (focusedId) {
|
|
3357
|
+
if (step.id === focusedId) {
|
|
3358
|
+
return content;
|
|
3359
|
+
}
|
|
3360
|
+
return null;
|
|
3361
|
+
}
|
|
3362
|
+
return /* @__PURE__ */ jsx41("div", { className: twMerge18("py-8 flex flex-col justify-center", isActive ? "flex-grow" : null), children: /* @__PURE__ */ jsx41("div", { className: twMerge18("flex flex-col", isDisabled ? "opacity-30 pointer-events-none" : null), children: content }) }, step.id);
|
|
3363
|
+
})
|
|
3364
|
+
}
|
|
3365
|
+
);
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
// src/AccountModalContent.tsx
|
|
3369
|
+
import { useRef as useRef6 } from "react";
|
|
3370
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
3371
|
+
function AccountModalContent() {
|
|
3372
|
+
const { chainId } = useEntryKitConfig();
|
|
3373
|
+
const userClient = useConnectorClient({ chainId });
|
|
3374
|
+
const { address: userAddress } = useAccount8();
|
|
3375
|
+
const initialUserAddress = useRef6(userAddress);
|
|
3376
|
+
if (userClient.status !== "success") {
|
|
3377
|
+
return /* @__PURE__ */ jsx42(ConnectWallet, {});
|
|
3378
|
+
}
|
|
3379
|
+
return /* @__PURE__ */ jsx42(ConnectedSteps, { userClient: userClient.data, initialUserAddress: initialUserAddress.current });
|
|
3380
|
+
}
|
|
3381
|
+
|
|
2062
3382
|
// src/AccountModal.tsx
|
|
3383
|
+
import { DialogClose } from "@radix-ui/react-dialog";
|
|
2063
3384
|
import { ErrorBoundary } from "react-error-boundary";
|
|
2064
3385
|
|
|
2065
3386
|
// src/errors/ErrorOverlay.tsx
|
|
2066
3387
|
import { wait } from "@latticexyz/common/utils";
|
|
2067
|
-
import { useEffect as
|
|
2068
|
-
import { twMerge as
|
|
2069
|
-
import { Fragment as
|
|
3388
|
+
import { useEffect as useEffect16 } from "react";
|
|
3389
|
+
import { twMerge as twMerge19 } from "tailwind-merge";
|
|
3390
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2070
3391
|
function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
2071
|
-
|
|
3392
|
+
useEffect16(() => {
|
|
2072
3393
|
if (error2) {
|
|
2073
3394
|
console.error(error2);
|
|
2074
3395
|
}
|
|
2075
3396
|
}, [error2]);
|
|
2076
|
-
return /* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
3397
|
+
return /* @__PURE__ */ jsxs25("div", { className: "pointer-events-none absolute inset-0 overflow-clip", children: [
|
|
3398
|
+
/* @__PURE__ */ jsx43(
|
|
2078
3399
|
"div",
|
|
2079
3400
|
{
|
|
2080
|
-
className:
|
|
3401
|
+
className: twMerge19(
|
|
2081
3402
|
"absolute inset-0 bg-blue-700/60",
|
|
2082
3403
|
"transition duration-300",
|
|
2083
3404
|
error2 ? "opacity-100 pointer-events-auto" : "opacity-0"
|
|
2084
3405
|
)
|
|
2085
3406
|
}
|
|
2086
3407
|
),
|
|
2087
|
-
/* @__PURE__ */
|
|
3408
|
+
/* @__PURE__ */ jsx43(
|
|
2088
3409
|
"div",
|
|
2089
3410
|
{
|
|
2090
|
-
className:
|
|
3411
|
+
className: twMerge19(
|
|
2091
3412
|
"absolute inset-0 pb-8",
|
|
2092
3413
|
"transition duration-300",
|
|
2093
3414
|
error2 ? "translate-y-0 opacity-100 pointer-events-auto" : "-translate-y-4 opacity-0"
|
|
2094
3415
|
),
|
|
2095
|
-
children: error2 ? /* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
3416
|
+
children: error2 ? /* @__PURE__ */ jsx43(Fragment6, { children: /* @__PURE__ */ jsxs25("div", { className: "w-full max-h-full bg-blue-700 text-white/80 overflow-auto", children: [
|
|
3417
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-6 px-8 pt-8", children: [
|
|
3418
|
+
/* @__PURE__ */ jsx43("div", { className: "text-white text-lg font-bold", children: "Oops! It broke :(" }),
|
|
3419
|
+
/* @__PURE__ */ jsx43("div", { className: "font-mono text-xs whitespace-pre-wrap", children: error2.message.trim() }),
|
|
3420
|
+
/* @__PURE__ */ jsx43("div", { className: "text-sm", children: "See the console for more info." })
|
|
2100
3421
|
] }),
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
retry ? /* @__PURE__ */
|
|
3422
|
+
/* @__PURE__ */ jsxs25("div", { className: "pointer-events-none sticky bottom-0 left-0 -mt-2", children: [
|
|
3423
|
+
/* @__PURE__ */ jsx43("div", { className: "w-full h-12 bg-gradient-to-b from-transparent to-blue-700" }),
|
|
3424
|
+
retry ? /* @__PURE__ */ jsx43("div", { className: "bg-blue-700 text-center", children: /* @__PURE__ */ jsxs25(
|
|
2104
3425
|
"button",
|
|
2105
3426
|
{
|
|
2106
3427
|
type: "button",
|
|
2107
|
-
className:
|
|
3428
|
+
className: twMerge19(
|
|
2108
3429
|
"pointer-events-auto group w-24 p-1 -translate-y-2 transition",
|
|
2109
3430
|
"bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500",
|
|
2110
3431
|
"text-white text-sm font-medium",
|
|
@@ -2119,15 +3440,15 @@ function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
|
2119
3440
|
}
|
|
2120
3441
|
},
|
|
2121
3442
|
children: [
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
/* @__PURE__ */
|
|
3443
|
+
/* @__PURE__ */ jsx43("span", { className: "group-aria-busy:hidden", children: "Retry" }),
|
|
3444
|
+
/* @__PURE__ */ jsx43("span", { className: "hidden group-aria-busy:inline", children: "Retrying\u2026" })
|
|
2124
3445
|
]
|
|
2125
3446
|
}
|
|
2126
|
-
) }) : dismiss ? /* @__PURE__ */
|
|
3447
|
+
) }) : dismiss ? /* @__PURE__ */ jsx43("div", { className: "bg-blue-700 text-center", children: /* @__PURE__ */ jsx43(
|
|
2127
3448
|
"button",
|
|
2128
3449
|
{
|
|
2129
3450
|
type: "button",
|
|
2130
|
-
className:
|
|
3451
|
+
className: twMerge19(
|
|
2131
3452
|
"pointer-events-auto group w-24 p-1 -translate-y-2 transition",
|
|
2132
3453
|
"bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500",
|
|
2133
3454
|
"text-white text-sm font-medium",
|
|
@@ -2145,27 +3466,27 @@ function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
|
2145
3466
|
}
|
|
2146
3467
|
|
|
2147
3468
|
// src/errors/ErrorFallback.tsx
|
|
2148
|
-
import { jsx as
|
|
3469
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2149
3470
|
function ErrorFallback({ error: error2, resetErrorBoundary }) {
|
|
2150
|
-
return /* @__PURE__ */
|
|
3471
|
+
return /* @__PURE__ */ jsx44("div", { className: "h-64", children: /* @__PURE__ */ jsx44(ErrorOverlay, { error: error2, retry: resetErrorBoundary }) });
|
|
2151
3472
|
}
|
|
2152
3473
|
|
|
2153
3474
|
// src/errors/ErrorsOverlay.tsx
|
|
2154
|
-
import { useStore as
|
|
2155
|
-
import { jsx as
|
|
3475
|
+
import { useStore as useStore3 } from "zustand";
|
|
3476
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
2156
3477
|
function ErrorsOverlay() {
|
|
2157
|
-
const error2 =
|
|
2158
|
-
return /* @__PURE__ */
|
|
3478
|
+
const error2 = useStore3(store3, (state) => state.errors.at(0));
|
|
3479
|
+
return /* @__PURE__ */ jsx45(ErrorOverlay, { error: error2?.error, retry: error2?.retry, dismiss: error2?.dismiss });
|
|
2159
3480
|
}
|
|
2160
3481
|
|
|
2161
3482
|
// src/AccountModal.tsx
|
|
2162
|
-
import { jsx as
|
|
3483
|
+
import { jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2163
3484
|
function AccountModal() {
|
|
2164
3485
|
const { accountModalOpen, toggleAccountModal } = useAccountModal();
|
|
2165
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ jsx46(Modal, { open: accountModalOpen, onOpenChange: toggleAccountModal, children: accountModalOpen ? /* @__PURE__ */ jsxs26(
|
|
2166
3487
|
"div",
|
|
2167
3488
|
{
|
|
2168
|
-
className:
|
|
3489
|
+
className: twMerge20(
|
|
2169
3490
|
"relative py-2 ring-1",
|
|
2170
3491
|
"bg-neutral-900 text-neutral-400 ring-neutral-700/50",
|
|
2171
3492
|
"links:font-medium links:underline links:underline-offset-4",
|
|
@@ -2173,11 +3494,11 @@ function AccountModal() {
|
|
|
2173
3494
|
"links:decoration-neutral-500 hover:links:decoration-orange-500"
|
|
2174
3495
|
),
|
|
2175
3496
|
children: [
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
/* @__PURE__ */
|
|
2178
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsxs26(ErrorBoundary, { FallbackComponent: ErrorFallback, children: [
|
|
3498
|
+
/* @__PURE__ */ jsx46(AccountModalContent, {}),
|
|
3499
|
+
/* @__PURE__ */ jsx46(ErrorsOverlay, {})
|
|
2179
3500
|
] }),
|
|
2180
|
-
/* @__PURE__ */
|
|
3501
|
+
/* @__PURE__ */ jsxs26(
|
|
2181
3502
|
"a",
|
|
2182
3503
|
{
|
|
2183
3504
|
href: "https://mud.dev",
|
|
@@ -2185,20 +3506,20 @@ function AccountModal() {
|
|
|
2185
3506
|
rel: "noreferrer noopener",
|
|
2186
3507
|
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",
|
|
2187
3508
|
children: [
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx46("span", { className: "block w-4 h-4", children: /* @__PURE__ */ jsx46(Logo, { className: "w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300" }) }),
|
|
3510
|
+
/* @__PURE__ */ jsx46("span", { children: "Powered by MUD" })
|
|
2190
3511
|
]
|
|
2191
3512
|
}
|
|
2192
3513
|
),
|
|
2193
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsx46("div", { className: "absolute top-0 right-0", children: /* @__PURE__ */ jsx46(
|
|
2194
3515
|
DialogClose,
|
|
2195
3516
|
{
|
|
2196
|
-
className:
|
|
3517
|
+
className: twMerge20(
|
|
2197
3518
|
"pointer-events-auto leading-none p-2 transition",
|
|
2198
3519
|
"text-white/20 hover:text-white/40"
|
|
2199
3520
|
),
|
|
2200
3521
|
title: "Close",
|
|
2201
|
-
children: /* @__PURE__ */
|
|
3522
|
+
children: /* @__PURE__ */ jsx46(CloseIcon, { className: "m-0" })
|
|
2202
3523
|
}
|
|
2203
3524
|
) })
|
|
2204
3525
|
]
|
|
@@ -2207,31 +3528,31 @@ function AccountModal() {
|
|
|
2207
3528
|
}
|
|
2208
3529
|
|
|
2209
3530
|
// src/EntryKitProvider.tsx
|
|
2210
|
-
import { jsx as
|
|
3531
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2211
3532
|
function EntryKitProvider({ config, children }) {
|
|
2212
|
-
return /* @__PURE__ */
|
|
3533
|
+
return /* @__PURE__ */ jsxs27(EntryKitConfigProvider, { config, children: [
|
|
2213
3534
|
children,
|
|
2214
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ jsx47(AccountModal, {})
|
|
2215
3536
|
] });
|
|
2216
3537
|
}
|
|
2217
3538
|
|
|
2218
3539
|
// src/AccountButton.tsx
|
|
2219
|
-
import { useAccount as
|
|
2220
|
-
import { twMerge as
|
|
3540
|
+
import { useAccount as useAccount9 } from "wagmi";
|
|
3541
|
+
import { twMerge as twMerge22 } from "tailwind-merge";
|
|
2221
3542
|
|
|
2222
3543
|
// src/AccountName.tsx
|
|
2223
|
-
import { twMerge as
|
|
2224
|
-
import { Fragment as
|
|
3544
|
+
import { twMerge as twMerge21 } from "tailwind-merge";
|
|
3545
|
+
import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2225
3546
|
function AccountName({ address }) {
|
|
2226
3547
|
const { data: ens } = useENS(address);
|
|
2227
3548
|
const avatar = usePreloadImage(ens?.avatar);
|
|
2228
|
-
return /* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
3549
|
+
return /* @__PURE__ */ jsxs28(Fragment7, { children: [
|
|
3550
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center", children: [
|
|
3551
|
+
/* @__PURE__ */ jsx48(
|
|
2231
3552
|
"img",
|
|
2232
3553
|
{
|
|
2233
3554
|
src: ens?.avatar && avatar.isSuccess ? ens.avatar : void 0,
|
|
2234
|
-
className:
|
|
3555
|
+
className: twMerge21(
|
|
2235
3556
|
"col-start-1 row-start-1",
|
|
2236
3557
|
"inline-flex w-full h-full rounded-full bg-black/10 dark:bg-white/10 bg-cover bg-no-repeat bg-center",
|
|
2237
3558
|
"transtion duration-300",
|
|
@@ -2239,10 +3560,10 @@ function AccountName({ address }) {
|
|
|
2239
3560
|
)
|
|
2240
3561
|
}
|
|
2241
3562
|
),
|
|
2242
|
-
/* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsx48(
|
|
2243
3564
|
Logo,
|
|
2244
3565
|
{
|
|
2245
|
-
className:
|
|
3566
|
+
className: twMerge21(
|
|
2246
3567
|
"col-start-1 row-start-1 text-orange-500",
|
|
2247
3568
|
"transition duration-300",
|
|
2248
3569
|
ens && (!ens.avatar || avatar.isError) ? "opacity-100" : "opacity-0"
|
|
@@ -2250,29 +3571,29 @@ function AccountName({ address }) {
|
|
|
2250
3571
|
}
|
|
2251
3572
|
)
|
|
2252
3573
|
] }),
|
|
2253
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx48("span", { className: "flex-grow", children: ens?.name ?? /* @__PURE__ */ jsx48(TruncatedHex, { hex: address }) })
|
|
2254
3575
|
] });
|
|
2255
3576
|
}
|
|
2256
3577
|
|
|
2257
3578
|
// src/AccountButton.tsx
|
|
2258
|
-
import { useRef as
|
|
2259
|
-
import { jsx as
|
|
2260
|
-
var containerClassNames =
|
|
3579
|
+
import { useRef as useRef7 } from "react";
|
|
3580
|
+
import { jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3581
|
+
var containerClassNames = twMerge22(
|
|
2261
3582
|
"w-48 p-3 inline-flex outline-none transition",
|
|
2262
3583
|
"border border-transparent",
|
|
2263
3584
|
"text-base leading-none"
|
|
2264
3585
|
);
|
|
2265
|
-
var secondaryClassNames =
|
|
3586
|
+
var secondaryClassNames = twMerge22(
|
|
2266
3587
|
"bg-neutral-100 border-neutral-300 text-black",
|
|
2267
3588
|
"dark:bg-neutral-800 dark:border-neutral-700 dark:text-white"
|
|
2268
3589
|
);
|
|
2269
|
-
var secondaryInteractiveClassNames =
|
|
3590
|
+
var secondaryInteractiveClassNames = twMerge22(
|
|
2270
3591
|
"cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700"
|
|
2271
3592
|
);
|
|
2272
3593
|
function AccountButton() {
|
|
2273
3594
|
const { openAccountModal, accountModalOpen } = useAccountModal();
|
|
2274
|
-
const { status, address: userAddress } =
|
|
2275
|
-
const initialUserAddress =
|
|
3595
|
+
const { status, address: userAddress } = useAccount9();
|
|
3596
|
+
const initialUserAddress = useRef7(userAddress);
|
|
2276
3597
|
const prereqs = usePrerequisites(userAddress);
|
|
2277
3598
|
const isConnected = status === "connected" || status === "reconnecting" && userAddress;
|
|
2278
3599
|
const isNewConnection = userAddress !== initialUserAddress.current;
|
|
@@ -2284,20 +3605,20 @@ function AccountButton() {
|
|
|
2284
3605
|
}
|
|
2285
3606
|
return "Sign in";
|
|
2286
3607
|
})();
|
|
2287
|
-
return /* @__PURE__ */
|
|
3608
|
+
return /* @__PURE__ */ jsx49(Shadow, { mode: "child", children: isSignedIn ? /* @__PURE__ */ jsx49(
|
|
2288
3609
|
"button",
|
|
2289
3610
|
{
|
|
2290
3611
|
type: "button",
|
|
2291
|
-
className:
|
|
3612
|
+
className: twMerge22(containerClassNames, secondaryClassNames, secondaryInteractiveClassNames),
|
|
2292
3613
|
onClick: openAccountModal,
|
|
2293
|
-
children: /* @__PURE__ */
|
|
3614
|
+
children: /* @__PURE__ */ jsx49("span", { className: "flex-grow inline-flex gap-2.5 items-center text-left font-medium", children: userAddress ? /* @__PURE__ */ jsx49(AccountName, { address: userAddress }) : null })
|
|
2294
3615
|
},
|
|
2295
3616
|
"connected"
|
|
2296
|
-
) : /* @__PURE__ */
|
|
3617
|
+
) : /* @__PURE__ */ jsxs29(
|
|
2297
3618
|
"button",
|
|
2298
3619
|
{
|
|
2299
3620
|
type: "button",
|
|
2300
|
-
className:
|
|
3621
|
+
className: twMerge22(
|
|
2301
3622
|
containerClassNames,
|
|
2302
3623
|
"group",
|
|
2303
3624
|
"items-center justify-center gap-2.5",
|
|
@@ -2308,32 +3629,32 @@ function AccountButton() {
|
|
|
2308
3629
|
"aria-busy": accountModalOpen,
|
|
2309
3630
|
onClick: openAccountModal,
|
|
2310
3631
|
children: [
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsxs29("span", { className: "pointer-events-none inline-grid place-items-center -ml-3", children: [
|
|
3633
|
+
/* @__PURE__ */ jsx49(
|
|
2313
3634
|
"span",
|
|
2314
3635
|
{
|
|
2315
|
-
className:
|
|
3636
|
+
className: twMerge22(
|
|
2316
3637
|
"col-start-1 row-start-1 leading-none",
|
|
2317
3638
|
"scale-100 opacity-100 transition duration-300",
|
|
2318
3639
|
"group-aria-busy:scale-125 group-aria-busy:opacity-0"
|
|
2319
3640
|
),
|
|
2320
|
-
children: /* @__PURE__ */
|
|
3641
|
+
children: /* @__PURE__ */ jsx49(Logo, {})
|
|
2321
3642
|
}
|
|
2322
3643
|
),
|
|
2323
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ jsx49(
|
|
2324
3645
|
"span",
|
|
2325
3646
|
{
|
|
2326
3647
|
"aria-hidden": true,
|
|
2327
|
-
className:
|
|
3648
|
+
className: twMerge22(
|
|
2328
3649
|
"col-start-1 row-start-1",
|
|
2329
3650
|
"scale-50 opacity-0 transition duration-300 delay-50",
|
|
2330
3651
|
"group-aria-busy:scale-100 group-aria-busy:opacity-100"
|
|
2331
3652
|
),
|
|
2332
|
-
children: /* @__PURE__ */
|
|
3653
|
+
children: /* @__PURE__ */ jsx49(PendingIcon, {})
|
|
2333
3654
|
}
|
|
2334
3655
|
)
|
|
2335
3656
|
] }),
|
|
2336
|
-
/* @__PURE__ */
|
|
3657
|
+
/* @__PURE__ */ jsx49("span", { className: "font-medium", children: buttonLabel })
|
|
2337
3658
|
]
|
|
2338
3659
|
},
|
|
2339
3660
|
"sign in"
|
|
@@ -2355,44 +3676,379 @@ function useSessionClientReady() {
|
|
|
2355
3676
|
}
|
|
2356
3677
|
|
|
2357
3678
|
// src/createWagmiConfig.ts
|
|
2358
|
-
import { connectorsForWallets } from "@rainbow-me/rainbowkit";
|
|
2359
3679
|
import { createConfig } from "wagmi";
|
|
3680
|
+
import { getDefaultConfig } from "connectkit";
|
|
3681
|
+
import { injected, coinbaseWallet, safe } from "wagmi/connectors";
|
|
2360
3682
|
|
|
2361
|
-
// src/
|
|
2362
|
-
import {
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
3683
|
+
// src/connectors/walletConnect.ts
|
|
3684
|
+
import { ChainNotConfiguredError, ProviderNotFoundError, createConnector } from "wagmi";
|
|
3685
|
+
import {
|
|
3686
|
+
SwitchChainError,
|
|
3687
|
+
UserRejectedRequestError,
|
|
3688
|
+
getAddress,
|
|
3689
|
+
numberToHex as numberToHex3
|
|
3690
|
+
} from "viem";
|
|
3691
|
+
walletConnect.type = "walletConnect";
|
|
3692
|
+
function walletConnect(parameters) {
|
|
3693
|
+
const isNewChainsStale = parameters.isNewChainsStale ?? true;
|
|
3694
|
+
let provider_;
|
|
3695
|
+
let providerPromise;
|
|
3696
|
+
const NAMESPACE = "eip155";
|
|
3697
|
+
let accountsChanged;
|
|
3698
|
+
let chainChanged;
|
|
3699
|
+
let connect;
|
|
3700
|
+
let displayUri;
|
|
3701
|
+
let sessionDelete;
|
|
3702
|
+
let disconnect;
|
|
3703
|
+
return createConnector((config) => ({
|
|
3704
|
+
id: "walletConnect",
|
|
3705
|
+
name: "WalletConnect",
|
|
3706
|
+
type: walletConnect.type,
|
|
3707
|
+
async setup() {
|
|
3708
|
+
const provider = await this.getProvider().catch(() => null);
|
|
3709
|
+
if (!provider) return;
|
|
3710
|
+
if (!connect) {
|
|
3711
|
+
connect = this.onConnect.bind(this);
|
|
3712
|
+
provider.on("connect", connect);
|
|
3713
|
+
}
|
|
3714
|
+
if (!sessionDelete) {
|
|
3715
|
+
sessionDelete = this.onSessionDelete.bind(this);
|
|
3716
|
+
provider.on("session_delete", sessionDelete);
|
|
3717
|
+
}
|
|
3718
|
+
},
|
|
3719
|
+
async connect({ chainId, ...rest } = {}) {
|
|
3720
|
+
try {
|
|
3721
|
+
const provider = await this.getProvider();
|
|
3722
|
+
if (!provider) throw new ProviderNotFoundError();
|
|
3723
|
+
if (!displayUri) {
|
|
3724
|
+
displayUri = this.onDisplayUri;
|
|
3725
|
+
provider.on("display_uri", displayUri);
|
|
3726
|
+
}
|
|
3727
|
+
let targetChainId = chainId;
|
|
3728
|
+
if (!targetChainId) {
|
|
3729
|
+
const state = await config.storage?.getItem("state") ?? {};
|
|
3730
|
+
const isChainSupported = config.chains.some((x) => x.id === state.chainId);
|
|
3731
|
+
if (isChainSupported) targetChainId = state.chainId;
|
|
3732
|
+
else targetChainId = config.chains[0]?.id;
|
|
3733
|
+
}
|
|
3734
|
+
if (!targetChainId) throw new Error("No chains found on connector.");
|
|
3735
|
+
const isChainsStale = await this.isChainsStale();
|
|
3736
|
+
if (provider.session && isChainsStale) await provider.disconnect();
|
|
3737
|
+
if (!provider.session || isChainsStale) {
|
|
3738
|
+
const optionalChains = config.chains.filter((chain) => chain.id !== targetChainId).map((optionalChain) => optionalChain.id);
|
|
3739
|
+
await provider.connect({
|
|
3740
|
+
optionalChains: [targetChainId, ...optionalChains],
|
|
3741
|
+
..."pairingTopic" in rest ? { pairingTopic: rest.pairingTopic } : {}
|
|
3742
|
+
});
|
|
3743
|
+
this.setRequestedChainsIds(config.chains.map((x) => x.id));
|
|
3744
|
+
}
|
|
3745
|
+
const accounts = (await provider.enable()).map((x) => getAddress(x));
|
|
3746
|
+
let currentChainId = await this.getChainId();
|
|
3747
|
+
if (chainId && currentChainId !== chainId) {
|
|
3748
|
+
const chain = await this.switchChain({ chainId }).catch((error2) => {
|
|
3749
|
+
if (error2.code === UserRejectedRequestError.code) throw error2;
|
|
3750
|
+
return { id: currentChainId };
|
|
3751
|
+
});
|
|
3752
|
+
currentChainId = chain?.id ?? currentChainId;
|
|
3753
|
+
}
|
|
3754
|
+
if (displayUri) {
|
|
3755
|
+
provider.removeListener("display_uri", displayUri);
|
|
3756
|
+
displayUri = void 0;
|
|
3757
|
+
}
|
|
3758
|
+
if (connect) {
|
|
3759
|
+
provider.removeListener("connect", connect);
|
|
3760
|
+
connect = void 0;
|
|
3761
|
+
}
|
|
3762
|
+
if (!accountsChanged) {
|
|
3763
|
+
accountsChanged = this.onAccountsChanged.bind(this);
|
|
3764
|
+
provider.on("accountsChanged", accountsChanged);
|
|
3765
|
+
}
|
|
3766
|
+
if (!chainChanged) {
|
|
3767
|
+
chainChanged = this.onChainChanged.bind(this);
|
|
3768
|
+
provider.on("chainChanged", chainChanged);
|
|
3769
|
+
}
|
|
3770
|
+
if (!disconnect) {
|
|
3771
|
+
disconnect = this.onDisconnect.bind(this);
|
|
3772
|
+
provider.on("disconnect", disconnect);
|
|
3773
|
+
}
|
|
3774
|
+
if (!sessionDelete) {
|
|
3775
|
+
sessionDelete = this.onSessionDelete.bind(this);
|
|
3776
|
+
provider.on("session_delete", sessionDelete);
|
|
3777
|
+
}
|
|
3778
|
+
return { accounts, chainId: currentChainId };
|
|
3779
|
+
} catch (error2) {
|
|
3780
|
+
if (/(user rejected|connection request reset)/i.test(error2?.message)) {
|
|
3781
|
+
throw new UserRejectedRequestError(error2);
|
|
3782
|
+
}
|
|
3783
|
+
throw error2;
|
|
3784
|
+
}
|
|
3785
|
+
},
|
|
3786
|
+
async disconnect() {
|
|
3787
|
+
const provider = await this.getProvider();
|
|
3788
|
+
try {
|
|
3789
|
+
await provider?.disconnect();
|
|
3790
|
+
} catch (error2) {
|
|
3791
|
+
if (!/No matching key/i.test(error2.message)) throw error2;
|
|
3792
|
+
} finally {
|
|
3793
|
+
if (chainChanged) {
|
|
3794
|
+
provider?.removeListener("chainChanged", chainChanged);
|
|
3795
|
+
chainChanged = void 0;
|
|
3796
|
+
}
|
|
3797
|
+
if (disconnect) {
|
|
3798
|
+
provider?.removeListener("disconnect", disconnect);
|
|
3799
|
+
disconnect = void 0;
|
|
3800
|
+
}
|
|
3801
|
+
if (!connect) {
|
|
3802
|
+
connect = this.onConnect.bind(this);
|
|
3803
|
+
provider?.on("connect", connect);
|
|
3804
|
+
}
|
|
3805
|
+
if (accountsChanged) {
|
|
3806
|
+
provider?.removeListener("accountsChanged", accountsChanged);
|
|
3807
|
+
accountsChanged = void 0;
|
|
3808
|
+
}
|
|
3809
|
+
if (sessionDelete) {
|
|
3810
|
+
provider?.removeListener("session_delete", sessionDelete);
|
|
3811
|
+
sessionDelete = void 0;
|
|
3812
|
+
}
|
|
3813
|
+
this.setRequestedChainsIds([]);
|
|
3814
|
+
}
|
|
3815
|
+
},
|
|
3816
|
+
async getAccounts() {
|
|
3817
|
+
const provider = await this.getProvider();
|
|
3818
|
+
return provider.accounts.map((x) => getAddress(x));
|
|
3819
|
+
},
|
|
3820
|
+
async getProvider() {
|
|
3821
|
+
async function initProvider() {
|
|
3822
|
+
const optionalChains = config.chains.map((x) => x.id);
|
|
3823
|
+
if (!optionalChains.length) return;
|
|
3824
|
+
const { EthereumProvider } = await import("@walletconnect/ethereum-provider");
|
|
3825
|
+
return await EthereumProvider.init({
|
|
3826
|
+
...parameters,
|
|
3827
|
+
disableProviderPing: true,
|
|
3828
|
+
optionalChains,
|
|
3829
|
+
projectId: parameters.projectId,
|
|
3830
|
+
rpcMap: Object.fromEntries(
|
|
3831
|
+
config.chains.map((chain) => {
|
|
3832
|
+
const [url] = extractRpcUrls({
|
|
3833
|
+
chain,
|
|
3834
|
+
transports: config.transports
|
|
3835
|
+
});
|
|
3836
|
+
return [chain.id, url];
|
|
3837
|
+
})
|
|
3838
|
+
),
|
|
3839
|
+
showQrModal: parameters.showQrModal ?? true
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
if (!provider_) {
|
|
3843
|
+
if (!providerPromise) providerPromise = initProvider();
|
|
3844
|
+
provider_ = await providerPromise;
|
|
3845
|
+
provider_?.events.setMaxListeners(Number.POSITIVE_INFINITY);
|
|
3846
|
+
}
|
|
3847
|
+
return provider_;
|
|
3848
|
+
},
|
|
3849
|
+
async getChainId() {
|
|
3850
|
+
const provider = await this.getProvider();
|
|
3851
|
+
return provider.chainId;
|
|
3852
|
+
},
|
|
3853
|
+
async isAuthorized() {
|
|
3854
|
+
try {
|
|
3855
|
+
const [accounts, provider] = await Promise.all([this.getAccounts(), this.getProvider()]);
|
|
3856
|
+
if (!accounts.length) return false;
|
|
3857
|
+
const isChainsStale = await this.isChainsStale();
|
|
3858
|
+
if (isChainsStale && provider.session) {
|
|
3859
|
+
await provider.disconnect().catch(() => {
|
|
3860
|
+
});
|
|
3861
|
+
return false;
|
|
3862
|
+
}
|
|
3863
|
+
return true;
|
|
3864
|
+
} catch {
|
|
3865
|
+
return false;
|
|
3866
|
+
}
|
|
3867
|
+
},
|
|
3868
|
+
async switchChain({ addEthereumChainParameter, chainId }) {
|
|
3869
|
+
const provider = await this.getProvider();
|
|
3870
|
+
if (!provider) throw new ProviderNotFoundError();
|
|
3871
|
+
const chain = config.chains.find((x) => x.id === chainId);
|
|
3872
|
+
if (!chain) throw new SwitchChainError(new ChainNotConfiguredError());
|
|
3873
|
+
try {
|
|
3874
|
+
await Promise.all([
|
|
3875
|
+
new Promise((resolve) => {
|
|
3876
|
+
const listener2 = ({ chainId: currentChainId }) => {
|
|
3877
|
+
if (currentChainId === chainId) {
|
|
3878
|
+
config.emitter.off("change", listener2);
|
|
3879
|
+
resolve();
|
|
3880
|
+
}
|
|
3881
|
+
};
|
|
3882
|
+
config.emitter.on("change", listener2);
|
|
3883
|
+
}),
|
|
3884
|
+
provider.request({
|
|
3885
|
+
method: "wallet_switchEthereumChain",
|
|
3886
|
+
params: [{ chainId: numberToHex3(chainId) }]
|
|
3887
|
+
})
|
|
3888
|
+
]);
|
|
3889
|
+
const requestedChains = await this.getRequestedChainsIds();
|
|
3890
|
+
this.setRequestedChainsIds([...requestedChains, chainId]);
|
|
3891
|
+
return chain;
|
|
3892
|
+
} catch (err) {
|
|
3893
|
+
const error2 = err;
|
|
3894
|
+
if (/(user rejected)/i.test(error2.message)) throw new UserRejectedRequestError(error2);
|
|
3895
|
+
try {
|
|
3896
|
+
let blockExplorerUrls;
|
|
3897
|
+
if (addEthereumChainParameter?.blockExplorerUrls)
|
|
3898
|
+
blockExplorerUrls = addEthereumChainParameter.blockExplorerUrls;
|
|
3899
|
+
else blockExplorerUrls = chain.blockExplorers?.default.url ? [chain.blockExplorers?.default.url] : [];
|
|
3900
|
+
let rpcUrls;
|
|
3901
|
+
if (addEthereumChainParameter?.rpcUrls?.length) rpcUrls = addEthereumChainParameter.rpcUrls;
|
|
3902
|
+
else rpcUrls = [...chain.rpcUrls.default.http];
|
|
3903
|
+
const addEthereumChain = {
|
|
3904
|
+
blockExplorerUrls,
|
|
3905
|
+
chainId: numberToHex3(chainId),
|
|
3906
|
+
chainName: addEthereumChainParameter?.chainName ?? chain.name,
|
|
3907
|
+
iconUrls: addEthereumChainParameter?.iconUrls,
|
|
3908
|
+
nativeCurrency: addEthereumChainParameter?.nativeCurrency ?? chain.nativeCurrency,
|
|
3909
|
+
rpcUrls
|
|
3910
|
+
};
|
|
3911
|
+
await provider.request({
|
|
3912
|
+
method: "wallet_addEthereumChain",
|
|
3913
|
+
params: [addEthereumChain]
|
|
3914
|
+
});
|
|
3915
|
+
const requestedChains = await this.getRequestedChainsIds();
|
|
3916
|
+
this.setRequestedChainsIds([...requestedChains, chainId]);
|
|
3917
|
+
return chain;
|
|
3918
|
+
} catch (error3) {
|
|
3919
|
+
throw new UserRejectedRequestError(error3);
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
},
|
|
3923
|
+
onAccountsChanged(accounts) {
|
|
3924
|
+
if (accounts.length === 0) this.onDisconnect();
|
|
3925
|
+
else
|
|
3926
|
+
config.emitter.emit("change", {
|
|
3927
|
+
accounts: accounts.map((x) => getAddress(x))
|
|
3928
|
+
});
|
|
3929
|
+
},
|
|
3930
|
+
onChainChanged(chain) {
|
|
3931
|
+
const chainId = Number(chain);
|
|
3932
|
+
config.emitter.emit("change", { chainId });
|
|
3933
|
+
},
|
|
3934
|
+
async onConnect(connectInfo) {
|
|
3935
|
+
const chainId = Number(connectInfo.chainId);
|
|
3936
|
+
const accounts = await this.getAccounts();
|
|
3937
|
+
config.emitter.emit("connect", { accounts, chainId });
|
|
3938
|
+
},
|
|
3939
|
+
async onDisconnect(_error) {
|
|
3940
|
+
this.setRequestedChainsIds([]);
|
|
3941
|
+
config.emitter.emit("disconnect");
|
|
3942
|
+
const provider = await this.getProvider();
|
|
3943
|
+
if (accountsChanged) {
|
|
3944
|
+
provider.removeListener("accountsChanged", accountsChanged);
|
|
3945
|
+
accountsChanged = void 0;
|
|
3946
|
+
}
|
|
3947
|
+
if (chainChanged) {
|
|
3948
|
+
provider.removeListener("chainChanged", chainChanged);
|
|
3949
|
+
chainChanged = void 0;
|
|
3950
|
+
}
|
|
3951
|
+
if (disconnect) {
|
|
3952
|
+
provider.removeListener("disconnect", disconnect);
|
|
3953
|
+
disconnect = void 0;
|
|
3954
|
+
}
|
|
3955
|
+
if (sessionDelete) {
|
|
3956
|
+
provider.removeListener("session_delete", sessionDelete);
|
|
3957
|
+
sessionDelete = void 0;
|
|
3958
|
+
}
|
|
3959
|
+
if (!connect) {
|
|
3960
|
+
connect = this.onConnect.bind(this);
|
|
3961
|
+
provider.on("connect", connect);
|
|
3962
|
+
}
|
|
3963
|
+
},
|
|
3964
|
+
onDisplayUri(uri) {
|
|
3965
|
+
config.emitter.emit("message", { type: "display_uri", data: uri });
|
|
3966
|
+
},
|
|
3967
|
+
onSessionDelete() {
|
|
3968
|
+
this.onDisconnect();
|
|
3969
|
+
},
|
|
3970
|
+
getNamespaceChainsIds() {
|
|
3971
|
+
if (!provider_) return [];
|
|
3972
|
+
const chainIds = provider_.session?.namespaces[NAMESPACE]?.accounts?.map(
|
|
3973
|
+
(account) => Number.parseInt(account.split(":")[1] || "")
|
|
3974
|
+
);
|
|
3975
|
+
return chainIds ?? [];
|
|
3976
|
+
},
|
|
3977
|
+
async getRequestedChainsIds() {
|
|
3978
|
+
return await config.storage?.getItem(this.requestedChainsStorageKey) ?? [];
|
|
3979
|
+
},
|
|
3980
|
+
/**
|
|
3981
|
+
* Checks if the target chains match the chains that were
|
|
3982
|
+
* initially requested by the connector for the WalletConnect session.
|
|
3983
|
+
* If there is a mismatch, this means that the chains on the connector
|
|
3984
|
+
* are considered stale, and need to be revalidated at a later point (via
|
|
3985
|
+
* connection).
|
|
3986
|
+
*
|
|
3987
|
+
* There may be a scenario where a dapp adds a chain to the
|
|
3988
|
+
* connector later on, however, this chain will not have been approved or rejected
|
|
3989
|
+
* by the wallet. In this case, the chain is considered stale.
|
|
3990
|
+
*/
|
|
3991
|
+
async isChainsStale() {
|
|
3992
|
+
if (!isNewChainsStale) return false;
|
|
3993
|
+
const connectorChains = config.chains.map((x) => x.id);
|
|
3994
|
+
const namespaceChains = this.getNamespaceChainsIds();
|
|
3995
|
+
if (namespaceChains.length && !namespaceChains.some((id) => connectorChains.includes(id))) return false;
|
|
3996
|
+
const requestedChains = await this.getRequestedChainsIds();
|
|
3997
|
+
return !connectorChains.every((id) => requestedChains.includes(id));
|
|
3998
|
+
},
|
|
3999
|
+
async setRequestedChainsIds(chains) {
|
|
4000
|
+
await config.storage?.setItem(this.requestedChainsStorageKey, chains);
|
|
4001
|
+
},
|
|
4002
|
+
get requestedChainsStorageKey() {
|
|
4003
|
+
return `${this.id}.requestedChains`;
|
|
4004
|
+
}
|
|
4005
|
+
}));
|
|
4006
|
+
}
|
|
4007
|
+
function extractRpcUrls(parameters) {
|
|
4008
|
+
const { chain } = parameters;
|
|
4009
|
+
const fallbackUrl = chain.rpcUrls.default.http[0];
|
|
4010
|
+
if (!parameters.transports) return [fallbackUrl];
|
|
4011
|
+
const transport = parameters.transports?.[chain.id]?.({ chain });
|
|
4012
|
+
const transports = transport?.value?.transports || [transport];
|
|
4013
|
+
return transports.map(({ value }) => value?.url || fallbackUrl);
|
|
2369
4014
|
}
|
|
2370
4015
|
|
|
2371
4016
|
// src/createWagmiConfig.ts
|
|
2372
4017
|
function createWagmiConfig(config) {
|
|
2373
|
-
const
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
4018
|
+
const connectors = [];
|
|
4019
|
+
const shouldUseSafeConnector = !(typeof window === "undefined") && window?.parent !== window;
|
|
4020
|
+
if (shouldUseSafeConnector) {
|
|
4021
|
+
connectors.push(
|
|
4022
|
+
safe({
|
|
4023
|
+
allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/]
|
|
4024
|
+
})
|
|
4025
|
+
);
|
|
4026
|
+
}
|
|
4027
|
+
connectors.push(
|
|
4028
|
+
injected({ target: "metaMask" }),
|
|
4029
|
+
coinbaseWallet({
|
|
4030
|
+
appName: config.appName,
|
|
4031
|
+
overrideIsMetaMask: false
|
|
4032
|
+
})
|
|
4033
|
+
);
|
|
4034
|
+
if (config.walletConnectProjectId) {
|
|
4035
|
+
connectors.push(
|
|
4036
|
+
walletConnect({
|
|
4037
|
+
showQrModal: false,
|
|
4038
|
+
projectId: config.walletConnectProjectId
|
|
4039
|
+
})
|
|
4040
|
+
);
|
|
4041
|
+
}
|
|
4042
|
+
const configParams = getDefaultConfig({
|
|
2380
4043
|
chains: config.chains,
|
|
2381
4044
|
transports: config.transports,
|
|
2382
|
-
pollingInterval: config.pollingInterval
|
|
2383
|
-
});
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
// src/getConnectors.ts
|
|
2387
|
-
import { connectorsForWallets as connectorsForWallets2 } from "@rainbow-me/rainbowkit";
|
|
2388
|
-
function getConnectors({
|
|
2389
|
-
wallets,
|
|
2390
|
-
...config
|
|
2391
|
-
}) {
|
|
2392
|
-
return connectorsForWallets2(wallets ?? getWallets(config), {
|
|
4045
|
+
pollingInterval: config.pollingInterval,
|
|
2393
4046
|
appName: config.appName,
|
|
2394
|
-
|
|
4047
|
+
walletConnectProjectId: config.walletConnectProjectId,
|
|
4048
|
+
enableFamily: false,
|
|
4049
|
+
connectors
|
|
2395
4050
|
});
|
|
4051
|
+
return createConfig(configParams);
|
|
2396
4052
|
}
|
|
2397
4053
|
|
|
2398
4054
|
// src/validateSigner.ts
|
|
@@ -2443,8 +4099,6 @@ export {
|
|
|
2443
4099
|
EntryKitProvider,
|
|
2444
4100
|
createWagmiConfig,
|
|
2445
4101
|
defineConfig,
|
|
2446
|
-
getConnectors,
|
|
2447
|
-
getWallets,
|
|
2448
4102
|
internal_validateSigner,
|
|
2449
4103
|
useAccountModal,
|
|
2450
4104
|
useEntryKitConfig,
|