solariskit 1.3.0 → 1.5.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/dist/{WalletButton-B-bj9FNL.d.ts → ChainSelectButton-COIW5SBO.d.ts} +9 -134
- package/dist/RainbowKitProvider-CKy7nmFG.js +271 -0
- package/dist/WalletButton-B3e-uEwx.d.ts +126 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +3 -2
- package/dist/index.css +47 -47
- package/dist/index.d.ts +9 -4
- package/dist/index.js +4 -3
- package/dist/{injectedWallet-Bq0gF2WF.js → injectedWallet-CnP8-uv5.js} +19 -1
- package/dist/solana/index.d.ts +156 -0
- package/dist/solana/index.js +601 -0
- package/dist/{WalletButton-DpDL4qfh.js → useFingerprint-BoVxC_1f.js} +4199 -4184
- package/dist/{walletConnectors-C02JPPxf.js → walletConnectors-DwPMzHor.js} +1 -1
- package/dist/wallets/walletConnectors/index.js +1 -1
- package/package.json +30 -15
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import React, { JSX, ReactNode } from "react";
|
|
4
|
-
import { Address } from "viem";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
5
3
|
import { Chain } from "wagmi/chains";
|
|
6
4
|
import { RequiredConditionalValue } from "@vanilla-extract/sprinkles";
|
|
7
5
|
|
|
@@ -187,139 +185,16 @@ declare function RainbowKitProvider({
|
|
|
187
185
|
theme
|
|
188
186
|
}: RainbowKitProviderProps): React.JSX.Element;
|
|
189
187
|
//#endregion
|
|
190
|
-
//#region src/components/
|
|
191
|
-
type AuthenticationStatus = "loading" | "unauthenticated" | "authenticated";
|
|
192
|
-
interface AuthenticationAdapter<Message> {
|
|
193
|
-
getNonce: () => Promise<string>;
|
|
194
|
-
createMessage: (args: {
|
|
195
|
-
nonce: string;
|
|
196
|
-
address: Address;
|
|
197
|
-
chainId: number;
|
|
198
|
-
}) => Promise<Message> | Message;
|
|
199
|
-
verify: (args: {
|
|
200
|
-
message: Message;
|
|
201
|
-
signature: string;
|
|
202
|
-
}) => Promise<boolean>;
|
|
203
|
-
signOut: () => Promise<void>;
|
|
204
|
-
}
|
|
205
|
-
interface AuthenticationConfig<Message> {
|
|
206
|
-
adapter: AuthenticationAdapter<Message>;
|
|
207
|
-
status: AuthenticationStatus;
|
|
208
|
-
}
|
|
209
|
-
declare function createAuthenticationAdapter<Message>(adapter: AuthenticationAdapter<Message>): AuthenticationAdapter<Message>;
|
|
210
|
-
interface RainbowKitAuthenticationProviderProps<Message> extends AuthenticationConfig<Message> {
|
|
211
|
-
enabled?: boolean;
|
|
212
|
-
children: ReactNode;
|
|
213
|
-
}
|
|
214
|
-
declare function RainbowKitAuthenticationProvider<Message = unknown>({
|
|
215
|
-
adapter,
|
|
216
|
-
children,
|
|
217
|
-
enabled,
|
|
218
|
-
status
|
|
219
|
-
}: RainbowKitAuthenticationProviderProps<Message>): React.JSX.Element;
|
|
220
|
-
//#endregion
|
|
221
|
-
//#region src/components/ConnectButton/ConnectButtonRenderer.d.ts
|
|
222
|
-
interface ConnectButtonRendererProps {
|
|
223
|
-
children: (renderProps: {
|
|
224
|
-
account?: {
|
|
225
|
-
address: string;
|
|
226
|
-
balanceDecimals?: number;
|
|
227
|
-
balanceFormatted?: string;
|
|
228
|
-
balanceSymbol?: string;
|
|
229
|
-
displayBalance?: string;
|
|
230
|
-
displayName: string;
|
|
231
|
-
ensAvatar?: string;
|
|
232
|
-
ensName?: string;
|
|
233
|
-
hasPendingTransactions: boolean;
|
|
234
|
-
};
|
|
235
|
-
chain?: {
|
|
236
|
-
hasIcon: boolean;
|
|
237
|
-
iconUrl?: string;
|
|
238
|
-
iconBackground?: string;
|
|
239
|
-
id: number;
|
|
240
|
-
name?: string;
|
|
241
|
-
unsupported?: boolean;
|
|
242
|
-
};
|
|
243
|
-
mounted: boolean;
|
|
244
|
-
authenticationStatus?: AuthenticationStatus;
|
|
245
|
-
openAccountModal: () => void;
|
|
246
|
-
openChainModal: () => void;
|
|
247
|
-
openConnectModal: () => void;
|
|
248
|
-
accountModalOpen: boolean;
|
|
249
|
-
chainModalOpen: boolean;
|
|
250
|
-
connectModalOpen: boolean;
|
|
251
|
-
}) => ReactNode;
|
|
252
|
-
}
|
|
253
|
-
declare function ConnectButtonRenderer({
|
|
254
|
-
children
|
|
255
|
-
}: ConnectButtonRendererProps): React.JSX.Element;
|
|
256
|
-
declare namespace ConnectButtonRenderer {
|
|
257
|
-
var displayName: string;
|
|
258
|
-
}
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region src/components/ConnectButton/ConnectButton.d.ts
|
|
188
|
+
//#region src/components/ConnectButton/ConnectButtonView.d.ts
|
|
261
189
|
type AccountStatus = "full" | "avatar" | "address";
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/components/ChainSelectButton/ChainSelectButton.d.ts
|
|
262
192
|
type ChainStatus = "full" | "icon" | "name" | "none";
|
|
263
|
-
interface
|
|
264
|
-
accountStatus?: ResponsiveValue<AccountStatus>;
|
|
265
|
-
showBalance?: ResponsiveValue<boolean>;
|
|
193
|
+
interface ChainSelectButtonProps {
|
|
266
194
|
chainStatus?: ResponsiveValue<ChainStatus>;
|
|
267
|
-
label?: string;
|
|
268
195
|
}
|
|
269
|
-
declare function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
label,
|
|
273
|
-
showBalance
|
|
274
|
-
}: ConnectButtonProps): React.JSX.Element | null;
|
|
275
|
-
declare namespace ConnectButton {
|
|
276
|
-
var __defaultProps: {
|
|
277
|
-
readonly accountStatus: "full";
|
|
278
|
-
readonly chainStatus: {
|
|
279
|
-
readonly largeScreen: "full";
|
|
280
|
-
readonly smallScreen: "icon";
|
|
281
|
-
};
|
|
282
|
-
readonly label: "Connect Wallet";
|
|
283
|
-
readonly showBalance: {
|
|
284
|
-
readonly largeScreen: true;
|
|
285
|
-
readonly smallScreen: false;
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
var Custom: typeof ConnectButtonRenderer;
|
|
289
|
-
}
|
|
290
|
-
//#endregion
|
|
291
|
-
//#region src/wallets/useWalletConnectors.d.ts
|
|
292
|
-
interface WalletConnector extends WalletInstance {
|
|
293
|
-
ready?: boolean;
|
|
294
|
-
connect: WalletInstance["connect"];
|
|
295
|
-
showWalletConnectModal?: () => void;
|
|
296
|
-
recent: boolean;
|
|
297
|
-
getDesktopUri?: () => Promise<string>;
|
|
298
|
-
getQrCodeUri?: () => Promise<string>;
|
|
299
|
-
getMobileUri?: () => Promise<string>;
|
|
300
|
-
}
|
|
301
|
-
//#endregion
|
|
302
|
-
//#region src/components/WalletButton/WalletButtonRenderer.d.ts
|
|
303
|
-
interface WalletButtonRendererProps {
|
|
304
|
-
wallet?: string;
|
|
305
|
-
children: (renderProps: {
|
|
306
|
-
error: boolean;
|
|
307
|
-
loading: boolean;
|
|
308
|
-
connected: boolean;
|
|
309
|
-
ready: boolean;
|
|
310
|
-
mounted: boolean;
|
|
311
|
-
connector: WalletConnector;
|
|
312
|
-
connect: () => Promise<void>;
|
|
313
|
-
}) => ReactNode;
|
|
314
|
-
}
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region src/components/WalletButton/WalletButton.d.ts
|
|
317
|
-
interface WalletButtonProps {
|
|
318
|
-
wallet?: string;
|
|
319
|
-
}
|
|
320
|
-
declare const WalletButton: {
|
|
321
|
-
(props: WalletButtonProps): JSX.Element | undefined;
|
|
322
|
-
Custom: (props: WalletButtonRendererProps) => ReactNode;
|
|
323
|
-
};
|
|
196
|
+
declare function ChainSelectButton({
|
|
197
|
+
chainStatus
|
|
198
|
+
}: ChainSelectButtonProps): React.JSX.Element | null;
|
|
324
199
|
//#endregion
|
|
325
|
-
export {
|
|
200
|
+
export { RainbowKitProvider as a, ModalSizes as c, DisclaimerComponent as d, ResponsiveValue as f, AccountStatus as i, AvatarComponent as l, ChainSelectButtonProps as n, RainbowKitProviderProps as o, ThemeVars as p, ChainStatus as r, Theme as s, ChainSelectButton as t, AvatarComponentProps as u };
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { A as clearLatestWalletId, At as useHydrated, Ct as useRainbowKitChains, D as useWalletConnectors, Dt as useIsMounted, E as preloadAssetsIcon, Et as isChainIdSupported, G as AppContext, H as defaultAvatar, J as ShowRecentTransactionsContext, K as defaultAppInfo, O as isNotNullish, Ot as ShowBalanceProvider, Pt as useAuthenticationStatus, St as RainbowKitChainProvider, T as preloadLoginIcon, V as AvatarContext, X as formatAddress, Y as formatENS, Z as abbreviateETHBalance, _t as TransactionStoreProvider, a as NetworkSelectButtonView, at as WalletButtonProvider, b as clearWalletConnectDeepLink, bt as useSelectedChainId, c as defaultConnectButtonProps, ct as ThemeRootStyle, d as useAccountModal, f as useChainModal, g as signInIcon, gt as useRecentTransactions, ht as useAsyncImage, i as WalletButtonView, it as WalletButtonContext, j as getLatestWalletId, jt as useConnectionStatus, k as addLatestWalletId, kt as useShowBalance, l as resolveShowBalance, lt as useThemeRoot, m as useModalState, mt as loadImages, n as lightTheme, nt as ModalSizeOptions, o as defaultNetworkSelectChainStatus, p as useConnectModal, pt as isMobile, rt as ModalSizeProvider, s as ConnectButtonView, st as ThemeIdProvider, t as useFingerprint, u as ModalProvider, wt as useRainbowKitChainsById, xt as useProfile } from "./useFingerprint-BoVxC_1f.js";
|
|
3
|
+
import React, { useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { useConfig, useConnection, useConnectionEffect } from "wagmi";
|
|
5
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/ConnectButton/ConnectButtonRenderer.tsx
|
|
8
|
+
const noop = () => {};
|
|
9
|
+
function ConnectButtonRenderer({ children }) {
|
|
10
|
+
const isMounted = useIsMounted();
|
|
11
|
+
const { address, chainId: connectedChainId } = useConnection();
|
|
12
|
+
const chainId = useSelectedChainId(connectedChainId);
|
|
13
|
+
const { chains: wagmiChains } = useConfig();
|
|
14
|
+
const isConnectedChainSupported = connectedChainId ? isChainIdSupported(wagmiChains, connectedChainId) : true;
|
|
15
|
+
const rainbowkitChainsById = useRainbowKitChainsById();
|
|
16
|
+
const authenticationStatus = useAuthenticationStatus() ?? void 0;
|
|
17
|
+
const rainbowKitChain = chainId ? rainbowkitChainsById[chainId] : void 0;
|
|
18
|
+
const chainName = rainbowKitChain?.name ?? void 0;
|
|
19
|
+
const chainIconUrl = rainbowKitChain?.iconUrl ?? void 0;
|
|
20
|
+
const chainIconBackground = rainbowKitChain?.iconBackground ?? void 0;
|
|
21
|
+
const resolvedChainIconUrl = useAsyncImage(chainIconUrl);
|
|
22
|
+
const showRecentTransactions = useContext(ShowRecentTransactionsContext);
|
|
23
|
+
const hasPendingTransactions = useRecentTransactions().some(({ status }) => status === "pending") && showRecentTransactions;
|
|
24
|
+
const { showBalance } = useShowBalance();
|
|
25
|
+
const { balance, ensAvatar, ensName } = useProfile({
|
|
26
|
+
address,
|
|
27
|
+
includeBalance: resolveShowBalance(showBalance)
|
|
28
|
+
});
|
|
29
|
+
const displayBalance = balance ? `${abbreviateETHBalance(Number.parseFloat(balance.formatted))} ${balance.symbol}` : void 0;
|
|
30
|
+
const { openConnectModal } = useConnectModal();
|
|
31
|
+
const { openChainModal } = useChainModal();
|
|
32
|
+
const { openAccountModal } = useAccountModal();
|
|
33
|
+
const { accountModalOpen, chainModalOpen, connectModalOpen } = useModalState();
|
|
34
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: children({
|
|
35
|
+
account: address ? {
|
|
36
|
+
address,
|
|
37
|
+
balanceDecimals: balance?.decimals,
|
|
38
|
+
balanceFormatted: balance?.formatted,
|
|
39
|
+
balanceSymbol: balance?.symbol,
|
|
40
|
+
displayBalance,
|
|
41
|
+
displayName: ensName ? formatENS(ensName) : formatAddress(address),
|
|
42
|
+
ensAvatar: ensAvatar ?? void 0,
|
|
43
|
+
ensName: ensName ?? void 0,
|
|
44
|
+
hasPendingTransactions
|
|
45
|
+
} : void 0,
|
|
46
|
+
accountModalOpen,
|
|
47
|
+
authenticationStatus,
|
|
48
|
+
chain: chainId ? {
|
|
49
|
+
hasIcon: Boolean(chainIconUrl),
|
|
50
|
+
iconBackground: chainIconBackground,
|
|
51
|
+
iconUrl: resolvedChainIconUrl,
|
|
52
|
+
id: chainId,
|
|
53
|
+
name: chainName,
|
|
54
|
+
unsupported: !isConnectedChainSupported
|
|
55
|
+
} : void 0,
|
|
56
|
+
chainModalOpen,
|
|
57
|
+
connectModalOpen,
|
|
58
|
+
mounted: isMounted(),
|
|
59
|
+
openAccountModal: openAccountModal ?? noop,
|
|
60
|
+
openChainModal: openChainModal ?? noop,
|
|
61
|
+
openConnectModal: openConnectModal ?? noop
|
|
62
|
+
}) });
|
|
63
|
+
}
|
|
64
|
+
ConnectButtonRenderer.displayName = "ConnectButton.Custom";
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/components/ConnectButton/ConnectButton.tsx
|
|
68
|
+
const defaultProps = defaultConnectButtonProps;
|
|
69
|
+
function ConnectButton({ accountStatus = defaultProps.accountStatus, label = defaultProps.label, showBalance = defaultProps.showBalance }) {
|
|
70
|
+
const connectionStatus = useConnectionStatus();
|
|
71
|
+
const { setShowBalance } = useShowBalance();
|
|
72
|
+
const hydrated = useHydrated();
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
setShowBalance(showBalance);
|
|
75
|
+
}, [setShowBalance, showBalance]);
|
|
76
|
+
return hydrated ? /* @__PURE__ */ jsx(ConnectButtonRenderer, { children: ({ account, mounted, openAccountModal, openConnectModal }) => {
|
|
77
|
+
return /* @__PURE__ */ jsx(ConnectButtonView, {
|
|
78
|
+
account,
|
|
79
|
+
accountStatus,
|
|
80
|
+
buttonReady: mounted && connectionStatus !== "loading",
|
|
81
|
+
isConnected: connectionStatus === "connected",
|
|
82
|
+
label,
|
|
83
|
+
mounted,
|
|
84
|
+
onOpenAccountModal: openAccountModal,
|
|
85
|
+
onOpenConnectModal: openConnectModal,
|
|
86
|
+
showBalance
|
|
87
|
+
});
|
|
88
|
+
} }) : null;
|
|
89
|
+
}
|
|
90
|
+
ConnectButton.Custom = ConnectButtonRenderer;
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/components/ChainSelectButton/ChainSelectButton.tsx
|
|
94
|
+
function ChainSelectButton({ chainStatus = defaultNetworkSelectChainStatus }) {
|
|
95
|
+
const chains = useRainbowKitChains();
|
|
96
|
+
const chainsById = useRainbowKitChainsById();
|
|
97
|
+
const connectionStatus = useConnectionStatus();
|
|
98
|
+
const { openChainModal } = useChainModal();
|
|
99
|
+
const { chainId: connectedChainId } = useConnection();
|
|
100
|
+
const chainId = useSelectedChainId(connectedChainId);
|
|
101
|
+
const { chains: wagmiChains } = useConfig();
|
|
102
|
+
const isConnectedChainSupported = connectedChainId ? isChainIdSupported(wagmiChains, connectedChainId) : true;
|
|
103
|
+
const hydrated = useHydrated();
|
|
104
|
+
const chainMetadata = chainId ? chainsById[chainId] : void 0;
|
|
105
|
+
const resolvedChainIconUrl = useAsyncImage(chainMetadata?.iconUrl ?? void 0);
|
|
106
|
+
const chain = chainId ? {
|
|
107
|
+
hasIcon: Boolean(chainMetadata?.iconUrl),
|
|
108
|
+
iconBackground: chainMetadata?.iconBackground,
|
|
109
|
+
iconUrl: resolvedChainIconUrl,
|
|
110
|
+
id: chainId,
|
|
111
|
+
name: chainMetadata?.name ?? void 0,
|
|
112
|
+
unsupported: !isConnectedChainSupported
|
|
113
|
+
} : void 0;
|
|
114
|
+
if (!hydrated) return null;
|
|
115
|
+
return /* @__PURE__ */ jsx(NetworkSelectButtonView, {
|
|
116
|
+
buttonReady: connectionStatus !== "loading",
|
|
117
|
+
chainStatus,
|
|
118
|
+
network: chain,
|
|
119
|
+
networkCount: chains.length,
|
|
120
|
+
onOpenNetworkModal: openChainModal
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/components/WalletButton/WalletButtonRenderer.tsx
|
|
126
|
+
function WalletButtonRenderer({ wallet = "rainbow", children }) {
|
|
127
|
+
const isMounted = useIsMounted();
|
|
128
|
+
const { openConnectModal } = useConnectModal();
|
|
129
|
+
const { connectModalOpen } = useModalState();
|
|
130
|
+
const { connector, setConnector } = useContext(WalletButtonContext);
|
|
131
|
+
const [firstConnector] = useWalletConnectors().filter((wallet) => wallet.isRainbowKitConnector).filter((_wallet) => _wallet.id.toLowerCase() === wallet.toLowerCase() || _wallet.aliases?.some((alias) => alias.toLowerCase() === wallet.toLowerCase())).sort((a, b) => a.groupIndex - b.groupIndex);
|
|
132
|
+
if (!firstConnector) throw new Error("Connector not found");
|
|
133
|
+
const connectionStatus = useConnectionStatus();
|
|
134
|
+
const [loading, setLoading] = useState(false);
|
|
135
|
+
const [isError, setIsError] = useState(false);
|
|
136
|
+
const mobile = isMobile();
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!connectModalOpen && connector) setConnector(null);
|
|
139
|
+
}, [
|
|
140
|
+
connectModalOpen,
|
|
141
|
+
connector,
|
|
142
|
+
setConnector
|
|
143
|
+
]);
|
|
144
|
+
const { isConnected, isConnecting } = useConnection();
|
|
145
|
+
useConnectionEffect({
|
|
146
|
+
onConnect: () => {
|
|
147
|
+
if (isError) setIsError(false);
|
|
148
|
+
},
|
|
149
|
+
onDisconnect: clearLatestWalletId
|
|
150
|
+
});
|
|
151
|
+
const isLastWalletIdConnected = useMemo(() => {
|
|
152
|
+
const lastWalletId = getLatestWalletId();
|
|
153
|
+
if (!lastWalletId || !firstConnector?.id) return false;
|
|
154
|
+
if (!isConnected) return false;
|
|
155
|
+
return lastWalletId === firstConnector?.id;
|
|
156
|
+
}, [isConnected, firstConnector]);
|
|
157
|
+
const connectWallet = async () => {
|
|
158
|
+
try {
|
|
159
|
+
setLoading(true);
|
|
160
|
+
if (isError) setIsError(false);
|
|
161
|
+
await firstConnector?.connect?.();
|
|
162
|
+
} catch {
|
|
163
|
+
setIsError(true);
|
|
164
|
+
} finally {
|
|
165
|
+
setLoading(false);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const ready = !isConnecting && !!openConnectModal && firstConnector && !(connectionStatus === "loading");
|
|
169
|
+
const isNotSupported = !firstConnector?.installed || !firstConnector?.ready;
|
|
170
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: children({
|
|
171
|
+
error: isError,
|
|
172
|
+
loading,
|
|
173
|
+
connected: isLastWalletIdConnected,
|
|
174
|
+
ready,
|
|
175
|
+
mounted: isMounted(),
|
|
176
|
+
connector: firstConnector,
|
|
177
|
+
connect: async () => {
|
|
178
|
+
addLatestWalletId(firstConnector?.id || "");
|
|
179
|
+
if (mobile || isNotSupported) {
|
|
180
|
+
openConnectModal?.();
|
|
181
|
+
setConnector(firstConnector);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
await connectWallet();
|
|
185
|
+
}
|
|
186
|
+
}) });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/components/WalletButton/WalletButton.tsx
|
|
191
|
+
const WalletButton = ({ wallet }) => {
|
|
192
|
+
return /* @__PURE__ */ jsx(WalletButtonRenderer, {
|
|
193
|
+
wallet,
|
|
194
|
+
children: ({ ready, connect, connected, mounted, connector, loading }) => {
|
|
195
|
+
return /* @__PURE__ */ jsx(WalletButtonView, {
|
|
196
|
+
connected,
|
|
197
|
+
connector,
|
|
198
|
+
loading,
|
|
199
|
+
mounted,
|
|
200
|
+
onConnect: connect,
|
|
201
|
+
ready
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
WalletButton.Custom = WalletButtonRenderer;
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/components/RainbowKitProvider/usePreloadImages.ts
|
|
210
|
+
function usePreloadImages() {
|
|
211
|
+
const rainbowKitChains = useRainbowKitChains();
|
|
212
|
+
const walletConnectors = useWalletConnectors();
|
|
213
|
+
const isUnauthenticated = useAuthenticationStatus() === "unauthenticated";
|
|
214
|
+
const preloadImages = useCallback(() => {
|
|
215
|
+
loadImages(...walletConnectors.map((wallet) => wallet.iconUrl), ...rainbowKitChains.map((chain) => chain.iconUrl).filter(isNotNullish));
|
|
216
|
+
if (!isMobile()) {
|
|
217
|
+
preloadAssetsIcon();
|
|
218
|
+
preloadLoginIcon();
|
|
219
|
+
}
|
|
220
|
+
if (isUnauthenticated) loadImages(signInIcon);
|
|
221
|
+
}, [
|
|
222
|
+
walletConnectors,
|
|
223
|
+
rainbowKitChains,
|
|
224
|
+
isUnauthenticated
|
|
225
|
+
]);
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
preloadImages();
|
|
228
|
+
}, [preloadImages]);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/components/RainbowKitProvider/RainbowKitProvider.tsx
|
|
233
|
+
const defaultTheme = lightTheme();
|
|
234
|
+
function RainbowKitProvider({ appInfo, avatar, chainSearchThreshold, children, id, initialChain, modalSize = ModalSizeOptions.WIDE, showRecentTransactions = false, theme = defaultTheme }) {
|
|
235
|
+
usePreloadImages();
|
|
236
|
+
useFingerprint();
|
|
237
|
+
useConnectionEffect({ onDisconnect: clearWalletConnectDeepLink });
|
|
238
|
+
const { themeCss, themeId } = useThemeRoot(id, theme);
|
|
239
|
+
const appContext = useMemo(() => ({
|
|
240
|
+
...defaultAppInfo,
|
|
241
|
+
...appInfo
|
|
242
|
+
}), [appInfo]);
|
|
243
|
+
const avatarContext = avatar ?? defaultAvatar;
|
|
244
|
+
return /* @__PURE__ */ jsx(RainbowKitChainProvider, {
|
|
245
|
+
chainSearchThreshold,
|
|
246
|
+
initialChain,
|
|
247
|
+
children: /* @__PURE__ */ jsx(WalletButtonProvider, { children: /* @__PURE__ */ jsx(ModalSizeProvider, {
|
|
248
|
+
modalSize,
|
|
249
|
+
children: /* @__PURE__ */ jsx(ShowRecentTransactionsContext.Provider, {
|
|
250
|
+
value: showRecentTransactions,
|
|
251
|
+
children: /* @__PURE__ */ jsx(TransactionStoreProvider, { children: /* @__PURE__ */ jsx(AvatarContext.Provider, {
|
|
252
|
+
value: avatarContext,
|
|
253
|
+
children: /* @__PURE__ */ jsx(AppContext.Provider, {
|
|
254
|
+
value: appContext,
|
|
255
|
+
children: /* @__PURE__ */ jsx(ThemeIdProvider, {
|
|
256
|
+
id: themeId,
|
|
257
|
+
children: /* @__PURE__ */ jsx(ShowBalanceProvider, { children: /* @__PURE__ */ jsx(ModalProvider, { children: /* @__PURE__ */ jsx(ThemeRootStyle, {
|
|
258
|
+
themeCss,
|
|
259
|
+
themeId,
|
|
260
|
+
children
|
|
261
|
+
}) }) })
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
}) })
|
|
265
|
+
})
|
|
266
|
+
}) })
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
//#endregion
|
|
271
|
+
export { ConnectButton as i, WalletButton as n, ChainSelectButton as r, RainbowKitProvider as t };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
import { f as ResponsiveValue, i as AccountStatus } from "./ChainSelectButton-COIW5SBO.js";
|
|
3
|
+
import { o as WalletInstance } from "./Wallet-epUweMuA.js";
|
|
4
|
+
import React, { JSX, ReactNode } from "react";
|
|
5
|
+
import { Address } from "viem";
|
|
6
|
+
|
|
7
|
+
//#region src/components/RainbowKitProvider/AuthenticationContext.d.ts
|
|
8
|
+
type AuthenticationStatus = "loading" | "unauthenticated" | "authenticated";
|
|
9
|
+
interface AuthenticationAdapter<Message> {
|
|
10
|
+
getNonce: () => Promise<string>;
|
|
11
|
+
createMessage: (args: {
|
|
12
|
+
nonce: string;
|
|
13
|
+
address: Address;
|
|
14
|
+
chainId: number;
|
|
15
|
+
}) => Promise<Message> | Message;
|
|
16
|
+
verify: (args: {
|
|
17
|
+
message: Message;
|
|
18
|
+
signature: string;
|
|
19
|
+
}) => Promise<boolean>;
|
|
20
|
+
signOut: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
interface AuthenticationConfig<Message> {
|
|
23
|
+
adapter: AuthenticationAdapter<Message>;
|
|
24
|
+
status: AuthenticationStatus;
|
|
25
|
+
}
|
|
26
|
+
declare function createAuthenticationAdapter<Message>(adapter: AuthenticationAdapter<Message>): AuthenticationAdapter<Message>;
|
|
27
|
+
interface RainbowKitAuthenticationProviderProps<Message> extends AuthenticationConfig<Message> {
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
declare function RainbowKitAuthenticationProvider<Message = unknown>({
|
|
32
|
+
adapter,
|
|
33
|
+
children,
|
|
34
|
+
enabled,
|
|
35
|
+
status
|
|
36
|
+
}: RainbowKitAuthenticationProviderProps<Message>): React.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/ConnectButton/ConnectButtonRenderer.d.ts
|
|
39
|
+
interface ConnectButtonRendererProps {
|
|
40
|
+
children: (renderProps: {
|
|
41
|
+
account?: {
|
|
42
|
+
address: string;
|
|
43
|
+
balanceDecimals?: number;
|
|
44
|
+
balanceFormatted?: string;
|
|
45
|
+
balanceSymbol?: string;
|
|
46
|
+
displayBalance?: string;
|
|
47
|
+
displayName: string;
|
|
48
|
+
ensAvatar?: string;
|
|
49
|
+
ensName?: string;
|
|
50
|
+
hasPendingTransactions: boolean;
|
|
51
|
+
};
|
|
52
|
+
chain?: {
|
|
53
|
+
hasIcon: boolean;
|
|
54
|
+
iconUrl?: string;
|
|
55
|
+
iconBackground?: string;
|
|
56
|
+
id: number;
|
|
57
|
+
name?: string;
|
|
58
|
+
unsupported?: boolean;
|
|
59
|
+
};
|
|
60
|
+
mounted: boolean;
|
|
61
|
+
authenticationStatus?: AuthenticationStatus;
|
|
62
|
+
openAccountModal: () => void;
|
|
63
|
+
openChainModal: () => void;
|
|
64
|
+
openConnectModal: () => void;
|
|
65
|
+
accountModalOpen: boolean;
|
|
66
|
+
chainModalOpen: boolean;
|
|
67
|
+
connectModalOpen: boolean;
|
|
68
|
+
}) => ReactNode;
|
|
69
|
+
}
|
|
70
|
+
declare function ConnectButtonRenderer({
|
|
71
|
+
children
|
|
72
|
+
}: ConnectButtonRendererProps): React.JSX.Element;
|
|
73
|
+
declare namespace ConnectButtonRenderer {
|
|
74
|
+
var displayName: string;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/ConnectButton/ConnectButton.d.ts
|
|
78
|
+
interface ConnectButtonProps {
|
|
79
|
+
accountStatus?: ResponsiveValue<AccountStatus>;
|
|
80
|
+
showBalance?: ResponsiveValue<boolean>;
|
|
81
|
+
label?: string;
|
|
82
|
+
}
|
|
83
|
+
declare function ConnectButton({
|
|
84
|
+
accountStatus,
|
|
85
|
+
label,
|
|
86
|
+
showBalance
|
|
87
|
+
}: ConnectButtonProps): React.JSX.Element | null;
|
|
88
|
+
declare namespace ConnectButton {
|
|
89
|
+
var Custom: typeof ConnectButtonRenderer;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/wallets/useWalletConnectors.d.ts
|
|
93
|
+
interface WalletConnector extends WalletInstance {
|
|
94
|
+
ready?: boolean;
|
|
95
|
+
connect: WalletInstance["connect"];
|
|
96
|
+
showWalletConnectModal?: () => void;
|
|
97
|
+
recent: boolean;
|
|
98
|
+
getDesktopUri?: () => Promise<string>;
|
|
99
|
+
getQrCodeUri?: () => Promise<string>;
|
|
100
|
+
getMobileUri?: () => Promise<string>;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/components/WalletButton/WalletButtonRenderer.d.ts
|
|
104
|
+
interface WalletButtonRendererProps {
|
|
105
|
+
wallet?: string;
|
|
106
|
+
children: (renderProps: {
|
|
107
|
+
error: boolean;
|
|
108
|
+
loading: boolean;
|
|
109
|
+
connected: boolean;
|
|
110
|
+
ready: boolean;
|
|
111
|
+
mounted: boolean;
|
|
112
|
+
connector: WalletConnector;
|
|
113
|
+
connect: () => Promise<void>;
|
|
114
|
+
}) => ReactNode;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/components/WalletButton/WalletButton.d.ts
|
|
118
|
+
interface WalletButtonProps {
|
|
119
|
+
wallet?: string;
|
|
120
|
+
}
|
|
121
|
+
declare const WalletButton: {
|
|
122
|
+
(props: WalletButtonProps): JSX.Element | undefined;
|
|
123
|
+
Custom: (props: WalletButtonRendererProps) => ReactNode;
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
export { ConnectButtonProps as a, RainbowKitAuthenticationProvider as c, ConnectButton as i, createAuthenticationAdapter as l, WalletButtonProps as n, AuthenticationConfig as o, WalletButtonRendererProps as r, AuthenticationStatus as s, WalletButton as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as RainbowKitProvider, l as AvatarComponent, n as ChainSelectButtonProps, o as RainbowKitProviderProps, r as ChainStatus, t as ChainSelectButton, u as AvatarComponentProps } from "../ChainSelectButton-COIW5SBO.js";
|
|
3
|
+
import { a as ConnectButtonProps, i as ConnectButton, n as WalletButtonProps, t as WalletButton } from "../WalletButton-B3e-uEwx.js";
|
|
3
4
|
import React from "react";
|
|
4
5
|
|
|
5
6
|
//#region src/components/Avatar/Avatar.d.ts
|
|
@@ -148,4 +149,4 @@ declare function ChainModal({
|
|
|
148
149
|
open
|
|
149
150
|
}: ChainModalProps): React.JSX.Element;
|
|
150
151
|
//#endregion
|
|
151
|
-
export { AccountModal, type AccountModalProps, Avatar, type AvatarProps, ChainModal, type ChainModalProps, ConnectButton, type ConnectButtonProps, EmojiAvatar, type AvatarComponentProps as EmojiAvatarProps, RainbowKitProvider, type RainbowKitProviderProps, WalletButton, type WalletButtonProps, emojiAvatarForAddress };
|
|
152
|
+
export { AccountModal, type AccountModalProps, Avatar, type AvatarProps, ChainModal, type ChainModalProps, ChainSelectButton, type ChainSelectButtonProps, type ChainStatus, ConnectButton, type ConnectButtonProps, EmojiAvatar, type AvatarComponentProps as EmojiAvatarProps, RainbowKitProvider, type RainbowKitProviderProps, WalletButton, type WalletButtonProps, emojiAvatarForAddress };
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { B as Avatar, I as ChainModal, R as AccountModal, U as EmojiAvatar } from "../useFingerprint-BoVxC_1f.js";
|
|
3
|
+
import { i as ConnectButton, n as WalletButton, r as ChainSelectButton, t as RainbowKitProvider } from "../RainbowKitProvider-CKy7nmFG.js";
|
|
3
4
|
|
|
4
5
|
//#region src/components/Avatar/emojiAvatarForAddress.ts
|
|
5
6
|
const colors = [
|
|
@@ -184,4 +185,4 @@ function emojiAvatarForAddress(address) {
|
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
//#endregion
|
|
187
|
-
export { AccountModal, Avatar, ChainModal, ConnectButton, EmojiAvatar, RainbowKitProvider, WalletButton, emojiAvatarForAddress };
|
|
188
|
+
export { AccountModal, Avatar, ChainModal, ChainSelectButton, ConnectButton, EmojiAvatar, RainbowKitProvider, WalletButton, emojiAvatarForAddress };
|