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