@rhinestone/deposit-modal 0.12.2 → 0.14.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 +73 -18
- package/bridge-transcript.json +653 -0
- package/dist/ClaimModal-IKTJU43Y.cjs +13 -0
- package/dist/ClaimModal-SEKNWRMA.mjs +13 -0
- package/dist/{DepositModalReown-VG66OTIU.cjs → DepositModalReown-46LPVFB6.cjs} +58 -35
- package/dist/{DepositModalReown-TEC3MEZ4.mjs → DepositModalReown-Q2JMLT47.mjs} +45 -22
- package/dist/{QRCode-WUC652SH.mjs → QRCode-5RGIZZHL.mjs} +1 -1
- package/dist/{QRCode-5DXFNKI2.cjs → QRCode-JKXG4RHN.cjs} +2 -2
- package/dist/WithdrawModal-5ICGD4HJ.mjs +12 -0
- package/dist/WithdrawModal-VP6PMIRO.cjs +12 -0
- package/dist/{chunk-O7BCVQ6L.cjs → chunk-4KCSH4T3.cjs} +157 -199
- package/dist/chunk-6KG642KH.cjs +31 -0
- package/dist/{chunk-PWLEBV5V.cjs → chunk-7ICSHJFE.cjs} +296 -220
- package/dist/{chunk-J46WDSRD.mjs → chunk-7SR7ENVJ.mjs} +165 -89
- package/dist/{chunk-2TPSF77V.mjs → chunk-CFKC77SV.mjs} +455 -261
- package/dist/{chunk-75DVGSAX.cjs → chunk-DW2EQA2U.cjs} +6 -3
- package/dist/{chunk-FXXUIK4E.mjs → chunk-IN77XSWO.mjs} +899 -153
- package/dist/chunk-K4H6TGBE.mjs +31 -0
- package/dist/{chunk-SDSKIJC7.mjs → chunk-KTUVSKR4.mjs} +2410 -1177
- package/dist/{chunk-HL5NUKZW.cjs → chunk-LZFRL2AL.cjs} +3 -3
- package/dist/{chunk-UQIJU6HV.cjs → chunk-MTFJSE52.cjs} +499 -191
- package/dist/{chunk-FLVLYO64.mjs → chunk-PKML3XVS.mjs} +430 -122
- package/dist/{chunk-4ZXQPFNU.mjs → chunk-RN5VKWI6.mjs} +4 -1
- package/dist/{chunk-BRYNGLDM.cjs → chunk-V2OBGLJD.cjs} +961 -215
- package/dist/{chunk-3STTWRAN.mjs → chunk-VUATPOWJ.mjs} +147 -189
- package/dist/{chunk-JE4R5VA3.mjs → chunk-WUJIKCFU.mjs} +1 -1
- package/dist/chunk-X2IPAPXU.cjs +163 -0
- package/dist/{chunk-OIN4CXCP.cjs → chunk-YCQZJQO6.cjs} +2343 -1110
- package/dist/{chunk-TM7VGHAG.cjs → chunk-YWMWI7PZ.cjs} +462 -268
- package/dist/chunk-ZEO6ADM3.mjs +163 -0
- 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 +1476 -0
- package/dist/embed.d.cts +183 -0
- package/dist/embed.d.ts +183 -0
- package/dist/embed.mjs +1476 -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 +124 -98
- package/dist/types-Bho4OA03.d.ts +982 -0
- package/dist/types-DP_3KwlD.d.cts +982 -0
- 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 +59 -6
- package/dist/chunk-IAGFDSNC.mjs +0 -11
- package/dist/chunk-L32UI7LA.cjs +0 -11
- package/dist/types-BO4iP6fG.d.cts +0 -612
- package/dist/types-oFblf65g.d.ts +0 -612
package/README.md
CHANGED
|
@@ -50,6 +50,17 @@ console error pointing at the CSP. Hosts without an explicit `img-src` (or with
|
|
|
50
50
|
> sufficient. They now come from the CDN, which drops ~20 kB (brotli) from the
|
|
51
51
|
> bundle and gives every Rhinestone surface one source of truth.
|
|
52
52
|
|
|
53
|
+
All three modals also post session analytics to Rhinestone (see
|
|
54
|
+
[Analytics](#analytics)), so a host with an explicit `connect-src` must allow the
|
|
55
|
+
orchestrator alongside its own proxy:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
connect-src 'self' https://v1.orchestrator.rhinestone.dev;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
A blocked origin is reported on `onEvent` as an `analytics_ingest_failure`, not
|
|
62
|
+
surfaced to the user.
|
|
63
|
+
|
|
53
64
|
## Example
|
|
54
65
|
|
|
55
66
|
```tsx
|
|
@@ -97,6 +108,19 @@ export function DepositButton({ walletClient, publicClient, recipient }) {
|
|
|
97
108
|
}
|
|
98
109
|
```
|
|
99
110
|
|
|
111
|
+
Set `enableGaslessDeposit` on `DepositModal` to offer off-chain token
|
|
112
|
+
authorization on eligible cross-chain ERC-20 deposits. It defaults to `false`.
|
|
113
|
+
The processor selects ERC-3009 first, ERC-2612 second, and Permit2 third; the
|
|
114
|
+
Permit2 route is available only when the owner already approved the token to
|
|
115
|
+
Permit2. If no gasless route is available, or submission is definitively
|
|
116
|
+
rejected, the modal explicitly offers the ordinary token transfer. The backend
|
|
117
|
+
proxy must forward `/deposits/permit/prepare` and `/deposits/permit`, and the
|
|
118
|
+
processor deployment must have its global permit endpoint switch enabled.
|
|
119
|
+
Because a permit submission has no source-chain transaction at submission
|
|
120
|
+
time, it does not emit the `submitted` lifecycle event with the processor's
|
|
121
|
+
internal tracking key. Its `complete` event reports the settled source and
|
|
122
|
+
destination transaction hashes once they exist.
|
|
123
|
+
|
|
100
124
|
## Withdraw
|
|
101
125
|
|
|
102
126
|
`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 +167,25 @@ import { ClaimModal } from "@rhinestone/deposit-modal/claim";
|
|
|
143
167
|
defaultTxHash={depositTxHash}
|
|
144
168
|
defaultRefundDestination={knownSelfCustodialAddress}
|
|
145
169
|
onLifecycle={(event) => console.log(event)}
|
|
146
|
-
|
|
170
|
+
/>;
|
|
147
171
|
```
|
|
148
172
|
|
|
149
173
|
### Why the user signs
|
|
150
174
|
|
|
151
175
|
Deposit accounts are owned by the Rhinestone service, so the account holding the
|
|
152
176
|
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 —
|
|
177
|
+
`recipient` — the in-app wallet the funds were headed to — _is_ a key your user
|
|
154
178
|
holds. So that is what authorizes the recovery.
|
|
155
179
|
|
|
156
180
|
`signRecovery` is handed the exact typed data to sign plus the `signer` address the
|
|
157
181
|
processor will verify against, and returns a signature. Return whatever that
|
|
158
182
|
address's own verifier accepts:
|
|
159
183
|
|
|
160
|
-
| recipient is
|
|
161
|
-
|
|
162
|
-
| embedded EOA (Privy, Turnkey, Dynamic) | `signTypedData` — the raw 65-byte signature
|
|
163
|
-
| deployed smart account
|
|
164
|
-
| undeployed smart account
|
|
184
|
+
| recipient is | return |
|
|
185
|
+
| -------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
186
|
+
| embedded EOA (Privy, Turnkey, Dynamic) | `signTypedData` — the raw 65-byte signature |
|
|
187
|
+
| deployed smart account | a signature valid under its ERC-1271 `isValidSignature` |
|
|
188
|
+
| undeployed smart account | an ERC-6492 wrapper — `SignatureErc6492.wrap` from `ox/erc6492`, which ships with viem |
|
|
165
189
|
|
|
166
190
|
A raw owner signature is usually **not** enough for a smart account: a Safe expects
|
|
167
191
|
its own message wrapping, so go through your account SDK rather than signing the
|
|
@@ -181,7 +205,7 @@ Two properties fall out of signing that are worth knowing:
|
|
|
181
205
|
|
|
182
206
|
- **The destination is inside the signed struct.** The processor cannot pay anywhere
|
|
183
207
|
else, so the success screen states what the user signed rather than trusting the
|
|
184
|
-
endpoint to report where the money went. `defaultRefundDestination` only
|
|
208
|
+
endpoint to report where the money went. `defaultRefundDestination` only _seeds_
|
|
185
209
|
the field; whatever the user submits is what they sign.
|
|
186
210
|
- **Failures carry a structured code**, so the modal knows when a retry helps. A
|
|
187
211
|
verification outage is retryable; a rejected signature or a deposit already
|
|
@@ -248,6 +272,7 @@ The flow: user picks a fiat option → modal registers a Rhinestone smart accoun
|
|
|
248
272
|
**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
273
|
|
|
250
274
|
**Fees.** Rhinestone does not charge a markup by default. The client (dapp) controls the user-facing experience via the orchestrator's sponsorship config:
|
|
275
|
+
|
|
251
276
|
- **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
277
|
- **Unsponsored**: the bridging cost is deducted from the on-ramped amount and shown as a "Bridging cost" line on the success screen.
|
|
253
278
|
|
|
@@ -259,11 +284,11 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
259
284
|
|
|
260
285
|
**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
286
|
|
|
262
|
-
| Prop
|
|
263
|
-
|
|
|
264
|
-
| `enableFiatOnramp`
|
|
265
|
-
| `enableQrTransfer`
|
|
266
|
-
| `fiatMethods`
|
|
287
|
+
| Prop | Type | Default | Description |
|
|
288
|
+
| ------------------ | ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
289
|
+
| `enableFiatOnramp` | `boolean` | `false` | Show fiat on-ramp option(s). Requires backend Swapped keys. Needs no wallet. |
|
|
290
|
+
| `enableQrTransfer` | `boolean` | `true` | Show the Transfer Crypto / QR row. Set false for fiat-only. |
|
|
291
|
+
| `fiatMethods` | `FiatMethodsConfig` | regional | Optional exact subset of standard `payment_group`s. Providing it opts out of regional personalization; empty means none. |
|
|
267
292
|
|
|
268
293
|
## Fund from Exchange (Swapped Connect)
|
|
269
294
|
|
|
@@ -278,14 +303,44 @@ Pass `enableExchangeConnect` to expose a "Fund from Exchange" row alongside the
|
|
|
278
303
|
|
|
279
304
|
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
305
|
|
|
281
|
-
| Prop
|
|
282
|
-
|
|
|
283
|
-
| `enableExchangeConnect`
|
|
306
|
+
| Prop | Type | Default | Description |
|
|
307
|
+
| ----------------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
308
|
+
| `enableExchangeConnect` | `boolean` | `false` | Show the "Fund from Exchange" row. Requires backend Swapped keys. Needs no wallet. Can be combined with `enableFiatOnramp`. |
|
|
309
|
+
|
|
310
|
+
## Analytics
|
|
311
|
+
|
|
312
|
+
`onEvent` receives the deposit, withdraw and claim funnels as a session-scoped
|
|
313
|
+
stream:
|
|
314
|
+
every event carries the session id, the modal, the widget version and a snapshot
|
|
315
|
+
of the session's configuration.
|
|
316
|
+
|
|
317
|
+
The same events are also sent to Rhinestone, batched, in the background, and
|
|
318
|
+
flushed when the modal closes or the page goes away. Delivery never affects the
|
|
319
|
+
flow and never changes what `onEvent` receives. Sessions are attributed to your
|
|
320
|
+
project through a short-lived token minted at `POST /analytics/ingest-token` on
|
|
321
|
+
your proxy; a proxy that does not forward that route still collects, just
|
|
322
|
+
unattributed.
|
|
323
|
+
|
|
324
|
+
| Prop | Type | Default | Description |
|
|
325
|
+
| ------------------------ | --------- | ------- | --------------------------------------------------------------- |
|
|
326
|
+
| `enableAnalyticsIngest` | `boolean` | `true` | Set `false` to stop sending analytics to Rhinestone. `onEvent` is unaffected. |
|
|
327
|
+
|
|
328
|
+
When a batch cannot be delivered, `onEvent` receives one
|
|
329
|
+
`analytics_ingest_failure` per distinct reason per session, naming the reason
|
|
330
|
+
(`network` — which includes a CSP block — `rejected`, `conflict`,
|
|
331
|
+
`unauthorized`, `throttled`, `unavailable`, `token_unavailable`, `unsupported`),
|
|
332
|
+
the HTTP status when there was one, and how many events the session has lost so
|
|
333
|
+
far.
|
|
284
334
|
|
|
285
335
|
## Upgrading
|
|
286
336
|
|
|
287
|
-
Upgrading from 0.
|
|
288
|
-
|
|
337
|
+
Upgrading from 0.13.x changes what `onEvent` delivers: the deposit events are
|
|
338
|
+
replaced by a method-aware taxonomy, the five flat claim events are replaced by
|
|
339
|
+
a claim funnel, and every event gains a session envelope. A claim-only
|
|
340
|
+
integration now posts analytics too, so it needs the `connect-src` above.
|
|
341
|
+
Upgrading from 0.8.x is a breaking change on both modals.
|
|
342
|
+
|
|
343
|
+
See [`MIGRATION.md`](./MIGRATION.md), or the same guide
|
|
289
344
|
[in the docs](https://docs.rhinestone.dev/deposits/widget/migration).
|
|
290
345
|
|
|
291
346
|
## Contributing
|