@rhinestone/deposit-modal 0.12.1 → 0.13.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 +30 -16
- package/dist/ClaimModal-CREZO27I.mjs +11 -0
- package/dist/ClaimModal-JRIA32U2.cjs +11 -0
- package/dist/{DepositModalReown-SXAXHYTN.mjs → DepositModalReown-3H75G3XQ.mjs} +44 -22
- package/dist/{DepositModalReown-CH6FUTCR.cjs → DepositModalReown-YNNHLAV2.cjs} +57 -35
- package/dist/{QRCode-WUC652SH.mjs → QRCode-5RGIZZHL.mjs} +1 -1
- package/dist/{QRCode-5DXFNKI2.cjs → QRCode-JKXG4RHN.cjs} +2 -2
- package/dist/WithdrawModal-NVRX44IZ.mjs +10 -0
- package/dist/WithdrawModal-YYSBPCJJ.cjs +10 -0
- package/dist/{chunk-2BOEUV6B.cjs → chunk-2G2EIN4A.cjs} +1510 -896
- package/dist/{chunk-O7BCVQ6L.cjs → chunk-4KCSH4T3.cjs} +157 -199
- package/dist/{chunk-UGK4JRK6.cjs → chunk-5NUIKYSF.cjs} +83 -209
- package/dist/{chunk-ZLCY33FQ.cjs → chunk-7N77GIP4.cjs} +102 -88
- package/dist/{chunk-PVWZN66D.mjs → chunk-COCBCQQC.mjs} +121 -86
- package/dist/chunk-CVGNCUVU.cjs +154 -0
- package/dist/{chunk-KPWB2JAX.mjs → chunk-DSIZNRWA.mjs} +1540 -926
- package/dist/{chunk-75DVGSAX.cjs → chunk-DW2EQA2U.cjs} +6 -3
- package/dist/{chunk-2K44IE3V.mjs → chunk-EOMT5LKX.mjs} +374 -151
- package/dist/chunk-FZ5FZFIG.mjs +31 -0
- package/dist/chunk-GACIGCSN.cjs +31 -0
- package/dist/{chunk-TYBMAUGH.cjs → chunk-HOGZKHHY.cjs} +3 -3
- package/dist/{chunk-TQWEGW3A.mjs → chunk-LTMMETAB.mjs} +29 -15
- package/dist/{chunk-O4AXBFHU.mjs → chunk-OLCD75JK.mjs} +20 -146
- package/dist/{chunk-FKHPVLJY.cjs → chunk-RAADLTSW.cjs} +240 -205
- package/dist/{chunk-4ZXQPFNU.mjs → chunk-RN5VKWI6.mjs} +4 -1
- package/dist/{chunk-3STTWRAN.mjs → chunk-VUATPOWJ.mjs} +147 -189
- package/dist/{chunk-NHGFU3WC.mjs → chunk-XYJFEN5D.mjs} +1 -1
- package/dist/chunk-YREVFB64.mjs +154 -0
- package/dist/{chunk-65MLWUQD.cjs → chunk-ZMT4ATHR.cjs} +437 -214
- package/dist/claim.cjs +7 -6
- package/dist/claim.d.cts +11 -3
- package/dist/claim.d.ts +11 -3
- package/dist/claim.mjs +6 -5
- package/dist/{constants-FuzG3h4m.d.cts → constants-DBrWhJWE.d.cts} +12 -7
- package/dist/{constants-FuzG3h4m.d.ts → constants-DBrWhJWE.d.ts} +12 -7
- package/dist/constants.cjs +3 -9
- package/dist/constants.d.cts +2 -3
- package/dist/constants.d.ts +2 -3
- package/dist/constants.mjs +4 -10
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +7 -7
- package/dist/embed.cjs +1268 -0
- package/dist/embed.d.cts +177 -0
- package/dist/embed.d.ts +177 -0
- package/dist/embed.mjs +1268 -0
- package/dist/index.cjs +11 -16
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +14 -19
- package/dist/modal-ui-state-OD1RmKkK.d.cts +30 -0
- package/dist/modal-ui-state-OD1RmKkK.d.ts +30 -0
- package/dist/polymarket.cjs +17 -7
- package/dist/polymarket.mjs +13 -3
- package/dist/styles.css +133 -98
- package/dist/{types-oFblf65g.d.ts → types-B89I8_8H.d.ts} +27 -1
- package/dist/{types-BO4iP6fG.d.cts → types-nnDR4tqA.d.cts} +27 -1
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +11 -3
- package/dist/withdraw.d.ts +11 -3
- package/dist/withdraw.mjs +5 -5
- package/package.json +33 -1
- package/dist/chunk-DMYA7U53.cjs +0 -11
- package/dist/chunk-O2TQLD4I.mjs +0 -11
package/README.md
CHANGED
|
@@ -97,6 +97,19 @@ export function DepositButton({ walletClient, publicClient, recipient }) {
|
|
|
97
97
|
}
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
Set `enableGaslessDeposit` on `DepositModal` to offer off-chain token
|
|
101
|
+
authorization on eligible cross-chain ERC-20 deposits. It defaults to `false`.
|
|
102
|
+
The processor selects ERC-3009 first, ERC-2612 second, and Permit2 third; the
|
|
103
|
+
Permit2 route is available only when the owner already approved the token to
|
|
104
|
+
Permit2. If no gasless route is available, or submission is definitively
|
|
105
|
+
rejected, the modal explicitly offers the ordinary token transfer. The backend
|
|
106
|
+
proxy must forward `/deposits/permit/prepare` and `/deposits/permit`, and the
|
|
107
|
+
processor deployment must have its global permit endpoint switch enabled.
|
|
108
|
+
Because a permit submission has no source-chain transaction at submission
|
|
109
|
+
time, it does not emit the `submitted` lifecycle event with the processor's
|
|
110
|
+
internal tracking key. Its `complete` event reports the settled source and
|
|
111
|
+
destination transaction hashes once they exist.
|
|
112
|
+
|
|
100
113
|
## Withdraw
|
|
101
114
|
|
|
102
115
|
`WithdrawModal` lives at `@rhinestone/deposit-modal/withdraw` and reports through the same `onLifecycle` + `onError` callbacks. It needs no wallet: you give it the account holding the funds and a function that performs one transfer.
|
|
@@ -143,25 +156,25 @@ import { ClaimModal } from "@rhinestone/deposit-modal/claim";
|
|
|
143
156
|
defaultTxHash={depositTxHash}
|
|
144
157
|
defaultRefundDestination={knownSelfCustodialAddress}
|
|
145
158
|
onLifecycle={(event) => console.log(event)}
|
|
146
|
-
|
|
159
|
+
/>;
|
|
147
160
|
```
|
|
148
161
|
|
|
149
162
|
### Why the user signs
|
|
150
163
|
|
|
151
164
|
Deposit accounts are owned by the Rhinestone service, so the account holding the
|
|
152
165
|
funds has no user key and cannot sign for its own refund. But the deposit's
|
|
153
|
-
`recipient` — the in-app wallet the funds were headed to —
|
|
166
|
+
`recipient` — the in-app wallet the funds were headed to — _is_ a key your user
|
|
154
167
|
holds. So that is what authorizes the recovery.
|
|
155
168
|
|
|
156
169
|
`signRecovery` is handed the exact typed data to sign plus the `signer` address the
|
|
157
170
|
processor will verify against, and returns a signature. Return whatever that
|
|
158
171
|
address's own verifier accepts:
|
|
159
172
|
|
|
160
|
-
| recipient is
|
|
161
|
-
|
|
162
|
-
| embedded EOA (Privy, Turnkey, Dynamic) | `signTypedData` — the raw 65-byte signature
|
|
163
|
-
| deployed smart account
|
|
164
|
-
| undeployed smart account
|
|
173
|
+
| recipient is | return |
|
|
174
|
+
| -------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
175
|
+
| embedded EOA (Privy, Turnkey, Dynamic) | `signTypedData` — the raw 65-byte signature |
|
|
176
|
+
| deployed smart account | a signature valid under its ERC-1271 `isValidSignature` |
|
|
177
|
+
| undeployed smart account | an ERC-6492 wrapper — `SignatureErc6492.wrap` from `ox/erc6492`, which ships with viem |
|
|
165
178
|
|
|
166
179
|
A raw owner signature is usually **not** enough for a smart account: a Safe expects
|
|
167
180
|
its own message wrapping, so go through your account SDK rather than signing the
|
|
@@ -181,7 +194,7 @@ Two properties fall out of signing that are worth knowing:
|
|
|
181
194
|
|
|
182
195
|
- **The destination is inside the signed struct.** The processor cannot pay anywhere
|
|
183
196
|
else, so the success screen states what the user signed rather than trusting the
|
|
184
|
-
endpoint to report where the money went. `defaultRefundDestination` only
|
|
197
|
+
endpoint to report where the money went. `defaultRefundDestination` only _seeds_
|
|
185
198
|
the field; whatever the user submits is what they sign.
|
|
186
199
|
- **Failures carry a structured code**, so the modal knows when a retry helps. A
|
|
187
200
|
verification outage is retryable; a rejected signature or a deposit already
|
|
@@ -248,6 +261,7 @@ The flow: user picks a fiat option → modal registers a Rhinestone smart accoun
|
|
|
248
261
|
**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>`.
|
|
249
262
|
|
|
250
263
|
**Fees.** Rhinestone does not charge a markup by default. The client (dapp) controls the user-facing experience via the orchestrator's sponsorship config:
|
|
264
|
+
|
|
251
265
|
- **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.
|
|
252
266
|
- **Unsponsored**: the bridging cost is deducted from the on-ramped amount and shown as a "Bridging cost" line on the success screen.
|
|
253
267
|
|
|
@@ -259,11 +273,11 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
259
273
|
|
|
260
274
|
**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`.
|
|
261
275
|
|
|
262
|
-
| Prop
|
|
263
|
-
|
|
|
264
|
-
| `enableFiatOnramp`
|
|
265
|
-
| `enableQrTransfer`
|
|
266
|
-
| `fiatMethods`
|
|
276
|
+
| Prop | Type | Default | Description |
|
|
277
|
+
| ------------------ | ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
278
|
+
| `enableFiatOnramp` | `boolean` | `false` | Show fiat on-ramp option(s). Requires backend Swapped keys. Needs no wallet. |
|
|
279
|
+
| `enableQrTransfer` | `boolean` | `true` | Show the Transfer Crypto / QR row. Set false for fiat-only. |
|
|
280
|
+
| `fiatMethods` | `FiatMethodsConfig` | regional | Optional exact subset of standard `payment_group`s. Providing it opts out of regional personalization; empty means none. |
|
|
267
281
|
|
|
268
282
|
## Fund from Exchange (Swapped Connect)
|
|
269
283
|
|
|
@@ -278,9 +292,9 @@ Pass `enableExchangeConnect` to expose a "Fund from Exchange" row alongside the
|
|
|
278
292
|
|
|
279
293
|
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" })`.
|
|
280
294
|
|
|
281
|
-
| Prop
|
|
282
|
-
|
|
|
283
|
-
| `enableExchangeConnect`
|
|
295
|
+
| Prop | Type | Default | Description |
|
|
296
|
+
| ----------------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
297
|
+
| `enableExchangeConnect` | `boolean` | `false` | Show the "Fund from Exchange" row. Requires backend Swapped keys. Needs no wallet. Can be combined with `enableFiatOnramp`. |
|
|
284
298
|
|
|
285
299
|
## Upgrading
|
|
286
300
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk5NUIKYSFcjs = require('./chunk-5NUIKYSF.cjs');
|
|
4
|
+
require('./chunk-CVGNCUVU.cjs');
|
|
5
|
+
require('./chunk-HOGZKHHY.cjs');
|
|
6
|
+
require('./chunk-ZMT4ATHR.cjs');
|
|
7
|
+
require('./chunk-GACIGCSN.cjs');
|
|
8
|
+
require('./chunk-4KCSH4T3.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.ClaimModal = _chunk5NUIKYSFcjs.ClaimModal;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-DSIZNRWA.mjs";
|
|
4
|
+
import "./chunk-COCBCQQC.mjs";
|
|
5
|
+
import "./chunk-XYJFEN5D.mjs";
|
|
6
6
|
import {
|
|
7
|
+
followSystemAppearance,
|
|
7
8
|
isUnsupportedChainSwitchError,
|
|
8
9
|
peekRuntimeChains,
|
|
9
10
|
primeRuntimeChains,
|
|
11
|
+
resolveThemeMode,
|
|
10
12
|
rpcUrlFor,
|
|
11
13
|
useStableRpcUrls
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-EOMT5LKX.mjs";
|
|
15
|
+
import "./chunk-FZ5FZFIG.mjs";
|
|
16
|
+
import "./chunk-RN5VKWI6.mjs";
|
|
15
17
|
import {
|
|
16
|
-
|
|
18
|
+
SUPPORTED_CHAIN_IDS,
|
|
17
19
|
getChainName
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VUATPOWJ.mjs";
|
|
19
21
|
|
|
20
22
|
// src/DepositModalReown.tsx
|
|
21
23
|
import { useCallback, useMemo as useMemo2 } from "react";
|
|
@@ -72,11 +74,11 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
72
74
|
[katana.id]: katana,
|
|
73
75
|
[hyperEvm.id]: hyperEvm
|
|
74
76
|
};
|
|
75
|
-
var EVM_NETWORKS =
|
|
76
|
-
const network = APPKIT_NETWORK_BY_ID[
|
|
77
|
+
var EVM_NETWORKS = SUPPORTED_CHAIN_IDS.map((chainId) => {
|
|
78
|
+
const network = APPKIT_NETWORK_BY_ID[chainId];
|
|
77
79
|
if (!network) {
|
|
78
80
|
throw new Error(
|
|
79
|
-
`[rhinestone] No AppKit network registered for supported chain ${
|
|
81
|
+
`[rhinestone] No AppKit network registered for supported chain ${chainId}. Add it to APPKIT_NETWORK_BY_ID in reown-networks.ts.`
|
|
80
82
|
);
|
|
81
83
|
}
|
|
82
84
|
return network;
|
|
@@ -85,6 +87,23 @@ function getAppKitNetwork(chainId) {
|
|
|
85
87
|
return APPKIT_NETWORK_BY_ID[chainId];
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
// src/core/reown-theme.ts
|
|
91
|
+
function mapTheme(theme) {
|
|
92
|
+
const themeMode = resolveThemeMode(theme?.mode) === "light" ? "light" : "dark";
|
|
93
|
+
const themeVariables = {
|
|
94
|
+
"--apkt-accent": theme?.ctaColor
|
|
95
|
+
};
|
|
96
|
+
return { themeMode, themeVariables };
|
|
97
|
+
}
|
|
98
|
+
function setAppKitTheme(appKit, theme) {
|
|
99
|
+
const { themeMode, themeVariables } = mapTheme(theme);
|
|
100
|
+
try {
|
|
101
|
+
appKit?.setThemeMode(themeMode);
|
|
102
|
+
appKit?.setThemeVariables(themeVariables);
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
88
107
|
// src/core/reown.tsx
|
|
89
108
|
import { jsx } from "react/jsx-runtime";
|
|
90
109
|
function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
@@ -105,14 +124,6 @@ var cachedAdapter = null;
|
|
|
105
124
|
var cachedAdapterKey = null;
|
|
106
125
|
var wagmiConfiguredEvmIds = /* @__PURE__ */ new Set();
|
|
107
126
|
var runtimeNetworkById = /* @__PURE__ */ new Map();
|
|
108
|
-
function mapTheme(theme) {
|
|
109
|
-
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
110
|
-
const themeVariables = {};
|
|
111
|
-
if (theme?.ctaColor) {
|
|
112
|
-
themeVariables["--apkt-accent"] = theme.ctaColor;
|
|
113
|
-
}
|
|
114
|
-
return { themeMode, themeVariables };
|
|
115
|
-
}
|
|
116
127
|
function mergeNetworks(runtime) {
|
|
117
128
|
const byId = /* @__PURE__ */ new Map();
|
|
118
129
|
for (const network of EVM_NETWORKS) byId.set(Number(network.id), network);
|
|
@@ -203,6 +214,13 @@ function ReownWalletProvider({
|
|
|
203
214
|
active = false;
|
|
204
215
|
};
|
|
205
216
|
}, [backendUrl, overrides]);
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
setAppKitTheme(modal, theme);
|
|
219
|
+
return followSystemAppearance(
|
|
220
|
+
theme?.mode,
|
|
221
|
+
() => setAppKitTheme(modal, theme)
|
|
222
|
+
);
|
|
223
|
+
}, [theme, state.ready]);
|
|
206
224
|
if (!state.ready) return null;
|
|
207
225
|
const runtimeChains = state.chains;
|
|
208
226
|
const adapter = getOrCreateAdapter(
|
|
@@ -215,7 +233,7 @@ function ReownWalletProvider({
|
|
|
215
233
|
const config = adapter.wagmiConfig;
|
|
216
234
|
return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
217
235
|
}
|
|
218
|
-
function
|
|
236
|
+
function useReownWalletSession() {
|
|
219
237
|
const { open } = useAppKit();
|
|
220
238
|
const { address, isConnected, caipAddress } = useAppKitAccount();
|
|
221
239
|
const { initialized, loading } = useAppKitState();
|
|
@@ -232,6 +250,10 @@ function useReownWallet() {
|
|
|
232
250
|
address: isSolana ? void 0 : address,
|
|
233
251
|
caipAddress,
|
|
234
252
|
isConnected,
|
|
253
|
+
// wagmi resolves the client a beat after the account, so this is false in
|
|
254
|
+
// that window — which is the behaviour the picker already had, now stated
|
|
255
|
+
// here rather than inferred from the client's presence by the picker.
|
|
256
|
+
canSignEvm: !isSolana && Boolean(walletClient),
|
|
235
257
|
isReady: initialized && !loading,
|
|
236
258
|
icon: walletInfo?.icon,
|
|
237
259
|
isSolana,
|
|
@@ -274,7 +296,7 @@ import { useAppKitProvider } from "@reown/appkit/react";
|
|
|
274
296
|
import { useAppKitConnection } from "@reown/appkit-adapter-solana/react";
|
|
275
297
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
276
298
|
function DepositModalWithReown(props) {
|
|
277
|
-
const reown =
|
|
299
|
+
const reown = useReownWalletSession();
|
|
278
300
|
const { walletProvider: solanaWalletProvider } = useAppKitProvider("solana");
|
|
279
301
|
const { connection: solanaConnection } = useAppKitConnection();
|
|
280
302
|
const reownWithSolana = useMemo2(
|
|
@@ -295,7 +317,7 @@ function DepositModalWithReown(props) {
|
|
|
295
317
|
DepositModalInner,
|
|
296
318
|
{
|
|
297
319
|
...props,
|
|
298
|
-
|
|
320
|
+
walletSession: reownWithSolana,
|
|
299
321
|
onConnect: handleConnect,
|
|
300
322
|
onDisconnect: handleDisconnect
|
|
301
323
|
}
|
|
@@ -1,21 +1,23 @@
|
|
|
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
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunk2G2EIN4Acjs = require('./chunk-2G2EIN4A.cjs');
|
|
4
|
+
require('./chunk-RAADLTSW.cjs');
|
|
5
|
+
require('./chunk-HOGZKHHY.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunk65MLWUQDcjs = require('./chunk-65MLWUQD.cjs');
|
|
13
|
-
require('./chunk-DMYA7U53.cjs');
|
|
14
|
-
require('./chunk-75DVGSAX.cjs');
|
|
15
12
|
|
|
16
13
|
|
|
14
|
+
var _chunkZMT4ATHRcjs = require('./chunk-ZMT4ATHR.cjs');
|
|
15
|
+
require('./chunk-GACIGCSN.cjs');
|
|
16
|
+
require('./chunk-DW2EQA2U.cjs');
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunk4KCSH4T3cjs = require('./chunk-4KCSH4T3.cjs');
|
|
19
21
|
|
|
20
22
|
// src/DepositModalReown.tsx
|
|
21
23
|
var _react = require('react');
|
|
@@ -72,11 +74,11 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
72
74
|
[_networks.katana.id]: _networks.katana,
|
|
73
75
|
[_networks.hyperEvm.id]: _networks.hyperEvm
|
|
74
76
|
};
|
|
75
|
-
var EVM_NETWORKS =
|
|
76
|
-
const network = APPKIT_NETWORK_BY_ID[
|
|
77
|
+
var EVM_NETWORKS = _chunk4KCSH4T3cjs.SUPPORTED_CHAIN_IDS.map((chainId) => {
|
|
78
|
+
const network = APPKIT_NETWORK_BY_ID[chainId];
|
|
77
79
|
if (!network) {
|
|
78
80
|
throw new Error(
|
|
79
|
-
`[rhinestone] No AppKit network registered for supported chain ${
|
|
81
|
+
`[rhinestone] No AppKit network registered for supported chain ${chainId}. Add it to APPKIT_NETWORK_BY_ID in reown-networks.ts.`
|
|
80
82
|
);
|
|
81
83
|
}
|
|
82
84
|
return network;
|
|
@@ -85,34 +87,43 @@ function getAppKitNetwork(chainId) {
|
|
|
85
87
|
return APPKIT_NETWORK_BY_ID[chainId];
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
// src/core/reown-theme.ts
|
|
91
|
+
function mapTheme(theme) {
|
|
92
|
+
const themeMode = _chunkZMT4ATHRcjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
|
|
93
|
+
const themeVariables = {
|
|
94
|
+
"--apkt-accent": _optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])
|
|
95
|
+
};
|
|
96
|
+
return { themeMode, themeVariables };
|
|
97
|
+
}
|
|
98
|
+
function setAppKitTheme(appKit, theme) {
|
|
99
|
+
const { themeMode, themeVariables } = mapTheme(theme);
|
|
100
|
+
try {
|
|
101
|
+
_optionalChain([appKit, 'optionalAccess', _3 => _3.setThemeMode, 'call', _4 => _4(themeMode)]);
|
|
102
|
+
_optionalChain([appKit, 'optionalAccess', _5 => _5.setThemeVariables, 'call', _6 => _6(themeVariables)]);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
88
107
|
// src/core/reown.tsx
|
|
89
108
|
var _jsxruntime = require('react/jsx-runtime');
|
|
90
109
|
function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
91
110
|
const transports = {};
|
|
92
111
|
for (const network of networks) {
|
|
93
112
|
const id = Number(network.id);
|
|
94
|
-
transports[id] = _viem.http.call(void 0,
|
|
113
|
+
transports[id] = _viem.http.call(void 0, _chunkZMT4ATHRcjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
95
114
|
}
|
|
96
115
|
return transports;
|
|
97
116
|
}
|
|
98
117
|
function getEvmRpcFingerprint(rpcUrls, networks) {
|
|
99
118
|
return networks.map((network) => {
|
|
100
119
|
const id = Number(network.id);
|
|
101
|
-
return `${id}=${_nullishCoalesce(
|
|
120
|
+
return `${id}=${_nullishCoalesce(_chunkZMT4ATHRcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
102
121
|
}).join("|");
|
|
103
122
|
}
|
|
104
123
|
var cachedAdapter = null;
|
|
105
124
|
var cachedAdapterKey = null;
|
|
106
125
|
var wagmiConfiguredEvmIds = /* @__PURE__ */ new Set();
|
|
107
126
|
var runtimeNetworkById = /* @__PURE__ */ new Map();
|
|
108
|
-
function mapTheme(theme) {
|
|
109
|
-
const themeMode = _optionalChain([theme, 'optionalAccess', _ => _.mode]) === "light" ? "light" : "dark";
|
|
110
|
-
const themeVariables = {};
|
|
111
|
-
if (_optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])) {
|
|
112
|
-
themeVariables["--apkt-accent"] = theme.ctaColor;
|
|
113
|
-
}
|
|
114
|
-
return { themeMode, themeVariables };
|
|
115
|
-
}
|
|
116
127
|
function mergeNetworks(runtime) {
|
|
117
128
|
const byId = /* @__PURE__ */ new Map();
|
|
118
129
|
for (const network of EVM_NETWORKS) byId.set(Number(network.id), network);
|
|
@@ -156,7 +167,7 @@ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls, runtimeChai
|
|
|
156
167
|
runtimeNetworkById.set(chain.id, chain);
|
|
157
168
|
try {
|
|
158
169
|
appKit.addNetwork("eip155", chain);
|
|
159
|
-
} catch (
|
|
170
|
+
} catch (e2) {
|
|
160
171
|
}
|
|
161
172
|
}
|
|
162
173
|
return cachedAdapter;
|
|
@@ -164,7 +175,7 @@ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls, runtimeChai
|
|
|
164
175
|
function chainDisplayName(chainId) {
|
|
165
176
|
const runtime = runtimeNetworkById.get(chainId);
|
|
166
177
|
if (runtime) return runtime.name;
|
|
167
|
-
return
|
|
178
|
+
return _chunk4KCSH4T3cjs.getChainName.call(void 0, chainId);
|
|
168
179
|
}
|
|
169
180
|
function resolveAppKitNetwork(chainId) {
|
|
170
181
|
return _nullishCoalesce(getAppKitNetwork(chainId), () => ( runtimeNetworkById.get(chainId)));
|
|
@@ -177,7 +188,7 @@ function ReownWalletProvider({
|
|
|
177
188
|
backendUrl,
|
|
178
189
|
children
|
|
179
190
|
}) {
|
|
180
|
-
const rpcUrls =
|
|
191
|
+
const rpcUrls = _chunkZMT4ATHRcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
181
192
|
const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
|
|
182
193
|
const overrides = _react.useMemo.call(void 0, () => {
|
|
183
194
|
if (!rpcUrls) return void 0;
|
|
@@ -189,20 +200,27 @@ function ReownWalletProvider({
|
|
|
189
200
|
return out;
|
|
190
201
|
}, [rpcUrls]);
|
|
191
202
|
const [state, setState] = _react.useState.call(void 0, () => {
|
|
192
|
-
const primed =
|
|
203
|
+
const primed = _chunkZMT4ATHRcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
193
204
|
return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
|
|
194
205
|
});
|
|
195
206
|
_react.useEffect.call(void 0, () => {
|
|
196
207
|
let active = true;
|
|
197
|
-
const primed =
|
|
208
|
+
const primed = _chunkZMT4ATHRcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
198
209
|
setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
|
|
199
|
-
|
|
210
|
+
_chunkZMT4ATHRcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
|
|
200
211
|
if (active) setState({ ready: true, chains });
|
|
201
212
|
});
|
|
202
213
|
return () => {
|
|
203
214
|
active = false;
|
|
204
215
|
};
|
|
205
216
|
}, [backendUrl, overrides]);
|
|
217
|
+
_react.useEffect.call(void 0, () => {
|
|
218
|
+
setAppKitTheme(_react3.modal, theme);
|
|
219
|
+
return _chunkZMT4ATHRcjs.followSystemAppearance.call(void 0,
|
|
220
|
+
_optionalChain([theme, 'optionalAccess', _7 => _7.mode]),
|
|
221
|
+
() => setAppKitTheme(_react3.modal, theme)
|
|
222
|
+
);
|
|
223
|
+
}, [theme, state.ready]);
|
|
206
224
|
if (!state.ready) return null;
|
|
207
225
|
const runtimeChains = state.chains;
|
|
208
226
|
const adapter = getOrCreateAdapter(
|
|
@@ -215,7 +233,7 @@ function ReownWalletProvider({
|
|
|
215
233
|
const config = adapter.wagmiConfig;
|
|
216
234
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
|
|
217
235
|
}
|
|
218
|
-
function
|
|
236
|
+
function useReownWalletSession() {
|
|
219
237
|
const { open } = _react3.useAppKit.call(void 0, );
|
|
220
238
|
const { address, isConnected, caipAddress } = _react3.useAppKitAccount.call(void 0, );
|
|
221
239
|
const { initialized, loading } = _react3.useAppKitState.call(void 0, );
|
|
@@ -224,16 +242,20 @@ function useReownWallet() {
|
|
|
224
242
|
const publicClient = _wagmi.usePublicClient.call(void 0, );
|
|
225
243
|
const { switchNetwork } = _react3.useAppKitNetwork.call(void 0, );
|
|
226
244
|
const { switchChainAsync } = _wagmi.useSwitchChain.call(void 0, );
|
|
227
|
-
const isSolana = _nullishCoalesce(_optionalChain([caipAddress, 'optionalAccess',
|
|
228
|
-
const solanaAddress = isSolana ? _optionalChain([caipAddress, 'optionalAccess',
|
|
245
|
+
const isSolana = _nullishCoalesce(_optionalChain([caipAddress, 'optionalAccess', _8 => _8.startsWith, 'call', _9 => _9("solana:")]), () => ( false));
|
|
246
|
+
const solanaAddress = isSolana ? _optionalChain([caipAddress, 'optionalAccess', _10 => _10.split, 'call', _11 => _11(":"), 'access', _12 => _12.slice, 'call', _13 => _13(2), 'access', _14 => _14.join, 'call', _15 => _15(":")]) : void 0;
|
|
229
247
|
return {
|
|
230
248
|
walletClient: isSolana ? void 0 : _nullishCoalesce(walletClient, () => ( void 0)),
|
|
231
249
|
publicClient: isSolana ? void 0 : _nullishCoalesce(publicClient, () => ( void 0)),
|
|
232
250
|
address: isSolana ? void 0 : address,
|
|
233
251
|
caipAddress,
|
|
234
252
|
isConnected,
|
|
253
|
+
// wagmi resolves the client a beat after the account, so this is false in
|
|
254
|
+
// that window — which is the behaviour the picker already had, now stated
|
|
255
|
+
// here rather than inferred from the client's presence by the picker.
|
|
256
|
+
canSignEvm: !isSolana && Boolean(walletClient),
|
|
235
257
|
isReady: initialized && !loading,
|
|
236
|
-
icon: _optionalChain([walletInfo, 'optionalAccess',
|
|
258
|
+
icon: _optionalChain([walletInfo, 'optionalAccess', _16 => _16.icon]),
|
|
237
259
|
isSolana,
|
|
238
260
|
solanaAddress,
|
|
239
261
|
solanaProvider: void 0,
|
|
@@ -242,7 +264,7 @@ function useReownWallet() {
|
|
|
242
264
|
void open({ view: "Connect" });
|
|
243
265
|
},
|
|
244
266
|
disconnect: () => {
|
|
245
|
-
void _optionalChain([_react3.modal, 'optionalAccess',
|
|
267
|
+
void _optionalChain([_react3.modal, 'optionalAccess', _17 => _17.disconnect, 'call', _18 => _18()]);
|
|
246
268
|
},
|
|
247
269
|
switchChain: async (chainId) => {
|
|
248
270
|
if (!wagmiConfiguredEvmIds.has(chainId)) {
|
|
@@ -258,7 +280,7 @@ function useReownWallet() {
|
|
|
258
280
|
await switchChainAsync({ chainId });
|
|
259
281
|
}
|
|
260
282
|
} catch (err) {
|
|
261
|
-
if (
|
|
283
|
+
if (_chunkZMT4ATHRcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
262
284
|
throw new Error(
|
|
263
285
|
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
264
286
|
);
|
|
@@ -274,7 +296,7 @@ function useReownWallet() {
|
|
|
274
296
|
var _react5 = require('@reown/appkit-adapter-solana/react');
|
|
275
297
|
|
|
276
298
|
function DepositModalWithReown(props) {
|
|
277
|
-
const reown =
|
|
299
|
+
const reown = useReownWalletSession();
|
|
278
300
|
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0, "solana");
|
|
279
301
|
const { connection: solanaConnection } = _react5.useAppKitConnection.call(void 0, );
|
|
280
302
|
const reownWithSolana = _react.useMemo.call(void 0,
|
|
@@ -292,10 +314,10 @@ function DepositModalWithReown(props) {
|
|
|
292
314
|
reown.disconnect();
|
|
293
315
|
}, [reown.disconnect]);
|
|
294
316
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
295
|
-
|
|
317
|
+
_chunk2G2EIN4Acjs.DepositModalInner,
|
|
296
318
|
{
|
|
297
319
|
...props,
|
|
298
|
-
|
|
320
|
+
walletSession: reownWithSolana,
|
|
299
321
|
onConnect: handleConnect,
|
|
300
322
|
onDisconnect: handleDisconnect
|
|
301
323
|
}
|
|
@@ -22,7 +22,7 @@ function QRCode({ value, size = 200, iconSrc, className }) {
|
|
|
22
22
|
if (!node) return;
|
|
23
23
|
const sync = () => setColors(resolveSurfaceColor(node));
|
|
24
24
|
sync();
|
|
25
|
-
const themed = node.closest("[data-theme]");
|
|
25
|
+
const themed = node.closest(".rs-modal") ?? node.closest("[data-theme]");
|
|
26
26
|
if (!themed) return;
|
|
27
27
|
const observer = new MutationObserver(sync);
|
|
28
28
|
observer.observe(themed, {
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/ui/QRCode.tsx
|
|
2
2
|
var _react = require('react');
|
|
3
3
|
var _reactqrcodelogo = require('react-qrcode-logo');
|
|
4
4
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -22,7 +22,7 @@ function QRCode({ value, size = 200, iconSrc, className }) {
|
|
|
22
22
|
if (!node) return;
|
|
23
23
|
const sync = () => setColors(resolveSurfaceColor(node));
|
|
24
24
|
sync();
|
|
25
|
-
const themed = node.closest("[data-theme]");
|
|
25
|
+
const themed = _nullishCoalesce(node.closest(".rs-modal"), () => ( node.closest("[data-theme]")));
|
|
26
26
|
if (!themed) return;
|
|
27
27
|
const observer = new MutationObserver(sync);
|
|
28
28
|
observer.observe(themed, {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk7N77GIP4cjs = require('./chunk-7N77GIP4.cjs');
|
|
4
|
+
require('./chunk-RAADLTSW.cjs');
|
|
5
|
+
require('./chunk-ZMT4ATHR.cjs');
|
|
6
|
+
require('./chunk-GACIGCSN.cjs');
|
|
7
|
+
require('./chunk-4KCSH4T3.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.WithdrawModal = _chunk7N77GIP4cjs.WithdrawModal;
|