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