@solana/connector 0.1.9 → 0.2.0
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 +403 -50
- package/dist/chunk-4KD6HQQG.js +69 -0
- package/dist/chunk-4KD6HQQG.js.map +1 -0
- package/dist/chunk-BJAVJQLK.js +230 -0
- package/dist/chunk-BJAVJQLK.js.map +1 -0
- package/dist/{chunk-5HRJKCIL.js → chunk-BZ2VBJCZ.js} +1061 -424
- package/dist/chunk-BZ2VBJCZ.js.map +1 -0
- package/dist/{chunk-WDXEP4AJ.js → chunk-EM4KNOKG.js} +658 -190
- package/dist/chunk-EM4KNOKG.js.map +1 -0
- package/dist/chunk-HN5AJF7F.js +507 -0
- package/dist/chunk-HN5AJF7F.js.map +1 -0
- package/dist/chunk-HO6QNKFM.mjs +61 -0
- package/dist/chunk-HO6QNKFM.mjs.map +1 -0
- package/dist/chunk-HPQ5T32K.mjs +178 -0
- package/dist/chunk-HPQ5T32K.mjs.map +1 -0
- package/dist/{chunk-MAXA3HEP.mjs → chunk-IDTUFDNB.mjs} +962 -344
- package/dist/chunk-IDTUFDNB.mjs.map +1 -0
- package/dist/{chunk-P5LXUDP6.mjs → chunk-RTXUS5KG.mjs} +579 -119
- package/dist/chunk-RTXUS5KG.mjs.map +1 -0
- package/dist/{chunk-DSUCH44G.js → chunk-SITQ4JWM.js} +23 -67
- package/dist/chunk-SITQ4JWM.js.map +1 -0
- package/dist/chunk-UCISIAOG.mjs +501 -0
- package/dist/chunk-UCISIAOG.mjs.map +1 -0
- package/dist/{chunk-J7DHGLW6.mjs → chunk-ZZTY3O4N.mjs} +21 -61
- package/dist/chunk-ZZTY3O4N.mjs.map +1 -0
- package/dist/compat.d.mts +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +10 -9
- package/dist/compat.js.map +1 -1
- package/dist/compat.mjs +2 -1
- package/dist/compat.mjs.map +1 -1
- package/dist/headless.d.mts +239 -104
- package/dist/headless.d.ts +239 -104
- package/dist/headless.js +255 -169
- package/dist/headless.mjs +5 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +316 -206
- package/dist/index.mjs +6 -4
- package/dist/react.d.mts +299 -9
- package/dist/react.d.ts +299 -9
- package/dist/react.js +90 -38
- package/dist/react.mjs +2 -2
- package/dist/{standard-shim-CT49DM5l.d.mts → standard-shim-CGB88PPO.d.mts} +673 -52
- package/dist/{standard-shim-D9guL5fz.d.ts → standard-shim-tmnQelaJ.d.ts} +673 -52
- package/dist/{transaction-signer-T-KVQFi8.d.mts → transaction-signer-7NaYmP5w.d.mts} +1 -0
- package/dist/{transaction-signer-T-KVQFi8.d.ts → transaction-signer-7NaYmP5w.d.ts} +1 -0
- package/dist/walletconnect-447EY3OJ.js +28 -0
- package/dist/walletconnect-447EY3OJ.js.map +1 -0
- package/dist/walletconnect-U455PO4I.mjs +3 -0
- package/dist/walletconnect-U455PO4I.mjs.map +1 -0
- package/package.json +6 -2
- package/dist/chunk-5HRJKCIL.js.map +0 -1
- package/dist/chunk-DSUCH44G.js.map +0 -1
- package/dist/chunk-I6TJLYNA.js +0 -535
- package/dist/chunk-I6TJLYNA.js.map +0 -1
- package/dist/chunk-J7DHGLW6.mjs.map +0 -1
- package/dist/chunk-JOBLG62A.mjs +0 -476
- package/dist/chunk-JOBLG62A.mjs.map +0 -1
- package/dist/chunk-MAXA3HEP.mjs.map +0 -1
- package/dist/chunk-P5LXUDP6.mjs.map +0 -1
- package/dist/chunk-WDXEP4AJ.js.map +0 -1
|
@@ -1,11 +1,312 @@
|
|
|
1
|
-
import { installPolyfills,
|
|
2
|
-
import { createLogger, __publicField, createSolanaClient, NetworkError, prepareTransaction } from './chunk-
|
|
3
|
-
import
|
|
4
|
-
import { jsx,
|
|
1
|
+
import { installPolyfills, isMainnetCluster, isDevnetCluster, isTestnetCluster, isLocalCluster, getClusterExplorerUrl, getClusterType, formatAddress, copyAddressToClipboard, createConnectorId, createTransactionSigner, createKitTransactionSigner, formatLamportsToSolSafe, getTransactionUrl, ConnectorClient, formatBigIntBalance, formatBigIntUsd } from './chunk-IDTUFDNB.mjs';
|
|
2
|
+
import { createLogger, __publicField, WalletErrorType, createSolanaClient, NetworkError, prepareTransaction, isConnectorError } from './chunk-ZZTY3O4N.mjs';
|
|
3
|
+
import React2, { createContext, Component, useTransition, useState, useCallback, useMemo, useRef, useEffect, useContext, useSyncExternalStore } from 'react';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { address } from '@solana/addresses';
|
|
6
6
|
import { signature } from '@solana/keys';
|
|
7
7
|
|
|
8
|
-
var logger = createLogger("
|
|
8
|
+
var logger = createLogger("ErrorBoundary");
|
|
9
|
+
var ErrorLogger = class {
|
|
10
|
+
static log(error, errorInfo, context) {
|
|
11
|
+
if (process.env.NODE_ENV === "development" && logger.error(error.message, {
|
|
12
|
+
error,
|
|
13
|
+
errorInfo,
|
|
14
|
+
context
|
|
15
|
+
}), process.env.NODE_ENV === "production" && typeof window < "u")
|
|
16
|
+
try {
|
|
17
|
+
let gtag = window.gtag;
|
|
18
|
+
typeof gtag == "function" && gtag("event", "exception", {
|
|
19
|
+
description: error.message,
|
|
20
|
+
fatal: false,
|
|
21
|
+
custom_map: { error_type: "wallet_error", ...context }
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function classifyError(error) {
|
|
28
|
+
if (isConnectorError(error)) {
|
|
29
|
+
let typeMapping = {
|
|
30
|
+
WALLET_NOT_CONNECTED: WalletErrorType.CONNECTION_FAILED,
|
|
31
|
+
WALLET_NOT_FOUND: WalletErrorType.WALLET_NOT_FOUND,
|
|
32
|
+
CONNECTION_FAILED: WalletErrorType.CONNECTION_FAILED,
|
|
33
|
+
USER_REJECTED: WalletErrorType.USER_REJECTED,
|
|
34
|
+
RPC_ERROR: WalletErrorType.NETWORK_ERROR,
|
|
35
|
+
NETWORK_TIMEOUT: WalletErrorType.NETWORK_ERROR,
|
|
36
|
+
SIGNING_FAILED: WalletErrorType.TRANSACTION_FAILED,
|
|
37
|
+
SEND_FAILED: WalletErrorType.TRANSACTION_FAILED
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
...error,
|
|
41
|
+
type: typeMapping[error.code] || WalletErrorType.UNKNOWN_ERROR,
|
|
42
|
+
recoverable: error.recoverable,
|
|
43
|
+
context: error.context
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
let walletError = error;
|
|
47
|
+
if (walletError.type) return walletError;
|
|
48
|
+
let type = WalletErrorType.UNKNOWN_ERROR, recoverable = false;
|
|
49
|
+
return error.message.includes("User rejected") || error.message.includes("User denied") ? (type = WalletErrorType.USER_REJECTED, recoverable = true) : error.message.includes("Insufficient funds") ? (type = WalletErrorType.INSUFFICIENT_FUNDS, recoverable = false) : error.message.includes("Network") || error.message.includes("fetch") ? (type = WalletErrorType.NETWORK_ERROR, recoverable = true) : error.message.includes("Wallet not found") || error.message.includes("not installed") ? (type = WalletErrorType.WALLET_NOT_FOUND, recoverable = true) : (error.message.includes("Failed to connect") || error.message.includes("Connection")) && (type = WalletErrorType.CONNECTION_FAILED, recoverable = true), {
|
|
50
|
+
...error,
|
|
51
|
+
type,
|
|
52
|
+
recoverable,
|
|
53
|
+
context: { originalMessage: error.message }
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var ConnectorErrorBoundary = class extends Component {
|
|
57
|
+
constructor(props) {
|
|
58
|
+
super(props);
|
|
59
|
+
__publicField(this, "retryTimeouts", /* @__PURE__ */ new Set());
|
|
60
|
+
__publicField(this, "retry", () => {
|
|
61
|
+
let { maxRetries = 3 } = this.props;
|
|
62
|
+
this.state.retryCount >= maxRetries || this.setState((prevState) => ({
|
|
63
|
+
hasError: false,
|
|
64
|
+
error: null,
|
|
65
|
+
errorInfo: null,
|
|
66
|
+
retryCount: prevState.retryCount + 1
|
|
67
|
+
}));
|
|
68
|
+
});
|
|
69
|
+
this.state = {
|
|
70
|
+
hasError: false,
|
|
71
|
+
error: null,
|
|
72
|
+
errorInfo: null,
|
|
73
|
+
errorId: "",
|
|
74
|
+
retryCount: 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static getDerivedStateFromError(error) {
|
|
78
|
+
return {
|
|
79
|
+
hasError: true,
|
|
80
|
+
error,
|
|
81
|
+
errorId: `error_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
componentDidCatch(error, errorInfo) {
|
|
85
|
+
this.setState({ errorInfo }), ErrorLogger.log(error, errorInfo, {
|
|
86
|
+
retryCount: this.state.retryCount,
|
|
87
|
+
errorId: this.state.errorId,
|
|
88
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
89
|
+
}), this.props.onError?.(error, errorInfo);
|
|
90
|
+
}
|
|
91
|
+
componentWillUnmount() {
|
|
92
|
+
this.retryTimeouts.forEach((timeout) => clearTimeout(timeout));
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
if (this.state.hasError && this.state.error) {
|
|
96
|
+
let walletError = classifyError(this.state.error);
|
|
97
|
+
return this.props.fallback ? this.props.fallback(walletError, this.retry) : /* @__PURE__ */ jsx(DefaultErrorFallback, { error: walletError, onRetry: this.retry });
|
|
98
|
+
}
|
|
99
|
+
return this.props.children;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
function DefaultErrorFallback({ error, onRetry }) {
|
|
103
|
+
let [isPending, startTransition] = useTransition(), [isRetrying, setIsRetrying] = useState(false), handleRetry = useCallback(() => {
|
|
104
|
+
setIsRetrying(true), startTransition(() => {
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
onRetry(), setIsRetrying(false);
|
|
107
|
+
}, 500);
|
|
108
|
+
});
|
|
109
|
+
}, [onRetry]), { title, message, actionText, showRetry } = useMemo(() => {
|
|
110
|
+
switch (error.type) {
|
|
111
|
+
case WalletErrorType.USER_REJECTED:
|
|
112
|
+
return {
|
|
113
|
+
title: "Transaction Cancelled",
|
|
114
|
+
message: "You cancelled the transaction. No problem!",
|
|
115
|
+
actionText: "Try Again",
|
|
116
|
+
showRetry: true
|
|
117
|
+
};
|
|
118
|
+
case WalletErrorType.WALLET_NOT_FOUND:
|
|
119
|
+
return {
|
|
120
|
+
title: "Wallet Not Found",
|
|
121
|
+
message: "Please install a supported Solana wallet to continue.",
|
|
122
|
+
actionText: "Check Wallets",
|
|
123
|
+
showRetry: true
|
|
124
|
+
};
|
|
125
|
+
case WalletErrorType.NETWORK_ERROR:
|
|
126
|
+
return {
|
|
127
|
+
title: "Network Error",
|
|
128
|
+
message: "Having trouble connecting. Please check your internet connection.",
|
|
129
|
+
actionText: "Retry",
|
|
130
|
+
showRetry: true
|
|
131
|
+
};
|
|
132
|
+
case WalletErrorType.INSUFFICIENT_FUNDS:
|
|
133
|
+
return {
|
|
134
|
+
title: "Insufficient Funds",
|
|
135
|
+
message: "You don't have enough SOL for this transaction.",
|
|
136
|
+
actionText: "Add Funds",
|
|
137
|
+
showRetry: false
|
|
138
|
+
};
|
|
139
|
+
default:
|
|
140
|
+
return {
|
|
141
|
+
title: "Something went wrong",
|
|
142
|
+
message: "An unexpected error occurred. Please try again.",
|
|
143
|
+
actionText: "Retry",
|
|
144
|
+
showRetry: error.recoverable
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}, [error.type, error.recoverable]);
|
|
148
|
+
return /* @__PURE__ */ jsxs(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
style: {
|
|
152
|
+
display: "flex",
|
|
153
|
+
flexDirection: "column",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
padding: "2rem",
|
|
157
|
+
textAlign: "center",
|
|
158
|
+
borderRadius: "12px",
|
|
159
|
+
border: "1px solid #e5e7eb",
|
|
160
|
+
backgroundColor: "#fafafa",
|
|
161
|
+
maxWidth: "400px",
|
|
162
|
+
margin: "0 auto"
|
|
163
|
+
},
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
style: {
|
|
169
|
+
width: "48px",
|
|
170
|
+
height: "48px",
|
|
171
|
+
borderRadius: "50%",
|
|
172
|
+
backgroundColor: "#fee2e2",
|
|
173
|
+
display: "flex",
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
justifyContent: "center",
|
|
176
|
+
marginBottom: "1rem"
|
|
177
|
+
},
|
|
178
|
+
children: /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "#dc2626", children: /* @__PURE__ */ jsx("path", { d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" }) })
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
"h3",
|
|
183
|
+
{
|
|
184
|
+
style: {
|
|
185
|
+
margin: "0 0 0.5rem 0",
|
|
186
|
+
fontSize: "1.125rem",
|
|
187
|
+
fontWeight: "600",
|
|
188
|
+
color: "#111827"
|
|
189
|
+
},
|
|
190
|
+
children: title
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ jsx(
|
|
194
|
+
"p",
|
|
195
|
+
{
|
|
196
|
+
style: {
|
|
197
|
+
margin: "0 0 1.5rem 0",
|
|
198
|
+
fontSize: "0.875rem",
|
|
199
|
+
color: "#6b7280",
|
|
200
|
+
lineHeight: "1.5"
|
|
201
|
+
},
|
|
202
|
+
children: message
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap" }, children: [
|
|
206
|
+
showRetry && /* @__PURE__ */ jsx(
|
|
207
|
+
"button",
|
|
208
|
+
{
|
|
209
|
+
onClick: handleRetry,
|
|
210
|
+
disabled: isPending || isRetrying,
|
|
211
|
+
style: {
|
|
212
|
+
padding: "0.5rem 1rem",
|
|
213
|
+
backgroundColor: "#3b82f6",
|
|
214
|
+
color: "white",
|
|
215
|
+
border: "none",
|
|
216
|
+
borderRadius: "6px",
|
|
217
|
+
fontSize: "0.875rem",
|
|
218
|
+
fontWeight: "500",
|
|
219
|
+
cursor: isPending || isRetrying ? "wait" : "pointer",
|
|
220
|
+
opacity: isPending || isRetrying ? 0.7 : 1,
|
|
221
|
+
transition: "all 0.2s"
|
|
222
|
+
},
|
|
223
|
+
children: isRetrying ? "Retrying..." : actionText
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
"button",
|
|
228
|
+
{
|
|
229
|
+
onClick: () => window.location.reload(),
|
|
230
|
+
style: {
|
|
231
|
+
padding: "0.5rem 1rem",
|
|
232
|
+
backgroundColor: "transparent",
|
|
233
|
+
color: "#6b7280",
|
|
234
|
+
border: "1px solid #d1d5db",
|
|
235
|
+
borderRadius: "6px",
|
|
236
|
+
fontSize: "0.875rem",
|
|
237
|
+
fontWeight: "500",
|
|
238
|
+
cursor: "pointer",
|
|
239
|
+
transition: "all 0.2s"
|
|
240
|
+
},
|
|
241
|
+
children: "Refresh Page"
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }),
|
|
245
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxs(
|
|
246
|
+
"details",
|
|
247
|
+
{
|
|
248
|
+
style: {
|
|
249
|
+
marginTop: "1rem",
|
|
250
|
+
fontSize: "0.75rem",
|
|
251
|
+
color: "#6b7280",
|
|
252
|
+
width: "100%"
|
|
253
|
+
},
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx("summary", { style: { cursor: "pointer", marginBottom: "0.5rem" }, children: "Error Details" }),
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
"pre",
|
|
258
|
+
{
|
|
259
|
+
style: {
|
|
260
|
+
whiteSpace: "pre-wrap",
|
|
261
|
+
wordBreak: "break-all",
|
|
262
|
+
backgroundColor: "#f3f4f6",
|
|
263
|
+
padding: "0.5rem",
|
|
264
|
+
borderRadius: "4px",
|
|
265
|
+
overflow: "auto",
|
|
266
|
+
maxHeight: "200px"
|
|
267
|
+
},
|
|
268
|
+
children: error.message
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
function withErrorBoundary(Component2, errorBoundaryProps) {
|
|
279
|
+
let WrappedComponent = (props) => /* @__PURE__ */ jsx(ConnectorErrorBoundary, { ...errorBoundaryProps, children: /* @__PURE__ */ jsx(Component2, { ...props }) });
|
|
280
|
+
return WrappedComponent.displayName = `withErrorBoundary(${Component2.displayName || Component2.name})`, WrappedComponent;
|
|
281
|
+
}
|
|
282
|
+
var WalletConnectContext = createContext(null);
|
|
283
|
+
function WalletConnectProvider({ children }) {
|
|
284
|
+
let [uri, setUriState] = useState(null), isMountedRef = useRef(false), pendingUriRef = useRef(null);
|
|
285
|
+
useEffect(() => (isMountedRef.current = true, pendingUriRef.current !== null && (setUriState(pendingUriRef.current), pendingUriRef.current = null), () => {
|
|
286
|
+
isMountedRef.current = false;
|
|
287
|
+
}), []);
|
|
288
|
+
let setUri = useCallback((newUri) => {
|
|
289
|
+
if (!isMountedRef.current) {
|
|
290
|
+
pendingUriRef.current = newUri;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
setUriState(newUri);
|
|
294
|
+
}, []), clearUri = useCallback(() => {
|
|
295
|
+
pendingUriRef.current = null, isMountedRef.current && setUriState(null);
|
|
296
|
+
}, []);
|
|
297
|
+
return /* @__PURE__ */ jsx(WalletConnectContext.Provider, { value: { uri, setUri, clearUri }, children });
|
|
298
|
+
}
|
|
299
|
+
function useWalletConnectUri() {
|
|
300
|
+
let context = useContext(WalletConnectContext);
|
|
301
|
+
return context || {
|
|
302
|
+
uri: null,
|
|
303
|
+
setUri: () => {
|
|
304
|
+
},
|
|
305
|
+
clearUri: () => {
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
var logger2 = createLogger("ConnectorProvider");
|
|
9
310
|
installPolyfills();
|
|
10
311
|
var ConnectorContext = createContext(null);
|
|
11
312
|
ConnectorContext.displayName = "ConnectorContext";
|
|
@@ -14,13 +315,13 @@ function ConnectorProviderInternal({
|
|
|
14
315
|
config,
|
|
15
316
|
mobile
|
|
16
317
|
}) {
|
|
17
|
-
let clientRef = useRef(null), client =
|
|
318
|
+
let clientRef = useRef(null), client = React2.useCallback(() => {
|
|
18
319
|
if (!clientRef.current)
|
|
19
320
|
try {
|
|
20
|
-
clientRef.current = new ConnectorClient(config), typeof window < "u" && (window.__connectorClient = clientRef.current), config?.debug &&
|
|
321
|
+
clientRef.current = new ConnectorClient(config), typeof window < "u" && (window.__connectorClient = clientRef.current), config?.debug && logger2.info("Client initialized successfully");
|
|
21
322
|
} catch (error) {
|
|
22
323
|
let err = error;
|
|
23
|
-
|
|
324
|
+
logger2.error("Failed to initialize client", { error: err });
|
|
24
325
|
let extendedConfig = config;
|
|
25
326
|
return extendedConfig?.errorBoundary?.onError && extendedConfig.errorBoundary.onError(err, {
|
|
26
327
|
componentStack: "client-initialization",
|
|
@@ -29,7 +330,7 @@ function ConnectorProviderInternal({
|
|
|
29
330
|
}
|
|
30
331
|
return clientRef.current;
|
|
31
332
|
}, [config])();
|
|
32
|
-
return
|
|
333
|
+
return React2.useEffect(() => {
|
|
33
334
|
let currentClient = clientRef.current;
|
|
34
335
|
if (currentClient) {
|
|
35
336
|
let privateClient = currentClient;
|
|
@@ -38,7 +339,7 @@ function ConnectorProviderInternal({
|
|
|
38
339
|
return () => {
|
|
39
340
|
typeof window < "u" && (window.__connectorClient = void 0), currentClient && typeof currentClient.destroy == "function" && currentClient.destroy();
|
|
40
341
|
};
|
|
41
|
-
}, []),
|
|
342
|
+
}, []), React2.useEffect(() => {
|
|
42
343
|
if (!mobile) return;
|
|
43
344
|
let cancelled = false;
|
|
44
345
|
return (async () => {
|
|
@@ -92,38 +393,163 @@ function useConnector() {
|
|
|
92
393
|
throw new Error(
|
|
93
394
|
"useConnector must be used within ConnectorProvider. Wrap your app with <ConnectorProvider> or <UnifiedProvider> to use connector hooks."
|
|
94
395
|
);
|
|
95
|
-
let state = useSyncExternalStore(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
396
|
+
let { uri: walletConnectUri, clearUri: clearWalletConnectUri } = useWalletConnectUri(), state = useSyncExternalStore(
|
|
397
|
+
React2.useCallback((cb) => client.subscribe(cb), [client]),
|
|
398
|
+
React2.useCallback(() => client.getSnapshot(), [client]),
|
|
399
|
+
React2.useCallback(() => client.getSnapshot(), [client])
|
|
99
400
|
), methods = useMemo(
|
|
100
401
|
() => ({
|
|
402
|
+
// Legacy (kept for backwards compatibility)
|
|
101
403
|
select: client.select.bind(client),
|
|
102
404
|
disconnect: client.disconnect.bind(client),
|
|
103
|
-
selectAccount: client.selectAccount.bind(client)
|
|
405
|
+
selectAccount: client.selectAccount.bind(client),
|
|
406
|
+
// vNext
|
|
407
|
+
connectWallet: client.connectWallet.bind(client),
|
|
408
|
+
disconnectWallet: client.disconnectWallet.bind(client)
|
|
104
409
|
}),
|
|
105
410
|
[client]
|
|
106
|
-
)
|
|
411
|
+
), vNextFields = useMemo(() => {
|
|
412
|
+
let walletStatus = state.wallet, isConnected2 = walletStatus.status === "connected", isConnecting2 = walletStatus.status === "connecting", isError = walletStatus.status === "error", connectorId = null, account = null, sessionAccounts = [], walletError = null;
|
|
413
|
+
walletStatus.status === "connected" ? (connectorId = walletStatus.session.connectorId, account = walletStatus.session.selectedAccount.address, sessionAccounts = walletStatus.session.accounts) : walletStatus.status === "connecting" ? connectorId = walletStatus.connectorId : walletStatus.status === "error" && (walletError = walletStatus.error, connectorId = walletStatus.connectorId ?? null);
|
|
414
|
+
let connector = connectorId ? state.connectors.find((c) => c.id === connectorId) ?? null : null;
|
|
415
|
+
return {
|
|
416
|
+
walletStatus,
|
|
417
|
+
isConnected: isConnected2,
|
|
418
|
+
isConnecting: isConnecting2,
|
|
419
|
+
isError,
|
|
420
|
+
walletError,
|
|
421
|
+
account,
|
|
422
|
+
sessionAccounts,
|
|
423
|
+
connectorId,
|
|
424
|
+
connector
|
|
425
|
+
};
|
|
426
|
+
}, [state.wallet, state.connectors]);
|
|
107
427
|
return useMemo(
|
|
108
428
|
() => ({
|
|
109
429
|
...state,
|
|
110
|
-
...methods
|
|
430
|
+
...methods,
|
|
431
|
+
...vNextFields,
|
|
432
|
+
walletConnectUri,
|
|
433
|
+
clearWalletConnectUri
|
|
111
434
|
}),
|
|
112
|
-
[state, methods]
|
|
435
|
+
[state, methods, vNextFields, walletConnectUri, clearWalletConnectUri]
|
|
113
436
|
);
|
|
114
437
|
}
|
|
115
438
|
function useConnectorClient() {
|
|
116
439
|
return useContext(ConnectorContext);
|
|
117
440
|
}
|
|
118
|
-
function
|
|
119
|
-
let
|
|
441
|
+
function AppProviderInner({ children, connectorConfig, mobile, providers = [] }) {
|
|
442
|
+
let { setUri, clearUri } = useWalletConnectUri(), enhancedConfig = useMemo(() => {
|
|
443
|
+
if (!connectorConfig?.walletConnect?.enabled)
|
|
444
|
+
return connectorConfig;
|
|
445
|
+
let wcConfig = connectorConfig.walletConnect;
|
|
446
|
+
return {
|
|
447
|
+
...connectorConfig,
|
|
448
|
+
walletConnect: {
|
|
449
|
+
...wcConfig,
|
|
450
|
+
// Auto-wire callbacks - use provided ones or fall back to context-based ones
|
|
451
|
+
onDisplayUri: wcConfig.onDisplayUri ?? setUri,
|
|
452
|
+
onSessionEstablished: wcConfig.onSessionEstablished ?? clearUri,
|
|
453
|
+
onSessionDisconnected: wcConfig.onSessionDisconnected ?? clearUri
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
}, [connectorConfig, setUri, clearUri]), content = /* @__PURE__ */ jsx(ConnectorProvider, { config: enhancedConfig, mobile, children });
|
|
120
457
|
for (let i = providers.length - 1; i >= 0; i--) {
|
|
121
458
|
let { component: Provider, props = {} } = providers[i];
|
|
122
459
|
content = /* @__PURE__ */ jsx(Provider, { ...props, children: content });
|
|
123
460
|
}
|
|
124
461
|
return content;
|
|
125
462
|
}
|
|
463
|
+
function AppProvider(props) {
|
|
464
|
+
return props.connectorConfig?.walletConnect?.enabled ? /* @__PURE__ */ jsx(WalletConnectProvider, { children: /* @__PURE__ */ jsx(AppProviderInner, { ...props }) }) : /* @__PURE__ */ jsx(AppProviderInner, { ...props });
|
|
465
|
+
}
|
|
126
466
|
var UnifiedProvider = AppProvider;
|
|
467
|
+
function useWallet() {
|
|
468
|
+
let client = useContext(ConnectorContext);
|
|
469
|
+
if (!client)
|
|
470
|
+
throw new Error(
|
|
471
|
+
"useWallet must be used within ConnectorProvider. Wrap your app with <ConnectorProvider> or <UnifiedProvider> to use wallet hooks."
|
|
472
|
+
);
|
|
473
|
+
let walletStatus = useSyncExternalStore(
|
|
474
|
+
useCallback((cb) => client.subscribe(cb), [client]),
|
|
475
|
+
useCallback(() => client.getSnapshot().wallet, [client]),
|
|
476
|
+
useCallback(() => client.getSnapshot().wallet, [client])
|
|
477
|
+
);
|
|
478
|
+
return useMemo(() => {
|
|
479
|
+
let status = walletStatus.status, isConnected2 = status === "connected", isConnecting2 = status === "connecting", isError = status === "error", connectorId = null, account = null, accounts = [], session = null, error = null;
|
|
480
|
+
return walletStatus.status === "connected" ? (connectorId = walletStatus.session.connectorId, account = walletStatus.session.selectedAccount.address, accounts = walletStatus.session.accounts, session = walletStatus.session) : walletStatus.status === "connecting" ? connectorId = walletStatus.connectorId : walletStatus.status === "error" && (error = walletStatus.error, connectorId = walletStatus.connectorId ?? null), {
|
|
481
|
+
status,
|
|
482
|
+
walletStatus,
|
|
483
|
+
isConnected: isConnected2,
|
|
484
|
+
isConnecting: isConnecting2,
|
|
485
|
+
isError,
|
|
486
|
+
error,
|
|
487
|
+
connectorId,
|
|
488
|
+
account,
|
|
489
|
+
accounts,
|
|
490
|
+
session
|
|
491
|
+
};
|
|
492
|
+
}, [walletStatus]);
|
|
493
|
+
}
|
|
494
|
+
function useWalletConnectors() {
|
|
495
|
+
let client = useContext(ConnectorContext);
|
|
496
|
+
if (!client)
|
|
497
|
+
throw new Error(
|
|
498
|
+
"useWalletConnectors must be used within ConnectorProvider. Wrap your app with <ConnectorProvider> or <UnifiedProvider> to use wallet hooks."
|
|
499
|
+
);
|
|
500
|
+
return useSyncExternalStore(
|
|
501
|
+
useCallback((cb) => client.subscribe(cb), [client]),
|
|
502
|
+
useCallback(() => client.getSnapshot().connectors, [client]),
|
|
503
|
+
useCallback(() => client.getSnapshot().connectors, [client])
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
function useConnectWallet() {
|
|
507
|
+
let client = useContext(ConnectorContext), [isConnecting2, setIsConnecting] = useState(false), [error, setError] = useState(null);
|
|
508
|
+
if (!client)
|
|
509
|
+
throw new Error(
|
|
510
|
+
"useConnectWallet must be used within ConnectorProvider. Wrap your app with <ConnectorProvider> or <UnifiedProvider> to use wallet hooks."
|
|
511
|
+
);
|
|
512
|
+
let connect = useCallback(
|
|
513
|
+
async (connectorId, options) => {
|
|
514
|
+
setIsConnecting(true), setError(null);
|
|
515
|
+
try {
|
|
516
|
+
await client.connectWallet(connectorId, options);
|
|
517
|
+
} catch (e) {
|
|
518
|
+
let connectError = e instanceof Error ? e : new Error(String(e));
|
|
519
|
+
throw setError(connectError), connectError;
|
|
520
|
+
} finally {
|
|
521
|
+
setIsConnecting(false);
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
[client]
|
|
525
|
+
), resetError = useCallback(() => {
|
|
526
|
+
setError(null);
|
|
527
|
+
}, []);
|
|
528
|
+
return {
|
|
529
|
+
connect,
|
|
530
|
+
isConnecting: isConnecting2,
|
|
531
|
+
error,
|
|
532
|
+
resetError
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function useDisconnectWallet() {
|
|
536
|
+
let client = useContext(ConnectorContext), [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
537
|
+
if (!client)
|
|
538
|
+
throw new Error(
|
|
539
|
+
"useDisconnectWallet must be used within ConnectorProvider. Wrap your app with <ConnectorProvider> or <UnifiedProvider> to use wallet hooks."
|
|
540
|
+
);
|
|
541
|
+
return {
|
|
542
|
+
disconnect: useCallback(async () => {
|
|
543
|
+
setIsDisconnecting(true);
|
|
544
|
+
try {
|
|
545
|
+
await client.disconnectWallet();
|
|
546
|
+
} finally {
|
|
547
|
+
setIsDisconnecting(false);
|
|
548
|
+
}
|
|
549
|
+
}, [client]),
|
|
550
|
+
isDisconnecting
|
|
551
|
+
};
|
|
552
|
+
}
|
|
127
553
|
function useCluster() {
|
|
128
554
|
let { cluster, clusters } = useConnector(), client = useConnectorClient();
|
|
129
555
|
if (!client)
|
|
@@ -150,7 +576,7 @@ function useCluster() {
|
|
|
150
576
|
}, [cluster, clusters, setCluster]);
|
|
151
577
|
}
|
|
152
578
|
function useAccount() {
|
|
153
|
-
let { selectedAccount, accounts, connected, selectAccount } = useConnector(), [copied, setCopied] = useState(false), copyTimeoutRef =
|
|
579
|
+
let { selectedAccount, accounts, connected, selectAccount } = useConnector(), [copied, setCopied] = useState(false), copyTimeoutRef = React2.useRef(void 0), account = useMemo(
|
|
154
580
|
() => accounts.find((a) => a.address === selectedAccount) ?? null,
|
|
155
581
|
[accounts, selectedAccount]
|
|
156
582
|
), formatted = useMemo(() => selectedAccount ? formatAddress(selectedAccount) : "", [selectedAccount]), copy = useCallback(async () => selectedAccount ? (copyTimeoutRef.current && clearTimeout(copyTimeoutRef.current), await copyAddressToClipboard(selectedAccount, {
|
|
@@ -162,7 +588,7 @@ function useAccount() {
|
|
|
162
588
|
error: "empty_value" /* EMPTY_VALUE */,
|
|
163
589
|
errorMessage: "No account selected"
|
|
164
590
|
}, [selectedAccount]);
|
|
165
|
-
return
|
|
591
|
+
return React2.useEffect(() => () => {
|
|
166
592
|
copyTimeoutRef.current && clearTimeout(copyTimeoutRef.current);
|
|
167
593
|
}, []), useMemo(
|
|
168
594
|
() => ({
|
|
@@ -183,6 +609,7 @@ function useWalletInfo() {
|
|
|
183
609
|
() => wallets.map(
|
|
184
610
|
(walletInfo) => ({
|
|
185
611
|
name: walletInfo.wallet.name,
|
|
612
|
+
connectorId: createConnectorId(walletInfo.wallet.name),
|
|
186
613
|
icon: walletInfo.wallet.icon,
|
|
187
614
|
installed: walletInfo.installed,
|
|
188
615
|
connectable: walletInfo.connectable
|
|
@@ -252,7 +679,7 @@ function useKitTransactionSigner() {
|
|
|
252
679
|
};
|
|
253
680
|
}
|
|
254
681
|
var useGillTransactionSigner = useKitTransactionSigner;
|
|
255
|
-
var
|
|
682
|
+
var logger3 = createLogger("useSolanaClient");
|
|
256
683
|
function useSolanaClient() {
|
|
257
684
|
let { type } = useCluster(), connectorClient = useConnectorClient(), client = useMemo(() => {
|
|
258
685
|
if (!type || !connectorClient) return null;
|
|
@@ -264,7 +691,7 @@ function useSolanaClient() {
|
|
|
264
691
|
urlOrMoniker: type
|
|
265
692
|
}) : null;
|
|
266
693
|
} catch (error) {
|
|
267
|
-
return
|
|
694
|
+
return logger3.error("Failed to create Solana client", { error }), null;
|
|
268
695
|
}
|
|
269
696
|
}, [type, connectorClient]);
|
|
270
697
|
return useMemo(
|
|
@@ -1599,7 +2026,7 @@ function DisconnectElement({
|
|
|
1599
2026
|
onDisconnect,
|
|
1600
2027
|
render
|
|
1601
2028
|
}) {
|
|
1602
|
-
let { disconnect, connecting } = useConnector(), [disconnecting, setDisconnecting] =
|
|
2029
|
+
let { disconnect, connecting } = useConnector(), [disconnecting, setDisconnecting] = React2.useState(false), handleDisconnect = async () => {
|
|
1603
2030
|
setDisconnecting(true);
|
|
1604
2031
|
try {
|
|
1605
2032
|
await disconnect(), onDisconnect?.();
|
|
@@ -1843,7 +2270,7 @@ function ClusterElement({
|
|
|
1843
2270
|
labels = {},
|
|
1844
2271
|
render
|
|
1845
2272
|
}) {
|
|
1846
|
-
let { cluster, clusters, setCluster, isMainnet, isDevnet, isTestnet, isLocal } = useCluster(), [isOpen, setIsOpen] =
|
|
2273
|
+
let { cluster, clusters, setCluster, isMainnet, isDevnet, isTestnet, isLocal } = useCluster(), [isOpen, setIsOpen] = React2.useState(false);
|
|
1847
2274
|
if (render)
|
|
1848
2275
|
return /* @__PURE__ */ jsx(Fragment, { children: render({ cluster, clusters, setCluster, isMainnet, isDevnet, isTestnet, isLocal }) });
|
|
1849
2276
|
if (!cluster) return null;
|
|
@@ -2050,14 +2477,32 @@ function WalletListElement({
|
|
|
2050
2477
|
variant = "list",
|
|
2051
2478
|
showStatus = true,
|
|
2052
2479
|
onSelect,
|
|
2480
|
+
onConnect,
|
|
2053
2481
|
render,
|
|
2054
2482
|
renderWallet
|
|
2055
2483
|
}) {
|
|
2056
2484
|
let { wallets, connecting } = useWalletInfo(), { select } = useConnector(), installedWallets = wallets.filter((w) => w.installed), displayWallets = installedOnly ? installedWallets : wallets, handleSelect = async (walletName) => {
|
|
2057
2485
|
await select(walletName), onSelect?.(walletName);
|
|
2486
|
+
}, handleConnectById = async (connectorId) => {
|
|
2487
|
+
let wallet = wallets.find((w) => w.connectorId === connectorId);
|
|
2488
|
+
if (!wallet) {
|
|
2489
|
+
let availableConnectorIds = wallets.map((w) => w.connectorId);
|
|
2490
|
+
console.warn(
|
|
2491
|
+
`[WalletListElement] Wallet not found for connectorId: ${connectorId}. Available connectorIds (${availableConnectorIds.length}):`,
|
|
2492
|
+
availableConnectorIds
|
|
2493
|
+
);
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
await select(wallet.name), onConnect?.(connectorId);
|
|
2058
2497
|
};
|
|
2059
2498
|
if (render)
|
|
2060
|
-
return /* @__PURE__ */ jsx(Fragment, { children: render({
|
|
2499
|
+
return /* @__PURE__ */ jsx(Fragment, { children: render({
|
|
2500
|
+
wallets,
|
|
2501
|
+
installedWallets,
|
|
2502
|
+
select: handleSelect,
|
|
2503
|
+
connectById: handleConnectById,
|
|
2504
|
+
connecting
|
|
2505
|
+
}) });
|
|
2061
2506
|
if (displayWallets.length === 0)
|
|
2062
2507
|
return /* @__PURE__ */ jsx(
|
|
2063
2508
|
"div",
|
|
@@ -2115,28 +2560,33 @@ function WalletListElement({
|
|
|
2115
2560
|
className: `ck-wallet-list-block ck-wallet-list-block--grid ${className || ""}`,
|
|
2116
2561
|
"data-slot": "wallet-list-element",
|
|
2117
2562
|
"data-variant": "grid",
|
|
2118
|
-
children: displayWallets.map((wallet) =>
|
|
2119
|
-
wallet
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2563
|
+
children: displayWallets.map((wallet) => {
|
|
2564
|
+
let handleWalletConnect = () => handleConnectById(wallet.connectorId);
|
|
2565
|
+
return renderWallet ? /* @__PURE__ */ jsx(React2.Fragment, { children: renderWallet({
|
|
2566
|
+
wallet,
|
|
2567
|
+
select: handleWalletConnect,
|
|
2568
|
+
connect: handleWalletConnect,
|
|
2569
|
+
connecting
|
|
2570
|
+
}) }, wallet.name) : /* @__PURE__ */ jsxs(
|
|
2571
|
+
"button",
|
|
2572
|
+
{
|
|
2573
|
+
type: "button",
|
|
2574
|
+
className: "ck-wallet-list-item ck-wallet-list-item--grid",
|
|
2575
|
+
onClick: handleWalletConnect,
|
|
2576
|
+
disabled: connecting || !wallet.installed && installedOnly,
|
|
2577
|
+
"data-slot": "wallet-list-item",
|
|
2578
|
+
"data-wallet": wallet.name,
|
|
2579
|
+
"data-connector-id": wallet.connectorId,
|
|
2580
|
+
"data-installed": wallet.installed,
|
|
2581
|
+
children: [
|
|
2582
|
+
/* @__PURE__ */ jsx("div", { className: "ck-wallet-list-item-icon", "data-slot": "wallet-list-item-icon", children: wallet.icon ? /* @__PURE__ */ jsx("img", { src: wallet.icon, alt: wallet.name }) : walletIcon }),
|
|
2583
|
+
/* @__PURE__ */ jsx("span", { className: "ck-wallet-list-item-name", "data-slot": "wallet-list-item-name", children: wallet.name }),
|
|
2584
|
+
showStatus && !wallet.installed && /* @__PURE__ */ jsx("span", { className: "ck-wallet-list-item-status", "data-slot": "wallet-list-item-status", children: "Not installed" })
|
|
2585
|
+
]
|
|
2586
|
+
},
|
|
2587
|
+
wallet.name
|
|
2588
|
+
);
|
|
2589
|
+
})
|
|
2140
2590
|
}
|
|
2141
2591
|
) : variant === "compact" ? /* @__PURE__ */ jsx(
|
|
2142
2592
|
"div",
|
|
@@ -2144,27 +2594,32 @@ function WalletListElement({
|
|
|
2144
2594
|
className: `ck-wallet-list-block ck-wallet-list-block--compact ${className || ""}`,
|
|
2145
2595
|
"data-slot": "wallet-list-element",
|
|
2146
2596
|
"data-variant": "compact",
|
|
2147
|
-
children: displayWallets.map((wallet) =>
|
|
2148
|
-
wallet
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2597
|
+
children: displayWallets.map((wallet) => {
|
|
2598
|
+
let handleWalletConnect = () => handleConnectById(wallet.connectorId);
|
|
2599
|
+
return renderWallet ? /* @__PURE__ */ jsx(React2.Fragment, { children: renderWallet({
|
|
2600
|
+
wallet,
|
|
2601
|
+
select: handleWalletConnect,
|
|
2602
|
+
connect: handleWalletConnect,
|
|
2603
|
+
connecting
|
|
2604
|
+
}) }, wallet.name) : /* @__PURE__ */ jsxs(
|
|
2605
|
+
"button",
|
|
2606
|
+
{
|
|
2607
|
+
type: "button",
|
|
2608
|
+
className: "ck-wallet-list-item ck-wallet-list-item--compact",
|
|
2609
|
+
onClick: handleWalletConnect,
|
|
2610
|
+
disabled: connecting || !wallet.installed && installedOnly,
|
|
2611
|
+
"data-slot": "wallet-list-item",
|
|
2612
|
+
"data-wallet": wallet.name,
|
|
2613
|
+
"data-connector-id": wallet.connectorId,
|
|
2614
|
+
"data-installed": wallet.installed,
|
|
2615
|
+
children: [
|
|
2616
|
+
/* @__PURE__ */ jsx("div", { className: "ck-wallet-list-item-icon", "data-slot": "wallet-list-item-icon", children: wallet.icon ? /* @__PURE__ */ jsx("img", { src: wallet.icon, alt: wallet.name }) : walletIcon }),
|
|
2617
|
+
/* @__PURE__ */ jsx("span", { className: "ck-wallet-list-item-name", "data-slot": "wallet-list-item-name", children: wallet.name })
|
|
2618
|
+
]
|
|
2619
|
+
},
|
|
2620
|
+
wallet.name
|
|
2621
|
+
);
|
|
2622
|
+
})
|
|
2168
2623
|
}
|
|
2169
2624
|
) : /* @__PURE__ */ jsx(
|
|
2170
2625
|
"div",
|
|
@@ -2172,54 +2627,59 @@ function WalletListElement({
|
|
|
2172
2627
|
className: `ck-wallet-list-block ck-wallet-list-block--list ${className || ""}`,
|
|
2173
2628
|
"data-slot": "wallet-list-element",
|
|
2174
2629
|
"data-variant": "list",
|
|
2175
|
-
children: displayWallets.map((wallet) =>
|
|
2176
|
-
wallet
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2630
|
+
children: displayWallets.map((wallet) => {
|
|
2631
|
+
let handleWalletConnect = () => handleConnectById(wallet.connectorId);
|
|
2632
|
+
return renderWallet ? /* @__PURE__ */ jsx(React2.Fragment, { children: renderWallet({
|
|
2633
|
+
wallet,
|
|
2634
|
+
select: handleWalletConnect,
|
|
2635
|
+
connect: handleWalletConnect,
|
|
2636
|
+
connecting
|
|
2637
|
+
}) }, wallet.name) : /* @__PURE__ */ jsxs(
|
|
2638
|
+
"button",
|
|
2639
|
+
{
|
|
2640
|
+
type: "button",
|
|
2641
|
+
className: "ck-wallet-list-item ck-wallet-list-item--list",
|
|
2642
|
+
onClick: handleWalletConnect,
|
|
2643
|
+
disabled: connecting || !wallet.installed && installedOnly,
|
|
2644
|
+
"data-slot": "wallet-list-item",
|
|
2645
|
+
"data-wallet": wallet.name,
|
|
2646
|
+
"data-connector-id": wallet.connectorId,
|
|
2647
|
+
"data-installed": wallet.installed,
|
|
2648
|
+
children: [
|
|
2649
|
+
/* @__PURE__ */ jsx("div", { className: "ck-wallet-list-item-icon", "data-slot": "wallet-list-item-icon", children: wallet.icon ? /* @__PURE__ */ jsx("img", { src: wallet.icon, alt: wallet.name }) : walletIcon }),
|
|
2650
|
+
/* @__PURE__ */ jsxs("div", { className: "ck-wallet-list-item-info", "data-slot": "wallet-list-item-info", children: [
|
|
2651
|
+
/* @__PURE__ */ jsx("span", { className: "ck-wallet-list-item-name", "data-slot": "wallet-list-item-name", children: wallet.name }),
|
|
2652
|
+
showStatus && /* @__PURE__ */ jsx(
|
|
2653
|
+
"span",
|
|
2654
|
+
{
|
|
2655
|
+
className: "ck-wallet-list-item-status",
|
|
2656
|
+
"data-slot": "wallet-list-item-status",
|
|
2657
|
+
"data-installed": wallet.installed,
|
|
2658
|
+
children: wallet.installed ? "Detected" : "Not installed"
|
|
2659
|
+
}
|
|
2660
|
+
)
|
|
2661
|
+
] }),
|
|
2662
|
+
/* @__PURE__ */ jsx(
|
|
2663
|
+
"svg",
|
|
2195
2664
|
{
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
"
|
|
2199
|
-
|
|
2665
|
+
width: "16",
|
|
2666
|
+
height: "16",
|
|
2667
|
+
viewBox: "0 0 24 24",
|
|
2668
|
+
fill: "none",
|
|
2669
|
+
stroke: "currentColor",
|
|
2670
|
+
strokeWidth: "2",
|
|
2671
|
+
strokeLinecap: "round",
|
|
2672
|
+
strokeLinejoin: "round",
|
|
2673
|
+
className: "ck-wallet-list-item-arrow",
|
|
2674
|
+
"data-slot": "wallet-list-item-arrow",
|
|
2675
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" })
|
|
2200
2676
|
}
|
|
2201
2677
|
)
|
|
2202
|
-
]
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
height: "16",
|
|
2208
|
-
viewBox: "0 0 24 24",
|
|
2209
|
-
fill: "none",
|
|
2210
|
-
stroke: "currentColor",
|
|
2211
|
-
strokeWidth: "2",
|
|
2212
|
-
strokeLinecap: "round",
|
|
2213
|
-
strokeLinejoin: "round",
|
|
2214
|
-
className: "ck-wallet-list-item-arrow",
|
|
2215
|
-
"data-slot": "wallet-list-item-arrow",
|
|
2216
|
-
children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" })
|
|
2217
|
-
}
|
|
2218
|
-
)
|
|
2219
|
-
]
|
|
2220
|
-
},
|
|
2221
|
-
wallet.name
|
|
2222
|
-
))
|
|
2678
|
+
]
|
|
2679
|
+
},
|
|
2680
|
+
wallet.name
|
|
2681
|
+
);
|
|
2682
|
+
})
|
|
2223
2683
|
}
|
|
2224
2684
|
);
|
|
2225
2685
|
}
|
|
@@ -2256,7 +2716,7 @@ function injectStyles() {
|
|
|
2256
2716
|
}
|
|
2257
2717
|
}
|
|
2258
2718
|
function SkeletonShine() {
|
|
2259
|
-
return
|
|
2719
|
+
return React2.useEffect(() => {
|
|
2260
2720
|
injectStyles();
|
|
2261
2721
|
}, []), /* @__PURE__ */ jsx("div", { className: "ck-skeleton-shine", "data-slot": "skeleton-shine" });
|
|
2262
2722
|
}
|
|
@@ -2790,6 +3250,6 @@ function TokenListElement({
|
|
|
2790
3250
|
}
|
|
2791
3251
|
TokenListElement.displayName = "TokenListElement";
|
|
2792
3252
|
|
|
2793
|
-
export { AccountElement, AppProvider, BalanceElement, ClusterElement, ConnectorProvider, DisconnectElement, SkeletonShine, TokenListElement, TransactionHistoryElement, UnifiedProvider, WalletListElement, clearSharedQueryCache, clearTokenCaches, getBalanceQueryKey, getTokensQueryKey, getTransactionsQueryKey, getWalletAssetsQueryKey, invalidateSharedQuery, useAccount, useBalance, useCluster, useConnector, useConnectorClient, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo };
|
|
2794
|
-
//# sourceMappingURL=chunk-
|
|
2795
|
-
//# sourceMappingURL=chunk-
|
|
3253
|
+
export { AccountElement, AppProvider, BalanceElement, ClusterElement, ConnectorErrorBoundary, ConnectorProvider, DisconnectElement, SkeletonShine, TokenListElement, TransactionHistoryElement, UnifiedProvider, WalletConnectProvider, WalletListElement, clearSharedQueryCache, clearTokenCaches, getBalanceQueryKey, getTokensQueryKey, getTransactionsQueryKey, getWalletAssetsQueryKey, invalidateSharedQuery, useAccount, useBalance, useCluster, useConnectWallet, useConnector, useConnectorClient, useDisconnectWallet, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWallet, useWalletConnectUri, useWalletConnectors, useWalletInfo, withErrorBoundary };
|
|
3254
|
+
//# sourceMappingURL=chunk-RTXUS5KG.mjs.map
|
|
3255
|
+
//# sourceMappingURL=chunk-RTXUS5KG.mjs.map
|