@rhinestone/deposit-modal 0.8.1 → 0.9.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 +193 -29
- package/dist/{chunk-2JPB3PLB.mjs → DepositModalReown-6KUAO5ZC.mjs} +56 -4
- package/dist/{chunk-Q3W53BKR.cjs → DepositModalReown-XC5RIU7Z.cjs} +62 -10
- package/dist/{caip-C_ZYFIGa.d.cts → caip-523Zrc3r.d.cts} +1 -3
- package/dist/{caip-C_ZYFIGa.d.ts → caip-523Zrc3r.d.ts} +1 -3
- package/dist/{chunk-D3Y7ZBED.cjs → chunk-22RV33LK.cjs} +2170 -1460
- package/dist/chunk-4WB2FHGC.mjs +865 -0
- package/dist/chunk-A223BLVC.mjs +801 -0
- package/dist/{chunk-HQWZCOMS.cjs → chunk-DIX7M3SP.cjs} +232 -601
- package/dist/{chunk-T43VUEJH.mjs → chunk-E4G5BOZP.mjs} +167 -536
- package/dist/chunk-H577RJN5.cjs +801 -0
- package/dist/{chunk-DABKCJVL.mjs → chunk-ILT2PITN.mjs} +60 -3
- package/dist/{chunk-7KHEIMWD.mjs → chunk-KKHLNFSA.mjs} +2436 -1726
- package/dist/chunk-LGVJWVSS.mjs +81 -0
- package/dist/chunk-NEXUCY4B.cjs +11 -0
- package/dist/chunk-NMIMRASD.cjs +1785 -0
- package/dist/chunk-OSI2CFGL.mjs +11 -0
- package/dist/chunk-PAGMU4RQ.cjs +865 -0
- package/dist/chunk-T7LGQFP3.cjs +81 -0
- package/dist/chunk-VN4BLZYC.cjs +2273 -0
- package/dist/chunk-VOGZAZB2.mjs +2273 -0
- package/dist/chunk-WYXBY2MQ.mjs +1785 -0
- package/dist/{chunk-4NN7UTWQ.cjs → chunk-YEBXUUH3.cjs} +63 -6
- package/dist/claim.cjs +10 -0
- package/dist/claim.d.cts +8 -0
- package/dist/claim.d.ts +8 -0
- package/dist/claim.mjs +10 -0
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +4 -2
- package/dist/constants.d.ts +4 -2
- package/dist/constants.mjs +5 -5
- package/dist/deposit.cjs +8 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +7 -5
- package/dist/index.cjs +22 -12
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.mjs +21 -11
- package/dist/polymarket.cjs +5 -6
- package/dist/polymarket.mjs +2 -3
- package/dist/server.cjs +96 -0
- package/dist/server.d.cts +65 -0
- package/dist/server.d.ts +65 -0
- package/dist/server.mjs +96 -0
- package/dist/styles.css +263 -12
- package/dist/types-C0SGf-21.d.cts +606 -0
- package/dist/types-C0SGf-21.d.ts +606 -0
- package/dist/withdraw.cjs +6 -5
- package/dist/withdraw.d.cts +3 -6
- package/dist/withdraw.d.ts +3 -6
- package/dist/withdraw.mjs +5 -4
- package/package.json +53 -6
- package/dist/DepositModalReown-4BSHOQ5Y.mjs +0 -63
- package/dist/DepositModalReown-UND3DEJH.cjs +0 -63
- package/dist/WithdrawModalReown-FVXSSGY5.mjs +0 -46
- package/dist/WithdrawModalReown-TVZWJKQI.cjs +0 -46
- package/dist/chunk-7OKA6GNA.cjs +0 -4537
- package/dist/chunk-NASHLEVQ.mjs +0 -4537
- package/dist/chunk-O5OKA27M.mjs +0 -800
- package/dist/chunk-U7SVYWVD.cjs +0 -800
- package/dist/chunk-WK5AFRSP.mjs +0 -295
- package/dist/chunk-XRWQMIBY.cjs +0 -295
- package/dist/types--LQWg_4W.d.cts +0 -468
- package/dist/types--LQWg_4W.d.ts +0 -468
package/README.md
CHANGED
|
@@ -2,12 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
React modal for cross-chain deposits and withdrawals via Rhinestone smart accounts.
|
|
4
4
|
|
|
5
|
+
**[Documentation](https://docs.rhinestone.dev/deposits/widget/quickstart)** ·
|
|
6
|
+
[Deposit modal](https://docs.rhinestone.dev/deposits/widget/deposit-modal) ·
|
|
7
|
+
[Withdraw modal](https://docs.rhinestone.dev/deposits/widget/withdraw-modal) ·
|
|
8
|
+
[Claim modal](https://docs.rhinestone.dev/deposits/widget/claim-modal) ·
|
|
9
|
+
[Backend proxy](https://docs.rhinestone.dev/deposits/widget/backend) ·
|
|
10
|
+
[Migration guide](https://docs.rhinestone.dev/deposits/widget/migration)
|
|
11
|
+
|
|
12
|
+
This README covers the common integrations. The full props reference lives in the
|
|
13
|
+
docs.
|
|
14
|
+
|
|
5
15
|
## Install
|
|
6
16
|
|
|
7
17
|
```bash
|
|
8
|
-
npm install @rhinestone/deposit-modal viem
|
|
18
|
+
npm install @rhinestone/deposit-modal viem wagmi @tanstack/react-query
|
|
9
19
|
```
|
|
10
20
|
|
|
21
|
+
Add Reown only if you want the modal to connect the wallet itself — these are
|
|
22
|
+
optional peers, so skip them when you pass your own `walletClient` or run a flow
|
|
23
|
+
with no wallet:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @reown/appkit @reown/appkit-adapter-wagmi
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For Solana sources or destinations:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @reown/appkit-adapter-solana @solana/web3.js @solana/spl-token
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Content Security Policy
|
|
36
|
+
|
|
37
|
+
Every logo the modal renders — chain, token, exchange, card-network, wallet and
|
|
38
|
+
dapp marks — is served from Rhinestone's public asset CDN. **A host with an
|
|
39
|
+
explicit `img-src` policy must allow it:**
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
img-src 'self' data: https://s3.rhinestone.dev;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Omit this and icons render blank — image loads fail silently, so there is no
|
|
46
|
+
console error pointing at the CSP. Hosts without an explicit `img-src` (or with
|
|
47
|
+
`img-src *`) need no change.
|
|
48
|
+
|
|
49
|
+
> Before v0.9 these marks were inlined as `data:` URIs, so `data:` alone was
|
|
50
|
+
> sufficient. They now come from the CDN, which drops ~20 kB (brotli) from the
|
|
51
|
+
> bundle and gives every Rhinestone surface one source of truth.
|
|
52
|
+
|
|
11
53
|
## Example
|
|
12
54
|
|
|
13
55
|
```tsx
|
|
@@ -15,7 +57,7 @@ import { useState } from "react";
|
|
|
15
57
|
import { DepositModal } from "@rhinestone/deposit-modal/deposit";
|
|
16
58
|
import "@rhinestone/deposit-modal/styles.css";
|
|
17
59
|
|
|
18
|
-
export function DepositButton({ walletClient, publicClient,
|
|
60
|
+
export function DepositButton({ walletClient, publicClient, recipient }) {
|
|
19
61
|
const [open, setOpen] = useState(false);
|
|
20
62
|
|
|
21
63
|
return (
|
|
@@ -24,9 +66,13 @@ export function DepositButton({ walletClient, publicClient, address }) {
|
|
|
24
66
|
<DepositModal
|
|
25
67
|
isOpen={open}
|
|
26
68
|
onClose={() => setOpen(false)}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
69
|
+
walletClient={walletClient}
|
|
70
|
+
publicClient={publicClient}
|
|
71
|
+
recipient={recipient}
|
|
72
|
+
// Required. A proxy you control that holds your Rhinestone API key and
|
|
73
|
+
// forwards to the deposit processor — the modal runs in the browser and
|
|
74
|
+
// cannot hold the key itself.
|
|
75
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
30
76
|
targetChain={8453}
|
|
31
77
|
targetToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
32
78
|
onLifecycle={(event) => {
|
|
@@ -51,7 +97,122 @@ export function DepositButton({ walletClient, publicClient, address }) {
|
|
|
51
97
|
}
|
|
52
98
|
```
|
|
53
99
|
|
|
54
|
-
|
|
100
|
+
## Withdraw
|
|
101
|
+
|
|
102
|
+
`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.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { WithdrawModal } from "@rhinestone/deposit-modal/withdraw";
|
|
106
|
+
|
|
107
|
+
<WithdrawModal
|
|
108
|
+
isOpen={open}
|
|
109
|
+
onClose={() => setOpen(false)}
|
|
110
|
+
accountAddress={userWallet}
|
|
111
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
112
|
+
sourceChain={137}
|
|
113
|
+
sourceToken={USDC_POLYGON}
|
|
114
|
+
targetChain={8453}
|
|
115
|
+
targetToken={USDC_BASE}
|
|
116
|
+
onSendTransaction={async ({ chainId, token, amount, to }) => ({
|
|
117
|
+
txHash: await myWallet.sendTransfer({ chainId, token, amount, to }),
|
|
118
|
+
})}
|
|
119
|
+
onLifecycle={(event) => console.log(event)}
|
|
120
|
+
/>;
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The user picks the destination chain, token, recipient, and amount in the modal; you move the funds. Two rules:
|
|
124
|
+
|
|
125
|
+
- **Send to `to`.** It's the Rhinestone deposit account the processor watches and bridges on to the recipient — except on a same-route withdrawal (source chain and token identical to the target), where the modal skips the bridge and `to` is the recipient itself. Never substitute an address of your own.
|
|
126
|
+
- **Return the on-chain transaction hash**, not a userOp hash. The modal tracks progress by looking the deposit up by that hash. Reject the promise to surface a failure.
|
|
127
|
+
|
|
128
|
+
## Claim a failed deposit
|
|
129
|
+
|
|
130
|
+
`ClaimModal` lets a user get a failed or rejected EVM deposit sent back to them on its source chain. They paste the deposit's transaction hash and name a destination, and there is no chain to pick: the hash is looked up across every chain, including ones the deposit flow itself doesn't list.
|
|
131
|
+
|
|
132
|
+
**The modal never runs a connect step** — it has no wallet UI and asks for no provider. It does need a signature from the deposit's `recipient`, which it requests through `signRecovery` using whatever wallet your app already holds for that user. For an embedded wallet that is headless and the user sees nothing but the confirmation your own SDK shows.
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { ClaimModal } from "@rhinestone/deposit-modal/claim";
|
|
136
|
+
|
|
137
|
+
<ClaimModal
|
|
138
|
+
isOpen={claimOpen}
|
|
139
|
+
onClose={() => setClaimOpen(false)}
|
|
140
|
+
signRecovery={({ typedData }) => wallet.signTypedData(typedData)}
|
|
141
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
142
|
+
// Optional prefills:
|
|
143
|
+
defaultTxHash={depositTxHash}
|
|
144
|
+
defaultRefundDestination={knownSelfCustodialAddress}
|
|
145
|
+
onLifecycle={(event) => console.log(event)}
|
|
146
|
+
/>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Why the user signs
|
|
150
|
+
|
|
151
|
+
Deposit accounts are owned by the Rhinestone service, so the account holding the
|
|
152
|
+
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 — *is* a key your user
|
|
154
|
+
holds. So that is what authorizes the recovery.
|
|
155
|
+
|
|
156
|
+
`signRecovery` is handed the exact typed data to sign plus the `signer` address the
|
|
157
|
+
processor will verify against, and returns a signature. Return whatever that
|
|
158
|
+
address's own verifier accepts:
|
|
159
|
+
|
|
160
|
+
| recipient is | return |
|
|
161
|
+
|---|---|
|
|
162
|
+
| embedded EOA (Privy, Turnkey, Dynamic) | `signTypedData` — the raw 65-byte signature |
|
|
163
|
+
| deployed smart account | a signature valid under its ERC-1271 `isValidSignature` |
|
|
164
|
+
| undeployed smart account | an ERC-6492 wrapper — `SignatureErc6492.wrap` from `ox/erc6492`, which ships with viem |
|
|
165
|
+
|
|
166
|
+
A raw owner signature is usually **not** enough for a smart account: a Safe expects
|
|
167
|
+
its own message wrapping, so go through your account SDK rather than signing the
|
|
168
|
+
struct directly with the owner key.
|
|
169
|
+
|
|
170
|
+
Your app needs no backend and no shared secret for any of this. The request goes
|
|
171
|
+
straight from the browser through your `deposit-widget-proxy`, which adds only the
|
|
172
|
+
project API key — and that key cannot move funds through this route without a valid
|
|
173
|
+
signature, so there is no privilege for a page to borrow.
|
|
174
|
+
|
|
175
|
+
**Your proxy must forward `POST /deposits/recover`**, alongside the `GET /deposits`
|
|
176
|
+
used for the lookup. Both are in the
|
|
177
|
+
[reference proxy](https://docs.rhinestone.dev/deposits/widget/backend); a proxy
|
|
178
|
+
missing the recover route 404s the claim rather than degrading.
|
|
179
|
+
|
|
180
|
+
Two properties fall out of signing that are worth knowing:
|
|
181
|
+
|
|
182
|
+
- **The destination is inside the signed struct.** The processor cannot pay anywhere
|
|
183
|
+
else, so the success screen states what the user signed rather than trusting the
|
|
184
|
+
endpoint to report where the money went. `defaultRefundDestination` only *seeds*
|
|
185
|
+
the field; whatever the user submits is what they sign.
|
|
186
|
+
- **Failures carry a structured code**, so the modal knows when a retry helps. A
|
|
187
|
+
verification outage is retryable; a rejected signature or a deposit already
|
|
188
|
+
claimed is not. HTTP status alone can't separate those.
|
|
189
|
+
|
|
190
|
+
### If your users can't sign
|
|
191
|
+
|
|
192
|
+
A lost embedded wallet, or a `recipient` your app controls rather than the user, both
|
|
193
|
+
leave nothing to sign with. `createRefundHandler` from
|
|
194
|
+
`@rhinestone/deposit-modal/server` is still exported for that case — it authorizes on
|
|
195
|
+
your say-so instead, verifying the deposit belongs to the recipient you name before
|
|
196
|
+
spending your API key:
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
// your own route, driving your own UI
|
|
200
|
+
import { createRefundHandler } from "@rhinestone/deposit-modal/server";
|
|
201
|
+
|
|
202
|
+
export const POST = createRefundHandler({
|
|
203
|
+
apiKey: process.env.RHINESTONE_API_KEY!,
|
|
204
|
+
async authorize(request) {
|
|
205
|
+
const session = await getSession(request);
|
|
206
|
+
if (!session) return null; // → 401
|
|
207
|
+
return { depositRecipient: session.depositRecipient };
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The modal does not drive this path — you'd build that UI yourself, or route the user
|
|
213
|
+
to support. Do **not** proxy `POST /deposits/refund`: unlike recover it carries no
|
|
214
|
+
proof of who is asking, so forwarding it with your API key attached would let anyone
|
|
215
|
+
return any of your recoverable deposits to an address they chose.
|
|
55
216
|
|
|
56
217
|
## Fiat on-ramp (Swapped)
|
|
57
218
|
|
|
@@ -60,22 +221,28 @@ Pass `enableFiatOnramp` to expose Swapped's iframe as a funding option alongside
|
|
|
60
221
|
```tsx
|
|
61
222
|
<DepositModal
|
|
62
223
|
enableFiatOnramp
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
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
|
-
]}
|
|
224
|
+
// Optional: restrict Cash to these standard Swapped payment groups.
|
|
225
|
+
// Omit this prop to use regional personalization. Keys are exact
|
|
226
|
+
// `payment_group` values — Apple Pay is `apple-pay`, not `applepay`.
|
|
227
|
+
// An empty or all-false object offers no fiat methods.
|
|
228
|
+
fiatMethods={{ creditcard: true, "apple-pay": true }}
|
|
73
229
|
// Hide the Transfer Crypto QR row if you only want fiat options:
|
|
74
230
|
// enableQrTransfer={false}
|
|
75
231
|
// ...
|
|
76
232
|
/>
|
|
77
233
|
```
|
|
78
234
|
|
|
235
|
+
When `fiatMethods` is omitted, the modal personalizes payment methods for the
|
|
236
|
+
user's region. One configured local favorite may appear first with a
|
|
237
|
+
**Popular** badge, followed by the supported subset of card, bank transfer, and
|
|
238
|
+
Apple Pay. Method names, icons, and EUR limits come from the regional response.
|
|
239
|
+
Personalization never blocks the flow: after 500 ms the default methods render,
|
|
240
|
+
and a later regional result only replaces an untouched picker.
|
|
241
|
+
|
|
242
|
+
Set `fiatMethods` to restrict Cash to the selected standard payment groups and
|
|
243
|
+
opt that modal instance out of regional personalization. An empty or all-false
|
|
244
|
+
object shows no Cash option.
|
|
245
|
+
|
|
79
246
|
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
247
|
|
|
81
248
|
**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>`.
|
|
@@ -94,9 +261,9 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
94
261
|
|
|
95
262
|
| Prop | Type | Default | Description |
|
|
96
263
|
| -------------------- | ----------------------------- | ------- | ----------- |
|
|
97
|
-
| `enableFiatOnramp` | `boolean` | `false` | Show fiat on-ramp option(s). Requires
|
|
264
|
+
| `enableFiatOnramp` | `boolean` | `false` | Show fiat on-ramp option(s). Requires backend Swapped keys. Needs no wallet. |
|
|
98
265
|
| `enableQrTransfer` | `boolean` | `true` | Show the Transfer Crypto / QR row. Set false for fiat-only. |
|
|
99
|
-
| `
|
|
266
|
+
| `fiatMethods` | `FiatMethodsConfig` | regional | Optional exact subset of standard `payment_group`s. Providing it opts out of regional personalization; empty means none. |
|
|
100
267
|
|
|
101
268
|
## Fund from Exchange (Swapped Connect)
|
|
102
269
|
|
|
@@ -113,21 +280,18 @@ Flow: user picks Fund from Exchange → backend returns supported exchanges + lo
|
|
|
113
280
|
|
|
114
281
|
| Prop | Type | Default | Description |
|
|
115
282
|
| ------------------------ | --------- | ------- | ----------- |
|
|
116
|
-
| `enableExchangeConnect` | `boolean` | `false` | Show the "Fund from Exchange" row. Requires
|
|
117
|
-
|
|
118
|
-
## Releasing
|
|
283
|
+
| `enableExchangeConnect` | `boolean` | `false` | Show the "Fund from Exchange" row. Requires backend Swapped keys. Needs no wallet. Can be combined with `enableFiatOnramp`. |
|
|
119
284
|
|
|
120
|
-
|
|
285
|
+
## Upgrading
|
|
121
286
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
287
|
+
Upgrading from 0.8.x is a breaking change on both modals. See
|
|
288
|
+
[`MIGRATION.md`](./MIGRATION.md), or the same guide
|
|
289
|
+
[in the docs](https://docs.rhinestone.dev/deposits/widget/migration).
|
|
125
290
|
|
|
126
|
-
|
|
291
|
+
## Contributing
|
|
127
292
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- A `release` branch and a `ship` label.
|
|
293
|
+
Local setup, the release process and where the docs live are in
|
|
294
|
+
[`CONTRIBUTING.md`](./CONTRIBUTING.md).
|
|
131
295
|
|
|
132
296
|
## License
|
|
133
297
|
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DepositModalInner
|
|
3
|
+
} from "./chunk-KKHLNFSA.mjs";
|
|
4
|
+
import "./chunk-WYXBY2MQ.mjs";
|
|
5
|
+
import "./chunk-LGVJWVSS.mjs";
|
|
1
6
|
import {
|
|
2
7
|
isUnsupportedChainSwitchError,
|
|
3
8
|
rpcUrlFor
|
|
4
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VOGZAZB2.mjs";
|
|
10
|
+
import "./chunk-OSI2CFGL.mjs";
|
|
11
|
+
import "./chunk-ILT2PITN.mjs";
|
|
5
12
|
import {
|
|
6
13
|
SUPPORTED_CHAINS,
|
|
7
14
|
getChainName
|
|
8
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-A223BLVC.mjs";
|
|
16
|
+
|
|
17
|
+
// src/DepositModalReown.tsx
|
|
18
|
+
import { useCallback, useMemo } from "react";
|
|
9
19
|
|
|
10
20
|
// src/core/reown.tsx
|
|
11
21
|
import { useState } from "react";
|
|
@@ -190,7 +200,49 @@ function useReownWallet() {
|
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
202
|
|
|
203
|
+
// src/DepositModalReown.tsx
|
|
204
|
+
import { useAppKitProvider } from "@reown/appkit/react";
|
|
205
|
+
import { useAppKitConnection } from "@reown/appkit-adapter-solana/react";
|
|
206
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
207
|
+
function DepositModalWithReown(props) {
|
|
208
|
+
const reown = useReownWallet();
|
|
209
|
+
const { walletProvider: solanaWalletProvider } = useAppKitProvider("solana");
|
|
210
|
+
const { connection: solanaConnection } = useAppKitConnection();
|
|
211
|
+
const reownWithSolana = useMemo(
|
|
212
|
+
() => ({
|
|
213
|
+
...reown,
|
|
214
|
+
solanaProvider: reown.isSolana ? solanaWalletProvider : void 0,
|
|
215
|
+
solanaConnection: reown.isSolana ? solanaConnection : void 0
|
|
216
|
+
}),
|
|
217
|
+
[reown, solanaWalletProvider, solanaConnection]
|
|
218
|
+
);
|
|
219
|
+
const handleConnect = useCallback(() => {
|
|
220
|
+
reown.openConnect();
|
|
221
|
+
}, [reown.openConnect]);
|
|
222
|
+
const handleDisconnect = useCallback(() => {
|
|
223
|
+
reown.disconnect();
|
|
224
|
+
}, [reown.disconnect]);
|
|
225
|
+
return /* @__PURE__ */ jsx2(
|
|
226
|
+
DepositModalInner,
|
|
227
|
+
{
|
|
228
|
+
...props,
|
|
229
|
+
reownWallet: reownWithSolana,
|
|
230
|
+
onConnect: handleConnect,
|
|
231
|
+
onDisconnect: handleDisconnect
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function DepositModalReown(props) {
|
|
236
|
+
return /* @__PURE__ */ jsx2(
|
|
237
|
+
ReownWalletProvider,
|
|
238
|
+
{
|
|
239
|
+
projectId: props.reownAppId,
|
|
240
|
+
theme: props.theme,
|
|
241
|
+
rpcUrls: props.rpcUrls,
|
|
242
|
+
children: /* @__PURE__ */ jsx2(DepositModalWithReown, { ...props })
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
193
246
|
export {
|
|
194
|
-
|
|
195
|
-
useReownWallet
|
|
247
|
+
DepositModalReown
|
|
196
248
|
};
|
|
@@ -1,14 +1,24 @@
|
|
|
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 _chunk22RV33LKcjs = require('./chunk-22RV33LK.cjs');
|
|
4
|
+
require('./chunk-NMIMRASD.cjs');
|
|
5
|
+
require('./chunk-T7LGQFP3.cjs');
|
|
3
6
|
|
|
4
|
-
var _chunk7OKA6GNAcjs = require('./chunk-7OKA6GNA.cjs');
|
|
5
7
|
|
|
6
8
|
|
|
9
|
+
var _chunkVN4BLZYCcjs = require('./chunk-VN4BLZYC.cjs');
|
|
10
|
+
require('./chunk-NEXUCY4B.cjs');
|
|
11
|
+
require('./chunk-YEBXUUH3.cjs');
|
|
7
12
|
|
|
8
|
-
var _chunkU7SVYWVDcjs = require('./chunk-U7SVYWVD.cjs');
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
|
|
15
|
+
var _chunkH577RJN5cjs = require('./chunk-H577RJN5.cjs');
|
|
16
|
+
|
|
17
|
+
// src/DepositModalReown.tsx
|
|
11
18
|
var _react = require('react');
|
|
19
|
+
|
|
20
|
+
// src/core/reown.tsx
|
|
21
|
+
|
|
12
22
|
var _reactquery = require('@tanstack/react-query');
|
|
13
23
|
var _appkitadapterwagmi = require('@reown/appkit-adapter-wagmi');
|
|
14
24
|
var _appkitadaptersolana = require('@reown/appkit-adapter-solana');
|
|
@@ -59,7 +69,7 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
59
69
|
[_networks.katana.id]: _networks.katana,
|
|
60
70
|
[_networks.hyperEvm.id]: _networks.hyperEvm
|
|
61
71
|
};
|
|
62
|
-
var EVM_NETWORKS =
|
|
72
|
+
var EVM_NETWORKS = _chunkH577RJN5cjs.SUPPORTED_CHAINS.map((chain) => {
|
|
63
73
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|
|
64
74
|
if (!network) {
|
|
65
75
|
throw new Error(
|
|
@@ -78,14 +88,14 @@ function buildTransports(rpcUrls) {
|
|
|
78
88
|
const transports = {};
|
|
79
89
|
for (const network of EVM_NETWORKS) {
|
|
80
90
|
const id = Number(network.id);
|
|
81
|
-
transports[id] = _viem.http.call(void 0,
|
|
91
|
+
transports[id] = _viem.http.call(void 0, _chunkVN4BLZYCcjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
82
92
|
}
|
|
83
93
|
return transports;
|
|
84
94
|
}
|
|
85
95
|
function getEvmRpcFingerprint(rpcUrls) {
|
|
86
96
|
return EVM_NETWORKS.map((network) => {
|
|
87
97
|
const id = Number(network.id);
|
|
88
|
-
return `${id}=${_nullishCoalesce(
|
|
98
|
+
return `${id}=${_nullishCoalesce(_chunkVN4BLZYCcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
89
99
|
}).join("|");
|
|
90
100
|
}
|
|
91
101
|
var cachedAdapter = null;
|
|
@@ -179,9 +189,9 @@ function useReownWallet() {
|
|
|
179
189
|
await switchChainAsync({ chainId });
|
|
180
190
|
}
|
|
181
191
|
} catch (err) {
|
|
182
|
-
if (
|
|
192
|
+
if (_chunkVN4BLZYCcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
183
193
|
throw new Error(
|
|
184
|
-
`Switch to ${
|
|
194
|
+
`Switch to ${_chunkH577RJN5cjs.getChainName.call(void 0, chainId)} in your wallet to continue`
|
|
185
195
|
);
|
|
186
196
|
}
|
|
187
197
|
throw err;
|
|
@@ -190,7 +200,49 @@ function useReownWallet() {
|
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
202
|
|
|
203
|
+
// src/DepositModalReown.tsx
|
|
204
|
+
|
|
205
|
+
var _react5 = require('@reown/appkit-adapter-solana/react');
|
|
206
|
+
|
|
207
|
+
function DepositModalWithReown(props) {
|
|
208
|
+
const reown = useReownWallet();
|
|
209
|
+
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0, "solana");
|
|
210
|
+
const { connection: solanaConnection } = _react5.useAppKitConnection.call(void 0, );
|
|
211
|
+
const reownWithSolana = _react.useMemo.call(void 0,
|
|
212
|
+
() => ({
|
|
213
|
+
...reown,
|
|
214
|
+
solanaProvider: reown.isSolana ? solanaWalletProvider : void 0,
|
|
215
|
+
solanaConnection: reown.isSolana ? solanaConnection : void 0
|
|
216
|
+
}),
|
|
217
|
+
[reown, solanaWalletProvider, solanaConnection]
|
|
218
|
+
);
|
|
219
|
+
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
220
|
+
reown.openConnect();
|
|
221
|
+
}, [reown.openConnect]);
|
|
222
|
+
const handleDisconnect = _react.useCallback.call(void 0, () => {
|
|
223
|
+
reown.disconnect();
|
|
224
|
+
}, [reown.disconnect]);
|
|
225
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
+
_chunk22RV33LKcjs.DepositModalInner,
|
|
227
|
+
{
|
|
228
|
+
...props,
|
|
229
|
+
reownWallet: reownWithSolana,
|
|
230
|
+
onConnect: handleConnect,
|
|
231
|
+
onDisconnect: handleDisconnect
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function DepositModalReown(props) {
|
|
236
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
ReownWalletProvider,
|
|
238
|
+
{
|
|
239
|
+
projectId: props.reownAppId,
|
|
240
|
+
theme: props.theme,
|
|
241
|
+
rpcUrls: props.rpcUrls,
|
|
242
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props })
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
193
246
|
|
|
194
247
|
|
|
195
|
-
|
|
196
|
-
exports.ReownWalletProvider = ReownWalletProvider; exports.useReownWallet = useReownWallet;
|
|
248
|
+
exports.DepositModalReown = DepositModalReown;
|
|
@@ -12,8 +12,6 @@ declare function tokenIconUrl(symbol: string): string;
|
|
|
12
12
|
*/
|
|
13
13
|
declare function getTokenIcon(symbol: string): string;
|
|
14
14
|
|
|
15
|
-
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
16
|
-
declare const DEFAULT_SIGNER_ADDRESS: Address;
|
|
17
15
|
declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
18
16
|
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
19
17
|
declare const SOURCE_CHAINS: Chain[];
|
|
@@ -74,4 +72,4 @@ declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba63
|
|
|
74
72
|
*/
|
|
75
73
|
declare const HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
76
74
|
|
|
77
|
-
export {
|
|
75
|
+
export { type SupportedTokenOption as A, CHAIN_BY_ID as C, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, HYPERCORE_USDC_ADDRESS as a, HYPERCORE_USDT0_ADDRESS as b, SUPPORTED_CHAINS as c, chainRegistry as d, getChainIcon as e, findChainIdForToken as f, getChainBadge as g, getChainId as h, getChainName as i, getChainObject as j, getExplorerName as k, getExplorerTxUrl as l, getExplorerUrl as m, getSupportedChainIds as n, getSupportedTargetTokens as o, getSupportedTokenSymbolsForChain as p, getTargetTokenSymbolsForChain as q, getTokenAddress as r, getTokenDecimals as s, getTokenDecimalsByAddress as t, getTokenIcon as u, getTokenSymbol as v, getUsdcAddress as w, getUsdcDecimals as x, isSupportedTokenAddressForChain as y, tokenIconUrl as z };
|
|
@@ -12,8 +12,6 @@ declare function tokenIconUrl(symbol: string): string;
|
|
|
12
12
|
*/
|
|
13
13
|
declare function getTokenIcon(symbol: string): string;
|
|
14
14
|
|
|
15
|
-
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
16
|
-
declare const DEFAULT_SIGNER_ADDRESS: Address;
|
|
17
15
|
declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
18
16
|
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
19
17
|
declare const SOURCE_CHAINS: Chain[];
|
|
@@ -74,4 +72,4 @@ declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba63
|
|
|
74
72
|
*/
|
|
75
73
|
declare const HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
76
74
|
|
|
77
|
-
export {
|
|
75
|
+
export { type SupportedTokenOption as A, CHAIN_BY_ID as C, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, HYPERCORE_USDC_ADDRESS as a, HYPERCORE_USDT0_ADDRESS as b, SUPPORTED_CHAINS as c, chainRegistry as d, getChainIcon as e, findChainIdForToken as f, getChainBadge as g, getChainId as h, getChainName as i, getChainObject as j, getExplorerName as k, getExplorerTxUrl as l, getExplorerUrl as m, getSupportedChainIds as n, getSupportedTargetTokens as o, getSupportedTokenSymbolsForChain as p, getTargetTokenSymbolsForChain as q, getTokenAddress as r, getTokenDecimals as s, getTokenDecimalsByAddress as t, getTokenIcon as u, getTokenSymbol as v, getUsdcAddress as w, getUsdcDecimals as x, isSupportedTokenAddressForChain as y, tokenIconUrl as z };
|