@rhinestone/deposit-modal 0.2.4 → 0.3.0-alpha.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.
- package/README.md +40 -211
- package/dist/{DepositModalReown-CY5MSQGK.mjs → DepositModalReown-GXY65HZP.mjs} +3 -3
- package/dist/{DepositModalReown-2UMPITRN.cjs → DepositModalReown-HVIEA6YA.cjs} +4 -4
- package/dist/QRCode-SMMYPUQC.cjs +58 -0
- package/dist/QRCode-YMQTKSSK.mjs +58 -0
- package/dist/{WithdrawModalReown-Z5BUZQ4Z.cjs → WithdrawModalReown-4M3PBY2T.cjs} +4 -4
- package/dist/{WithdrawModalReown-YSRO5ZTA.mjs → WithdrawModalReown-O6V6KRH6.mjs} +3 -3
- package/dist/{chunk-ARGMXV6E.cjs → chunk-7SYZG47X.cjs} +1723 -1881
- package/dist/{chunk-WHW3ZMOT.mjs → chunk-EEHUOFIW.mjs} +107 -90
- package/dist/{chunk-KJEHVIPZ.mjs → chunk-FKPTIHU7.mjs} +631 -423
- package/dist/{chunk-HFQV7EHS.mjs → chunk-U5QIFNG4.mjs} +1774 -1932
- package/dist/{chunk-WNFGZS56.mjs → chunk-UIHAYD7J.mjs} +1079 -784
- package/dist/{chunk-R2HP743T.cjs → chunk-XCAF6B3D.cjs} +51 -34
- package/dist/{chunk-NFXJEOE6.cjs → chunk-Y3RA3YGA.cjs} +1101 -806
- package/dist/{chunk-QUOP5C6V.cjs → chunk-Z2SIC2TH.cjs} +686 -478
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -3
- package/dist/deposit.d.ts +2 -3
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +4 -4
- package/dist/styles.css +1068 -752
- package/dist/{types-DGQzvl6v.d.ts → types-DRou84ZM.d.cts} +147 -33
- package/dist/{types-DJ1fzNC7.d.cts → types-DRou84ZM.d.ts} +147 -33
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -3
- package/dist/withdraw.d.ts +2 -3
- package/dist/withdraw.mjs +3 -3
- package/package.json +13 -12
- package/dist/reown.cjs +0 -16
- package/dist/reown.d.cts +0 -10
- package/dist/reown.d.ts +0 -10
- package/dist/reown.mjs +0 -16
- package/dist/safe.cjs +0 -1
- package/dist/safe.d.cts +0 -62
- package/dist/safe.d.ts +0 -62
- package/dist/safe.mjs +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @rhinestone/deposit-modal
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
React modal for cross-chain deposits and withdrawals via Rhinestone smart accounts.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,221 +8,50 @@ React components for cross-chain deposits and withdrawals via Rhinestone smart a
|
|
|
8
8
|
npm install @rhinestone/deposit-modal viem
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
Prefer subpath imports so apps only bundle what they use:
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import { DepositModal } from "@rhinestone/deposit-modal/deposit";
|
|
17
|
-
import { WithdrawModal } from "@rhinestone/deposit-modal/withdraw";
|
|
18
|
-
import { executeSafeEthTransfer } from "@rhinestone/deposit-modal/safe";
|
|
19
|
-
import { getChainName } from "@rhinestone/deposit-modal/constants";
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## DepositModal
|
|
23
|
-
|
|
24
|
-
Deposits tokens from any supported chain into a target chain/token via a Rhinestone smart account.
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
User wallet → transfer → Rhinestone smart account → bridge → target chain/token
|
|
28
|
-
```
|
|
11
|
+
## Example
|
|
29
12
|
|
|
30
13
|
```tsx
|
|
14
|
+
import { useState } from "react";
|
|
31
15
|
import { DepositModal } from "@rhinestone/deposit-modal/deposit";
|
|
32
16
|
import "@rhinestone/deposit-modal/styles.css";
|
|
33
17
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- Smart-account owner config is passed to the SDK as two ECDSA owners (`ownerAddress` + local `sessionOwner`) with threshold `1`.
|
|
72
|
-
- `DEFAULT_SIGNER_ADDRESS` is the session policy signer inside `sessionDetails`; it is not the local co-owner key stored in browser.
|
|
73
|
-
|
|
74
|
-
### Props
|
|
75
|
-
|
|
76
|
-
| Prop | Type | Required | Description |
|
|
77
|
-
| -------------------- | ---------------------- | -------- | ---------------------------------------------------------------------------- |
|
|
78
|
-
| `isOpen` | `boolean` | Yes | Modal open state |
|
|
79
|
-
| `onClose` | `() => void` | Yes | Close handler |
|
|
80
|
-
| `targetChain` | `Chain \| number` | Yes | Destination chain |
|
|
81
|
-
| `targetToken` | `Address` | Yes | Destination token address |
|
|
82
|
-
| `dappWalletClient` | `WalletClient \| null` | No | Host-provided signer wallet client |
|
|
83
|
-
| `dappPublicClient` | `PublicClient \| null` | No | Host-provided public client (fallbacks are created internally if missing) |
|
|
84
|
-
| `dappAddress` | `Address \| null` | No | Dapp identity / owner anchor used by setup and QR flow |
|
|
85
|
-
| `inline` | `boolean` | No | Render inline without overlay |
|
|
86
|
-
| `sourceChain` | `Chain \| number` | No | Pre-selected source chain |
|
|
87
|
-
| `sourceToken` | `Address` | No | Pre-selected source token |
|
|
88
|
-
| `defaultAmount` | `string` | No | Pre-filled amount |
|
|
89
|
-
| `recipient` | `Address` | No | Custom recipient address |
|
|
90
|
-
| `backendUrl` | `string` | No | Backend URL |
|
|
91
|
-
| `solanaRpcUrl` | `string` | No | Optional Solana RPC URL override (default: `https://api.mainnet.solana.com`) |
|
|
92
|
-
| `rhinestoneApiKey` | `string` | No | Optional SDK api key forwarded to `RhinestoneSDK` during smart-account setup |
|
|
93
|
-
| `signerAddress` | `Address` | No | Session signer address |
|
|
94
|
-
| `waitForFinalTx` | `boolean` | No | Wait for destination tx (default: true) |
|
|
95
|
-
| `enableSolana` | `boolean` | No | Enable Solana wallet and QR deposit flows (default: `true`) |
|
|
96
|
-
| `onRequestConnect` | `() => void` | No | Called when wallet connection needed |
|
|
97
|
-
| `connectButtonLabel` | `string` | No | Custom connect button label |
|
|
98
|
-
| `theme` | `DepositModalTheme` | No | Theme customization |
|
|
99
|
-
| `branding` | `DepositModalBranding` | No | Logo and title |
|
|
100
|
-
| `uiConfig` | `DepositModalUIConfig` | No | UI display options |
|
|
101
|
-
| `className` | `string` | No | Additional CSS class |
|
|
102
|
-
|
|
103
|
-
### Callbacks
|
|
104
|
-
|
|
105
|
-
| Callback | Description |
|
|
106
|
-
| -------------------------- | --------------------------------------------------- |
|
|
107
|
-
| `onReady` | Modal initialized |
|
|
108
|
-
| `onConnected(data)` | Smart account created (`{ address, smartAccount }`) |
|
|
109
|
-
| `onDepositSubmitted(data)` | Transfer signed (`{ txHash, sourceChain, amount }`) |
|
|
110
|
-
| `onDepositComplete(data)` | Deposit arrived (`{ txHash, destinationTxHash? }`) |
|
|
111
|
-
| `onDepositFailed(data)` | Bridge failed (`{ txHash, error? }`) |
|
|
112
|
-
| `onError(data)` | Error payload (`{ message, code? }`) |
|
|
113
|
-
|
|
114
|
-
## WithdrawModal
|
|
115
|
-
|
|
116
|
-
Withdraws tokens from a 1/1 Safe to a target chain/token. The connected wallet must be the sole Safe owner. User signs an EIP-712 SafeTx authorizing the ERC20 transfer, then funds are bridged to the destination.
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
Safe → ERC20 transfer → Rhinestone smart account → bridge → target chain/token
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
import { WithdrawModal } from "@rhinestone/deposit-modal/withdraw";
|
|
124
|
-
import "@rhinestone/deposit-modal/styles.css";
|
|
125
|
-
|
|
126
|
-
<WithdrawModal
|
|
127
|
-
isOpen={isOpen}
|
|
128
|
-
onClose={() => setIsOpen(false)}
|
|
129
|
-
dappWalletClient={walletClient}
|
|
130
|
-
dappPublicClient={publicClient}
|
|
131
|
-
dappAddress={address}
|
|
132
|
-
safeAddress="0x..."
|
|
133
|
-
sourceChain={8453}
|
|
134
|
-
sourceToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
135
|
-
targetChain={1}
|
|
136
|
-
targetToken="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
137
|
-
onWithdrawComplete={(data) => console.log("Done!", data)}
|
|
138
|
-
/>;
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Withdrawal flow
|
|
142
|
-
|
|
143
|
-
Prerequisites:
|
|
144
|
-
|
|
145
|
-
- A 1/1 Safe (single owner) with ERC20 token balance on a supported source chain
|
|
146
|
-
- The connected wallet must be the sole owner of the Safe
|
|
147
|
-
|
|
148
|
-
End-to-end steps:
|
|
149
|
-
|
|
150
|
-
1. User connects wallet (must be the Safe owner)
|
|
151
|
-
2. Modal creates a Rhinestone smart account and signs session authorization
|
|
152
|
-
3. Modal registers the smart account with the backend (`/register`)
|
|
153
|
-
4. User enters withdrawal amount
|
|
154
|
-
5. User signs an EIP-712 `execTransaction` authorizing the ERC20 transfer from the Safe to the smart account
|
|
155
|
-
6. Modal calls `/process/:address` to trigger the bridge intent
|
|
156
|
-
7. Modal polls `/status/:address` for webhook events until the bridge completes on the destination chain
|
|
157
|
-
|
|
158
|
-
To test with the demo configurator:
|
|
159
|
-
|
|
160
|
-
1. Switch flow to "Withdraw"
|
|
161
|
-
2. Enter the Safe address
|
|
162
|
-
3. Select the source chain/token matching the Safe's holdings
|
|
163
|
-
4. Select the destination chain/token
|
|
164
|
-
5. The connected wallet (Privy embedded or Reown) must be the Safe's sole owner
|
|
165
|
-
|
|
166
|
-
### Additional Props (beyond shared DepositModal props)
|
|
167
|
-
|
|
168
|
-
| Prop | Type | Required | Description |
|
|
169
|
-
| ------------- | ----------------- | -------- | --------------------------- |
|
|
170
|
-
| `safeAddress` | `Address` | Yes | Safe holding funds |
|
|
171
|
-
| `sourceChain` | `Chain \| number` | Yes | Chain where the Safe exists |
|
|
172
|
-
| `sourceToken` | `Address` | Yes | Token in the Safe |
|
|
173
|
-
|
|
174
|
-
### Callbacks
|
|
175
|
-
|
|
176
|
-
| Callback | Description |
|
|
177
|
-
| --------------------------- | --------------------------------------------------------------------- |
|
|
178
|
-
| `onWithdrawSubmitted(data)` | Safe transfer signed (`{ txHash, sourceChain, amount, safeAddress }`) |
|
|
179
|
-
| `onWithdrawComplete(data)` | Withdrawal arrived (`{ txHash, destinationTxHash? }`) |
|
|
180
|
-
| `onWithdrawFailed(data)` | Bridge failed (`{ txHash, error? }`) |
|
|
181
|
-
|
|
182
|
-
Also supports `onReady`, `onConnected`, and `onError` (same as DepositModal).
|
|
183
|
-
|
|
184
|
-
## Theming
|
|
185
|
-
|
|
186
|
-
```tsx
|
|
187
|
-
<DepositModal
|
|
188
|
-
theme={{ mode: "dark", ctaColor: "#8b5cf6", radius: "lg" }}
|
|
189
|
-
branding={{ logoUrl: "https://example.com/logo.png", title: "Fund Account" }}
|
|
190
|
-
uiConfig={{ showLogo: true, showStepper: true, maxDepositUsd: 10000 }}
|
|
191
|
-
/>
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Theme**: `mode` (light/dark), `ctaColor`, `ctaHoverColor`, `fontColor`, `iconColor`, `borderColor`, `backgroundColor`, `radius` (none/sm/md/lg/full)
|
|
195
|
-
|
|
196
|
-
**Branding**: `logoUrl`, `title`
|
|
197
|
-
|
|
198
|
-
**UI Config**: `showLogo`, `showStepper`, `showBackButton`, `balanceTitle`, `maxDepositUsd`, `minDepositUsd`
|
|
199
|
-
|
|
200
|
-
Use `enableSolana={false}` to keep the deposit experience EVM-only even when `reownAppId` is provided.
|
|
201
|
-
|
|
202
|
-
## Utility Exports
|
|
203
|
-
|
|
204
|
-
```tsx
|
|
205
|
-
import {
|
|
206
|
-
SOURCE_CHAINS,
|
|
207
|
-
SUPPORTED_CHAINS,
|
|
208
|
-
chainRegistry,
|
|
209
|
-
getChainName,
|
|
210
|
-
getChainIcon,
|
|
211
|
-
getChainObject,
|
|
212
|
-
getUsdcAddress,
|
|
213
|
-
getTokenAddress,
|
|
214
|
-
getTokenDecimals,
|
|
215
|
-
getTokenSymbol,
|
|
216
|
-
getTokenIcon,
|
|
217
|
-
getExplorerTxUrl,
|
|
218
|
-
DEFAULT_BACKEND_URL,
|
|
219
|
-
NATIVE_TOKEN_ADDRESS,
|
|
220
|
-
} from "@rhinestone/deposit-modal/constants";
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## Supported Chains
|
|
224
|
-
|
|
225
|
-
Mainnet (1), Base (8453), Arbitrum (42161), Optimism (10), Polygon (137), BSC (56)
|
|
18
|
+
export function DepositButton({ walletClient, publicClient, address }) {
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<button onClick={() => setOpen(true)}>Deposit</button>
|
|
24
|
+
<DepositModal
|
|
25
|
+
isOpen={open}
|
|
26
|
+
onClose={() => setOpen(false)}
|
|
27
|
+
dappWalletClient={walletClient}
|
|
28
|
+
dappPublicClient={publicClient}
|
|
29
|
+
dappAddress={address}
|
|
30
|
+
targetChain={8453}
|
|
31
|
+
targetToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
32
|
+
onLifecycle={(event) => {
|
|
33
|
+
switch (event.type) {
|
|
34
|
+
case "connected":
|
|
35
|
+
console.log("smart account ready", event.smartAccount);
|
|
36
|
+
break;
|
|
37
|
+
case "submitted":
|
|
38
|
+
console.log("source tx", event.txHash);
|
|
39
|
+
break;
|
|
40
|
+
case "complete":
|
|
41
|
+
console.log("done", event.destinationTxHash);
|
|
42
|
+
break;
|
|
43
|
+
case "failed":
|
|
44
|
+
console.error("failed", event.error);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`WithdrawModal` lives at `@rhinestone/deposit-modal/withdraw` and takes the same shape (`onLifecycle` + `onError`).
|
|
226
55
|
|
|
227
56
|
## License
|
|
228
57
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-U5QIFNG4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
7
|
} from "./chunk-5YXAQB6A.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-UIHAYD7J.mjs";
|
|
9
|
+
import "./chunk-EEHUOFIW.mjs";
|
|
10
10
|
|
|
11
11
|
// src/DepositModalReown.tsx
|
|
12
12
|
import { useCallback, useMemo } from "react";
|
|
@@ -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
|
|
3
|
+
var _chunk7SYZG47Xcjs = require('./chunk-7SYZG47X.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-Y3RA3YGA.cjs');
|
|
9
|
+
require('./chunk-XCAF6B3D.cjs');
|
|
10
10
|
|
|
11
11
|
// src/DepositModalReown.tsx
|
|
12
12
|
var _react = require('react');
|
|
@@ -32,7 +32,7 @@ function DepositModalWithReown(props) {
|
|
|
32
32
|
reown.disconnect();
|
|
33
33
|
}, [reown.disconnect]);
|
|
34
34
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
-
|
|
35
|
+
_chunk7SYZG47Xcjs.DepositModalInner,
|
|
36
36
|
{
|
|
37
37
|
...props,
|
|
38
38
|
reownWallet: reownWithSolana,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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/components/ui/QRCode.tsx
|
|
2
|
+
var _react = require('react');
|
|
3
|
+
var _reactqrcodelogo = require('react-qrcode-logo');
|
|
4
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
5
|
+
function resolveSurfaceColor(node) {
|
|
6
|
+
if (!node) return { bg: "#ffffff", fg: "#000000" };
|
|
7
|
+
const themed = node.closest("[data-theme]");
|
|
8
|
+
const styles = themed ? getComputedStyle(themed) : getComputedStyle(document.documentElement);
|
|
9
|
+
const bg = styles.getPropertyValue("--rs-surface-subtle").trim() || "#ffffff";
|
|
10
|
+
const isDark = _optionalChain([themed, 'optionalAccess', _ => _.dataset, 'access', _2 => _2.theme]) === "dark";
|
|
11
|
+
const fg = isDark ? "#ffffff" : "#000000";
|
|
12
|
+
return { bg, fg };
|
|
13
|
+
}
|
|
14
|
+
function QRCode({ value, size = 200, iconSrc, className }) {
|
|
15
|
+
const wrapperRef = _react.useRef.call(void 0, null);
|
|
16
|
+
const [colors, setColors] = _react.useState.call(void 0, {
|
|
17
|
+
bg: "#ffffff",
|
|
18
|
+
fg: "#000000"
|
|
19
|
+
});
|
|
20
|
+
_react.useEffect.call(void 0, () => {
|
|
21
|
+
const node = wrapperRef.current;
|
|
22
|
+
if (!node) return;
|
|
23
|
+
const sync = () => setColors(resolveSurfaceColor(node));
|
|
24
|
+
sync();
|
|
25
|
+
const themed = node.closest("[data-theme]");
|
|
26
|
+
if (!themed) return;
|
|
27
|
+
const observer = new MutationObserver(sync);
|
|
28
|
+
observer.observe(themed, {
|
|
29
|
+
attributes: true,
|
|
30
|
+
attributeFilter: ["data-theme"]
|
|
31
|
+
});
|
|
32
|
+
return () => observer.disconnect();
|
|
33
|
+
}, []);
|
|
34
|
+
const { bg: bgColor, fg: fgColor } = colors;
|
|
35
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: wrapperRef, className, role: "img", "aria-label": "QR Code", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
36
|
+
_reactqrcodelogo.QRCode,
|
|
37
|
+
{
|
|
38
|
+
value,
|
|
39
|
+
size,
|
|
40
|
+
qrStyle: "dots",
|
|
41
|
+
eyeRadius: [10, 10, 10],
|
|
42
|
+
ecLevel: "H",
|
|
43
|
+
logoImage: iconSrc,
|
|
44
|
+
logoWidth: size * 0.22,
|
|
45
|
+
logoHeight: size * 0.22,
|
|
46
|
+
logoPaddingStyle: "circle",
|
|
47
|
+
logoPadding: 5,
|
|
48
|
+
removeQrCodeBehindLogo: true,
|
|
49
|
+
quietZone: 10,
|
|
50
|
+
bgColor,
|
|
51
|
+
fgColor
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
55
|
+
QRCode.displayName = "QRCode";
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
exports.QRCode = QRCode;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/components/ui/QRCode.tsx
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { QRCode as QRCodeCanvas } from "react-qrcode-logo";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function resolveSurfaceColor(node) {
|
|
6
|
+
if (!node) return { bg: "#ffffff", fg: "#000000" };
|
|
7
|
+
const themed = node.closest("[data-theme]");
|
|
8
|
+
const styles = themed ? getComputedStyle(themed) : getComputedStyle(document.documentElement);
|
|
9
|
+
const bg = styles.getPropertyValue("--rs-surface-subtle").trim() || "#ffffff";
|
|
10
|
+
const isDark = themed?.dataset.theme === "dark";
|
|
11
|
+
const fg = isDark ? "#ffffff" : "#000000";
|
|
12
|
+
return { bg, fg };
|
|
13
|
+
}
|
|
14
|
+
function QRCode({ value, size = 200, iconSrc, className }) {
|
|
15
|
+
const wrapperRef = useRef(null);
|
|
16
|
+
const [colors, setColors] = useState({
|
|
17
|
+
bg: "#ffffff",
|
|
18
|
+
fg: "#000000"
|
|
19
|
+
});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const node = wrapperRef.current;
|
|
22
|
+
if (!node) return;
|
|
23
|
+
const sync = () => setColors(resolveSurfaceColor(node));
|
|
24
|
+
sync();
|
|
25
|
+
const themed = node.closest("[data-theme]");
|
|
26
|
+
if (!themed) return;
|
|
27
|
+
const observer = new MutationObserver(sync);
|
|
28
|
+
observer.observe(themed, {
|
|
29
|
+
attributes: true,
|
|
30
|
+
attributeFilter: ["data-theme"]
|
|
31
|
+
});
|
|
32
|
+
return () => observer.disconnect();
|
|
33
|
+
}, []);
|
|
34
|
+
const { bg: bgColor, fg: fgColor } = colors;
|
|
35
|
+
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, className, role: "img", "aria-label": "QR Code", children: /* @__PURE__ */ jsx(
|
|
36
|
+
QRCodeCanvas,
|
|
37
|
+
{
|
|
38
|
+
value,
|
|
39
|
+
size,
|
|
40
|
+
qrStyle: "dots",
|
|
41
|
+
eyeRadius: [10, 10, 10],
|
|
42
|
+
ecLevel: "H",
|
|
43
|
+
logoImage: iconSrc,
|
|
44
|
+
logoWidth: size * 0.22,
|
|
45
|
+
logoHeight: size * 0.22,
|
|
46
|
+
logoPaddingStyle: "circle",
|
|
47
|
+
logoPadding: 5,
|
|
48
|
+
removeQrCodeBehindLogo: true,
|
|
49
|
+
quietZone: 10,
|
|
50
|
+
bgColor,
|
|
51
|
+
fgColor
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
55
|
+
QRCode.displayName = "QRCode";
|
|
56
|
+
export {
|
|
57
|
+
QRCode
|
|
58
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZ2SIC2THcjs = require('./chunk-Z2SIC2TH.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-Y3RA3YGA.cjs');
|
|
9
|
+
require('./chunk-XCAF6B3D.cjs');
|
|
10
10
|
|
|
11
11
|
// src/WithdrawModalReown.tsx
|
|
12
12
|
var _react = require('react');
|
|
@@ -20,7 +20,7 @@ function WithdrawModalWithReown(props) {
|
|
|
20
20
|
reown.disconnect();
|
|
21
21
|
}, [reown.disconnect]);
|
|
22
22
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
|
|
23
|
+
_chunkZ2SIC2THcjs.WithdrawModalInner,
|
|
24
24
|
{
|
|
25
25
|
...props,
|
|
26
26
|
reownWallet: reown,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FKPTIHU7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
7
|
} from "./chunk-5YXAQB6A.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-UIHAYD7J.mjs";
|
|
9
|
+
import "./chunk-EEHUOFIW.mjs";
|
|
10
10
|
|
|
11
11
|
// src/WithdrawModalReown.tsx
|
|
12
12
|
import { useCallback } from "react";
|