@rhinestone/deposit-modal 0.20.0 → 0.21.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 +45 -17
- package/dist/{BankOnrampStep-JG32OCM2.mjs → BankOnrampStep-JTU7WS5R.mjs} +22 -12
- package/dist/{BankOnrampStep-NPGXAA7U.cjs → BankOnrampStep-QCPISCAQ.cjs} +34 -24
- package/dist/{DepositModalReown-3FGTPER6.mjs → DepositModalReown-FJBSF4VL.mjs} +5 -3
- package/dist/{DepositModalReown-ALVWADG7.cjs → DepositModalReown-QJ6O2FWY.cjs} +18 -16
- package/dist/{WithdrawModal-LL4Z5WZP.mjs → WithdrawModal-CB7RNEPI.mjs} +3 -3
- package/dist/WithdrawModal-E2BTWJV7.cjs +12 -0
- package/dist/{chunk-B2LZQIGB.mjs → chunk-2D3J53PX.mjs} +1 -1
- package/dist/{chunk-CXRH5MKO.cjs → chunk-4O2UGFFT.cjs} +385 -297
- package/dist/{chunk-HP7S7AD6.mjs → chunk-7CHQA2OZ.mjs} +1 -1
- package/dist/chunk-ADEWTBSN.cjs +19 -0
- package/dist/{chunk-FMUSY563.cjs → chunk-AV3SA7TW.cjs} +3 -3
- package/dist/{chunk-247GJH57.mjs → chunk-B2LUWNFX.mjs} +583 -533
- package/dist/{chunk-Z4RBTNKX.cjs → chunk-CAIRS4LK.cjs} +732 -682
- package/dist/{chunk-OPT5EW6L.cjs → chunk-CG3JKPUF.cjs} +2 -2
- package/dist/{chunk-5QUWEFD4.mjs → chunk-CXEQFRX4.mjs} +1 -1
- package/dist/chunk-PP4QE32S.mjs +19 -0
- package/dist/{chunk-XBJCZYBX.mjs → chunk-PZIKRYMO.mjs} +1 -1
- package/dist/{chunk-BTEG2VNZ.cjs → chunk-U7NYYT4Q.cjs} +58 -58
- package/dist/{chunk-32ERBFMO.mjs → chunk-UNXUOV3F.mjs} +131 -43
- package/dist/{chunk-EKFXUF5A.cjs → chunk-VQAV6ESI.cjs} +1 -1
- package/dist/{chunk-6CTJFR3T.mjs → chunk-WK2ELRL3.mjs} +5 -16
- package/dist/{chunk-PYRXOP2Y.cjs → chunk-X425VJFY.cjs} +10 -21
- package/dist/compliance.cjs +4 -4
- package/dist/compliance.mjs +3 -3
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -3
- package/dist/embed.cjs +16 -14
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.mjs +6 -4
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +6 -4
- package/dist/onramp.cjs +5 -4
- package/dist/onramp.mjs +4 -3
- package/dist/server.cjs +12 -8
- package/dist/server.mjs +11 -7
- package/dist/{types-CixUBhrM.d.cts → types-BrxDZNEr.d.cts} +23 -11
- package/dist/{types-BxSrazbq.d.ts → types-DCUB4DY8.d.ts} +23 -11
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +5 -5
- package/dist/WithdrawModal-5YWFJSYY.cjs +0 -12
package/README.md
CHANGED
|
@@ -317,6 +317,9 @@ The flow: user picks a fiat option → modal registers a Rhinestone smart accoun
|
|
|
317
317
|
> request carries no `Authorization` header, and never key-forward the list
|
|
318
318
|
> `GET /onramp/orders`. [`deposit-widget-proxy`](https://github.com/rhinestonewtf/deposit-widget-proxy)
|
|
319
319
|
> does this from #38. Keep the `/onramp/swapped/*` routes for older modal versions.
|
|
320
|
+
> Forward `GET /onramp/providers` with the key too: the modal offers only the
|
|
321
|
+
> onramps your project has (Cash and exchange rows, bank details). Without it,
|
|
322
|
+
> every row your props enable is offered, as before.
|
|
320
323
|
|
|
321
324
|
Host CSP must allow Swapped's domains:
|
|
322
325
|
|
|
@@ -335,7 +338,7 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
335
338
|
### Bank transfer accounts (Noah)
|
|
336
339
|
|
|
337
340
|
> **Preview.** Your proxy must forward these on the customer bearer before you ship
|
|
338
|
-
> a modal with `
|
|
341
|
+
> a modal with `virtualAccountOnramp` and `getCustomerSession`: `GET /compliance/status`, `POST /compliance/verification`,
|
|
339
342
|
> `GET /onramp/options`, `POST`/`GET /onramp/accounts`,
|
|
340
343
|
> `GET /onramp/accounts/:id[/details]` and `GET /onramp/orders[/:id]`. A missing one
|
|
341
344
|
> 404s at the proxy. [`deposit-widget-proxy`](https://github.com/rhinestonewtf/deposit-widget-proxy)
|
|
@@ -344,7 +347,7 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
344
347
|
> The prop is opt-in and inert unless you pass it. Treat it as unstable until
|
|
345
348
|
> this note is removed.
|
|
346
349
|
|
|
347
|
-
Pass `
|
|
350
|
+
Pass `virtualAccountOnramp` to use reusable USD/EUR account details when Noah is provisioned
|
|
348
351
|
for your organization. Integrator KYB happens directly with Noah; Rhinestone
|
|
349
352
|
enables provisioning after Noah confirms it. Card and Apple Pay continue through Swapped. A customer who has
|
|
350
353
|
not been verified is taken through hosted verification first; an existing active
|
|
@@ -363,16 +366,21 @@ either, the customer returns to the Cash methods with a notice and the row hidde
|
|
|
363
366
|
A successful response keeps Noah exclusive, even when no currencies are available.
|
|
364
367
|
Authentication and service errors show a retry instead of switching providers.
|
|
365
368
|
|
|
366
|
-
|
|
367
|
-
|
|
369
|
+
With `getCustomerSession`, History lists the deposit account's bank, card and
|
|
370
|
+
exchange orders, including payments that never become chain deposits. It asks for
|
|
371
|
+
a **resume-only** session (`{ resumeOnly: true }`), so viewing History never creates
|
|
372
|
+
a customer or binds the account; until the user has set up bank transfer for this
|
|
373
|
+
account there is no customer, and History shows deposits only. Card or exchange
|
|
374
|
+
checkouts that never took payment are not listed.
|
|
375
|
+
The History icon stays available during Noah verification and bank details;
|
|
368
376
|
new activity adds a dot without navigating away.
|
|
369
|
-
Opening History acknowledges that activity and clears the
|
|
370
|
-
only a subsequent new
|
|
371
|
-
|
|
377
|
+
Opening History acknowledges that activity and clears the notification;
|
|
378
|
+
only a subsequent new order or stage change adds it again.
|
|
379
|
+
History refreshes `GET /onramp/orders` every 30 seconds while the modal
|
|
372
380
|
is open and visible, and on focus or opening History. Discovery continues after a
|
|
373
|
-
|
|
381
|
+
payment finishes so the next one is detected. A linked deposit shares the entry
|
|
374
382
|
and shows final settlement separately from the provider's delivery.
|
|
375
|
-
Each
|
|
383
|
+
Each entry shows its amount, date and latest status rather than
|
|
376
384
|
individual provider stages. "Settled" means crypto reached the deposit account;
|
|
377
385
|
"Completed" requires the linked deposit's final settlement to complete.
|
|
378
386
|
Expanded fiat entries use the same explorer links as crypto History: the
|
|
@@ -381,18 +389,38 @@ chain. No on-chain link is shown for a fiat-only or sub-fee transfer.
|
|
|
381
389
|
|
|
382
390
|
```tsx
|
|
383
391
|
<DepositModal
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
392
|
+
virtualAccountOnramp={{ supportUrl: "https://your-app.example/support" }} // Optional help link.
|
|
393
|
+
getCustomerSession={async (smartAccount, options) => {
|
|
394
|
+
const response = await fetch("/api/customer-session", {
|
|
395
|
+
method: "POST",
|
|
396
|
+
credentials: "same-origin",
|
|
397
|
+
// Forward `options`: History's `resumeOnly` keeps it from binding the account.
|
|
398
|
+
body: JSON.stringify({ smartAccount, ...options }),
|
|
399
|
+
});
|
|
400
|
+
// Keep the refusal's code, so the modal can explain it.
|
|
401
|
+
if (!response.ok) {
|
|
402
|
+
const { code } = await response.json().catch(() => ({}));
|
|
403
|
+
throw Object.assign(new Error("Customer session unavailable"), { code });
|
|
404
|
+
}
|
|
405
|
+
return response.json();
|
|
388
406
|
}}
|
|
389
407
|
// ...
|
|
390
408
|
/>
|
|
391
409
|
```
|
|
392
410
|
|
|
393
|
-
`
|
|
394
|
-
short-lived customer session with `createCustomerSessionHandler
|
|
395
|
-
|
|
411
|
+
`getCustomerSession` must call your authenticated server endpoint, which mints a
|
|
412
|
+
short-lived customer session with `createCustomerSessionHandler`, which reads
|
|
413
|
+
`resumeOnly` from the request body and forwards it. It is called
|
|
414
|
+
for every request; do not put the Rhinestone API key in the browser. Bank
|
|
415
|
+
transfer through virtual accounts requires it: without `getCustomerSession`,
|
|
416
|
+
`virtualAccountOnramp` is ignored (with one console warning). Card and exchange
|
|
417
|
+
never depend on the session. A session that throws, is malformed or is refused
|
|
418
|
+
is an error on the bank step, with the back chevron; it never switches provider.
|
|
419
|
+
The only hand-over to Swapped's bank transfer is the processor's "not served"
|
|
420
|
+
for the customer (or a project without virtual accounts). A refusal with
|
|
421
|
+
`ACCOUNT_CHANGE_REQUIRES_MIGRATION` (the user's deposit account changed after
|
|
422
|
+
verification) says bank transfer is unavailable for this account instead of
|
|
423
|
+
offering a retry.
|
|
396
424
|
|
|
397
425
|
Bank instructions render inside the modal from `GET /onramp/accounts/:id/details`
|
|
398
426
|
on the customer bearer: separate transfer rails (SWIFT, ACH, Wire, SEPA), copy
|
|
@@ -403,7 +431,7 @@ application. A `409` means the account predates snapshot capture and the
|
|
|
403
431
|
processor backfill has not run; the customer is told to check back. Only identity
|
|
404
432
|
verification uses Noah's hosted page.
|
|
405
433
|
|
|
406
|
-
`
|
|
434
|
+
`virtualAccountOnramp` enables Cash when `fiatMethods` is omitted. When an exact
|
|
407
435
|
`fiatMethods` subset is provided, it must include
|
|
408
436
|
`{ "bank-transfer": true }`. The proxy must forward the `/onramp/options`,
|
|
409
437
|
`/onramp/accounts` and `/onramp/orders` customer routes with the bearer token
|
|
@@ -8,15 +8,16 @@ import {
|
|
|
8
8
|
} from "./chunk-YY4ZOAH5.mjs";
|
|
9
9
|
import {
|
|
10
10
|
createOnrampService
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WK2ELRL3.mjs";
|
|
12
|
+
import "./chunk-PP4QE32S.mjs";
|
|
12
13
|
import {
|
|
13
14
|
getComplianceStatus,
|
|
14
15
|
startComplianceVerification
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CXEQFRX4.mjs";
|
|
16
17
|
import {
|
|
17
18
|
ScopedRequestError
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-PZIKRYMO.mjs";
|
|
20
|
+
import "./chunk-2D3J53PX.mjs";
|
|
20
21
|
|
|
21
22
|
// src/components/steps/BankOnrampStep.tsx
|
|
22
23
|
import { useCallback, useEffect, useMemo, useRef, useState as useState2 } from "react";
|
|
@@ -125,18 +126,23 @@ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
125
126
|
var SAFE_ERROR = "Bank details are unavailable. Try again.";
|
|
126
127
|
var PENDING_ERROR = "Bank details are not ready yet. Check back shortly.";
|
|
127
128
|
var OPTIONS_ERROR = "Bank transfer options are unavailable. Try again.";
|
|
129
|
+
var ACCOUNT_ERROR = "Bank transfer isn't available for this account.";
|
|
130
|
+
var SESSION_REFUSALS = /* @__PURE__ */ new Set([
|
|
131
|
+
"ACCOUNT_CHANGE_REQUIRES_MIGRATION",
|
|
132
|
+
"ACCOUNT_ALREADY_LINKED"
|
|
133
|
+
]);
|
|
128
134
|
var VERIFICATION_POLL_MS = 5e3;
|
|
129
135
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
130
136
|
function BankOnrampStep({
|
|
131
137
|
backendUrl,
|
|
132
138
|
smartAccount,
|
|
133
|
-
|
|
139
|
+
getCustomerSession,
|
|
134
140
|
onError,
|
|
135
141
|
openExternally,
|
|
136
142
|
onUnavailable,
|
|
137
143
|
onJourney
|
|
138
144
|
}) {
|
|
139
|
-
const getSessionRef = useLatestRef(
|
|
145
|
+
const getSessionRef = useLatestRef(getCustomerSession);
|
|
140
146
|
const sessionOptions = useMemo(
|
|
141
147
|
() => ({
|
|
142
148
|
backendUrl,
|
|
@@ -148,11 +154,10 @@ function BankOnrampStep({
|
|
|
148
154
|
() => createOnrampService(sessionOptions),
|
|
149
155
|
[sessionOptions]
|
|
150
156
|
);
|
|
151
|
-
const [availableForHistory, setAvailableForHistory] = useState2(false);
|
|
152
157
|
useEffect(() => {
|
|
153
|
-
onJourney?.(
|
|
154
|
-
return () => onJourney?.(
|
|
155
|
-
}, [
|
|
158
|
+
onJourney?.(true);
|
|
159
|
+
return () => onJourney?.(false);
|
|
160
|
+
}, [onJourney]);
|
|
156
161
|
const [noOptions, setNoOptions] = useState2(false);
|
|
157
162
|
const [loading, setLoading] = useState2(true);
|
|
158
163
|
const [selectedAccount, setSelectedAccount] = useState2(
|
|
@@ -211,7 +216,6 @@ function BankOnrampStep({
|
|
|
211
216
|
});
|
|
212
217
|
const available = await discover();
|
|
213
218
|
if (!available || !isCurrentRequest(generation)) return;
|
|
214
|
-
setAvailableForHistory(true);
|
|
215
219
|
const verification = await ensureVerified();
|
|
216
220
|
if (!isCurrentRequest(generation)) return;
|
|
217
221
|
if (verification !== "approved") {
|
|
@@ -236,8 +240,14 @@ function BankOnrampStep({
|
|
|
236
240
|
(account) => account.status === "active" && account.currency === option.currency
|
|
237
241
|
)
|
|
238
242
|
);
|
|
239
|
-
} catch {
|
|
243
|
+
} catch (error2) {
|
|
240
244
|
if (!isCurrentRequest(generation)) return;
|
|
245
|
+
const code = error2?.code;
|
|
246
|
+
if (typeof code === "string" && SESSION_REFUSALS.has(code)) {
|
|
247
|
+
setError(ACCOUNT_ERROR);
|
|
248
|
+
onError?.(ACCOUNT_ERROR, "BANK_ONRAMP_SESSION_REFUSED");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
241
251
|
setError(OPTIONS_ERROR);
|
|
242
252
|
onError?.(OPTIONS_ERROR, "BANK_ONRAMP_OPTIONS_FAILED");
|
|
243
253
|
} finally {
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
var _chunkG264OM23cjs = require('./chunk-G264OM23.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkX425VJFYcjs = require('./chunk-X425VJFY.cjs');
|
|
12
|
+
require('./chunk-ADEWTBSN.cjs');
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
var
|
|
16
|
+
var _chunkAV3SA7TWcjs = require('./chunk-AV3SA7TW.cjs');
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
var
|
|
19
|
-
require('./chunk-
|
|
19
|
+
var _chunkCG3JKPUFcjs = require('./chunk-CG3JKPUF.cjs');
|
|
20
|
+
require('./chunk-VQAV6ESI.cjs');
|
|
20
21
|
|
|
21
22
|
// src/components/steps/BankOnrampStep.tsx
|
|
22
23
|
var _react = require('react');
|
|
@@ -125,18 +126,23 @@ function BankDetailsView({ details }) {
|
|
|
125
126
|
var SAFE_ERROR = "Bank details are unavailable. Try again.";
|
|
126
127
|
var PENDING_ERROR = "Bank details are not ready yet. Check back shortly.";
|
|
127
128
|
var OPTIONS_ERROR = "Bank transfer options are unavailable. Try again.";
|
|
129
|
+
var ACCOUNT_ERROR = "Bank transfer isn't available for this account.";
|
|
130
|
+
var SESSION_REFUSALS = /* @__PURE__ */ new Set([
|
|
131
|
+
"ACCOUNT_CHANGE_REQUIRES_MIGRATION",
|
|
132
|
+
"ACCOUNT_ALREADY_LINKED"
|
|
133
|
+
]);
|
|
128
134
|
var VERIFICATION_POLL_MS = 5e3;
|
|
129
135
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
130
136
|
function BankOnrampStep({
|
|
131
137
|
backendUrl,
|
|
132
138
|
smartAccount,
|
|
133
|
-
|
|
139
|
+
getCustomerSession,
|
|
134
140
|
onError,
|
|
135
141
|
openExternally,
|
|
136
142
|
onUnavailable,
|
|
137
143
|
onJourney
|
|
138
144
|
}) {
|
|
139
|
-
const getSessionRef = _chunkG264OM23cjs.useLatestRef.call(void 0,
|
|
145
|
+
const getSessionRef = _chunkG264OM23cjs.useLatestRef.call(void 0, getCustomerSession);
|
|
140
146
|
const sessionOptions = _react.useMemo.call(void 0,
|
|
141
147
|
() => ({
|
|
142
148
|
backendUrl,
|
|
@@ -145,14 +151,13 @@ function BankOnrampStep({
|
|
|
145
151
|
[backendUrl, getSessionRef, smartAccount]
|
|
146
152
|
);
|
|
147
153
|
const service = _react.useMemo.call(void 0,
|
|
148
|
-
() =>
|
|
154
|
+
() => _chunkX425VJFYcjs.createOnrampService.call(void 0, sessionOptions),
|
|
149
155
|
[sessionOptions]
|
|
150
156
|
);
|
|
151
|
-
const [availableForHistory, setAvailableForHistory] = _react.useState.call(void 0, false);
|
|
152
157
|
_react.useEffect.call(void 0, () => {
|
|
153
|
-
_optionalChain([onJourney, 'optionalCall', _ => _(
|
|
154
|
-
return () => _optionalChain([onJourney, 'optionalCall', _2 => _2(
|
|
155
|
-
}, [
|
|
158
|
+
_optionalChain([onJourney, 'optionalCall', _ => _(true)]);
|
|
159
|
+
return () => _optionalChain([onJourney, 'optionalCall', _2 => _2(false)]);
|
|
160
|
+
}, [onJourney]);
|
|
156
161
|
const [noOptions, setNoOptions] = _react.useState.call(void 0, false);
|
|
157
162
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
158
163
|
const [selectedAccount, setSelectedAccount] = _react.useState.call(void 0,
|
|
@@ -175,7 +180,7 @@ function BankOnrampStep({
|
|
|
175
180
|
[]
|
|
176
181
|
);
|
|
177
182
|
const startVerification = _react.useCallback.call(void 0, async () => {
|
|
178
|
-
const session = await
|
|
183
|
+
const session = await _chunkAV3SA7TWcjs.startComplianceVerification.call(void 0, sessionOptions);
|
|
179
184
|
if (session.status === "failed") return "declined";
|
|
180
185
|
if (!session.nextAction) return "reviewing";
|
|
181
186
|
if (!isTrustedNoahHostedUrl(session.nextAction.url)) return "reviewing";
|
|
@@ -191,7 +196,7 @@ function BankOnrampStep({
|
|
|
191
196
|
return "action_required";
|
|
192
197
|
}, [openExternally, sessionOptions]);
|
|
193
198
|
const ensureVerified = _react.useCallback.call(void 0, async () => {
|
|
194
|
-
const current = await
|
|
199
|
+
const current = await _chunkAV3SA7TWcjs.getComplianceStatus.call(void 0, sessionOptions);
|
|
195
200
|
if (current.status === "approved") return "approved";
|
|
196
201
|
if (current.status === "declined") return "declined";
|
|
197
202
|
return startVerification();
|
|
@@ -203,7 +208,7 @@ function BankOnrampStep({
|
|
|
203
208
|
setNoOptions(false);
|
|
204
209
|
try {
|
|
205
210
|
const discover = () => service.getOptions().catch((error2) => {
|
|
206
|
-
if (error2 instanceof
|
|
211
|
+
if (error2 instanceof _chunkCG3JKPUFcjs.ScopedRequestError && error2.status === 404 && onUnavailable) {
|
|
207
212
|
if (isCurrentRequest(generation)) onUnavailable();
|
|
208
213
|
return null;
|
|
209
214
|
}
|
|
@@ -211,7 +216,6 @@ function BankOnrampStep({
|
|
|
211
216
|
});
|
|
212
217
|
const available = await discover();
|
|
213
218
|
if (!available || !isCurrentRequest(generation)) return;
|
|
214
|
-
setAvailableForHistory(true);
|
|
215
219
|
const verification = await ensureVerified();
|
|
216
220
|
if (!isCurrentRequest(generation)) return;
|
|
217
221
|
if (verification !== "approved") {
|
|
@@ -236,10 +240,16 @@ function BankOnrampStep({
|
|
|
236
240
|
(account) => account.status === "active" && account.currency === option.currency
|
|
237
241
|
)
|
|
238
242
|
);
|
|
239
|
-
} catch (
|
|
243
|
+
} catch (error2) {
|
|
240
244
|
if (!isCurrentRequest(generation)) return;
|
|
245
|
+
const code = _optionalChain([error2, 'optionalAccess', _3 => _3.code]);
|
|
246
|
+
if (typeof code === "string" && SESSION_REFUSALS.has(code)) {
|
|
247
|
+
setError(ACCOUNT_ERROR);
|
|
248
|
+
_optionalChain([onError, 'optionalCall', _4 => _4(ACCOUNT_ERROR, "BANK_ONRAMP_SESSION_REFUSED")]);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
241
251
|
setError(OPTIONS_ERROR);
|
|
242
|
-
_optionalChain([onError, 'optionalCall',
|
|
252
|
+
_optionalChain([onError, 'optionalCall', _5 => _5(OPTIONS_ERROR, "BANK_ONRAMP_OPTIONS_FAILED")]);
|
|
243
253
|
} finally {
|
|
244
254
|
if (isCurrentRequest(generation)) setLoading(false);
|
|
245
255
|
}
|
|
@@ -270,10 +280,10 @@ function BankOnrampStep({
|
|
|
270
280
|
setBankDetails(details);
|
|
271
281
|
} catch (error2) {
|
|
272
282
|
if (!isCurrentRequest(generation)) return;
|
|
273
|
-
const pending = error2 instanceof
|
|
283
|
+
const pending = error2 instanceof _chunkCG3JKPUFcjs.ScopedRequestError && error2.status === 409;
|
|
274
284
|
const message = pending ? PENDING_ERROR : SAFE_ERROR;
|
|
275
285
|
setError(message);
|
|
276
|
-
_optionalChain([onError, 'optionalCall',
|
|
286
|
+
_optionalChain([onError, 'optionalCall', _6 => _6(
|
|
277
287
|
message,
|
|
278
288
|
pending ? "BANK_ONRAMP_DETAILS_PENDING" : "BANK_ONRAMP_DETAILS_FAILED"
|
|
279
289
|
)]);
|
|
@@ -304,7 +314,7 @@ function BankOnrampStep({
|
|
|
304
314
|
await openDetails(nextAccount);
|
|
305
315
|
} catch (error2) {
|
|
306
316
|
if (!isCurrentRequest(generation)) return;
|
|
307
|
-
if (error2 instanceof
|
|
317
|
+
if (error2 instanceof _chunkCG3JKPUFcjs.ScopedRequestError && error2.status === 409 && error2.code === "VERIFICATION_REQUIRED" && !verificationResumedRef.current) {
|
|
308
318
|
verificationResumedRef.current = true;
|
|
309
319
|
try {
|
|
310
320
|
const verification = await startVerification();
|
|
@@ -312,12 +322,12 @@ function BankOnrampStep({
|
|
|
312
322
|
setVerifying(verification);
|
|
313
323
|
setLoading(false);
|
|
314
324
|
return;
|
|
315
|
-
} catch (
|
|
325
|
+
} catch (e3) {
|
|
316
326
|
if (!isCurrentRequest(generation)) return;
|
|
317
327
|
}
|
|
318
328
|
}
|
|
319
329
|
setError(SAFE_ERROR);
|
|
320
|
-
_optionalChain([onError, 'optionalCall',
|
|
330
|
+
_optionalChain([onError, 'optionalCall', _7 => _7(SAFE_ERROR, "BANK_ONRAMP_SETUP_FAILED")]);
|
|
321
331
|
setLoading(false);
|
|
322
332
|
}
|
|
323
333
|
},
|
|
@@ -340,7 +350,7 @@ function BankOnrampStep({
|
|
|
340
350
|
const timer = setInterval(() => {
|
|
341
351
|
void (async () => {
|
|
342
352
|
try {
|
|
343
|
-
const status = await
|
|
353
|
+
const status = await _chunkAV3SA7TWcjs.getComplianceStatus.call(void 0, sessionOptions);
|
|
344
354
|
if (!active) return;
|
|
345
355
|
if (status.status === "approved") {
|
|
346
356
|
setHostedUrl(null);
|
|
@@ -348,7 +358,7 @@ function BankOnrampStep({
|
|
|
348
358
|
} else if (status.status === "declined") {
|
|
349
359
|
setVerifying("declined");
|
|
350
360
|
}
|
|
351
|
-
} catch (
|
|
361
|
+
} catch (e4) {
|
|
352
362
|
}
|
|
353
363
|
})();
|
|
354
364
|
}, VERIFICATION_POLL_MS);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner,
|
|
3
3
|
getReownDependencies
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-B2LUWNFX.mjs";
|
|
5
5
|
import "./chunk-2FOPO4N5.mjs";
|
|
6
6
|
import {
|
|
7
7
|
followSystemAppearance,
|
|
@@ -11,13 +11,15 @@ import {
|
|
|
11
11
|
resolveThemeMode,
|
|
12
12
|
rpcUrlFor,
|
|
13
13
|
useStableRpcUrls
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UNXUOV3F.mjs";
|
|
15
15
|
import "./chunk-YY4ZOAH5.mjs";
|
|
16
|
+
import "./chunk-PP4QE32S.mjs";
|
|
17
|
+
import "./chunk-PZIKRYMO.mjs";
|
|
16
18
|
import {
|
|
17
19
|
SUPPORTED_CHAIN_IDS,
|
|
18
20
|
getChainName
|
|
19
21
|
} from "./chunk-E7IMWVMN.mjs";
|
|
20
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-2D3J53PX.mjs";
|
|
21
23
|
|
|
22
24
|
// src/DepositModalReown.tsx
|
|
23
25
|
import { useCallback, useMemo as useMemo2 } from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkCAIRS4LKcjs = require('./chunk-CAIRS4LK.cjs');
|
|
5
5
|
require('./chunk-FVJKUTHF.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
@@ -11,13 +11,15 @@ require('./chunk-FVJKUTHF.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk4O2UGFFTcjs = require('./chunk-4O2UGFFT.cjs');
|
|
15
15
|
require('./chunk-G264OM23.cjs');
|
|
16
|
+
require('./chunk-ADEWTBSN.cjs');
|
|
17
|
+
require('./chunk-CG3JKPUF.cjs');
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
var _chunkFKJ6EJHHcjs = require('./chunk-FKJ6EJHH.cjs');
|
|
20
|
-
require('./chunk-
|
|
22
|
+
require('./chunk-VQAV6ESI.cjs');
|
|
21
23
|
|
|
22
24
|
// src/DepositModalReown.tsx
|
|
23
25
|
var _react = require('react');
|
|
@@ -45,7 +47,7 @@ var {
|
|
|
45
47
|
unichain,
|
|
46
48
|
katana,
|
|
47
49
|
hyperEvm
|
|
48
|
-
} =
|
|
50
|
+
} = _chunkCAIRS4LKcjs.getReownDependencies.call(void 0, )[1];
|
|
49
51
|
var APPKIT_NETWORK_BY_ID = {
|
|
50
52
|
[mainnet.id]: mainnet,
|
|
51
53
|
[optimism.id]: optimism,
|
|
@@ -77,7 +79,7 @@ function getAppKitNetwork(chainId) {
|
|
|
77
79
|
|
|
78
80
|
// src/core/reown-theme.ts
|
|
79
81
|
function mapTheme(theme) {
|
|
80
|
-
const themeMode =
|
|
82
|
+
const themeMode = _chunk4O2UGFFTcjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
|
|
81
83
|
const themeVariables = {
|
|
82
84
|
"--apkt-accent": _optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])
|
|
83
85
|
};
|
|
@@ -94,7 +96,7 @@ function setAppKitTheme(appKit, theme) {
|
|
|
94
96
|
|
|
95
97
|
// src/core/reown.tsx
|
|
96
98
|
var _jsxruntime = require('react/jsx-runtime');
|
|
97
|
-
var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] =
|
|
99
|
+
var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkCAIRS4LKcjs.getReownDependencies.call(void 0, );
|
|
98
100
|
var {
|
|
99
101
|
createAppKit,
|
|
100
102
|
useAppKit,
|
|
@@ -110,14 +112,14 @@ function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
|
110
112
|
const transports = {};
|
|
111
113
|
for (const network of networks) {
|
|
112
114
|
const id = Number(network.id);
|
|
113
|
-
transports[id] = _viem.http.call(void 0,
|
|
115
|
+
transports[id] = _viem.http.call(void 0, _chunk4O2UGFFTcjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
114
116
|
}
|
|
115
117
|
return transports;
|
|
116
118
|
}
|
|
117
119
|
function getEvmRpcFingerprint(rpcUrls, networks) {
|
|
118
120
|
return networks.map((network) => {
|
|
119
121
|
const id = Number(network.id);
|
|
120
|
-
return `${id}=${_nullishCoalesce(
|
|
122
|
+
return `${id}=${_nullishCoalesce(_chunk4O2UGFFTcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
121
123
|
}).join("|");
|
|
122
124
|
}
|
|
123
125
|
var cachedAdapter = null;
|
|
@@ -188,7 +190,7 @@ function ReownWalletProvider({
|
|
|
188
190
|
backendUrl,
|
|
189
191
|
children
|
|
190
192
|
}) {
|
|
191
|
-
const rpcUrls =
|
|
193
|
+
const rpcUrls = _chunk4O2UGFFTcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
192
194
|
const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
|
|
193
195
|
const overrides = _react.useMemo.call(void 0, () => {
|
|
194
196
|
if (!rpcUrls) return void 0;
|
|
@@ -200,14 +202,14 @@ function ReownWalletProvider({
|
|
|
200
202
|
return out;
|
|
201
203
|
}, [rpcUrls]);
|
|
202
204
|
const [state, setState] = _react.useState.call(void 0, () => {
|
|
203
|
-
const primed =
|
|
205
|
+
const primed = _chunk4O2UGFFTcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
204
206
|
return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
|
|
205
207
|
});
|
|
206
208
|
_react.useEffect.call(void 0, () => {
|
|
207
209
|
let active = true;
|
|
208
|
-
const primed =
|
|
210
|
+
const primed = _chunk4O2UGFFTcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
209
211
|
setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
|
|
210
|
-
|
|
212
|
+
_chunk4O2UGFFTcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
|
|
211
213
|
if (active) setState({ ready: true, chains });
|
|
212
214
|
});
|
|
213
215
|
return () => {
|
|
@@ -216,7 +218,7 @@ function ReownWalletProvider({
|
|
|
216
218
|
}, [backendUrl, overrides]);
|
|
217
219
|
_react.useEffect.call(void 0, () => {
|
|
218
220
|
setAppKitTheme(appKitReact.modal, theme);
|
|
219
|
-
return
|
|
221
|
+
return _chunk4O2UGFFTcjs.followSystemAppearance.call(void 0,
|
|
220
222
|
_optionalChain([theme, 'optionalAccess', _7 => _7.mode]),
|
|
221
223
|
() => setAppKitTheme(appKitReact.modal, theme)
|
|
222
224
|
);
|
|
@@ -280,7 +282,7 @@ function useReownWalletSession() {
|
|
|
280
282
|
await switchChainAsync({ chainId });
|
|
281
283
|
}
|
|
282
284
|
} catch (err) {
|
|
283
|
-
if (
|
|
285
|
+
if (_chunk4O2UGFFTcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
284
286
|
throw new Error(
|
|
285
287
|
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
286
288
|
);
|
|
@@ -293,7 +295,7 @@ function useReownWalletSession() {
|
|
|
293
295
|
|
|
294
296
|
// src/DepositModalReown.tsx
|
|
295
297
|
|
|
296
|
-
var [appKitReact2, , , , solanaAdapterReact] =
|
|
298
|
+
var [appKitReact2, , , , solanaAdapterReact] = _chunkCAIRS4LKcjs.getReownDependencies.call(void 0, );
|
|
297
299
|
var { useAppKitProvider } = appKitReact2;
|
|
298
300
|
var { useAppKitConnection } = solanaAdapterReact;
|
|
299
301
|
function DepositModalWithReown(props) {
|
|
@@ -315,7 +317,7 @@ function DepositModalWithReown(props) {
|
|
|
315
317
|
reown.disconnect();
|
|
316
318
|
}, [reown.disconnect]);
|
|
317
319
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
318
|
-
|
|
320
|
+
_chunkCAIRS4LKcjs.DepositModalInner,
|
|
319
321
|
{
|
|
320
322
|
...props,
|
|
321
323
|
walletSession: reownWithSolana,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModal,
|
|
3
3
|
buildWithdrawAnalyticsSessionProperties
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7CHQA2OZ.mjs";
|
|
5
|
+
import "./chunk-UNXUOV3F.mjs";
|
|
6
6
|
import "./chunk-YY4ZOAH5.mjs";
|
|
7
7
|
import "./chunk-E7IMWVMN.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-2D3J53PX.mjs";
|
|
9
9
|
export {
|
|
10
10
|
WithdrawModal,
|
|
11
11
|
buildWithdrawAnalyticsSessionProperties
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkU7NYYT4Qcjs = require('./chunk-U7NYYT4Q.cjs');
|
|
5
|
+
require('./chunk-4O2UGFFT.cjs');
|
|
6
|
+
require('./chunk-G264OM23.cjs');
|
|
7
|
+
require('./chunk-FKJ6EJHH.cjs');
|
|
8
|
+
require('./chunk-VQAV6ESI.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.WithdrawModal = _chunkU7NYYT4Qcjs.WithdrawModal; exports.buildWithdrawAnalyticsSessionProperties = _chunkU7NYYT4Qcjs.buildWithdrawAnalyticsSessionProperties;
|