@rhinestone/deposit-modal 0.1.23 → 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.
- package/README.md +5 -1
- package/dist/{chunk-J7UK4L5T.mjs → chunk-35DWLO33.mjs} +36 -41
- package/dist/{chunk-W7ZYJB2X.cjs → chunk-A2PDOYYE.cjs} +81 -89
- package/dist/{chunk-BO745KAB.cjs → chunk-ANQQMGNN.cjs} +116 -197
- package/dist/{chunk-V6HZJZOL.cjs → chunk-O3I5KVXA.cjs} +72 -77
- package/dist/{chunk-JBT2ZV3Q.mjs → chunk-P7SQQAAF.mjs} +89 -170
- package/dist/{chunk-N2LJOFT2.mjs → chunk-ZMVCDFXM.mjs} +40 -48
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +197 -0
- package/dist/reown.d.cts +14 -0
- package/dist/reown.d.ts +14 -0
- package/dist/reown.mjs +197 -0
- package/dist/{types-D_xeOU8G.d.cts → types-CUww05xT.d.cts} +14 -1
- package/dist/{types-DnGF9RJJ.d.ts → types-Z6GjVWFR.d.ts} +14 -1
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +33 -11
- package/dist/DepositModalReown-324WTBDE.cjs +0 -33
- package/dist/DepositModalReown-YTWIR7A4.mjs +0 -33
- package/dist/WithdrawModalReown-ICP3DH6Q.mjs +0 -33
- package/dist/WithdrawModalReown-ZNTE2G6W.cjs +0 -33
- package/dist/chunk-6VJ2ZTNQ.cjs +0 -90
- package/dist/chunk-LBEP3A2Z.mjs +0 -90
package/dist/reown.cjs
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
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
|
+
|
|
3
|
+
var _chunkA2PDOYYEcjs = require('./chunk-A2PDOYYE.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkO3I5KVXAcjs = require('./chunk-O3I5KVXA.cjs');
|
|
7
|
+
require('./chunk-ANQQMGNN.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
|
|
37
|
+
|
|
38
|
+
// src/DepositModalReown.tsx
|
|
39
|
+
var _react = require('react');
|
|
40
|
+
|
|
41
|
+
// src/core/reown.tsx
|
|
42
|
+
|
|
43
|
+
var _reactquery = require('@tanstack/react-query');
|
|
44
|
+
var _appkitadapterwagmi = require('@reown/appkit-adapter-wagmi');
|
|
45
|
+
var _wagmi = require('wagmi');
|
|
46
|
+
var _react3 = require('@reown/appkit/react');
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var _networks = require('@reown/appkit/networks');
|
|
55
|
+
|
|
56
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
57
|
+
var NETWORKS = [
|
|
58
|
+
_networks.mainnet,
|
|
59
|
+
_networks.base,
|
|
60
|
+
_networks.arbitrum,
|
|
61
|
+
_networks.optimism,
|
|
62
|
+
_networks.polygon,
|
|
63
|
+
_networks.bsc
|
|
64
|
+
];
|
|
65
|
+
var cachedAdapter = null;
|
|
66
|
+
var cachedProjectId = null;
|
|
67
|
+
function mapTheme(theme) {
|
|
68
|
+
const themeMode = _optionalChain([theme, 'optionalAccess', _ => _.mode]) === "light" ? "light" : "dark";
|
|
69
|
+
const themeVariables = {};
|
|
70
|
+
if (_optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])) {
|
|
71
|
+
themeVariables["--apkt-accent"] = theme.ctaColor;
|
|
72
|
+
}
|
|
73
|
+
return { themeMode, themeVariables };
|
|
74
|
+
}
|
|
75
|
+
function getOrCreateAdapter(projectId, theme) {
|
|
76
|
+
if (cachedAdapter && cachedProjectId === projectId) return cachedAdapter;
|
|
77
|
+
cachedAdapter = new (0, _appkitadapterwagmi.WagmiAdapter)({
|
|
78
|
+
networks: NETWORKS,
|
|
79
|
+
projectId
|
|
80
|
+
});
|
|
81
|
+
cachedProjectId = projectId;
|
|
82
|
+
const { themeMode, themeVariables } = mapTheme(theme);
|
|
83
|
+
_react3.createAppKit.call(void 0, {
|
|
84
|
+
adapters: [cachedAdapter],
|
|
85
|
+
networks: NETWORKS,
|
|
86
|
+
projectId,
|
|
87
|
+
themeMode,
|
|
88
|
+
themeVariables,
|
|
89
|
+
features: {
|
|
90
|
+
connectMethodsOrder: ["wallet"],
|
|
91
|
+
email: false,
|
|
92
|
+
socials: false
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return cachedAdapter;
|
|
96
|
+
}
|
|
97
|
+
function ReownWalletProvider({
|
|
98
|
+
projectId,
|
|
99
|
+
theme,
|
|
100
|
+
children
|
|
101
|
+
}) {
|
|
102
|
+
const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
|
|
103
|
+
const adapter = getOrCreateAdapter(projectId, theme);
|
|
104
|
+
const config = adapter.wagmiConfig;
|
|
105
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
|
|
106
|
+
}
|
|
107
|
+
function useReownWallet() {
|
|
108
|
+
const { open } = _react3.useAppKit.call(void 0, );
|
|
109
|
+
const { address, isConnected } = _react3.useAppKitAccount.call(void 0, );
|
|
110
|
+
const { data: walletClient } = _wagmi.useWalletClient.call(void 0, );
|
|
111
|
+
const publicClient = _wagmi.usePublicClient.call(void 0, );
|
|
112
|
+
const { switchChainAsync } = _wagmi.useSwitchChain.call(void 0, );
|
|
113
|
+
return {
|
|
114
|
+
walletClient: _nullishCoalesce(walletClient, () => ( void 0)),
|
|
115
|
+
publicClient: _nullishCoalesce(publicClient, () => ( void 0)),
|
|
116
|
+
address,
|
|
117
|
+
isConnected,
|
|
118
|
+
openConnect: () => {
|
|
119
|
+
void open({ view: isConnected ? "Account" : "Connect" });
|
|
120
|
+
},
|
|
121
|
+
switchChain: async (chainId) => {
|
|
122
|
+
await switchChainAsync({ chainId });
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/DepositModalReown.tsx
|
|
128
|
+
|
|
129
|
+
function DepositModalWithReown(props) {
|
|
130
|
+
const reown = useReownWallet();
|
|
131
|
+
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
132
|
+
reown.openConnect();
|
|
133
|
+
}, [reown.openConnect]);
|
|
134
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
135
|
+
_chunkA2PDOYYEcjs.DepositModalInner,
|
|
136
|
+
{
|
|
137
|
+
...props,
|
|
138
|
+
reownWallet: reown,
|
|
139
|
+
onConnect: handleConnect
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function DepositModalReown(props) {
|
|
144
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props }) });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/WithdrawModalReown.tsx
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
function WithdrawModalWithReown(props) {
|
|
151
|
+
const reown = useReownWallet();
|
|
152
|
+
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
153
|
+
reown.openConnect();
|
|
154
|
+
}, [reown.openConnect]);
|
|
155
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
156
|
+
_chunkO3I5KVXAcjs.WithdrawModalInner,
|
|
157
|
+
{
|
|
158
|
+
...props,
|
|
159
|
+
reownWallet: reown,
|
|
160
|
+
onConnect: handleConnect
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function WithdrawModalReown(props) {
|
|
165
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
exports.CHAIN_BY_ID = _chunkCEIWN53Ncjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkCEIWN53Ncjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = DepositModalReown; exports.NATIVE_TOKEN_ADDRESS = _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkCEIWN53Ncjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkCEIWN53Ncjs.SUPPORTED_CHAINS; exports.WithdrawModal = WithdrawModalReown; exports.chainRegistry = _chunkCEIWN53Ncjs.chainRegistry; exports.findChainIdForToken = _chunkCEIWN53Ncjs.findChainIdForToken; exports.getChainBadge = _chunkCEIWN53Ncjs.getChainBadge; exports.getChainIcon = _chunkCEIWN53Ncjs.getChainIcon; exports.getChainId = _chunkCEIWN53Ncjs.getChainId; exports.getChainName = _chunkCEIWN53Ncjs.getChainName; exports.getChainObject = _chunkCEIWN53Ncjs.getChainObject; exports.getExplorerName = _chunkCEIWN53Ncjs.getExplorerName; exports.getExplorerTxUrl = _chunkCEIWN53Ncjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkCEIWN53Ncjs.getExplorerUrl; exports.getSupportedChainIds = _chunkCEIWN53Ncjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkCEIWN53Ncjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkCEIWN53Ncjs.getSupportedTokenSymbolsForChain; exports.getTokenAddress = _chunkCEIWN53Ncjs.getTokenAddress; exports.getTokenDecimals = _chunkCEIWN53Ncjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkCEIWN53Ncjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkCEIWN53Ncjs.getTokenIcon; exports.getTokenSymbol = _chunkCEIWN53Ncjs.getTokenSymbol; exports.getUsdcAddress = _chunkCEIWN53Ncjs.getUsdcAddress; exports.getUsdcDecimals = _chunkCEIWN53Ncjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkCEIWN53Ncjs.isSupportedTokenAddressForChain;
|
package/dist/reown.d.cts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { c as DepositModalProps, i as WithdrawModalProps } from './types-CUww05xT.cjs';
|
|
3
|
+
export { A as AssetOption, C as ConnectedEventData, D as DepositCompleteEventData, a as DepositFailedEventData, b as DepositModalBranding, d as DepositModalTheme, e as DepositModalUIConfig, f as DepositSubmittedEventData, E as ErrorEventData, R as ReownWallet, W as WalletOption, g as WithdrawCompleteEventData, h as WithdrawFailedEventData, j as WithdrawSubmittedEventData } from './types-CUww05xT.cjs';
|
|
4
|
+
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain } from './constants.cjs';
|
|
5
|
+
export { SafeTransactionRequest } from './safe.cjs';
|
|
6
|
+
export { chainRegistry } from '@rhinestone/shared-configs';
|
|
7
|
+
import 'viem';
|
|
8
|
+
import 'viem/chains';
|
|
9
|
+
|
|
10
|
+
declare function DepositModalReown(props: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
declare function WithdrawModalReown(props: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { DepositModalReown as DepositModal, DepositModalProps, WithdrawModalReown as WithdrawModal, WithdrawModalProps };
|
package/dist/reown.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { c as DepositModalProps, i as WithdrawModalProps } from './types-Z6GjVWFR.js';
|
|
3
|
+
export { A as AssetOption, C as ConnectedEventData, D as DepositCompleteEventData, a as DepositFailedEventData, b as DepositModalBranding, d as DepositModalTheme, e as DepositModalUIConfig, f as DepositSubmittedEventData, E as ErrorEventData, R as ReownWallet, W as WalletOption, g as WithdrawCompleteEventData, h as WithdrawFailedEventData, j as WithdrawSubmittedEventData } from './types-Z6GjVWFR.js';
|
|
4
|
+
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain } from './constants.js';
|
|
5
|
+
export { SafeTransactionRequest } from './safe.js';
|
|
6
|
+
export { chainRegistry } from '@rhinestone/shared-configs';
|
|
7
|
+
import 'viem';
|
|
8
|
+
import 'viem/chains';
|
|
9
|
+
|
|
10
|
+
declare function DepositModalReown(props: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
declare function WithdrawModalReown(props: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { DepositModalReown as DepositModal, DepositModalProps, WithdrawModalReown as WithdrawModal, WithdrawModalProps };
|
package/dist/reown.mjs
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DepositModalInner
|
|
3
|
+
} from "./chunk-ZMVCDFXM.mjs";
|
|
4
|
+
import {
|
|
5
|
+
WithdrawModalInner
|
|
6
|
+
} from "./chunk-35DWLO33.mjs";
|
|
7
|
+
import "./chunk-P7SQQAAF.mjs";
|
|
8
|
+
import {
|
|
9
|
+
CHAIN_BY_ID,
|
|
10
|
+
DEFAULT_BACKEND_URL,
|
|
11
|
+
DEFAULT_SIGNER_ADDRESS,
|
|
12
|
+
NATIVE_TOKEN_ADDRESS,
|
|
13
|
+
SOURCE_CHAINS,
|
|
14
|
+
SUPPORTED_CHAINS,
|
|
15
|
+
chainRegistry,
|
|
16
|
+
findChainIdForToken,
|
|
17
|
+
getChainBadge,
|
|
18
|
+
getChainIcon,
|
|
19
|
+
getChainId,
|
|
20
|
+
getChainName,
|
|
21
|
+
getChainObject,
|
|
22
|
+
getExplorerName,
|
|
23
|
+
getExplorerTxUrl,
|
|
24
|
+
getExplorerUrl,
|
|
25
|
+
getSupportedChainIds,
|
|
26
|
+
getSupportedTargetTokens,
|
|
27
|
+
getSupportedTokenSymbolsForChain,
|
|
28
|
+
getTokenAddress,
|
|
29
|
+
getTokenDecimals,
|
|
30
|
+
getTokenDecimalsByAddress,
|
|
31
|
+
getTokenIcon,
|
|
32
|
+
getTokenSymbol,
|
|
33
|
+
getUsdcAddress,
|
|
34
|
+
getUsdcDecimals,
|
|
35
|
+
isSupportedTokenAddressForChain
|
|
36
|
+
} from "./chunk-A6QLADED.mjs";
|
|
37
|
+
|
|
38
|
+
// src/DepositModalReown.tsx
|
|
39
|
+
import { useCallback } from "react";
|
|
40
|
+
|
|
41
|
+
// src/core/reown.tsx
|
|
42
|
+
import { useState } from "react";
|
|
43
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
44
|
+
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
|
|
45
|
+
import { WagmiProvider } from "wagmi";
|
|
46
|
+
import { createAppKit, useAppKit, useAppKitAccount } from "@reown/appkit/react";
|
|
47
|
+
import {
|
|
48
|
+
mainnet,
|
|
49
|
+
base,
|
|
50
|
+
arbitrum,
|
|
51
|
+
optimism,
|
|
52
|
+
polygon,
|
|
53
|
+
bsc
|
|
54
|
+
} from "@reown/appkit/networks";
|
|
55
|
+
import { useWalletClient, usePublicClient, useSwitchChain } from "wagmi";
|
|
56
|
+
import { jsx } from "react/jsx-runtime";
|
|
57
|
+
var NETWORKS = [
|
|
58
|
+
mainnet,
|
|
59
|
+
base,
|
|
60
|
+
arbitrum,
|
|
61
|
+
optimism,
|
|
62
|
+
polygon,
|
|
63
|
+
bsc
|
|
64
|
+
];
|
|
65
|
+
var cachedAdapter = null;
|
|
66
|
+
var cachedProjectId = null;
|
|
67
|
+
function mapTheme(theme) {
|
|
68
|
+
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
69
|
+
const themeVariables = {};
|
|
70
|
+
if (theme?.ctaColor) {
|
|
71
|
+
themeVariables["--apkt-accent"] = theme.ctaColor;
|
|
72
|
+
}
|
|
73
|
+
return { themeMode, themeVariables };
|
|
74
|
+
}
|
|
75
|
+
function getOrCreateAdapter(projectId, theme) {
|
|
76
|
+
if (cachedAdapter && cachedProjectId === projectId) return cachedAdapter;
|
|
77
|
+
cachedAdapter = new WagmiAdapter({
|
|
78
|
+
networks: NETWORKS,
|
|
79
|
+
projectId
|
|
80
|
+
});
|
|
81
|
+
cachedProjectId = projectId;
|
|
82
|
+
const { themeMode, themeVariables } = mapTheme(theme);
|
|
83
|
+
createAppKit({
|
|
84
|
+
adapters: [cachedAdapter],
|
|
85
|
+
networks: NETWORKS,
|
|
86
|
+
projectId,
|
|
87
|
+
themeMode,
|
|
88
|
+
themeVariables,
|
|
89
|
+
features: {
|
|
90
|
+
connectMethodsOrder: ["wallet"],
|
|
91
|
+
email: false,
|
|
92
|
+
socials: false
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return cachedAdapter;
|
|
96
|
+
}
|
|
97
|
+
function ReownWalletProvider({
|
|
98
|
+
projectId,
|
|
99
|
+
theme,
|
|
100
|
+
children
|
|
101
|
+
}) {
|
|
102
|
+
const [queryClient] = useState(() => new QueryClient());
|
|
103
|
+
const adapter = getOrCreateAdapter(projectId, theme);
|
|
104
|
+
const config = adapter.wagmiConfig;
|
|
105
|
+
return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
106
|
+
}
|
|
107
|
+
function useReownWallet() {
|
|
108
|
+
const { open } = useAppKit();
|
|
109
|
+
const { address, isConnected } = useAppKitAccount();
|
|
110
|
+
const { data: walletClient } = useWalletClient();
|
|
111
|
+
const publicClient = usePublicClient();
|
|
112
|
+
const { switchChainAsync } = useSwitchChain();
|
|
113
|
+
return {
|
|
114
|
+
walletClient: walletClient ?? void 0,
|
|
115
|
+
publicClient: publicClient ?? void 0,
|
|
116
|
+
address,
|
|
117
|
+
isConnected,
|
|
118
|
+
openConnect: () => {
|
|
119
|
+
void open({ view: isConnected ? "Account" : "Connect" });
|
|
120
|
+
},
|
|
121
|
+
switchChain: async (chainId) => {
|
|
122
|
+
await switchChainAsync({ chainId });
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/DepositModalReown.tsx
|
|
128
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
129
|
+
function DepositModalWithReown(props) {
|
|
130
|
+
const reown = useReownWallet();
|
|
131
|
+
const handleConnect = useCallback(() => {
|
|
132
|
+
reown.openConnect();
|
|
133
|
+
}, [reown.openConnect]);
|
|
134
|
+
return /* @__PURE__ */ jsx2(
|
|
135
|
+
DepositModalInner,
|
|
136
|
+
{
|
|
137
|
+
...props,
|
|
138
|
+
reownWallet: reown,
|
|
139
|
+
onConnect: handleConnect
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function DepositModalReown(props) {
|
|
144
|
+
return /* @__PURE__ */ jsx2(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx2(DepositModalWithReown, { ...props }) });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/WithdrawModalReown.tsx
|
|
148
|
+
import { useCallback as useCallback2 } from "react";
|
|
149
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
150
|
+
function WithdrawModalWithReown(props) {
|
|
151
|
+
const reown = useReownWallet();
|
|
152
|
+
const handleConnect = useCallback2(() => {
|
|
153
|
+
reown.openConnect();
|
|
154
|
+
}, [reown.openConnect]);
|
|
155
|
+
return /* @__PURE__ */ jsx3(
|
|
156
|
+
WithdrawModalInner,
|
|
157
|
+
{
|
|
158
|
+
...props,
|
|
159
|
+
reownWallet: reown,
|
|
160
|
+
onConnect: handleConnect
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function WithdrawModalReown(props) {
|
|
165
|
+
return /* @__PURE__ */ jsx3(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx3(WithdrawModalWithReown, { ...props }) });
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
CHAIN_BY_ID,
|
|
169
|
+
DEFAULT_BACKEND_URL,
|
|
170
|
+
DEFAULT_SIGNER_ADDRESS,
|
|
171
|
+
DepositModalReown as DepositModal,
|
|
172
|
+
NATIVE_TOKEN_ADDRESS,
|
|
173
|
+
SOURCE_CHAINS,
|
|
174
|
+
SUPPORTED_CHAINS,
|
|
175
|
+
WithdrawModalReown as WithdrawModal,
|
|
176
|
+
chainRegistry,
|
|
177
|
+
findChainIdForToken,
|
|
178
|
+
getChainBadge,
|
|
179
|
+
getChainIcon,
|
|
180
|
+
getChainId,
|
|
181
|
+
getChainName,
|
|
182
|
+
getChainObject,
|
|
183
|
+
getExplorerName,
|
|
184
|
+
getExplorerTxUrl,
|
|
185
|
+
getExplorerUrl,
|
|
186
|
+
getSupportedChainIds,
|
|
187
|
+
getSupportedTargetTokens,
|
|
188
|
+
getSupportedTokenSymbolsForChain,
|
|
189
|
+
getTokenAddress,
|
|
190
|
+
getTokenDecimals,
|
|
191
|
+
getTokenDecimalsByAddress,
|
|
192
|
+
getTokenIcon,
|
|
193
|
+
getTokenSymbol,
|
|
194
|
+
getUsdcAddress,
|
|
195
|
+
getUsdcDecimals,
|
|
196
|
+
isSupportedTokenAddressForChain
|
|
197
|
+
};
|
|
@@ -23,6 +23,19 @@ interface DepositModalBranding {
|
|
|
23
23
|
logoUrl?: string;
|
|
24
24
|
title?: string;
|
|
25
25
|
}
|
|
26
|
+
interface ReownWallet {
|
|
27
|
+
walletClient: WalletClient | undefined;
|
|
28
|
+
publicClient: PublicClient | undefined;
|
|
29
|
+
address: Address | undefined;
|
|
30
|
+
isConnected: boolean;
|
|
31
|
+
openConnect: () => void;
|
|
32
|
+
switchChain: (chainId: number) => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
interface WalletOption {
|
|
35
|
+
address: Address;
|
|
36
|
+
label: string;
|
|
37
|
+
kind: "connected" | "external";
|
|
38
|
+
}
|
|
26
39
|
interface ConnectedEventData {
|
|
27
40
|
address: Address;
|
|
28
41
|
smartAccount: Address;
|
|
@@ -141,4 +154,4 @@ interface AssetOption {
|
|
|
141
154
|
balanceUsd?: number;
|
|
142
155
|
}
|
|
143
156
|
|
|
144
|
-
export type { AssetOption as A, ConnectedEventData as C, DepositCompleteEventData as D, ErrorEventData as E,
|
|
157
|
+
export type { AssetOption as A, ConnectedEventData as C, DepositCompleteEventData as D, ErrorEventData as E, ReownWallet as R, WalletOption as W, DepositFailedEventData as a, DepositModalBranding as b, DepositModalProps as c, DepositModalTheme as d, DepositModalUIConfig as e, DepositSubmittedEventData as f, WithdrawCompleteEventData as g, WithdrawFailedEventData as h, WithdrawModalProps as i, WithdrawSubmittedEventData as j };
|
|
@@ -23,6 +23,19 @@ interface DepositModalBranding {
|
|
|
23
23
|
logoUrl?: string;
|
|
24
24
|
title?: string;
|
|
25
25
|
}
|
|
26
|
+
interface ReownWallet {
|
|
27
|
+
walletClient: WalletClient | undefined;
|
|
28
|
+
publicClient: PublicClient | undefined;
|
|
29
|
+
address: Address | undefined;
|
|
30
|
+
isConnected: boolean;
|
|
31
|
+
openConnect: () => void;
|
|
32
|
+
switchChain: (chainId: number) => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
interface WalletOption {
|
|
35
|
+
address: Address;
|
|
36
|
+
label: string;
|
|
37
|
+
kind: "connected" | "external";
|
|
38
|
+
}
|
|
26
39
|
interface ConnectedEventData {
|
|
27
40
|
address: Address;
|
|
28
41
|
smartAccount: Address;
|
|
@@ -141,4 +154,4 @@ interface AssetOption {
|
|
|
141
154
|
balanceUsd?: number;
|
|
142
155
|
}
|
|
143
156
|
|
|
144
|
-
export type { AssetOption as A, ConnectedEventData as C, DepositCompleteEventData as D, ErrorEventData as E,
|
|
157
|
+
export type { AssetOption as A, ConnectedEventData as C, DepositCompleteEventData as D, ErrorEventData as E, ReownWallet as R, WalletOption as W, DepositFailedEventData as a, DepositModalBranding as b, DepositModalProps as c, DepositModalTheme as d, DepositModalUIConfig as e, DepositSubmittedEventData as f, WithdrawCompleteEventData as g, WithdrawFailedEventData as h, WithdrawModalProps as i, WithdrawSubmittedEventData as j };
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkO3I5KVXAcjs = require('./chunk-O3I5KVXA.cjs');
|
|
4
|
+
require('./chunk-ANQQMGNN.cjs');
|
|
5
5
|
require('./chunk-CEIWN53N.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.WithdrawModal =
|
|
8
|
+
exports.WithdrawModal = _chunkO3I5KVXAcjs.WithdrawModal;
|
package/dist/withdraw.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AssetOption, C as ConnectedEventData, E as ErrorEventData,
|
|
2
|
+
import { i as WithdrawModalProps } from './types-CUww05xT.cjs';
|
|
3
|
+
export { A as AssetOption, C as ConnectedEventData, E as ErrorEventData, g as WithdrawCompleteEventData, h as WithdrawFailedEventData, j as WithdrawSubmittedEventData } from './types-CUww05xT.cjs';
|
|
4
4
|
export { SafeTransactionRequest } from './safe.cjs';
|
|
5
5
|
import 'viem';
|
|
6
6
|
|
package/dist/withdraw.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AssetOption, C as ConnectedEventData, E as ErrorEventData,
|
|
2
|
+
import { i as WithdrawModalProps } from './types-Z6GjVWFR.js';
|
|
3
|
+
export { A as AssetOption, C as ConnectedEventData, E as ErrorEventData, g as WithdrawCompleteEventData, h as WithdrawFailedEventData, j as WithdrawSubmittedEventData } from './types-Z6GjVWFR.js';
|
|
4
4
|
export { SafeTransactionRequest } from './safe.js';
|
|
5
5
|
import 'viem';
|
|
6
6
|
|
package/dist/withdraw.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/deposit-modal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "React modal component for Rhinestone cross-chain deposits",
|
|
5
5
|
"author": "Rhinestone <dev@rhinestone.wtf>",
|
|
6
6
|
"bugs": {
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"import": "./dist/constants.mjs",
|
|
37
37
|
"require": "./dist/constants.cjs"
|
|
38
38
|
},
|
|
39
|
+
"./reown": {
|
|
40
|
+
"types": "./dist/reown.d.ts",
|
|
41
|
+
"import": "./dist/reown.mjs",
|
|
42
|
+
"require": "./dist/reown.cjs"
|
|
43
|
+
},
|
|
39
44
|
"./styles.css": {
|
|
40
45
|
"types": "./dist/styles.d.ts",
|
|
41
46
|
"default": "./dist/styles.css"
|
|
@@ -55,20 +60,36 @@
|
|
|
55
60
|
"prepublishOnly": "bun run clean && bun run build && bun run typecheck"
|
|
56
61
|
},
|
|
57
62
|
"peerDependencies": {
|
|
63
|
+
"@reown/appkit": "^1.8.17",
|
|
64
|
+
"@reown/appkit-adapter-wagmi": "^1.8.17",
|
|
65
|
+
"@tanstack/react-query": "^5.0.0",
|
|
58
66
|
"react": ">=18",
|
|
59
67
|
"react-dom": ">=18",
|
|
60
|
-
"viem": ">=2"
|
|
68
|
+
"viem": ">=2",
|
|
69
|
+
"wagmi": "^3.4.2"
|
|
70
|
+
},
|
|
71
|
+
"peerDependenciesMeta": {
|
|
72
|
+
"@reown/appkit": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"@reown/appkit-adapter-wagmi": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"@tanstack/react-query": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"wagmi": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
61
84
|
},
|
|
62
85
|
"dependencies": {
|
|
63
|
-
"@rhinestone/sdk": "^1.2.11",
|
|
64
86
|
"@rhinestone/shared-configs": "^1.4.93",
|
|
65
|
-
"
|
|
66
|
-
"@reown/appkit-adapter-wagmi": "^1.8.17",
|
|
67
|
-
"qrcode-generator": "^2.0.4",
|
|
68
|
-
"wagmi": "^3.4.2",
|
|
69
|
-
"@tanstack/react-query": "^5.0.0"
|
|
87
|
+
"qrcode-generator": "^2.0.4"
|
|
70
88
|
},
|
|
71
89
|
"devDependencies": {
|
|
90
|
+
"@reown/appkit": "^1.8.17",
|
|
91
|
+
"@reown/appkit-adapter-wagmi": "^1.8.17",
|
|
92
|
+
"@tanstack/react-query": "^5.0.0",
|
|
72
93
|
"@types/react": "^19.0.0",
|
|
73
94
|
"@types/react-dom": "^19.0.0",
|
|
74
95
|
"bun-types": "^1.3.8",
|
|
@@ -76,7 +97,8 @@
|
|
|
76
97
|
"react-dom": "^19.0.0",
|
|
77
98
|
"tsup": "^8.0.0",
|
|
78
99
|
"typescript": "^5.5.0",
|
|
79
|
-
"viem": "^2.0.0"
|
|
100
|
+
"viem": "^2.0.0",
|
|
101
|
+
"wagmi": "^3.4.2"
|
|
80
102
|
},
|
|
81
103
|
"keywords": [
|
|
82
104
|
"rhinestone",
|
|
@@ -89,6 +111,6 @@
|
|
|
89
111
|
],
|
|
90
112
|
"repository": {
|
|
91
113
|
"type": "git",
|
|
92
|
-
"url": "https://github.com/rhinestonewtf/deposit-modal"
|
|
114
|
+
"url": "git+https://github.com/rhinestonewtf/deposit-modal.git"
|
|
93
115
|
}
|
|
94
|
-
}
|
|
116
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkW7ZYJB2Xcjs = require('./chunk-W7ZYJB2X.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunk6VJ2ZTNQcjs = require('./chunk-6VJ2ZTNQ.cjs');
|
|
8
|
-
require('./chunk-BO745KAB.cjs');
|
|
9
|
-
require('./chunk-CEIWN53N.cjs');
|
|
10
|
-
|
|
11
|
-
// src/DepositModalReown.tsx
|
|
12
|
-
var _react = require('react');
|
|
13
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
14
|
-
function DepositModalWithReown(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
|
-
_chunkW7ZYJB2Xcjs.DepositModalInner,
|
|
21
|
-
{
|
|
22
|
-
...props,
|
|
23
|
-
reownWallet: reown,
|
|
24
|
-
onConnect: handleConnect
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
function DepositModalReown(props) {
|
|
29
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6VJ2ZTNQcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props }) });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
exports.DepositModalReown = DepositModalReown;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DepositModalInner
|
|
3
|
-
} from "./chunk-N2LJOFT2.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/DepositModalReown.tsx
|
|
12
|
-
import { useCallback } from "react";
|
|
13
|
-
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
function DepositModalWithReown(props) {
|
|
15
|
-
const reown = useReownWallet();
|
|
16
|
-
const handleConnect = useCallback(() => {
|
|
17
|
-
reown.openConnect();
|
|
18
|
-
}, [reown.openConnect]);
|
|
19
|
-
return /* @__PURE__ */ jsx(
|
|
20
|
-
DepositModalInner,
|
|
21
|
-
{
|
|
22
|
-
...props,
|
|
23
|
-
reownWallet: reown,
|
|
24
|
-
onConnect: handleConnect
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
function DepositModalReown(props) {
|
|
29
|
-
return /* @__PURE__ */ jsx(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx(DepositModalWithReown, { ...props }) });
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
DepositModalReown
|
|
33
|
-
};
|