@luno-kit/ui 0.0.1 → 0.0.3
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/LICENSE +21 -0
- package/dist/index.cjs +1 -1820
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1791
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1377
- package/package.json +24 -22
package/dist/index.js
CHANGED
|
@@ -1,1793 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
|
-
// src/components/AccountDetailsModal/index.tsx
|
|
4
|
-
import { useCallback as useCallback5, useMemo as useMemo4 } from "react";
|
|
5
|
-
import { useAccount as useAccount3, useActiveConnector as useActiveConnector2, useBalance as useBalance2, useChain as useChain4 } from "@luno-kit/react";
|
|
6
|
-
|
|
7
|
-
// src/components/Dialog/index.tsx
|
|
8
|
-
import React from "react";
|
|
9
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
10
|
-
|
|
11
|
-
// src/utils/cs.ts
|
|
12
|
-
import { clsx } from "clsx";
|
|
13
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
14
|
-
var customTwMerge = extendTailwindMerge({
|
|
15
|
-
extend: {
|
|
16
|
-
classGroups: {
|
|
17
|
-
"font-size": [
|
|
18
|
-
"text-xs",
|
|
19
|
-
"text-sm",
|
|
20
|
-
"text-base",
|
|
21
|
-
"text-lg"
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
function cs(...inputs) {
|
|
27
|
-
return customTwMerge(clsx(inputs));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// src/utils/debounce.ts
|
|
31
|
-
function debounce(fn, ms) {
|
|
32
|
-
let timer;
|
|
33
|
-
return () => {
|
|
34
|
-
if (timer) {
|
|
35
|
-
clearTimeout(timer);
|
|
36
|
-
}
|
|
37
|
-
timer = setTimeout(() => {
|
|
38
|
-
timer = null;
|
|
39
|
-
fn();
|
|
40
|
-
}, ms);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/components/Dialog/index.tsx
|
|
45
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
46
|
-
var DialogRoot = ({
|
|
47
|
-
open,
|
|
48
|
-
onOpenChange,
|
|
49
|
-
children,
|
|
50
|
-
contentClassName,
|
|
51
|
-
overlayClassName
|
|
52
|
-
}) => {
|
|
53
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
54
|
-
React.createElement(DialogPrimitive.Overlay, {
|
|
55
|
-
className: cs(
|
|
56
|
-
"fixed inset-0 z-[100] bg-modalBackdrop luno-kit",
|
|
57
|
-
"data-[state=open]:[animation:overlay-in_150ms_ease-out]",
|
|
58
|
-
overlayClassName
|
|
59
|
-
)
|
|
60
|
-
}),
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
DialogPrimitive.Content,
|
|
63
|
-
{
|
|
64
|
-
className: cs(
|
|
65
|
-
"luno-kit font-body fixed z-[200] text-modalText text-base leading-base",
|
|
66
|
-
"bg-modalBackground shadow-primary focus:outline-none overflow-hidden",
|
|
67
|
-
"transition-all duration-200",
|
|
68
|
-
"rounded-t-modalMobile bottom-0 left-0 w-full",
|
|
69
|
-
"translate-y-0 -translate-x-0",
|
|
70
|
-
"data-[state=open]:[animation:slide-up_200ms_ease-out]",
|
|
71
|
-
"md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2",
|
|
72
|
-
"md:w-auto md:rounded-modal",
|
|
73
|
-
"md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",
|
|
74
|
-
contentClassName
|
|
75
|
-
),
|
|
76
|
-
children
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
] }) });
|
|
80
|
-
};
|
|
81
|
-
var DialogTitleWrapper = ({ children, className }) => React.createElement(DialogPrimitive.Title, { className: cs("font-heading", className) }, children);
|
|
82
|
-
var DialogCloseWrapper = ({ children, className, onClick }) => React.createElement(DialogPrimitive.Close, { className, onClick }, children);
|
|
83
|
-
var Dialog = DialogRoot;
|
|
84
|
-
var DialogClose = DialogCloseWrapper;
|
|
85
|
-
var DialogTitle = DialogTitleWrapper;
|
|
86
|
-
|
|
87
|
-
// src/providers/ModalContext.tsx
|
|
88
|
-
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
89
|
-
import { ConnectionStatus, useStatus } from "@luno-kit/react";
|
|
90
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
91
|
-
function useModalVisibility() {
|
|
92
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
93
|
-
const open = useCallback(() => setIsOpen(true), []);
|
|
94
|
-
const close = useCallback(() => setIsOpen(false), []);
|
|
95
|
-
return { isOpen, open, close };
|
|
96
|
-
}
|
|
97
|
-
var ModalContext = createContext(void 0);
|
|
98
|
-
var ModalProvider = ({ children }) => {
|
|
99
|
-
const { isOpen: isConnectModalOpen, open: openConnectModal, close: closeConnectModal } = useModalVisibility();
|
|
100
|
-
const { isOpen: isAccountModalOpen, open: openAccountModal, close: closeAccountModal } = useModalVisibility();
|
|
101
|
-
const { isOpen: isChainModalOpen, open: openChainModal, close: closeChainModal } = useModalVisibility();
|
|
102
|
-
const connectionStatus = useStatus();
|
|
103
|
-
const closeAllModals = useCallback(() => {
|
|
104
|
-
closeConnectModal();
|
|
105
|
-
closeAccountModal();
|
|
106
|
-
closeChainModal();
|
|
107
|
-
}, [closeConnectModal, closeAccountModal, closeChainModal]);
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
if (connectionStatus === ConnectionStatus.Disconnected) {
|
|
110
|
-
closeAccountModal();
|
|
111
|
-
closeChainModal();
|
|
112
|
-
}
|
|
113
|
-
}, [connectionStatus, closeAccountModal, closeChainModal]);
|
|
114
|
-
const contextValue = useMemo(() => ({
|
|
115
|
-
isConnectModalOpen,
|
|
116
|
-
isAccountModalOpen,
|
|
117
|
-
isChainModalOpen,
|
|
118
|
-
openConnectModal: connectionStatus !== ConnectionStatus.Connected ? openConnectModal : void 0,
|
|
119
|
-
closeConnectModal,
|
|
120
|
-
openAccountModal: connectionStatus === ConnectionStatus.Connected ? openAccountModal : void 0,
|
|
121
|
-
closeAccountModal,
|
|
122
|
-
openChainModal: connectionStatus === ConnectionStatus.Connected ? openChainModal : void 0,
|
|
123
|
-
closeChainModal,
|
|
124
|
-
closeAllModals
|
|
125
|
-
}), [
|
|
126
|
-
isConnectModalOpen,
|
|
127
|
-
openConnectModal,
|
|
128
|
-
closeConnectModal,
|
|
129
|
-
isAccountModalOpen,
|
|
130
|
-
openAccountModal,
|
|
131
|
-
closeAccountModal,
|
|
132
|
-
isChainModalOpen,
|
|
133
|
-
openChainModal,
|
|
134
|
-
closeChainModal,
|
|
135
|
-
closeAllModals,
|
|
136
|
-
connectionStatus
|
|
137
|
-
]);
|
|
138
|
-
return /* @__PURE__ */ jsx2(ModalContext.Provider, { value: contextValue, children });
|
|
139
|
-
};
|
|
140
|
-
var useConnectModal = () => {
|
|
141
|
-
const context = useContext(ModalContext);
|
|
142
|
-
if (!context) throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");
|
|
143
|
-
return {
|
|
144
|
-
isOpen: context.isConnectModalOpen,
|
|
145
|
-
open: context.openConnectModal,
|
|
146
|
-
close: context.closeConnectModal
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
var useAccountModal = () => {
|
|
150
|
-
const context = useContext(ModalContext);
|
|
151
|
-
if (!context) throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");
|
|
152
|
-
return {
|
|
153
|
-
isOpen: context.isAccountModalOpen,
|
|
154
|
-
open: context.openAccountModal,
|
|
155
|
-
close: context.closeAccountModal
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
var useChainModal = () => {
|
|
159
|
-
const context = useContext(ModalContext);
|
|
160
|
-
if (!context) throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");
|
|
161
|
-
return {
|
|
162
|
-
isOpen: context.isChainModalOpen,
|
|
163
|
-
open: context.openChainModal,
|
|
164
|
-
close: context.closeChainModal
|
|
165
|
-
};
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/assets/icons/Arrow.tsx
|
|
169
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
170
|
-
var SvgArrow = (props) => /* @__PURE__ */ jsx3(
|
|
171
|
-
"svg",
|
|
172
|
-
{
|
|
173
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
174
|
-
className: "arrow_svg__icon",
|
|
175
|
-
viewBox: "0 0 256 256",
|
|
176
|
-
width: "20",
|
|
177
|
-
height: "20",
|
|
178
|
-
fill: "currentColor",
|
|
179
|
-
...props,
|
|
180
|
-
children: /* @__PURE__ */ jsx3("path", { d: "M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z" })
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
var Arrow_default = SvgArrow;
|
|
184
|
-
|
|
185
|
-
// src/assets/icons/Back.tsx
|
|
186
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
187
|
-
var SvgBack = (props) => /* @__PURE__ */ jsx4(
|
|
188
|
-
"svg",
|
|
189
|
-
{
|
|
190
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
191
|
-
width: "20",
|
|
192
|
-
height: "20",
|
|
193
|
-
fill: "currentColor",
|
|
194
|
-
viewBox: "0 0 256 256",
|
|
195
|
-
...props,
|
|
196
|
-
children: /* @__PURE__ */ jsx4("path", { d: "M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z" })
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
var Back_default = SvgBack;
|
|
200
|
-
|
|
201
|
-
// src/assets/icons/Close.tsx
|
|
202
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
203
|
-
var SvgClose = (props) => /* @__PURE__ */ jsx5(
|
|
204
|
-
"svg",
|
|
205
|
-
{
|
|
206
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
207
|
-
width: "20",
|
|
208
|
-
height: "20",
|
|
209
|
-
fill: "currentColor",
|
|
210
|
-
viewBox: "0 0 256 256",
|
|
211
|
-
...props,
|
|
212
|
-
children: /* @__PURE__ */ jsx5("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" })
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
var Close_default = SvgClose;
|
|
216
|
-
|
|
217
|
-
// src/assets/icons/Copy.tsx
|
|
218
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
219
|
-
var SvgCopy = (props) => /* @__PURE__ */ jsx6(
|
|
220
|
-
"svg",
|
|
221
|
-
{
|
|
222
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
223
|
-
className: "copy_svg__icon",
|
|
224
|
-
width: "16",
|
|
225
|
-
height: "16",
|
|
226
|
-
fill: "currentColor",
|
|
227
|
-
viewBox: "0 0 256 256",
|
|
228
|
-
...props,
|
|
229
|
-
children: /* @__PURE__ */ jsx6("path", { d: "M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z" })
|
|
230
|
-
}
|
|
231
|
-
);
|
|
232
|
-
var Copy_default = SvgCopy;
|
|
233
|
-
|
|
234
|
-
// src/assets/icons/Disconnect.tsx
|
|
235
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
236
|
-
var SvgDisconnect = (props) => /* @__PURE__ */ jsx7(
|
|
237
|
-
"svg",
|
|
238
|
-
{
|
|
239
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
240
|
-
fill: "currentColor",
|
|
241
|
-
viewBox: "0 0 256 256",
|
|
242
|
-
width: "20",
|
|
243
|
-
height: "20",
|
|
244
|
-
...props,
|
|
245
|
-
children: /* @__PURE__ */ jsx7("path", { d: "M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z" })
|
|
246
|
-
}
|
|
247
|
-
);
|
|
248
|
-
var Disconnect_default = SvgDisconnect;
|
|
249
|
-
|
|
250
|
-
// src/assets/icons/List.tsx
|
|
251
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
252
|
-
var SvgList = (props) => /* @__PURE__ */ jsx8(
|
|
253
|
-
"svg",
|
|
254
|
-
{
|
|
255
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
256
|
-
className: "list_svg__icon",
|
|
257
|
-
viewBox: "0 0 256 256",
|
|
258
|
-
width: "20",
|
|
259
|
-
height: "20",
|
|
260
|
-
fill: "currentColor",
|
|
261
|
-
...props,
|
|
262
|
-
children: /* @__PURE__ */ jsx8("path", { d: "M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z" })
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
var List_default = SvgList;
|
|
266
|
-
|
|
267
|
-
// src/assets/icons/Loading.tsx
|
|
268
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
269
|
-
var SvgLoading = (props) => /* @__PURE__ */ jsx9(
|
|
270
|
-
"svg",
|
|
271
|
-
{
|
|
272
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
273
|
-
width: "20",
|
|
274
|
-
height: "20",
|
|
275
|
-
fill: "currentColor",
|
|
276
|
-
className: "loading_svg__icon",
|
|
277
|
-
viewBox: "0 0 256 256",
|
|
278
|
-
...props,
|
|
279
|
-
children: /* @__PURE__ */ jsx9("path", { d: "M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z" })
|
|
280
|
-
}
|
|
281
|
-
);
|
|
282
|
-
var Loading_default = SvgLoading;
|
|
283
|
-
|
|
284
|
-
// src/assets/icons/Success.tsx
|
|
285
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
286
|
-
var SvgSuccess = (props) => /* @__PURE__ */ jsx10(
|
|
287
|
-
"svg",
|
|
288
|
-
{
|
|
289
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
290
|
-
className: "success_svg__icon",
|
|
291
|
-
viewBox: "0 0 256 256",
|
|
292
|
-
width: "20",
|
|
293
|
-
height: "20",
|
|
294
|
-
fill: "currentColor",
|
|
295
|
-
...props,
|
|
296
|
-
children: /* @__PURE__ */ jsx10("path", { d: "M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z" })
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
var Success_default = SvgSuccess;
|
|
300
|
-
|
|
301
|
-
// src/assets/icons/Switch.tsx
|
|
302
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
303
|
-
var SvgSwitch = (props) => /* @__PURE__ */ jsx11(
|
|
304
|
-
"svg",
|
|
305
|
-
{
|
|
306
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
307
|
-
width: "20",
|
|
308
|
-
height: "20",
|
|
309
|
-
className: "switch_svg__icon",
|
|
310
|
-
viewBox: "0 0 256 256",
|
|
311
|
-
fill: "currentColor",
|
|
312
|
-
...props,
|
|
313
|
-
children: /* @__PURE__ */ jsx11("path", { d: "M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z" })
|
|
314
|
-
}
|
|
315
|
-
);
|
|
316
|
-
var Switch_default = SvgSwitch;
|
|
317
|
-
|
|
318
|
-
// src/components/AccountDetailsModal/MainView.tsx
|
|
319
|
-
import { useMemo as useMemo2 } from "react";
|
|
320
|
-
|
|
321
|
-
// src/components/ChainIcon/index.tsx
|
|
322
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
323
|
-
var ChainIcon = ({
|
|
324
|
-
chainIconUrl,
|
|
325
|
-
chainName,
|
|
326
|
-
className
|
|
327
|
-
}) => {
|
|
328
|
-
if (chainIconUrl) {
|
|
329
|
-
return /* @__PURE__ */ jsx12(
|
|
330
|
-
"img",
|
|
331
|
-
{
|
|
332
|
-
src: chainIconUrl,
|
|
333
|
-
alt: chainName || "Chain icon",
|
|
334
|
-
className: cs("w-full h-full object-cover rounded-full", className)
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
return /* @__PURE__ */ jsx12("div", { className: cs(
|
|
339
|
-
"w-full h-full bg-gray-500 text-modalText font-semibold",
|
|
340
|
-
"flex items-center justify-center rounded-full",
|
|
341
|
-
className
|
|
342
|
-
), children: chainName ? chainName.charAt(0).toUpperCase() : "C" });
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
// src/components/AccountDetailsModal/MainView.tsx
|
|
346
|
-
import { useAccount, useChain, useDisconnect, getExplorerUrl } from "@luno-kit/react";
|
|
347
|
-
import { Fragment, jsx as jsx13, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
348
|
-
var MainView = ({
|
|
349
|
-
onViewChange,
|
|
350
|
-
onModalClose
|
|
351
|
-
}) => {
|
|
352
|
-
const { address } = useAccount();
|
|
353
|
-
const { chain } = useChain();
|
|
354
|
-
const { disconnectAsync } = useDisconnect();
|
|
355
|
-
const items = useMemo2(() => {
|
|
356
|
-
return [
|
|
357
|
-
{
|
|
358
|
-
key: "Chain Name",
|
|
359
|
-
content: /* @__PURE__ */ jsxs2("div", { className: "flex items-stretch w-full justify-between", children: [
|
|
360
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
361
|
-
/* @__PURE__ */ jsx13(
|
|
362
|
-
ChainIcon,
|
|
363
|
-
{
|
|
364
|
-
className: "w-[20px] h-[20px]",
|
|
365
|
-
chainIconUrl: chain?.chainIconUrl,
|
|
366
|
-
chainName: chain?.name
|
|
367
|
-
}
|
|
368
|
-
),
|
|
369
|
-
/* @__PURE__ */ jsx13("span", { className: "text-base text-modalText", children: chain?.name || "Polkadot" })
|
|
370
|
-
] }),
|
|
371
|
-
/* @__PURE__ */ jsx13(
|
|
372
|
-
"div",
|
|
373
|
-
{
|
|
374
|
-
className: "flex items-center justify-center",
|
|
375
|
-
children: /* @__PURE__ */ jsx13(Arrow_default, { className: "w-[16px] h-[16px] " })
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
] }),
|
|
379
|
-
onClick: () => onViewChange("switchChain" /* switchChain */)
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
key: "View on Explorer",
|
|
383
|
-
content: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
384
|
-
/* @__PURE__ */ jsx13(List_default, {}),
|
|
385
|
-
/* @__PURE__ */ jsx13("span", { className: "text-base text-accountActionItemText", children: "View on Explorer" })
|
|
386
|
-
] }),
|
|
387
|
-
onClick: () => window.open(getExplorerUrl(chain?.blockExplorers?.default?.url, address, "address"))
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
key: "Switch Account",
|
|
391
|
-
content: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
392
|
-
/* @__PURE__ */ jsx13(Switch_default, {}),
|
|
393
|
-
/* @__PURE__ */ jsx13("span", { className: "text-base text-accountActionItemText", children: "Switch Account" })
|
|
394
|
-
] }),
|
|
395
|
-
onClick: () => onViewChange("switchAccount" /* switchAccount */)
|
|
396
|
-
}
|
|
397
|
-
];
|
|
398
|
-
}, [onViewChange, chain, address]);
|
|
399
|
-
const handleDisconnect = async () => {
|
|
400
|
-
await disconnectAsync();
|
|
401
|
-
onModalClose();
|
|
402
|
-
};
|
|
403
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-3 w-full", children: [
|
|
404
|
-
/* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-1.5 w-full px-4", children: items.map((i) => /* @__PURE__ */ jsx13(SelectItem, { onClick: i.onClick, children: i.content }, i.key)) }),
|
|
405
|
-
/* @__PURE__ */ jsx13("div", { className: "w-full mx-[-100px] h-[1px] bg-cutLine" }),
|
|
406
|
-
/* @__PURE__ */ jsx13("div", { className: "w-full px-4 pb-4", children: /* @__PURE__ */ jsxs2(SelectItem, { onClick: handleDisconnect, children: [
|
|
407
|
-
/* @__PURE__ */ jsx13(Disconnect_default, {}),
|
|
408
|
-
/* @__PURE__ */ jsx13("span", { className: "font-medium text-base text-accountActionItemText", children: "Disconnect" })
|
|
409
|
-
] }) })
|
|
410
|
-
] });
|
|
411
|
-
};
|
|
412
|
-
var SelectItem = ({ children, onClick }) => {
|
|
413
|
-
return /* @__PURE__ */ jsx13(
|
|
414
|
-
"button",
|
|
415
|
-
{
|
|
416
|
-
type: "button",
|
|
417
|
-
onClick: () => onClick?.(),
|
|
418
|
-
className: cs(
|
|
419
|
-
"w-full p-3.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium",
|
|
420
|
-
"bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover",
|
|
421
|
-
"transition-colors duration-200",
|
|
422
|
-
onClick ? "cursor-pointer" : "cursor-auto"
|
|
423
|
-
),
|
|
424
|
-
"aria-label": typeof children === "string" ? children : void 0,
|
|
425
|
-
children
|
|
426
|
-
}
|
|
427
|
-
);
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
// src/components/AccountDetailsModal/SwitchAccountView.tsx
|
|
431
|
-
import React4, { useCallback as useCallback2 } from "react";
|
|
432
|
-
import { useAccount as useAccount2, useAccounts, useActiveConnector, useBalance, useChain as useChain2 } from "@luno-kit/react";
|
|
433
|
-
import { formatAddress } from "@luno-kit/react";
|
|
434
|
-
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
435
|
-
var SwitchAccountView = ({ onBack }) => {
|
|
436
|
-
const { accounts, selectAccount } = useAccounts();
|
|
437
|
-
const { address: currentAddress } = useAccount2();
|
|
438
|
-
const _selectAccount = useCallback2((acc) => {
|
|
439
|
-
selectAccount(acc);
|
|
440
|
-
onBack();
|
|
441
|
-
}, [onBack]);
|
|
442
|
-
return /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0", children: accounts.map((acc) => /* @__PURE__ */ jsx14(
|
|
443
|
-
AccountItem,
|
|
444
|
-
{
|
|
445
|
-
account: acc,
|
|
446
|
-
isSelected: acc.address === currentAddress,
|
|
447
|
-
selectAccount: _selectAccount
|
|
448
|
-
},
|
|
449
|
-
acc.address
|
|
450
|
-
)) });
|
|
451
|
-
};
|
|
452
|
-
SwitchAccountView.title = "Switch Accounts";
|
|
453
|
-
var AccountItem = React4.memo(({
|
|
454
|
-
isSelected,
|
|
455
|
-
account,
|
|
456
|
-
selectAccount
|
|
457
|
-
}) => {
|
|
458
|
-
const { chain } = useChain2();
|
|
459
|
-
const address = account.address;
|
|
460
|
-
const { data: balance } = useBalance({ address });
|
|
461
|
-
const connector = useActiveConnector();
|
|
462
|
-
return /* @__PURE__ */ jsxs3(
|
|
463
|
-
"button",
|
|
464
|
-
{
|
|
465
|
-
type: "button",
|
|
466
|
-
onClick: () => selectAccount(account),
|
|
467
|
-
className: cs(
|
|
468
|
-
"px-3.5 py-2.5 w-full rounded-accountSelectItem border-none",
|
|
469
|
-
"bg-accountSelectItemBackground",
|
|
470
|
-
"text-left flex items-center justify-between gap-2",
|
|
471
|
-
"transition-colors duration-200",
|
|
472
|
-
isSelected ? "cursor-auto" : "cursor-pointer hover:bg-accountSelectItemBackgroundHover"
|
|
473
|
-
),
|
|
474
|
-
"aria-label": account.name || address,
|
|
475
|
-
disabled: isSelected,
|
|
476
|
-
children: [
|
|
477
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
478
|
-
/* @__PURE__ */ jsx14("div", { className: "shrink-0 w-[24px] h-[24px] bg-pink-500 rounded-full flex items-center justify-center", children: connector?.icon && /* @__PURE__ */ jsx14("img", { src: connector?.icon, alt: "luno account" }) }),
|
|
479
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-start", children: [
|
|
480
|
-
/* @__PURE__ */ jsx14("span", { className: "font-medium text-sm leading-sm text-accountSelectItemText", children: account.name || formatAddress(address) }),
|
|
481
|
-
/* @__PURE__ */ jsx14("span", { className: "text-xs text-modalTextSecondary font-medium", children: balance === void 0 ? /* @__PURE__ */ jsx14("div", { className: "animate-pulse rounded w-[60px] h-[18px] bg-skeleton" }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
482
|
-
balance?.formattedTransferable || "0.00",
|
|
483
|
-
" ",
|
|
484
|
-
chain?.nativeCurrency?.symbol || "DOT"
|
|
485
|
-
] }) })
|
|
486
|
-
] })
|
|
487
|
-
] }),
|
|
488
|
-
isSelected && /* @__PURE__ */ jsx14("div", { className: "border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsx14("div", { className: "rounded-full bg-accentColor w-[10px] h-[10px]" }) })
|
|
489
|
-
]
|
|
490
|
-
}
|
|
491
|
-
);
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
// src/components/ChainList/index.tsx
|
|
495
|
-
import React5, { useMemo as useMemo3, useState as useState2 } from "react";
|
|
496
|
-
import { useApi, useChain as useChain3, useChains, useSwitchChain } from "@luno-kit/react";
|
|
497
|
-
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
498
|
-
var FILTER_TABS = [
|
|
499
|
-
{ key: "All" /* all */, label: "All" /* all */ },
|
|
500
|
-
{ key: "Mainnets" /* mainnets */, label: "Mainnets" /* mainnets */ },
|
|
501
|
-
{ key: "Testnets" /* testnets */, label: "Testnets" /* testnets */ }
|
|
502
|
-
];
|
|
503
|
-
var ChainList = ({ onChainSwitched }) => {
|
|
504
|
-
const { chain: currentChain } = useChain3();
|
|
505
|
-
const chains = useChains();
|
|
506
|
-
const { switchChainAsync } = useSwitchChain();
|
|
507
|
-
const { isApiReady, apiError } = useApi();
|
|
508
|
-
const [activeFilter, setActiveFilter] = useState2("All" /* all */);
|
|
509
|
-
const [switchingChain, setSwitchingChain] = useState2(null);
|
|
510
|
-
const filteredChains = useMemo3(() => {
|
|
511
|
-
switch (activeFilter) {
|
|
512
|
-
case "Mainnets" /* mainnets */:
|
|
513
|
-
return chains.filter((chain) => !chain.testnet);
|
|
514
|
-
case "Testnets" /* testnets */:
|
|
515
|
-
return chains.filter((chain) => chain.testnet);
|
|
516
|
-
case "All" /* all */:
|
|
517
|
-
default:
|
|
518
|
-
return chains;
|
|
519
|
-
}
|
|
520
|
-
}, [chains, activeFilter]);
|
|
521
|
-
const handleChainSelect = async (chain) => {
|
|
522
|
-
if (chain.genesisHash === currentChain?.genesisHash) return;
|
|
523
|
-
if (!isApiReady && !apiError) return;
|
|
524
|
-
setSwitchingChain(chain.genesisHash);
|
|
525
|
-
try {
|
|
526
|
-
await switchChainAsync({ chainId: chain.genesisHash });
|
|
527
|
-
onChainSwitched?.(chain);
|
|
528
|
-
} catch (error) {
|
|
529
|
-
console.error("Failed to switch chain:", error);
|
|
530
|
-
} finally {
|
|
531
|
-
setSwitchingChain(null);
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
535
|
-
/* @__PURE__ */ jsx15("div", { className: "flex items-center gap-1.5 w-full", children: FILTER_TABS.map((tab) => /* @__PURE__ */ jsx15(
|
|
536
|
-
"button",
|
|
537
|
-
{
|
|
538
|
-
onClick: () => setActiveFilter(tab.key),
|
|
539
|
-
className: cs(
|
|
540
|
-
"px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",
|
|
541
|
-
activeFilter === tab.key ? "bg-navigationButtonBackground text-modalText" : "bg-transparent text-modalTextSecondary hover:text-modalText"
|
|
542
|
-
),
|
|
543
|
-
children: tab.label
|
|
544
|
-
},
|
|
545
|
-
tab.key
|
|
546
|
-
)) }),
|
|
547
|
-
/* @__PURE__ */ jsx15("div", { className: "flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]", children: filteredChains.map((chain) => /* @__PURE__ */ jsx15(
|
|
548
|
-
ChainItem,
|
|
549
|
-
{
|
|
550
|
-
chain,
|
|
551
|
-
isSelected: chain.genesisHash === currentChain?.genesisHash,
|
|
552
|
-
onSelect: handleChainSelect,
|
|
553
|
-
isLoading: (switchingChain === chain.genesisHash || !isApiReady) && !apiError
|
|
554
|
-
},
|
|
555
|
-
chain.genesisHash
|
|
556
|
-
)) }),
|
|
557
|
-
filteredChains.length === 0 && /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsxs4("span", { className: "text-modalTextSecondary text-xs", children: [
|
|
558
|
-
"No ",
|
|
559
|
-
activeFilter === "All" /* all */ ? "chains" : activeFilter.toLowerCase(),
|
|
560
|
-
" available"
|
|
561
|
-
] }) })
|
|
562
|
-
] });
|
|
563
|
-
};
|
|
564
|
-
var ChainItem = React5.memo(({
|
|
565
|
-
chain,
|
|
566
|
-
isSelected,
|
|
567
|
-
isLoading,
|
|
568
|
-
onSelect
|
|
569
|
-
}) => {
|
|
570
|
-
return /* @__PURE__ */ jsxs4(
|
|
571
|
-
"button",
|
|
572
|
-
{
|
|
573
|
-
onClick: () => onSelect(chain),
|
|
574
|
-
disabled: isSelected || isLoading,
|
|
575
|
-
className: cs(
|
|
576
|
-
"flex items-center justify-between p-2 rounded-sm",
|
|
577
|
-
"bg-networkSelectItemBackground",
|
|
578
|
-
"transition-colors duration-200",
|
|
579
|
-
isSelected || isLoading ? "cursor-default" : "cursor-pointer hover:bg-networkSelectItemBackgroundHover",
|
|
580
|
-
isLoading && "opacity-80"
|
|
581
|
-
),
|
|
582
|
-
children: [
|
|
583
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
584
|
-
/* @__PURE__ */ jsx15(
|
|
585
|
-
ChainIcon,
|
|
586
|
-
{
|
|
587
|
-
className: "w-[24px] bg-modal-bg h-[24px] flex items-center justify-center",
|
|
588
|
-
chainIconUrl: chain?.chainIconUrl,
|
|
589
|
-
chainName: chain?.name
|
|
590
|
-
}
|
|
591
|
-
),
|
|
592
|
-
/* @__PURE__ */ jsx15("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ jsx15("span", { className: "font-medium text-base text-modalText", children: chain.name }) })
|
|
593
|
-
] }),
|
|
594
|
-
/* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-[20px]", children: isSelected ? isLoading ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
595
|
-
/* @__PURE__ */ jsx15("span", { className: "text-accentColor text-xs leading-xs mr-1.5", children: "Switching" }),
|
|
596
|
-
/* @__PURE__ */ jsx15(
|
|
597
|
-
Loading_default,
|
|
598
|
-
{
|
|
599
|
-
className: "text-accentColor animate-[spin_2s_linear_infinite]",
|
|
600
|
-
width: "15px",
|
|
601
|
-
height: "15px"
|
|
602
|
-
}
|
|
603
|
-
)
|
|
604
|
-
] }) : /* @__PURE__ */ jsxs4("span", { className: "status-dot-container", children: [
|
|
605
|
-
/* @__PURE__ */ jsx15("span", { className: "ping-animation" }),
|
|
606
|
-
/* @__PURE__ */ jsx15("span", { className: "status-dot" })
|
|
607
|
-
] }) : null })
|
|
608
|
-
]
|
|
609
|
-
}
|
|
610
|
-
);
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
// src/components/AccountDetailsModal/SwitchChainView.tsx
|
|
614
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
615
|
-
var SwitchChainView = ({ onBack }) => {
|
|
616
|
-
return /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-3.5 p-4 pt-0", children: /* @__PURE__ */ jsx16(ChainList, {}) });
|
|
617
|
-
};
|
|
618
|
-
SwitchChainView.title = "Select Networks";
|
|
619
|
-
|
|
620
|
-
// src/components/Copy/index.tsx
|
|
621
|
-
import { useCallback as useCallback3, useState as useState3 } from "react";
|
|
622
|
-
import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
623
|
-
var Copy = ({ copyText, label, className = "" }) => {
|
|
624
|
-
const [isCopied, setIsCopied] = useState3(false);
|
|
625
|
-
const copyToClipboard = useCallback3(async (text) => {
|
|
626
|
-
try {
|
|
627
|
-
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
628
|
-
await navigator.clipboard.writeText(text);
|
|
629
|
-
setIsCopied(true);
|
|
630
|
-
setTimeout(() => setIsCopied(false), 2e3);
|
|
631
|
-
return true;
|
|
632
|
-
}
|
|
633
|
-
return false;
|
|
634
|
-
} catch (err) {
|
|
635
|
-
console.error("Copy failed:", err);
|
|
636
|
-
return false;
|
|
637
|
-
}
|
|
638
|
-
}, []);
|
|
639
|
-
return /* @__PURE__ */ jsxs5(
|
|
640
|
-
"button",
|
|
641
|
-
{
|
|
642
|
-
type: "button",
|
|
643
|
-
className: cs("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1", className),
|
|
644
|
-
onClick: () => !isCopied && copyText && copyToClipboard(copyText),
|
|
645
|
-
"aria-label": "Copy address to clipboard",
|
|
646
|
-
disabled: isCopied,
|
|
647
|
-
children: [
|
|
648
|
-
isCopied ? /* @__PURE__ */ jsx17(Success_default, { className: "text-accentColor", width: 16, height: 16 }) : /* @__PURE__ */ jsx17(Copy_default, { width: 16, height: 16 }),
|
|
649
|
-
label
|
|
650
|
-
]
|
|
651
|
-
}
|
|
652
|
-
);
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
// src/components/AccountDetailsModal/index.tsx
|
|
656
|
-
import { formatAddress as formatAddress2 } from "@luno-kit/react";
|
|
657
|
-
|
|
658
|
-
// src/hooks/useAnimatedViews.ts
|
|
659
|
-
import { useCallback as useCallback4, useState as useState4, useRef } from "react";
|
|
660
|
-
function useAnimatedViews({
|
|
661
|
-
initialView,
|
|
662
|
-
animationDuration = 200,
|
|
663
|
-
animationEasing = "ease-out"
|
|
664
|
-
}) {
|
|
665
|
-
const [currentView, setCurrentView] = useState4(initialView);
|
|
666
|
-
const [isAnimating, setIsAnimating] = useState4(false);
|
|
667
|
-
const containerRef = useRef(null);
|
|
668
|
-
const currentViewRef = useRef(null);
|
|
669
|
-
const handleViewChange = useCallback4((view) => {
|
|
670
|
-
if (view === currentView || isAnimating) return;
|
|
671
|
-
setIsAnimating(true);
|
|
672
|
-
if (!containerRef.current) {
|
|
673
|
-
setCurrentView(view);
|
|
674
|
-
setIsAnimating(false);
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
const container = containerRef.current;
|
|
678
|
-
const currentHeight = container.offsetHeight;
|
|
679
|
-
setCurrentView(view);
|
|
680
|
-
requestAnimationFrame(() => {
|
|
681
|
-
if (!container || !currentViewRef.current) {
|
|
682
|
-
setIsAnimating(false);
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
const newHeight = currentViewRef.current.offsetHeight;
|
|
686
|
-
container.animate([
|
|
687
|
-
{ height: currentHeight + "px" },
|
|
688
|
-
{ height: newHeight + "px" }
|
|
689
|
-
], {
|
|
690
|
-
duration: animationDuration,
|
|
691
|
-
easing: animationEasing,
|
|
692
|
-
fill: "forwards"
|
|
693
|
-
}).addEventListener("finish", () => {
|
|
694
|
-
setIsAnimating(false);
|
|
695
|
-
});
|
|
696
|
-
});
|
|
697
|
-
}, [currentView, isAnimating, animationDuration, animationEasing]);
|
|
698
|
-
const resetView = useCallback4(() => {
|
|
699
|
-
setCurrentView(initialView);
|
|
700
|
-
setIsAnimating(false);
|
|
701
|
-
}, [initialView]);
|
|
702
|
-
return {
|
|
703
|
-
currentView,
|
|
704
|
-
isAnimating,
|
|
705
|
-
containerRef,
|
|
706
|
-
currentViewRef,
|
|
707
|
-
handleViewChange,
|
|
708
|
-
resetView
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// src/components/AccountDetailsModal/index.tsx
|
|
713
|
-
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
714
|
-
var AccountDetailsModal = () => {
|
|
715
|
-
const { isOpen, close } = useAccountModal();
|
|
716
|
-
const { address } = useAccount3();
|
|
717
|
-
const { chain } = useChain4();
|
|
718
|
-
const { data: balance } = useBalance2({ address });
|
|
719
|
-
const activeConnector = useActiveConnector2();
|
|
720
|
-
const {
|
|
721
|
-
currentView,
|
|
722
|
-
containerRef,
|
|
723
|
-
currentViewRef,
|
|
724
|
-
handleViewChange,
|
|
725
|
-
resetView
|
|
726
|
-
} = useAnimatedViews({ initialView: "main" /* main */ });
|
|
727
|
-
const handleModalClose = useCallback5(() => {
|
|
728
|
-
close();
|
|
729
|
-
resetView();
|
|
730
|
-
}, [close]);
|
|
731
|
-
const viewTitle = useMemo4(() => {
|
|
732
|
-
if (currentView === "switchAccount" /* switchAccount */) return "Switch Account";
|
|
733
|
-
if (currentView === "switchChain" /* switchChain */) return SwitchChainView.title;
|
|
734
|
-
return null;
|
|
735
|
-
}, [currentView]);
|
|
736
|
-
const viewComponents = useMemo4(() => ({
|
|
737
|
-
["main" /* main */]: /* @__PURE__ */ jsx18(
|
|
738
|
-
MainView,
|
|
739
|
-
{
|
|
740
|
-
onViewChange: handleViewChange,
|
|
741
|
-
onModalClose: handleModalClose
|
|
742
|
-
}
|
|
743
|
-
),
|
|
744
|
-
["switchAccount" /* switchAccount */]: /* @__PURE__ */ jsx18(SwitchAccountView, { onBack: () => handleViewChange("main" /* main */) }),
|
|
745
|
-
["switchChain" /* switchChain */]: /* @__PURE__ */ jsx18(SwitchChainView, { onBack: () => handleViewChange("main" /* main */) })
|
|
746
|
-
}), [handleViewChange, handleModalClose]);
|
|
747
|
-
return /* @__PURE__ */ jsx18(
|
|
748
|
-
Dialog,
|
|
749
|
-
{
|
|
750
|
-
open: isOpen,
|
|
751
|
-
onOpenChange: handleModalClose,
|
|
752
|
-
children: /* @__PURE__ */ jsxs6("div", { className: cs(
|
|
753
|
-
"flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText",
|
|
754
|
-
"bg-modalBackground shadow-modal",
|
|
755
|
-
currentView === "main" /* main */ ? "gap-6" : "gap-3.5"
|
|
756
|
-
), children: [
|
|
757
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-stretch justify-between w-full px-4 pt-4", children: [
|
|
758
|
-
currentView === "main" /* main */ ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
|
|
759
|
-
activeConnector?.icon && /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center w-[55px] h-[55px]", children: /* @__PURE__ */ jsx18("img", { src: activeConnector.icon, alt: "" }) }),
|
|
760
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-start gap-2 w-full", children: [
|
|
761
|
-
/* @__PURE__ */ jsx18(DialogTitle, { className: "sr-only", children: "Account Details" }),
|
|
762
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5 w-full", children: [
|
|
763
|
-
/* @__PURE__ */ jsx18("span", { className: "text-base text-modalText font-semibold", children: formatAddress2(address) }),
|
|
764
|
-
/* @__PURE__ */ jsx18(Copy, { copyText: address })
|
|
765
|
-
] }),
|
|
766
|
-
/* @__PURE__ */ jsx18("div", { className: "text-sm text-modalTextSecondary font-medium min-h-[20px]", children: balance === void 0 ? /* @__PURE__ */ jsx18("div", { className: "animate-pulse rounded w-[80px] h-[20px] bg-skeleton" }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
767
|
-
balance?.formattedTransferable || "0.00",
|
|
768
|
-
" ",
|
|
769
|
-
chain?.nativeCurrency?.symbol || "DOT"
|
|
770
|
-
] }) })
|
|
771
|
-
] })
|
|
772
|
-
] }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
773
|
-
/* @__PURE__ */ jsx18(
|
|
774
|
-
"button",
|
|
775
|
-
{
|
|
776
|
-
className: "flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
|
|
777
|
-
onClick: () => handleViewChange("main" /* main */),
|
|
778
|
-
"aria-label": "Back",
|
|
779
|
-
children: /* @__PURE__ */ jsx18(Back_default, {})
|
|
780
|
-
}
|
|
781
|
-
),
|
|
782
|
-
/* @__PURE__ */ jsx18(
|
|
783
|
-
DialogTitle,
|
|
784
|
-
{
|
|
785
|
-
className: "text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",
|
|
786
|
-
children: viewTitle
|
|
787
|
-
}
|
|
788
|
-
)
|
|
789
|
-
] }),
|
|
790
|
-
/* @__PURE__ */ jsx18(DialogClose, { className: "z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer", children: /* @__PURE__ */ jsx18(Close_default, {}) })
|
|
791
|
-
] }),
|
|
792
|
-
/* @__PURE__ */ jsx18(
|
|
793
|
-
"div",
|
|
794
|
-
{
|
|
795
|
-
ref: containerRef,
|
|
796
|
-
className: "relative overflow-hidden",
|
|
797
|
-
children: /* @__PURE__ */ jsx18("div", { ref: currentViewRef, children: viewComponents[currentView] })
|
|
798
|
-
}
|
|
799
|
-
)
|
|
800
|
-
] })
|
|
801
|
-
}
|
|
802
|
-
);
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
// src/components/ChainModal/index.tsx
|
|
806
|
-
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
807
|
-
var ChainModal = () => {
|
|
808
|
-
const { isOpen, close } = useChainModal();
|
|
809
|
-
return /* @__PURE__ */ jsx19(Dialog, { open: isOpen, onOpenChange: (open) => !open && close(), children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText", children: [
|
|
810
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between w-full", children: [
|
|
811
|
-
/* @__PURE__ */ jsx19("div", { className: "w-[30px]" }),
|
|
812
|
-
" ",
|
|
813
|
-
/* @__PURE__ */ jsx19(DialogTitle, { className: "text-lg leading-lg text-modalText font-semibold transition-opacity duration-300", children: "Select Network" }),
|
|
814
|
-
/* @__PURE__ */ jsx19(DialogClose, { className: "z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer", children: /* @__PURE__ */ jsx19(Close_default, {}) })
|
|
815
|
-
] }),
|
|
816
|
-
/* @__PURE__ */ jsx19(ChainList, {})
|
|
817
|
-
] }) });
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
// src/components/ConnectModal/index.tsx
|
|
821
|
-
import { useEffect as useEffect4, useMemo as useMemo5, useState as useState7 } from "react";
|
|
822
|
-
import { useConnect, isMobileDevice as isMobileDevice2 } from "@luno-kit/react";
|
|
823
|
-
|
|
824
|
-
// src/hooks/useConnectButton.ts
|
|
825
|
-
import {
|
|
826
|
-
useStatus as useStatus2,
|
|
827
|
-
useAccount as useAccount4,
|
|
828
|
-
useChain as useChain5,
|
|
829
|
-
useBalance as useBalance3,
|
|
830
|
-
ConnectionStatus as ConnectionStatus2,
|
|
831
|
-
useChains as useChains2,
|
|
832
|
-
useActiveConnector as useActiveConnector3,
|
|
833
|
-
formatAddress as formatAddress3
|
|
834
|
-
} from "@luno-kit/react";
|
|
835
|
-
function useLunoWallet() {
|
|
836
|
-
const connectionStatus = useStatus2();
|
|
837
|
-
const { account, address } = useAccount4();
|
|
838
|
-
const { chain: currentChain } = useChain5();
|
|
839
|
-
const configuredChains = useChains2();
|
|
840
|
-
const { data: balance } = useBalance3({ address });
|
|
841
|
-
const activeConnector = useActiveConnector3();
|
|
842
|
-
const { open: openConnectModal, isOpen: isConnectModalOpen } = useConnectModal();
|
|
843
|
-
const { open: openAccountModal, isOpen: isAccountModalOpen } = useAccountModal();
|
|
844
|
-
const { open: openChainModal, isOpen: isChainModalOpen } = useChainModal();
|
|
845
|
-
const isConnecting = connectionStatus === ConnectionStatus2.Connecting;
|
|
846
|
-
const isConnected = connectionStatus === ConnectionStatus2.Connected;
|
|
847
|
-
const isDisconnected = connectionStatus === ConnectionStatus2.Disconnected || connectionStatus === ConnectionStatus2.Disconnecting;
|
|
848
|
-
const isChainSupported = !!currentChain && configuredChains.some((c) => c.genesisHash.toLowerCase() === currentChain.genesisHash.toLowerCase());
|
|
849
|
-
return {
|
|
850
|
-
activeConnector,
|
|
851
|
-
connectionStatus,
|
|
852
|
-
isConnected,
|
|
853
|
-
isDisconnected,
|
|
854
|
-
isConnecting,
|
|
855
|
-
account,
|
|
856
|
-
address,
|
|
857
|
-
displayAddress: formatAddress3(address),
|
|
858
|
-
currentChain,
|
|
859
|
-
configuredChains,
|
|
860
|
-
isChainSupported,
|
|
861
|
-
chainIconUrl: currentChain?.chainIconUrl,
|
|
862
|
-
chainName: currentChain?.name,
|
|
863
|
-
balance,
|
|
864
|
-
openConnectModal,
|
|
865
|
-
openAccountModal,
|
|
866
|
-
openChainModal,
|
|
867
|
-
isConnectModalOpen,
|
|
868
|
-
isAccountModalOpen,
|
|
869
|
-
isChainModalOpen
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
// src/hooks/useWindowSize.ts
|
|
874
|
-
import { useEffect as useEffect2, useState as useState6 } from "react";
|
|
875
|
-
var useWindowSize = () => {
|
|
876
|
-
const [windowSize, setWindowSize] = useState6({
|
|
877
|
-
height: void 0,
|
|
878
|
-
width: void 0
|
|
879
|
-
});
|
|
880
|
-
useEffect2(() => {
|
|
881
|
-
const handleResize = debounce(() => {
|
|
882
|
-
setWindowSize({
|
|
883
|
-
height: window.innerHeight,
|
|
884
|
-
width: window.innerWidth
|
|
885
|
-
});
|
|
886
|
-
}, 500);
|
|
887
|
-
window.addEventListener("resize", handleResize);
|
|
888
|
-
handleResize();
|
|
889
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
890
|
-
}, []);
|
|
891
|
-
return windowSize;
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
// src/components/ConnectModal/WalletView.tsx
|
|
895
|
-
import React10 from "react";
|
|
896
|
-
|
|
897
|
-
// src/components/QRCode/index.tsx
|
|
898
|
-
import { Cuer } from "cuer";
|
|
899
|
-
import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
900
|
-
var QRCode = ({
|
|
901
|
-
logoBackground,
|
|
902
|
-
uri,
|
|
903
|
-
size
|
|
904
|
-
}) => {
|
|
905
|
-
if (!uri) {
|
|
906
|
-
const QR_GRID_SIZE = 57;
|
|
907
|
-
const FINDER_SIZE_WITH_MARGIN = 8;
|
|
908
|
-
const ARENA_GRID_SIZE = Math.floor(QR_GRID_SIZE / 4);
|
|
909
|
-
const cellSize = size / QR_GRID_SIZE;
|
|
910
|
-
const arenaSize = ARENA_GRID_SIZE * cellSize;
|
|
911
|
-
const arenaStart = Math.floor(QR_GRID_SIZE / 2 - ARENA_GRID_SIZE / 2);
|
|
912
|
-
const arenaEnd = arenaStart + ARENA_GRID_SIZE;
|
|
913
|
-
const generateSkeletonDots = () => {
|
|
914
|
-
const dots = [];
|
|
915
|
-
for (let i = 0; i < QR_GRID_SIZE; i++) {
|
|
916
|
-
for (let j = 0; j < QR_GRID_SIZE; j++) {
|
|
917
|
-
if (i >= arenaStart && i <= arenaEnd && j >= arenaStart && j <= arenaEnd) continue;
|
|
918
|
-
const isInFinder = i < FINDER_SIZE_WITH_MARGIN && j < FINDER_SIZE_WITH_MARGIN || i < FINDER_SIZE_WITH_MARGIN && j >= QR_GRID_SIZE - FINDER_SIZE_WITH_MARGIN || i >= QR_GRID_SIZE - FINDER_SIZE_WITH_MARGIN && j < FINDER_SIZE_WITH_MARGIN;
|
|
919
|
-
if (isInFinder) continue;
|
|
920
|
-
const cx = j + 0.5;
|
|
921
|
-
const cy = i + 0.5;
|
|
922
|
-
dots.push(
|
|
923
|
-
/* @__PURE__ */ jsx20(
|
|
924
|
-
"rect",
|
|
925
|
-
{
|
|
926
|
-
x: cx - 0.4,
|
|
927
|
-
y: cy - 0.4,
|
|
928
|
-
width: 0.8,
|
|
929
|
-
height: 0.8,
|
|
930
|
-
rx: 0.4,
|
|
931
|
-
fill: "var(--color-walletSelectItemBackground)"
|
|
932
|
-
},
|
|
933
|
-
`${i}-${j}`
|
|
934
|
-
)
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
return dots;
|
|
939
|
-
};
|
|
940
|
-
const renderFinderPattern = ({ position }) => {
|
|
941
|
-
const finderSize = 7 * cellSize;
|
|
942
|
-
const positionStyles = {
|
|
943
|
-
"top-left": { top: 0, left: 0 },
|
|
944
|
-
"top-right": { top: 0, right: 0 },
|
|
945
|
-
"bottom-left": { bottom: 0, left: 0 }
|
|
946
|
-
};
|
|
947
|
-
return /* @__PURE__ */ jsxs8(
|
|
948
|
-
"div",
|
|
949
|
-
{
|
|
950
|
-
className: "absolute z-[4]",
|
|
951
|
-
style: {
|
|
952
|
-
width: `${finderSize}px`,
|
|
953
|
-
height: `${finderSize}px`,
|
|
954
|
-
...positionStyles[position]
|
|
955
|
-
},
|
|
956
|
-
children: [
|
|
957
|
-
/* @__PURE__ */ jsx20(
|
|
958
|
-
"div",
|
|
959
|
-
{
|
|
960
|
-
className: "absolute inset-0",
|
|
961
|
-
style: {
|
|
962
|
-
borderRadius: `${2 * cellSize}px`,
|
|
963
|
-
border: `${cellSize}px solid var(--color-walletSelectItemBackground)`
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
),
|
|
967
|
-
/* @__PURE__ */ jsx20(
|
|
968
|
-
"div",
|
|
969
|
-
{
|
|
970
|
-
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
971
|
-
style: {
|
|
972
|
-
width: `${3 * cellSize}px`,
|
|
973
|
-
height: `${3 * cellSize}px`,
|
|
974
|
-
borderRadius: `${0.5 * cellSize}px`,
|
|
975
|
-
backgroundColor: "var(--color-walletSelectItemBackground)"
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
)
|
|
979
|
-
]
|
|
980
|
-
}
|
|
981
|
-
);
|
|
982
|
-
};
|
|
983
|
-
const renderArenaLogo = () => {
|
|
984
|
-
const logoStart = Math.ceil(QR_GRID_SIZE / 2 - ARENA_GRID_SIZE / 2) * cellSize;
|
|
985
|
-
return /* @__PURE__ */ jsx20(
|
|
986
|
-
"div",
|
|
987
|
-
{
|
|
988
|
-
className: "absolute z-[4] flex items-center justify-center box-border",
|
|
989
|
-
style: {
|
|
990
|
-
width: `${arenaSize}px`,
|
|
991
|
-
height: `${arenaSize}px`,
|
|
992
|
-
left: `${logoStart}px`,
|
|
993
|
-
top: `${logoStart}px`,
|
|
994
|
-
borderRadius: `${cellSize}px`,
|
|
995
|
-
padding: `${cellSize / 2}px`
|
|
996
|
-
},
|
|
997
|
-
children: /* @__PURE__ */ jsx20(
|
|
998
|
-
"img",
|
|
999
|
-
{
|
|
1000
|
-
src: logoBackground,
|
|
1001
|
-
alt: "QR Code Logo",
|
|
1002
|
-
className: "h-full w-full object-cover",
|
|
1003
|
-
style: {
|
|
1004
|
-
borderRadius: `${cellSize}px`
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
)
|
|
1008
|
-
}
|
|
1009
|
-
);
|
|
1010
|
-
};
|
|
1011
|
-
return /* @__PURE__ */ jsxs8(
|
|
1012
|
-
"div",
|
|
1013
|
-
{
|
|
1014
|
-
className: "relative overflow-hidden flex items-center justify-center",
|
|
1015
|
-
style: {
|
|
1016
|
-
width: size,
|
|
1017
|
-
height: size,
|
|
1018
|
-
borderRadius: `${2 * cellSize}px`
|
|
1019
|
-
},
|
|
1020
|
-
children: [
|
|
1021
|
-
/* @__PURE__ */ jsx20(
|
|
1022
|
-
"svg",
|
|
1023
|
-
{
|
|
1024
|
-
className: "absolute inset-0 z-[3]",
|
|
1025
|
-
width: size,
|
|
1026
|
-
height: size,
|
|
1027
|
-
viewBox: `0 0 ${QR_GRID_SIZE} ${QR_GRID_SIZE}`,
|
|
1028
|
-
children: generateSkeletonDots()
|
|
1029
|
-
}
|
|
1030
|
-
),
|
|
1031
|
-
/* @__PURE__ */ jsx20(
|
|
1032
|
-
"div",
|
|
1033
|
-
{
|
|
1034
|
-
className: "absolute inset-0 z-[100]",
|
|
1035
|
-
style: {
|
|
1036
|
-
background: "linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",
|
|
1037
|
-
backgroundSize: "200% 100%",
|
|
1038
|
-
transform: "scale(1.5) rotate(45deg)",
|
|
1039
|
-
animation: "shimmer 1000ms linear infinite both"
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
),
|
|
1043
|
-
renderFinderPattern({ position: "top-left" }),
|
|
1044
|
-
renderFinderPattern({ position: "top-right" }),
|
|
1045
|
-
renderFinderPattern({ position: "bottom-left" }),
|
|
1046
|
-
logoBackground && renderArenaLogo()
|
|
1047
|
-
]
|
|
1048
|
-
}
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
return /* @__PURE__ */ jsx20(Cuer, { arena: logoBackground, value: uri });
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
|
-
// src/components/ConnectButton/index.tsx
|
|
1055
|
-
import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1056
|
-
var transitionClassName = "transition-transform transition-[125] hover:scale-[1.03] transition-ease";
|
|
1057
|
-
var ConnectButton = ({
|
|
1058
|
-
className,
|
|
1059
|
-
label = "Connect Wallet",
|
|
1060
|
-
accountStatus = "full",
|
|
1061
|
-
chainStatus = "full",
|
|
1062
|
-
showBalance = true
|
|
1063
|
-
}) => {
|
|
1064
|
-
const {
|
|
1065
|
-
isConnected,
|
|
1066
|
-
isDisconnected,
|
|
1067
|
-
displayAddress,
|
|
1068
|
-
balance,
|
|
1069
|
-
openConnectModal,
|
|
1070
|
-
openAccountModal,
|
|
1071
|
-
openChainModal,
|
|
1072
|
-
chainIconUrl,
|
|
1073
|
-
chainName,
|
|
1074
|
-
currentChain,
|
|
1075
|
-
activeConnector
|
|
1076
|
-
} = useLunoWallet();
|
|
1077
|
-
const { width: windowWidth } = useWindowSize();
|
|
1078
|
-
const isLargeWindow = windowWidth && windowWidth > 768;
|
|
1079
|
-
if (isDisconnected || !isConnected || !activeConnector) {
|
|
1080
|
-
return /* @__PURE__ */ jsx21(
|
|
1081
|
-
"button",
|
|
1082
|
-
{
|
|
1083
|
-
type: "button",
|
|
1084
|
-
onClick: () => openConnectModal?.(),
|
|
1085
|
-
className: cs(
|
|
1086
|
-
"cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none",
|
|
1087
|
-
"text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]",
|
|
1088
|
-
"rounded-connectButton",
|
|
1089
|
-
transitionClassName,
|
|
1090
|
-
"px-3.5 text-base leading-base min-h-[40px]",
|
|
1091
|
-
className
|
|
1092
|
-
),
|
|
1093
|
-
children: label
|
|
1094
|
-
}
|
|
1095
|
-
);
|
|
1096
|
-
}
|
|
1097
|
-
return /* @__PURE__ */ jsxs9("div", { className: cs("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3", className), children: [
|
|
1098
|
-
chainStatus !== "none" && /* @__PURE__ */ jsxs9(
|
|
1099
|
-
"button",
|
|
1100
|
-
{
|
|
1101
|
-
type: "button",
|
|
1102
|
-
onClick: () => openChainModal?.(),
|
|
1103
|
-
className: cs(
|
|
1104
|
-
"flex items-center rounded-currentNetworkButton cursor-pointer",
|
|
1105
|
-
"bg-currentNetworkButtonBackground shadow-button",
|
|
1106
|
-
"py-2 px-2.5 gap-1.5",
|
|
1107
|
-
transitionClassName
|
|
1108
|
-
),
|
|
1109
|
-
"aria-label": "Switch chain",
|
|
1110
|
-
children: [
|
|
1111
|
-
chainStatus === "full" || chainStatus === "icon" ? /* @__PURE__ */ jsx21(ChainIcon, { chainIconUrl, chainName, className: "w-[24px] h-[24px]" }) : null,
|
|
1112
|
-
(chainStatus === "full" || chainStatus === "name") && isLargeWindow && /* @__PURE__ */ jsx21("span", { children: currentChain?.name || "Unknown Chain" })
|
|
1113
|
-
]
|
|
1114
|
-
}
|
|
1115
|
-
),
|
|
1116
|
-
/* @__PURE__ */ jsxs9(
|
|
1117
|
-
"button",
|
|
1118
|
-
{
|
|
1119
|
-
type: "button",
|
|
1120
|
-
onClick: () => openAccountModal?.(),
|
|
1121
|
-
className: cs(
|
|
1122
|
-
"flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",
|
|
1123
|
-
transitionClassName
|
|
1124
|
-
),
|
|
1125
|
-
"aria-label": "Open account modal",
|
|
1126
|
-
children: [
|
|
1127
|
-
showBalance && isLargeWindow && /* @__PURE__ */ jsx21("div", { className: "p-2 pl-3", children: balance === void 0 ? /* @__PURE__ */ jsx21("div", { className: "animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover" }) : /* @__PURE__ */ jsxs9("span", { className: "", children: [
|
|
1128
|
-
balance?.formattedTransferable || balance?.formattedTotal || 0,
|
|
1129
|
-
" ",
|
|
1130
|
-
currentChain?.nativeCurrency?.symbol || ""
|
|
1131
|
-
] }) }),
|
|
1132
|
-
/* @__PURE__ */ jsxs9("div", { className: cs(
|
|
1133
|
-
"flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",
|
|
1134
|
-
showBalance && isLargeWindow ? "bg-connectButtonInnerBackground py-1.5 px-2" : "bg-connectButtonBackground py-2 px-2.5"
|
|
1135
|
-
), children: [
|
|
1136
|
-
accountStatus === "full" && /* @__PURE__ */ jsx21("span", { className: "w-[24px] h-[24px]", children: /* @__PURE__ */ jsx21("img", { src: activeConnector.icon, alt: "luno" }) }),
|
|
1137
|
-
/* @__PURE__ */ jsx21(
|
|
1138
|
-
"span",
|
|
1139
|
-
{
|
|
1140
|
-
"aria-label": "Wallet icon placeholder",
|
|
1141
|
-
className: "",
|
|
1142
|
-
children: displayAddress
|
|
1143
|
-
}
|
|
1144
|
-
)
|
|
1145
|
-
] })
|
|
1146
|
-
]
|
|
1147
|
-
}
|
|
1148
|
-
)
|
|
1149
|
-
] });
|
|
1150
|
-
};
|
|
1151
|
-
|
|
1152
|
-
// src/components/SpiralAnimation/index.tsx
|
|
1153
|
-
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
1154
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1155
|
-
var SpiralAnimation = ({
|
|
1156
|
-
size = 160,
|
|
1157
|
-
dotCount = 300,
|
|
1158
|
-
duration = 3,
|
|
1159
|
-
className = ""
|
|
1160
|
-
}) => {
|
|
1161
|
-
const containerRef = useRef3(null);
|
|
1162
|
-
useEffect3(() => {
|
|
1163
|
-
if (!containerRef.current) return;
|
|
1164
|
-
const DOT_RADIUS = 1;
|
|
1165
|
-
const MARGIN = 2;
|
|
1166
|
-
const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
|
|
1167
|
-
const CENTER = size / 2;
|
|
1168
|
-
const MAX_RADIUS = CENTER - MARGIN - DOT_RADIUS;
|
|
1169
|
-
const svgNS = "http://www.w3.org/2000/svg";
|
|
1170
|
-
containerRef.current.innerHTML = "";
|
|
1171
|
-
const svg = document.createElementNS(svgNS, "svg");
|
|
1172
|
-
svg.setAttribute("width", size.toString());
|
|
1173
|
-
svg.setAttribute("height", size.toString());
|
|
1174
|
-
svg.setAttribute("viewBox", `0 0 ${size} ${size}`);
|
|
1175
|
-
svg.style.display = "block";
|
|
1176
|
-
containerRef.current.appendChild(svg);
|
|
1177
|
-
for (let i = 0; i < dotCount; i++) {
|
|
1178
|
-
const idx = i + 0.5;
|
|
1179
|
-
const frac = idx / dotCount;
|
|
1180
|
-
const r = Math.sqrt(frac) * MAX_RADIUS;
|
|
1181
|
-
const theta = idx * GOLDEN_ANGLE;
|
|
1182
|
-
const x = CENTER + r * Math.cos(theta);
|
|
1183
|
-
const y = CENTER + r * Math.sin(theta);
|
|
1184
|
-
const circle = document.createElementNS(svgNS, "circle");
|
|
1185
|
-
circle.setAttribute("cx", x.toString());
|
|
1186
|
-
circle.setAttribute("cy", y.toString());
|
|
1187
|
-
circle.setAttribute("r", DOT_RADIUS.toString());
|
|
1188
|
-
circle.setAttribute("fill", "currentColor");
|
|
1189
|
-
circle.setAttribute("opacity", "0.6");
|
|
1190
|
-
svg.appendChild(circle);
|
|
1191
|
-
const animR = document.createElementNS(svgNS, "animate");
|
|
1192
|
-
animR.setAttribute("attributeName", "r");
|
|
1193
|
-
animR.setAttribute(
|
|
1194
|
-
"values",
|
|
1195
|
-
`${DOT_RADIUS * 0.5};${DOT_RADIUS * 1.8};${DOT_RADIUS * 0.5}`
|
|
1196
|
-
);
|
|
1197
|
-
animR.setAttribute("dur", `${duration}s`);
|
|
1198
|
-
animR.setAttribute("begin", `${frac * duration}s`);
|
|
1199
|
-
animR.setAttribute("repeatCount", "indefinite");
|
|
1200
|
-
animR.setAttribute("calcMode", "spline");
|
|
1201
|
-
animR.setAttribute("keySplines", "0.4 0 0.6 1;0.4 0 0.6 1");
|
|
1202
|
-
circle.appendChild(animR);
|
|
1203
|
-
const animO = document.createElementNS(svgNS, "animate");
|
|
1204
|
-
animO.setAttribute("attributeName", "opacity");
|
|
1205
|
-
animO.setAttribute("values", "0.2;1;0.2");
|
|
1206
|
-
animO.setAttribute("dur", `${duration}s`);
|
|
1207
|
-
animO.setAttribute("begin", `${frac * duration}s`);
|
|
1208
|
-
animO.setAttribute("repeatCount", "indefinite");
|
|
1209
|
-
animO.setAttribute("calcMode", "spline");
|
|
1210
|
-
animO.setAttribute("keySplines", "0.4 0 0.6 1;0.4 0 0.6 1");
|
|
1211
|
-
circle.appendChild(animO);
|
|
1212
|
-
}
|
|
1213
|
-
}, [size, dotCount, duration]);
|
|
1214
|
-
return /* @__PURE__ */ jsx22(
|
|
1215
|
-
"div",
|
|
1216
|
-
{
|
|
1217
|
-
ref: containerRef,
|
|
1218
|
-
className: cs("text-accentColor inline-flex w-full h-full justify-center align-center", className)
|
|
1219
|
-
}
|
|
1220
|
-
);
|
|
1221
|
-
};
|
|
1222
|
-
|
|
1223
|
-
// src/components/ConnectModal/WalletView.tsx
|
|
1224
|
-
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1225
|
-
var WalletView = React10.memo(({ selectedConnector, onConnect, qrCode, isWide, connectState }) => {
|
|
1226
|
-
const showQRCode = selectedConnector?.hasConnectionUri();
|
|
1227
|
-
return /* @__PURE__ */ jsxs10("div", { className: cs(
|
|
1228
|
-
"flex flex-col items-center",
|
|
1229
|
-
isWide ? "w-[400px] p-4 min-h-[472px]" : "justify-center w-full min-h-[400px]"
|
|
1230
|
-
), children: [
|
|
1231
|
-
isWide && /* @__PURE__ */ jsx23("div", { className: "w-full", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
|
|
1232
|
-
/* @__PURE__ */ jsx23("div", {}),
|
|
1233
|
-
/* @__PURE__ */ jsx23(
|
|
1234
|
-
DialogClose,
|
|
1235
|
-
{
|
|
1236
|
-
className: "z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
|
|
1237
|
-
children: /* @__PURE__ */ jsx23(Close_default, {})
|
|
1238
|
-
}
|
|
1239
|
-
)
|
|
1240
|
-
] }) }),
|
|
1241
|
-
/* @__PURE__ */ jsx23("div", { className: cs(
|
|
1242
|
-
"flex items-center py-12 flex-col grow justify-start",
|
|
1243
|
-
selectedConnector && showQRCode ? "max-w-[220px]" : "max-w-[360px]"
|
|
1244
|
-
), children: selectedConnector ? showQRCode ? /* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center gap-4", children: [
|
|
1245
|
-
/* @__PURE__ */ jsx23(QRCode, { size: 220, logoBackground: selectedConnector.icon, uri: qrCode }),
|
|
1246
|
-
/* @__PURE__ */ jsxs10("div", { className: "text-secondaryFont leading-secondary font-[500] text-center", children: [
|
|
1247
|
-
"Scan the QR Code with ",
|
|
1248
|
-
selectedConnector.id === "nova" ? "the Nova app" : "your phone"
|
|
1249
|
-
] }),
|
|
1250
|
-
selectedConnector.links?.browserExtension ? /* @__PURE__ */ jsxs10(
|
|
1251
|
-
"p",
|
|
1252
|
-
{
|
|
1253
|
-
onClick: () => window.open(selectedConnector.links.browserExtension),
|
|
1254
|
-
className: "cursor-pointer pt-[16px] text-base leading-base text-accentColor font-bold text-center",
|
|
1255
|
-
children: [
|
|
1256
|
-
"Don\u2018t have ",
|
|
1257
|
-
selectedConnector.name,
|
|
1258
|
-
"?"
|
|
1259
|
-
]
|
|
1260
|
-
}
|
|
1261
|
-
) : qrCode ? /* @__PURE__ */ jsx23(Copy, { className: "text-sm leading-sm text-accentColor", copyText: qrCode, label: "Copy Link" }) : null
|
|
1262
|
-
] }) : /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
1263
|
-
/* @__PURE__ */ jsx23("div", { className: "w-[102px] h-[102px] pb-[16px]", children: /* @__PURE__ */ jsx23("img", { src: selectedConnector.icon, className: "w-full h-full", alt: "" }) }),
|
|
1264
|
-
/* @__PURE__ */ jsxs10("p", { className: "pb-[10px] text-primary leading-primary text-modalFont font-[600]", children: [
|
|
1265
|
-
"Opening ",
|
|
1266
|
-
selectedConnector.name,
|
|
1267
|
-
"..."
|
|
1268
|
-
] }),
|
|
1269
|
-
/* @__PURE__ */ jsx23("p", { className: "pb-[10px] text-secondaryFont text-secondary leading-secondary font-[500] text-center", children: "Confirm connection in the extension" }),
|
|
1270
|
-
connectState.isConnecting && /* @__PURE__ */ jsx23(Loading_default, { className: "w-[24px] h-[24px] text-secondaryFont animate-[spin_3s_linear_infinite]" }),
|
|
1271
|
-
!selectedConnector.isInstalled() && selectedConnector.links.browserExtension && /* @__PURE__ */ jsxs10(
|
|
1272
|
-
"p",
|
|
1273
|
-
{
|
|
1274
|
-
onClick: () => window.open(selectedConnector.links.browserExtension),
|
|
1275
|
-
className: "cursor-pointer pt-[16px] text-base leading-base text-accentColor font-bold text-center",
|
|
1276
|
-
children: [
|
|
1277
|
-
"Don\u2018t have ",
|
|
1278
|
-
selectedConnector.name,
|
|
1279
|
-
"?"
|
|
1280
|
-
]
|
|
1281
|
-
}
|
|
1282
|
-
),
|
|
1283
|
-
!connectState.isConnecting && connectState.isError && selectedConnector.isInstalled() && /* @__PURE__ */ jsx23(
|
|
1284
|
-
"button",
|
|
1285
|
-
{
|
|
1286
|
-
className: cs(
|
|
1287
|
-
"rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-[600] text-primaryFont bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",
|
|
1288
|
-
transitionClassName
|
|
1289
|
-
),
|
|
1290
|
-
onClick: () => onConnect(selectedConnector),
|
|
1291
|
-
children: "Retry"
|
|
1292
|
-
}
|
|
1293
|
-
)
|
|
1294
|
-
] }) : /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
1295
|
-
/* @__PURE__ */ jsx23("div", { className: "w-[160px] h-[160px] mb-4", children: /* @__PURE__ */ jsx23(SpiralAnimation, {}) }),
|
|
1296
|
-
/* @__PURE__ */ jsx23("p", { className: "cursor-pointer pb-[16px] text-base leading-base text-accentColor font-bold text-center", children: "New to wallets?" }),
|
|
1297
|
-
/* @__PURE__ */ jsx23("p", { className: "text-modalTextSecondary text-sm leading-sm font-medium text-center", children: "Your gateway to the decentralized world Connect a wallet to get started" })
|
|
1298
|
-
] }) }),
|
|
1299
|
-
/* @__PURE__ */ jsx23("div", {})
|
|
1300
|
-
] });
|
|
1301
|
-
});
|
|
1302
|
-
|
|
1303
|
-
// src/components/ConnectModal/ConnectOptions.tsx
|
|
1304
|
-
import React11 from "react";
|
|
1305
|
-
import { useConnectors, isMobileDevice } from "@luno-kit/react";
|
|
1306
|
-
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1307
|
-
var ConnectOptions = React11.memo(({ onConnect }) => {
|
|
1308
|
-
const connectors = useConnectors();
|
|
1309
|
-
if (isMobileDevice()) {
|
|
1310
|
-
const filteredConnectors = connectors.filter((i) => i.links.deepLink);
|
|
1311
|
-
return /* @__PURE__ */ jsx24("div", { className: "flex flex-col items-start gap-1 w-full", children: filteredConnectors.map((i) => /* @__PURE__ */ jsx24(ConnectorItem, { connector: i, onConnect: () => onConnect(i) }, `${i.id}-${i.name}`)) });
|
|
1312
|
-
}
|
|
1313
|
-
const installedConnectors = connectors.filter((c) => c.isInstalled());
|
|
1314
|
-
const moreConnectors = connectors.filter((c) => !c.isInstalled());
|
|
1315
|
-
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-start gap-4 w-full", children: [
|
|
1316
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-start gap-3 w-full", children: [
|
|
1317
|
-
/* @__PURE__ */ jsx24("div", { className: "text-base text-modalText font-semibold leading-base", children: "Installed" }),
|
|
1318
|
-
/* @__PURE__ */ jsx24("div", { className: "flex flex-col items-start gap-1.5 w-full", children: installedConnectors.map((i) => /* @__PURE__ */ jsx24(ConnectorItem, { connector: i, onConnect: () => onConnect(i) }, i.id)) })
|
|
1319
|
-
] }),
|
|
1320
|
-
moreConnectors.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-start gap-3 w-full", children: [
|
|
1321
|
-
/* @__PURE__ */ jsx24("div", { className: "text-base text-modalText font-semibold leading-base", children: "More" }),
|
|
1322
|
-
/* @__PURE__ */ jsx24("div", { className: "flex flex-col items-start gap-1 w-full", children: moreConnectors.map((i) => /* @__PURE__ */ jsx24(ConnectorItem, { connector: i, onConnect: () => onConnect(i) }, i.id)) })
|
|
1323
|
-
] })
|
|
1324
|
-
] });
|
|
1325
|
-
});
|
|
1326
|
-
var ConnectorItem = React11.memo(({ connector, onConnect }) => {
|
|
1327
|
-
return /* @__PURE__ */ jsxs11(
|
|
1328
|
-
"button",
|
|
1329
|
-
{
|
|
1330
|
-
onClick: onConnect,
|
|
1331
|
-
className: cs(
|
|
1332
|
-
"cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none",
|
|
1333
|
-
"hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]",
|
|
1334
|
-
"text-left"
|
|
1335
|
-
),
|
|
1336
|
-
children: [
|
|
1337
|
-
/* @__PURE__ */ jsx24("div", { className: "w-[24px] h-[24px]", children: /* @__PURE__ */ jsx24(
|
|
1338
|
-
"img",
|
|
1339
|
-
{
|
|
1340
|
-
src: connector.icon,
|
|
1341
|
-
alt: connector.name,
|
|
1342
|
-
className: "w-full h-full"
|
|
1343
|
-
}
|
|
1344
|
-
) }),
|
|
1345
|
-
/* @__PURE__ */ jsx24("span", { className: "font-semibold leading-base text-base text-modalText", children: connector.name })
|
|
1346
|
-
]
|
|
1347
|
-
}
|
|
1348
|
-
);
|
|
1349
|
-
});
|
|
1350
|
-
|
|
1351
|
-
// src/components/ConnectModal/index.tsx
|
|
1352
|
-
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1353
|
-
var ConnectModal = ({
|
|
1354
|
-
size = "wide"
|
|
1355
|
-
}) => {
|
|
1356
|
-
const { isOpen, close } = useConnectModal();
|
|
1357
|
-
const { connectAsync, reset: resetConnect, isPending: isConnecting, isError: connectError } = useConnect();
|
|
1358
|
-
const [selectedConnector, setSelectedConnector] = useState7(null);
|
|
1359
|
-
const [qrCode, setQrCode] = useState7();
|
|
1360
|
-
const { width: windowWidth } = useWindowSize();
|
|
1361
|
-
const isLargeWindow = windowWidth && windowWidth > 768;
|
|
1362
|
-
const isWide = !!(size === "wide" && isLargeWindow);
|
|
1363
|
-
const {
|
|
1364
|
-
containerRef,
|
|
1365
|
-
currentViewRef,
|
|
1366
|
-
resetView,
|
|
1367
|
-
handleViewChange,
|
|
1368
|
-
currentView
|
|
1369
|
-
} = useAnimatedViews({ initialView: "Connect Wallet" /* connectOptions */ });
|
|
1370
|
-
const onQrCode = async (connector) => {
|
|
1371
|
-
const uri = await connector.getConnectionUri();
|
|
1372
|
-
setQrCode(uri);
|
|
1373
|
-
};
|
|
1374
|
-
const handleConnect = async (connector) => {
|
|
1375
|
-
if (isMobileDevice2() && connector.links.deepLink) {
|
|
1376
|
-
try {
|
|
1377
|
-
await connectAsync({ connectorId: connector.id });
|
|
1378
|
-
_onOpenChange(false);
|
|
1379
|
-
return;
|
|
1380
|
-
} catch (error) {
|
|
1381
|
-
window.location.href = `${connector.links.deepLink}?url=${window.location.href}`;
|
|
1382
|
-
return;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
!isWide && handleViewChange("walletView" /* walletView */);
|
|
1386
|
-
setSelectedConnector(connector);
|
|
1387
|
-
setQrCode(void 0);
|
|
1388
|
-
if (connector.hasConnectionUri()) {
|
|
1389
|
-
onQrCode(connector);
|
|
1390
|
-
}
|
|
1391
|
-
await connectAsync({ connectorId: connector.id });
|
|
1392
|
-
_onOpenChange(false);
|
|
1393
|
-
};
|
|
1394
|
-
const _onOpenChange = (open) => {
|
|
1395
|
-
!open && close();
|
|
1396
|
-
resetConnect();
|
|
1397
|
-
resetView();
|
|
1398
|
-
setSelectedConnector(null);
|
|
1399
|
-
setQrCode(void 0);
|
|
1400
|
-
};
|
|
1401
|
-
const viewComponents = useMemo5(() => {
|
|
1402
|
-
return {
|
|
1403
|
-
["Connect Wallet" /* connectOptions */]: /* @__PURE__ */ jsx25(ConnectOptions, { onConnect: handleConnect }),
|
|
1404
|
-
["walletView" /* walletView */]: /* @__PURE__ */ jsx25(
|
|
1405
|
-
WalletView,
|
|
1406
|
-
{
|
|
1407
|
-
connectState: { isConnecting, isError: connectError },
|
|
1408
|
-
isWide,
|
|
1409
|
-
selectedConnector,
|
|
1410
|
-
qrCode,
|
|
1411
|
-
onConnect: handleConnect
|
|
1412
|
-
}
|
|
1413
|
-
)
|
|
1414
|
-
};
|
|
1415
|
-
}, [isWide, selectedConnector, qrCode, handleConnect, isConnecting, connectError]);
|
|
1416
|
-
useEffect4(() => {
|
|
1417
|
-
if (isWide && currentView === "walletView" /* walletView */) {
|
|
1418
|
-
handleViewChange("Connect Wallet" /* connectOptions */);
|
|
1419
|
-
}
|
|
1420
|
-
}, [isWide, currentView]);
|
|
1421
|
-
useEffect4(() => {
|
|
1422
|
-
if (isWide && currentView === "walletView" /* walletView */) {
|
|
1423
|
-
handleViewChange("Connect Wallet" /* connectOptions */);
|
|
1424
|
-
}
|
|
1425
|
-
}, [isWide, currentView]);
|
|
1426
|
-
useEffect4(() => {
|
|
1427
|
-
if (isWide && currentView === "walletView" /* walletView */) {
|
|
1428
|
-
handleViewChange("Connect Wallet" /* connectOptions */);
|
|
1429
|
-
}
|
|
1430
|
-
}, [isWide, currentView]);
|
|
1431
|
-
return /* @__PURE__ */ jsx25(Dialog, { open: isOpen, onOpenChange: _onOpenChange, children: /* @__PURE__ */ jsxs12("div", { className: cs("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"), children: [
|
|
1432
|
-
/* @__PURE__ */ jsxs12("div", { className: cs(
|
|
1433
|
-
"flex flex-col items-start py-4 px-5 md:min-w-[360px] w-full md:w-auto",
|
|
1434
|
-
isWide && "border-r-[1px] border-r-solid border-r-separatorLine"
|
|
1435
|
-
), children: [
|
|
1436
|
-
/* @__PURE__ */ jsxs12("div", { className: cs("flex items-center justify-between w-full", !isWide && "pb-4"), children: [
|
|
1437
|
-
currentView === "Connect Wallet" /* connectOptions */ ? /* @__PURE__ */ jsx25(DialogTitle, { className: cs("text-lg leading-lg text-modalText font-bold", isWide && "pb-6"), children: "Connect Wallet" }) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1438
|
-
/* @__PURE__ */ jsx25(
|
|
1439
|
-
"button",
|
|
1440
|
-
{
|
|
1441
|
-
className: "flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
|
|
1442
|
-
onClick: () => handleViewChange("Connect Wallet" /* connectOptions */),
|
|
1443
|
-
"aria-label": "Back",
|
|
1444
|
-
children: /* @__PURE__ */ jsx25(Back_default, {})
|
|
1445
|
-
}
|
|
1446
|
-
),
|
|
1447
|
-
/* @__PURE__ */ jsx25(
|
|
1448
|
-
DialogTitle,
|
|
1449
|
-
{
|
|
1450
|
-
className: cs(
|
|
1451
|
-
"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",
|
|
1452
|
-
!selectedConnector?.hasConnectionUri() && "sr-only"
|
|
1453
|
-
),
|
|
1454
|
-
children: selectedConnector?.hasConnectionUri() && "Scan by your phone"
|
|
1455
|
-
}
|
|
1456
|
-
)
|
|
1457
|
-
] }),
|
|
1458
|
-
!isWide && /* @__PURE__ */ jsx25(
|
|
1459
|
-
DialogClose,
|
|
1460
|
-
{
|
|
1461
|
-
className: "z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
|
|
1462
|
-
children: /* @__PURE__ */ jsx25(Close_default, {})
|
|
1463
|
-
}
|
|
1464
|
-
)
|
|
1465
|
-
] }),
|
|
1466
|
-
/* @__PURE__ */ jsx25(
|
|
1467
|
-
"div",
|
|
1468
|
-
{
|
|
1469
|
-
ref: containerRef,
|
|
1470
|
-
className: "relative overflow-hidden w-full",
|
|
1471
|
-
children: /* @__PURE__ */ jsx25("div", { ref: currentViewRef, children: viewComponents[currentView] })
|
|
1472
|
-
}
|
|
1473
|
-
)
|
|
1474
|
-
] }),
|
|
1475
|
-
isWide && /* @__PURE__ */ jsx25(
|
|
1476
|
-
WalletView,
|
|
1477
|
-
{
|
|
1478
|
-
connectState: { isConnecting, isError: connectError },
|
|
1479
|
-
isWide,
|
|
1480
|
-
selectedConnector,
|
|
1481
|
-
qrCode,
|
|
1482
|
-
onConnect: handleConnect
|
|
1483
|
-
}
|
|
1484
|
-
)
|
|
1485
|
-
] }) });
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
// src/providers/LunoKitProvider.tsx
|
|
1489
|
-
import { useState as useState9 } from "react";
|
|
1490
|
-
import { LunoProvider } from "@luno-kit/react";
|
|
1491
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
1492
|
-
|
|
1493
|
-
// src/theme/context.tsx
|
|
1494
|
-
import { createContext as createContext2, useState as useState8, useContext as useContext2, useMemo as useMemo6, useCallback as useCallback6, useEffect as useEffect6 } from "react";
|
|
1495
|
-
|
|
1496
|
-
// src/hooks/useCSSVariableInjection.ts
|
|
1497
|
-
import { useEffect as useEffect5 } from "react";
|
|
1498
|
-
var ALL_THEME_VARS = [
|
|
1499
|
-
"--color-accentColor",
|
|
1500
|
-
"--color-walletSelectItemBackground",
|
|
1501
|
-
"--color-walletSelectItemBackgroundHover",
|
|
1502
|
-
"--color-walletSelectItemText",
|
|
1503
|
-
"--color-connectButtonBackground",
|
|
1504
|
-
"--color-connectButtonInnerBackground",
|
|
1505
|
-
"--color-connectButtonText",
|
|
1506
|
-
"--color-accountActionItemBackground",
|
|
1507
|
-
"--color-accountActionItemBackgroundHover",
|
|
1508
|
-
"--color-accountActionItemText",
|
|
1509
|
-
"--color-accountSelectItemBackground",
|
|
1510
|
-
"--color-accountSelectItemBackgroundHover",
|
|
1511
|
-
"--color-accountSelectItemText",
|
|
1512
|
-
"--color-currentNetworkButtonBackground",
|
|
1513
|
-
"--color-currentNetworkButtonText",
|
|
1514
|
-
"--color-networkSelectItemBackground",
|
|
1515
|
-
"--color-networkSelectItemBackgroundHover",
|
|
1516
|
-
"--color-networkSelectItemText",
|
|
1517
|
-
"--color-navigationButtonBackground",
|
|
1518
|
-
"--color-separatorLine",
|
|
1519
|
-
"--color-modalBackground",
|
|
1520
|
-
"--color-modalBackdrop",
|
|
1521
|
-
"--color-modalBorder",
|
|
1522
|
-
"--color-modalText",
|
|
1523
|
-
"--color-modalTextSecondary",
|
|
1524
|
-
"--color-modalControlButtonBackgroundHover",
|
|
1525
|
-
"--color-modalControlButtonText",
|
|
1526
|
-
"--color-success",
|
|
1527
|
-
"--color-successForeground",
|
|
1528
|
-
"--color-warning",
|
|
1529
|
-
"--color-warningForeground",
|
|
1530
|
-
"--color-error",
|
|
1531
|
-
"--color-errorForeground",
|
|
1532
|
-
"--color-info",
|
|
1533
|
-
"--color-infoForeground",
|
|
1534
|
-
"--color-skeleton",
|
|
1535
|
-
"--color-cutLine",
|
|
1536
|
-
"--font-body",
|
|
1537
|
-
"--font-heading",
|
|
1538
|
-
"--font-mono",
|
|
1539
|
-
"--radius-walletSelectItem",
|
|
1540
|
-
"--radius-connectButton",
|
|
1541
|
-
"--radius-modalControlButton",
|
|
1542
|
-
"--radius-accountActionItem",
|
|
1543
|
-
"--radius-accountSelectItem",
|
|
1544
|
-
"--radius-currentNetworkButton",
|
|
1545
|
-
"--radius-networkSelectItem",
|
|
1546
|
-
"--radius-modal",
|
|
1547
|
-
"--radius-modalMobile",
|
|
1548
|
-
"--shadow-button",
|
|
1549
|
-
"--shadow-modal",
|
|
1550
|
-
"--blur-modalOverlay"
|
|
1551
|
-
];
|
|
1552
|
-
var useCSSVariableInjection = (themeInfo, themeMode) => {
|
|
1553
|
-
useEffect5(() => {
|
|
1554
|
-
if (typeof window === "undefined") return;
|
|
1555
|
-
const root = document.documentElement;
|
|
1556
|
-
if (themeInfo.type === "complete" && themeInfo.completeTheme) {
|
|
1557
|
-
Object.entries(themeInfo.completeTheme.colors).forEach(([key, value]) => {
|
|
1558
|
-
if (value) {
|
|
1559
|
-
root.style.setProperty(`--color-${key}`, value);
|
|
1560
|
-
}
|
|
1561
|
-
});
|
|
1562
|
-
Object.entries(themeInfo.completeTheme.fonts).forEach(([key, value]) => {
|
|
1563
|
-
if (value) {
|
|
1564
|
-
root.style.setProperty(`--font-${key}`, value);
|
|
1565
|
-
}
|
|
1566
|
-
});
|
|
1567
|
-
Object.entries(themeInfo.completeTheme.radii).forEach(([key, value]) => {
|
|
1568
|
-
if (value) {
|
|
1569
|
-
root.style.setProperty(`--radius-${key}`, value);
|
|
1570
|
-
}
|
|
1571
|
-
});
|
|
1572
|
-
Object.entries(themeInfo.completeTheme.shadows).forEach(([key, value]) => {
|
|
1573
|
-
if (value) {
|
|
1574
|
-
root.style.setProperty(`--shadow-${key}`, value);
|
|
1575
|
-
}
|
|
1576
|
-
});
|
|
1577
|
-
Object.entries(themeInfo.completeTheme.blurs).forEach(([key, value]) => {
|
|
1578
|
-
if (value) {
|
|
1579
|
-
root.style.setProperty(`--blur-${key}`, value);
|
|
1580
|
-
}
|
|
1581
|
-
});
|
|
1582
|
-
root.removeAttribute("data-theme");
|
|
1583
|
-
} else if (themeInfo.type === "partial" && themeInfo.partialOverrides) {
|
|
1584
|
-
root.setAttribute("data-theme", themeMode);
|
|
1585
|
-
const hasOverrides = Object.keys(themeInfo.partialOverrides).length > 0;
|
|
1586
|
-
if (hasOverrides) {
|
|
1587
|
-
ALL_THEME_VARS.forEach((varName) => {
|
|
1588
|
-
root.style.removeProperty(varName);
|
|
1589
|
-
});
|
|
1590
|
-
if (themeInfo.partialOverrides.colors) {
|
|
1591
|
-
Object.entries(themeInfo.partialOverrides.colors).forEach(([key, value]) => {
|
|
1592
|
-
if (value) {
|
|
1593
|
-
root.style.setProperty(`--color-${key}`, value);
|
|
1594
|
-
}
|
|
1595
|
-
});
|
|
1596
|
-
}
|
|
1597
|
-
if (themeInfo.partialOverrides.fonts) {
|
|
1598
|
-
Object.entries(themeInfo.partialOverrides.fonts).forEach(([key, value]) => {
|
|
1599
|
-
if (value) {
|
|
1600
|
-
root.style.setProperty(`--font-${key}`, value);
|
|
1601
|
-
}
|
|
1602
|
-
});
|
|
1603
|
-
}
|
|
1604
|
-
if (themeInfo.partialOverrides.radii) {
|
|
1605
|
-
Object.entries(themeInfo.partialOverrides.radii).forEach(([key, value]) => {
|
|
1606
|
-
if (value) {
|
|
1607
|
-
root.style.setProperty(`--radius-${key}`, value);
|
|
1608
|
-
}
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
if (themeInfo.partialOverrides.shadows) {
|
|
1612
|
-
Object.entries(themeInfo.partialOverrides.shadows).forEach(([key, value]) => {
|
|
1613
|
-
if (value) {
|
|
1614
|
-
root.style.setProperty(`--shadow-${key}`, value);
|
|
1615
|
-
}
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
if (themeInfo.partialOverrides.blurs) {
|
|
1619
|
-
Object.entries(themeInfo.partialOverrides.blurs).forEach(([key, value]) => {
|
|
1620
|
-
if (value) {
|
|
1621
|
-
root.style.setProperty(`--blur-${key}`, value);
|
|
1622
|
-
}
|
|
1623
|
-
});
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
} else {
|
|
1627
|
-
root.setAttribute("data-theme", themeMode);
|
|
1628
|
-
ALL_THEME_VARS.forEach((varName) => {
|
|
1629
|
-
root.style.removeProperty(varName);
|
|
1630
|
-
});
|
|
1631
|
-
}
|
|
1632
|
-
}, [themeInfo, themeMode]);
|
|
1633
|
-
};
|
|
1634
|
-
|
|
1635
|
-
// src/theme/context.tsx
|
|
1636
|
-
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1637
|
-
var THEME_STORAGE_KEY = "luno.lastThemePreference";
|
|
1638
|
-
var saveThemePreference = (preference) => {
|
|
1639
|
-
try {
|
|
1640
|
-
localStorage.setItem(THEME_STORAGE_KEY, JSON.stringify(preference));
|
|
1641
|
-
} catch (e) {
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
var ThemeContext = createContext2(void 0);
|
|
1645
|
-
var isCompleteTheme = (theme) => {
|
|
1646
|
-
return "colors" in theme && "fonts" in theme && "radii" in theme && "shadows" in theme && "blurs" in theme;
|
|
1647
|
-
};
|
|
1648
|
-
var useSystemTheme = () => {
|
|
1649
|
-
const [systemTheme, setSystemTheme] = useState8(() => {
|
|
1650
|
-
if (typeof window === "undefined") return "light";
|
|
1651
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1652
|
-
});
|
|
1653
|
-
useEffect6(() => {
|
|
1654
|
-
if (typeof window === "undefined") return;
|
|
1655
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1656
|
-
const updateTheme = (e) => {
|
|
1657
|
-
setSystemTheme(e.matches ? "dark" : "light");
|
|
1658
|
-
};
|
|
1659
|
-
updateTheme(mediaQuery);
|
|
1660
|
-
mediaQuery.addEventListener("change", updateTheme);
|
|
1661
|
-
return () => mediaQuery.removeEventListener("change", updateTheme);
|
|
1662
|
-
}, []);
|
|
1663
|
-
return systemTheme;
|
|
1664
|
-
};
|
|
1665
|
-
var ThemeProvider = ({
|
|
1666
|
-
children,
|
|
1667
|
-
theme: themeOverrides
|
|
1668
|
-
}) => {
|
|
1669
|
-
const systemTheme = useSystemTheme();
|
|
1670
|
-
const [themeMode, setThemeMode] = useState8(() => {
|
|
1671
|
-
if (typeof window !== "undefined") {
|
|
1672
|
-
try {
|
|
1673
|
-
const saved = localStorage.getItem(THEME_STORAGE_KEY);
|
|
1674
|
-
if (saved) {
|
|
1675
|
-
const preference = JSON.parse(saved);
|
|
1676
|
-
if (preference?.isAuto) {
|
|
1677
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1678
|
-
} else if (preference?.preferredTheme) {
|
|
1679
|
-
return preference.preferredTheme;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
} catch (e) {
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
if (!themeOverrides || isCompleteTheme(themeOverrides)) {
|
|
1686
|
-
return "light";
|
|
1687
|
-
}
|
|
1688
|
-
const overrides = themeOverrides;
|
|
1689
|
-
return overrides.defaultMode || "light";
|
|
1690
|
-
});
|
|
1691
|
-
const [isAutoMode, setIsAutoMode] = useState8(() => {
|
|
1692
|
-
if (typeof window !== "undefined") {
|
|
1693
|
-
try {
|
|
1694
|
-
const saved = localStorage.getItem(THEME_STORAGE_KEY);
|
|
1695
|
-
if (saved) {
|
|
1696
|
-
const preference = JSON.parse(saved);
|
|
1697
|
-
return preference?.isAuto ?? false;
|
|
1698
|
-
}
|
|
1699
|
-
} catch (e) {
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
if (!themeOverrides || isCompleteTheme(themeOverrides)) {
|
|
1703
|
-
return false;
|
|
1704
|
-
}
|
|
1705
|
-
const overrides = themeOverrides;
|
|
1706
|
-
return overrides.autoMode ?? false;
|
|
1707
|
-
});
|
|
1708
|
-
const themeInfo = useMemo6(() => {
|
|
1709
|
-
if (!themeOverrides) {
|
|
1710
|
-
return { type: "default", completeTheme: null, partialOverrides: null };
|
|
1711
|
-
}
|
|
1712
|
-
if (isCompleteTheme(themeOverrides)) {
|
|
1713
|
-
return { type: "complete", completeTheme: themeOverrides, partialOverrides: null };
|
|
1714
|
-
}
|
|
1715
|
-
const overrides = themeOverrides;
|
|
1716
|
-
if (overrides.theme) {
|
|
1717
|
-
return { type: "complete", completeTheme: overrides.theme, partialOverrides: null };
|
|
1718
|
-
}
|
|
1719
|
-
let partialOverrides = null;
|
|
1720
|
-
if (themeMode === "light" && overrides.light) {
|
|
1721
|
-
partialOverrides = overrides.light;
|
|
1722
|
-
} else if (themeMode === "dark" && overrides.dark) {
|
|
1723
|
-
partialOverrides = overrides.dark;
|
|
1724
|
-
} else {
|
|
1725
|
-
partialOverrides = { ...overrides };
|
|
1726
|
-
}
|
|
1727
|
-
return { type: "partial", completeTheme: null, partialOverrides };
|
|
1728
|
-
}, [themeMode, themeOverrides]);
|
|
1729
|
-
const currentTheme = useMemo6(() => {
|
|
1730
|
-
return themeInfo.type === "complete" ? themeInfo.completeTheme : null;
|
|
1731
|
-
}, [themeInfo]);
|
|
1732
|
-
useCSSVariableInjection(themeInfo, themeMode);
|
|
1733
|
-
const setThemeChoice = useCallback6((choice) => {
|
|
1734
|
-
const isAuto = choice === "auto";
|
|
1735
|
-
setIsAutoMode(isAuto);
|
|
1736
|
-
if (isAuto) {
|
|
1737
|
-
setThemeMode(systemTheme || "light");
|
|
1738
|
-
} else {
|
|
1739
|
-
setThemeMode(choice);
|
|
1740
|
-
}
|
|
1741
|
-
const preference = {
|
|
1742
|
-
isAuto,
|
|
1743
|
-
...isAuto ? {} : { preferredTheme: choice }
|
|
1744
|
-
};
|
|
1745
|
-
saveThemePreference(preference);
|
|
1746
|
-
}, [systemTheme]);
|
|
1747
|
-
useEffect6(() => {
|
|
1748
|
-
if (isAutoMode) {
|
|
1749
|
-
setThemeMode(systemTheme || "light");
|
|
1750
|
-
}
|
|
1751
|
-
}, [systemTheme, isAutoMode]);
|
|
1752
|
-
const contextValue = useMemo6(() => ({
|
|
1753
|
-
themeMode,
|
|
1754
|
-
setThemeChoice,
|
|
1755
|
-
currentTheme
|
|
1756
|
-
}), [themeMode, setThemeChoice, currentTheme]);
|
|
1757
|
-
return /* @__PURE__ */ jsx26(ThemeContext.Provider, { value: contextValue, children });
|
|
1758
|
-
};
|
|
1759
|
-
var useLunoTheme = () => {
|
|
1760
|
-
const context = useContext2(ThemeContext);
|
|
1761
|
-
if (!context) {
|
|
1762
|
-
throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");
|
|
1763
|
-
}
|
|
1764
|
-
return context;
|
|
1765
|
-
};
|
|
1766
|
-
|
|
1767
|
-
// src/providers/LunoKitProvider.tsx
|
|
1768
|
-
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1769
|
-
var LunoKitProvider = ({
|
|
1770
|
-
children,
|
|
1771
|
-
config,
|
|
1772
|
-
queryClientConfig,
|
|
1773
|
-
theme
|
|
1774
|
-
}) => {
|
|
1775
|
-
const [queryClient] = useState9(() => new QueryClient(queryClientConfig));
|
|
1776
|
-
return /* @__PURE__ */ jsx27(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx27(LunoProvider, { config, children: /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs13(ModalProvider, { children: [
|
|
1777
|
-
/* @__PURE__ */ jsx27("div", { className: "font-base luno-kit", children }),
|
|
1778
|
-
/* @__PURE__ */ jsx27(RenderModals, { modalSize: config.modalSize })
|
|
1779
|
-
] }) }) }) });
|
|
1780
|
-
};
|
|
1781
|
-
var RenderModals = ({ modalSize }) => {
|
|
1782
|
-
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
1783
|
-
/* @__PURE__ */ jsx27(ConnectModal, { size: modalSize }),
|
|
1784
|
-
/* @__PURE__ */ jsx27(AccountDetailsModal, {}),
|
|
1785
|
-
/* @__PURE__ */ jsx27(ChainModal, {})
|
|
1786
|
-
] });
|
|
1787
|
-
};
|
|
1788
|
-
export {
|
|
1789
|
-
ConnectButton,
|
|
1790
|
-
LunoKitProvider,
|
|
1791
|
-
useLunoTheme
|
|
1792
|
-
};
|
|
2
|
+
import{useCallback as fo,useMemo as Ye}from"react";import{useAccount as ho,useActiveConnector as xo,useBalance as go,useChain as wo}from"@luno-kit/react";import le from"react";import*as N from"@radix-ui/react-dialog";import{clsx as Ct}from"clsx";import{extendTailwindMerge as vt}from"tailwind-merge";var bt=vt({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return bt(Ct(e))}function Re(e,n){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},n)}}import{jsx as Pe,jsxs as Nt}from"react/jsx-runtime";var yt=({open:e,onOpenChange:n,children:t,contentClassName:r,overlayClassName:o})=>Pe(N.Root,{open:e,onOpenChange:n,children:Nt(N.Portal,{children:[le.createElement(N.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",o)}),Pe(N.Content,{className:d("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-primary focus:outline-none overflow-hidden","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",r),children:t})]})}),St=({children:e,className:n})=>le.createElement(N.Title,{className:d("font-heading",n)},e),Mt=({children:e,className:n,onClick:t})=>le.createElement(N.Close,{className:n,onClick:t},e),G=yt,E=Mt,D=St;import{createContext as At,useCallback as me,useContext as ue,useEffect as kt,useMemo as Tt,useState as Rt}from"react";import{ConnectionStatus as q,useStatus as Pt}from"@luno-kit/react";import{jsx as Vt}from"react/jsx-runtime";function de(){let[e,n]=Rt(!1),t=me(()=>n(!0),[]),r=me(()=>n(!1),[]);return{isOpen:e,open:t,close:r}}var K=At(void 0),Ve=({children:e})=>{let{isOpen:n,open:t,close:r}=de(),{isOpen:o,open:a,close:i}=de(),{isOpen:m,open:p,close:u}=de(),f=Pt(),c=me(()=>{r(),i(),u()},[r,i,u]);kt(()=>{f===q.Disconnected&&(i(),u())},[f,i,u]);let s=Tt(()=>({isConnectModalOpen:n,isAccountModalOpen:o,isChainModalOpen:m,openConnectModal:f!==q.Connected?t:void 0,closeConnectModal:r,openAccountModal:f===q.Connected?a:void 0,closeAccountModal:i,openChainModal:f===q.Connected?p:void 0,closeChainModal:u,closeAllModals:c}),[n,t,r,o,a,i,m,p,u,c,f]);return Vt(K.Provider,{value:s,children:e})},J=()=>{let e=ue(K);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},Y=()=>{let e=ue(K);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},X=()=>{let e=ue(K);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}};import{jsx as Ie}from"react/jsx-runtime";var It=e=>Ie("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ie("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"})}),pe=It;import{jsx as Be}from"react/jsx-runtime";var Bt=e=>Be("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Be("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"})}),W=Bt;import{jsx as Ee}from"react/jsx-runtime";var Et=e=>Ee("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Ee("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),V=Et;import{jsx as De}from"react/jsx-runtime";var Dt=e=>De("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:De("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"})}),fe=Dt;import{jsx as Le}from"react/jsx-runtime";var Lt=e=>Le("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:Le("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"})}),he=Lt;import{jsx as Oe}from"react/jsx-runtime";var Ot=e=>Oe("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Oe("path",{d:"M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z"})}),xe=Ot;import{jsx as _e}from"react/jsx-runtime";var _t=e=>_e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",className:"loading_svg__icon",viewBox:"0 0 256 256",...e,children:_e("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"})}),Q=_t;import{jsx as He}from"react/jsx-runtime";var Ht=e=>He("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:He("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"})}),ge=Ht;import{jsx as Ge}from"react/jsx-runtime";var Gt=e=>Ge("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:Ge("path",{d:"M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z"})}),we=Gt;import{useMemo as Ft}from"react";import{jsx as Fe}from"react/jsx-runtime";var F=({chainIconUrl:e,chainName:n,className:t})=>e?Fe("img",{src:e,alt:n||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):Fe("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:n?n.charAt(0).toUpperCase():"C"});import{useAccount as $t,useChain as Zt,useDisconnect as zt,getExplorerUrl as Wt}from"@luno-kit/react";import{Fragment as Ze,jsx as v,jsxs as $}from"react/jsx-runtime";var ze=({onViewChange:e,onModalClose:n})=>{let{address:t}=$t(),{chain:r}=Zt(),{disconnectAsync:o}=zt(),a=Ft(()=>[{key:"Chain Name",content:$("div",{className:"flex items-stretch w-full justify-between",children:[$("div",{className:"flex items-center gap-2",children:[v(F,{className:"w-[20px] h-[20px]",chainIconUrl:r?.chainIconUrl,chainName:r?.name}),v("span",{className:"text-base text-modalText",children:r?.name||"Polkadot"})]}),v("div",{className:"flex items-center justify-center",children:v(pe,{className:"w-[16px] h-[16px] "})})]}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:$(Ze,{children:[v(xe,{}),v("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open(Wt(r?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:$(Ze,{children:[v(we,{}),v("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,r,t]),i=async()=>{await o(),n()};return $("div",{className:"flex flex-col items-center gap-3 w-full",children:[v("div",{className:"flex flex-col gap-1.5 w-full px-4",children:a.map(m=>v($e,{onClick:m.onClick,children:m.content},m.key))}),v("div",{className:"w-full mx-[-100px] h-[1px] bg-cutLine"}),v("div",{className:"w-full px-4 pb-4",children:$($e,{onClick:i,children:[v(he,{}),v("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},$e=({children:e,onClick:n})=>v("button",{type:"button",onClick:()=>n?.(),className:d("w-full p-3.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",n?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});import Qt,{useCallback as Ut}from"react";import{useAccount as jt,useAccounts as qt,useActiveConnector as Kt,useBalance as Jt,useChain as Yt}from"@luno-kit/react";import{formatAddress as Xt}from"@luno-kit/react";import{Fragment as to,jsx as I,jsxs as ee}from"react/jsx-runtime";var Ce=({onBack:e})=>{let{accounts:n,selectAccount:t}=qt(),{address:r}=jt(),o=Ut(a=>{t(a),e()},[e]);return I("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:n.map(a=>I(eo,{account:a,isSelected:a.address===r,selectAccount:o},a.address))})};Ce.title="Switch Accounts";var eo=Qt.memo(({isSelected:e,account:n,selectAccount:t})=>{let{chain:r}=Yt(),o=n.address,{data:a}=Jt({address:o}),i=Kt();return ee("button",{type:"button",onClick:()=>t(n),className:d("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":n.name||o,disabled:e,children:[ee("div",{className:"flex items-center gap-2",children:[I("div",{className:"shrink-0 w-[24px] h-[24px] bg-pink-500 rounded-full flex items-center justify-center",children:i?.icon&&I("img",{src:i?.icon,alt:"luno account"})}),ee("div",{className:"flex flex-col items-start",children:[I("span",{className:"font-medium text-sm leading-sm text-accountSelectItemText",children:n.name||Xt(o)}),I("span",{className:"text-xs text-modalTextSecondary font-medium",children:a===void 0?I("div",{className:"animate-pulse rounded w-[60px] h-[18px] bg-skeleton"}):ee(to,{children:[a?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}),e&&I("div",{className:"border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:I("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});import oo,{useMemo as no,useState as We}from"react";import{useApi as ro,useChain as ao,useChains as io,useSwitchChain as so}from"@luno-kit/react";import{Fragment as Qe,jsx as y,jsxs as Z}from"react/jsx-runtime";var co=[{key:"All",label:"All"},{key:"Mainnets",label:"Mainnets"},{key:"Testnets",label:"Testnets"}],te=({onChainSwitched:e})=>{let{chain:n}=ao(),t=io(),{switchChainAsync:r}=so(),{isApiReady:o,apiError:a}=ro(),[i,m]=We("All"),[p,u]=We(null),f=no(()=>{switch(i){case"Mainnets":return t.filter(s=>!s.testnet);case"Testnets":return t.filter(s=>s.testnet);case"All":default:return t}},[t,i]),c=async s=>{if(s.genesisHash!==n?.genesisHash&&!(!o&&!a)){u(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(l){console.error("Failed to switch chain:",l)}finally{u(null)}}};return Z(Qe,{children:[y("div",{className:"flex items-center gap-1.5 w-full",children:co.map(s=>y("button",{onClick:()=>m(s.key),className:d("px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",i===s.key?"bg-navigationButtonBackground text-modalText":"bg-transparent text-modalTextSecondary hover:text-modalText"),children:s.label},s.key))}),y("div",{className:"flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]",children:f.map(s=>y(lo,{chain:s,isSelected:s.genesisHash===n?.genesisHash,onSelect:c,isLoading:(p===s.genesisHash||!o)&&!a},s.genesisHash))}),f.length===0&&y("div",{className:"flex items-center justify-center py-12",children:Z("span",{className:"text-modalTextSecondary text-xs",children:["No ",i==="All"?"chains":i.toLowerCase()," available"]})})]})},lo=oo.memo(({chain:e,isSelected:n,isLoading:t,onSelect:r})=>Z("button",{onClick:()=>r(e),disabled:n||t,className:d("flex items-center justify-between p-2 rounded-sm","bg-networkSelectItemBackground","transition-colors duration-200",n||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[Z("div",{className:"flex items-center gap-2",children:[y(F,{className:"w-[24px] bg-modal-bg h-[24px] flex items-center justify-center",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),y("div",{className:"flex flex-col items-start",children:y("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),y("div",{className:"flex items-center justify-center h-[20px]",children:n?t?Z(Qe,{children:[y("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:"Switching"}),y(Q,{className:"text-accentColor animate-[spin_2s_linear_infinite]",width:"15px",height:"15px"})]}):Z("span",{className:"status-dot-container",children:[y("span",{className:"ping-animation"}),y("span",{className:"status-dot"})]}):null})]}));import{jsx as Ue}from"react/jsx-runtime";var oe=({onBack:e})=>Ue("div",{className:"flex flex-col gap-3.5 p-4 pt-0",children:Ue(te,{})});oe.title="Select Networks";import{useCallback as mo,useState as uo}from"react";import{jsx as je,jsxs as po}from"react/jsx-runtime";var ne=({copyText:e,label:n,className:t=""})=>{let[r,o]=uo(!1),a=mo(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),o(!0),setTimeout(()=>o(!1),2e3),!0):!1}catch(m){return console.error("Copy failed:",m),!1}},[]);return po("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1",t),onClick:()=>!r&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:r,children:[r?je(ge,{className:"text-accentColor",width:16,height:16}):je(fe,{width:16,height:16}),n]})};import{formatAddress as Co}from"@luno-kit/react";import{useCallback as qe,useState as Ke,useRef as Je}from"react";function re({initialView:e,animationDuration:n=200,animationEasing:t="ease-out"}){let[r,o]=Ke(e),[a,i]=Ke(!1),m=Je(null),p=Je(null),u=qe(c=>{if(c===r||a)return;if(i(!0),!m.current){o(c),i(!1);return}let s=m.current,l=s.offsetHeight;o(c),requestAnimationFrame(()=>{if(!s||!p.current){i(!1);return}let h=p.current.offsetHeight;s.animate([{height:l+"px"},{height:h+"px"}],{duration:n,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[r,a,n,t]),f=qe(()=>{o(e),i(!1)},[e]);return{currentView:r,isAnimating:a,containerRef:m,currentViewRef:p,handleViewChange:u,resetView:f}}import{Fragment as Xe,jsx as g,jsxs as H}from"react/jsx-runtime";var et=()=>{let{isOpen:e,close:n}=Y(),{address:t}=ho(),{chain:r}=wo(),{data:o}=go({address:t}),a=xo(),{currentView:i,containerRef:m,currentViewRef:p,handleViewChange:u,resetView:f}=re({initialView:"main"}),c=fo(()=>{n(),f()},[n]),s=Ye(()=>i==="switchAccount"?"Switch Account":i==="switchChain"?oe.title:null,[i]),l=Ye(()=>({main:g(ze,{onViewChange:u,onModalClose:c}),switchAccount:g(Ce,{onBack:()=>u("main")}),switchChain:g(oe,{onBack:()=>u("main")})}),[u,c]);return g(G,{open:e,onOpenChange:c,children:H("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText","bg-modalBackground shadow-modal",i==="main"?"gap-6":"gap-3.5"),children:[H("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[i==="main"?H("div",{className:"flex items-center gap-3",children:[a?.icon&&g("div",{className:"flex items-center justify-center w-[55px] h-[55px]",children:g("img",{src:a.icon,alt:""})}),H("div",{className:"flex flex-col items-start gap-2 w-full",children:[g(D,{className:"sr-only",children:"Account Details"}),H("div",{className:"flex items-center gap-1.5 w-full",children:[g("span",{className:"text-base text-modalText font-semibold",children:Co(t)}),g(ne,{copyText:t})]}),g("div",{className:"text-sm text-modalTextSecondary font-medium min-h-[20px]",children:o===void 0?g("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-skeleton"}):H(Xe,{children:[o?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}):H(Xe,{children:[g("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>u("main"),"aria-label":"Back",children:g(W,{})}),g(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:s})]}),g(E,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:g(V,{})})]}),g("div",{ref:m,className:"relative overflow-hidden",children:g("div",{ref:p,children:l[i]})})]})})};import{jsx as z,jsxs as tt}from"react/jsx-runtime";var ot=()=>{let{isOpen:e,close:n}=X();return z(G,{open:e,onOpenChange:t=>!t&&n(),children:tt("div",{className:"flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText",children:[tt("div",{className:"flex items-center justify-between w-full",children:[z("div",{className:"w-[30px]"})," ",z(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),z(E,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:z(V,{})})]}),z(te,{})]})})};import{useEffect as ye,useMemo as Oo,useState as dt}from"react";import{useConnect as _o,isMobileDevice as Ho}from"@luno-kit/react";import{useStatus as vo,useAccount as bo,useChain as yo,useBalance as So,ConnectionStatus as ae,useChains as Mo,useActiveConnector as No,formatAddress as Ao}from"@luno-kit/react";function nt(){let e=vo(),{account:n,address:t}=bo(),{chain:r}=yo(),o=Mo(),{data:a}=So({address:t}),i=No(),{open:m,isOpen:p}=J(),{open:u,isOpen:f}=Y(),{open:c,isOpen:s}=X(),l=e===ae.Connecting,h=e===ae.Connected,x=e===ae.Disconnected||e===ae.Disconnecting,R=!!r&&o.some(C=>C.genesisHash.toLowerCase()===r.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:h,isDisconnected:x,isConnecting:l,account:n,address:t,displayAddress:Ao(t),currentChain:r,configuredChains:o,isChainSupported:R,chainIconUrl:r?.chainIconUrl,chainName:r?.name,balance:a,openConnectModal:m,openAccountModal:u,openChainModal:c,isConnectModalOpen:p,isAccountModalOpen:f,isChainModalOpen:s}}import{useEffect as ko,useState as To}from"react";var ie=()=>{let[e,n]=To({height:void 0,width:void 0});return ko(()=>{let t=Re(()=>{n({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};import Eo from"react";import{Cuer as Ro}from"cuer";import{jsx as L,jsxs as rt}from"react/jsx-runtime";var at=({logoBackground:e,uri:n,size:t})=>{if(!n){let a=Math.floor(14.25),i=t/57,m=a*i,p=Math.floor(57/2-a/2),u=p+a,f=()=>{let l=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=p&&h<=u&&x>=p&&x<=u||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let C=x+.5,S=h+.5;l.push(L("rect",{x:C-.4,y:S-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return l},c=({position:l})=>{let h=7*i,x={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return rt("div",{className:"absolute z-[4]",style:{width:`${h}px`,height:`${h}px`,...x[l]},children:[L("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),L("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},s=()=>{let l=Math.ceil(28.5-a/2)*i;return L("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${m}px`,height:`${m}px`,left:`${l}px`,top:`${l}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:L("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return rt("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[L("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:f()}),L("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),c({position:"top-left"}),c({position:"top-right"}),c({position:"bottom-left"}),e&&s()]})}return L(Ro,{arena:e,value:n})};import{jsx as O,jsxs as U}from"react/jsx-runtime";var j="transition-transform transition-[125] hover:scale-[1.03] transition-ease",Po=({className:e,label:n="Connect Wallet",accountStatus:t="full",chainStatus:r="full",showBalance:o=!0})=>{let{isConnected:a,isDisconnected:i,displayAddress:m,balance:p,openConnectModal:u,openAccountModal:f,openChainModal:c,chainIconUrl:s,chainName:l,currentChain:h,activeConnector:x}=nt(),{width:R}=ie(),C=R&&R>768;return i||!a||!x?O("button",{type:"button",onClick:()=>u?.(),className:d("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",j,"px-3.5 text-base leading-base min-h-[40px]",e),children:n}):U("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[r!=="none"&&U("button",{type:"button",onClick:()=>c?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",j),"aria-label":"Switch chain",children:[r==="full"||r==="icon"?O(F,{chainIconUrl:s,chainName:l,className:"w-[24px] h-[24px]"}):null,(r==="full"||r==="name")&&C&&O("span",{children:h?.name||"Unknown Chain"})]}),U("button",{type:"button",onClick:()=>f?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",j),"aria-label":"Open account modal",children:[o&&C&&O("div",{className:"p-2 pl-3",children:p===void 0?O("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"}):U("span",{className:"",children:[p?.formattedTransferable||p?.formattedTotal||0," ",h?.nativeCurrency?.symbol||""]})}),U("div",{className:d("flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",o&&C?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&O("span",{className:"w-[24px] h-[24px]",children:O("img",{src:x.icon,alt:"luno"})}),O("span",{"aria-label":"Wallet icon placeholder",className:"",children:m})]})]})]})};import{useEffect as Vo,useRef as Io}from"react";import{jsx as Bo}from"react/jsx-runtime";var it=({size:e=160,dotCount:n=300,duration:t=3,className:r=""})=>{let o=Io(null);return Vo(()=>{if(!o.current)return;let a=1,i=2,m=Math.PI*(3-Math.sqrt(5)),p=e/2,u=p-i-a,f="http://www.w3.org/2000/svg";o.current.innerHTML="";let c=document.createElementNS(f,"svg");c.setAttribute("width",e.toString()),c.setAttribute("height",e.toString()),c.setAttribute("viewBox",`0 0 ${e} ${e}`),c.style.display="block",o.current.appendChild(c);for(let s=0;s<n;s++){let l=s+.5,h=l/n,x=Math.sqrt(h)*u,R=l*m,C=p+x*Math.cos(R),S=p+x*Math.sin(R),P=document.createElementNS(f,"circle");P.setAttribute("cx",C.toString()),P.setAttribute("cy",S.toString()),P.setAttribute("r",a.toString()),P.setAttribute("fill","currentColor"),P.setAttribute("opacity","0.6"),c.appendChild(P);let b=document.createElementNS(f,"animate");b.setAttribute("attributeName","r"),b.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),b.setAttribute("dur",`${t}s`),b.setAttribute("begin",`${h*t}s`),b.setAttribute("repeatCount","indefinite"),b.setAttribute("calcMode","spline"),b.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),P.appendChild(b);let M=document.createElementNS(f,"animate");M.setAttribute("attributeName","opacity"),M.setAttribute("values","0.2;1;0.2"),M.setAttribute("dur",`${t}s`),M.setAttribute("begin",`${h*t}s`),M.setAttribute("repeatCount","indefinite"),M.setAttribute("calcMode","spline"),M.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),P.appendChild(M)}},[e,n,t]),Bo("div",{ref:o,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",r)})};import{Fragment as st,jsx as w,jsxs as B}from"react/jsx-runtime";var ve=Eo.memo(({selectedConnector:e,onConnect:n,qrCode:t,isWide:r,connectState:o})=>{let a=e?.hasConnectionUri();return B("div",{className:d("flex flex-col items-center",r?"w-[400px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[r&&w("div",{className:"w-full",children:B("div",{className:"flex items-center justify-between",children:[w("div",{}),w(E,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:w(V,{})})]})}),w("div",{className:d("flex items-center py-12 flex-col grow justify-start",e&&a?"max-w-[220px]":"max-w-[360px]"),children:e?a?B("div",{className:"flex flex-col items-center gap-4",children:[w(at,{size:220,logoBackground:e.icon,uri:t}),B("div",{className:"text-secondaryFont leading-secondary font-[500] text-center",children:["Scan the QR Code with ",e.id==="nova"?"the Nova app":"your phone"]}),e.links?.browserExtension?B("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-[16px] text-base leading-base text-accentColor font-bold text-center",children:["Don\u2018t have ",e.name,"?"]}):t?w(ne,{className:"text-sm leading-sm text-accentColor",copyText:t,label:"Copy Link"}):null]}):B(st,{children:[w("div",{className:"w-[102px] h-[102px] pb-[16px]",children:w("img",{src:e.icon,className:"w-full h-full",alt:""})}),B("p",{className:"pb-[10px] text-primary leading-primary text-modalFont font-[600]",children:["Opening ",e.name,"..."]}),w("p",{className:"pb-[10px] text-secondaryFont text-secondary leading-secondary font-[500] text-center",children:"Confirm connection in the extension"}),o.isConnecting&&w(Q,{className:"w-[24px] h-[24px] text-secondaryFont animate-[spin_3s_linear_infinite]"}),!e.isInstalled()&&e.links.browserExtension&&B("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-[16px] text-base leading-base text-accentColor font-bold text-center",children:["Don\u2018t have ",e.name,"?"]}),!o.isConnecting&&o.isError&&e.isInstalled()&&w("button",{className:d("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-[600] text-primaryFont bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",j),onClick:()=>n(e),children:"Retry"})]}):B(st,{children:[w("div",{className:"w-[160px] h-[160px] mb-4",children:w(it,{})}),w("p",{className:"cursor-pointer pb-[16px] text-base leading-base text-accentColor font-bold text-center",children:"New to wallets?"}),w("p",{className:"text-modalTextSecondary text-sm leading-sm font-medium text-center",children:"Your gateway to the decentralized world Connect a wallet to get started"})]})}),w("div",{})]})});import ct from"react";import{useConnectors as Do,isMobileDevice as Lo}from"@luno-kit/react";import{jsx as T,jsxs as se}from"react/jsx-runtime";var lt=ct.memo(({onConnect:e})=>{let n=Do();if(Lo()){let o=n.filter(a=>a.links.deepLink);return T("div",{className:"flex flex-col items-start gap-1 w-full",children:o.map(a=>T(be,{connector:a,onConnect:()=>e(a)},`${a.id}-${a.name}`))})}let t=n.filter(o=>o.isInstalled()),r=n.filter(o=>!o.isInstalled());return se("div",{className:"flex flex-col items-start gap-4 w-full",children:[se("div",{className:"flex flex-col items-start gap-3 w-full",children:[T("div",{className:"text-base text-modalText font-semibold leading-base",children:"Installed"}),T("div",{className:"flex flex-col items-start gap-1.5 w-full",children:t.map(o=>T(be,{connector:o,onConnect:()=>e(o)},o.id))})]}),r.length>0&&se("div",{className:"flex flex-col items-start gap-3 w-full",children:[T("div",{className:"text-base text-modalText font-semibold leading-base",children:"More"}),T("div",{className:"flex flex-col items-start gap-1 w-full",children:r.map(o=>T(be,{connector:o,onConnect:()=>e(o)},o.id))})]})]})}),be=ct.memo(({connector:e,onConnect:n})=>se("button",{onClick:n,className:d("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[T("div",{className:"w-[24px] h-[24px]",children:T("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),T("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));import{Fragment as Go,jsx as A,jsxs as ce}from"react/jsx-runtime";var mt=({size:e="wide"})=>{let{isOpen:n,close:t}=J(),{connectAsync:r,reset:o,isPending:a,isError:i}=_o(),[m,p]=dt(null),[u,f]=dt(),{width:c}=ie(),s=c&&c>768,l=!!(e==="wide"&&s),{containerRef:h,currentViewRef:x,resetView:R,handleViewChange:C,currentView:S}=re({initialView:"Connect Wallet"}),P=async k=>{let Te=await k.getConnectionUri();f(Te)},b=async k=>{if(Ho()&&k.links.deepLink)try{await r({connectorId:k.id}),M(!1);return}catch{window.location.href=`${k.links.deepLink}?url=${window.location.href}`;return}!l&&C("walletView"),p(k),f(void 0),k.hasConnectionUri()&&P(k),await r({connectorId:k.id}),M(!1)},M=k=>{!k&&t(),o(),R(),p(null),f(void 0)},wt=Oo(()=>({"Connect Wallet":A(lt,{onConnect:b}),walletView:A(ve,{connectState:{isConnecting:a,isError:i},isWide:l,selectedConnector:m,qrCode:u,onConnect:b})}),[l,m,u,b,a,i]);return ye(()=>{l&&S==="walletView"&&C("Connect Wallet")},[l,S]),ye(()=>{l&&S==="walletView"&&C("Connect Wallet")},[l,S]),ye(()=>{l&&S==="walletView"&&C("Connect Wallet")},[l,S]),A(G,{open:n,onOpenChange:M,children:ce("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[ce("div",{className:d("flex flex-col items-start py-4 px-5 md:min-w-[360px] w-full md:w-auto",l&&"border-r-[1px] border-r-solid border-r-separatorLine"),children:[ce("div",{className:d("flex items-center justify-between w-full",!l&&"pb-4"),children:[S==="Connect Wallet"?A(D,{className:d("text-lg leading-lg text-modalText font-bold",l&&"pb-6"),children:"Connect Wallet"}):ce(Go,{children:[A("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>C("Connect Wallet"),"aria-label":"Back",children:A(W,{})}),A(D,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",!m?.hasConnectionUri()&&"sr-only"),children:m?.hasConnectionUri()&&"Scan by your phone"})]}),!l&&A(E,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:A(V,{})})]}),A("div",{ref:h,className:"relative overflow-hidden w-full",children:A("div",{ref:x,children:wt[S]})})]}),l&&A(ve,{connectState:{isConnecting:a,isError:i},isWide:l,selectedConnector:m,qrCode:u,onConnect:b})]})})};import{useState as jo}from"react";import{LunoProvider as qo}from"@luno-kit/react";import{QueryClient as Ko,QueryClientProvider as Jo}from"@tanstack/react-query";import{createContext as $o,useState as Ne,useContext as Zo,useMemo as Se,useCallback as zo,useEffect as ft}from"react";import{useEffect as Fo}from"react";var ut=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--color-cutLine","--font-body","--font-heading","--font-mono","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],pt=(e,n)=>{Fo(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([r,o])=>{o&&t.style.setProperty(`--color-${r}`,o)}),Object.entries(e.completeTheme.fonts).forEach(([r,o])=>{o&&t.style.setProperty(`--font-${r}`,o)}),Object.entries(e.completeTheme.radii).forEach(([r,o])=>{o&&t.style.setProperty(`--radius-${r}`,o)}),Object.entries(e.completeTheme.shadows).forEach(([r,o])=>{o&&t.style.setProperty(`--shadow-${r}`,o)}),Object.entries(e.completeTheme.blurs).forEach(([r,o])=>{o&&t.style.setProperty(`--blur-${r}`,o)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",n),Object.keys(e.partialOverrides).length>0&&(ut.forEach(o=>{t.style.removeProperty(o)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([o,a])=>{a&&t.style.setProperty(`--color-${o}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([o,a])=>{a&&t.style.setProperty(`--font-${o}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([o,a])=>{a&&t.style.setProperty(`--radius-${o}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([o,a])=>{a&&t.style.setProperty(`--shadow-${o}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([o,a])=>{a&&t.style.setProperty(`--blur-${o}`,a)}))):(t.setAttribute("data-theme",n),ut.forEach(r=>{t.style.removeProperty(r)}))},[e,n])};import{jsx as Uo}from"react/jsx-runtime";var Ae="luno.lastThemePreference",Wo=e=>{try{localStorage.setItem(Ae,JSON.stringify(e))}catch{}},ht=$o(void 0),Me=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Qo=()=>{let[e,n]=Ne(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return ft(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=o=>{n(o.matches?"dark":"light")};return r(t),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e},ke=({children:e,theme:n})=>{let t=Qo(),[r,o]=Ne(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ae);if(s){let l=JSON.parse(s);if(l?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(l?.preferredTheme)return l.preferredTheme}}catch{}return!n||Me(n)?"light":n.defaultMode||"light"}),[a,i]=Ne(()=>{if(typeof window<"u")try{let s=localStorage.getItem(Ae);if(s)return JSON.parse(s)?.isAuto??!1}catch{}return!n||Me(n)?!1:n.autoMode??!1}),m=Se(()=>{if(!n)return{type:"default",completeTheme:null,partialOverrides:null};if(Me(n))return{type:"complete",completeTheme:n,partialOverrides:null};let c=n;if(c.theme)return{type:"complete",completeTheme:c.theme,partialOverrides:null};let s=null;return r==="light"&&c.light?s=c.light:r==="dark"&&c.dark?s=c.dark:s={...c},{type:"partial",completeTheme:null,partialOverrides:s}},[r,n]),p=Se(()=>m.type==="complete"?m.completeTheme:null,[m]);pt(m,r);let u=zo(c=>{let s=c==="auto";i(s),o(s?t||"light":c);let l={isAuto:s,...s?{}:{preferredTheme:c}};Wo(l)},[t]);ft(()=>{a&&o(t||"light")},[t,a]);let f=Se(()=>({themeMode:r,setThemeChoice:u,currentTheme:p}),[r,u,p]);return Uo(ht.Provider,{value:f,children:e})},xt=()=>{let e=Zo(ht);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};import{Fragment as Xo,jsx as _,jsxs as gt}from"react/jsx-runtime";var ci=({children:e,config:n,queryClientConfig:t,theme:r})=>{let[o]=jo(()=>new Ko(t));return _(Jo,{client:o,children:_(qo,{config:n,children:_(ke,{theme:r,children:gt(Ve,{children:[_("div",{className:"font-base luno-kit",children:e}),_(Yo,{modalSize:n.modalSize})]})})})})},Yo=({modalSize:e})=>gt(Xo,{children:[_(mt,{size:e}),_(et,{}),_(ot,{})]});export{Po as ConnectButton,ci as LunoKitProvider,xt as useLunoTheme};
|
|
1793
3
|
//# sourceMappingURL=index.js.map
|