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