@rhinestone/deposit-modal 0.4.3 → 0.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.
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  DepositModalInner
3
- } from "./chunk-ANPDY6NJ.mjs";
3
+ } from "./chunk-ZYYLKWU2.mjs";
4
4
  import "./chunk-FJWLC4AM.mjs";
5
5
  import {
6
6
  ReownWalletProvider,
7
7
  useReownWallet
8
- } from "./chunk-V72YVCR6.mjs";
9
- import "./chunk-7EQQD7B4.mjs";
8
+ } from "./chunk-LCKO6C76.mjs";
9
+ import "./chunk-PS7HJ62M.mjs";
10
10
  import "./chunk-F7P4MV72.mjs";
11
11
  import "./chunk-WJX3TJFK.mjs";
12
12
 
@@ -53,6 +53,7 @@ function DepositModalReown(props) {
53
53
  projectId: props.reownAppId,
54
54
  theme: props.theme,
55
55
  enableSolana: props.enableSolana,
56
+ rpcUrls: props.rpcUrls,
56
57
  children: /* @__PURE__ */ jsx(DepositModalWithReown, { ...props })
57
58
  }
58
59
  );
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunk36R7XKXPcjs = require('./chunk-36R7XKXP.cjs');
3
+ var _chunkMXFZ6Q7Fcjs = require('./chunk-MXFZ6Q7F.cjs');
4
4
  require('./chunk-NRNJAQUA.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkPQDHZZ2Bcjs = require('./chunk-PQDHZZ2B.cjs');
9
- require('./chunk-EDUWRMQI.cjs');
8
+ var _chunkH7727ABXcjs = require('./chunk-H7727ABX.cjs');
9
+ require('./chunk-PPFG3VBD.cjs');
10
10
  require('./chunk-UEKPBRBY.cjs');
11
11
  require('./chunk-ABVRVW3P.cjs');
12
12
 
@@ -16,7 +16,7 @@ var _react3 = require('@reown/appkit/react');
16
16
  var _react5 = require('@reown/appkit-adapter-solana/react');
17
17
  var _jsxruntime = require('react/jsx-runtime');
18
18
  function DepositModalWithReown(props) {
19
- const reown = _chunkPQDHZZ2Bcjs.useReownWallet.call(void 0, );
19
+ const reown = _chunkH7727ABXcjs.useReownWallet.call(void 0, );
20
20
  const enableSolana = _nullishCoalesce(props.enableSolana, () => ( true));
21
21
  const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0,
22
22
  enableSolana ? "solana" : "eip155"
@@ -37,7 +37,7 @@ function DepositModalWithReown(props) {
37
37
  reown.disconnect();
38
38
  }, [reown.disconnect]);
39
39
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
40
- _chunk36R7XKXPcjs.DepositModalInner,
40
+ _chunkMXFZ6Q7Fcjs.DepositModalInner,
41
41
  {
42
42
  ...props,
43
43
  reownWallet: reownWithSolana,
@@ -48,11 +48,12 @@ function DepositModalWithReown(props) {
48
48
  }
49
49
  function DepositModalReown(props) {
50
50
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
51
- _chunkPQDHZZ2Bcjs.ReownWalletProvider,
51
+ _chunkH7727ABXcjs.ReownWalletProvider,
52
52
  {
53
53
  projectId: props.reownAppId,
54
54
  theme: props.theme,
55
55
  enableSolana: props.enableSolana,
56
+ rpcUrls: props.rpcUrls,
56
57
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props })
57
58
  }
58
59
  );
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WithdrawModalInner
3
- } from "./chunk-IDJBMNV2.mjs";
3
+ } from "./chunk-V6KJKRE7.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
7
- } from "./chunk-V72YVCR6.mjs";
8
- import "./chunk-7EQQD7B4.mjs";
7
+ } from "./chunk-LCKO6C76.mjs";
8
+ import "./chunk-PS7HJ62M.mjs";
9
9
  import "./chunk-F7P4MV72.mjs";
10
10
  import "./chunk-WJX3TJFK.mjs";
11
11
 
@@ -31,7 +31,15 @@ function WithdrawModalWithReown(props) {
31
31
  );
32
32
  }
33
33
  function WithdrawModalReown(props) {
34
- return /* @__PURE__ */ jsx(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx(WithdrawModalWithReown, { ...props }) });
34
+ return /* @__PURE__ */ jsx(
35
+ ReownWalletProvider,
36
+ {
37
+ projectId: props.reownAppId,
38
+ theme: props.theme,
39
+ rpcUrls: props.rpcUrls,
40
+ children: /* @__PURE__ */ jsx(WithdrawModalWithReown, { ...props })
41
+ }
42
+ );
35
43
  }
36
44
  export {
37
45
  WithdrawModalReown
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk3NZUMDSTcjs = require('./chunk-3NZUMDST.cjs');
3
+ var _chunkXQH2APMOcjs = require('./chunk-XQH2APMO.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunkPQDHZZ2Bcjs = require('./chunk-PQDHZZ2B.cjs');
8
- require('./chunk-EDUWRMQI.cjs');
7
+ var _chunkH7727ABXcjs = require('./chunk-H7727ABX.cjs');
8
+ require('./chunk-PPFG3VBD.cjs');
9
9
  require('./chunk-UEKPBRBY.cjs');
10
10
  require('./chunk-ABVRVW3P.cjs');
11
11
 
@@ -13,7 +13,7 @@ require('./chunk-ABVRVW3P.cjs');
13
13
  var _react = require('react');
14
14
  var _jsxruntime = require('react/jsx-runtime');
15
15
  function WithdrawModalWithReown(props) {
16
- const reown = _chunkPQDHZZ2Bcjs.useReownWallet.call(void 0, );
16
+ const reown = _chunkH7727ABXcjs.useReownWallet.call(void 0, );
17
17
  const handleConnect = _react.useCallback.call(void 0, () => {
18
18
  reown.openConnect();
19
19
  }, [reown.openConnect]);
@@ -21,7 +21,7 @@ function WithdrawModalWithReown(props) {
21
21
  reown.disconnect();
22
22
  }, [reown.disconnect]);
23
23
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
24
- _chunk3NZUMDSTcjs.WithdrawModalInner,
24
+ _chunkXQH2APMOcjs.WithdrawModalInner,
25
25
  {
26
26
  ...props,
27
27
  reownWallet: reown,
@@ -31,7 +31,15 @@ function WithdrawModalWithReown(props) {
31
31
  );
32
32
  }
33
33
  function WithdrawModalReown(props) {
34
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkPQDHZZ2Bcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
34
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
35
+ _chunkH7727ABXcjs.ReownWalletProvider,
36
+ {
37
+ projectId: props.reownAppId,
38
+ theme: props.theme,
39
+ rpcUrls: props.rpcUrls,
40
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props })
41
+ }
42
+ );
35
43
  }
36
44
 
37
45
 
@@ -1,6 +1,7 @@
1
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; }
2
2
 
3
- var _chunkEDUWRMQIcjs = require('./chunk-EDUWRMQI.cjs');
3
+
4
+ var _chunkPPFG3VBDcjs = require('./chunk-PPFG3VBD.cjs');
4
5
 
5
6
 
6
7
 
@@ -23,6 +24,7 @@ var _wagmi = require('wagmi');
23
24
  var _react3 = require('@reown/appkit/react');
24
25
  var _networks = require('@reown/appkit/networks');
25
26
 
27
+ var _viem = require('viem');
26
28
 
27
29
  // src/core/reown-networks.ts
28
30
 
@@ -70,6 +72,20 @@ function getAppKitNetwork(chainId) {
70
72
 
71
73
  // src/core/reown.tsx
72
74
  var _jsxruntime = require('react/jsx-runtime');
75
+ function buildTransports(rpcUrls) {
76
+ const transports = {};
77
+ for (const network of EVM_NETWORKS) {
78
+ const id = Number(network.id);
79
+ transports[id] = _viem.http.call(void 0, _chunkPPFG3VBDcjs.rpcUrlFor.call(void 0, rpcUrls, id));
80
+ }
81
+ return transports;
82
+ }
83
+ function getEvmRpcFingerprint(rpcUrls) {
84
+ return EVM_NETWORKS.map((network) => {
85
+ const id = Number(network.id);
86
+ return `${id}=${_nullishCoalesce(_chunkPPFG3VBDcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
87
+ }).join("|");
88
+ }
73
89
  var cachedAdapter = null;
74
90
  var cachedAdapterKey = null;
75
91
  function mapTheme(theme) {
@@ -80,12 +96,17 @@ function mapTheme(theme) {
80
96
  }
81
97
  return { themeMode, themeVariables };
82
98
  }
83
- function getOrCreateAdapter(projectId, enableSolana, theme) {
84
- const adapterKey = `${projectId}:${enableSolana ? "solana" : "evm"}`;
99
+ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls) {
100
+ const adapterKey = [
101
+ projectId,
102
+ enableSolana ? "solana" : "evm",
103
+ getEvmRpcFingerprint(rpcUrls)
104
+ ].join(":");
85
105
  if (cachedAdapter && cachedAdapterKey === adapterKey) return cachedAdapter;
86
106
  cachedAdapter = new (0, _appkitadapterwagmi.WagmiAdapter)({
87
107
  networks: EVM_NETWORKS,
88
- projectId
108
+ projectId,
109
+ transports: buildTransports(rpcUrls)
89
110
  });
90
111
  cachedAdapterKey = adapterKey;
91
112
  const { themeMode, themeVariables } = mapTheme(theme);
@@ -110,10 +131,11 @@ function ReownWalletProvider({
110
131
  projectId,
111
132
  theme,
112
133
  enableSolana = true,
134
+ rpcUrls,
113
135
  children
114
136
  }) {
115
137
  const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
116
- const adapter = getOrCreateAdapter(projectId, enableSolana, theme);
138
+ const adapter = getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls);
117
139
  const config = adapter.wagmiConfig;
118
140
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
119
141
  }
@@ -155,7 +177,7 @@ function useReownWallet() {
155
177
  await switchChainAsync({ chainId });
156
178
  }
157
179
  } catch (err) {
158
- if (_chunkEDUWRMQIcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
180
+ if (_chunkPPFG3VBDcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
159
181
  throw new Error(
160
182
  `Switch to ${_chunkABVRVW3Pcjs.getChainName.call(void 0, chainId)} in your wallet to continue`
161
183
  );
@@ -1,6 +1,7 @@
1
1
  import {
2
- isUnsupportedChainSwitchError
3
- } from "./chunk-7EQQD7B4.mjs";
2
+ isUnsupportedChainSwitchError,
3
+ rpcUrlFor
4
+ } from "./chunk-PS7HJ62M.mjs";
4
5
  import {
5
6
  SUPPORTED_CHAINS,
6
7
  getChainName
@@ -23,6 +24,7 @@ import {
23
24
  } from "@reown/appkit/react";
24
25
  import { solana } from "@reown/appkit/networks";
25
26
  import { useWalletClient, usePublicClient, useSwitchChain } from "wagmi";
27
+ import { http } from "viem";
26
28
 
27
29
  // src/core/reown-networks.ts
28
30
  import {
@@ -70,6 +72,20 @@ function getAppKitNetwork(chainId) {
70
72
 
71
73
  // src/core/reown.tsx
72
74
  import { jsx } from "react/jsx-runtime";
75
+ function buildTransports(rpcUrls) {
76
+ const transports = {};
77
+ for (const network of EVM_NETWORKS) {
78
+ const id = Number(network.id);
79
+ transports[id] = http(rpcUrlFor(rpcUrls, id));
80
+ }
81
+ return transports;
82
+ }
83
+ function getEvmRpcFingerprint(rpcUrls) {
84
+ return EVM_NETWORKS.map((network) => {
85
+ const id = Number(network.id);
86
+ return `${id}=${rpcUrlFor(rpcUrls, id) ?? ""}`;
87
+ }).join("|");
88
+ }
73
89
  var cachedAdapter = null;
74
90
  var cachedAdapterKey = null;
75
91
  function mapTheme(theme) {
@@ -80,12 +96,17 @@ function mapTheme(theme) {
80
96
  }
81
97
  return { themeMode, themeVariables };
82
98
  }
83
- function getOrCreateAdapter(projectId, enableSolana, theme) {
84
- const adapterKey = `${projectId}:${enableSolana ? "solana" : "evm"}`;
99
+ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls) {
100
+ const adapterKey = [
101
+ projectId,
102
+ enableSolana ? "solana" : "evm",
103
+ getEvmRpcFingerprint(rpcUrls)
104
+ ].join(":");
85
105
  if (cachedAdapter && cachedAdapterKey === adapterKey) return cachedAdapter;
86
106
  cachedAdapter = new WagmiAdapter({
87
107
  networks: EVM_NETWORKS,
88
- projectId
108
+ projectId,
109
+ transports: buildTransports(rpcUrls)
89
110
  });
90
111
  cachedAdapterKey = adapterKey;
91
112
  const { themeMode, themeVariables } = mapTheme(theme);
@@ -110,10 +131,11 @@ function ReownWalletProvider({
110
131
  projectId,
111
132
  theme,
112
133
  enableSolana = true,
134
+ rpcUrls,
113
135
  children
114
136
  }) {
115
137
  const [queryClient] = useState(() => new QueryClient());
116
- const adapter = getOrCreateAdapter(projectId, enableSolana, theme);
138
+ const adapter = getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls);
117
139
  const config = adapter.wagmiConfig;
118
140
  return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
119
141
  }