solariskit 1.1.0 → 1.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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
3
3
|
import { createMapValueFn, createNormalizeValueFn } from "@vanilla-extract/sprinkles/createUtils";
|
|
4
4
|
import { createSprinkles } from "@vanilla-extract/sprinkles/createRuntimeSprinkles";
|
|
5
|
-
import { useBalance, useConfig, useConnect, useConnection, useConnectionEffect, useConnectors, useDisconnect, useEnsAvatar, useEnsName, usePublicClient, useSignMessage, useSwitchChain } from "wagmi";
|
|
5
|
+
import { useBalance, useChainId, useConfig, useConnect, useConnection, useConnectionEffect, useConnectors, useDisconnect, useEnsAvatar, useEnsName, usePublicClient, useSignMessage, useSwitchChain } from "wagmi";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import clsx from "clsx";
|
|
8
8
|
import { polyconDataUri } from "@akshatmittal/polycons";
|
|
@@ -1592,7 +1592,7 @@ function AsyncImage({ alt, background, borderColor, borderRadius, useAsImage, bo
|
|
|
1592
1592
|
width: typeof width === "string" ? width : void 0,
|
|
1593
1593
|
testId,
|
|
1594
1594
|
children: [/* @__PURE__ */ jsx(Box, {
|
|
1595
|
-
...isRemoteImage ? {
|
|
1595
|
+
...src ? isRemoteImage ? {
|
|
1596
1596
|
"aria-hidden": true,
|
|
1597
1597
|
as: "img",
|
|
1598
1598
|
onLoad: setRemoteImageLoaded,
|
|
@@ -1601,7 +1601,7 @@ function AsyncImage({ alt, background, borderColor, borderRadius, useAsImage, bo
|
|
|
1601
1601
|
"aria-hidden": true,
|
|
1602
1602
|
as: "img",
|
|
1603
1603
|
src
|
|
1604
|
-
},
|
|
1604
|
+
} : { "aria-hidden": true },
|
|
1605
1605
|
height: "full",
|
|
1606
1606
|
position: "absolute",
|
|
1607
1607
|
...ios ? { WebkitUserSelect: "none" } : {},
|
|
@@ -1777,6 +1777,12 @@ const DropdownIcon = () => /* @__PURE__ */ jsxs("svg", {
|
|
|
1777
1777
|
})]
|
|
1778
1778
|
});
|
|
1779
1779
|
|
|
1780
|
+
//#endregion
|
|
1781
|
+
//#region src/utils/isChainIdSupported.ts
|
|
1782
|
+
function isChainIdSupported(chains, chainId) {
|
|
1783
|
+
return chainId != null && chains.some((chain) => chain.id === chainId);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1780
1786
|
//#endregion
|
|
1781
1787
|
//#region src/components/RainbowKitProvider/provideRainbowKitChains.ts
|
|
1782
1788
|
const getChainIconUrl = (chainId) => `https://static.createmytoken.com/images/chains/${chainId}.png`;
|
|
@@ -1794,15 +1800,32 @@ const RainbowKitChainContext = createContext({
|
|
|
1794
1800
|
});
|
|
1795
1801
|
function RainbowKitChainProvider({ chainSearchThreshold = 5, children, initialChain }) {
|
|
1796
1802
|
const { chains } = useConfig();
|
|
1803
|
+
const { status } = useConnection();
|
|
1804
|
+
const wagmiChainId = useChainId();
|
|
1805
|
+
const { mutate: switchChain } = useSwitchChain();
|
|
1806
|
+
const appliedInitialChainIdRef = useRef(void 0);
|
|
1807
|
+
const initialChainId = typeof initialChain === "number" ? initialChain : initialChain?.id;
|
|
1808
|
+
const configuredInitialChainId = isChainIdSupported(chains, initialChainId) ? initialChainId : void 0;
|
|
1809
|
+
useEffect(() => {
|
|
1810
|
+
if (status !== "disconnected" || configuredInitialChainId == null) return;
|
|
1811
|
+
if (appliedInitialChainIdRef.current === configuredInitialChainId) return;
|
|
1812
|
+
appliedInitialChainIdRef.current = configuredInitialChainId;
|
|
1813
|
+
if (wagmiChainId !== configuredInitialChainId) switchChain({ chainId: configuredInitialChainId });
|
|
1814
|
+
}, [
|
|
1815
|
+
configuredInitialChainId,
|
|
1816
|
+
status,
|
|
1817
|
+
switchChain,
|
|
1818
|
+
wagmiChainId
|
|
1819
|
+
]);
|
|
1797
1820
|
return /* @__PURE__ */ jsx(RainbowKitChainContext.Provider, {
|
|
1798
1821
|
value: useMemo(() => ({
|
|
1799
1822
|
chains: provideRainbowKitChains(chains),
|
|
1800
1823
|
chainSearchThreshold,
|
|
1801
|
-
initialChainId
|
|
1824
|
+
initialChainId
|
|
1802
1825
|
}), [
|
|
1803
1826
|
chainSearchThreshold,
|
|
1804
1827
|
chains,
|
|
1805
|
-
|
|
1828
|
+
initialChainId
|
|
1806
1829
|
]),
|
|
1807
1830
|
children
|
|
1808
1831
|
});
|
|
@@ -2124,9 +2147,16 @@ function useProfile({ address, includeBalance }) {
|
|
|
2124
2147
|
};
|
|
2125
2148
|
}
|
|
2126
2149
|
|
|
2150
|
+
//#endregion
|
|
2151
|
+
//#region src/hooks/useSelectedChainId.ts
|
|
2152
|
+
function useSelectedChainId(connectedChainId) {
|
|
2153
|
+
const wagmiChainId = useChainId();
|
|
2154
|
+
return connectedChainId ?? wagmiChainId;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2127
2157
|
//#endregion
|
|
2128
2158
|
//#region src/hooks/useChainId.ts
|
|
2129
|
-
function useChainId() {
|
|
2159
|
+
function useChainId$1() {
|
|
2130
2160
|
const { chain: activeChain } = useConnection();
|
|
2131
2161
|
return activeChain?.id ?? null;
|
|
2132
2162
|
}
|
|
@@ -2276,7 +2306,7 @@ const TransactionStoreContext = React.createContext(null);
|
|
|
2276
2306
|
function TransactionStoreProvider({ children }) {
|
|
2277
2307
|
const provider = usePublicClient();
|
|
2278
2308
|
const { address } = useConnection();
|
|
2279
|
-
const chainId = useChainId();
|
|
2309
|
+
const chainId = useChainId$1();
|
|
2280
2310
|
const { refetch } = useBalance({
|
|
2281
2311
|
address,
|
|
2282
2312
|
query: { enabled: false }
|
|
@@ -2322,7 +2352,7 @@ function useTransactionStore() {
|
|
|
2322
2352
|
function useRecentTransactions() {
|
|
2323
2353
|
const store = useTransactionStore();
|
|
2324
2354
|
const { address } = useConnection();
|
|
2325
|
-
const chainId = useChainId();
|
|
2355
|
+
const chainId = useChainId$1();
|
|
2326
2356
|
const [transactions, setTransactions] = useState(() => store && address && chainId ? store.getTransactions(address, chainId) : []);
|
|
2327
2357
|
useEffect(() => {
|
|
2328
2358
|
if (store && address && chainId) {
|
|
@@ -2578,7 +2608,7 @@ function setRainbowKitVersion({ version }) {
|
|
|
2578
2608
|
}
|
|
2579
2609
|
function useFingerprint() {
|
|
2580
2610
|
const fingerprint = useCallback(() => {
|
|
2581
|
-
setRainbowKitVersion({ version: "1.
|
|
2611
|
+
setRainbowKitVersion({ version: "1.2.0" });
|
|
2582
2612
|
}, []);
|
|
2583
2613
|
useEffect(() => {
|
|
2584
2614
|
fingerprint();
|
|
@@ -2651,7 +2681,8 @@ function addRecentWalletId(walletId) {
|
|
|
2651
2681
|
function useWalletConnectors(mergeEIP6963WithRkConnectors = false) {
|
|
2652
2682
|
const rainbowKitChains = useRainbowKitChains();
|
|
2653
2683
|
const initialChainId = useInitialChainId();
|
|
2654
|
-
const
|
|
2684
|
+
const selectedChainId = useChainId();
|
|
2685
|
+
const { mutateAsync: connect } = useConnect();
|
|
2655
2686
|
const defaultCreatedConnectors = useConnectors();
|
|
2656
2687
|
const { setIsWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
2657
2688
|
const defaultConnectors = defaultCreatedConnectors.map((connector) => ({
|
|
@@ -2660,9 +2691,9 @@ function useWalletConnectors(mergeEIP6963WithRkConnectors = false) {
|
|
|
2660
2691
|
}));
|
|
2661
2692
|
async function connectWallet(connector, parameters) {
|
|
2662
2693
|
const walletChainId = await connector.getChainId();
|
|
2663
|
-
const result = await
|
|
2694
|
+
const result = await connect({
|
|
2664
2695
|
...parameters,
|
|
2665
|
-
chainId: parameters?.chainId ?? initialChainId ??
|
|
2696
|
+
chainId: parameters?.chainId ?? selectedChainId ?? initialChainId ?? (isChainIdSupported(rainbowKitChains, walletChainId) ? walletChainId : void 0) ?? rainbowKitChains[0]?.id,
|
|
2666
2697
|
connector
|
|
2667
2698
|
});
|
|
2668
2699
|
if (result) addRecentWalletId(connector.id);
|
|
@@ -2939,7 +2970,7 @@ function SignIn({ onClose, onCloseModal }) {
|
|
|
2939
2970
|
}, [getNonce]);
|
|
2940
2971
|
const mobile = isMobile();
|
|
2941
2972
|
const { address, chain: activeChain } = useConnection();
|
|
2942
|
-
const {
|
|
2973
|
+
const { mutateAsync: signMessage } = useSignMessage();
|
|
2943
2974
|
const signIn = async () => {
|
|
2944
2975
|
try {
|
|
2945
2976
|
const chainId = activeChain?.id;
|
|
@@ -2974,7 +3005,7 @@ function SignIn({ onClose, onCloseModal }) {
|
|
|
2974
3005
|
...x,
|
|
2975
3006
|
status: "signing"
|
|
2976
3007
|
}));
|
|
2977
|
-
signature = await
|
|
3008
|
+
signature = await signMessage({ message });
|
|
2978
3009
|
} catch (error) {
|
|
2979
3010
|
if (error instanceof UserRejectedRequestError) return setState((x) => ({
|
|
2980
3011
|
...x,
|
|
@@ -3423,7 +3454,7 @@ const DisconnectIcon = () => /* @__PURE__ */ jsxs("svg", {
|
|
|
3423
3454
|
function useClearRecentTransactions() {
|
|
3424
3455
|
const store = useTransactionStore();
|
|
3425
3456
|
const { address } = useConnection();
|
|
3426
|
-
const chainId = useChainId();
|
|
3457
|
+
const chainId = useChainId$1();
|
|
3427
3458
|
return useCallback(() => {
|
|
3428
3459
|
if (!address || !chainId) throw new Error("No address or chain ID found");
|
|
3429
3460
|
store.clearTransactions(address, chainId);
|
|
@@ -3834,7 +3865,7 @@ function AccountModal({ onClose, open }) {
|
|
|
3834
3865
|
address,
|
|
3835
3866
|
includeBalance: open
|
|
3836
3867
|
});
|
|
3837
|
-
const { disconnect } = useDisconnect();
|
|
3868
|
+
const { mutate: disconnect } = useDisconnect();
|
|
3838
3869
|
if (!address) return null;
|
|
3839
3870
|
return /* @__PURE__ */ jsx(Fragment$1, { children: address && /* @__PURE__ */ jsx(Dialog, {
|
|
3840
3871
|
onClose,
|
|
@@ -4008,28 +4039,24 @@ var SearchInputClassName = "_5a0qia2";
|
|
|
4008
4039
|
//#endregion
|
|
4009
4040
|
//#region src/components/ChainModal/ChainModal.tsx
|
|
4010
4041
|
function ChainModal({ onClose, open }) {
|
|
4011
|
-
const { chainId } = useConnection();
|
|
4042
|
+
const { chainId: connectedChainId, isConnected } = useConnection();
|
|
4043
|
+
const currentChainId = useSelectedChainId(connectedChainId);
|
|
4012
4044
|
const { chains } = useConfig();
|
|
4013
4045
|
const [pendingChainId, setPendingChainId] = useState(null);
|
|
4014
4046
|
const [searchQuery, setSearchQuery] = useState("");
|
|
4015
|
-
const { switchChain } = useSwitchChain({ mutation: {
|
|
4047
|
+
const { mutate: switchChain } = useSwitchChain({ mutation: {
|
|
4016
4048
|
onMutate: ({ chainId: _chainId }) => {
|
|
4017
4049
|
setPendingChainId(_chainId);
|
|
4018
4050
|
},
|
|
4019
|
-
onSuccess: () => {
|
|
4020
|
-
if (pendingChainId) setPendingChainId(null);
|
|
4021
|
-
},
|
|
4022
|
-
onError: () => {
|
|
4023
|
-
if (pendingChainId) setPendingChainId(null);
|
|
4024
|
-
},
|
|
4025
4051
|
onSettled: () => {
|
|
4052
|
+
setPendingChainId(null);
|
|
4026
4053
|
onClose();
|
|
4027
4054
|
}
|
|
4028
4055
|
} });
|
|
4029
|
-
const { disconnect } = useDisconnect();
|
|
4056
|
+
const { mutate: disconnect } = useDisconnect();
|
|
4030
4057
|
const titleId = "rk_chain_modal_title";
|
|
4031
4058
|
const mobile = isMobile();
|
|
4032
|
-
const
|
|
4059
|
+
const isConnectedToUnsupportedChain = isConnected && !isChainIdSupported(chains, connectedChainId);
|
|
4033
4060
|
const chainIconSize = mobile ? "36" : "28";
|
|
4034
4061
|
const rainbowkitChains = useRainbowKitChains();
|
|
4035
4062
|
const chainSearchThreshold = useChainSearchThreshold();
|
|
@@ -4042,7 +4069,6 @@ function ChainModal({ onClose, open }) {
|
|
|
4042
4069
|
useEffect(() => {
|
|
4043
4070
|
if (!open) setSearchQuery("");
|
|
4044
4071
|
}, [open]);
|
|
4045
|
-
if (!chainId) return null;
|
|
4046
4072
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
4047
4073
|
onClose,
|
|
4048
4074
|
open,
|
|
@@ -4077,7 +4103,7 @@ function ChainModal({ onClose, open }) {
|
|
|
4077
4103
|
/* @__PURE__ */ jsx(CloseButton, { onClose })
|
|
4078
4104
|
]
|
|
4079
4105
|
}),
|
|
4080
|
-
|
|
4106
|
+
isConnectedToUnsupportedChain && /* @__PURE__ */ jsx(Box, {
|
|
4081
4107
|
marginX: "8",
|
|
4082
4108
|
textAlign: mobile ? "center" : "left",
|
|
4083
4109
|
children: /* @__PURE__ */ jsx(Text, {
|
|
@@ -4110,7 +4136,7 @@ function ChainModal({ onClose, open }) {
|
|
|
4110
4136
|
filteredChains.map(({ iconBackground, iconUrl, id, name }, idx) => {
|
|
4111
4137
|
return /* @__PURE__ */ jsx(Chain$1, {
|
|
4112
4138
|
chainId: id,
|
|
4113
|
-
currentChainId
|
|
4139
|
+
currentChainId,
|
|
4114
4140
|
switchChain,
|
|
4115
4141
|
chainIconSize,
|
|
4116
4142
|
isLoading: pendingChainId === id,
|
|
@@ -4131,7 +4157,7 @@ function ChainModal({ onClose, open }) {
|
|
|
4131
4157
|
children: t("chains.search.no_results")
|
|
4132
4158
|
})
|
|
4133
4159
|
}),
|
|
4134
|
-
|
|
4160
|
+
isConnectedToUnsupportedChain && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Box, {
|
|
4135
4161
|
background: "generalBorderDim",
|
|
4136
4162
|
height: "1",
|
|
4137
4163
|
marginX: "8"
|
|
@@ -5332,7 +5358,7 @@ function ConnectOptions({ onClose }) {
|
|
|
5332
5358
|
function ConnectModal({ onClose, open }) {
|
|
5333
5359
|
const titleId = "rk_connect_title";
|
|
5334
5360
|
const connectionStatus = useConnectionStatus();
|
|
5335
|
-
const { disconnect } = useDisconnect();
|
|
5361
|
+
const { mutate: disconnect } = useDisconnect();
|
|
5336
5362
|
const { isConnecting } = useConnection();
|
|
5337
5363
|
const onAuthCancel = React.useCallback(() => {
|
|
5338
5364
|
onClose();
|
|
@@ -5398,7 +5424,7 @@ function ModalProvider({ children }) {
|
|
|
5398
5424
|
const connectionStatus = useConnectionStatus();
|
|
5399
5425
|
const { chainId } = useConnection();
|
|
5400
5426
|
const { chains } = useConfig();
|
|
5401
|
-
const isCurrentChainSupported = chains
|
|
5427
|
+
const isCurrentChainSupported = isChainIdSupported(chains, chainId);
|
|
5402
5428
|
const closeModals = useCallback(({ keepConnectModalOpen = false } = {}) => {
|
|
5403
5429
|
if (!keepConnectModalOpen) closeConnectModal();
|
|
5404
5430
|
closeAccountModal();
|
|
@@ -5423,7 +5449,7 @@ function ModalProvider({ children }) {
|
|
|
5423
5449
|
connectModalOpen,
|
|
5424
5450
|
isWalletConnectModalOpen,
|
|
5425
5451
|
openAccountModal: isCurrentChainSupported && connectionStatus === "connected" ? openAccountModal : void 0,
|
|
5426
|
-
openChainModal:
|
|
5452
|
+
openChainModal: chains.length > 0 ? openChainModal : void 0,
|
|
5427
5453
|
openConnectModal: connectionStatus === "disconnected" || connectionStatus === "unauthenticated" ? openConnectModal : void 0,
|
|
5428
5454
|
setIsWalletConnectModalOpen
|
|
5429
5455
|
}), [
|
|
@@ -5435,6 +5461,7 @@ function ModalProvider({ children }) {
|
|
|
5435
5461
|
openChainModal,
|
|
5436
5462
|
openConnectModal,
|
|
5437
5463
|
isCurrentChainSupported,
|
|
5464
|
+
chains.length,
|
|
5438
5465
|
isWalletConnectModalOpen
|
|
5439
5466
|
]),
|
|
5440
5467
|
children: [
|
|
@@ -5497,10 +5524,10 @@ function useConnectModal() {
|
|
|
5497
5524
|
const noop = () => {};
|
|
5498
5525
|
function ConnectButtonRenderer({ children }) {
|
|
5499
5526
|
const isMounted = useIsMounted();
|
|
5500
|
-
const { address } = useConnection();
|
|
5501
|
-
const
|
|
5527
|
+
const { address, chainId: connectedChainId } = useConnection();
|
|
5528
|
+
const chainId = useSelectedChainId(connectedChainId);
|
|
5502
5529
|
const { chains: wagmiChains } = useConfig();
|
|
5503
|
-
const
|
|
5530
|
+
const isConnectedChainSupported = connectedChainId ? isChainIdSupported(wagmiChains, connectedChainId) : true;
|
|
5504
5531
|
const rainbowkitChainsById = useRainbowKitChainsById();
|
|
5505
5532
|
const authenticationStatus = useAuthenticationStatus() ?? void 0;
|
|
5506
5533
|
const rainbowKitChain = chainId ? rainbowkitChainsById[chainId] : void 0;
|
|
@@ -5545,7 +5572,7 @@ function ConnectButtonRenderer({ children }) {
|
|
|
5545
5572
|
iconUrl: resolvedChainIconUrl,
|
|
5546
5573
|
id: chainId,
|
|
5547
5574
|
name: chainName,
|
|
5548
|
-
unsupported: !
|
|
5575
|
+
unsupported: !isConnectedChainSupported
|
|
5549
5576
|
} : void 0,
|
|
5550
5577
|
chainModalOpen,
|
|
5551
5578
|
connectModalOpen,
|
|
@@ -5587,6 +5614,59 @@ function ConnectButton({ accountStatus = defaultProps.accountStatus, chainStatus
|
|
|
5587
5614
|
return ready ? /* @__PURE__ */ jsx(ConnectButtonRenderer, { children: ({ account, chain, mounted, openAccountModal, openChainModal, openConnectModal }) => {
|
|
5588
5615
|
const ready = mounted && connectionStatus !== "loading";
|
|
5589
5616
|
const unsupportedChain = chain?.unsupported ?? false;
|
|
5617
|
+
const chainButton = chain && (chains.length > 1 || unsupportedChain) ? /* @__PURE__ */ jsxs(Box, {
|
|
5618
|
+
alignItems: "center",
|
|
5619
|
+
"aria-label": "Chain Selector",
|
|
5620
|
+
as: "button",
|
|
5621
|
+
background: unsupportedChain ? "connectButtonBackgroundError" : "connectButtonBackground",
|
|
5622
|
+
borderRadius: "connectButton",
|
|
5623
|
+
boxShadow: "connectButton",
|
|
5624
|
+
className: touchableStyles({
|
|
5625
|
+
active: "shrink",
|
|
5626
|
+
hover: "grow"
|
|
5627
|
+
}),
|
|
5628
|
+
color: unsupportedChain ? "connectButtonTextError" : "connectButtonText",
|
|
5629
|
+
display: mapResponsiveValue(chainStatus, (value) => value === "none" ? "none" : "flex"),
|
|
5630
|
+
fontFamily: "body",
|
|
5631
|
+
fontWeight: "bold",
|
|
5632
|
+
gap: "6",
|
|
5633
|
+
onClick: openChainModal,
|
|
5634
|
+
paddingX: "10",
|
|
5635
|
+
paddingY: "8",
|
|
5636
|
+
testId: unsupportedChain ? "wrong-network-button" : "chain-button",
|
|
5637
|
+
transition: "default",
|
|
5638
|
+
type: "button",
|
|
5639
|
+
children: [unsupportedChain ? /* @__PURE__ */ jsx(Box, {
|
|
5640
|
+
alignItems: "center",
|
|
5641
|
+
display: "flex",
|
|
5642
|
+
height: "24",
|
|
5643
|
+
paddingX: "4",
|
|
5644
|
+
children: t("connect_wallet.wrong_network.label")
|
|
5645
|
+
}) : /* @__PURE__ */ jsxs(Box, {
|
|
5646
|
+
alignItems: "center",
|
|
5647
|
+
display: "flex",
|
|
5648
|
+
gap: "6",
|
|
5649
|
+
children: [chain.hasIcon ? /* @__PURE__ */ jsx(Box, {
|
|
5650
|
+
display: mapResponsiveValue(chainStatus, (value) => value === "full" || value === "icon" ? "block" : "none"),
|
|
5651
|
+
height: "24",
|
|
5652
|
+
width: "24",
|
|
5653
|
+
children: /* @__PURE__ */ jsx(AsyncImage, {
|
|
5654
|
+
alt: chain.name ?? "Chain icon",
|
|
5655
|
+
background: chain.iconBackground,
|
|
5656
|
+
borderRadius: "full",
|
|
5657
|
+
height: "24",
|
|
5658
|
+
src: chain.iconUrl,
|
|
5659
|
+
width: "24"
|
|
5660
|
+
})
|
|
5661
|
+
}) : null, /* @__PURE__ */ jsx(Box, {
|
|
5662
|
+
display: mapResponsiveValue(chainStatus, (value) => {
|
|
5663
|
+
if (value === "icon" && !chain.iconUrl) return "block";
|
|
5664
|
+
return value === "full" || value === "name" ? "block" : "none";
|
|
5665
|
+
}),
|
|
5666
|
+
children: chain.name ?? chain.id
|
|
5667
|
+
})]
|
|
5668
|
+
}), /* @__PURE__ */ jsx(DropdownIcon, {})]
|
|
5669
|
+
}, unsupportedChain ? "unsupported" : "supported") : null;
|
|
5590
5670
|
return /* @__PURE__ */ jsx(Box, {
|
|
5591
5671
|
display: "flex",
|
|
5592
5672
|
gap: "12",
|
|
@@ -5598,59 +5678,7 @@ function ConnectButton({ accountStatus = defaultProps.accountStatus, chainStatus
|
|
|
5598
5678
|
userSelect: "none"
|
|
5599
5679
|
}
|
|
5600
5680
|
},
|
|
5601
|
-
children: ready && account && connectionStatus === "connected" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5602
|
-
alignItems: "center",
|
|
5603
|
-
"aria-label": "Chain Selector",
|
|
5604
|
-
as: "button",
|
|
5605
|
-
background: unsupportedChain ? "connectButtonBackgroundError" : "connectButtonBackground",
|
|
5606
|
-
borderRadius: "connectButton",
|
|
5607
|
-
boxShadow: "connectButton",
|
|
5608
|
-
className: touchableStyles({
|
|
5609
|
-
active: "shrink",
|
|
5610
|
-
hover: "grow"
|
|
5611
|
-
}),
|
|
5612
|
-
color: unsupportedChain ? "connectButtonTextError" : "connectButtonText",
|
|
5613
|
-
display: mapResponsiveValue(chainStatus, (value) => value === "none" ? "none" : "flex"),
|
|
5614
|
-
fontFamily: "body",
|
|
5615
|
-
fontWeight: "bold",
|
|
5616
|
-
gap: "6",
|
|
5617
|
-
onClick: openChainModal,
|
|
5618
|
-
paddingX: "10",
|
|
5619
|
-
paddingY: "8",
|
|
5620
|
-
testId: unsupportedChain ? "wrong-network-button" : "chain-button",
|
|
5621
|
-
transition: "default",
|
|
5622
|
-
type: "button",
|
|
5623
|
-
children: [unsupportedChain ? /* @__PURE__ */ jsx(Box, {
|
|
5624
|
-
alignItems: "center",
|
|
5625
|
-
display: "flex",
|
|
5626
|
-
height: "24",
|
|
5627
|
-
paddingX: "4",
|
|
5628
|
-
children: t("connect_wallet.wrong_network.label")
|
|
5629
|
-
}) : /* @__PURE__ */ jsxs(Box, {
|
|
5630
|
-
alignItems: "center",
|
|
5631
|
-
display: "flex",
|
|
5632
|
-
gap: "6",
|
|
5633
|
-
children: [chain.hasIcon ? /* @__PURE__ */ jsx(Box, {
|
|
5634
|
-
display: mapResponsiveValue(chainStatus, (value) => value === "full" || value === "icon" ? "block" : "none"),
|
|
5635
|
-
height: "24",
|
|
5636
|
-
width: "24",
|
|
5637
|
-
children: /* @__PURE__ */ jsx(AsyncImage, {
|
|
5638
|
-
alt: chain.name ?? "Chain icon",
|
|
5639
|
-
background: chain.iconBackground,
|
|
5640
|
-
borderRadius: "full",
|
|
5641
|
-
height: "24",
|
|
5642
|
-
src: chain.iconUrl,
|
|
5643
|
-
width: "24"
|
|
5644
|
-
})
|
|
5645
|
-
}) : null, /* @__PURE__ */ jsx(Box, {
|
|
5646
|
-
display: mapResponsiveValue(chainStatus, (value) => {
|
|
5647
|
-
if (value === "icon" && !chain.iconUrl) return "block";
|
|
5648
|
-
return value === "full" || value === "name" ? "block" : "none";
|
|
5649
|
-
}),
|
|
5650
|
-
children: chain.name ?? chain.id
|
|
5651
|
-
})]
|
|
5652
|
-
}), /* @__PURE__ */ jsx(DropdownIcon, {})]
|
|
5653
|
-
}, unsupportedChain ? "unsupported" : "supported"), !unsupportedChain && /* @__PURE__ */ jsxs(Box, {
|
|
5681
|
+
children: ready && account && connectionStatus === "connected" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [chainButton, !unsupportedChain && /* @__PURE__ */ jsxs(Box, {
|
|
5654
5682
|
alignItems: "center",
|
|
5655
5683
|
as: "button",
|
|
5656
5684
|
background: "connectButtonBackground",
|
|
@@ -5709,7 +5737,7 @@ function ConnectButton({ accountStatus = defaultProps.accountStatus, chainStatus
|
|
|
5709
5737
|
})]
|
|
5710
5738
|
})
|
|
5711
5739
|
})]
|
|
5712
|
-
})] }) : /* @__PURE__ */ jsx(Box, {
|
|
5740
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [chainButton, /* @__PURE__ */ jsx(Box, {
|
|
5713
5741
|
as: "button",
|
|
5714
5742
|
background: "accentColor",
|
|
5715
5743
|
borderRadius: "connectButton",
|
|
@@ -5728,7 +5756,7 @@ function ConnectButton({ accountStatus = defaultProps.accountStatus, chainStatus
|
|
|
5728
5756
|
transition: "default",
|
|
5729
5757
|
type: "button",
|
|
5730
5758
|
children: mounted && label === "Connect Wallet" ? t("connect_wallet.label") : label
|
|
5731
|
-
}, "connect")
|
|
5759
|
+
}, "connect")] })
|
|
5732
5760
|
});
|
|
5733
5761
|
} }) : null;
|
|
5734
5762
|
}
|
|
@@ -5894,4 +5922,4 @@ const WalletButton = ({ wallet }) => {
|
|
|
5894
5922
|
WalletButton.Custom = WalletButtonRenderer;
|
|
5895
5923
|
|
|
5896
5924
|
//#endregion
|
|
5897
|
-
export { createAuthenticationAdapter as S, useTransactionStore as _, useConnectModal as a, EmojiAvatar as b, ChainModal as c, dialogContentMobile as d, RainbowKitProvider as f, cssObjectFromTheme as g, cssStringFromTheme as h, useChainModal as i, AccountModal as l, baseTheme as m, ConnectButton as n, MobileOptions as o, lightTheme as p, useAccountModal as r, DesktopOptions as s, WalletButton as t, dialogContent as u, useChainId as v, RainbowKitAuthenticationProvider as x, Avatar as y };
|
|
5925
|
+
export { createAuthenticationAdapter as S, useTransactionStore as _, useConnectModal as a, EmojiAvatar as b, ChainModal as c, dialogContentMobile as d, RainbowKitProvider as f, cssObjectFromTheme as g, cssStringFromTheme as h, useChainModal as i, AccountModal as l, baseTheme as m, ConnectButton as n, MobileOptions as o, lightTheme as p, useAccountModal as r, DesktopOptions as s, WalletButton as t, dialogContent as u, useChainId$1 as v, RainbowKitAuthenticationProvider as x, Avatar as y };
|
|
@@ -146,6 +146,6 @@ interface ChainModalProps {
|
|
|
146
146
|
declare function ChainModal({
|
|
147
147
|
onClose,
|
|
148
148
|
open
|
|
149
|
-
}: ChainModalProps): React.JSX.Element
|
|
149
|
+
}: ChainModalProps): React.JSX.Element;
|
|
150
150
|
//#endregion
|
|
151
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 };
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { b as EmojiAvatar, c as ChainModal, f as RainbowKitProvider, l as AccountModal, n as ConnectButton, t as WalletButton, y as Avatar } from "../WalletButton-
|
|
2
|
+
import { b as EmojiAvatar, c as ChainModal, f as RainbowKitProvider, l as AccountModal, n as ConnectButton, t as WalletButton, y as Avatar } from "../WalletButton-CsbqNc5l.js";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Avatar/emojiAvatarForAddress.ts
|
|
5
5
|
const colors = [
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { S as createAuthenticationAdapter, _ as useTransactionStore, a as useConnectModal, d as dialogContentMobile, f as RainbowKitProvider, g as cssObjectFromTheme, h as cssStringFromTheme, i as useChainModal, m as baseTheme, n as ConnectButton, o as MobileOptions, p as lightTheme, r as useAccountModal, s as DesktopOptions, t as WalletButton, u as dialogContent, v as useChainId, x as RainbowKitAuthenticationProvider } from "./WalletButton-
|
|
2
|
+
import { S as createAuthenticationAdapter, _ as useTransactionStore, a as useConnectModal, d as dialogContentMobile, f as RainbowKitProvider, g as cssObjectFromTheme, h as cssStringFromTheme, i as useChainModal, m as baseTheme, n as ConnectButton, o as MobileOptions, p as lightTheme, r as useAccountModal, s as DesktopOptions, t as WalletButton, u as dialogContent, v as useChainId$1, x as RainbowKitAuthenticationProvider } from "./WalletButton-CsbqNc5l.js";
|
|
3
3
|
import { a as injectedWallet, i as getWalletConnectConnector, n as safeWallet, o as base, r as metaMaskWallet, t as walletConnectWallet } from "./walletConnectors-C02JPPxf.js";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
import { createConfig, http, useConnection } from "wagmi";
|
|
@@ -167,7 +167,7 @@ function getDefaultWallets(parameters) {
|
|
|
167
167
|
function useAddRecentTransaction() {
|
|
168
168
|
const store = useTransactionStore();
|
|
169
169
|
const { address } = useConnection();
|
|
170
|
-
const chainId = useChainId();
|
|
170
|
+
const chainId = useChainId$1();
|
|
171
171
|
return useCallback((transaction) => {
|
|
172
172
|
if (!address || !chainId) throw new Error("No address or chain ID found");
|
|
173
173
|
store.addTransaction(address, chainId, transaction);
|
|
@@ -30,4 +30,4 @@ declare const metaMaskWallet: ({
|
|
|
30
30
|
//#region src/wallets/walletConnectors/safeWallet/safeWallet.d.ts
|
|
31
31
|
declare const safeWallet: () => Wallet;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { base, baseAccount, injectedWallet, metaMaskWallet, safeWallet, walletConnectWallet };
|
|
33
|
+
export { BaseOptions, base, baseAccount, injectedWallet, metaMaskWallet, safeWallet, walletConnectWallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solariskit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "The best way to connect a wallet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blockchain",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@vanilla-extract/sprinkles": "1.6.5",
|
|
39
39
|
"clsx": "2.1.1",
|
|
40
40
|
"cuer": "0.0.3",
|
|
41
|
+
"qr": "0.5.5",
|
|
41
42
|
"react-remove-scroll": "2.7.2",
|
|
42
43
|
"@akshatmittal/polycons": "1.1.0"
|
|
43
44
|
},
|