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