@rhinestone/deposit-modal 0.0.0-dev-20260608080045
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 +134 -0
- package/dist/DepositModalReown-6SUEC5IU.mjs +60 -0
- package/dist/DepositModalReown-DNW4GH6L.cjs +60 -0
- package/dist/QRCode-5DXFNKI2.cjs +58 -0
- package/dist/QRCode-WUC652SH.mjs +58 -0
- package/dist/WithdrawModalReown-7UAGSOSU.mjs +37 -0
- package/dist/WithdrawModalReown-OUWBSKSM.cjs +37 -0
- package/dist/caip-CsslyHGL.d.cts +62 -0
- package/dist/caip-CsslyHGL.d.ts +62 -0
- package/dist/chunk-2SMS542Q.cjs +1654 -0
- package/dist/chunk-33H6O5UU.cjs +162 -0
- package/dist/chunk-6YRDD462.mjs +614 -0
- package/dist/chunk-GPSBM66J.mjs +162 -0
- package/dist/chunk-KAWJABTW.mjs +3765 -0
- package/dist/chunk-KJ2RR2D4.mjs +7619 -0
- package/dist/chunk-MILJQWPT.cjs +614 -0
- package/dist/chunk-RABZINV3.cjs +3765 -0
- package/dist/chunk-TKQYTBU6.mjs +1654 -0
- package/dist/chunk-VVJAIMKB.cjs +7619 -0
- package/dist/constants.cjs +70 -0
- package/dist/constants.d.cts +21 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.mjs +70 -0
- package/dist/deposit.cjs +8 -0
- package/dist/deposit.d.cts +11 -0
- package/dist/deposit.d.ts +11 -0
- package/dist/deposit.mjs +8 -0
- package/dist/index.cjs +86 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +86 -0
- package/dist/styles.css +5143 -0
- package/dist/styles.d.ts +3 -0
- package/dist/types-BMcGO5k_.d.cts +432 -0
- package/dist/types-BMcGO5k_.d.ts +432 -0
- package/dist/withdraw.cjs +8 -0
- package/dist/withdraw.d.cts +11 -0
- package/dist/withdraw.d.ts +11 -0
- package/dist/withdraw.mjs +8 -0
- package/package.json +190 -0
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# @rhinestone/deposit-modal
|
|
2
|
+
|
|
3
|
+
React modal for cross-chain deposits and withdrawals via Rhinestone smart accounts.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rhinestone/deposit-modal viem
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { DepositModal } from "@rhinestone/deposit-modal/deposit";
|
|
16
|
+
import "@rhinestone/deposit-modal/styles.css";
|
|
17
|
+
|
|
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`).
|
|
55
|
+
|
|
56
|
+
## Fiat on-ramp (Swapped)
|
|
57
|
+
|
|
58
|
+
Pass `enableFiatOnramp` to expose Swapped's iframe as a funding option alongside Transfer Crypto:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<DepositModal
|
|
62
|
+
enableFiatOnramp
|
|
63
|
+
// Optionally render one row per Swapped payment method instead of a generic
|
|
64
|
+
// "Pay with Card" row. `method` must be the `payment_group` value from
|
|
65
|
+
// Swapped's GET /api/v1/merchant/get_payment_methods — that exact string is
|
|
66
|
+
// what the widget prepopulates from. Note Apple Pay is `apple-pay` (hyphen),
|
|
67
|
+
// not `applepay`.
|
|
68
|
+
fiatOnrampMethods={[
|
|
69
|
+
{ method: "creditcard", label: "Pay with Card", icon: "card" },
|
|
70
|
+
{ method: "apple-pay", label: "Apple Pay", icon: "apple" },
|
|
71
|
+
{ method: "bank-transfer", label: "Bank Transfer", icon: "bank" },
|
|
72
|
+
]}
|
|
73
|
+
// Hide the Transfer Crypto QR row if you only want fiat options:
|
|
74
|
+
// enableQrTransfer={false}
|
|
75
|
+
// ...
|
|
76
|
+
/>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The flow: user picks a fiat option → modal registers a Rhinestone smart account → backend mints a server-signed Swapped iframe URL → user completes purchase → Swapped sends crypto on-chain to the smart account → the existing on-chain detection fires `onLifecycle({ type: "complete" })`.
|
|
80
|
+
|
|
81
|
+
**Destination guarantees.** The user picks the fiat amount inside Swapped's widget, but the destination is fixed server-side: every order receives **USDC on Base** delivered to the **registered Rhinestone smart account**. The frontend cannot override these; the backend signs the Swapped URL with `currencyCode=USDC_BASE` and `walletAddress=<smartAccount>`.
|
|
82
|
+
|
|
83
|
+
**Fees.** Rhinestone does not charge a markup by default. The client (dapp) controls the user-facing experience via the orchestrator's sponsorship config:
|
|
84
|
+
- **Sponsored** (client has a funded sponsor pool for the source chain): user receives 1:1 — the on-ramped amount lands on the target chain exactly.
|
|
85
|
+
- **Unsponsored**: the bridging cost is deducted from the on-ramped amount and shown as a "Bridging cost" line on the success screen.
|
|
86
|
+
|
|
87
|
+
Host CSP must allow Swapped's domains:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect.swapped.com;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Submerchant attribution.** Swapped orders are tagged with a `submerchant` for multi-tenant reporting. This is derived automatically server-side from the embedding page's domain (the request `Origin` header) — no configuration is required. In local development the domain resolves to `localhost`.
|
|
94
|
+
|
|
95
|
+
| Prop | Type | Default | Description |
|
|
96
|
+
| -------------------- | ----------------------------- | ------- | ----------- |
|
|
97
|
+
| `enableFiatOnramp` | `boolean` | `false` | Show fiat on-ramp option(s). Requires `dappAddress` and backend Swapped keys. |
|
|
98
|
+
| `enableQrTransfer` | `boolean` | `true` | Show the Transfer Crypto / QR row. Set false for fiat-only. |
|
|
99
|
+
| `fiatOnrampMethods` | `FiatPaymentMethodOption[]` | — | One row per method, each preselects Swapped's payment method via the `method` URL param. |
|
|
100
|
+
|
|
101
|
+
## Fund from Exchange (Swapped Connect)
|
|
102
|
+
|
|
103
|
+
Pass `enableExchangeConnect` to expose a "Fund from Exchange" row alongside the existing options. Clicking it opens an exchange picker backed by `/onramp/swapped/connect-exchanges`; after the user picks an exchange, the modal embeds Swapped's Connect iframe for that selected `connection`, signs in, and Swapped pulls the crypto on-chain to the smart account.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<DepositModal
|
|
107
|
+
enableExchangeConnect
|
|
108
|
+
// ...
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Flow: user picks Fund from Exchange → backend returns supported exchanges + logos from Swapped using a 24-hour cache → user picks an exchange → modal registers a Rhinestone smart account → backend mints a server-signed Swapped Connect URL with the selected `connection` → user authenticates with their CEX inside the iframe → Swapped pushes crypto on-chain → existing on-chain detection fires `onLifecycle({ type: "complete" })`.
|
|
113
|
+
|
|
114
|
+
| Prop | Type | Default | Description |
|
|
115
|
+
| ------------------------ | --------- | ------- | ----------- |
|
|
116
|
+
| `enableExchangeConnect` | `boolean` | `false` | Show the "Fund from Exchange" row. Requires `dappAddress` and backend Swapped keys. Can be combined with `enableFiatOnramp`. |
|
|
117
|
+
|
|
118
|
+
## Releasing
|
|
119
|
+
|
|
120
|
+
Releases are driven by [changesets](https://github.com/changesets/changesets) and two GitHub Actions workflows (`.github/workflows/`).
|
|
121
|
+
|
|
122
|
+
- **Every PR** that changes published behaviour should include a changeset: run `bun run changeset`, pick the bump, and commit the generated `.changeset/*.md`.
|
|
123
|
+
- **Merge to `main` → `@dev` snapshot.** The `Release` workflow publishes a snapshot to npm under the `dev` tag (`npm install @rhinestone/deposit-modal@dev`). Snapshots are only published when there are pending changesets.
|
|
124
|
+
- **Stable release → `release` branch.** Merge `main` into `release`. The `changesets/action` opens a "Release" PR that bumps the version, writes the changelog, and consumes the changeset files. Merging that PR publishes `@latest` to npm and creates the git tag.
|
|
125
|
+
|
|
126
|
+
Publishing uses npm [OIDC trusted publishing](https://docs.npmjs.com/trusted-publishers) (no stored token). Prerequisites in the `rhinestonewtf/deposit-modal` repo / npm package:
|
|
127
|
+
|
|
128
|
+
- `@rhinestone/deposit-modal` configured as a trusted publisher on npmjs.com (GitHub Actions, repo `rhinestonewtf/deposit-modal`, workflow `release.yaml`).
|
|
129
|
+
- `APP_ID` / `APP_PRIVATE_KEY` secrets for the `rhinestone-automations` GitHub App (opens the Release PR).
|
|
130
|
+
- A `release` branch and a `ship` label.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DepositModalInner
|
|
3
|
+
} from "./chunk-KJ2RR2D4.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ReownWalletProvider,
|
|
6
|
+
useReownWallet
|
|
7
|
+
} from "./chunk-GPSBM66J.mjs";
|
|
8
|
+
import "./chunk-KAWJABTW.mjs";
|
|
9
|
+
import "./chunk-6YRDD462.mjs";
|
|
10
|
+
|
|
11
|
+
// src/DepositModalReown.tsx
|
|
12
|
+
import { useCallback, useMemo } from "react";
|
|
13
|
+
import { useAppKitProvider } from "@reown/appkit/react";
|
|
14
|
+
import { useAppKitConnection } from "@reown/appkit-adapter-solana/react";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
function DepositModalWithReown(props) {
|
|
17
|
+
const reown = useReownWallet();
|
|
18
|
+
const enableSolana = props.enableSolana ?? true;
|
|
19
|
+
const { walletProvider: solanaWalletProvider } = useAppKitProvider(
|
|
20
|
+
enableSolana ? "solana" : "eip155"
|
|
21
|
+
);
|
|
22
|
+
const { connection: solanaConnection } = useAppKitConnection();
|
|
23
|
+
const reownWithSolana = useMemo(
|
|
24
|
+
() => ({
|
|
25
|
+
...reown,
|
|
26
|
+
solanaProvider: enableSolana && reown.isSolana ? solanaWalletProvider : void 0,
|
|
27
|
+
solanaConnection: enableSolana && reown.isSolana ? solanaConnection : void 0
|
|
28
|
+
}),
|
|
29
|
+
[enableSolana, reown, solanaWalletProvider, solanaConnection]
|
|
30
|
+
);
|
|
31
|
+
const handleConnect = useCallback(() => {
|
|
32
|
+
reown.openConnect();
|
|
33
|
+
}, [reown.openConnect]);
|
|
34
|
+
const handleDisconnect = useCallback(() => {
|
|
35
|
+
reown.disconnect();
|
|
36
|
+
}, [reown.disconnect]);
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
DepositModalInner,
|
|
39
|
+
{
|
|
40
|
+
...props,
|
|
41
|
+
reownWallet: reownWithSolana,
|
|
42
|
+
onConnect: handleConnect,
|
|
43
|
+
onDisconnect: handleDisconnect
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function DepositModalReown(props) {
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
ReownWalletProvider,
|
|
50
|
+
{
|
|
51
|
+
projectId: props.reownAppId,
|
|
52
|
+
theme: props.theme,
|
|
53
|
+
enableSolana: props.enableSolana,
|
|
54
|
+
children: /* @__PURE__ */ jsx(DepositModalWithReown, { ...props })
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
DepositModalReown
|
|
60
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkVVJAIMKBcjs = require('./chunk-VVJAIMKB.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunk33H6O5UUcjs = require('./chunk-33H6O5UU.cjs');
|
|
8
|
+
require('./chunk-RABZINV3.cjs');
|
|
9
|
+
require('./chunk-MILJQWPT.cjs');
|
|
10
|
+
|
|
11
|
+
// src/DepositModalReown.tsx
|
|
12
|
+
var _react = require('react');
|
|
13
|
+
var _react3 = require('@reown/appkit/react');
|
|
14
|
+
var _react5 = require('@reown/appkit-adapter-solana/react');
|
|
15
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
16
|
+
function DepositModalWithReown(props) {
|
|
17
|
+
const reown = _chunk33H6O5UUcjs.useReownWallet.call(void 0, );
|
|
18
|
+
const enableSolana = _nullishCoalesce(props.enableSolana, () => ( true));
|
|
19
|
+
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0,
|
|
20
|
+
enableSolana ? "solana" : "eip155"
|
|
21
|
+
);
|
|
22
|
+
const { connection: solanaConnection } = _react5.useAppKitConnection.call(void 0, );
|
|
23
|
+
const reownWithSolana = _react.useMemo.call(void 0,
|
|
24
|
+
() => ({
|
|
25
|
+
...reown,
|
|
26
|
+
solanaProvider: enableSolana && reown.isSolana ? solanaWalletProvider : void 0,
|
|
27
|
+
solanaConnection: enableSolana && reown.isSolana ? solanaConnection : void 0
|
|
28
|
+
}),
|
|
29
|
+
[enableSolana, reown, solanaWalletProvider, solanaConnection]
|
|
30
|
+
);
|
|
31
|
+
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
32
|
+
reown.openConnect();
|
|
33
|
+
}, [reown.openConnect]);
|
|
34
|
+
const handleDisconnect = _react.useCallback.call(void 0, () => {
|
|
35
|
+
reown.disconnect();
|
|
36
|
+
}, [reown.disconnect]);
|
|
37
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
38
|
+
_chunkVVJAIMKBcjs.DepositModalInner,
|
|
39
|
+
{
|
|
40
|
+
...props,
|
|
41
|
+
reownWallet: reownWithSolana,
|
|
42
|
+
onConnect: handleConnect,
|
|
43
|
+
onDisconnect: handleDisconnect
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function DepositModalReown(props) {
|
|
48
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
49
|
+
_chunk33H6O5UUcjs.ReownWalletProvider,
|
|
50
|
+
{
|
|
51
|
+
projectId: props.reownAppId,
|
|
52
|
+
theme: props.theme,
|
|
53
|
+
enableSolana: props.enableSolana,
|
|
54
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props })
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
exports.DepositModalReown = DepositModalReown;
|
|
@@ -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: 50,
|
|
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: 0,
|
|
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: 50,
|
|
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: 0,
|
|
50
|
+
bgColor,
|
|
51
|
+
fgColor
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
55
|
+
QRCode.displayName = "QRCode";
|
|
56
|
+
export {
|
|
57
|
+
QRCode
|
|
58
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WithdrawModalInner
|
|
3
|
+
} from "./chunk-TKQYTBU6.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ReownWalletProvider,
|
|
6
|
+
useReownWallet
|
|
7
|
+
} from "./chunk-GPSBM66J.mjs";
|
|
8
|
+
import "./chunk-KAWJABTW.mjs";
|
|
9
|
+
import "./chunk-6YRDD462.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
|
+
const handleDisconnect = useCallback(() => {
|
|
20
|
+
reown.disconnect();
|
|
21
|
+
}, [reown.disconnect]);
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
WithdrawModalInner,
|
|
24
|
+
{
|
|
25
|
+
...props,
|
|
26
|
+
reownWallet: reown,
|
|
27
|
+
onConnect: handleConnect,
|
|
28
|
+
onDisconnect: handleDisconnect
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function WithdrawModalReown(props) {
|
|
33
|
+
return /* @__PURE__ */ jsx(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx(WithdrawModalWithReown, { ...props }) });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
WithdrawModalReown
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk2SMS542Qcjs = require('./chunk-2SMS542Q.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunk33H6O5UUcjs = require('./chunk-33H6O5UU.cjs');
|
|
8
|
+
require('./chunk-RABZINV3.cjs');
|
|
9
|
+
require('./chunk-MILJQWPT.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 = _chunk33H6O5UUcjs.useReownWallet.call(void 0, );
|
|
16
|
+
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
17
|
+
reown.openConnect();
|
|
18
|
+
}, [reown.openConnect]);
|
|
19
|
+
const handleDisconnect = _react.useCallback.call(void 0, () => {
|
|
20
|
+
reown.disconnect();
|
|
21
|
+
}, [reown.disconnect]);
|
|
22
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
+
_chunk2SMS542Qcjs.WithdrawModalInner,
|
|
24
|
+
{
|
|
25
|
+
...props,
|
|
26
|
+
reownWallet: reown,
|
|
27
|
+
onConnect: handleConnect,
|
|
28
|
+
onDisconnect: handleDisconnect
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function WithdrawModalReown(props) {
|
|
33
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk33H6O5UUcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.WithdrawModalReown = WithdrawModalReown;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Chain } from 'viem/chains';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
|
|
4
|
+
declare function getChainIcon(chainId: number | "solana"): string | undefined;
|
|
5
|
+
declare function getTokenIcon(symbol: string): string | undefined;
|
|
6
|
+
|
|
7
|
+
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
8
|
+
declare const DEFAULT_SIGNER_ADDRESS: Address;
|
|
9
|
+
declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
10
|
+
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
11
|
+
declare const SOURCE_CHAINS: Chain[];
|
|
12
|
+
declare const SUPPORTED_CHAINS: Chain[];
|
|
13
|
+
type ChainRegistryToken = {
|
|
14
|
+
symbol: string;
|
|
15
|
+
address: Address;
|
|
16
|
+
decimals: number;
|
|
17
|
+
};
|
|
18
|
+
type ChainRegistryEntry = {
|
|
19
|
+
name: string;
|
|
20
|
+
tokens: readonly ChainRegistryToken[];
|
|
21
|
+
};
|
|
22
|
+
declare const chainRegistry: Record<string, ChainRegistryEntry>;
|
|
23
|
+
type SupportedTokenOption = {
|
|
24
|
+
symbol: string;
|
|
25
|
+
address: Address;
|
|
26
|
+
decimals: number;
|
|
27
|
+
};
|
|
28
|
+
declare function getChainId(chain: Chain | number): number;
|
|
29
|
+
declare function getChainObject(chain: Chain | number): Chain | undefined;
|
|
30
|
+
declare function getUsdcAddress(chainId: number): Address | undefined;
|
|
31
|
+
declare function getUsdcDecimals(chainId: number): number;
|
|
32
|
+
declare function getTokenAddress(symbol: string, chainId: number): Address | undefined;
|
|
33
|
+
declare function getTokenDecimals(symbol: string, chainId: number): number;
|
|
34
|
+
declare function getTargetTokenSymbolsForChain(chainId: number): string[];
|
|
35
|
+
declare function getSupportedTokenSymbolsForChain(chainId: number): string[];
|
|
36
|
+
declare function getSupportedChainIds(): number[];
|
|
37
|
+
declare function isSupportedTokenAddressForChain(token: Address, chainId: number): boolean;
|
|
38
|
+
declare function getSupportedTargetTokens(chainId: number): SupportedTokenOption[];
|
|
39
|
+
declare function getTokenDecimalsByAddress(token: Address, chainId?: number): number;
|
|
40
|
+
declare function findChainIdForToken(address: Address): number | undefined;
|
|
41
|
+
declare function getTokenSymbol(token: Address, chainId?: number): string;
|
|
42
|
+
declare function getChainName(chainId: number | "solana"): string;
|
|
43
|
+
declare function getChainBadge(chainId: number | "solana"): {
|
|
44
|
+
shortLabel: string;
|
|
45
|
+
color: string;
|
|
46
|
+
bg: string;
|
|
47
|
+
};
|
|
48
|
+
declare function getExplorerUrl(chainId: number | "solana"): string | undefined;
|
|
49
|
+
declare function getExplorerTxUrl(chainId: number | "solana", txHash: string): string | undefined;
|
|
50
|
+
declare function getExplorerName(chainId: number | "solana"): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* HyperCore — Hyperliquid's virtual trading L1 (chain id 1337), settling on
|
|
54
|
+
* HyperEVM (999). It is USDC-only and requires an EOA recipient. It has no node
|
|
55
|
+
* of its own, so `targetChainToCaip2(1337)` still emits `eip155:1337` (the
|
|
56
|
+
* backend maps 1337 → 999), but it must never be used as an EVM RPC target.
|
|
57
|
+
*/
|
|
58
|
+
declare const HYPERCORE_CHAIN_ID = 1337;
|
|
59
|
+
/** Canonical USDC on HyperEVM (999), the HyperCore settlement chain. */
|
|
60
|
+
declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
61
|
+
|
|
62
|
+
export { CHAIN_BY_ID as C, DEFAULT_BACKEND_URL as D, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, DEFAULT_SIGNER_ADDRESS as a, HYPERCORE_USDC_ADDRESS as b, SUPPORTED_CHAINS as c, type SupportedTokenOption as d, chainRegistry as e, findChainIdForToken as f, getChainBadge as g, getChainIcon as h, getChainId as i, getChainName as j, getChainObject as k, getExplorerName as l, getExplorerTxUrl as m, getExplorerUrl as n, getSupportedChainIds as o, getSupportedTargetTokens as p, getSupportedTokenSymbolsForChain as q, getTargetTokenSymbolsForChain as r, getTokenAddress as s, getTokenDecimals as t, getTokenDecimalsByAddress as u, getTokenIcon as v, getTokenSymbol as w, getUsdcAddress as x, getUsdcDecimals as y, isSupportedTokenAddressForChain as z };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Chain } from 'viem/chains';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
|
|
4
|
+
declare function getChainIcon(chainId: number | "solana"): string | undefined;
|
|
5
|
+
declare function getTokenIcon(symbol: string): string | undefined;
|
|
6
|
+
|
|
7
|
+
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
8
|
+
declare const DEFAULT_SIGNER_ADDRESS: Address;
|
|
9
|
+
declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
10
|
+
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
11
|
+
declare const SOURCE_CHAINS: Chain[];
|
|
12
|
+
declare const SUPPORTED_CHAINS: Chain[];
|
|
13
|
+
type ChainRegistryToken = {
|
|
14
|
+
symbol: string;
|
|
15
|
+
address: Address;
|
|
16
|
+
decimals: number;
|
|
17
|
+
};
|
|
18
|
+
type ChainRegistryEntry = {
|
|
19
|
+
name: string;
|
|
20
|
+
tokens: readonly ChainRegistryToken[];
|
|
21
|
+
};
|
|
22
|
+
declare const chainRegistry: Record<string, ChainRegistryEntry>;
|
|
23
|
+
type SupportedTokenOption = {
|
|
24
|
+
symbol: string;
|
|
25
|
+
address: Address;
|
|
26
|
+
decimals: number;
|
|
27
|
+
};
|
|
28
|
+
declare function getChainId(chain: Chain | number): number;
|
|
29
|
+
declare function getChainObject(chain: Chain | number): Chain | undefined;
|
|
30
|
+
declare function getUsdcAddress(chainId: number): Address | undefined;
|
|
31
|
+
declare function getUsdcDecimals(chainId: number): number;
|
|
32
|
+
declare function getTokenAddress(symbol: string, chainId: number): Address | undefined;
|
|
33
|
+
declare function getTokenDecimals(symbol: string, chainId: number): number;
|
|
34
|
+
declare function getTargetTokenSymbolsForChain(chainId: number): string[];
|
|
35
|
+
declare function getSupportedTokenSymbolsForChain(chainId: number): string[];
|
|
36
|
+
declare function getSupportedChainIds(): number[];
|
|
37
|
+
declare function isSupportedTokenAddressForChain(token: Address, chainId: number): boolean;
|
|
38
|
+
declare function getSupportedTargetTokens(chainId: number): SupportedTokenOption[];
|
|
39
|
+
declare function getTokenDecimalsByAddress(token: Address, chainId?: number): number;
|
|
40
|
+
declare function findChainIdForToken(address: Address): number | undefined;
|
|
41
|
+
declare function getTokenSymbol(token: Address, chainId?: number): string;
|
|
42
|
+
declare function getChainName(chainId: number | "solana"): string;
|
|
43
|
+
declare function getChainBadge(chainId: number | "solana"): {
|
|
44
|
+
shortLabel: string;
|
|
45
|
+
color: string;
|
|
46
|
+
bg: string;
|
|
47
|
+
};
|
|
48
|
+
declare function getExplorerUrl(chainId: number | "solana"): string | undefined;
|
|
49
|
+
declare function getExplorerTxUrl(chainId: number | "solana", txHash: string): string | undefined;
|
|
50
|
+
declare function getExplorerName(chainId: number | "solana"): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* HyperCore — Hyperliquid's virtual trading L1 (chain id 1337), settling on
|
|
54
|
+
* HyperEVM (999). It is USDC-only and requires an EOA recipient. It has no node
|
|
55
|
+
* of its own, so `targetChainToCaip2(1337)` still emits `eip155:1337` (the
|
|
56
|
+
* backend maps 1337 → 999), but it must never be used as an EVM RPC target.
|
|
57
|
+
*/
|
|
58
|
+
declare const HYPERCORE_CHAIN_ID = 1337;
|
|
59
|
+
/** Canonical USDC on HyperEVM (999), the HyperCore settlement chain. */
|
|
60
|
+
declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
61
|
+
|
|
62
|
+
export { CHAIN_BY_ID as C, DEFAULT_BACKEND_URL as D, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, DEFAULT_SIGNER_ADDRESS as a, HYPERCORE_USDC_ADDRESS as b, SUPPORTED_CHAINS as c, type SupportedTokenOption as d, chainRegistry as e, findChainIdForToken as f, getChainBadge as g, getChainIcon as h, getChainId as i, getChainName as j, getChainObject as k, getExplorerName as l, getExplorerTxUrl as m, getExplorerUrl as n, getSupportedChainIds as o, getSupportedTargetTokens as p, getSupportedTokenSymbolsForChain as q, getTargetTokenSymbolsForChain as r, getTokenAddress as s, getTokenDecimals as t, getTokenDecimalsByAddress as u, getTokenIcon as v, getTokenSymbol as w, getUsdcAddress as x, getUsdcDecimals as y, isSupportedTokenAddressForChain as z };
|