@latticexyz/entrykit 2.2.22-582f7187cf3cb1e0013aa5d192560235114d71e0 → 2.2.22-5b0ec82a03d09e53ebf0ef0eb29682dda4c9d687
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,12 +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";
|
|
550
563
|
|
|
551
|
-
// src/onboarding/
|
|
552
|
-
import {
|
|
553
|
-
|
|
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, 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
|
+
}
|
|
554
590
|
|
|
555
591
|
// src/onboarding/quarry/useAllowance.ts
|
|
556
592
|
import { useClient } from "wagmi";
|
|
@@ -565,7 +601,11 @@ import { parseAbi } from "viem";
|
|
|
565
601
|
var paymasterAbi = parseAbi([
|
|
566
602
|
"error SpenderSystem_AlreadyRegistered(address spender, address user)",
|
|
567
603
|
"error SpenderSystem_HasOwnBalance(address spender)",
|
|
568
|
-
"
|
|
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)"
|
|
569
609
|
]);
|
|
570
610
|
var paymasterConfig = defineStore({
|
|
571
611
|
namespaces: {
|
|
@@ -579,6 +619,13 @@ var paymasterConfig = defineStore({
|
|
|
579
619
|
},
|
|
580
620
|
key: ["user"]
|
|
581
621
|
},
|
|
622
|
+
Balance: {
|
|
623
|
+
schema: {
|
|
624
|
+
user: "address",
|
|
625
|
+
balance: "uint256"
|
|
626
|
+
},
|
|
627
|
+
key: ["user"]
|
|
628
|
+
},
|
|
582
629
|
Grantor: {
|
|
583
630
|
schema: {
|
|
584
631
|
grantor: "address",
|
|
@@ -628,29 +675,6 @@ var paymasterTables = paymasterConfig.namespaces.root.tables;
|
|
|
628
675
|
import { getRecord, getStaticDataLocation } from "@latticexyz/store/internal";
|
|
629
676
|
import { getKeyTuple } from "@latticexyz/protocol-parser/internal";
|
|
630
677
|
import { setStorageAt } from "viem/actions";
|
|
631
|
-
|
|
632
|
-
// src/getPaymaster.ts
|
|
633
|
-
function getPaymaster(chain) {
|
|
634
|
-
const contracts = chain.contracts ?? {};
|
|
635
|
-
if ("quarryPaymaster" in contracts && contracts.quarryPaymaster != null) {
|
|
636
|
-
if ("address" in contracts.quarryPaymaster) {
|
|
637
|
-
return {
|
|
638
|
-
type: "quarry",
|
|
639
|
-
address: contracts.quarryPaymaster.address
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
if ("paymaster" in contracts && contracts.paymaster != null) {
|
|
644
|
-
if ("address" in contracts.paymaster) {
|
|
645
|
-
return {
|
|
646
|
-
type: "simple",
|
|
647
|
-
address: contracts.paymaster.address
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// src/quarry/getAllowance.ts
|
|
654
678
|
async function getAllowance({ client, userAddress }) {
|
|
655
679
|
const paymaster = getPaymaster(client.chain);
|
|
656
680
|
if (paymaster?.type !== "quarry") return null;
|
|
@@ -776,10 +800,6 @@ function getDelegationQueryOptions({
|
|
|
776
800
|
});
|
|
777
801
|
}
|
|
778
802
|
|
|
779
|
-
// src/onboarding/usePrerequisites.ts
|
|
780
|
-
import { queryOptions as queryOptions5, skipToken as skipToken5, useQuery as useQuery6, useQueryClient } from "@tanstack/react-query";
|
|
781
|
-
import { useClient as useClient5, useConfig } from "wagmi";
|
|
782
|
-
|
|
783
803
|
// src/useSessionAccount.ts
|
|
784
804
|
import { useClient as useClient4 } from "wagmi";
|
|
785
805
|
import { queryOptions as queryOptions4, skipToken as skipToken4, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
@@ -855,8 +875,41 @@ function getSessionAccountQueryOptions({
|
|
|
855
875
|
});
|
|
856
876
|
}
|
|
857
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
|
+
|
|
858
912
|
// src/onboarding/usePrerequisites.ts
|
|
859
|
-
import { getBalanceQueryOptions } from "wagmi/query";
|
|
860
913
|
function getPrequisitesQueryOptions({
|
|
861
914
|
queryClient,
|
|
862
915
|
config,
|
|
@@ -864,34 +917,39 @@ function getPrequisitesQueryOptions({
|
|
|
864
917
|
userAddress,
|
|
865
918
|
worldAddress
|
|
866
919
|
}) {
|
|
867
|
-
return
|
|
920
|
+
return queryOptions6({
|
|
868
921
|
queryKey: ["getPrerequisites", client?.uid, userAddress],
|
|
869
|
-
queryFn:
|
|
922
|
+
queryFn: async () => {
|
|
923
|
+
if (!client) throw new Error("Viem client not ready.");
|
|
924
|
+
if (!userAddress) throw new Error("User not connected.");
|
|
870
925
|
const paymaster = getPaymaster(client.chain);
|
|
871
926
|
const {
|
|
872
927
|
account: { address: sessionAddress }
|
|
873
928
|
} = await queryClient.fetchQuery(getSessionAccountQueryOptions({ client, userAddress }));
|
|
874
|
-
const [sessionBalance, allowance, spender, hasDelegation] = await Promise.all([
|
|
929
|
+
const [sessionBalance, allowance, spender, quarryBalance, hasDelegation] = await Promise.all([
|
|
875
930
|
!paymaster ? queryClient.fetchQuery(
|
|
876
|
-
|
|
931
|
+
getBalanceQueryOptions2(config, { chainId: client.chain.id, address: sessionAddress })
|
|
877
932
|
) : null,
|
|
878
933
|
paymaster?.type === "quarry" ? queryClient.fetchQuery(getAllowanceQueryOptions({ client, userAddress })) : null,
|
|
879
934
|
paymaster?.type === "quarry" ? queryClient.fetchQuery(getSpenderQueryOptions({ client, userAddress, sessionAddress })) : null,
|
|
935
|
+
paymaster?.type === "quarry" ? queryClient.fetchQuery(getBalanceQueryOptions({ client, userAddress })) : null,
|
|
880
936
|
queryClient.fetchQuery(getDelegationQueryOptions({ client, worldAddress, userAddress, sessionAddress }))
|
|
881
937
|
]);
|
|
882
|
-
const hasAllowance = allowance == null || allowance
|
|
938
|
+
const hasAllowance = allowance == null || allowance > 0n;
|
|
883
939
|
const isSpender = spender == null ? true : spender;
|
|
884
|
-
const hasGasBalance = sessionBalance == null || sessionBalance.value
|
|
940
|
+
const hasGasBalance = sessionBalance == null || sessionBalance.value > 0n;
|
|
941
|
+
const hasQuarryGasBalance = quarryBalance == null || quarryBalance > 0n;
|
|
885
942
|
return {
|
|
886
943
|
sessionAddress,
|
|
887
944
|
hasAllowance,
|
|
888
945
|
isSpender,
|
|
889
946
|
hasGasBalance,
|
|
947
|
+
hasQuarryGasBalance,
|
|
890
948
|
hasDelegation,
|
|
891
949
|
// we intentionally don't enforce an allowance/gas balance here
|
|
892
950
|
complete: isSpender && hasDelegation
|
|
893
951
|
};
|
|
894
|
-
}
|
|
952
|
+
},
|
|
895
953
|
retry: false
|
|
896
954
|
});
|
|
897
955
|
}
|
|
@@ -899,8 +957,8 @@ function usePrerequisites(userAddress) {
|
|
|
899
957
|
const queryClient = useQueryClient();
|
|
900
958
|
const config = useConfig();
|
|
901
959
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
902
|
-
const client =
|
|
903
|
-
const prereqs =
|
|
960
|
+
const client = useClient6({ chainId });
|
|
961
|
+
const prereqs = useQuery7(
|
|
904
962
|
getPrequisitesQueryOptions({
|
|
905
963
|
queryClient,
|
|
906
964
|
config,
|
|
@@ -917,10 +975,10 @@ function usePrerequisites(userAddress) {
|
|
|
917
975
|
import { useDisconnect } from "wagmi";
|
|
918
976
|
|
|
919
977
|
// src/useENS.ts
|
|
920
|
-
import { useQuery as
|
|
978
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
921
979
|
function useENS(address) {
|
|
922
980
|
const normalizedAddress = address?.toLowerCase();
|
|
923
|
-
return
|
|
981
|
+
return useQuery8({
|
|
924
982
|
enabled: !!normalizedAddress,
|
|
925
983
|
queryKey: ["ens", normalizedAddress],
|
|
926
984
|
queryFn: async () => {
|
|
@@ -1039,8 +1097,11 @@ function Wallet({ isActive, isExpanded, userAddress }) {
|
|
|
1039
1097
|
] });
|
|
1040
1098
|
}
|
|
1041
1099
|
|
|
1042
|
-
// src/onboarding/quarry/
|
|
1100
|
+
// src/onboarding/quarry/Allowance.tsx
|
|
1043
1101
|
import { parseEther as parseEther3 } from "viem";
|
|
1102
|
+
|
|
1103
|
+
// src/onboarding/quarry/useClaimGasPass.ts
|
|
1104
|
+
import { parseEther as parseEther2 } from "viem";
|
|
1044
1105
|
import { useMutation, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
1045
1106
|
|
|
1046
1107
|
// src/quarry/transports/quarryPassIssuer.ts
|
|
@@ -1070,11 +1131,11 @@ async function claimGasPass({ chain, userAddress }) {
|
|
|
1070
1131
|
}
|
|
1071
1132
|
|
|
1072
1133
|
// src/onboarding/quarry/useClaimGasPass.ts
|
|
1073
|
-
import { useClient as
|
|
1134
|
+
import { useClient as useClient7 } from "wagmi";
|
|
1074
1135
|
function useClaimGasPass() {
|
|
1075
1136
|
const queryClient = useQueryClient2();
|
|
1076
1137
|
const { chain } = useEntryKitConfig();
|
|
1077
|
-
const client =
|
|
1138
|
+
const client = useClient7({ chainId: chain.id });
|
|
1078
1139
|
const mutationKey = ["claimGasPass", chain.id];
|
|
1079
1140
|
return useMutation({
|
|
1080
1141
|
retry: 0,
|
|
@@ -1082,7 +1143,7 @@ function useClaimGasPass() {
|
|
|
1082
1143
|
mutationFn: async (userAddress) => {
|
|
1083
1144
|
if (chain.id === 31337) {
|
|
1084
1145
|
if (!client) throw new Error("No client?");
|
|
1085
|
-
await setAllowanceSlot({ client, userAddress, allowance:
|
|
1146
|
+
await setAllowanceSlot({ client, userAddress, allowance: parseEther2("1") });
|
|
1086
1147
|
} else {
|
|
1087
1148
|
await claimGasPass({ chain, userAddress });
|
|
1088
1149
|
}
|
|
@@ -1120,8 +1181,12 @@ function EthIcon({ className, ...props }) {
|
|
|
1120
1181
|
import { formatEther } from "viem";
|
|
1121
1182
|
function formatBalance(wei) {
|
|
1122
1183
|
const formatted = formatEther(wei);
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1184
|
+
const parsed = parseFloat(formatted);
|
|
1185
|
+
if (parsed > 0 && parsed < 1e-5) {
|
|
1186
|
+
return "<0.00001";
|
|
1187
|
+
}
|
|
1188
|
+
const magnitude = Math.floor(parsed).toString().length;
|
|
1189
|
+
return parsed.toLocaleString("en-US", { maximumFractionDigits: Math.max(0, 6 - magnitude) });
|
|
1125
1190
|
}
|
|
1126
1191
|
|
|
1127
1192
|
// src/ui/Balance.tsx
|
|
@@ -1157,7 +1222,7 @@ function Allowance({ isActive, isExpanded, userAddress }) {
|
|
|
1157
1222
|
const claimGasPass2 = useShowMutationError(useClaimGasPass());
|
|
1158
1223
|
useEffect6(() => {
|
|
1159
1224
|
const timer = setTimeout(() => {
|
|
1160
|
-
if (isActive && claimGasPass2.status === "idle" && allowance.isSuccess && allowance.data != null && allowance.data <
|
|
1225
|
+
if (isActive && claimGasPass2.status === "idle" && allowance.isSuccess && allowance.data != null && allowance.data < parseEther3("0.01")) {
|
|
1161
1226
|
claimGasPass2.mutate(userAddress);
|
|
1162
1227
|
}
|
|
1163
1228
|
});
|
|
@@ -1185,6 +1250,9 @@ function Allowance({ isActive, isExpanded, userAddress }) {
|
|
|
1185
1250
|
] });
|
|
1186
1251
|
}
|
|
1187
1252
|
|
|
1253
|
+
// src/onboarding/Session.tsx
|
|
1254
|
+
import { useEffect as useEffect7 } from "react";
|
|
1255
|
+
|
|
1188
1256
|
// src/onboarding/useSetupSession.ts
|
|
1189
1257
|
import { encodeFunctionData } from "viem";
|
|
1190
1258
|
import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
@@ -1198,11 +1266,12 @@ function defineCall(call) {
|
|
|
1198
1266
|
}
|
|
1199
1267
|
|
|
1200
1268
|
// src/onboarding/useSetupSession.ts
|
|
1201
|
-
import { useClient as
|
|
1269
|
+
import { useClient as useClient8 } from "wagmi";
|
|
1202
1270
|
import { resourceToHex as resourceToHex2 } from "@latticexyz/common";
|
|
1203
1271
|
import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";
|
|
1204
1272
|
|
|
1205
1273
|
// src/utils/callWithSignature.ts
|
|
1274
|
+
import { parseErc6492Signature } from "viem";
|
|
1206
1275
|
import { writeContract as viem_writeContract } from "viem/actions";
|
|
1207
1276
|
import { getAction as getAction3 } from "viem/utils";
|
|
1208
1277
|
|
|
@@ -1210,7 +1279,7 @@ import { getAction as getAction3 } from "viem/utils";
|
|
|
1210
1279
|
import { toHex } from "viem";
|
|
1211
1280
|
import { signTypedData } from "viem/actions";
|
|
1212
1281
|
import { callWithSignatureTypes } from "@latticexyz/world-module-callwithsignature/internal";
|
|
1213
|
-
import { getRecord as
|
|
1282
|
+
import { getRecord as getRecord5 } from "@latticexyz/store/internal";
|
|
1214
1283
|
import moduleConfig from "@latticexyz/world-module-callwithsignature/mud.config";
|
|
1215
1284
|
import { hexToResource } from "@latticexyz/common";
|
|
1216
1285
|
import { getAction as getAction2 } from "viem/utils";
|
|
@@ -1222,7 +1291,7 @@ async function signCall({
|
|
|
1222
1291
|
nonce: initialNonce,
|
|
1223
1292
|
client
|
|
1224
1293
|
}) {
|
|
1225
|
-
const nonce = initialNonce ?? (client ? (await
|
|
1294
|
+
const nonce = initialNonce ?? (client ? (await getRecord5(client, {
|
|
1226
1295
|
address: worldAddress,
|
|
1227
1296
|
table: moduleConfig.tables.CallWithSignatureNonces,
|
|
1228
1297
|
key: { signer: userClient.account.address },
|
|
@@ -1257,7 +1326,13 @@ async function callWithSignature({
|
|
|
1257
1326
|
sessionClient,
|
|
1258
1327
|
...opts
|
|
1259
1328
|
}) {
|
|
1260
|
-
const
|
|
1329
|
+
const rawSignature = await signCall(opts);
|
|
1330
|
+
const { address, signature } = parseErc6492Signature(rawSignature);
|
|
1331
|
+
if (address != null) {
|
|
1332
|
+
throw new Error(
|
|
1333
|
+
"ERC-6492 signatures, like from Coinbase Smart Wallet, are not yet supported. Try using a different wallet?"
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1261
1336
|
return getAction3(
|
|
1262
1337
|
sessionClient,
|
|
1263
1338
|
viem_writeContract,
|
|
@@ -1275,7 +1350,7 @@ import { systemsConfig as worldSystemsConfig } from "@latticexyz/world/mud.confi
|
|
|
1275
1350
|
function useSetupSession({ userClient }) {
|
|
1276
1351
|
const queryClient = useQueryClient3();
|
|
1277
1352
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
1278
|
-
const client =
|
|
1353
|
+
const client = useClient8({ chainId });
|
|
1279
1354
|
const mutationKey = ["setupSession", client?.chain.id, userClient.account.address];
|
|
1280
1355
|
return useMutation2({
|
|
1281
1356
|
retry: 0,
|
|
@@ -1381,15 +1456,11 @@ function useSetupSession({ userClient }) {
|
|
|
1381
1456
|
});
|
|
1382
1457
|
}
|
|
1383
1458
|
|
|
1384
|
-
// src/onboarding/Session.tsx
|
|
1385
|
-
import { useEffect as useEffect7 } from "react";
|
|
1386
|
-
|
|
1387
1459
|
// src/useSessionClient.ts
|
|
1388
|
-
import { useClient as
|
|
1460
|
+
import { useClient as useClient9 } from "wagmi";
|
|
1389
1461
|
import {
|
|
1390
|
-
queryOptions as
|
|
1391
|
-
|
|
1392
|
-
useQuery as useQuery8,
|
|
1462
|
+
queryOptions as queryOptions7,
|
|
1463
|
+
useQuery as useQuery9,
|
|
1393
1464
|
useQueryClient as useQueryClient4
|
|
1394
1465
|
} from "@tanstack/react-query";
|
|
1395
1466
|
|
|
@@ -1474,9 +1545,10 @@ function getSessionClientQueryOptions({
|
|
|
1474
1545
|
userAddress,
|
|
1475
1546
|
worldAddress
|
|
1476
1547
|
}) {
|
|
1477
|
-
return
|
|
1548
|
+
return queryOptions7({
|
|
1478
1549
|
queryKey: ["getSessionClient", client?.uid, userAddress, worldAddress],
|
|
1479
|
-
queryFn:
|
|
1550
|
+
queryFn: async () => {
|
|
1551
|
+
if (!userAddress) throw new Error("User not connected.");
|
|
1480
1552
|
const { account: sessionAccount, signer: sessionSigner } = await queryClient.fetchQuery(
|
|
1481
1553
|
getSessionAccountQueryOptions({ client, userAddress })
|
|
1482
1554
|
);
|
|
@@ -1486,7 +1558,7 @@ function getSessionClientQueryOptions({
|
|
|
1486
1558
|
userAddress,
|
|
1487
1559
|
worldAddress
|
|
1488
1560
|
});
|
|
1489
|
-
}
|
|
1561
|
+
},
|
|
1490
1562
|
staleTime: Infinity,
|
|
1491
1563
|
// TODO: replace with function to retry only connection errors
|
|
1492
1564
|
retry: false
|
|
@@ -1495,8 +1567,8 @@ function getSessionClientQueryOptions({
|
|
|
1495
1567
|
function useSessionClient(userAddress) {
|
|
1496
1568
|
const queryClient = useQueryClient4();
|
|
1497
1569
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
1498
|
-
const client =
|
|
1499
|
-
return
|
|
1570
|
+
const client = useClient9({ chainId });
|
|
1571
|
+
return useQuery9(
|
|
1500
1572
|
getSessionClientQueryOptions({
|
|
1501
1573
|
queryClient,
|
|
1502
1574
|
client,
|
|
@@ -1512,9 +1584,11 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1512
1584
|
const sessionClient = useShowQueryError(useSessionClient(userClient.account.address));
|
|
1513
1585
|
const setup = useShowMutationError(useSetupSession({ userClient }));
|
|
1514
1586
|
const hasSession = !registerDelegation && !registerDelegation;
|
|
1587
|
+
const { data: prerequisites } = usePrerequisites(userClient.account.address);
|
|
1588
|
+
const { hasAllowance, hasGasBalance, hasQuarryGasBalance } = prerequisites ?? {};
|
|
1515
1589
|
useEffect7(() => {
|
|
1516
1590
|
const timer = setTimeout(() => {
|
|
1517
|
-
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession) {
|
|
1591
|
+
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession && (hasAllowance || hasGasBalance || hasQuarryGasBalance)) {
|
|
1518
1592
|
setup.mutate({
|
|
1519
1593
|
sessionClient: sessionClient.data,
|
|
1520
1594
|
registerSpender,
|
|
@@ -1523,7 +1597,17 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1523
1597
|
}
|
|
1524
1598
|
});
|
|
1525
1599
|
return () => clearTimeout(timer);
|
|
1526
|
-
}, [
|
|
1600
|
+
}, [
|
|
1601
|
+
hasSession,
|
|
1602
|
+
isActive,
|
|
1603
|
+
registerDelegation,
|
|
1604
|
+
registerSpender,
|
|
1605
|
+
sessionClient,
|
|
1606
|
+
setup,
|
|
1607
|
+
hasAllowance,
|
|
1608
|
+
hasGasBalance,
|
|
1609
|
+
hasQuarryGasBalance
|
|
1610
|
+
]);
|
|
1527
1611
|
return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4", children: [
|
|
1528
1612
|
/* @__PURE__ */ jsxs13("div", { className: "flex justify-between gap-4", children: [
|
|
1529
1613
|
/* @__PURE__ */ jsxs13("div", { children: [
|
|
@@ -1551,7 +1635,10 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1551
1635
|
}
|
|
1552
1636
|
|
|
1553
1637
|
// src/onboarding/GasBalance.tsx
|
|
1554
|
-
import {
|
|
1638
|
+
import { useEffect as useEffect9, useState as useState2 } from "react";
|
|
1639
|
+
import { parseEther as parseEther4 } from "viem";
|
|
1640
|
+
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
1641
|
+
import { useBalance as useBalance2, useWatchBlockNumber } from "wagmi";
|
|
1555
1642
|
|
|
1556
1643
|
// src/data/relayChains.json
|
|
1557
1644
|
var relayChains_default = {
|
|
@@ -1836,11 +1923,11 @@ var relayChains_default = {
|
|
|
1836
1923
|
// src/onboarding/useSetBalance.ts
|
|
1837
1924
|
import { useQueryClient as useQueryClient5, useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1838
1925
|
import { setBalance as setBalance2 } from "viem/actions";
|
|
1839
|
-
import { useClient as
|
|
1926
|
+
import { useClient as useClient10 } from "wagmi";
|
|
1840
1927
|
function useSetBalance() {
|
|
1841
1928
|
const queryClient = useQueryClient5();
|
|
1842
1929
|
const { chainId } = useEntryKitConfig();
|
|
1843
|
-
const client =
|
|
1930
|
+
const client = useClient10({ chainId });
|
|
1844
1931
|
return useMutation3({
|
|
1845
1932
|
retry: 0,
|
|
1846
1933
|
mutationKey: ["setBalance", chainId],
|
|
@@ -1856,21 +1943,93 @@ function useSetBalance() {
|
|
|
1856
1943
|
});
|
|
1857
1944
|
}
|
|
1858
1945
|
|
|
1946
|
+
// src/errors/usePrevious.ts
|
|
1947
|
+
import { useEffect as useEffect8, useRef as useRef3 } from "react";
|
|
1948
|
+
function usePrevious(value, initialValue) {
|
|
1949
|
+
const ref = useRef3();
|
|
1950
|
+
useEffect8(() => {
|
|
1951
|
+
ref.current = { value };
|
|
1952
|
+
}, [value]);
|
|
1953
|
+
return ref.current ? ref.current.value : initialValue;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
// src/icons/IconSVG.tsx
|
|
1957
|
+
import { twMerge as twMerge7 } from "tailwind-merge";
|
|
1958
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1959
|
+
function IconSVG({ className, children, ...props }) {
|
|
1960
|
+
return /* @__PURE__ */ jsx16(
|
|
1961
|
+
"svg",
|
|
1962
|
+
{
|
|
1963
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1964
|
+
viewBox: "0 0 24 24",
|
|
1965
|
+
fill: "currentColor",
|
|
1966
|
+
className: twMerge7("-my-[0.125em] h-[1.25em] w-[1.25em]", className),
|
|
1967
|
+
...props,
|
|
1968
|
+
children
|
|
1969
|
+
}
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
// src/icons/CopyIcon.tsx
|
|
1974
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1975
|
+
function CopyIcon(props) {
|
|
1976
|
+
return /* @__PURE__ */ jsx17(IconSVG, { ...props, children: /* @__PURE__ */ jsx17(
|
|
1977
|
+
"path",
|
|
1978
|
+
{
|
|
1979
|
+
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",
|
|
1980
|
+
fill: "none",
|
|
1981
|
+
stroke: "currentColor",
|
|
1982
|
+
strokeWidth: "2",
|
|
1983
|
+
strokeLinecap: "round",
|
|
1984
|
+
strokeLinejoin: "round"
|
|
1985
|
+
}
|
|
1986
|
+
) });
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
// src/icons/CheckIcon.tsx
|
|
1990
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1991
|
+
function CheckIcon(props) {
|
|
1992
|
+
return /* @__PURE__ */ jsx18(IconSVG, { ...props, children: /* @__PURE__ */ jsx18(
|
|
1993
|
+
"path",
|
|
1994
|
+
{
|
|
1995
|
+
d: "M5 13L9 17L19 7",
|
|
1996
|
+
fill: "none",
|
|
1997
|
+
stroke: "currentColor",
|
|
1998
|
+
strokeWidth: "2",
|
|
1999
|
+
strokeLinecap: "round",
|
|
2000
|
+
strokeLinejoin: "round"
|
|
2001
|
+
}
|
|
2002
|
+
) });
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1859
2005
|
// src/onboarding/GasBalance.tsx
|
|
1860
|
-
import { Fragment, jsx as
|
|
2006
|
+
import { Fragment, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1861
2007
|
function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
2008
|
+
const queryClient = useQueryClient6();
|
|
1862
2009
|
const { chain } = useEntryKitConfig();
|
|
1863
|
-
const
|
|
2010
|
+
const [copied, setCopied] = useState2(false);
|
|
2011
|
+
const balance = useShowQueryError(useBalance2({ chainId: chain.id, address: sessionAddress }));
|
|
2012
|
+
const prevBalance = usePrevious(balance.data);
|
|
1864
2013
|
useWatchBlockNumber({ onBlockNumber: () => balance.refetch() });
|
|
1865
2014
|
const setBalance3 = useShowMutationError(useSetBalance());
|
|
1866
2015
|
const relayChain = relayChains_default[chain.id];
|
|
2016
|
+
const handleCopy = () => {
|
|
2017
|
+
navigator.clipboard.writeText(sessionAddress);
|
|
2018
|
+
setCopied(true);
|
|
2019
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2020
|
+
};
|
|
2021
|
+
useEffect9(() => {
|
|
2022
|
+
if (balance.data != null && prevBalance?.value === 0n && balance.data.value > 0n) {
|
|
2023
|
+
queryClient.invalidateQueries({ queryKey: ["getPrerequisites"] });
|
|
2024
|
+
}
|
|
2025
|
+
}, [balance.data, prevBalance, setBalance3, sessionAddress, queryClient]);
|
|
1867
2026
|
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4", children: [
|
|
1868
2027
|
/* @__PURE__ */ jsxs14("div", { className: "flex justify-between gap-4", children: [
|
|
1869
2028
|
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1870
|
-
/* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
2029
|
+
/* @__PURE__ */ jsx19("div", { children: "Gas balance" }),
|
|
2030
|
+
/* @__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
2031
|
] }),
|
|
1873
|
-
chain.id === 31337 ? /* @__PURE__ */
|
|
2032
|
+
chain.id === 31337 ? /* @__PURE__ */ jsx19(
|
|
1874
2033
|
Button,
|
|
1875
2034
|
{
|
|
1876
2035
|
variant: isActive ? "primary" : "tertiary",
|
|
@@ -1879,19 +2038,19 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
1879
2038
|
pending: balance.status === "pending" || setBalance3.status === "pending",
|
|
1880
2039
|
onClick: () => setBalance3.mutate({
|
|
1881
2040
|
address: sessionAddress,
|
|
1882
|
-
value:
|
|
2041
|
+
value: parseEther4("0.01") + (balance.data?.value ?? 0n)
|
|
1883
2042
|
}),
|
|
1884
2043
|
children: "Top up"
|
|
1885
2044
|
}
|
|
1886
2045
|
) : relayChain != null ? (
|
|
1887
2046
|
// TODO: convert this to a <ButtonLink>
|
|
1888
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsx19(
|
|
1889
2048
|
"a",
|
|
1890
2049
|
{
|
|
1891
|
-
href: `${relayChain.bridgeUrl}?${new URLSearchParams({ toAddress: sessionAddress })}`,
|
|
2050
|
+
href: `${relayChain.bridgeUrl}?${new URLSearchParams({ toAddress: sessionAddress, amount: "0.01" })}`,
|
|
1892
2051
|
target: "_blank",
|
|
1893
2052
|
rel: "noopener noreferrer",
|
|
1894
|
-
children: /* @__PURE__ */
|
|
2053
|
+
children: /* @__PURE__ */ jsx19(
|
|
1895
2054
|
Button,
|
|
1896
2055
|
{
|
|
1897
2056
|
variant: isActive ? "primary" : "tertiary",
|
|
@@ -1906,11 +2065,23 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
1906
2065
|
) : null
|
|
1907
2066
|
] }),
|
|
1908
2067
|
isExpanded ? /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
1909
|
-
/* @__PURE__ */
|
|
2068
|
+
/* @__PURE__ */ jsx19("p", { className: "text-sm", children: "Your session's gas balance is used to pay for onchain computation." }),
|
|
1910
2069
|
/* @__PURE__ */ jsxs14("p", { className: "text-sm", children: [
|
|
1911
2070
|
"Send funds to",
|
|
1912
2071
|
" ",
|
|
1913
|
-
/* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ jsxs14(
|
|
2073
|
+
"span",
|
|
2074
|
+
{
|
|
2075
|
+
className: "inline-flex items-center gap-1 font-mono text-white cursor-pointer hover:text-white/80 transition-colors",
|
|
2076
|
+
onClick: handleCopy,
|
|
2077
|
+
title: "Click to copy",
|
|
2078
|
+
children: [
|
|
2079
|
+
/* @__PURE__ */ jsx19(TruncatedHex, { hex: sessionAddress }),
|
|
2080
|
+
" ",
|
|
2081
|
+
copied ? /* @__PURE__ */ jsx19(CheckIcon, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx19(CopyIcon, { className: "w-3.5 h-3.5" })
|
|
2082
|
+
]
|
|
2083
|
+
}
|
|
2084
|
+
),
|
|
1914
2085
|
" ",
|
|
1915
2086
|
"on ",
|
|
1916
2087
|
chain.name,
|
|
@@ -1920,133 +2091,754 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
1920
2091
|
] });
|
|
1921
2092
|
}
|
|
1922
2093
|
|
|
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
|
-
];
|
|
1959
|
-
}
|
|
1960
|
-
const steps2 = [
|
|
1961
|
-
{
|
|
1962
|
-
id: "wallet",
|
|
1963
|
-
isComplete: true,
|
|
1964
|
-
content: (props) => /* @__PURE__ */ jsx17(Wallet, { ...props, userAddress })
|
|
1965
|
-
}
|
|
1966
|
-
];
|
|
1967
|
-
if (!paymaster) {
|
|
1968
|
-
if (sessionAddress != null) {
|
|
1969
|
-
steps2.push({
|
|
1970
|
-
id: "gasBalance",
|
|
1971
|
-
isComplete: !!hasGasBalance,
|
|
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
|
-
});
|
|
2094
|
+
// src/onboarding/quarry/GasBalance.tsx
|
|
2095
|
+
import { useEffect as useEffect14 } from "react";
|
|
2096
|
+
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
2097
|
+
|
|
2098
|
+
// src/onboarding/deposit/DepositFormContainer.tsx
|
|
2099
|
+
import { useState as useState4 } from "react";
|
|
2100
|
+
import { useChains as useChains4, useChainId } from "wagmi";
|
|
2101
|
+
|
|
2102
|
+
// src/onboarding/deposit/DepositViaTransferForm.tsx
|
|
2103
|
+
import { useAccount as useAccount4, useWriteContract, usePrepareTransactionRequest, usePublicClient } from "wagmi";
|
|
2104
|
+
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
2105
|
+
import { useMutation as useMutation4, useQuery as useQuery12 } from "@tanstack/react-query";
|
|
2106
|
+
|
|
2107
|
+
// src/onboarding/deposit/DepositForm.tsx
|
|
2108
|
+
import { useEffect as useEffect11, useRef as useRef4 } from "react";
|
|
2109
|
+
import { useAccount as useAccount3, useBalance as useBalance4, useWatchBlockNumber as useWatchBlockNumber2 } from "wagmi";
|
|
2110
|
+
import { useIsMounted } from "usehooks-ts";
|
|
2111
|
+
import { twMerge as twMerge15 } from "tailwind-merge";
|
|
2112
|
+
|
|
2113
|
+
// src/onboarding/deposit/ChainSelect.tsx
|
|
2114
|
+
import { useEffect as useEffect10, useMemo as useMemo2 } from "react";
|
|
2115
|
+
import { useSwitchChain } from "wagmi";
|
|
2116
|
+
import { twMerge as twMerge12 } from "tailwind-merge";
|
|
2117
|
+
import * as Select from "@radix-ui/react-select";
|
|
2118
|
+
|
|
2119
|
+
// src/icons/ChevronUpIcon.tsx
|
|
2120
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2121
|
+
function ChevronUpIcon(props) {
|
|
2122
|
+
return /* @__PURE__ */ jsx20(IconSVG, { viewBox: "0 0 20 20", ...props, children: /* @__PURE__ */ jsx20(
|
|
2123
|
+
"path",
|
|
2124
|
+
{
|
|
2125
|
+
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",
|
|
2126
|
+
fillRule: "evenodd",
|
|
2127
|
+
clipRule: "evenodd"
|
|
1981
2128
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
const nextStep = steps.find((step) => step.content != null && !step.isComplete);
|
|
1991
|
-
const completedSteps = steps.filter((step) => step.isComplete);
|
|
1992
|
-
const activeStep = (selectedStepId != null ? steps.find((step) => step.id === selectedStepId) : null) ?? nextStep ?? (completedSteps.length < steps.length ? completedSteps.at(-1) : null);
|
|
1993
|
-
const activeStepIndex = activeStep ? steps.indexOf(activeStep) : -1;
|
|
1994
|
-
return /* @__PURE__ */ jsx17(
|
|
1995
|
-
"div",
|
|
2129
|
+
) });
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
// src/icons/ChevronDownIcon.tsx
|
|
2133
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2134
|
+
function ChevronDownIcon(props) {
|
|
2135
|
+
return /* @__PURE__ */ jsx21(IconSVG, { viewBox: "0 0 20 20", ...props, children: /* @__PURE__ */ jsx21(
|
|
2136
|
+
"path",
|
|
1996
2137
|
{
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
"animate-in animate-duration-300 fade-in slide-in-from-bottom-8"
|
|
2001
|
-
),
|
|
2002
|
-
children: steps.map((step, i) => {
|
|
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
|
-
})
|
|
2138
|
+
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",
|
|
2139
|
+
fillRule: "evenodd",
|
|
2140
|
+
clipRule: "evenodd"
|
|
2008
2141
|
}
|
|
2009
|
-
);
|
|
2142
|
+
) });
|
|
2010
2143
|
}
|
|
2011
2144
|
|
|
2012
|
-
// src/
|
|
2013
|
-
import {
|
|
2014
|
-
import {
|
|
2015
|
-
function
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2145
|
+
// src/ui/Slot.tsx
|
|
2146
|
+
import { isValidElement, cloneElement, Children } from "react";
|
|
2147
|
+
import { twMerge as twMerge8 } from "tailwind-merge";
|
|
2148
|
+
function Slot({
|
|
2149
|
+
children,
|
|
2150
|
+
...props
|
|
2151
|
+
}) {
|
|
2152
|
+
if (isValidElement(children)) {
|
|
2153
|
+
return cloneElement(children, {
|
|
2154
|
+
...props,
|
|
2155
|
+
...children.props,
|
|
2156
|
+
style: {
|
|
2157
|
+
...props.style,
|
|
2158
|
+
...children.props.style
|
|
2159
|
+
},
|
|
2160
|
+
className: twMerge8(props.className, children.props.className)
|
|
2161
|
+
});
|
|
2022
2162
|
}
|
|
2023
|
-
|
|
2163
|
+
if (Children.count(children) > 1) {
|
|
2164
|
+
Children.only(null);
|
|
2165
|
+
}
|
|
2166
|
+
return null;
|
|
2024
2167
|
}
|
|
2025
2168
|
|
|
2026
|
-
// src/
|
|
2027
|
-
import {
|
|
2169
|
+
// src/ui/Input.tsx
|
|
2170
|
+
import { twMerge as twMerge9 } from "tailwind-merge";
|
|
2171
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2172
|
+
function Input({ asChild, className, ...props }) {
|
|
2173
|
+
const Child = asChild ? Slot : "input";
|
|
2174
|
+
return /* @__PURE__ */ jsx22(
|
|
2175
|
+
Child,
|
|
2176
|
+
{
|
|
2177
|
+
className: twMerge9(
|
|
2178
|
+
"p-2.5 gap-1 border text-lg font-medium transition",
|
|
2179
|
+
"outline-none ring-2 ring-transparent focus-within:ring-orange-500 focus-within:border-transparent",
|
|
2180
|
+
"bg-neutral-900 border-neutral-700 text-white placeholder:text-neutral-500",
|
|
2181
|
+
className
|
|
2182
|
+
),
|
|
2183
|
+
...props
|
|
2184
|
+
}
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2028
2187
|
|
|
2029
|
-
// src/
|
|
2030
|
-
import { twMerge as
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2188
|
+
// src/onboarding/deposit/ChainIcon.tsx
|
|
2189
|
+
import { twMerge as twMerge11 } from "tailwind-merge";
|
|
2190
|
+
|
|
2191
|
+
// src/onboarding/deposit/PreloadedImage.tsx
|
|
2192
|
+
import { twMerge as twMerge10 } from "tailwind-merge";
|
|
2193
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2194
|
+
function PreloadedImage({ url, fallback: fallback2, className }) {
|
|
2195
|
+
const { isSuccess, isLoading } = usePreloadImage(url);
|
|
2196
|
+
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 });
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
// src/onboarding/deposit/ChainIcon.tsx
|
|
2200
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
2201
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2202
|
+
var ChainIcon = forwardRef2(function ChainIcon2({ name, url, className }, forwardedRef) {
|
|
2203
|
+
return /* @__PURE__ */ jsx24(
|
|
2204
|
+
"span",
|
|
2035
2205
|
{
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2206
|
+
ref: forwardedRef,
|
|
2207
|
+
className: twMerge11("flex-shrink-0 inline-flex w-6 aspect-square rounded-full overflow-clip", className),
|
|
2208
|
+
children: url ? /* @__PURE__ */ jsx24(PreloadedImage, { url }) : (
|
|
2209
|
+
// TODO: better placeholder
|
|
2210
|
+
/* @__PURE__ */ jsx24(
|
|
2211
|
+
"span",
|
|
2212
|
+
{
|
|
2213
|
+
className: twMerge11(
|
|
2214
|
+
"inline-flex items-center justify-center w-full h-full rounded-full",
|
|
2215
|
+
"border-2 border-dashed border-white/50 opacity-50"
|
|
2216
|
+
),
|
|
2217
|
+
children: name?.slice(0, 1)
|
|
2218
|
+
}
|
|
2219
|
+
)
|
|
2220
|
+
)
|
|
2042
2221
|
}
|
|
2043
2222
|
);
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
// src/onboarding/deposit/useRelay.ts
|
|
2226
|
+
import {
|
|
2227
|
+
MAINNET_RELAY_API,
|
|
2228
|
+
TESTNET_RELAY_API,
|
|
2229
|
+
fetchChainConfigs,
|
|
2230
|
+
createClient as createClient2,
|
|
2231
|
+
LogLevel
|
|
2232
|
+
} from "@reservoir0x/relay-sdk";
|
|
2233
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
2234
|
+
function useRelay() {
|
|
2235
|
+
const { chain } = useEntryKitConfig();
|
|
2236
|
+
const appOrigin = location.host;
|
|
2237
|
+
const baseApiUrl = chain.testnet ? TESTNET_RELAY_API : MAINNET_RELAY_API;
|
|
2238
|
+
return useQuery10({
|
|
2239
|
+
queryKey: ["relayChains", baseApiUrl, appOrigin],
|
|
2240
|
+
queryFn: async () => {
|
|
2241
|
+
debug("fetching relay chains from", baseApiUrl);
|
|
2242
|
+
const chains = await fetchChainConfigs(baseApiUrl);
|
|
2243
|
+
debug("got relay chains", chains);
|
|
2244
|
+
const client = createClient2({
|
|
2245
|
+
baseApiUrl,
|
|
2246
|
+
source: appOrigin,
|
|
2247
|
+
chains,
|
|
2248
|
+
logLevel: LogLevel.Verbose
|
|
2249
|
+
});
|
|
2250
|
+
return { client, chains };
|
|
2251
|
+
},
|
|
2252
|
+
refetchOnMount: false,
|
|
2253
|
+
refetchOnReconnect: false,
|
|
2254
|
+
refetchOnWindowFocus: false,
|
|
2255
|
+
staleTime: Infinity
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
// src/onboarding/deposit/useChainBalances.ts
|
|
2260
|
+
import { useAccount, useConfig as useWagmiConfig } from "wagmi";
|
|
2261
|
+
import { getBalance as getBalance2 } from "wagmi/actions";
|
|
2262
|
+
import { useQuery as useQuery11, skipToken as skipToken6 } from "@tanstack/react-query";
|
|
2263
|
+
import { isNotNull } from "@latticexyz/common/utils";
|
|
2264
|
+
function useChainBalances({ chains }) {
|
|
2265
|
+
const { address: userAddress } = useAccount();
|
|
2266
|
+
const wagmiConfig = useWagmiConfig();
|
|
2267
|
+
const chainIds = chains.map((chain) => chain.id);
|
|
2268
|
+
return useQuery11({
|
|
2269
|
+
queryKey: ["chainBalances", chainIds, userAddress],
|
|
2270
|
+
queryFn: userAddress ? async () => {
|
|
2271
|
+
const chainBalances = await Promise.allSettled(
|
|
2272
|
+
chains.map(async (chain) => {
|
|
2273
|
+
const balance = await getBalance2(wagmiConfig, { chainId: chain.id, address: userAddress });
|
|
2274
|
+
return { chain, balance };
|
|
2275
|
+
})
|
|
2276
|
+
);
|
|
2277
|
+
return chainBalances.map((result) => result.status === "fulfilled" ? result.value : null).filter(isNotNull);
|
|
2278
|
+
} : skipToken6,
|
|
2279
|
+
refetchInterval: 1e3 * 60,
|
|
2280
|
+
retry: 1
|
|
2281
|
+
});
|
|
2044
2282
|
}
|
|
2045
2283
|
|
|
2284
|
+
// src/onboarding/deposit/ChainSelect.tsx
|
|
2285
|
+
import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2286
|
+
function ChainSelect({ value, onChange }) {
|
|
2287
|
+
const theme = useTheme();
|
|
2288
|
+
const { frame } = useFrame();
|
|
2289
|
+
const { chains, switchChain } = useSwitchChain();
|
|
2290
|
+
const relay = useRelay();
|
|
2291
|
+
const relayChains = relay.data?.chains;
|
|
2292
|
+
const sourceChains = useMemo2(() => {
|
|
2293
|
+
return chains.map((sourceChain) => {
|
|
2294
|
+
const relayChain = relayChains?.find((c) => c.id === sourceChain.id);
|
|
2295
|
+
return {
|
|
2296
|
+
...sourceChain,
|
|
2297
|
+
relayChain
|
|
2298
|
+
};
|
|
2299
|
+
}).filter((c) => c.relayChain);
|
|
2300
|
+
}, [chains, relayChains]);
|
|
2301
|
+
const selectedChain = sourceChains.find((c) => c.id === value);
|
|
2302
|
+
const { data: chainsBalances, isLoading } = useShowQueryError(useChainBalances({ chains: sourceChains }));
|
|
2303
|
+
const renderedChains = useMemo2(() => {
|
|
2304
|
+
if (!chainsBalances) return [];
|
|
2305
|
+
const chainsWithBalance = chainsBalances.filter(({ balance }) => balance.value > 0n).map(({ chain, balance }) => ({ chain, balance: balance.value }));
|
|
2306
|
+
return chainsWithBalance.length > 0 ? chainsWithBalance : sourceChains.map((chain) => ({ chain, balance: 0n }));
|
|
2307
|
+
}, [chainsBalances, sourceChains]);
|
|
2308
|
+
useEffect10(() => {
|
|
2309
|
+
if (renderedChains.length > 0 && (!selectedChain || !renderedChains.find((c) => c.chain.id === selectedChain?.id))) {
|
|
2310
|
+
const defaultChain = renderedChains[0].chain;
|
|
2311
|
+
onChange(defaultChain.id);
|
|
2312
|
+
switchChain({ chainId: defaultChain.id });
|
|
2313
|
+
}
|
|
2314
|
+
}, [value, selectedChain, renderedChains, onChange, switchChain]);
|
|
2315
|
+
return /* @__PURE__ */ jsxs15(
|
|
2316
|
+
Select.Root,
|
|
2317
|
+
{
|
|
2318
|
+
value: value.toString(),
|
|
2319
|
+
onValueChange: (value2) => {
|
|
2320
|
+
if (value2) {
|
|
2321
|
+
const chain = renderedChains.find((item) => item.chain.id.toString() === value2)?.chain;
|
|
2322
|
+
if (!chain) throw new Error(`Unknown chain selected: ${value2}`);
|
|
2323
|
+
onChange(chain.id);
|
|
2324
|
+
}
|
|
2325
|
+
},
|
|
2326
|
+
children: [
|
|
2327
|
+
/* @__PURE__ */ jsx25(Input, { asChild: true, children: /* @__PURE__ */ jsxs15(Select.Trigger, { className: "group inline-flex items-center justify-center", children: [
|
|
2328
|
+
/* @__PURE__ */ jsx25(Select.Value, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
2329
|
+
ChainIcon,
|
|
2330
|
+
{
|
|
2331
|
+
id: selectedChain?.id,
|
|
2332
|
+
name: selectedChain?.name,
|
|
2333
|
+
url: selectedChain?.relayChain?.icon?.[theme],
|
|
2334
|
+
className: "w-8"
|
|
2335
|
+
}
|
|
2336
|
+
) }),
|
|
2337
|
+
/* @__PURE__ */ jsx25(Select.Icon, { asChild: true, children: /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
2338
|
+
/* @__PURE__ */ jsx25(ChevronDownIcon, { className: "text-sm -mr-1 group-aria-expanded:hidden" }),
|
|
2339
|
+
/* @__PURE__ */ jsx25(ChevronUpIcon, { className: "text-sm -mr-1 hidden group-aria-expanded:inline" })
|
|
2340
|
+
] }) })
|
|
2341
|
+
] }) }),
|
|
2342
|
+
frame.contentDocument ? /* @__PURE__ */ jsx25(Select.Portal, { container: frame.contentDocument.body, children: /* @__PURE__ */ jsx25(
|
|
2343
|
+
Select.Content,
|
|
2344
|
+
{
|
|
2345
|
+
position: "popper",
|
|
2346
|
+
className: "w-[352px] max-h-[230px] overflow-y-auto mt-1 animate-in fade-in slide-in-from-top-2",
|
|
2347
|
+
children: /* @__PURE__ */ jsx25(Select.Viewport, { children: /* @__PURE__ */ jsx25(
|
|
2348
|
+
Select.Group,
|
|
2349
|
+
{
|
|
2350
|
+
className: twMerge12(
|
|
2351
|
+
"flex flex-col border divide-y",
|
|
2352
|
+
"bg-neutral-800 text-neutral-300 border-neutral-700 divide-neutral-700"
|
|
2353
|
+
),
|
|
2354
|
+
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 }) => {
|
|
2355
|
+
return /* @__PURE__ */ jsxs15(
|
|
2356
|
+
Select.Item,
|
|
2357
|
+
{
|
|
2358
|
+
value: chain.id.toString(),
|
|
2359
|
+
className: twMerge12(
|
|
2360
|
+
"group flex p-2.5 gap-2.5 items-center cursor-pointer outline-none",
|
|
2361
|
+
"text-white focus:bg-neutral-700 data-[state=checked]:bg-neutral-900"
|
|
2362
|
+
),
|
|
2363
|
+
children: [
|
|
2364
|
+
/* @__PURE__ */ jsx25(ChainIcon, { id: chain.id, name: chain.name, url: chain.relayChain?.icon?.[theme] }),
|
|
2365
|
+
/* @__PURE__ */ jsx25("span", { className: "flex-grow flex-shrink-0", children: chain.name }),
|
|
2366
|
+
/* @__PURE__ */ jsx25("span", { className: "flex-shrink-0 font-mono text-sm text-neutral-400", children: /* @__PURE__ */ jsx25(Balance, { wei: balance }) })
|
|
2367
|
+
]
|
|
2368
|
+
},
|
|
2369
|
+
chain.id
|
|
2370
|
+
);
|
|
2371
|
+
})
|
|
2372
|
+
}
|
|
2373
|
+
) })
|
|
2374
|
+
}
|
|
2375
|
+
) }) : null
|
|
2376
|
+
]
|
|
2377
|
+
}
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
// src/onboarding/deposit/AmountInput.tsx
|
|
2382
|
+
import { formatEther as formatEther3, parseEther as parseEther5 } from "viem";
|
|
2383
|
+
import { twMerge as twMerge13 } from "tailwind-merge";
|
|
2384
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
2385
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2386
|
+
var AmountInput = forwardRef3(function AmountInput2({ initialAmount, onChange }, forwardedRef) {
|
|
2387
|
+
return /* @__PURE__ */ jsx26(Input, { asChild: true, className: "w-full cursor-text flex items-center", children: /* @__PURE__ */ jsxs16("label", { children: [
|
|
2388
|
+
/* @__PURE__ */ jsx26(
|
|
2389
|
+
"input",
|
|
2390
|
+
{
|
|
2391
|
+
ref: forwardedRef,
|
|
2392
|
+
className: twMerge13("peer flex-grow outline-none bg-transparent", "placeholder:text-neutral-500"),
|
|
2393
|
+
placeholder: "0.005",
|
|
2394
|
+
required: true,
|
|
2395
|
+
autoFocus: true,
|
|
2396
|
+
defaultValue: initialAmount == null ? "" : formatEther3(initialAmount),
|
|
2397
|
+
onChange: (event) => {
|
|
2398
|
+
const input = event.currentTarget;
|
|
2399
|
+
if (input.value.trim() === "") {
|
|
2400
|
+
input.setCustomValidity("");
|
|
2401
|
+
onChange(void 0);
|
|
2402
|
+
return;
|
|
2403
|
+
}
|
|
2404
|
+
const value = input.value.trim().replace(/\.$/, ".0");
|
|
2405
|
+
if (!/^\d*(\.\d+)?$/.test(value)) {
|
|
2406
|
+
return input.setCustomValidity("Invalid amount.");
|
|
2407
|
+
}
|
|
2408
|
+
input.setCustomValidity("");
|
|
2409
|
+
onChange(parseEther5(value));
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
),
|
|
2413
|
+
/* @__PURE__ */ jsx26("span", { className: twMerge13("flex-shrink-0 text-2xl", "peer-placeholder-shown:text-neutral-500"), children: /* @__PURE__ */ jsx26(EthIcon, {}) })
|
|
2414
|
+
] }) });
|
|
2415
|
+
});
|
|
2416
|
+
|
|
2417
|
+
// src/onboarding/deposit/SubmitButton.tsx
|
|
2418
|
+
import { useAccount as useAccount2, useBalance as useBalance3, useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
2419
|
+
import { twMerge as twMerge14 } from "tailwind-merge";
|
|
2420
|
+
import { parseEther as parseEther6 } from "viem";
|
|
2421
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2422
|
+
var MAX_DEPOSIT_AMOUNT = "0.1";
|
|
2423
|
+
function SubmitButton({ amount, chainId, className, ...buttonProps }) {
|
|
2424
|
+
const { chainId: userChainId, address: userAddress } = useAccount2();
|
|
2425
|
+
const { data: userBalance } = useBalance3({ address: userAddress });
|
|
2426
|
+
const shouldSwitchChain = chainId != null && chainId !== userChainId;
|
|
2427
|
+
const switchChain = useSwitchChain2();
|
|
2428
|
+
if (shouldSwitchChain) {
|
|
2429
|
+
return /* @__PURE__ */ jsx27(
|
|
2430
|
+
Button,
|
|
2431
|
+
{
|
|
2432
|
+
type: "button",
|
|
2433
|
+
variant: "primary",
|
|
2434
|
+
className: twMerge14("w-full", className),
|
|
2435
|
+
pending: switchChain.isPending,
|
|
2436
|
+
onClick: () => switchChain.switchChain({ chainId }),
|
|
2437
|
+
children: "Switch chain"
|
|
2438
|
+
}
|
|
2439
|
+
);
|
|
2440
|
+
} else if (amount) {
|
|
2441
|
+
if (amount > parseEther6(MAX_DEPOSIT_AMOUNT)) {
|
|
2442
|
+
return /* @__PURE__ */ jsxs17(Button, { type: "button", className: twMerge14("w-full", className), disabled: true, children: [
|
|
2443
|
+
"Max amount is ",
|
|
2444
|
+
MAX_DEPOSIT_AMOUNT,
|
|
2445
|
+
" ETH"
|
|
2446
|
+
] });
|
|
2447
|
+
} else if (amount > (userBalance?.value ?? 0n)) {
|
|
2448
|
+
return /* @__PURE__ */ jsx27(Button, { type: "button", className: twMerge14("w-full", className), disabled: true, children: "Insufficient balance" });
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
return /* @__PURE__ */ jsx27(Button, { type: "submit", className: twMerge14("w-full", className), ...buttonProps });
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
// src/icons/WarningIcon.tsx
|
|
2455
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2456
|
+
function WarningIcon(props) {
|
|
2457
|
+
return /* @__PURE__ */ jsx28(IconSVG, { fill: "none", ...props, children: /* @__PURE__ */ jsx28(
|
|
2458
|
+
"path",
|
|
2459
|
+
{
|
|
2460
|
+
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",
|
|
2461
|
+
stroke: "currentColor",
|
|
2462
|
+
strokeWidth: "2",
|
|
2463
|
+
strokeLinecap: "round",
|
|
2464
|
+
strokeLinejoin: "round"
|
|
2465
|
+
}
|
|
2466
|
+
) });
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
// src/formatGas.ts
|
|
2470
|
+
import { formatGwei } from "viem";
|
|
2471
|
+
function formatGas(wei) {
|
|
2472
|
+
const formatted = formatGwei(wei);
|
|
2473
|
+
const magnitude = Math.floor(parseFloat(formatted)).toString().length;
|
|
2474
|
+
return parseFloat(formatted).toLocaleString("en-US", { maximumFractionDigits: Math.max(0, 6 - magnitude) });
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
// src/onboarding/deposit/DepositForm.tsx
|
|
2478
|
+
import { Fragment as Fragment3, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2479
|
+
function DepositForm({
|
|
2480
|
+
sourceChain,
|
|
2481
|
+
setSourceChainId,
|
|
2482
|
+
amount,
|
|
2483
|
+
setAmount,
|
|
2484
|
+
estimatedFee,
|
|
2485
|
+
estimatedTime,
|
|
2486
|
+
onSubmit,
|
|
2487
|
+
submitButton
|
|
2488
|
+
}) {
|
|
2489
|
+
const amountInputRef = useRef4(null);
|
|
2490
|
+
const isMounted = useIsMounted();
|
|
2491
|
+
const { address: userAddress, chainId: userChainId } = useAccount3();
|
|
2492
|
+
const balance = useShowQueryError(useBalance4({ chainId: sourceChain.id, address: userAddress }));
|
|
2493
|
+
const quarryBalance = useShowQueryError(useBalance(userAddress));
|
|
2494
|
+
useWatchBlockNumber2({
|
|
2495
|
+
onBlockNumber: () => {
|
|
2496
|
+
balance.refetch();
|
|
2497
|
+
quarryBalance.refetch();
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
const minimumBalance = amount != null ? amount + (estimatedFee?.fee ?? 0n) : void 0;
|
|
2501
|
+
const hasMinimumBalance = balance.data != null ? balance.data.value > (minimumBalance ?? 0n) : void 0;
|
|
2502
|
+
useEffect11(() => {
|
|
2503
|
+
amountInputRef.current?.focus();
|
|
2504
|
+
}, [userChainId]);
|
|
2505
|
+
return /* @__PURE__ */ jsxs18(
|
|
2506
|
+
"form",
|
|
2507
|
+
{
|
|
2508
|
+
className: "flex flex-col gap-5",
|
|
2509
|
+
onSubmit: async (event) => {
|
|
2510
|
+
event.preventDefault();
|
|
2511
|
+
try {
|
|
2512
|
+
await onSubmit();
|
|
2513
|
+
if (isMounted()) {
|
|
2514
|
+
setAmount(void 0);
|
|
2515
|
+
if (amountInputRef.current) {
|
|
2516
|
+
amountInputRef.current.value = "";
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
} catch (error2) {
|
|
2520
|
+
console.error("Error during deposit", error2);
|
|
2521
|
+
} finally {
|
|
2522
|
+
amountInputRef.current?.focus();
|
|
2523
|
+
}
|
|
2524
|
+
},
|
|
2525
|
+
children: [
|
|
2526
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
|
|
2527
|
+
/* @__PURE__ */ jsx29(ChainSelect, { value: sourceChain.id, onChange: setSourceChainId }),
|
|
2528
|
+
/* @__PURE__ */ jsx29(AmountInput, { ref: amountInputRef, initialAmount: amount, onChange: setAmount })
|
|
2529
|
+
] }),
|
|
2530
|
+
/* @__PURE__ */ jsxs18(
|
|
2531
|
+
"dl",
|
|
2532
|
+
{
|
|
2533
|
+
className: twMerge15(
|
|
2534
|
+
"grid grid-cols-2 divide-y text-sm leading-loose [&_>_:is(dt,dd)]:px-1 [&_>_dd]:text-right",
|
|
2535
|
+
"divide-neutral-700 text-neutral-400"
|
|
2536
|
+
),
|
|
2537
|
+
children: [
|
|
2538
|
+
/* @__PURE__ */ jsx29("dt", { children: "Available to deposit" }),
|
|
2539
|
+
/* @__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 }),
|
|
2540
|
+
/* @__PURE__ */ jsx29("dt", { children: "Gas balance after deposit" }),
|
|
2541
|
+
/* @__PURE__ */ jsx29("dd", { children: /* @__PURE__ */ jsx29(Balance, { wei: (quarryBalance.data ?? 0n) + (amount ?? 0n) }) }),
|
|
2542
|
+
/* @__PURE__ */ jsx29("dt", { children: "Estimated fee" }),
|
|
2543
|
+
/* @__PURE__ */ jsx29("dd", { children: estimatedFee.fee ? /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
2544
|
+
formatGas(estimatedFee.fee),
|
|
2545
|
+
" gwei"
|
|
2546
|
+
] }) : 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 }),
|
|
2547
|
+
/* @__PURE__ */ jsx29("dt", { children: "Time to deposit" }),
|
|
2548
|
+
/* @__PURE__ */ jsx29("dd", { children: estimatedTime })
|
|
2549
|
+
]
|
|
2550
|
+
}
|
|
2551
|
+
),
|
|
2552
|
+
hasMinimumBalance ? submitButton : /* @__PURE__ */ jsx29(SubmitButton, { disabled: true, children: "Not enough funds" })
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
);
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
// src/onboarding/deposit/useDeposits.ts
|
|
2559
|
+
import { createStore as createStore4 } from "zustand/vanilla";
|
|
2560
|
+
import { useStore as useStore2 } from "zustand";
|
|
2561
|
+
import { useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
2562
|
+
var store4 = createStore4(() => ({
|
|
2563
|
+
count: 0,
|
|
2564
|
+
deposits: []
|
|
2565
|
+
}));
|
|
2566
|
+
function useDeposits() {
|
|
2567
|
+
const deposits = useStore2(store4, (state) => state.deposits);
|
|
2568
|
+
const addDeposit = useCallback2((transaction) => {
|
|
2569
|
+
store4.setState((state) => {
|
|
2570
|
+
if (transaction.type === "relay") {
|
|
2571
|
+
const existingDeposit = state.deposits.find(
|
|
2572
|
+
(deposit) => deposit.type === "relay" && deposit.requestId === transaction.requestId
|
|
2573
|
+
);
|
|
2574
|
+
if (existingDeposit) {
|
|
2575
|
+
return state;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
return {
|
|
2579
|
+
count: state.count + 1,
|
|
2580
|
+
deposits: [
|
|
2581
|
+
...state.deposits,
|
|
2582
|
+
{
|
|
2583
|
+
...transaction,
|
|
2584
|
+
uid: `deposit-${state.count}`
|
|
2585
|
+
}
|
|
2586
|
+
]
|
|
2587
|
+
};
|
|
2588
|
+
});
|
|
2589
|
+
}, []);
|
|
2590
|
+
const removeDeposit = useCallback2((uid) => {
|
|
2591
|
+
store4.setState((state) => ({
|
|
2592
|
+
deposits: state.deposits.filter((deposit) => deposit.uid !== uid)
|
|
2593
|
+
}));
|
|
2594
|
+
}, []);
|
|
2595
|
+
return useMemo3(
|
|
2596
|
+
() => ({
|
|
2597
|
+
deposits,
|
|
2598
|
+
addDeposit,
|
|
2599
|
+
removeDeposit
|
|
2600
|
+
}),
|
|
2601
|
+
[addDeposit, deposits, removeDeposit]
|
|
2602
|
+
);
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// src/onboarding/deposit/DepositViaTransferForm.tsx
|
|
2606
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2607
|
+
function DepositViaTransferForm({ amount, setAmount, sourceChain, setSourceChainId }) {
|
|
2608
|
+
const { chain } = useEntryKitConfig();
|
|
2609
|
+
const paymaster = getPaymaster(chain);
|
|
2610
|
+
const publicClient = usePublicClient();
|
|
2611
|
+
const { address: userAddress } = useAccount4();
|
|
2612
|
+
const { writeContractAsync } = useWriteContract();
|
|
2613
|
+
const { addDeposit } = useDeposits();
|
|
2614
|
+
if (!userAddress) {
|
|
2615
|
+
throw new Error("User address not found");
|
|
2616
|
+
}
|
|
2617
|
+
const { data: gasPrice } = useQuery12({
|
|
2618
|
+
queryKey: ["gasPrice", sourceChain.id],
|
|
2619
|
+
queryFn: async () => {
|
|
2620
|
+
if (!publicClient) throw new Error("Public client not available");
|
|
2621
|
+
return publicClient.getGasPrice();
|
|
2622
|
+
},
|
|
2623
|
+
refetchInterval: 15e3,
|
|
2624
|
+
enabled: !!publicClient
|
|
2625
|
+
});
|
|
2626
|
+
const { data: prepareData, error: prepareError } = usePrepareTransactionRequest({
|
|
2627
|
+
to: paymaster?.address,
|
|
2628
|
+
data: encodeFunctionData2({
|
|
2629
|
+
abi: paymasterAbi,
|
|
2630
|
+
functionName: "depositTo",
|
|
2631
|
+
args: [userAddress]
|
|
2632
|
+
}),
|
|
2633
|
+
value: amount
|
|
2634
|
+
});
|
|
2635
|
+
const deposit = useMutation4({
|
|
2636
|
+
mutationKey: ["depositViaTransfer", amount?.toString()],
|
|
2637
|
+
mutationFn: async () => {
|
|
2638
|
+
if (!paymaster) throw new Error("Paymaster not found");
|
|
2639
|
+
if (!publicClient) throw new Error("Public client not found");
|
|
2640
|
+
if (!amount) throw new Error("Amount cannot be 0");
|
|
2641
|
+
try {
|
|
2642
|
+
const hash = await writeContractAsync({
|
|
2643
|
+
address: paymaster.address,
|
|
2644
|
+
abi: paymasterAbi,
|
|
2645
|
+
functionName: "depositTo",
|
|
2646
|
+
args: [userAddress],
|
|
2647
|
+
value: amount
|
|
2648
|
+
});
|
|
2649
|
+
const receipt = publicClient.waitForTransactionReceipt({ hash }).then((receipt2) => {
|
|
2650
|
+
if (receipt2.status === "reverted") {
|
|
2651
|
+
throw new Error("Transfer transaction reverted.");
|
|
2652
|
+
}
|
|
2653
|
+
return receipt2;
|
|
2654
|
+
});
|
|
2655
|
+
const pendingDeposit = {
|
|
2656
|
+
type: "transfer",
|
|
2657
|
+
amount,
|
|
2658
|
+
chainL1Id: sourceChain.id,
|
|
2659
|
+
chainL2Id: chain.id,
|
|
2660
|
+
hash,
|
|
2661
|
+
receipt,
|
|
2662
|
+
start: /* @__PURE__ */ new Date(),
|
|
2663
|
+
estimatedTime: 1e3 * 12,
|
|
2664
|
+
isComplete: receipt.then(() => void 0)
|
|
2665
|
+
};
|
|
2666
|
+
addDeposit(pendingDeposit);
|
|
2667
|
+
} catch (error2) {
|
|
2668
|
+
console.error("Error while depositing via bridge", error2);
|
|
2669
|
+
throw error2;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
});
|
|
2673
|
+
const estimatedFee = prepareData?.gas && gasPrice ? prepareData.gas * gasPrice : void 0;
|
|
2674
|
+
return /* @__PURE__ */ jsx30(
|
|
2675
|
+
DepositForm,
|
|
2676
|
+
{
|
|
2677
|
+
sourceChain,
|
|
2678
|
+
setSourceChainId,
|
|
2679
|
+
amount,
|
|
2680
|
+
setAmount,
|
|
2681
|
+
estimatedFee: {
|
|
2682
|
+
fee: estimatedFee,
|
|
2683
|
+
isLoading: !prepareData && !prepareError || !gasPrice,
|
|
2684
|
+
error: prepareError instanceof Error ? prepareError : void 0
|
|
2685
|
+
},
|
|
2686
|
+
estimatedTime: "A few seconds",
|
|
2687
|
+
onSubmit: async () => {
|
|
2688
|
+
await deposit.mutateAsync();
|
|
2689
|
+
},
|
|
2690
|
+
submitButton: /* @__PURE__ */ jsx30(
|
|
2691
|
+
SubmitButton,
|
|
2692
|
+
{
|
|
2693
|
+
variant: "primary",
|
|
2694
|
+
amount,
|
|
2695
|
+
chainId: sourceChain.id,
|
|
2696
|
+
disabled: !!prepareError || !amount || !userAddress,
|
|
2697
|
+
pending: deposit.isPending,
|
|
2698
|
+
children: "Deposit"
|
|
2699
|
+
}
|
|
2700
|
+
)
|
|
2701
|
+
}
|
|
2702
|
+
);
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
// src/onboarding/deposit/DepositViaRelayForm.tsx
|
|
2706
|
+
import { encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
2707
|
+
import { useAccount as useAccount5, useWalletClient } from "wagmi";
|
|
2708
|
+
import { useMutation as useMutation5, useQuery as useQuery13 } from "@tanstack/react-query";
|
|
2709
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2710
|
+
var ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2711
|
+
function DepositViaRelayForm({ amount, setAmount, sourceChain, setSourceChainId }) {
|
|
2712
|
+
const { chain, chainId: destinationChainId } = useEntryKitConfig();
|
|
2713
|
+
const paymaster = getPaymaster(chain);
|
|
2714
|
+
const { data: wallet } = useWalletClient();
|
|
2715
|
+
const { address: userAddress } = useAccount5();
|
|
2716
|
+
const { addDeposit } = useDeposits();
|
|
2717
|
+
const { data: relay } = useRelay();
|
|
2718
|
+
const relayClient = relay?.client;
|
|
2719
|
+
const quote = useQuery13({
|
|
2720
|
+
queryKey: ["relayBridgeQuote", sourceChain.id, amount?.toString()],
|
|
2721
|
+
queryFn: async () => {
|
|
2722
|
+
if (!relayClient) throw new Error("No Relay client found.");
|
|
2723
|
+
if (!userAddress) throw new Error("No user address found.");
|
|
2724
|
+
const result = await relayClient.actions.getQuote({
|
|
2725
|
+
chainId: sourceChain.id,
|
|
2726
|
+
toChainId: destinationChainId,
|
|
2727
|
+
currency: ETH_ADDRESS,
|
|
2728
|
+
toCurrency: ETH_ADDRESS,
|
|
2729
|
+
amount: amount?.toString(),
|
|
2730
|
+
tradeType: "EXACT_OUTPUT",
|
|
2731
|
+
recipient: paymaster?.address,
|
|
2732
|
+
wallet,
|
|
2733
|
+
txs: [
|
|
2734
|
+
{
|
|
2735
|
+
to: paymaster?.address,
|
|
2736
|
+
data: encodeFunctionData3({
|
|
2737
|
+
abi: paymasterAbi,
|
|
2738
|
+
functionName: "depositTo",
|
|
2739
|
+
args: [userAddress]
|
|
2740
|
+
}),
|
|
2741
|
+
value: amount?.toString()
|
|
2742
|
+
}
|
|
2743
|
+
]
|
|
2744
|
+
});
|
|
2745
|
+
if (!result) {
|
|
2746
|
+
throw new Error("Failed to get relay quote");
|
|
2747
|
+
}
|
|
2748
|
+
return result;
|
|
2749
|
+
},
|
|
2750
|
+
retry: 1,
|
|
2751
|
+
refetchInterval: 15e3,
|
|
2752
|
+
enabled: !!amount && !!userAddress && !!relayClient
|
|
2753
|
+
});
|
|
2754
|
+
const deposit = useMutation5({
|
|
2755
|
+
mutationKey: ["depositViaRelay", sourceChain.id, amount?.toString()],
|
|
2756
|
+
mutationFn: async ({ quote: quote2, amount: amount2 }) => {
|
|
2757
|
+
if (!relayClient) throw new Error("No Relay client found.");
|
|
2758
|
+
if (!wallet) throw new Error("No wallet found.");
|
|
2759
|
+
try {
|
|
2760
|
+
return new Promise((resolve) => {
|
|
2761
|
+
const pendingDeposit = relayClient.actions.execute({
|
|
2762
|
+
quote: quote2,
|
|
2763
|
+
wallet,
|
|
2764
|
+
onProgress(progress) {
|
|
2765
|
+
const currentStep = progress.currentStep;
|
|
2766
|
+
const requestId = currentStep?.requestId;
|
|
2767
|
+
const currentState = currentStep?.items[0]?.progressState;
|
|
2768
|
+
if (requestId && currentState === "validating") {
|
|
2769
|
+
addDeposit({
|
|
2770
|
+
type: "relay",
|
|
2771
|
+
requestId,
|
|
2772
|
+
amount: amount2,
|
|
2773
|
+
chainL1Id: sourceChain.id,
|
|
2774
|
+
chainL2Id: destinationChainId,
|
|
2775
|
+
start: /* @__PURE__ */ new Date(),
|
|
2776
|
+
estimatedTime: 1e3 * 30,
|
|
2777
|
+
depositPromise: pendingDeposit,
|
|
2778
|
+
isComplete: pendingDeposit.then(() => void 0)
|
|
2779
|
+
});
|
|
2780
|
+
resolve(void 0);
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
});
|
|
2784
|
+
});
|
|
2785
|
+
} catch (error2) {
|
|
2786
|
+
console.error("Error while depositing via Relay", error2);
|
|
2787
|
+
throw error2;
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
});
|
|
2791
|
+
const fees = quote.data?.fees;
|
|
2792
|
+
const gasFee = BigInt(fees?.gas?.amount ?? 0);
|
|
2793
|
+
const relayerFee = BigInt(fees?.relayer?.amount ?? 0);
|
|
2794
|
+
const fee = gasFee + relayerFee;
|
|
2795
|
+
return /* @__PURE__ */ jsx31(
|
|
2796
|
+
DepositForm,
|
|
2797
|
+
{
|
|
2798
|
+
sourceChain,
|
|
2799
|
+
setSourceChainId,
|
|
2800
|
+
amount,
|
|
2801
|
+
setAmount,
|
|
2802
|
+
estimatedFee: {
|
|
2803
|
+
fee: fee != null ? BigInt(fee) : void 0,
|
|
2804
|
+
isLoading: quote.isLoading,
|
|
2805
|
+
error: quote.error instanceof Error ? quote.error : void 0
|
|
2806
|
+
},
|
|
2807
|
+
estimatedTime: "A few seconds",
|
|
2808
|
+
onSubmit: async () => {
|
|
2809
|
+
if (!quote.data || !amount) return;
|
|
2810
|
+
await deposit.mutateAsync({ quote: quote.data, amount });
|
|
2811
|
+
},
|
|
2812
|
+
submitButton: /* @__PURE__ */ jsx31(
|
|
2813
|
+
SubmitButton,
|
|
2814
|
+
{
|
|
2815
|
+
variant: "primary",
|
|
2816
|
+
amount,
|
|
2817
|
+
chainId: sourceChain.id,
|
|
2818
|
+
disabled: quote.isError || !amount,
|
|
2819
|
+
pending: deposit.isPending,
|
|
2820
|
+
children: "Deposit"
|
|
2821
|
+
}
|
|
2822
|
+
)
|
|
2823
|
+
}
|
|
2824
|
+
);
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
// src/onboarding/deposit/Deposits.tsx
|
|
2828
|
+
import { useEffect as useEffect13 } from "react";
|
|
2829
|
+
import { useQuery as useQuery16, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
2830
|
+
|
|
2831
|
+
// src/onboarding/deposit/TransferDepositStatus.tsx
|
|
2832
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
2833
|
+
|
|
2834
|
+
// src/onboarding/deposit/DepositStatus.tsx
|
|
2835
|
+
import { useEffect as useEffect12, useState as useState3 } from "react";
|
|
2836
|
+
import { twMerge as twMerge16 } from "tailwind-merge";
|
|
2837
|
+
|
|
2046
2838
|
// src/icons/CloseIcon.tsx
|
|
2047
|
-
import { jsx as
|
|
2839
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2048
2840
|
function CloseIcon(props) {
|
|
2049
|
-
return /* @__PURE__ */
|
|
2841
|
+
return /* @__PURE__ */ jsx32(IconSVG, { strokeWidth: "2", stroke: "currentColor", ...props, children: /* @__PURE__ */ jsx32(
|
|
2050
2842
|
"path",
|
|
2051
2843
|
{
|
|
2052
2844
|
d: "M6 18L18 6M6 6L18 18",
|
|
@@ -2059,52 +2851,583 @@ function CloseIcon(props) {
|
|
|
2059
2851
|
) });
|
|
2060
2852
|
}
|
|
2061
2853
|
|
|
2854
|
+
// src/onboarding/deposit/DepositStatus.tsx
|
|
2855
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2856
|
+
function DepositStatus({ status, progress, children, onDismiss }) {
|
|
2857
|
+
const [appear, setAppear] = useState3(false);
|
|
2858
|
+
useEffect12(() => {
|
|
2859
|
+
setAppear(true);
|
|
2860
|
+
}, []);
|
|
2861
|
+
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: [
|
|
2862
|
+
/* @__PURE__ */ jsxs19("div", { className: "py-1 text-sm flex items-center gap-2", children: [
|
|
2863
|
+
/* @__PURE__ */ jsx33("div", { className: "flex-grow", children }),
|
|
2864
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex-shrink-0 grid", children: [
|
|
2865
|
+
/* @__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" }) }),
|
|
2866
|
+
/* @__PURE__ */ jsx33(
|
|
2867
|
+
"button",
|
|
2868
|
+
{
|
|
2869
|
+
type: "button",
|
|
2870
|
+
className: twMerge16(
|
|
2871
|
+
"col-start-1 row-start-1 flex items-center justify-center transition",
|
|
2872
|
+
"opacity-0 pointer-events-none",
|
|
2873
|
+
"group-hover:opacity-100 group-hover:pointer-events-auto",
|
|
2874
|
+
"text-neutral-500 hover:text-white"
|
|
2875
|
+
),
|
|
2876
|
+
title: "Dismiss",
|
|
2877
|
+
onClick: onDismiss,
|
|
2878
|
+
children: /* @__PURE__ */ jsx33(CloseIcon, {})
|
|
2879
|
+
}
|
|
2880
|
+
)
|
|
2881
|
+
] })
|
|
2882
|
+
] }),
|
|
2883
|
+
/* @__PURE__ */ jsx33("div", { className: "w-full h-[2px] -mt-full overflow-clip", children: /* @__PURE__ */ jsx33(
|
|
2884
|
+
"div",
|
|
2885
|
+
{
|
|
2886
|
+
className: twMerge16(
|
|
2887
|
+
"w-full h-full transition ease-linear",
|
|
2888
|
+
status === "success" ? "bg-green-600" : status === "error" ? "bg-red-600" : "bg-blue-600",
|
|
2889
|
+
status === "pending" ? "opacity-100" : "opacity-0"
|
|
2890
|
+
),
|
|
2891
|
+
style: status === "pending" ? {
|
|
2892
|
+
transform: appear ? `translateX(0)` : "translate(-100%)",
|
|
2893
|
+
transitionDuration: `${progress.duration}ms`,
|
|
2894
|
+
transitionDelay: `-${Math.min(progress.duration, progress.elapsed)}ms`
|
|
2895
|
+
} : void 0
|
|
2896
|
+
}
|
|
2897
|
+
) })
|
|
2898
|
+
] });
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
// src/onboarding/deposit/TransferDepositStatus.tsx
|
|
2902
|
+
import { useChains as useChains2 } from "wagmi";
|
|
2903
|
+
import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2904
|
+
function TransferDepositStatus({
|
|
2905
|
+
amount,
|
|
2906
|
+
chainL1Id,
|
|
2907
|
+
hash,
|
|
2908
|
+
receipt: receiptPromise,
|
|
2909
|
+
start,
|
|
2910
|
+
estimatedTime,
|
|
2911
|
+
onDismiss
|
|
2912
|
+
}) {
|
|
2913
|
+
const chains = useChains2();
|
|
2914
|
+
const chain = chains.find((chain2) => chain2.id === chainL1Id);
|
|
2915
|
+
const receipt = useQuery14({
|
|
2916
|
+
queryKey: ["transferDepositStatus", hash],
|
|
2917
|
+
queryFn: () => receiptPromise
|
|
2918
|
+
});
|
|
2919
|
+
return /* @__PURE__ */ jsx34(
|
|
2920
|
+
DepositStatus,
|
|
2921
|
+
{
|
|
2922
|
+
status: receipt.status,
|
|
2923
|
+
progress: {
|
|
2924
|
+
duration: estimatedTime,
|
|
2925
|
+
elapsed: Math.min(estimatedTime, Date.now() - start.getTime())
|
|
2926
|
+
},
|
|
2927
|
+
onDismiss,
|
|
2928
|
+
children: (() => {
|
|
2929
|
+
const blockExplorer = chain.blockExplorers?.default.url;
|
|
2930
|
+
if (receipt.status === "pending") {
|
|
2931
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2932
|
+
"Confirming deposit on",
|
|
2933
|
+
" ",
|
|
2934
|
+
/* @__PURE__ */ jsx34(
|
|
2935
|
+
"a",
|
|
2936
|
+
{
|
|
2937
|
+
href: blockExplorer ? `${blockExplorer}/tx/${hash}` : void 0,
|
|
2938
|
+
target: "_blank",
|
|
2939
|
+
rel: "noreferrer noopener",
|
|
2940
|
+
children: chain.name
|
|
2941
|
+
}
|
|
2942
|
+
),
|
|
2943
|
+
"\u2026"
|
|
2944
|
+
] });
|
|
2945
|
+
}
|
|
2946
|
+
if (receipt.status === "error") {
|
|
2947
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2948
|
+
"Could not find deposit on",
|
|
2949
|
+
" ",
|
|
2950
|
+
/* @__PURE__ */ jsx34(
|
|
2951
|
+
"a",
|
|
2952
|
+
{
|
|
2953
|
+
href: blockExplorer ? `${blockExplorer}/tx/${hash}` : void 0,
|
|
2954
|
+
target: "_blank",
|
|
2955
|
+
rel: "noreferrer noopener",
|
|
2956
|
+
children: chain.name
|
|
2957
|
+
}
|
|
2958
|
+
),
|
|
2959
|
+
"."
|
|
2960
|
+
] });
|
|
2961
|
+
}
|
|
2962
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2963
|
+
"Successfully",
|
|
2964
|
+
" ",
|
|
2965
|
+
/* @__PURE__ */ jsx34(
|
|
2966
|
+
"a",
|
|
2967
|
+
{
|
|
2968
|
+
href: blockExplorer ? `${blockExplorer}/tx/${receipt.data.transactionHash}` : void 0,
|
|
2969
|
+
target: "_blank",
|
|
2970
|
+
rel: "noreferrer noopener",
|
|
2971
|
+
children: "deposited"
|
|
2972
|
+
}
|
|
2973
|
+
),
|
|
2974
|
+
" ",
|
|
2975
|
+
/* @__PURE__ */ jsx34(Balance, { wei: amount })
|
|
2976
|
+
] });
|
|
2977
|
+
})()
|
|
2978
|
+
}
|
|
2979
|
+
);
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
// src/onboarding/deposit/RelayDepositStatus.tsx
|
|
2983
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
2984
|
+
import { useChains as useChains3 } from "wagmi";
|
|
2985
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2986
|
+
function RelayDepositStatus({
|
|
2987
|
+
amount,
|
|
2988
|
+
chainL1Id,
|
|
2989
|
+
chainL2Id,
|
|
2990
|
+
start,
|
|
2991
|
+
estimatedTime,
|
|
2992
|
+
depositPromise,
|
|
2993
|
+
onDismiss
|
|
2994
|
+
}) {
|
|
2995
|
+
const chains = useChains3();
|
|
2996
|
+
const chainL1 = chains.find((chain) => chain.id === chainL1Id);
|
|
2997
|
+
const chainL2 = chains.find((chain) => chain.id === chainL2Id);
|
|
2998
|
+
const deposit = useQuery15({
|
|
2999
|
+
queryKey: ["relayDepositPromise", chainL1Id, chainL2Id, amount.toString(), start.toISOString()],
|
|
3000
|
+
queryFn: () => depositPromise
|
|
3001
|
+
});
|
|
3002
|
+
return /* @__PURE__ */ jsx35(
|
|
3003
|
+
DepositStatus,
|
|
3004
|
+
{
|
|
3005
|
+
status: deposit.status,
|
|
3006
|
+
progress: {
|
|
3007
|
+
duration: estimatedTime,
|
|
3008
|
+
elapsed: Math.min(estimatedTime, Date.now() - start.getTime())
|
|
3009
|
+
},
|
|
3010
|
+
onDismiss,
|
|
3011
|
+
children: (() => {
|
|
3012
|
+
if (deposit.status === "pending") {
|
|
3013
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3014
|
+
"Relay bridge deposit pending on ",
|
|
3015
|
+
chainL1.name,
|
|
3016
|
+
"\u2026"
|
|
3017
|
+
] });
|
|
3018
|
+
}
|
|
3019
|
+
if (deposit.status === "error") {
|
|
3020
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3021
|
+
"Relay bridge deposit to ",
|
|
3022
|
+
chainL2.name,
|
|
3023
|
+
" failed."
|
|
3024
|
+
] });
|
|
3025
|
+
}
|
|
3026
|
+
return /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3027
|
+
"Successfully bridged ",
|
|
3028
|
+
/* @__PURE__ */ jsx35(Balance, { wei: amount }),
|
|
3029
|
+
" to ",
|
|
3030
|
+
chainL2.name,
|
|
3031
|
+
"!"
|
|
3032
|
+
] });
|
|
3033
|
+
})()
|
|
3034
|
+
}
|
|
3035
|
+
);
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
// src/onboarding/deposit/Deposits.tsx
|
|
3039
|
+
import { useAccount as useAccount6, useClient as useClient11 } from "wagmi";
|
|
3040
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3041
|
+
function Deposits() {
|
|
3042
|
+
const queryClient = useQueryClient7();
|
|
3043
|
+
const { chainId } = useEntryKitConfig();
|
|
3044
|
+
const client = useClient11({ chainId });
|
|
3045
|
+
const { address: userAddress } = useAccount6();
|
|
3046
|
+
const { deposits, removeDeposit } = useDeposits();
|
|
3047
|
+
const { data: isComplete } = useQuery16({
|
|
3048
|
+
queryKey: ["depositsComplete", deposits.map((deposit) => deposit.uid)],
|
|
3049
|
+
queryFn: async () => {
|
|
3050
|
+
if (!deposits.length) return false;
|
|
3051
|
+
await Promise.all(deposits.map((deposit) => deposit.isComplete));
|
|
3052
|
+
return true;
|
|
3053
|
+
}
|
|
3054
|
+
});
|
|
3055
|
+
useEffect13(() => {
|
|
3056
|
+
if (isComplete) {
|
|
3057
|
+
queryClient.invalidateQueries({ queryKey: ["balance"] });
|
|
3058
|
+
queryClient.invalidateQueries({ queryKey: ["getBalance", client?.uid, userAddress] });
|
|
3059
|
+
}
|
|
3060
|
+
}, [client?.uid, isComplete, queryClient, userAddress]);
|
|
3061
|
+
if (!deposits.length) return null;
|
|
3062
|
+
return /* @__PURE__ */ jsx36("div", { className: "flex flex-col gap-1 mt-4", children: deposits.map((deposit) => {
|
|
3063
|
+
if (deposit.type === "transfer") {
|
|
3064
|
+
return /* @__PURE__ */ jsx36(TransferDepositStatus, { ...deposit, onDismiss: () => removeDeposit(deposit.uid) }, deposit.uid);
|
|
3065
|
+
} else if (deposit.type === "relay") {
|
|
3066
|
+
return /* @__PURE__ */ jsx36(RelayDepositStatus, { ...deposit, onDismiss: () => removeDeposit(deposit.uid) }, deposit.uid);
|
|
3067
|
+
}
|
|
3068
|
+
}) });
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
// src/onboarding/deposit/DepositFormContainer.tsx
|
|
3072
|
+
import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3073
|
+
function DepositFormContainer() {
|
|
3074
|
+
const { chainId: destinationChainId } = useEntryKitConfig();
|
|
3075
|
+
const chainId = useChainId();
|
|
3076
|
+
const chains = useChains4();
|
|
3077
|
+
const [amount, setAmount] = useState4(void 0);
|
|
3078
|
+
const [sourceChainId, setSourceChainId] = useState4(chainId);
|
|
3079
|
+
const sourceChain = chains.find(({ id }) => id === sourceChainId);
|
|
3080
|
+
return /* @__PURE__ */ jsxs22("div", { className: "pt-10 pb-2", children: [
|
|
3081
|
+
destinationChainId === sourceChainId ? /* @__PURE__ */ jsx37(
|
|
3082
|
+
DepositViaTransferForm,
|
|
3083
|
+
{
|
|
3084
|
+
amount,
|
|
3085
|
+
setAmount,
|
|
3086
|
+
sourceChain,
|
|
3087
|
+
setSourceChainId
|
|
3088
|
+
}
|
|
3089
|
+
) : /* @__PURE__ */ jsx37(
|
|
3090
|
+
DepositViaRelayForm,
|
|
3091
|
+
{
|
|
3092
|
+
amount,
|
|
3093
|
+
setAmount,
|
|
3094
|
+
sourceChain,
|
|
3095
|
+
setSourceChainId
|
|
3096
|
+
}
|
|
3097
|
+
),
|
|
3098
|
+
/* @__PURE__ */ jsx37(Deposits, {})
|
|
3099
|
+
] });
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
// src/icons/ArrowLeftIcon.tsx
|
|
3103
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3104
|
+
function ArrowLeftIcon(props) {
|
|
3105
|
+
return /* @__PURE__ */ jsx38(IconSVG, { ...props, children: /* @__PURE__ */ jsx38(
|
|
3106
|
+
"path",
|
|
3107
|
+
{
|
|
3108
|
+
d: "M19 12H5M12 19l-7-7 7-7",
|
|
3109
|
+
fill: "none",
|
|
3110
|
+
stroke: "currentColor",
|
|
3111
|
+
strokeWidth: "2",
|
|
3112
|
+
strokeLinecap: "round",
|
|
3113
|
+
strokeLinejoin: "round"
|
|
3114
|
+
}
|
|
3115
|
+
) });
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
// src/onboarding/quarry/WithdrawGasBalanceButton.tsx
|
|
3119
|
+
import { getAction as getAction6 } from "viem/utils";
|
|
3120
|
+
import { waitForTransactionReceipt as waitForTransactionReceipt3 } from "viem/actions";
|
|
3121
|
+
import { useAccount as useAccount7, useClient as useClient12, useSwitchChain as useSwitchChain3, useWriteContract as useWriteContract2 } from "wagmi";
|
|
3122
|
+
import { twMerge as twMerge17 } from "tailwind-merge";
|
|
3123
|
+
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
3124
|
+
import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
3125
|
+
import { jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3126
|
+
function WithdrawGasBalanceButton({ userAddress }) {
|
|
3127
|
+
const { writeContractAsync } = useWriteContract2();
|
|
3128
|
+
const { switchChain } = useSwitchChain3();
|
|
3129
|
+
const { chain, chainId } = useEntryKitConfig();
|
|
3130
|
+
const { chainId: userChainId } = useAccount7();
|
|
3131
|
+
const queryClient = useQueryClient8();
|
|
3132
|
+
const client = useClient12({ chainId });
|
|
3133
|
+
const paymaster = getPaymaster(chain);
|
|
3134
|
+
const balance = useShowQueryError(useBalance(userAddress));
|
|
3135
|
+
const shouldSwitchChain = chainId != null && chainId !== userChainId;
|
|
3136
|
+
const withdraw = useMutation6({
|
|
3137
|
+
mutationKey: ["withdraw", userAddress],
|
|
3138
|
+
mutationFn: async () => {
|
|
3139
|
+
if (!client) throw new Error("Client not ready.");
|
|
3140
|
+
if (!paymaster) throw new Error("Paymaster not found");
|
|
3141
|
+
if (!balance.data) throw new Error("No gas balance to withdraw.");
|
|
3142
|
+
try {
|
|
3143
|
+
const hash = await writeContractAsync({
|
|
3144
|
+
address: paymaster.address,
|
|
3145
|
+
abi: paymasterAbi,
|
|
3146
|
+
functionName: "withdrawTo",
|
|
3147
|
+
args: [userAddress, balance.data],
|
|
3148
|
+
chainId
|
|
3149
|
+
});
|
|
3150
|
+
await getAction6(client, waitForTransactionReceipt3, "waitForTransactionReceipt")({ hash });
|
|
3151
|
+
await Promise.all([
|
|
3152
|
+
queryClient.invalidateQueries({ queryKey: ["balance"] }),
|
|
3153
|
+
queryClient.invalidateQueries({ queryKey: ["getPrerequisites"] })
|
|
3154
|
+
]);
|
|
3155
|
+
} catch (error2) {
|
|
3156
|
+
console.error("Error while withdrawing", error2);
|
|
3157
|
+
throw error2;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
});
|
|
3161
|
+
if (balance.data == null || balance.data === 0n) {
|
|
3162
|
+
return null;
|
|
3163
|
+
}
|
|
3164
|
+
return /* @__PURE__ */ jsx39(
|
|
3165
|
+
"button",
|
|
3166
|
+
{
|
|
3167
|
+
onClick: () => {
|
|
3168
|
+
if (shouldSwitchChain) {
|
|
3169
|
+
return switchChain({ chainId });
|
|
3170
|
+
}
|
|
3171
|
+
withdraw.mutate();
|
|
3172
|
+
},
|
|
3173
|
+
className: twMerge17(
|
|
3174
|
+
"text-sm font-medium text-white/50 group whitespace-nowrap",
|
|
3175
|
+
withdraw.isPending ? "opacity-50 pointer-events-none" : "cursor-pointer hover:text-white"
|
|
3176
|
+
),
|
|
3177
|
+
disabled: withdraw.isPending,
|
|
3178
|
+
children: /* @__PURE__ */ jsxs23("span", { className: "inline-block", children: [
|
|
3179
|
+
/* @__PURE__ */ jsxs23(
|
|
3180
|
+
"span",
|
|
3181
|
+
{
|
|
3182
|
+
className: twMerge17(
|
|
3183
|
+
"inline-flex items-center gap-1 underline decoration-neutral-500 underline-offset-4",
|
|
3184
|
+
!withdraw.isPending && "hover:decoration-orange-500",
|
|
3185
|
+
shouldSwitchChain && "group-hover:hidden"
|
|
3186
|
+
),
|
|
3187
|
+
children: [
|
|
3188
|
+
withdraw.isPending && /* @__PURE__ */ jsx39(PendingIcon, { className: "w-3 h-3" }),
|
|
3189
|
+
"Withdraw"
|
|
3190
|
+
]
|
|
3191
|
+
}
|
|
3192
|
+
),
|
|
3193
|
+
shouldSwitchChain && /* @__PURE__ */ jsx39("span", { className: "hidden group-hover:inline-block underline decoration-neutral-500 underline-offset-4 hover:decoration-orange-500", children: "Switch chain" })
|
|
3194
|
+
] })
|
|
3195
|
+
}
|
|
3196
|
+
);
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
// src/onboarding/quarry/GasBalance.tsx
|
|
3200
|
+
import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3201
|
+
function GasBalance2({ isActive, isExpanded, isFocused, setFocused, userAddress }) {
|
|
3202
|
+
const queryClient = useQueryClient9();
|
|
3203
|
+
const balance = useShowQueryError(useBalance(userAddress));
|
|
3204
|
+
const prevBalance = usePrevious(balance.data || 0n);
|
|
3205
|
+
useEffect14(() => {
|
|
3206
|
+
if (balance.data != null && prevBalance === 0n && balance.data > 0n) {
|
|
3207
|
+
queryClient.invalidateQueries({ queryKey: ["getPrerequisites"] });
|
|
3208
|
+
setFocused(false);
|
|
3209
|
+
}
|
|
3210
|
+
}, [balance.data, prevBalance, setFocused, queryClient, userAddress]);
|
|
3211
|
+
if (isFocused) {
|
|
3212
|
+
return /* @__PURE__ */ jsxs24("div", { children: [
|
|
3213
|
+
isFocused && /* @__PURE__ */ jsx40("div", { className: "absolute top-0 left-0", children: /* @__PURE__ */ jsx40(
|
|
3214
|
+
"div",
|
|
3215
|
+
{
|
|
3216
|
+
className: "flex items-center justify-center w-10 h-10 text-white/20 hover:text-white/40 cursor-pointer",
|
|
3217
|
+
onClick: () => setFocused(false),
|
|
3218
|
+
children: /* @__PURE__ */ jsx40(ArrowLeftIcon, { className: "m-0" })
|
|
3219
|
+
}
|
|
3220
|
+
) }),
|
|
3221
|
+
/* @__PURE__ */ jsx40(DepositFormContainer, {})
|
|
3222
|
+
] });
|
|
3223
|
+
}
|
|
3224
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4", children: [
|
|
3225
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex justify-between gap-4", children: [
|
|
3226
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
3227
|
+
/* @__PURE__ */ jsx40("div", { children: "Gas balance" }),
|
|
3228
|
+
/* @__PURE__ */ jsx40("div", { className: "font-mono text-white", children: balance.data != null ? /* @__PURE__ */ jsx40(Balance, { wei: balance.data }) : /* @__PURE__ */ jsx40(PendingIcon, { className: "text-sm" }) })
|
|
3229
|
+
] }),
|
|
3230
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1 justify-center items-center", children: [
|
|
3231
|
+
/* @__PURE__ */ jsx40(
|
|
3232
|
+
Button,
|
|
3233
|
+
{
|
|
3234
|
+
variant: isActive ? "primary" : "tertiary",
|
|
3235
|
+
className: "flex-shrink-0 text-sm p-1 w-28",
|
|
3236
|
+
autoFocus: isActive || isExpanded,
|
|
3237
|
+
pending: balance.status === "pending",
|
|
3238
|
+
onClick: () => setFocused(true),
|
|
3239
|
+
children: "Top up"
|
|
3240
|
+
}
|
|
3241
|
+
),
|
|
3242
|
+
/* @__PURE__ */ jsx40(WithdrawGasBalanceButton, { userAddress })
|
|
3243
|
+
] })
|
|
3244
|
+
] }),
|
|
3245
|
+
isExpanded ? /* @__PURE__ */ jsx40("p", { className: "text-sm", children: "Your gas balance is used to pay for onchain computation." }) : null
|
|
3246
|
+
] });
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
// src/onboarding/ConnectedSteps.tsx
|
|
3250
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3251
|
+
function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
3252
|
+
const { chain } = useEntryKitConfig();
|
|
3253
|
+
const paymaster = getPaymaster(chain);
|
|
3254
|
+
const [focusedId, setFocusedId] = useState5(null);
|
|
3255
|
+
const userAddress = userClient.account.address;
|
|
3256
|
+
const { data: prerequisites, error: prerequisitesError } = usePrerequisites(userAddress);
|
|
3257
|
+
useEffect15(() => {
|
|
3258
|
+
if (prerequisitesError) {
|
|
3259
|
+
console.error("Could not get prerequisites", prerequisitesError);
|
|
3260
|
+
}
|
|
3261
|
+
}, [prerequisitesError]);
|
|
3262
|
+
const { closeAccountModal } = useAccountModal();
|
|
3263
|
+
const isNewConnection = userAddress !== initialUserAddress;
|
|
3264
|
+
const initialPrerequisites = useRef5(prerequisites);
|
|
3265
|
+
useEffect15(() => {
|
|
3266
|
+
if (prerequisites == null) return;
|
|
3267
|
+
if (initialPrerequisites.current == null) {
|
|
3268
|
+
initialPrerequisites.current = prerequisites;
|
|
3269
|
+
}
|
|
3270
|
+
if (prerequisites.complete) {
|
|
3271
|
+
if (isNewConnection || !initialPrerequisites.current.complete) {
|
|
3272
|
+
closeAccountModal();
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
}, [closeAccountModal, isNewConnection, prerequisites]);
|
|
3276
|
+
const { sessionAddress, hasAllowance, isSpender, hasDelegation, hasGasBalance, hasQuarryGasBalance } = prerequisites ?? {};
|
|
3277
|
+
const steps = useMemo4(() => {
|
|
3278
|
+
if (!userAddress) {
|
|
3279
|
+
return [
|
|
3280
|
+
{
|
|
3281
|
+
id: "wallet",
|
|
3282
|
+
isComplete: false,
|
|
3283
|
+
content: () => null
|
|
3284
|
+
}
|
|
3285
|
+
];
|
|
3286
|
+
}
|
|
3287
|
+
const steps2 = [
|
|
3288
|
+
{
|
|
3289
|
+
id: "wallet",
|
|
3290
|
+
isComplete: true,
|
|
3291
|
+
content: (props) => /* @__PURE__ */ jsx41(Wallet, { ...props, userAddress })
|
|
3292
|
+
}
|
|
3293
|
+
];
|
|
3294
|
+
if (!paymaster) {
|
|
3295
|
+
if (sessionAddress != null) {
|
|
3296
|
+
steps2.push({
|
|
3297
|
+
id: "gasBalance",
|
|
3298
|
+
isComplete: !!hasGasBalance,
|
|
3299
|
+
content: (props) => /* @__PURE__ */ jsx41(GasBalance, { ...props, sessionAddress })
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3302
|
+
} else if (paymaster.type === "quarry") {
|
|
3303
|
+
if (paymaster.isGasPass) {
|
|
3304
|
+
steps2.push({
|
|
3305
|
+
id: "allowance",
|
|
3306
|
+
isComplete: !!hasAllowance,
|
|
3307
|
+
content: (props) => /* @__PURE__ */ jsx41(Allowance, { ...props, userAddress })
|
|
3308
|
+
});
|
|
3309
|
+
} else {
|
|
3310
|
+
steps2.push({
|
|
3311
|
+
id: "gasBalanceQuarry",
|
|
3312
|
+
isComplete: !!hasQuarryGasBalance,
|
|
3313
|
+
content: (props) => /* @__PURE__ */ jsx41(GasBalance2, { ...props, userAddress })
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
steps2.push({
|
|
3318
|
+
id: "session",
|
|
3319
|
+
isComplete: !!isSpender && !!hasDelegation,
|
|
3320
|
+
content: (props) => /* @__PURE__ */ jsx41(Session, { ...props, userClient, registerSpender: !isSpender, registerDelegation: !hasDelegation })
|
|
3321
|
+
});
|
|
3322
|
+
return steps2;
|
|
3323
|
+
}, [
|
|
3324
|
+
hasAllowance,
|
|
3325
|
+
hasDelegation,
|
|
3326
|
+
hasGasBalance,
|
|
3327
|
+
hasQuarryGasBalance,
|
|
3328
|
+
isSpender,
|
|
3329
|
+
paymaster,
|
|
3330
|
+
sessionAddress,
|
|
3331
|
+
userAddress,
|
|
3332
|
+
userClient
|
|
3333
|
+
]);
|
|
3334
|
+
const [selectedStepId] = useState5(null);
|
|
3335
|
+
const nextStep = steps.find((step) => step.content != null && !step.isComplete);
|
|
3336
|
+
const completedSteps = steps.filter((step) => step.isComplete);
|
|
3337
|
+
const activeStep = (selectedStepId != null ? steps.find((step) => step.id === selectedStepId) : null) ?? nextStep ?? (completedSteps.length < steps.length ? completedSteps.at(-1) : null);
|
|
3338
|
+
const activeStepIndex = activeStep ? steps.indexOf(activeStep) : -1;
|
|
3339
|
+
return /* @__PURE__ */ jsx41(
|
|
3340
|
+
"div",
|
|
3341
|
+
{
|
|
3342
|
+
className: twMerge18(
|
|
3343
|
+
"px-8 flex flex-col",
|
|
3344
|
+
"divide-y divide-neutral-800",
|
|
3345
|
+
"animate-in animate-duration-300 fade-in slide-in-from-bottom-8"
|
|
3346
|
+
),
|
|
3347
|
+
children: steps.map((step, i) => {
|
|
3348
|
+
const isActive = step === activeStep;
|
|
3349
|
+
const isExpanded = isActive || completedSteps.length === steps.length;
|
|
3350
|
+
const isDisabled = !step.isComplete && activeStepIndex !== -1 && i > activeStepIndex;
|
|
3351
|
+
const isFocused = focusedId === step.id;
|
|
3352
|
+
const content = step.content({
|
|
3353
|
+
isActive,
|
|
3354
|
+
isExpanded,
|
|
3355
|
+
isFocused,
|
|
3356
|
+
setFocused: (focused) => setFocusedId(focused ? step.id : null)
|
|
3357
|
+
});
|
|
3358
|
+
if (focusedId) {
|
|
3359
|
+
if (step.id === focusedId) {
|
|
3360
|
+
return content;
|
|
3361
|
+
}
|
|
3362
|
+
return null;
|
|
3363
|
+
}
|
|
3364
|
+
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);
|
|
3365
|
+
})
|
|
3366
|
+
}
|
|
3367
|
+
);
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
// src/AccountModalContent.tsx
|
|
3371
|
+
import { useRef as useRef6 } from "react";
|
|
3372
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
3373
|
+
function AccountModalContent() {
|
|
3374
|
+
const { chainId } = useEntryKitConfig();
|
|
3375
|
+
const userClient = useConnectorClient({ chainId });
|
|
3376
|
+
const { address: userAddress } = useAccount8();
|
|
3377
|
+
const initialUserAddress = useRef6(userAddress);
|
|
3378
|
+
if (userClient.status !== "success") {
|
|
3379
|
+
return /* @__PURE__ */ jsx42(ConnectWallet, {});
|
|
3380
|
+
}
|
|
3381
|
+
return /* @__PURE__ */ jsx42(ConnectedSteps, { userClient: userClient.data, initialUserAddress: initialUserAddress.current });
|
|
3382
|
+
}
|
|
3383
|
+
|
|
2062
3384
|
// src/AccountModal.tsx
|
|
3385
|
+
import { DialogClose } from "@radix-ui/react-dialog";
|
|
2063
3386
|
import { ErrorBoundary } from "react-error-boundary";
|
|
2064
3387
|
|
|
2065
3388
|
// src/errors/ErrorOverlay.tsx
|
|
2066
3389
|
import { wait } from "@latticexyz/common/utils";
|
|
2067
|
-
import { useEffect as
|
|
2068
|
-
import { twMerge as
|
|
2069
|
-
import { Fragment as
|
|
3390
|
+
import { useEffect as useEffect16 } from "react";
|
|
3391
|
+
import { twMerge as twMerge19 } from "tailwind-merge";
|
|
3392
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2070
3393
|
function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
2071
|
-
|
|
3394
|
+
useEffect16(() => {
|
|
2072
3395
|
if (error2) {
|
|
2073
3396
|
console.error(error2);
|
|
2074
3397
|
}
|
|
2075
3398
|
}, [error2]);
|
|
2076
|
-
return /* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
3399
|
+
return /* @__PURE__ */ jsxs25("div", { className: "pointer-events-none absolute inset-0 overflow-clip", children: [
|
|
3400
|
+
/* @__PURE__ */ jsx43(
|
|
2078
3401
|
"div",
|
|
2079
3402
|
{
|
|
2080
|
-
className:
|
|
3403
|
+
className: twMerge19(
|
|
2081
3404
|
"absolute inset-0 bg-blue-700/60",
|
|
2082
3405
|
"transition duration-300",
|
|
2083
3406
|
error2 ? "opacity-100 pointer-events-auto" : "opacity-0"
|
|
2084
3407
|
)
|
|
2085
3408
|
}
|
|
2086
3409
|
),
|
|
2087
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsx43(
|
|
2088
3411
|
"div",
|
|
2089
3412
|
{
|
|
2090
|
-
className:
|
|
3413
|
+
className: twMerge19(
|
|
2091
3414
|
"absolute inset-0 pb-8",
|
|
2092
3415
|
"transition duration-300",
|
|
2093
3416
|
error2 ? "translate-y-0 opacity-100 pointer-events-auto" : "-translate-y-4 opacity-0"
|
|
2094
3417
|
),
|
|
2095
|
-
children: error2 ? /* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
3418
|
+
children: error2 ? /* @__PURE__ */ jsx43(Fragment6, { children: /* @__PURE__ */ jsxs25("div", { className: "w-full max-h-full bg-blue-700 text-white/80 overflow-auto", children: [
|
|
3419
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-6 px-8 pt-8", children: [
|
|
3420
|
+
/* @__PURE__ */ jsx43("div", { className: "text-white text-lg font-bold", children: "Oops! It broke :(" }),
|
|
3421
|
+
/* @__PURE__ */ jsx43("div", { className: "font-mono text-xs whitespace-pre-wrap", children: error2.message.trim() }),
|
|
3422
|
+
/* @__PURE__ */ jsx43("div", { className: "text-sm", children: "See the console for more info." })
|
|
2100
3423
|
] }),
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
retry ? /* @__PURE__ */
|
|
3424
|
+
/* @__PURE__ */ jsxs25("div", { className: "pointer-events-none sticky bottom-0 left-0 -mt-2", children: [
|
|
3425
|
+
/* @__PURE__ */ jsx43("div", { className: "w-full h-12 bg-gradient-to-b from-transparent to-blue-700" }),
|
|
3426
|
+
retry ? /* @__PURE__ */ jsx43("div", { className: "bg-blue-700 text-center", children: /* @__PURE__ */ jsxs25(
|
|
2104
3427
|
"button",
|
|
2105
3428
|
{
|
|
2106
3429
|
type: "button",
|
|
2107
|
-
className:
|
|
3430
|
+
className: twMerge19(
|
|
2108
3431
|
"pointer-events-auto group w-24 p-1 -translate-y-2 transition",
|
|
2109
3432
|
"bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500",
|
|
2110
3433
|
"text-white text-sm font-medium",
|
|
@@ -2119,15 +3442,15 @@ function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
|
2119
3442
|
}
|
|
2120
3443
|
},
|
|
2121
3444
|
children: [
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx43("span", { className: "group-aria-busy:hidden", children: "Retry" }),
|
|
3446
|
+
/* @__PURE__ */ jsx43("span", { className: "hidden group-aria-busy:inline", children: "Retrying\u2026" })
|
|
2124
3447
|
]
|
|
2125
3448
|
}
|
|
2126
|
-
) }) : dismiss ? /* @__PURE__ */
|
|
3449
|
+
) }) : dismiss ? /* @__PURE__ */ jsx43("div", { className: "bg-blue-700 text-center", children: /* @__PURE__ */ jsx43(
|
|
2127
3450
|
"button",
|
|
2128
3451
|
{
|
|
2129
3452
|
type: "button",
|
|
2130
|
-
className:
|
|
3453
|
+
className: twMerge19(
|
|
2131
3454
|
"pointer-events-auto group w-24 p-1 -translate-y-2 transition",
|
|
2132
3455
|
"bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500",
|
|
2133
3456
|
"text-white text-sm font-medium",
|
|
@@ -2145,27 +3468,27 @@ function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
|
2145
3468
|
}
|
|
2146
3469
|
|
|
2147
3470
|
// src/errors/ErrorFallback.tsx
|
|
2148
|
-
import { jsx as
|
|
3471
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2149
3472
|
function ErrorFallback({ error: error2, resetErrorBoundary }) {
|
|
2150
|
-
return /* @__PURE__ */
|
|
3473
|
+
return /* @__PURE__ */ jsx44("div", { className: "h-64", children: /* @__PURE__ */ jsx44(ErrorOverlay, { error: error2, retry: resetErrorBoundary }) });
|
|
2151
3474
|
}
|
|
2152
3475
|
|
|
2153
3476
|
// src/errors/ErrorsOverlay.tsx
|
|
2154
|
-
import { useStore as
|
|
2155
|
-
import { jsx as
|
|
3477
|
+
import { useStore as useStore3 } from "zustand";
|
|
3478
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
2156
3479
|
function ErrorsOverlay() {
|
|
2157
|
-
const error2 =
|
|
2158
|
-
return /* @__PURE__ */
|
|
3480
|
+
const error2 = useStore3(store3, (state) => state.errors.at(0));
|
|
3481
|
+
return /* @__PURE__ */ jsx45(ErrorOverlay, { error: error2?.error, retry: error2?.retry, dismiss: error2?.dismiss });
|
|
2159
3482
|
}
|
|
2160
3483
|
|
|
2161
3484
|
// src/AccountModal.tsx
|
|
2162
|
-
import { jsx as
|
|
3485
|
+
import { jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2163
3486
|
function AccountModal() {
|
|
2164
3487
|
const { accountModalOpen, toggleAccountModal } = useAccountModal();
|
|
2165
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsx46(Modal, { open: accountModalOpen, onOpenChange: toggleAccountModal, children: accountModalOpen ? /* @__PURE__ */ jsxs26(
|
|
2166
3489
|
"div",
|
|
2167
3490
|
{
|
|
2168
|
-
className:
|
|
3491
|
+
className: twMerge20(
|
|
2169
3492
|
"relative py-2 ring-1",
|
|
2170
3493
|
"bg-neutral-900 text-neutral-400 ring-neutral-700/50",
|
|
2171
3494
|
"links:font-medium links:underline links:underline-offset-4",
|
|
@@ -2173,11 +3496,11 @@ function AccountModal() {
|
|
|
2173
3496
|
"links:decoration-neutral-500 hover:links:decoration-orange-500"
|
|
2174
3497
|
),
|
|
2175
3498
|
children: [
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
/* @__PURE__ */
|
|
2178
|
-
/* @__PURE__ */
|
|
3499
|
+
/* @__PURE__ */ jsxs26(ErrorBoundary, { FallbackComponent: ErrorFallback, children: [
|
|
3500
|
+
/* @__PURE__ */ jsx46(AccountModalContent, {}),
|
|
3501
|
+
/* @__PURE__ */ jsx46(ErrorsOverlay, {})
|
|
2179
3502
|
] }),
|
|
2180
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsxs26(
|
|
2181
3504
|
"a",
|
|
2182
3505
|
{
|
|
2183
3506
|
href: "https://mud.dev",
|
|
@@ -2185,20 +3508,20 @@ function AccountModal() {
|
|
|
2185
3508
|
rel: "noreferrer noopener",
|
|
2186
3509
|
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
3510
|
children: [
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__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" }) }),
|
|
3512
|
+
/* @__PURE__ */ jsx46("span", { children: "Powered by MUD" })
|
|
2190
3513
|
]
|
|
2191
3514
|
}
|
|
2192
3515
|
),
|
|
2193
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsx46("div", { className: "absolute top-0 right-0", children: /* @__PURE__ */ jsx46(
|
|
2194
3517
|
DialogClose,
|
|
2195
3518
|
{
|
|
2196
|
-
className:
|
|
3519
|
+
className: twMerge20(
|
|
2197
3520
|
"pointer-events-auto leading-none p-2 transition",
|
|
2198
3521
|
"text-white/20 hover:text-white/40"
|
|
2199
3522
|
),
|
|
2200
3523
|
title: "Close",
|
|
2201
|
-
children: /* @__PURE__ */
|
|
3524
|
+
children: /* @__PURE__ */ jsx46(CloseIcon, { className: "m-0" })
|
|
2202
3525
|
}
|
|
2203
3526
|
) })
|
|
2204
3527
|
]
|
|
@@ -2207,31 +3530,31 @@ function AccountModal() {
|
|
|
2207
3530
|
}
|
|
2208
3531
|
|
|
2209
3532
|
// src/EntryKitProvider.tsx
|
|
2210
|
-
import { jsx as
|
|
3533
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2211
3534
|
function EntryKitProvider({ config, children }) {
|
|
2212
|
-
return /* @__PURE__ */
|
|
3535
|
+
return /* @__PURE__ */ jsxs27(EntryKitConfigProvider, { config, children: [
|
|
2213
3536
|
children,
|
|
2214
|
-
/* @__PURE__ */
|
|
3537
|
+
/* @__PURE__ */ jsx47(AccountModal, {})
|
|
2215
3538
|
] });
|
|
2216
3539
|
}
|
|
2217
3540
|
|
|
2218
3541
|
// src/AccountButton.tsx
|
|
2219
|
-
import { useAccount as
|
|
2220
|
-
import { twMerge as
|
|
3542
|
+
import { useAccount as useAccount9 } from "wagmi";
|
|
3543
|
+
import { twMerge as twMerge22 } from "tailwind-merge";
|
|
2221
3544
|
|
|
2222
3545
|
// src/AccountName.tsx
|
|
2223
|
-
import { twMerge as
|
|
2224
|
-
import { Fragment as
|
|
3546
|
+
import { twMerge as twMerge21 } from "tailwind-merge";
|
|
3547
|
+
import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2225
3548
|
function AccountName({ address }) {
|
|
2226
3549
|
const { data: ens } = useENS(address);
|
|
2227
3550
|
const avatar = usePreloadImage(ens?.avatar);
|
|
2228
|
-
return /* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
3551
|
+
return /* @__PURE__ */ jsxs28(Fragment7, { children: [
|
|
3552
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center", children: [
|
|
3553
|
+
/* @__PURE__ */ jsx48(
|
|
2231
3554
|
"img",
|
|
2232
3555
|
{
|
|
2233
3556
|
src: ens?.avatar && avatar.isSuccess ? ens.avatar : void 0,
|
|
2234
|
-
className:
|
|
3557
|
+
className: twMerge21(
|
|
2235
3558
|
"col-start-1 row-start-1",
|
|
2236
3559
|
"inline-flex w-full h-full rounded-full bg-black/10 dark:bg-white/10 bg-cover bg-no-repeat bg-center",
|
|
2237
3560
|
"transtion duration-300",
|
|
@@ -2239,10 +3562,10 @@ function AccountName({ address }) {
|
|
|
2239
3562
|
)
|
|
2240
3563
|
}
|
|
2241
3564
|
),
|
|
2242
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx48(
|
|
2243
3566
|
Logo,
|
|
2244
3567
|
{
|
|
2245
|
-
className:
|
|
3568
|
+
className: twMerge21(
|
|
2246
3569
|
"col-start-1 row-start-1 text-orange-500",
|
|
2247
3570
|
"transition duration-300",
|
|
2248
3571
|
ens && (!ens.avatar || avatar.isError) ? "opacity-100" : "opacity-0"
|
|
@@ -2250,29 +3573,29 @@ function AccountName({ address }) {
|
|
|
2250
3573
|
}
|
|
2251
3574
|
)
|
|
2252
3575
|
] }),
|
|
2253
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsx48("span", { className: "flex-grow", children: ens?.name ?? /* @__PURE__ */ jsx48(TruncatedHex, { hex: address }) })
|
|
2254
3577
|
] });
|
|
2255
3578
|
}
|
|
2256
3579
|
|
|
2257
3580
|
// src/AccountButton.tsx
|
|
2258
|
-
import { useRef as
|
|
2259
|
-
import { jsx as
|
|
2260
|
-
var containerClassNames =
|
|
3581
|
+
import { useRef as useRef7 } from "react";
|
|
3582
|
+
import { jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3583
|
+
var containerClassNames = twMerge22(
|
|
2261
3584
|
"w-48 p-3 inline-flex outline-none transition",
|
|
2262
3585
|
"border border-transparent",
|
|
2263
3586
|
"text-base leading-none"
|
|
2264
3587
|
);
|
|
2265
|
-
var secondaryClassNames =
|
|
3588
|
+
var secondaryClassNames = twMerge22(
|
|
2266
3589
|
"bg-neutral-100 border-neutral-300 text-black",
|
|
2267
3590
|
"dark:bg-neutral-800 dark:border-neutral-700 dark:text-white"
|
|
2268
3591
|
);
|
|
2269
|
-
var secondaryInteractiveClassNames =
|
|
3592
|
+
var secondaryInteractiveClassNames = twMerge22(
|
|
2270
3593
|
"cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700"
|
|
2271
3594
|
);
|
|
2272
3595
|
function AccountButton() {
|
|
2273
3596
|
const { openAccountModal, accountModalOpen } = useAccountModal();
|
|
2274
|
-
const { status, address: userAddress } =
|
|
2275
|
-
const initialUserAddress =
|
|
3597
|
+
const { status, address: userAddress } = useAccount9();
|
|
3598
|
+
const initialUserAddress = useRef7(userAddress);
|
|
2276
3599
|
const prereqs = usePrerequisites(userAddress);
|
|
2277
3600
|
const isConnected = status === "connected" || status === "reconnecting" && userAddress;
|
|
2278
3601
|
const isNewConnection = userAddress !== initialUserAddress.current;
|
|
@@ -2284,20 +3607,20 @@ function AccountButton() {
|
|
|
2284
3607
|
}
|
|
2285
3608
|
return "Sign in";
|
|
2286
3609
|
})();
|
|
2287
|
-
return /* @__PURE__ */
|
|
3610
|
+
return /* @__PURE__ */ jsx49(Shadow, { mode: "child", children: isSignedIn ? /* @__PURE__ */ jsx49(
|
|
2288
3611
|
"button",
|
|
2289
3612
|
{
|
|
2290
3613
|
type: "button",
|
|
2291
|
-
className:
|
|
3614
|
+
className: twMerge22(containerClassNames, secondaryClassNames, secondaryInteractiveClassNames),
|
|
2292
3615
|
onClick: openAccountModal,
|
|
2293
|
-
children: /* @__PURE__ */
|
|
3616
|
+
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
3617
|
},
|
|
2295
3618
|
"connected"
|
|
2296
|
-
) : /* @__PURE__ */
|
|
3619
|
+
) : /* @__PURE__ */ jsxs29(
|
|
2297
3620
|
"button",
|
|
2298
3621
|
{
|
|
2299
3622
|
type: "button",
|
|
2300
|
-
className:
|
|
3623
|
+
className: twMerge22(
|
|
2301
3624
|
containerClassNames,
|
|
2302
3625
|
"group",
|
|
2303
3626
|
"items-center justify-center gap-2.5",
|
|
@@ -2305,35 +3628,35 @@ function AccountButton() {
|
|
|
2305
3628
|
"hover:bg-orange-400",
|
|
2306
3629
|
"active:bg-orange-600"
|
|
2307
3630
|
),
|
|
2308
|
-
"aria-busy": accountModalOpen,
|
|
3631
|
+
"aria-busy": accountModalOpen || prereqs.isPending,
|
|
2309
3632
|
onClick: openAccountModal,
|
|
2310
3633
|
children: [
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsxs29("span", { className: "pointer-events-none inline-grid place-items-center -ml-3", children: [
|
|
3635
|
+
/* @__PURE__ */ jsx49(
|
|
2313
3636
|
"span",
|
|
2314
3637
|
{
|
|
2315
|
-
className:
|
|
3638
|
+
className: twMerge22(
|
|
2316
3639
|
"col-start-1 row-start-1 leading-none",
|
|
2317
3640
|
"scale-100 opacity-100 transition duration-300",
|
|
2318
3641
|
"group-aria-busy:scale-125 group-aria-busy:opacity-0"
|
|
2319
3642
|
),
|
|
2320
|
-
children: /* @__PURE__ */
|
|
3643
|
+
children: /* @__PURE__ */ jsx49(Logo, {})
|
|
2321
3644
|
}
|
|
2322
3645
|
),
|
|
2323
|
-
/* @__PURE__ */
|
|
3646
|
+
/* @__PURE__ */ jsx49(
|
|
2324
3647
|
"span",
|
|
2325
3648
|
{
|
|
2326
3649
|
"aria-hidden": true,
|
|
2327
|
-
className:
|
|
3650
|
+
className: twMerge22(
|
|
2328
3651
|
"col-start-1 row-start-1",
|
|
2329
3652
|
"scale-50 opacity-0 transition duration-300 delay-50",
|
|
2330
3653
|
"group-aria-busy:scale-100 group-aria-busy:opacity-100"
|
|
2331
3654
|
),
|
|
2332
|
-
children: /* @__PURE__ */
|
|
3655
|
+
children: /* @__PURE__ */ jsx49(PendingIcon, {})
|
|
2333
3656
|
}
|
|
2334
3657
|
)
|
|
2335
3658
|
] }),
|
|
2336
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx49("span", { className: "font-medium", children: buttonLabel })
|
|
2337
3660
|
]
|
|
2338
3661
|
},
|
|
2339
3662
|
"sign in"
|
|
@@ -2349,50 +3672,386 @@ function useSessionClientReady() {
|
|
|
2349
3672
|
const userAddress = userClient.data?.account.address;
|
|
2350
3673
|
const prerequisites = usePrerequisites(userAddress);
|
|
2351
3674
|
const sessionClient = useSessionClient(userAddress);
|
|
2352
|
-
if (!
|
|
2353
|
-
|
|
3675
|
+
if (!prerequisites.isSuccess || !prerequisites.data.complete) {
|
|
3676
|
+
return { ...prerequisites, data: void 0 };
|
|
3677
|
+
}
|
|
2354
3678
|
return sessionClient;
|
|
2355
3679
|
}
|
|
2356
3680
|
|
|
2357
3681
|
// src/createWagmiConfig.ts
|
|
2358
|
-
import { connectorsForWallets } from "@rainbow-me/rainbowkit";
|
|
2359
3682
|
import { createConfig } from "wagmi";
|
|
3683
|
+
import { getDefaultConfig } from "connectkit";
|
|
3684
|
+
import { injected, coinbaseWallet, safe } from "wagmi/connectors";
|
|
2360
3685
|
|
|
2361
|
-
// src/
|
|
2362
|
-
import {
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
3686
|
+
// src/connectors/walletConnect.ts
|
|
3687
|
+
import { ChainNotConfiguredError, ProviderNotFoundError, createConnector } from "wagmi";
|
|
3688
|
+
import {
|
|
3689
|
+
SwitchChainError,
|
|
3690
|
+
UserRejectedRequestError,
|
|
3691
|
+
getAddress,
|
|
3692
|
+
numberToHex as numberToHex3
|
|
3693
|
+
} from "viem";
|
|
3694
|
+
walletConnect.type = "walletConnect";
|
|
3695
|
+
function walletConnect(parameters) {
|
|
3696
|
+
const isNewChainsStale = parameters.isNewChainsStale ?? true;
|
|
3697
|
+
let provider_;
|
|
3698
|
+
let providerPromise;
|
|
3699
|
+
const NAMESPACE = "eip155";
|
|
3700
|
+
let accountsChanged;
|
|
3701
|
+
let chainChanged;
|
|
3702
|
+
let connect;
|
|
3703
|
+
let displayUri;
|
|
3704
|
+
let sessionDelete;
|
|
3705
|
+
let disconnect;
|
|
3706
|
+
return createConnector((config) => ({
|
|
3707
|
+
id: "walletConnect",
|
|
3708
|
+
name: "WalletConnect",
|
|
3709
|
+
type: walletConnect.type,
|
|
3710
|
+
async setup() {
|
|
3711
|
+
const provider = await this.getProvider().catch(() => null);
|
|
3712
|
+
if (!provider) return;
|
|
3713
|
+
if (!connect) {
|
|
3714
|
+
connect = this.onConnect.bind(this);
|
|
3715
|
+
provider.on("connect", connect);
|
|
3716
|
+
}
|
|
3717
|
+
if (!sessionDelete) {
|
|
3718
|
+
sessionDelete = this.onSessionDelete.bind(this);
|
|
3719
|
+
provider.on("session_delete", sessionDelete);
|
|
3720
|
+
}
|
|
3721
|
+
},
|
|
3722
|
+
async connect({ chainId, ...rest } = {}) {
|
|
3723
|
+
try {
|
|
3724
|
+
const provider = await this.getProvider();
|
|
3725
|
+
if (!provider) throw new ProviderNotFoundError();
|
|
3726
|
+
if (!displayUri) {
|
|
3727
|
+
displayUri = this.onDisplayUri;
|
|
3728
|
+
provider.on("display_uri", displayUri);
|
|
3729
|
+
}
|
|
3730
|
+
let targetChainId = chainId;
|
|
3731
|
+
if (!targetChainId) {
|
|
3732
|
+
const state = await config.storage?.getItem("state") ?? {};
|
|
3733
|
+
const isChainSupported = config.chains.some((x) => x.id === state.chainId);
|
|
3734
|
+
if (isChainSupported) targetChainId = state.chainId;
|
|
3735
|
+
else targetChainId = config.chains[0]?.id;
|
|
3736
|
+
}
|
|
3737
|
+
if (!targetChainId) throw new Error("No chains found on connector.");
|
|
3738
|
+
const isChainsStale = await this.isChainsStale();
|
|
3739
|
+
if (provider.session && isChainsStale) await provider.disconnect();
|
|
3740
|
+
if (!provider.session || isChainsStale) {
|
|
3741
|
+
const optionalChains = config.chains.filter((chain) => chain.id !== targetChainId).map((optionalChain) => optionalChain.id);
|
|
3742
|
+
await provider.connect({
|
|
3743
|
+
optionalChains: [targetChainId, ...optionalChains],
|
|
3744
|
+
..."pairingTopic" in rest ? { pairingTopic: rest.pairingTopic } : {}
|
|
3745
|
+
});
|
|
3746
|
+
this.setRequestedChainsIds(config.chains.map((x) => x.id));
|
|
3747
|
+
}
|
|
3748
|
+
const accounts = (await provider.enable()).map((x) => getAddress(x));
|
|
3749
|
+
let currentChainId = await this.getChainId();
|
|
3750
|
+
if (chainId && currentChainId !== chainId) {
|
|
3751
|
+
const chain = await this.switchChain({ chainId }).catch((error2) => {
|
|
3752
|
+
if (error2.code === UserRejectedRequestError.code) throw error2;
|
|
3753
|
+
return { id: currentChainId };
|
|
3754
|
+
});
|
|
3755
|
+
currentChainId = chain?.id ?? currentChainId;
|
|
3756
|
+
}
|
|
3757
|
+
if (displayUri) {
|
|
3758
|
+
provider.removeListener("display_uri", displayUri);
|
|
3759
|
+
displayUri = void 0;
|
|
3760
|
+
}
|
|
3761
|
+
if (connect) {
|
|
3762
|
+
provider.removeListener("connect", connect);
|
|
3763
|
+
connect = void 0;
|
|
3764
|
+
}
|
|
3765
|
+
if (!accountsChanged) {
|
|
3766
|
+
accountsChanged = this.onAccountsChanged.bind(this);
|
|
3767
|
+
provider.on("accountsChanged", accountsChanged);
|
|
3768
|
+
}
|
|
3769
|
+
if (!chainChanged) {
|
|
3770
|
+
chainChanged = this.onChainChanged.bind(this);
|
|
3771
|
+
provider.on("chainChanged", chainChanged);
|
|
3772
|
+
}
|
|
3773
|
+
if (!disconnect) {
|
|
3774
|
+
disconnect = this.onDisconnect.bind(this);
|
|
3775
|
+
provider.on("disconnect", disconnect);
|
|
3776
|
+
}
|
|
3777
|
+
if (!sessionDelete) {
|
|
3778
|
+
sessionDelete = this.onSessionDelete.bind(this);
|
|
3779
|
+
provider.on("session_delete", sessionDelete);
|
|
3780
|
+
}
|
|
3781
|
+
return { accounts, chainId: currentChainId };
|
|
3782
|
+
} catch (error2) {
|
|
3783
|
+
if (/(user rejected|connection request reset)/i.test(error2?.message)) {
|
|
3784
|
+
throw new UserRejectedRequestError(error2);
|
|
3785
|
+
}
|
|
3786
|
+
throw error2;
|
|
3787
|
+
}
|
|
3788
|
+
},
|
|
3789
|
+
async disconnect() {
|
|
3790
|
+
const provider = await this.getProvider();
|
|
3791
|
+
try {
|
|
3792
|
+
await provider?.disconnect();
|
|
3793
|
+
} catch (error2) {
|
|
3794
|
+
if (!/No matching key/i.test(error2.message)) throw error2;
|
|
3795
|
+
} finally {
|
|
3796
|
+
if (chainChanged) {
|
|
3797
|
+
provider?.removeListener("chainChanged", chainChanged);
|
|
3798
|
+
chainChanged = void 0;
|
|
3799
|
+
}
|
|
3800
|
+
if (disconnect) {
|
|
3801
|
+
provider?.removeListener("disconnect", disconnect);
|
|
3802
|
+
disconnect = void 0;
|
|
3803
|
+
}
|
|
3804
|
+
if (!connect) {
|
|
3805
|
+
connect = this.onConnect.bind(this);
|
|
3806
|
+
provider?.on("connect", connect);
|
|
3807
|
+
}
|
|
3808
|
+
if (accountsChanged) {
|
|
3809
|
+
provider?.removeListener("accountsChanged", accountsChanged);
|
|
3810
|
+
accountsChanged = void 0;
|
|
3811
|
+
}
|
|
3812
|
+
if (sessionDelete) {
|
|
3813
|
+
provider?.removeListener("session_delete", sessionDelete);
|
|
3814
|
+
sessionDelete = void 0;
|
|
3815
|
+
}
|
|
3816
|
+
this.setRequestedChainsIds([]);
|
|
3817
|
+
}
|
|
3818
|
+
},
|
|
3819
|
+
async getAccounts() {
|
|
3820
|
+
const provider = await this.getProvider();
|
|
3821
|
+
return provider.accounts.map((x) => getAddress(x));
|
|
3822
|
+
},
|
|
3823
|
+
async getProvider() {
|
|
3824
|
+
async function initProvider() {
|
|
3825
|
+
const optionalChains = config.chains.map((x) => x.id);
|
|
3826
|
+
if (!optionalChains.length) return;
|
|
3827
|
+
const { EthereumProvider } = await import("@walletconnect/ethereum-provider");
|
|
3828
|
+
return await EthereumProvider.init({
|
|
3829
|
+
...parameters,
|
|
3830
|
+
disableProviderPing: true,
|
|
3831
|
+
optionalChains,
|
|
3832
|
+
projectId: parameters.projectId,
|
|
3833
|
+
rpcMap: Object.fromEntries(
|
|
3834
|
+
config.chains.map((chain) => {
|
|
3835
|
+
const [url] = extractRpcUrls({
|
|
3836
|
+
chain,
|
|
3837
|
+
transports: config.transports
|
|
3838
|
+
});
|
|
3839
|
+
return [chain.id, url];
|
|
3840
|
+
})
|
|
3841
|
+
),
|
|
3842
|
+
showQrModal: parameters.showQrModal ?? true
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
if (!provider_) {
|
|
3846
|
+
if (!providerPromise) providerPromise = initProvider();
|
|
3847
|
+
provider_ = await providerPromise;
|
|
3848
|
+
provider_?.events.setMaxListeners(Number.POSITIVE_INFINITY);
|
|
3849
|
+
}
|
|
3850
|
+
return provider_;
|
|
3851
|
+
},
|
|
3852
|
+
async getChainId() {
|
|
3853
|
+
const provider = await this.getProvider();
|
|
3854
|
+
return provider.chainId;
|
|
3855
|
+
},
|
|
3856
|
+
async isAuthorized() {
|
|
3857
|
+
try {
|
|
3858
|
+
const [accounts, provider] = await Promise.all([this.getAccounts(), this.getProvider()]);
|
|
3859
|
+
if (!accounts.length) return false;
|
|
3860
|
+
const isChainsStale = await this.isChainsStale();
|
|
3861
|
+
if (isChainsStale && provider.session) {
|
|
3862
|
+
await provider.disconnect().catch(() => {
|
|
3863
|
+
});
|
|
3864
|
+
return false;
|
|
3865
|
+
}
|
|
3866
|
+
return true;
|
|
3867
|
+
} catch {
|
|
3868
|
+
return false;
|
|
3869
|
+
}
|
|
3870
|
+
},
|
|
3871
|
+
async switchChain({ addEthereumChainParameter, chainId }) {
|
|
3872
|
+
const provider = await this.getProvider();
|
|
3873
|
+
if (!provider) throw new ProviderNotFoundError();
|
|
3874
|
+
const chain = config.chains.find((x) => x.id === chainId);
|
|
3875
|
+
if (!chain) throw new SwitchChainError(new ChainNotConfiguredError());
|
|
3876
|
+
try {
|
|
3877
|
+
await Promise.all([
|
|
3878
|
+
new Promise((resolve) => {
|
|
3879
|
+
const listener2 = ({ chainId: currentChainId }) => {
|
|
3880
|
+
if (currentChainId === chainId) {
|
|
3881
|
+
config.emitter.off("change", listener2);
|
|
3882
|
+
resolve();
|
|
3883
|
+
}
|
|
3884
|
+
};
|
|
3885
|
+
config.emitter.on("change", listener2);
|
|
3886
|
+
}),
|
|
3887
|
+
provider.request({
|
|
3888
|
+
method: "wallet_switchEthereumChain",
|
|
3889
|
+
params: [{ chainId: numberToHex3(chainId) }]
|
|
3890
|
+
})
|
|
3891
|
+
]);
|
|
3892
|
+
const requestedChains = await this.getRequestedChainsIds();
|
|
3893
|
+
this.setRequestedChainsIds([...requestedChains, chainId]);
|
|
3894
|
+
return chain;
|
|
3895
|
+
} catch (err) {
|
|
3896
|
+
const error2 = err;
|
|
3897
|
+
if (/(user rejected)/i.test(error2.message)) throw new UserRejectedRequestError(error2);
|
|
3898
|
+
try {
|
|
3899
|
+
let blockExplorerUrls;
|
|
3900
|
+
if (addEthereumChainParameter?.blockExplorerUrls)
|
|
3901
|
+
blockExplorerUrls = addEthereumChainParameter.blockExplorerUrls;
|
|
3902
|
+
else blockExplorerUrls = chain.blockExplorers?.default.url ? [chain.blockExplorers?.default.url] : [];
|
|
3903
|
+
let rpcUrls;
|
|
3904
|
+
if (addEthereumChainParameter?.rpcUrls?.length) rpcUrls = addEthereumChainParameter.rpcUrls;
|
|
3905
|
+
else rpcUrls = [...chain.rpcUrls.default.http];
|
|
3906
|
+
const addEthereumChain = {
|
|
3907
|
+
blockExplorerUrls,
|
|
3908
|
+
chainId: numberToHex3(chainId),
|
|
3909
|
+
chainName: addEthereumChainParameter?.chainName ?? chain.name,
|
|
3910
|
+
iconUrls: addEthereumChainParameter?.iconUrls,
|
|
3911
|
+
nativeCurrency: addEthereumChainParameter?.nativeCurrency ?? chain.nativeCurrency,
|
|
3912
|
+
rpcUrls
|
|
3913
|
+
};
|
|
3914
|
+
await provider.request({
|
|
3915
|
+
method: "wallet_addEthereumChain",
|
|
3916
|
+
params: [addEthereumChain]
|
|
3917
|
+
});
|
|
3918
|
+
const requestedChains = await this.getRequestedChainsIds();
|
|
3919
|
+
this.setRequestedChainsIds([...requestedChains, chainId]);
|
|
3920
|
+
return chain;
|
|
3921
|
+
} catch (error3) {
|
|
3922
|
+
throw new UserRejectedRequestError(error3);
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
},
|
|
3926
|
+
onAccountsChanged(accounts) {
|
|
3927
|
+
if (accounts.length === 0) this.onDisconnect();
|
|
3928
|
+
else
|
|
3929
|
+
config.emitter.emit("change", {
|
|
3930
|
+
accounts: accounts.map((x) => getAddress(x))
|
|
3931
|
+
});
|
|
3932
|
+
},
|
|
3933
|
+
onChainChanged(chain) {
|
|
3934
|
+
const chainId = Number(chain);
|
|
3935
|
+
config.emitter.emit("change", { chainId });
|
|
3936
|
+
},
|
|
3937
|
+
async onConnect(connectInfo) {
|
|
3938
|
+
const chainId = Number(connectInfo.chainId);
|
|
3939
|
+
const accounts = await this.getAccounts();
|
|
3940
|
+
config.emitter.emit("connect", { accounts, chainId });
|
|
3941
|
+
},
|
|
3942
|
+
async onDisconnect(_error) {
|
|
3943
|
+
this.setRequestedChainsIds([]);
|
|
3944
|
+
config.emitter.emit("disconnect");
|
|
3945
|
+
const provider = await this.getProvider();
|
|
3946
|
+
if (accountsChanged) {
|
|
3947
|
+
provider.removeListener("accountsChanged", accountsChanged);
|
|
3948
|
+
accountsChanged = void 0;
|
|
3949
|
+
}
|
|
3950
|
+
if (chainChanged) {
|
|
3951
|
+
provider.removeListener("chainChanged", chainChanged);
|
|
3952
|
+
chainChanged = void 0;
|
|
3953
|
+
}
|
|
3954
|
+
if (disconnect) {
|
|
3955
|
+
provider.removeListener("disconnect", disconnect);
|
|
3956
|
+
disconnect = void 0;
|
|
3957
|
+
}
|
|
3958
|
+
if (sessionDelete) {
|
|
3959
|
+
provider.removeListener("session_delete", sessionDelete);
|
|
3960
|
+
sessionDelete = void 0;
|
|
3961
|
+
}
|
|
3962
|
+
if (!connect) {
|
|
3963
|
+
connect = this.onConnect.bind(this);
|
|
3964
|
+
provider.on("connect", connect);
|
|
3965
|
+
}
|
|
3966
|
+
},
|
|
3967
|
+
onDisplayUri(uri) {
|
|
3968
|
+
config.emitter.emit("message", { type: "display_uri", data: uri });
|
|
3969
|
+
},
|
|
3970
|
+
onSessionDelete() {
|
|
3971
|
+
this.onDisconnect();
|
|
3972
|
+
},
|
|
3973
|
+
getNamespaceChainsIds() {
|
|
3974
|
+
if (!provider_) return [];
|
|
3975
|
+
const chainIds = provider_.session?.namespaces[NAMESPACE]?.accounts?.map(
|
|
3976
|
+
(account) => Number.parseInt(account.split(":")[1] || "")
|
|
3977
|
+
);
|
|
3978
|
+
return chainIds ?? [];
|
|
3979
|
+
},
|
|
3980
|
+
async getRequestedChainsIds() {
|
|
3981
|
+
return await config.storage?.getItem(this.requestedChainsStorageKey) ?? [];
|
|
3982
|
+
},
|
|
3983
|
+
/**
|
|
3984
|
+
* Checks if the target chains match the chains that were
|
|
3985
|
+
* initially requested by the connector for the WalletConnect session.
|
|
3986
|
+
* If there is a mismatch, this means that the chains on the connector
|
|
3987
|
+
* are considered stale, and need to be revalidated at a later point (via
|
|
3988
|
+
* connection).
|
|
3989
|
+
*
|
|
3990
|
+
* There may be a scenario where a dapp adds a chain to the
|
|
3991
|
+
* connector later on, however, this chain will not have been approved or rejected
|
|
3992
|
+
* by the wallet. In this case, the chain is considered stale.
|
|
3993
|
+
*/
|
|
3994
|
+
async isChainsStale() {
|
|
3995
|
+
if (!isNewChainsStale) return false;
|
|
3996
|
+
const connectorChains = config.chains.map((x) => x.id);
|
|
3997
|
+
const namespaceChains = this.getNamespaceChainsIds();
|
|
3998
|
+
if (namespaceChains.length && !namespaceChains.some((id) => connectorChains.includes(id))) return false;
|
|
3999
|
+
const requestedChains = await this.getRequestedChainsIds();
|
|
4000
|
+
return !connectorChains.every((id) => requestedChains.includes(id));
|
|
4001
|
+
},
|
|
4002
|
+
async setRequestedChainsIds(chains) {
|
|
4003
|
+
await config.storage?.setItem(this.requestedChainsStorageKey, chains);
|
|
4004
|
+
},
|
|
4005
|
+
get requestedChainsStorageKey() {
|
|
4006
|
+
return `${this.id}.requestedChains`;
|
|
4007
|
+
}
|
|
4008
|
+
}));
|
|
4009
|
+
}
|
|
4010
|
+
function extractRpcUrls(parameters) {
|
|
4011
|
+
const { chain } = parameters;
|
|
4012
|
+
const fallbackUrl = chain.rpcUrls.default.http[0];
|
|
4013
|
+
if (!parameters.transports) return [fallbackUrl];
|
|
4014
|
+
const transport = parameters.transports?.[chain.id]?.({ chain });
|
|
4015
|
+
const transports = transport?.value?.transports || [transport];
|
|
4016
|
+
return transports.map(({ value }) => value?.url || fallbackUrl);
|
|
2369
4017
|
}
|
|
2370
4018
|
|
|
2371
4019
|
// src/createWagmiConfig.ts
|
|
2372
4020
|
function createWagmiConfig(config) {
|
|
2373
|
-
const
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
4021
|
+
const connectors = [];
|
|
4022
|
+
const shouldUseSafeConnector = !(typeof window === "undefined") && window?.parent !== window;
|
|
4023
|
+
if (shouldUseSafeConnector) {
|
|
4024
|
+
connectors.push(
|
|
4025
|
+
safe({
|
|
4026
|
+
allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/]
|
|
4027
|
+
})
|
|
4028
|
+
);
|
|
4029
|
+
}
|
|
4030
|
+
connectors.push(
|
|
4031
|
+
injected({ target: "metaMask" }),
|
|
4032
|
+
coinbaseWallet({
|
|
4033
|
+
appName: config.appName,
|
|
4034
|
+
overrideIsMetaMask: false
|
|
4035
|
+
})
|
|
4036
|
+
);
|
|
4037
|
+
if (config.walletConnectProjectId) {
|
|
4038
|
+
connectors.push(
|
|
4039
|
+
walletConnect({
|
|
4040
|
+
showQrModal: false,
|
|
4041
|
+
projectId: config.walletConnectProjectId
|
|
4042
|
+
})
|
|
4043
|
+
);
|
|
4044
|
+
}
|
|
4045
|
+
const configParams = getDefaultConfig({
|
|
2380
4046
|
chains: config.chains,
|
|
2381
4047
|
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), {
|
|
4048
|
+
pollingInterval: config.pollingInterval,
|
|
2393
4049
|
appName: config.appName,
|
|
2394
|
-
|
|
4050
|
+
walletConnectProjectId: config.walletConnectProjectId,
|
|
4051
|
+
enableFamily: false,
|
|
4052
|
+
connectors
|
|
2395
4053
|
});
|
|
4054
|
+
return createConfig(configParams);
|
|
2396
4055
|
}
|
|
2397
4056
|
|
|
2398
4057
|
// src/validateSigner.ts
|
|
@@ -2443,8 +4102,6 @@ export {
|
|
|
2443
4102
|
EntryKitProvider,
|
|
2444
4103
|
createWagmiConfig,
|
|
2445
4104
|
defineConfig,
|
|
2446
|
-
getConnectors,
|
|
2447
|
-
getWallets,
|
|
2448
4105
|
internal_validateSigner,
|
|
2449
4106
|
useAccountModal,
|
|
2450
4107
|
useEntryKitConfig,
|