@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.cjs
CHANGED
|
@@ -1,13 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
9
29
|
|
|
10
30
|
// src/react.tsx
|
|
31
|
+
var react_exports = {};
|
|
32
|
+
__export(react_exports, {
|
|
33
|
+
ApprovalPending: () => ApprovalPending,
|
|
34
|
+
ConnectButton: () => ConnectButton,
|
|
35
|
+
ConnectionStatus: () => ConnectionStatus,
|
|
36
|
+
LoadingSpinner: () => LoadingSpinner,
|
|
37
|
+
NETWORKS: () => NETWORKS,
|
|
38
|
+
SafeWalletProvider: () => SafeWalletProvider,
|
|
39
|
+
WalletErrorBoundary: () => WalletErrorBoundary,
|
|
40
|
+
WalletModal: () => WalletModal,
|
|
41
|
+
WalletProvider: () => WalletProvider,
|
|
42
|
+
formatAddress: () => formatAddress,
|
|
43
|
+
formatBalance: () => formatBalance,
|
|
44
|
+
getRialoProvider: () => getRialoProvider,
|
|
45
|
+
isRialoInstalled: () => isRialoInstalled,
|
|
46
|
+
isValidAddress: () => isValidAddress,
|
|
47
|
+
useAccounts: () => useAccounts,
|
|
48
|
+
useActiveAccount: () => useActiveAccount,
|
|
49
|
+
useBalance: () => useBalance,
|
|
50
|
+
useChainId: () => useChainId,
|
|
51
|
+
useConnectWallet: () => useConnectWallet,
|
|
52
|
+
useDisconnectWallet: () => useDisconnectWallet,
|
|
53
|
+
useIsConnected: () => useIsConnected,
|
|
54
|
+
useNetwork: () => useNetwork,
|
|
55
|
+
useSendTransaction: () => useSendTransaction,
|
|
56
|
+
useSignMessage: () => useSignMessage,
|
|
57
|
+
useSignTransaction: () => useSignTransaction,
|
|
58
|
+
useSwitchNetwork: () => useSwitchNetwork,
|
|
59
|
+
useWallet: () => useWallet,
|
|
60
|
+
withWalletErrorBoundary: () => withWalletErrorBoundary
|
|
61
|
+
});
|
|
62
|
+
module.exports = __toCommonJS(react_exports);
|
|
63
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
11
64
|
|
|
12
65
|
// src/index.ts
|
|
13
66
|
var NETWORKS = {
|
|
@@ -103,7 +156,11 @@ function isValidAddress(address) {
|
|
|
103
156
|
if (address.length < 32 || address.length > 50) return false;
|
|
104
157
|
return /^[1-9A-HJ-NP-Za-km-z]+$/.test(address);
|
|
105
158
|
}
|
|
106
|
-
|
|
159
|
+
|
|
160
|
+
// src/ErrorBoundary.tsx
|
|
161
|
+
var import_react = require("react");
|
|
162
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
163
|
+
var WalletErrorBoundary = class extends import_react.Component {
|
|
107
164
|
constructor() {
|
|
108
165
|
super(...arguments);
|
|
109
166
|
this.state = {
|
|
@@ -126,7 +183,7 @@ var WalletErrorBoundary = class extends React2.Component {
|
|
|
126
183
|
if (this.props.fallback) {
|
|
127
184
|
return this.props.fallback;
|
|
128
185
|
}
|
|
129
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
130
187
|
"div",
|
|
131
188
|
{
|
|
132
189
|
style: {
|
|
@@ -137,7 +194,7 @@ var WalletErrorBoundary = class extends React2.Component {
|
|
|
137
194
|
textAlign: "center"
|
|
138
195
|
},
|
|
139
196
|
children: [
|
|
140
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
198
|
"div",
|
|
142
199
|
{
|
|
143
200
|
style: {
|
|
@@ -150,7 +207,7 @@ var WalletErrorBoundary = class extends React2.Component {
|
|
|
150
207
|
alignItems: "center",
|
|
151
208
|
justifyContent: "center"
|
|
152
209
|
},
|
|
153
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
154
211
|
"svg",
|
|
155
212
|
{
|
|
156
213
|
width: "24",
|
|
@@ -162,17 +219,17 @@ var WalletErrorBoundary = class extends React2.Component {
|
|
|
162
219
|
strokeLinecap: "round",
|
|
163
220
|
strokeLinejoin: "round",
|
|
164
221
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
168
225
|
]
|
|
169
226
|
}
|
|
170
227
|
)
|
|
171
228
|
}
|
|
172
229
|
),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { style: { margin: "0 0 8px", fontSize: "16px", fontWeight: 600, color: "#991b1b" }, children: "Wallet Connection Error" }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { margin: "0 0 16px", fontSize: "14px", color: "#b91c1c" }, children: this.state.error?.message || "Something went wrong" }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
233
|
"button",
|
|
177
234
|
{
|
|
178
235
|
onClick: this.handleRetry,
|
|
@@ -196,6 +253,9 @@ var WalletErrorBoundary = class extends React2.Component {
|
|
|
196
253
|
return this.props.children;
|
|
197
254
|
}
|
|
198
255
|
};
|
|
256
|
+
|
|
257
|
+
// src/LoadingStates.tsx
|
|
258
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
199
259
|
function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
200
260
|
const sizes = {
|
|
201
261
|
sm: { container: 20, stroke: 2 },
|
|
@@ -205,7 +265,7 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
|
205
265
|
const { container, stroke } = sizes[size];
|
|
206
266
|
const radius = (container - stroke) / 2;
|
|
207
267
|
const circumference = radius * 2 * Math.PI;
|
|
208
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
209
269
|
"svg",
|
|
210
270
|
{
|
|
211
271
|
width: container,
|
|
@@ -214,13 +274,13 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
|
214
274
|
className,
|
|
215
275
|
style: { animation: "wallet-spin 1s linear infinite" },
|
|
216
276
|
children: [
|
|
217
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: `
|
|
218
278
|
@keyframes wallet-spin {
|
|
219
279
|
from { transform: rotate(0deg); }
|
|
220
280
|
to { transform: rotate(360deg); }
|
|
221
281
|
}
|
|
222
282
|
` }),
|
|
223
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
224
284
|
"circle",
|
|
225
285
|
{
|
|
226
286
|
cx: container / 2,
|
|
@@ -232,7 +292,7 @@ function LoadingSpinner({ size = "md", color = "#6EB9A8", className = "" }) {
|
|
|
232
292
|
strokeOpacity: 0.2
|
|
233
293
|
}
|
|
234
294
|
),
|
|
235
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
236
296
|
"circle",
|
|
237
297
|
{
|
|
238
298
|
cx: container / 2,
|
|
@@ -256,7 +316,7 @@ function ApprovalPending({
|
|
|
256
316
|
walletName = "Sheep Wallet",
|
|
257
317
|
onCancel
|
|
258
318
|
}) {
|
|
259
|
-
return /* @__PURE__ */
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
260
320
|
"div",
|
|
261
321
|
{
|
|
262
322
|
style: {
|
|
@@ -267,7 +327,7 @@ function ApprovalPending({
|
|
|
267
327
|
border: "1px solid #e2e8f0"
|
|
268
328
|
},
|
|
269
329
|
children: [
|
|
270
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
271
331
|
"div",
|
|
272
332
|
{
|
|
273
333
|
style: {
|
|
@@ -282,8 +342,8 @@ function ApprovalPending({
|
|
|
282
342
|
position: "relative"
|
|
283
343
|
},
|
|
284
344
|
children: [
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingSpinner, { size: "lg" }),
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
287
347
|
"div",
|
|
288
348
|
{
|
|
289
349
|
style: {
|
|
@@ -299,7 +359,7 @@ function ApprovalPending({
|
|
|
299
359
|
]
|
|
300
360
|
}
|
|
301
361
|
),
|
|
302
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
303
363
|
"h3",
|
|
304
364
|
{
|
|
305
365
|
style: {
|
|
@@ -311,7 +371,7 @@ function ApprovalPending({
|
|
|
311
371
|
children: title
|
|
312
372
|
}
|
|
313
373
|
),
|
|
314
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
315
375
|
"p",
|
|
316
376
|
{
|
|
317
377
|
style: {
|
|
@@ -322,7 +382,7 @@ function ApprovalPending({
|
|
|
322
382
|
children: message
|
|
323
383
|
}
|
|
324
384
|
),
|
|
325
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
326
386
|
"p",
|
|
327
387
|
{
|
|
328
388
|
style: {
|
|
@@ -337,7 +397,7 @@ function ApprovalPending({
|
|
|
337
397
|
]
|
|
338
398
|
}
|
|
339
399
|
),
|
|
340
|
-
onCancel && /* @__PURE__ */
|
|
400
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
341
401
|
"button",
|
|
342
402
|
{
|
|
343
403
|
onClick: onCancel,
|
|
@@ -396,7 +456,7 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
396
456
|
}
|
|
397
457
|
};
|
|
398
458
|
const config = statusConfig[status];
|
|
399
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
400
460
|
"div",
|
|
401
461
|
{
|
|
402
462
|
style: {
|
|
@@ -407,7 +467,7 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
407
467
|
textAlign: "center"
|
|
408
468
|
},
|
|
409
469
|
children: [
|
|
410
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
411
471
|
"div",
|
|
412
472
|
{
|
|
413
473
|
style: {
|
|
@@ -420,15 +480,15 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
420
480
|
alignItems: "center",
|
|
421
481
|
justifyContent: "center"
|
|
422
482
|
},
|
|
423
|
-
children: status === "success" ? /* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
] }) : /* @__PURE__ */
|
|
483
|
+
children: status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "20,6 9,17 4,12" }) }) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: config.color, strokeWidth: "2", children: [
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
486
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingSpinner, { size: "sm", color: config.color })
|
|
427
487
|
}
|
|
428
488
|
),
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h4", { style: { margin: "0 0 4px", fontSize: "14px", fontWeight: 600, color: config.color }, children: config.title }),
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: { margin: 0, fontSize: "12px", color: "#64748b" }, children: message || config.defaultMessage }),
|
|
491
|
+
status === "error" && onRetry && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
432
492
|
"button",
|
|
433
493
|
{
|
|
434
494
|
onClick: onRetry,
|
|
@@ -450,25 +510,19 @@ function ConnectionStatus({ status, message, onRetry }) {
|
|
|
450
510
|
}
|
|
451
511
|
);
|
|
452
512
|
}
|
|
513
|
+
|
|
514
|
+
// src/react.tsx
|
|
515
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
516
|
+
var SHEEP_WALLET_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHJ4PSI4IiBmaWxsPSIjMUExQTFBIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSIxNCIgcj0iOCIgZmlsbD0iI0ZGRjhGMCIvPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTAiIHI9IjQiIGZpbGw9IiNGRkY4RjAiLz48Y2lyY2xlIGN4PSIyMCIgY3k9IjEwIiByPSI0IiBmaWxsPSIjRkZGOEYwIi8+PGNpcmNsZSBjeD0iMTMiIGN5PSIxMyIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGNpcmNsZSBjeD0iMTkiIGN5PSIxMyIgcj0iMS41IiBmaWxsPSIjMzMzIi8+PGVsbGlwc2UgY3g9IjE2IiBjeT0iMTciIHJ4PSIyIiByeT0iMS41IiBmaWxsPSIjRkZDMENCIi8+PHBhdGggZD0iTTE0IDI0QzE0IDIyLjkgMTQuOSAyMiAxNiAyMkMxNy4xIDIyIDE4IDIyLjkgMTggMjRWMjZIMTRWMjRaIiBmaWxsPSIjNkVCOUE4Ii8+PC9zdmc+";
|
|
453
517
|
var DEFAULT_WALLETS = [
|
|
454
518
|
{
|
|
455
519
|
id: "sheep-wallet",
|
|
456
520
|
name: "Sheep Wallet",
|
|
457
|
-
icon:
|
|
521
|
+
icon: SHEEP_WALLET_ICON,
|
|
458
522
|
downloadUrl: "https://rialo.io/wallet"
|
|
459
523
|
}
|
|
460
524
|
];
|
|
461
|
-
var
|
|
462
|
-
function withTimeout(promise, ms, message) {
|
|
463
|
-
let timeoutId;
|
|
464
|
-
const timeout = new Promise((_, reject) => {
|
|
465
|
-
timeoutId = setTimeout(() => reject(new Error(message)), ms);
|
|
466
|
-
});
|
|
467
|
-
return Promise.race([promise, timeout]).finally(() => {
|
|
468
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
var WalletContext = React2.createContext(null);
|
|
525
|
+
var WalletContext = (0, import_react2.createContext)(null);
|
|
472
526
|
function WalletProvider({
|
|
473
527
|
children,
|
|
474
528
|
network: initialNetwork = "devnet",
|
|
@@ -479,27 +533,26 @@ function WalletProvider({
|
|
|
479
533
|
onError,
|
|
480
534
|
onNetworkChange
|
|
481
535
|
}) {
|
|
482
|
-
const [connected, setConnected] =
|
|
483
|
-
const [connecting, setConnecting] =
|
|
484
|
-
const [accounts, setAccounts] =
|
|
485
|
-
const [network, setNetwork] =
|
|
486
|
-
const [balance, setBalance] =
|
|
487
|
-
const [selectedWallet, setSelectedWallet] =
|
|
488
|
-
const [isModalOpen, setIsModalOpen] =
|
|
489
|
-
const [provider, setProvider] =
|
|
490
|
-
const [error, setError] =
|
|
491
|
-
const
|
|
492
|
-
const chainId = React2.useMemo(() => `rialo:${network}`, [network]);
|
|
536
|
+
const [connected, setConnected] = (0, import_react2.useState)(false);
|
|
537
|
+
const [connecting, setConnecting] = (0, import_react2.useState)(false);
|
|
538
|
+
const [accounts, setAccounts] = (0, import_react2.useState)([]);
|
|
539
|
+
const [network, setNetwork] = (0, import_react2.useState)(initialNetwork);
|
|
540
|
+
const [balance, setBalance] = (0, import_react2.useState)(null);
|
|
541
|
+
const [selectedWallet, setSelectedWallet] = (0, import_react2.useState)(null);
|
|
542
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react2.useState)(false);
|
|
543
|
+
const [provider, setProvider] = (0, import_react2.useState)();
|
|
544
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
545
|
+
const chainId = (0, import_react2.useMemo)(() => `rialo:${network}`, [network]);
|
|
493
546
|
const activeAccount = accounts[0] || null;
|
|
494
547
|
const isInstalled = isRialoInstalled();
|
|
495
|
-
const wallets =
|
|
548
|
+
const wallets = (0, import_react2.useMemo)(() => {
|
|
496
549
|
const installed = isRialoInstalled();
|
|
497
550
|
return [...DEFAULT_WALLETS, ...customWallets].map((w) => ({
|
|
498
551
|
...w,
|
|
499
552
|
installed: w.id === "sheep-wallet" ? installed : false
|
|
500
553
|
}));
|
|
501
554
|
}, [customWallets]);
|
|
502
|
-
|
|
555
|
+
(0, import_react2.useEffect)(() => {
|
|
503
556
|
const init = async () => {
|
|
504
557
|
const p = await waitForRialoProvider(3e3);
|
|
505
558
|
setProvider(p);
|
|
@@ -509,7 +562,7 @@ function WalletProvider({
|
|
|
509
562
|
};
|
|
510
563
|
init();
|
|
511
564
|
}, [wallets]);
|
|
512
|
-
const refreshBalance =
|
|
565
|
+
const refreshBalance = (0, import_react2.useCallback)(async () => {
|
|
513
566
|
if (!provider || !activeAccount) return;
|
|
514
567
|
try {
|
|
515
568
|
const result = await provider.getBalance(activeAccount.address);
|
|
@@ -519,42 +572,24 @@ function WalletProvider({
|
|
|
519
572
|
console.error("Balance fetch error:", e);
|
|
520
573
|
}
|
|
521
574
|
}, [provider, activeAccount]);
|
|
522
|
-
|
|
575
|
+
(0, import_react2.useEffect)(() => {
|
|
523
576
|
if (connected && activeAccount && provider) {
|
|
524
577
|
refreshBalance();
|
|
525
578
|
const interval = setInterval(refreshBalance, 3e4);
|
|
526
579
|
return () => clearInterval(interval);
|
|
527
580
|
}
|
|
528
581
|
}, [connected, activeAccount, provider, refreshBalance]);
|
|
529
|
-
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
try {
|
|
535
|
-
const rawAccounts = await withTimeout(provider.getAccounts(), 5e3, "Auto-connect timed out");
|
|
536
|
-
const normalized = (rawAccounts || []).map((acc) => {
|
|
537
|
-
if (typeof acc === "string") return { address: acc, publicKey: acc };
|
|
538
|
-
return { address: acc.address, publicKey: acc.publicKey || acc.address };
|
|
539
|
-
});
|
|
540
|
-
if (cancelled) return;
|
|
541
|
-
setAccounts(normalized);
|
|
542
|
-
setConnected(true);
|
|
543
|
-
try {
|
|
544
|
-
const net = await provider.getNetwork();
|
|
545
|
-
if (!cancelled) setNetwork(net);
|
|
546
|
-
} catch {
|
|
582
|
+
(0, import_react2.useEffect)(() => {
|
|
583
|
+
if (autoConnect && provider && !connected && !connecting) {
|
|
584
|
+
provider.isConnected().then((isConn) => {
|
|
585
|
+
if (isConn) {
|
|
586
|
+
handleConnect();
|
|
547
587
|
}
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
return () => {
|
|
554
|
-
cancelled = true;
|
|
555
|
-
};
|
|
556
|
-
}, [provider, autoConnect, connected, connecting, onConnect]);
|
|
557
|
-
React2.useEffect(() => {
|
|
588
|
+
}).catch(() => {
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}, [provider, autoConnect, connected, connecting]);
|
|
592
|
+
(0, import_react2.useEffect)(() => {
|
|
558
593
|
if (!provider) return;
|
|
559
594
|
const cleanupFns = [];
|
|
560
595
|
cleanupFns.push(
|
|
@@ -603,65 +638,48 @@ function WalletProvider({
|
|
|
603
638
|
cleanupFns.forEach((fn) => fn?.());
|
|
604
639
|
};
|
|
605
640
|
}, [provider, onDisconnect, onNetworkChange]);
|
|
606
|
-
const handleConnect =
|
|
607
|
-
if (
|
|
608
|
-
|
|
641
|
+
const handleConnect = (0, import_react2.useCallback)(async () => {
|
|
642
|
+
if (!provider) {
|
|
643
|
+
const err = new Error("Rialo Wallet not installed");
|
|
644
|
+
setError(err);
|
|
645
|
+
onError?.(err);
|
|
646
|
+
throw err;
|
|
609
647
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
setError(null);
|
|
620
|
-
try {
|
|
621
|
-
console.log("[Adapter] Calling provider.connect()...");
|
|
622
|
-
const result = await withTimeout(
|
|
623
|
-
provider.connect(),
|
|
624
|
-
CONNECT_TIMEOUT_MS,
|
|
625
|
-
"Connect timed out. Please open Sheep Wallet extension and approve the request."
|
|
626
|
-
);
|
|
627
|
-
console.log("[Adapter] Connect result:", result);
|
|
628
|
-
const walletAccounts = result.map((acc) => {
|
|
629
|
-
if (typeof acc === "string") {
|
|
630
|
-
return { address: acc, publicKey: acc };
|
|
631
|
-
}
|
|
632
|
-
return {
|
|
633
|
-
address: acc.address,
|
|
634
|
-
publicKey: acc.publicKey || acc.address
|
|
635
|
-
};
|
|
636
|
-
});
|
|
637
|
-
setAccounts(walletAccounts);
|
|
638
|
-
setConnected(true);
|
|
639
|
-
setIsModalOpen(false);
|
|
640
|
-
try {
|
|
641
|
-
const net = await withTimeout(provider.getNetwork(), 5e3, "Network request timed out");
|
|
642
|
-
setNetwork(net);
|
|
643
|
-
} catch {
|
|
648
|
+
setConnecting(true);
|
|
649
|
+
setError(null);
|
|
650
|
+
try {
|
|
651
|
+
console.log("[Adapter] Calling provider.connect()...");
|
|
652
|
+
const result = await provider.connect();
|
|
653
|
+
console.log("[Adapter] Connect result:", result);
|
|
654
|
+
const walletAccounts = result.map((acc) => {
|
|
655
|
+
if (typeof acc === "string") {
|
|
656
|
+
return { address: acc, publicKey: acc };
|
|
644
657
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
658
|
+
return {
|
|
659
|
+
address: acc.address,
|
|
660
|
+
publicKey: acc.publicKey || acc.address
|
|
661
|
+
};
|
|
662
|
+
});
|
|
663
|
+
setAccounts(walletAccounts);
|
|
664
|
+
setConnected(true);
|
|
665
|
+
setIsModalOpen(false);
|
|
666
|
+
try {
|
|
667
|
+
const net = await provider.getNetwork();
|
|
668
|
+
setNetwork(net);
|
|
669
|
+
} catch {
|
|
655
670
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
671
|
+
onConnect?.(walletAccounts);
|
|
672
|
+
return walletAccounts;
|
|
673
|
+
} catch (e) {
|
|
674
|
+
const err = e;
|
|
675
|
+
setError(err);
|
|
676
|
+
onError?.(err);
|
|
677
|
+
throw err;
|
|
660
678
|
} finally {
|
|
661
|
-
|
|
679
|
+
setConnecting(false);
|
|
662
680
|
}
|
|
663
681
|
}, [provider, onConnect, onError]);
|
|
664
|
-
const handleDisconnect =
|
|
682
|
+
const handleDisconnect = (0, import_react2.useCallback)(async () => {
|
|
665
683
|
try {
|
|
666
684
|
if (provider) {
|
|
667
685
|
await provider.disconnect();
|
|
@@ -673,7 +691,7 @@ function WalletProvider({
|
|
|
673
691
|
setBalance(null);
|
|
674
692
|
onDisconnect?.();
|
|
675
693
|
}, [provider, onDisconnect]);
|
|
676
|
-
const selectWallet =
|
|
694
|
+
const selectWallet = (0, import_react2.useCallback)((walletId) => {
|
|
677
695
|
const wallet = wallets.find((w) => w.id === walletId);
|
|
678
696
|
if (wallet) {
|
|
679
697
|
setSelectedWallet(wallet);
|
|
@@ -684,40 +702,40 @@ function WalletProvider({
|
|
|
684
702
|
}
|
|
685
703
|
}
|
|
686
704
|
}, [wallets, handleConnect]);
|
|
687
|
-
const handleSwitchNetwork =
|
|
705
|
+
const handleSwitchNetwork = (0, import_react2.useCallback)(async (newNetwork) => {
|
|
688
706
|
if (provider) {
|
|
689
707
|
await provider.switchNetwork(newNetwork);
|
|
690
708
|
}
|
|
691
709
|
setNetwork(newNetwork);
|
|
692
710
|
onNetworkChange?.(newNetwork);
|
|
693
711
|
}, [provider, onNetworkChange]);
|
|
694
|
-
const handleSignMessage =
|
|
712
|
+
const handleSignMessage = (0, import_react2.useCallback)(async (message) => {
|
|
695
713
|
if (!provider || !connected) {
|
|
696
714
|
throw new Error("Wallet not connected");
|
|
697
715
|
}
|
|
698
716
|
return provider.signMessage(message);
|
|
699
717
|
}, [provider, connected]);
|
|
700
|
-
const handleSignTransaction =
|
|
718
|
+
const handleSignTransaction = (0, import_react2.useCallback)(async (tx) => {
|
|
701
719
|
if (!provider || !connected) {
|
|
702
720
|
throw new Error("Wallet not connected");
|
|
703
721
|
}
|
|
704
722
|
const result = await provider.signTransaction(tx);
|
|
705
723
|
return result.signature;
|
|
706
724
|
}, [provider, connected]);
|
|
707
|
-
const handleSendTransaction =
|
|
725
|
+
const handleSendTransaction = (0, import_react2.useCallback)(async (tx) => {
|
|
708
726
|
if (!provider || !connected) {
|
|
709
727
|
throw new Error("Wallet not connected");
|
|
710
728
|
}
|
|
711
729
|
return provider.sendTransaction(tx);
|
|
712
730
|
}, [provider, connected]);
|
|
713
|
-
const handleSignAndSendTransaction =
|
|
731
|
+
const handleSignAndSendTransaction = (0, import_react2.useCallback)(async (tx) => {
|
|
714
732
|
if (!provider || !connected) {
|
|
715
733
|
throw new Error("Wallet not connected");
|
|
716
734
|
}
|
|
717
735
|
return provider.signAndSendTransaction(tx);
|
|
718
736
|
}, [provider, connected]);
|
|
719
|
-
const openModal =
|
|
720
|
-
const closeModal =
|
|
737
|
+
const openModal = (0, import_react2.useCallback)(() => setIsModalOpen(true), []);
|
|
738
|
+
const closeModal = (0, import_react2.useCallback)(() => setIsModalOpen(false), []);
|
|
721
739
|
const value = {
|
|
722
740
|
connected,
|
|
723
741
|
connecting,
|
|
@@ -743,13 +761,13 @@ function WalletProvider({
|
|
|
743
761
|
openModal,
|
|
744
762
|
closeModal
|
|
745
763
|
};
|
|
746
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(WalletContext.Provider, { value, children: [
|
|
747
765
|
children,
|
|
748
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WalletModal, {})
|
|
749
767
|
] });
|
|
750
768
|
}
|
|
751
769
|
function useWallet() {
|
|
752
|
-
const context =
|
|
770
|
+
const context = (0, import_react2.useContext)(WalletContext);
|
|
753
771
|
if (!context) {
|
|
754
772
|
throw new Error("useWallet must be used within WalletProvider");
|
|
755
773
|
}
|
|
@@ -789,9 +807,9 @@ function useChainId() {
|
|
|
789
807
|
}
|
|
790
808
|
function useSwitchNetwork() {
|
|
791
809
|
const { switchNetwork, network } = useWallet();
|
|
792
|
-
const [switching, setSwitching] =
|
|
793
|
-
const [error, setError] =
|
|
794
|
-
const doSwitch =
|
|
810
|
+
const [switching, setSwitching] = (0, import_react2.useState)(false);
|
|
811
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
812
|
+
const doSwitch = (0, import_react2.useCallback)(async (newNetwork) => {
|
|
795
813
|
setSwitching(true);
|
|
796
814
|
setError(null);
|
|
797
815
|
try {
|
|
@@ -807,7 +825,7 @@ function useSwitchNetwork() {
|
|
|
807
825
|
}
|
|
808
826
|
function useConnectWallet() {
|
|
809
827
|
const { connect, connecting, openModal, isInstalled, error } = useWallet();
|
|
810
|
-
const handleConnect =
|
|
828
|
+
const handleConnect = (0, import_react2.useCallback)(() => {
|
|
811
829
|
openModal();
|
|
812
830
|
}, [openModal]);
|
|
813
831
|
return {
|
|
@@ -825,10 +843,10 @@ function useDisconnectWallet() {
|
|
|
825
843
|
}
|
|
826
844
|
function useSignMessage() {
|
|
827
845
|
const { signMessage, connected, activeAccount } = useWallet();
|
|
828
|
-
const [signing, setSigning] =
|
|
829
|
-
const [signature, setSignature] =
|
|
830
|
-
const [error, setError] =
|
|
831
|
-
const sign =
|
|
846
|
+
const [signing, setSigning] = (0, import_react2.useState)(false);
|
|
847
|
+
const [signature, setSignature] = (0, import_react2.useState)(null);
|
|
848
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
849
|
+
const sign = (0, import_react2.useCallback)(async (message) => {
|
|
832
850
|
if (!connected) {
|
|
833
851
|
setError(new Error("Wallet not connected"));
|
|
834
852
|
return null;
|
|
@@ -850,10 +868,10 @@ function useSignMessage() {
|
|
|
850
868
|
}
|
|
851
869
|
function useSendTransaction() {
|
|
852
870
|
const { signAndSendTransaction, connected } = useWallet();
|
|
853
|
-
const [sending, setSending] =
|
|
854
|
-
const [txHash, setTxHash] =
|
|
855
|
-
const [error, setError] =
|
|
856
|
-
const send =
|
|
871
|
+
const [sending, setSending] = (0, import_react2.useState)(false);
|
|
872
|
+
const [txHash, setTxHash] = (0, import_react2.useState)(null);
|
|
873
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
874
|
+
const send = (0, import_react2.useCallback)(async (tx) => {
|
|
857
875
|
if (!connected) {
|
|
858
876
|
setError(new Error("Wallet not connected"));
|
|
859
877
|
return null;
|
|
@@ -878,10 +896,10 @@ function useSendTransaction() {
|
|
|
878
896
|
}
|
|
879
897
|
function useSignTransaction() {
|
|
880
898
|
const { signTransaction, connected } = useWallet();
|
|
881
|
-
const [signing, setSigning] =
|
|
882
|
-
const [signature, setSignature] =
|
|
883
|
-
const [error, setError] =
|
|
884
|
-
const sign =
|
|
899
|
+
const [signing, setSigning] = (0, import_react2.useState)(false);
|
|
900
|
+
const [signature, setSignature] = (0, import_react2.useState)(null);
|
|
901
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
902
|
+
const sign = (0, import_react2.useCallback)(async (tx) => {
|
|
885
903
|
if (!connected) {
|
|
886
904
|
setError(new Error("Wallet not connected"));
|
|
887
905
|
return null;
|
|
@@ -921,7 +939,7 @@ function ConnectButton({
|
|
|
921
939
|
...style
|
|
922
940
|
};
|
|
923
941
|
if (connecting) {
|
|
924
|
-
return /* @__PURE__ */
|
|
942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
925
943
|
"button",
|
|
926
944
|
{
|
|
927
945
|
disabled: true,
|
|
@@ -932,7 +950,7 @@ function ConnectButton({
|
|
|
932
950
|
);
|
|
933
951
|
}
|
|
934
952
|
if (connected && activeAccount) {
|
|
935
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
936
954
|
"button",
|
|
937
955
|
{
|
|
938
956
|
onClick: () => disconnect(),
|
|
@@ -943,7 +961,7 @@ function ConnectButton({
|
|
|
943
961
|
color: "white"
|
|
944
962
|
},
|
|
945
963
|
children: [
|
|
946
|
-
showBalance && balance && /* @__PURE__ */
|
|
964
|
+
showBalance && balance && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { marginRight: 8 }, children: [
|
|
947
965
|
formatBalance(balance),
|
|
948
966
|
" RLO"
|
|
949
967
|
] }),
|
|
@@ -952,7 +970,7 @@ function ConnectButton({
|
|
|
952
970
|
}
|
|
953
971
|
);
|
|
954
972
|
}
|
|
955
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
956
974
|
"button",
|
|
957
975
|
{
|
|
958
976
|
onClick: openModal,
|
|
@@ -968,15 +986,15 @@ function ConnectButton({
|
|
|
968
986
|
}
|
|
969
987
|
var walletModalOwnerToken = null;
|
|
970
988
|
function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
971
|
-
const ownerRef =
|
|
972
|
-
const [isOwner] =
|
|
989
|
+
const ownerRef = import_react2.default.useRef({});
|
|
990
|
+
const [isOwner] = (0, import_react2.useState)(() => {
|
|
973
991
|
if (!walletModalOwnerToken) {
|
|
974
992
|
walletModalOwnerToken = ownerRef.current;
|
|
975
993
|
return true;
|
|
976
994
|
}
|
|
977
995
|
return walletModalOwnerToken === ownerRef.current;
|
|
978
996
|
});
|
|
979
|
-
|
|
997
|
+
(0, import_react2.useEffect)(() => {
|
|
980
998
|
return () => {
|
|
981
999
|
if (isOwner && walletModalOwnerToken === ownerRef.current) {
|
|
982
1000
|
walletModalOwnerToken = null;
|
|
@@ -986,7 +1004,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
986
1004
|
if (!isOwner) return null;
|
|
987
1005
|
const { isModalOpen, closeModal, wallets, selectWallet, connecting } = useWallet();
|
|
988
1006
|
if (!isModalOpen) return null;
|
|
989
|
-
return /* @__PURE__ */
|
|
1007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
990
1008
|
"div",
|
|
991
1009
|
{
|
|
992
1010
|
className,
|
|
@@ -1000,7 +1018,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1000
1018
|
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
1001
1019
|
},
|
|
1002
1020
|
onClick: closeModal,
|
|
1003
|
-
children: /* @__PURE__ */
|
|
1021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1004
1022
|
"div",
|
|
1005
1023
|
{
|
|
1006
1024
|
style: {
|
|
@@ -1014,9 +1032,9 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1014
1032
|
},
|
|
1015
1033
|
onClick: (e) => e.stopPropagation(),
|
|
1016
1034
|
children: [
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
|
|
1036
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: title }),
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1020
1038
|
"button",
|
|
1021
1039
|
{
|
|
1022
1040
|
onClick: closeModal,
|
|
@@ -1025,7 +1043,7 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1025
1043
|
}
|
|
1026
1044
|
)
|
|
1027
1045
|
] }),
|
|
1028
|
-
/* @__PURE__ */
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1029
1047
|
"button",
|
|
1030
1048
|
{
|
|
1031
1049
|
onClick: () => selectWallet(wallet.id),
|
|
@@ -1043,17 +1061,17 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1043
1061
|
transition: "all 0.2s ease"
|
|
1044
1062
|
},
|
|
1045
1063
|
children: [
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
/* @__PURE__ */
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { src: wallet.icon, alt: wallet.name, style: { width: 40, height: 40, borderRadius: 8 } }),
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { textAlign: "left", flex: 1 }, children: [
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontWeight: 500 }, children: wallet.name }),
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: "12px", color: "#666" }, children: wallet.installed ? "Detected" : "Not installed" })
|
|
1050
1068
|
] }),
|
|
1051
|
-
!wallet.installed && /* @__PURE__ */
|
|
1069
|
+
!wallet.installed && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: "12px", color: "#6EB9A8" }, children: "Install \u2192" })
|
|
1052
1070
|
]
|
|
1053
1071
|
},
|
|
1054
1072
|
wallet.id
|
|
1055
1073
|
)) }),
|
|
1056
|
-
/* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { marginTop: "20px", textAlign: "center", fontSize: "12px", color: "#999" }, children: "Powered by CookilLabs" })
|
|
1057
1075
|
]
|
|
1058
1076
|
}
|
|
1059
1077
|
)
|
|
@@ -1062,41 +1080,42 @@ function WalletModal({ title = "Connect Wallet", className = "" }) {
|
|
|
1062
1080
|
}
|
|
1063
1081
|
function withWalletErrorBoundary(WrappedComponent, fallback) {
|
|
1064
1082
|
return function WithErrorBoundary(props) {
|
|
1065
|
-
return /* @__PURE__ */
|
|
1083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WalletErrorBoundary, { fallback, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WrappedComponent, { ...props }) });
|
|
1066
1084
|
};
|
|
1067
1085
|
}
|
|
1068
1086
|
function SafeWalletProvider(props) {
|
|
1069
1087
|
const { errorFallback, ...providerProps } = props;
|
|
1070
|
-
return /* @__PURE__ */
|
|
1088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WalletErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WalletProvider, { ...providerProps }) });
|
|
1071
1089
|
}
|
|
1072
|
-
|
|
1073
|
-
exports
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1090
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1091
|
+
0 && (module.exports = {
|
|
1092
|
+
ApprovalPending,
|
|
1093
|
+
ConnectButton,
|
|
1094
|
+
ConnectionStatus,
|
|
1095
|
+
LoadingSpinner,
|
|
1096
|
+
NETWORKS,
|
|
1097
|
+
SafeWalletProvider,
|
|
1098
|
+
WalletErrorBoundary,
|
|
1099
|
+
WalletModal,
|
|
1100
|
+
WalletProvider,
|
|
1101
|
+
formatAddress,
|
|
1102
|
+
formatBalance,
|
|
1103
|
+
getRialoProvider,
|
|
1104
|
+
isRialoInstalled,
|
|
1105
|
+
isValidAddress,
|
|
1106
|
+
useAccounts,
|
|
1107
|
+
useActiveAccount,
|
|
1108
|
+
useBalance,
|
|
1109
|
+
useChainId,
|
|
1110
|
+
useConnectWallet,
|
|
1111
|
+
useDisconnectWallet,
|
|
1112
|
+
useIsConnected,
|
|
1113
|
+
useNetwork,
|
|
1114
|
+
useSendTransaction,
|
|
1115
|
+
useSignMessage,
|
|
1116
|
+
useSignTransaction,
|
|
1117
|
+
useSwitchNetwork,
|
|
1118
|
+
useWallet,
|
|
1119
|
+
withWalletErrorBoundary
|
|
1120
|
+
});
|
|
1102
1121
|
//# sourceMappingURL=react.cjs.map
|