@rhinestone/deposit-modal 0.1.22 → 0.1.24

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.
@@ -1,33 +0,0 @@
1
- import {
2
- WithdrawModalInner
3
- } from "./chunk-J7UK4L5T.mjs";
4
- import {
5
- ReownWalletProvider,
6
- useReownWallet
7
- } from "./chunk-LBEP3A2Z.mjs";
8
- import "./chunk-JBT2ZV3Q.mjs";
9
- import "./chunk-A6QLADED.mjs";
10
-
11
- // src/WithdrawModalReown.tsx
12
- import { useCallback } from "react";
13
- import { jsx } from "react/jsx-runtime";
14
- function WithdrawModalWithReown(props) {
15
- const reown = useReownWallet();
16
- const handleConnect = useCallback(() => {
17
- reown.openConnect();
18
- }, [reown.openConnect]);
19
- return /* @__PURE__ */ jsx(
20
- WithdrawModalInner,
21
- {
22
- ...props,
23
- reownWallet: reown,
24
- onConnect: handleConnect
25
- }
26
- );
27
- }
28
- function WithdrawModalReown(props) {
29
- return /* @__PURE__ */ jsx(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx(WithdrawModalWithReown, { ...props }) });
30
- }
31
- export {
32
- WithdrawModalReown
33
- };
@@ -1,33 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkV6HZJZOLcjs = require('./chunk-V6HZJZOL.cjs');
4
-
5
-
6
-
7
- var _chunk6VJ2ZTNQcjs = require('./chunk-6VJ2ZTNQ.cjs');
8
- require('./chunk-BO745KAB.cjs');
9
- require('./chunk-CEIWN53N.cjs');
10
-
11
- // src/WithdrawModalReown.tsx
12
- var _react = require('react');
13
- var _jsxruntime = require('react/jsx-runtime');
14
- function WithdrawModalWithReown(props) {
15
- const reown = _chunk6VJ2ZTNQcjs.useReownWallet.call(void 0, );
16
- const handleConnect = _react.useCallback.call(void 0, () => {
17
- reown.openConnect();
18
- }, [reown.openConnect]);
19
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
20
- _chunkV6HZJZOLcjs.WithdrawModalInner,
21
- {
22
- ...props,
23
- reownWallet: reown,
24
- onConnect: handleConnect
25
- }
26
- );
27
- }
28
- function WithdrawModalReown(props) {
29
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6VJ2ZTNQcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
30
- }
31
-
32
-
33
- exports.WithdrawModalReown = WithdrawModalReown;
@@ -1,90 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/reown.tsx
2
- var _react = require('react');
3
- var _reactquery = require('@tanstack/react-query');
4
- var _appkitadapterwagmi = require('@reown/appkit-adapter-wagmi');
5
- var _wagmi = require('wagmi');
6
- var _react3 = require('@reown/appkit/react');
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
- var _networks = require('@reown/appkit/networks');
15
-
16
- var _jsxruntime = require('react/jsx-runtime');
17
- var NETWORKS = [
18
- _networks.mainnet,
19
- _networks.base,
20
- _networks.arbitrum,
21
- _networks.optimism,
22
- _networks.polygon,
23
- _networks.bsc
24
- ];
25
- var cachedAdapter = null;
26
- var cachedProjectId = null;
27
- function mapTheme(theme) {
28
- const themeMode = _optionalChain([theme, 'optionalAccess', _ => _.mode]) === "light" ? "light" : "dark";
29
- const themeVariables = {};
30
- if (_optionalChain([theme, 'optionalAccess', _2 => _2.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 (0, _appkitadapterwagmi.WagmiAdapter)({
38
- networks: NETWORKS,
39
- projectId
40
- });
41
- cachedProjectId = projectId;
42
- const { themeMode, themeVariables } = mapTheme(theme);
43
- _react3.createAppKit.call(void 0, {
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] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
63
- const adapter = getOrCreateAdapter(projectId, theme);
64
- const config = adapter.wagmiConfig;
65
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
66
- }
67
- function useReownWallet() {
68
- const { open } = _react3.useAppKit.call(void 0, );
69
- const { address, isConnected } = _react3.useAppKitAccount.call(void 0, );
70
- const { data: walletClient } = _wagmi.useWalletClient.call(void 0, );
71
- const publicClient = _wagmi.usePublicClient.call(void 0, );
72
- const { switchChainAsync } = _wagmi.useSwitchChain.call(void 0, );
73
- return {
74
- walletClient: _nullishCoalesce(walletClient, () => ( void 0)),
75
- publicClient: _nullishCoalesce(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
-
88
-
89
-
90
- exports.ReownWalletProvider = ReownWalletProvider; exports.useReownWallet = useReownWallet;
@@ -1,90 +0,0 @@
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
- };