solariskit 1.4.0 → 1.6.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/ChainSelectButton-BcLkwhod.d.ts +187 -0
- package/dist/RainbowKitProvider-D6tnZRYJ.js +271 -0
- package/dist/{Wallet-epUweMuA.d.ts → Wallet-BhiBD1Pn.d.ts} +1 -5
- package/dist/WalletButton-Dc_yPK_E.d.ts +114 -0
- package/dist/components/index.d.ts +6 -126
- package/dist/components/index.js +3 -185
- package/dist/index.css +47 -47
- package/dist/index.d.ts +14 -49
- package/dist/index.js +3 -2
- package/dist/{injectedWallet-Bq0gF2WF.js → injectedWallet-CnP8-uv5.js} +19 -1
- package/dist/solana/index.d.ts +141 -0
- package/dist/solana/index.js +601 -0
- package/dist/{WalletButton-D8U16Q_4.js → useFingerprint-DGiyXD_j.js} +4583 -4593
- package/dist/{walletConnectors-C02JPPxf.js → walletConnectors-okw2Nbqq.js} +3 -2
- package/dist/wallets/walletConnectors/index.d.ts +2 -6
- package/dist/wallets/walletConnectors/index.js +1 -1
- package/package.json +26 -11
- package/dist/WalletButton-BiMfdrFz.d.ts +0 -337
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import { Chain } from "wagmi/chains";
|
|
4
|
+
import { RequiredConditionalValue } from "@vanilla-extract/sprinkles";
|
|
5
|
+
//#region src/css/sprinkles.css.d.ts
|
|
6
|
+
declare const themeContractValues: {
|
|
7
|
+
colors: {
|
|
8
|
+
accentColor: string;
|
|
9
|
+
accentColorForeground: string;
|
|
10
|
+
actionButtonBorder: string;
|
|
11
|
+
actionButtonBorderMobile: string;
|
|
12
|
+
actionButtonSecondaryBackground: string;
|
|
13
|
+
closeButton: string;
|
|
14
|
+
closeButtonBackground: string;
|
|
15
|
+
connectButtonBackground: string;
|
|
16
|
+
connectButtonBackgroundError: string;
|
|
17
|
+
connectButtonInnerBackground: string;
|
|
18
|
+
connectButtonText: string;
|
|
19
|
+
connectButtonTextError: string;
|
|
20
|
+
connectionIndicator: string;
|
|
21
|
+
downloadBottomCardBackground: string;
|
|
22
|
+
downloadTopCardBackground: string;
|
|
23
|
+
error: string;
|
|
24
|
+
generalBorder: string;
|
|
25
|
+
generalBorderDim: string;
|
|
26
|
+
menuItemBackground: string;
|
|
27
|
+
modalBackdrop: string;
|
|
28
|
+
modalBackground: string;
|
|
29
|
+
modalBorder: string;
|
|
30
|
+
modalText: string;
|
|
31
|
+
modalTextDim: string;
|
|
32
|
+
modalTextSecondary: string;
|
|
33
|
+
profileAction: string;
|
|
34
|
+
profileActionHover: string;
|
|
35
|
+
profileForeground: string;
|
|
36
|
+
selectedOptionBorder: string;
|
|
37
|
+
standby: string;
|
|
38
|
+
};
|
|
39
|
+
fonts: {
|
|
40
|
+
body: string;
|
|
41
|
+
};
|
|
42
|
+
radii: {
|
|
43
|
+
actionButton: string;
|
|
44
|
+
connectButton: string;
|
|
45
|
+
menuButton: string;
|
|
46
|
+
modal: string;
|
|
47
|
+
modalMobile: string;
|
|
48
|
+
};
|
|
49
|
+
shadows: {
|
|
50
|
+
connectButton: string;
|
|
51
|
+
dialog: string;
|
|
52
|
+
profileDetailsAction: string;
|
|
53
|
+
selectedOption: string;
|
|
54
|
+
selectedWallet: string;
|
|
55
|
+
walletLogo: string;
|
|
56
|
+
};
|
|
57
|
+
blurs: {
|
|
58
|
+
modalOverlay: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
type ThemeVars = typeof themeContractValues;
|
|
62
|
+
declare const responsiveProperties: {
|
|
63
|
+
conditions: {
|
|
64
|
+
defaultCondition: "smallScreen";
|
|
65
|
+
conditionNames: ("smallScreen" | "largeScreen")[];
|
|
66
|
+
};
|
|
67
|
+
styles: {
|
|
68
|
+
alignItems: {
|
|
69
|
+
values: {
|
|
70
|
+
center: {
|
|
71
|
+
defaultClass: string;
|
|
72
|
+
conditions: {
|
|
73
|
+
smallScreen: string;
|
|
74
|
+
largeScreen: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
"flex-end": {
|
|
78
|
+
defaultClass: string;
|
|
79
|
+
conditions: {
|
|
80
|
+
smallScreen: string;
|
|
81
|
+
largeScreen: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
"flex-start": {
|
|
85
|
+
defaultClass: string;
|
|
86
|
+
conditions: {
|
|
87
|
+
smallScreen: string;
|
|
88
|
+
largeScreen: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
display: {
|
|
94
|
+
values: {
|
|
95
|
+
flex: {
|
|
96
|
+
defaultClass: string;
|
|
97
|
+
conditions: {
|
|
98
|
+
smallScreen: string;
|
|
99
|
+
largeScreen: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
none: {
|
|
103
|
+
defaultClass: string;
|
|
104
|
+
conditions: {
|
|
105
|
+
smallScreen: string;
|
|
106
|
+
largeScreen: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
block: {
|
|
110
|
+
defaultClass: string;
|
|
111
|
+
conditions: {
|
|
112
|
+
smallScreen: string;
|
|
113
|
+
largeScreen: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
inline: {
|
|
117
|
+
defaultClass: string;
|
|
118
|
+
conditions: {
|
|
119
|
+
smallScreen: string;
|
|
120
|
+
largeScreen: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
type ResponsiveValue<Value extends string | number | boolean> = RequiredConditionalValue<typeof responsiveProperties, Value>;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/components/RainbowKitProvider/AppContext.d.ts
|
|
130
|
+
type DisclaimerComponent = React.FunctionComponent<{
|
|
131
|
+
Text: React.FunctionComponent<{
|
|
132
|
+
children: ReactNode;
|
|
133
|
+
}>;
|
|
134
|
+
Link: React.FunctionComponent<{
|
|
135
|
+
children: ReactNode;
|
|
136
|
+
href: string;
|
|
137
|
+
}>;
|
|
138
|
+
}>;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/components/RainbowKitProvider/AvatarContext.d.ts
|
|
141
|
+
type AvatarComponentProps = {
|
|
142
|
+
address: string;
|
|
143
|
+
ensImage?: string | null;
|
|
144
|
+
size: number;
|
|
145
|
+
};
|
|
146
|
+
type AvatarComponent = React.FunctionComponent<AvatarComponentProps>;
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/components/RainbowKitProvider/ModalSizeContext.d.ts
|
|
149
|
+
declare const ModalSizeOptions: {
|
|
150
|
+
readonly COMPACT: "compact";
|
|
151
|
+
readonly WIDE: "wide";
|
|
152
|
+
};
|
|
153
|
+
type ModalSizes = (typeof ModalSizeOptions)[keyof typeof ModalSizeOptions];
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/components/RainbowKitProvider/RainbowKitProvider.d.ts
|
|
156
|
+
type Theme = ThemeVars | {
|
|
157
|
+
lightMode: ThemeVars;
|
|
158
|
+
darkMode: ThemeVars;
|
|
159
|
+
};
|
|
160
|
+
interface RainbowKitProviderProps {
|
|
161
|
+
initialChain?: Chain | number;
|
|
162
|
+
chainSearchThreshold?: number;
|
|
163
|
+
id?: string;
|
|
164
|
+
children: ReactNode;
|
|
165
|
+
theme?: Theme | null;
|
|
166
|
+
showRecentTransactions?: boolean;
|
|
167
|
+
appInfo?: {
|
|
168
|
+
appName?: string;
|
|
169
|
+
learnMoreUrl?: string;
|
|
170
|
+
disclaimer?: DisclaimerComponent;
|
|
171
|
+
};
|
|
172
|
+
avatar?: AvatarComponent;
|
|
173
|
+
modalSize?: ModalSizes;
|
|
174
|
+
}
|
|
175
|
+
declare function RainbowKitProvider({ appInfo, avatar, chainSearchThreshold, children, id, initialChain, modalSize, showRecentTransactions, theme }: RainbowKitProviderProps): React.JSX.Element;
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/components/ConnectButton/ConnectButtonView.d.ts
|
|
178
|
+
type AccountStatus = "full" | "avatar" | "address";
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/components/ChainSelectButton/ChainSelectButton.d.ts
|
|
181
|
+
type ChainStatus = "full" | "icon" | "name" | "none";
|
|
182
|
+
interface ChainSelectButtonProps {
|
|
183
|
+
chainStatus?: ResponsiveValue<ChainStatus>;
|
|
184
|
+
}
|
|
185
|
+
declare function ChainSelectButton({ chainStatus }: ChainSelectButtonProps): React.JSX.Element | null;
|
|
186
|
+
//#endregion
|
|
187
|
+
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-DGiyXD_j.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 };
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { Connector, CreateConnectorFn } from "wagmi";
|
|
3
3
|
import { WalletConnectParameters } from "wagmi/connectors";
|
|
4
|
-
|
|
5
4
|
//#region src/wallets/walletConnectors/walletConnectWallet/walletConnectWallet.d.ts
|
|
6
5
|
interface WalletConnectWalletOptions {
|
|
7
6
|
projectId: string;
|
|
8
7
|
options?: RainbowKitWalletConnectParameters;
|
|
9
8
|
}
|
|
10
|
-
declare const walletConnectWallet: ({
|
|
11
|
-
projectId,
|
|
12
|
-
options
|
|
13
|
-
}: WalletConnectWalletOptions) => Wallet;
|
|
9
|
+
declare const walletConnectWallet: ({ projectId, options }: WalletConnectWalletOptions) => Wallet;
|
|
14
10
|
//#endregion
|
|
15
11
|
//#region src/wallets/Wallet.d.ts
|
|
16
12
|
type RainbowKitConnector = {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
|
|
2
|
+
import { f as ResponsiveValue, i as AccountStatus } from "./ChainSelectButton-BcLkwhod.js";
|
|
3
|
+
import { o as WalletInstance } from "./Wallet-BhiBD1Pn.js";
|
|
4
|
+
import React, { JSX, ReactNode } from "react";
|
|
5
|
+
import { Address, SignableMessage } from "viem";
|
|
6
|
+
//#region src/components/RainbowKitProvider/AuthenticationContext.d.ts
|
|
7
|
+
type AuthenticationStatus = "loading" | "unauthenticated" | "authenticated";
|
|
8
|
+
interface AuthenticationAdapter<Message extends SignableMessage> {
|
|
9
|
+
getNonce: () => Promise<string>;
|
|
10
|
+
createMessage: (args: {
|
|
11
|
+
nonce: string;
|
|
12
|
+
address: Address;
|
|
13
|
+
chainId: number;
|
|
14
|
+
}) => Promise<Message> | Message;
|
|
15
|
+
verify: (args: {
|
|
16
|
+
message: Message;
|
|
17
|
+
signature: string;
|
|
18
|
+
}) => Promise<boolean>;
|
|
19
|
+
signOut: () => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
interface AuthenticationConfig<Message extends SignableMessage> {
|
|
22
|
+
adapter: AuthenticationAdapter<Message>;
|
|
23
|
+
status: AuthenticationStatus;
|
|
24
|
+
}
|
|
25
|
+
declare function createAuthenticationAdapter<Message extends SignableMessage>(adapter: AuthenticationAdapter<Message>): AuthenticationAdapter<Message>;
|
|
26
|
+
interface RainbowKitAuthenticationProviderProps<Message extends SignableMessage> extends AuthenticationConfig<Message> {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare function RainbowKitAuthenticationProvider<Message extends SignableMessage = SignableMessage>({ adapter, children, enabled, status }: RainbowKitAuthenticationProviderProps<Message>): React.JSX.Element;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/ConnectButton/ConnectButtonRenderer.d.ts
|
|
33
|
+
interface ConnectButtonRendererProps {
|
|
34
|
+
children: (renderProps: {
|
|
35
|
+
account?: {
|
|
36
|
+
address: string;
|
|
37
|
+
balanceDecimals?: number;
|
|
38
|
+
balanceFormatted?: string;
|
|
39
|
+
balanceSymbol?: string;
|
|
40
|
+
displayBalance?: string;
|
|
41
|
+
displayName: string;
|
|
42
|
+
ensAvatar?: string;
|
|
43
|
+
ensName?: string;
|
|
44
|
+
hasPendingTransactions: boolean;
|
|
45
|
+
};
|
|
46
|
+
chain?: {
|
|
47
|
+
hasIcon: boolean;
|
|
48
|
+
iconUrl?: string;
|
|
49
|
+
iconBackground?: string;
|
|
50
|
+
id: number;
|
|
51
|
+
name?: string;
|
|
52
|
+
unsupported?: boolean;
|
|
53
|
+
};
|
|
54
|
+
mounted: boolean;
|
|
55
|
+
authenticationStatus?: AuthenticationStatus;
|
|
56
|
+
openAccountModal: () => void;
|
|
57
|
+
openChainModal: () => void;
|
|
58
|
+
openConnectModal: () => void;
|
|
59
|
+
accountModalOpen: boolean;
|
|
60
|
+
chainModalOpen: boolean;
|
|
61
|
+
connectModalOpen: boolean;
|
|
62
|
+
}) => ReactNode;
|
|
63
|
+
}
|
|
64
|
+
declare function ConnectButtonRenderer({ children }: ConnectButtonRendererProps): React.JSX.Element;
|
|
65
|
+
declare namespace ConnectButtonRenderer {
|
|
66
|
+
var displayName: string;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/ConnectButton/ConnectButton.d.ts
|
|
70
|
+
interface ConnectButtonProps {
|
|
71
|
+
accountStatus?: ResponsiveValue<AccountStatus>;
|
|
72
|
+
showBalance?: ResponsiveValue<boolean>;
|
|
73
|
+
label?: string;
|
|
74
|
+
}
|
|
75
|
+
declare function ConnectButton({ accountStatus, label, showBalance }: ConnectButtonProps): React.JSX.Element | null;
|
|
76
|
+
declare namespace ConnectButton {
|
|
77
|
+
var Custom: typeof ConnectButtonRenderer;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/wallets/useWalletConnectors.d.ts
|
|
81
|
+
interface WalletConnector extends WalletInstance {
|
|
82
|
+
ready?: boolean;
|
|
83
|
+
connect: WalletInstance["connect"];
|
|
84
|
+
showWalletConnectModal?: () => void;
|
|
85
|
+
recent: boolean;
|
|
86
|
+
getDesktopUri?: () => Promise<string>;
|
|
87
|
+
getQrCodeUri?: () => Promise<string>;
|
|
88
|
+
getMobileUri?: () => Promise<string>;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/components/WalletButton/WalletButtonRenderer.d.ts
|
|
92
|
+
interface WalletButtonRendererProps {
|
|
93
|
+
wallet?: string;
|
|
94
|
+
children: (renderProps: {
|
|
95
|
+
error: boolean;
|
|
96
|
+
loading: boolean;
|
|
97
|
+
connected: boolean;
|
|
98
|
+
ready: boolean;
|
|
99
|
+
mounted: boolean;
|
|
100
|
+
connector: WalletConnector;
|
|
101
|
+
connect: () => Promise<void>;
|
|
102
|
+
}) => ReactNode;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/components/WalletButton/WalletButton.d.ts
|
|
106
|
+
interface WalletButtonProps {
|
|
107
|
+
wallet?: string;
|
|
108
|
+
}
|
|
109
|
+
declare const WalletButton: {
|
|
110
|
+
(props: WalletButtonProps): JSX.Element | undefined;
|
|
111
|
+
Custom: (props: WalletButtonRendererProps) => ReactNode;
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
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 };
|