@cookill/wallet-adapter 2.5.3 → 2.5.4
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/README.md +176 -110
- package/dist/ErrorBoundary.cjs +40 -20
- package/dist/ErrorBoundary.cjs.map +1 -1
- package/dist/ErrorBoundary.js +6 -6
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/LoadingStates.cjs +54 -32
- package/dist/LoadingStates.cjs.map +1 -1
- package/dist/LoadingStates.js +7 -5
- package/dist/LoadingStates.js.map +1 -1
- package/dist/index.cjs +48 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +244 -225
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +133 -136
- package/dist/react.js.map +1 -1
- package/dist/standard.cjs +42 -14
- package/dist/standard.cjs.map +1 -1
- package/dist/standard.d.cts +1 -1
- package/dist/standard.d.ts +1 -1
- package/dist/standard.js +11 -3
- package/dist/standard.js.map +1 -1
- package/package.json +4 -3
package/dist/react.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import React2, { createContext, Component, useState, useRef, useMemo, useEffect, useCallback, useContext } from 'react';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
1
|
// src/react.tsx
|
|
2
|
+
import React2, {
|
|
3
|
+
createContext,
|
|
4
|
+
useContext,
|
|
5
|
+
useState,
|
|
6
|
+
useEffect,
|
|
7
|
+
useCallback,
|
|
8
|
+
useMemo
|
|
9
|
+
} from "react";
|
|
5
10
|
|
|
6
11
|
// src/index.ts
|
|
7
12
|
var NETWORKS = {
|
|
@@ -97,6 +102,10 @@ function isValidAddress(address) {
|
|
|
97
102
|
if (address.length < 32 || address.length > 50) return false;
|
|
98
103
|
return /^[1-9A-HJ-NP-Za-km-z]+$/.test(address);
|
|
99
104
|
}
|
|
105
|
+
|
|
106
|
+
// src/ErrorBoundary.tsx
|
|
107
|
+
import { Component } from "react";
|
|
108
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
100
109
|
var WalletErrorBoundary = class extends Component {
|
|
101
110
|
constructor() {
|
|
102
111
|
super(...arguments);
|
|
@@ -190,6 +199,9 @@ var WalletErrorBoundary = class extends Component {
|
|
|
190
199
|
return this.props.children;
|
|
191
200
|
}
|
|
192
201
|
};
|
|
202
|
+
|
|
203
|
+
// src/LoadingStates.tsx
|
|
204
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
193
205
|
function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
194
206
|
const sizes = {
|
|
195
207
|
sm: { container: 20, stroke: 2 },
|
|
@@ -199,7 +211,7 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
|
199
211
|
const { container, stroke } = sizes[size];
|
|
200
212
|
const radius = (container - stroke) / 2;
|
|
201
213
|
const circumference = radius * 2 * Math.PI;
|
|
202
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ jsxs2(
|
|
203
215
|
"svg",
|
|
204
216
|
{
|
|
205
217
|
width: container,
|
|
@@ -208,13 +220,13 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
|
208
220
|
className,
|
|
209
221
|
style: { animation: "wallet-spin 1s linear infinite" },
|
|
210
222
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ jsx2("style", { children: `
|
|
212
224
|
@keyframes wallet-spin {
|
|
213
225
|
from { transform: rotate(0deg); }
|
|
214
226
|
to { transform: rotate(360deg); }
|
|
215
227
|
}
|
|
216
228
|
` }),
|
|
217
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ jsx2(
|
|
218
230
|
"circle",
|
|
219
231
|
{
|
|
220
232
|
cx: container / 2,
|
|
@@ -226,7 +238,7 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
|
226
238
|
strokeOpacity: 0.2
|
|
227
239
|
}
|
|
228
240
|
),
|
|
229
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ jsx2(
|
|
230
242
|
"circle",
|
|
231
243
|
{
|
|
232
244
|
cx: container / 2,
|
|
@@ -250,7 +262,7 @@ function ApprovalPending({
|
|
|
250
262
|
walletName = "Sheep Wallet",
|
|
251
263
|
onCancel
|
|
252
264
|
}) {
|
|
253
|
-
return /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ jsxs2(
|
|
254
266
|
"div",
|
|
255
267
|
{
|
|
256
268
|
style: {
|
|
@@ -261,7 +273,7 @@ function ApprovalPending({
|
|
|
261
273
|
border: "1px solid #e2e8f0"
|
|
262
274
|
},
|
|
263
275
|
children: [
|
|
264
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ jsxs2(
|
|
265
277
|
"div",
|
|
266
278
|
{
|
|
267
279
|
style: {
|
|
@@ -276,8 +288,8 @@ function ApprovalPending({
|
|
|
276
288
|
position: "relative"
|
|
277
289
|
},
|
|
278
290
|
children: [
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ jsx2(LoadingSpinner, { size: "lg" }),
|
|
292
|
+
/* @__PURE__ */ jsx2(
|
|
281
293
|
"div",
|
|
282
294
|
{
|
|
283
295
|
style: {
|
|
@@ -293,7 +305,7 @@ function ApprovalPending({
|
|
|
293
305
|
]
|
|
294
306
|
}
|
|
295
307
|
),
|
|
296
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ jsx2(
|
|
297
309
|
"h3",
|
|
298
310
|
{
|
|
299
311
|
style: {
|
|
@@ -305,7 +317,7 @@ function ApprovalPending({
|
|
|
305
317
|
children: title
|
|
306
318
|
}
|
|
307
319
|
),
|
|
308
|
-
/* @__PURE__ */
|
|
320
|
+
/* @__PURE__ */ jsx2(
|
|
309
321
|
"p",
|
|
310
322
|
{
|
|
311
323
|
style: {
|
|
@@ -316,7 +328,7 @@ function ApprovalPending({
|
|
|
316
328
|
children: message
|
|
317
329
|
}
|
|
318
330
|
),
|
|
319
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ jsxs2(
|
|
320
332
|
"p",
|
|
321
333
|
{
|
|
322
334
|
style: {
|
|
@@ -331,7 +343,7 @@ function ApprovalPending({
|
|
|
331
343
|
]
|
|
332
344
|
}
|
|
333
345
|
),
|
|
334
|
-
onCancel && /* @__PURE__ */
|
|
346
|
+
onCancel && /* @__PURE__ */ jsx2(
|
|
335
347
|
"button",
|
|
336
348
|
{
|
|
337
349
|
onClick: onCancel,
|
|
@@ -390,7 +402,7 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
390
402
|
}
|
|
391
403
|
};
|
|
392
404
|
const config = statusConfig[status];
|
|
393
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ jsxs2(
|
|
394
406
|
"div",
|
|
395
407
|
{
|
|
396
408
|
style: {
|
|
@@ -401,7 +413,7 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
401
413
|
textAlign: "center"
|
|
402
414
|
},
|
|
403
415
|
children: [
|
|
404
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ jsx2(
|
|
405
417
|
"div",
|
|
406
418
|
{
|
|
407
419
|
style: {
|
|
@@ -414,15 +426,15 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
414
426
|
alignItems: "center",
|
|
415
427
|
justifyContent: "center"
|
|
416
428
|
},
|
|
417
|
-
children: status === "success" ? /* @__PURE__ */
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
] }) : /* @__PURE__ */
|
|
429
|
+
children: status === "success" ? /* @__PURE__ */ jsx2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: /* @__PURE__ */ jsx2("polyline", { points: "20,6 9,17 4,12" }) }) : status === "error" ? /* @__PURE__ */ jsxs2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: [
|
|
430
|
+
/* @__PURE__ */ jsx2("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
431
|
+
/* @__PURE__ */ jsx2("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
432
|
+
] }) : /* @__PURE__ */ jsx2(LoadingSpinner, { size: "sm", color: config.color })
|
|
421
433
|
}
|
|
422
434
|
),
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ jsx2("h4", { style: { margin: "0 0 4px", fontSize: "14px", fontWeight: 600, color: config.color }, children: config.title }),
|
|
436
|
+
/* @__PURE__ */ jsx2("p", { style: { margin: 0, fontSize: "12px", color: "#64748b" }, children: message || config.defaultMessage }),
|
|
437
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx2(
|
|
426
438
|
"button",
|
|
427
439
|
{
|
|
428
440
|
onClick: onRetry,
|
|
@@ -444,24 +456,18 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
444
456
|
}
|
|
445
457
|
);
|
|
446
458
|
}
|
|
459
|
+
|
|
460
|
+
// src/react.tsx
|
|
461
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
462
|
+
var SHEEP_WALLET_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHJ4PSI4IiBmaWxsPSIjMUExQTFBIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSIxNCIgcj0iOCIgZmlsbD0iI0ZGRjhGMCIvPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTAiIHI9IjQiIGZpbGw9IiNGRkY4RjAiLz48Y2lyY2xlIGN4PSIyMCIgY3k9IjEwIiByPSI0IiBmaWxsPSIjRkZGOEYwIi8+PGNpcmNsZSBjeD0iMTMiIGN5PSIxMyIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGNpcmNsZSBjeD0iMTkiIGN5PSIxMyIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGVsbGlwc2UgY3g9IjE2IiBjeT0iMTciIHJ4PSIyIiByeT0iMS41IiBmaWxsPSIjRkZDMENCIi8+PHBhdGggZD0iTTE0IDI0QzE0IDIyLjkgMTQuOSAyMiAxNiAyMkMxNy4xIDIyIDE4IDIyLjkgMTggMjRWMjZIMTRWMjRaIiBmaWxsPSIjNkVCOUE4Ii8+PC9zdmc+";
|
|
447
463
|
var DEFAULT_WALLETS = [
|
|
448
464
|
{
|
|
449
465
|
id: "sheep-wallet",
|
|
450
466
|
name: "Sheep Wallet",
|
|
451
|
-
icon:
|
|
467
|
+
icon: SHEEP_WALLET_ICON,
|
|
452
468
|
downloadUrl: "https://rialo.io/wallet"
|
|
453
469
|
}
|
|
454
470
|
];
|
|
455
|
-
var CONNECT_TIMEOUT_MS = 2e4;
|
|
456
|
-
function withTimeout(promise, ms, message) {
|
|
457
|
-
let timeoutId;
|
|
458
|
-
const timeout = new Promise((_, reject) => {
|
|
459
|
-
timeoutId = setTimeout(() => reject(new Error(message)), ms);
|
|
460
|
-
});
|
|
461
|
-
return Promise.race([promise, timeout]).finally(() => {
|
|
462
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
471
|
var WalletContext = createContext(null);
|
|
466
472
|
function WalletProvider({
|
|
467
473
|
children,
|
|
@@ -482,7 +488,6 @@ function WalletProvider({
|
|
|
482
488
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
483
489
|
const [provider, setProvider] = useState();
|
|
484
490
|
const [error, setError] = useState(null);
|
|
485
|
-
const connectPromiseRef = useRef(null);
|
|
486
491
|
const chainId = useMemo(() => `rialo:${network}`, [network]);
|
|
487
492
|
const activeAccount = accounts[0] || null;
|
|
488
493
|
const isInstalled = isRialoInstalled();
|
|
@@ -521,33 +526,15 @@ function WalletProvider({
|
|
|
521
526
|
}
|
|
522
527
|
}, [connected, activeAccount, provider, refreshBalance]);
|
|
523
528
|
useEffect(() => {
|
|
524
|
-
if (
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
try {
|
|
529
|
-
const rawAccounts = await withTimeout(provider.getAccounts(), 5e3, "Auto-connect timed out");
|
|
530
|
-
const normalized = (rawAccounts || []).map((acc) => {
|
|
531
|
-
if (typeof acc === "string") return { address: acc, publicKey: acc };
|
|
532
|
-
return { address: acc.address, publicKey: acc.publicKey || acc.address };
|
|
533
|
-
});
|
|
534
|
-
if (cancelled) return;
|
|
535
|
-
setAccounts(normalized);
|
|
536
|
-
setConnected(true);
|
|
537
|
-
try {
|
|
538
|
-
const net = await provider.getNetwork();
|
|
539
|
-
if (!cancelled) setNetwork(net);
|
|
540
|
-
} catch {
|
|
529
|
+
if (autoConnect && provider && !connected && !connecting) {
|
|
530
|
+
provider.isConnected().then((isConn) => {
|
|
531
|
+
if (isConn) {
|
|
532
|
+
handleConnect();
|
|
541
533
|
}
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
});
|
|
547
|
-
return () => {
|
|
548
|
-
cancelled = true;
|
|
549
|
-
};
|
|
550
|
-
}, [provider, autoConnect, connected, connecting, onConnect]);
|
|
534
|
+
}).catch(() => {
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}, [provider, autoConnect, connected, connecting]);
|
|
551
538
|
useEffect(() => {
|
|
552
539
|
if (!provider) return;
|
|
553
540
|
const cleanupFns = [];
|
|
@@ -598,61 +585,44 @@ function WalletProvider({
|
|
|
598
585
|
};
|
|
599
586
|
}, [provider, onDisconnect, onNetworkChange]);
|
|
600
587
|
const handleConnect = useCallback(async () => {
|
|
601
|
-
if (
|
|
602
|
-
|
|
588
|
+
if (!provider) {
|
|
589
|
+
const err = new Error("Rialo Wallet not installed");
|
|
590
|
+
setError(err);
|
|
591
|
+
onError?.(err);
|
|
592
|
+
throw err;
|
|
603
593
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
setError(null);
|
|
614
|
-
try {
|
|
615
|
-
console.log("[Adapter] Calling provider.connect()...");
|
|
616
|
-
const result = await withTimeout(
|
|
617
|
-
provider.connect(),
|
|
618
|
-
CONNECT_TIMEOUT_MS,
|
|
619
|
-
"Connect timed out. Please open Sheep Wallet extension and approve the request."
|
|
620
|
-
);
|
|
621
|
-
console.log("[Adapter] Connect result:", result);
|
|
622
|
-
const walletAccounts = result.map((acc) => {
|
|
623
|
-
if (typeof acc === "string") {
|
|
624
|
-
return { address: acc, publicKey: acc };
|
|
625
|
-
}
|
|
626
|
-
return {
|
|
627
|
-
address: acc.address,
|
|
628
|
-
publicKey: acc.publicKey || acc.address
|
|
629
|
-
};
|
|
630
|
-
});
|
|
631
|
-
setAccounts(walletAccounts);
|
|
632
|
-
setConnected(true);
|
|
633
|
-
setIsModalOpen(false);
|
|
634
|
-
try {
|
|
635
|
-
const net = await withTimeout(provider.getNetwork(), 5e3, "Network request timed out");
|
|
636
|
-
setNetwork(net);
|
|
637
|
-
} catch {
|
|
594
|
+
setConnecting(true);
|
|
595
|
+
setError(null);
|
|
596
|
+
try {
|
|
597
|
+
console.log("[Adapter] Calling provider.connect()...");
|
|
598
|
+
const result = await provider.connect();
|
|
599
|
+
console.log("[Adapter] Connect result:", result);
|
|
600
|
+
const walletAccounts = result.map((acc) => {
|
|
601
|
+
if (typeof acc === "string") {
|
|
602
|
+
return { address: acc, publicKey: acc };
|
|
638
603
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
604
|
+
return {
|
|
605
|
+
address: acc.address,
|
|
606
|
+
publicKey: acc.publicKey || acc.address
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
setAccounts(walletAccounts);
|
|
610
|
+
setConnected(true);
|
|
611
|
+
setIsModalOpen(false);
|
|
612
|
+
try {
|
|
613
|
+
const net = await provider.getNetwork();
|
|
614
|
+
setNetwork(net);
|
|
615
|
+
} catch {
|
|
649
616
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
617
|
+
onConnect?.(walletAccounts);
|
|
618
|
+
return walletAccounts;
|
|
619
|
+
} catch (e) {
|
|
620
|
+
const err = e;
|
|
621
|
+
setError(err);
|
|
622
|
+
onError?.(err);
|
|
623
|
+
throw err;
|
|
654
624
|
} finally {
|
|
655
|
-
|
|
625
|
+
setConnecting(false);
|
|
656
626
|
}
|
|
657
627
|
}, [provider, onConnect, onError]);
|
|
658
628
|
const handleDisconnect = useCallback(async () => {
|
|
@@ -737,9 +707,9 @@ function WalletProvider({
|
|
|
737
707
|
openModal,
|
|
738
708
|
closeModal
|
|
739
709
|
};
|
|
740
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ jsxs3(WalletContext.Provider, { value, children: [
|
|
741
711
|
children,
|
|
742
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ jsx3(WalletModal, {})
|
|
743
713
|
] });
|
|
744
714
|
}
|
|
745
715
|
function useWallet() {
|
|
@@ -915,7 +885,7 @@ function ConnectButton({
|
|
|
915
885
|
...style
|
|
916
886
|
};
|
|
917
887
|
if (connecting) {
|
|
918
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ jsx3(
|
|
919
889
|
"button",
|
|
920
890
|
{
|
|
921
891
|
disabled: true,
|
|
@@ -926,7 +896,7 @@ function ConnectButton({
|
|
|
926
896
|
);
|
|
927
897
|
}
|
|
928
898
|
if (connected && activeAccount) {
|
|
929
|
-
return /* @__PURE__ */
|
|
899
|
+
return /* @__PURE__ */ jsxs3(
|
|
930
900
|
"button",
|
|
931
901
|
{
|
|
932
902
|
onClick: () => disconnect(),
|
|
@@ -937,7 +907,7 @@ function ConnectButton({
|
|
|
937
907
|
color: "white"
|
|
938
908
|
},
|
|
939
909
|
children: [
|
|
940
|
-
showBalance && balance && /* @__PURE__ */
|
|
910
|
+
showBalance && balance && /* @__PURE__ */ jsxs3("span", { style: { marginRight: 8 }, children: [
|
|
941
911
|
formatBalance(balance),
|
|
942
912
|
" RLO"
|
|
943
913
|
] }),
|
|
@@ -946,7 +916,7 @@ function ConnectButton({
|
|
|
946
916
|
}
|
|
947
917
|
);
|
|
948
918
|
}
|
|
949
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsx3(
|
|
950
920
|
"button",
|
|
951
921
|
{
|
|
952
922
|
onClick: openModal,
|
|
@@ -980,7 +950,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
980
950
|
if (!isOwner) return null;
|
|
981
951
|
const { isModalOpen, closeModal, wallets, selectWallet, connecting } = useWallet();
|
|
982
952
|
if (!isModalOpen) return null;
|
|
983
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsx3(
|
|
984
954
|
"div",
|
|
985
955
|
{
|
|
986
956
|
className,
|
|
@@ -994,7 +964,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
994
964
|
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
995
965
|
},
|
|
996
966
|
onClick: closeModal,
|
|
997
|
-
children: /* @__PURE__ */
|
|
967
|
+
children: /* @__PURE__ */ jsxs3(
|
|
998
968
|
"div",
|
|
999
969
|
{
|
|
1000
970
|
style: {
|
|
@@ -1008,9 +978,9 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1008
978
|
},
|
|
1009
979
|
onClick: (e) => e.stopPropagation(),
|
|
1010
980
|
children: [
|
|
1011
|
-
/* @__PURE__ */
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
|
|
982
|
+
/* @__PURE__ */ jsx3("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: title }),
|
|
983
|
+
/* @__PURE__ */ jsx3(
|
|
1014
984
|
"button",
|
|
1015
985
|
{
|
|
1016
986
|
onClick: closeModal,
|
|
@@ -1019,7 +989,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1019
989
|
}
|
|
1020
990
|
)
|
|
1021
991
|
] }),
|
|
1022
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ jsx3("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: wallets.map((wallet) => /* @__PURE__ */ jsxs3(
|
|
1023
993
|
"button",
|
|
1024
994
|
{
|
|
1025
995
|
onClick: () => selectWallet(wallet.id),
|
|
@@ -1037,17 +1007,17 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1037
1007
|
transition: "all 0.2s ease"
|
|
1038
1008
|
},
|
|
1039
1009
|
children: [
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ jsx3("img", { src: wallet.icon, alt: wallet.name, style: { width: 40, height: 40, borderRadius: 8 } }),
|
|
1011
|
+
/* @__PURE__ */ jsxs3("div", { style: { textAlign: "left", flex: 1 }, children: [
|
|
1012
|
+
/* @__PURE__ */ jsx3("div", { style: { fontWeight: 500 }, children: wallet.name }),
|
|
1013
|
+
/* @__PURE__ */ jsx3("div", { style: { fontSize: "12px", color: "#666" }, children: wallet.installed ? "Detected" : "Not installed" })
|
|
1044
1014
|
] }),
|
|
1045
|
-
!wallet.installed && /* @__PURE__ */
|
|
1015
|
+
!wallet.installed && /* @__PURE__ */ jsx3("span", { style: { fontSize: "12px", color: "#6EB9A8" }, children: "Install \u2192" })
|
|
1046
1016
|
]
|
|
1047
1017
|
},
|
|
1048
1018
|
wallet.id
|
|
1049
1019
|
)) }),
|
|
1050
|
-
/* @__PURE__ */
|
|
1020
|
+
/* @__PURE__ */ jsx3("div", { style: { marginTop: "20px", textAlign: "center", fontSize: "12px", color: "#999" }, children: "Powered by CookilLabs" })
|
|
1051
1021
|
]
|
|
1052
1022
|
}
|
|
1053
1023
|
)
|
|
@@ -1056,14 +1026,41 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1056
1026
|
}
|
|
1057
1027
|
function withWalletErrorBoundary(WrappedComponent, fallback) {
|
|
1058
1028
|
return function WithErrorBoundary(props) {
|
|
1059
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ jsx3(WalletErrorBoundary, { fallback, children: /* @__PURE__ */ jsx3(WrappedComponent, { ...props }) });
|
|
1060
1030
|
};
|
|
1061
1031
|
}
|
|
1062
1032
|
function SafeWalletProvider(props) {
|
|
1063
1033
|
const { errorFallback, ...providerProps } = props;
|
|
1064
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsx3(WalletErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ jsx3(WalletProvider, { ...providerProps }) });
|
|
1065
1035
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1036
|
+
export {
|
|
1037
|
+
ApprovalPending,
|
|
1038
|
+
ConnectButton,
|
|
1039
|
+
ConnectionStatus,
|
|
1040
|
+
LoadingSpinner,
|
|
1041
|
+
NETWORKS,
|
|
1042
|
+
SafeWalletProvider,
|
|
1043
|
+
WalletErrorBoundary,
|
|
1044
|
+
WalletModal,
|
|
1045
|
+
WalletProvider,
|
|
1046
|
+
formatAddress,
|
|
1047
|
+
formatBalance,
|
|
1048
|
+
getRialoProvider,
|
|
1049
|
+
isRialoInstalled,
|
|
1050
|
+
isValidAddress,
|
|
1051
|
+
useAccounts,
|
|
1052
|
+
useActiveAccount,
|
|
1053
|
+
useBalance,
|
|
1054
|
+
useChainId,
|
|
1055
|
+
useConnectWallet,
|
|
1056
|
+
useDisconnectWallet,
|
|
1057
|
+
useIsConnected,
|
|
1058
|
+
useNetwork,
|
|
1059
|
+
useSendTransaction,
|
|
1060
|
+
useSignMessage,
|
|
1061
|
+
useSignTransaction,
|
|
1062
|
+
useSwitchNetwork,
|
|
1063
|
+
useWallet,
|
|
1064
|
+
withWalletErrorBoundary
|
|
1065
|
+
};
|
|
1069
1066
|
//# sourceMappingURL=react.js.map
|