@rhinestone/deposit-modal 0.1.20 → 0.1.22
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 +92 -67
- package/dist/DepositModalReown-324WTBDE.cjs +33 -0
- package/dist/DepositModalReown-YTWIR7A4.mjs +33 -0
- package/dist/WithdrawModalReown-ICP3DH6Q.mjs +33 -0
- package/dist/WithdrawModalReown-ZNTE2G6W.cjs +33 -0
- package/dist/chunk-6VJ2ZTNQ.cjs +90 -0
- package/dist/chunk-A6QLADED.mjs +304 -0
- package/dist/chunk-BO745KAB.cjs +1648 -0
- package/dist/chunk-CEIWN53N.cjs +304 -0
- package/dist/chunk-J7UK4L5T.mjs +1524 -0
- package/dist/chunk-JBT2ZV3Q.mjs +1648 -0
- package/dist/chunk-LBEP3A2Z.mjs +90 -0
- package/dist/chunk-N2LJOFT2.mjs +2346 -0
- package/dist/chunk-V6HZJZOL.cjs +1524 -0
- package/dist/chunk-W7ZYJB2X.cjs +2346 -0
- package/dist/constants.cjs +58 -0
- package/dist/constants.d.cts +41 -0
- package/dist/constants.d.ts +41 -0
- package/dist/constants.mjs +58 -0
- package/dist/deposit.cjs +8 -0
- package/dist/deposit.d.cts +12 -0
- package/dist/deposit.d.ts +12 -0
- package/dist/deposit.mjs +8 -0
- package/dist/index.cjs +36 -5953
- package/dist/index.d.cts +8 -220
- package/dist/index.d.ts +8 -220
- package/dist/index.mjs +33 -5923
- package/dist/safe.cjs +1 -0
- package/dist/safe.d.cts +62 -0
- package/dist/safe.d.ts +62 -0
- package/dist/safe.mjs +0 -0
- package/dist/types-D_xeOU8G.d.cts +144 -0
- package/dist/types-DnGF9RJJ.d.ts +144 -0
- package/dist/withdraw.cjs +8 -0
- package/dist/withdraw.d.cts +12 -0
- package/dist/withdraw.d.ts +12 -0
- package/dist/withdraw.mjs +8 -0
- package/package.json +26 -5
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/core/reown.tsx
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
|
|
5
|
+
import { WagmiProvider } from "wagmi";
|
|
6
|
+
import { createAppKit, useAppKit, useAppKitAccount } from "@reown/appkit/react";
|
|
7
|
+
import {
|
|
8
|
+
mainnet,
|
|
9
|
+
base,
|
|
10
|
+
arbitrum,
|
|
11
|
+
optimism,
|
|
12
|
+
polygon,
|
|
13
|
+
bsc
|
|
14
|
+
} from "@reown/appkit/networks";
|
|
15
|
+
import { useWalletClient, usePublicClient, useSwitchChain } from "wagmi";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
var NETWORKS = [
|
|
18
|
+
mainnet,
|
|
19
|
+
base,
|
|
20
|
+
arbitrum,
|
|
21
|
+
optimism,
|
|
22
|
+
polygon,
|
|
23
|
+
bsc
|
|
24
|
+
];
|
|
25
|
+
var cachedAdapter = null;
|
|
26
|
+
var cachedProjectId = null;
|
|
27
|
+
function mapTheme(theme) {
|
|
28
|
+
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
29
|
+
const themeVariables = {};
|
|
30
|
+
if (theme?.ctaColor) {
|
|
31
|
+
themeVariables["--apkt-accent"] = theme.ctaColor;
|
|
32
|
+
}
|
|
33
|
+
return { themeMode, themeVariables };
|
|
34
|
+
}
|
|
35
|
+
function getOrCreateAdapter(projectId, theme) {
|
|
36
|
+
if (cachedAdapter && cachedProjectId === projectId) return cachedAdapter;
|
|
37
|
+
cachedAdapter = new WagmiAdapter({
|
|
38
|
+
networks: NETWORKS,
|
|
39
|
+
projectId
|
|
40
|
+
});
|
|
41
|
+
cachedProjectId = projectId;
|
|
42
|
+
const { themeMode, themeVariables } = mapTheme(theme);
|
|
43
|
+
createAppKit({
|
|
44
|
+
adapters: [cachedAdapter],
|
|
45
|
+
networks: NETWORKS,
|
|
46
|
+
projectId,
|
|
47
|
+
themeMode,
|
|
48
|
+
themeVariables,
|
|
49
|
+
features: {
|
|
50
|
+
connectMethodsOrder: ["wallet"],
|
|
51
|
+
email: false,
|
|
52
|
+
socials: false
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return cachedAdapter;
|
|
56
|
+
}
|
|
57
|
+
function ReownWalletProvider({
|
|
58
|
+
projectId,
|
|
59
|
+
theme,
|
|
60
|
+
children
|
|
61
|
+
}) {
|
|
62
|
+
const [queryClient] = useState(() => new QueryClient());
|
|
63
|
+
const adapter = getOrCreateAdapter(projectId, theme);
|
|
64
|
+
const config = adapter.wagmiConfig;
|
|
65
|
+
return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
66
|
+
}
|
|
67
|
+
function useReownWallet() {
|
|
68
|
+
const { open } = useAppKit();
|
|
69
|
+
const { address, isConnected } = useAppKitAccount();
|
|
70
|
+
const { data: walletClient } = useWalletClient();
|
|
71
|
+
const publicClient = usePublicClient();
|
|
72
|
+
const { switchChainAsync } = useSwitchChain();
|
|
73
|
+
return {
|
|
74
|
+
walletClient: walletClient ?? void 0,
|
|
75
|
+
publicClient: publicClient ?? void 0,
|
|
76
|
+
address,
|
|
77
|
+
isConnected,
|
|
78
|
+
openConnect: () => {
|
|
79
|
+
void open({ view: isConnected ? "Account" : "Connect" });
|
|
80
|
+
},
|
|
81
|
+
switchChain: async (chainId) => {
|
|
82
|
+
await switchChainAsync({ chainId });
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
ReownWalletProvider,
|
|
89
|
+
useReownWallet
|
|
90
|
+
};
|