@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
|
@@ -58,6 +58,9 @@ import {
|
|
|
58
58
|
getExchangeLogo,
|
|
59
59
|
getExchangeLogoSrc,
|
|
60
60
|
getPublicClient,
|
|
61
|
+
hasReached,
|
|
62
|
+
hostedOrderState,
|
|
63
|
+
hostedOrderStateFromSwapped,
|
|
61
64
|
isDepositEvent,
|
|
62
65
|
isDepositPolicyRefusal,
|
|
63
66
|
isDisplayStablecoinSymbol,
|
|
@@ -66,6 +69,7 @@ import {
|
|
|
66
69
|
isNativeAsset,
|
|
67
70
|
isNativeSol,
|
|
68
71
|
isSubmissionUncertain,
|
|
72
|
+
mergeHostedOrderState,
|
|
69
73
|
portfolioToAssets,
|
|
70
74
|
quoteFeeRow,
|
|
71
75
|
readDedupedAccountSetupResult,
|
|
@@ -94,7 +98,7 @@ import {
|
|
|
94
98
|
useTokenDisplay,
|
|
95
99
|
useTokenDisplays,
|
|
96
100
|
warnRemovedProps
|
|
97
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-UNXUOV3F.mjs";
|
|
98
102
|
import {
|
|
99
103
|
AppleIcon,
|
|
100
104
|
BankIcon,
|
|
@@ -115,6 +119,12 @@ import {
|
|
|
115
119
|
WalletIcon,
|
|
116
120
|
useLatestRef
|
|
117
121
|
} from "./chunk-YY4ZOAH5.mjs";
|
|
122
|
+
import {
|
|
123
|
+
rampQuery
|
|
124
|
+
} from "./chunk-PP4QE32S.mjs";
|
|
125
|
+
import {
|
|
126
|
+
createBearerTransport
|
|
127
|
+
} from "./chunk-PZIKRYMO.mjs";
|
|
118
128
|
import {
|
|
119
129
|
HYPERCORE_CHAIN_ID,
|
|
120
130
|
HYPERCORE_MIN_DEPOSIT_USD,
|
|
@@ -166,24 +176,23 @@ function getReownDependencies() {
|
|
|
166
176
|
|
|
167
177
|
// src/DepositModal.tsx
|
|
168
178
|
import {
|
|
169
|
-
useMemo as
|
|
179
|
+
useMemo as useMemo10,
|
|
170
180
|
useEffect as useEffect15,
|
|
171
181
|
useRef as useRef11,
|
|
172
182
|
useState as useState15,
|
|
173
|
-
useCallback as
|
|
174
|
-
lazy as
|
|
183
|
+
useCallback as useCallback8,
|
|
184
|
+
lazy as lazy4,
|
|
175
185
|
Suspense as Suspense3
|
|
176
186
|
} from "react";
|
|
177
187
|
|
|
178
188
|
// src/DepositFlow.tsx
|
|
179
189
|
import {
|
|
180
190
|
useState as useState13,
|
|
181
|
-
useCallback as
|
|
191
|
+
useCallback as useCallback6,
|
|
182
192
|
useMemo as useMemo8,
|
|
183
193
|
useEffect as useEffect13,
|
|
184
194
|
useLayoutEffect as useLayoutEffect2,
|
|
185
195
|
useRef as useRef9,
|
|
186
|
-
lazy as lazy2,
|
|
187
196
|
Suspense as Suspense2
|
|
188
197
|
} from "react";
|
|
189
198
|
|
|
@@ -518,6 +527,7 @@ function ConnectStep({
|
|
|
518
527
|
onPrefetchFiatMethod,
|
|
519
528
|
recommendedMethod,
|
|
520
529
|
onSelectFundFromExchange,
|
|
530
|
+
fundFromExchangeLoading,
|
|
521
531
|
onRequestConnect,
|
|
522
532
|
onConnect,
|
|
523
533
|
onDisconnect,
|
|
@@ -598,7 +608,9 @@ function ConnectStep({
|
|
|
598
608
|
title: "Connect exchange",
|
|
599
609
|
subtitle: "Instant - No limit",
|
|
600
610
|
meta: EXCHANGE_META,
|
|
601
|
-
onClick: onSelectFundFromExchange
|
|
611
|
+
onClick: onSelectFundFromExchange,
|
|
612
|
+
disabled: fundFromExchangeLoading,
|
|
613
|
+
trailing: fundFromExchangeLoading ? SMALL_SPINNER : void 0
|
|
602
614
|
},
|
|
603
615
|
"connect-exchange"
|
|
604
616
|
)
|
|
@@ -3476,8 +3488,8 @@ function DepositAddressStep({
|
|
|
3476
3488
|
}
|
|
3477
3489
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
3478
3490
|
|
|
3479
|
-
// src/components/steps/
|
|
3480
|
-
import { useCallback as useCallback3 } from "react";
|
|
3491
|
+
// src/components/steps/RampOrderStep.tsx
|
|
3492
|
+
import { lazy as lazy2, useCallback as useCallback3 } from "react";
|
|
3481
3493
|
|
|
3482
3494
|
// src/core/swapped.ts
|
|
3483
3495
|
var SWAPPED_ORIGINS = [
|
|
@@ -3549,7 +3561,7 @@ function SwappedOrderTracker({
|
|
|
3549
3561
|
onRetry
|
|
3550
3562
|
}) {
|
|
3551
3563
|
const formattedAmount = formatTrackerAmount(amount);
|
|
3552
|
-
const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
3564
|
+
const title = terminal ? terminal.title ?? (terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed") : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
3553
3565
|
const labels = [
|
|
3554
3566
|
STEP_LABELS[0],
|
|
3555
3567
|
`${currency} received`,
|
|
@@ -3627,16 +3639,10 @@ var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
|
|
|
3627
3639
|
var IFRAME_LOAD_TIMEOUT_MS = 15e3;
|
|
3628
3640
|
var SWAPPED_SUCCESS_HANDOFF_DELAY_MS = 1400;
|
|
3629
3641
|
var SWAPPED_IFRAME_ORIGINS = new Set(SWAPPED_ORIGINS);
|
|
3630
|
-
var
|
|
3631
|
-
"
|
|
3632
|
-
"
|
|
3633
|
-
|
|
3634
|
-
var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
3635
|
-
"payment_pending",
|
|
3636
|
-
"order_completed",
|
|
3637
|
-
"order_broadcasted",
|
|
3638
|
-
"order_cancelled"
|
|
3639
|
-
]);
|
|
3642
|
+
var OUTCOMES = {
|
|
3643
|
+
failed: { title: "Order failed", message: "Any charge will be refunded." },
|
|
3644
|
+
refunded: { title: "Order refunded", message: "Your payment was returned." }
|
|
3645
|
+
};
|
|
3640
3646
|
var SWAPPED_GO_BACK_KEY = "SWAPPED_GO_BACK";
|
|
3641
3647
|
var OPEN_FAILED_MESSAGE = "We could not open your browser.";
|
|
3642
3648
|
var OPEN_FAILED_CODE = "SWAPPED_BROWSER_UNAVAILABLE";
|
|
@@ -3682,19 +3688,20 @@ function parseSwappedIframeMessage(raw) {
|
|
|
3682
3688
|
const obj = data;
|
|
3683
3689
|
const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
|
|
3684
3690
|
const rawStatus = inner.order_status ?? inner.status ?? obj.status;
|
|
3685
|
-
if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
|
|
3686
|
-
return null;
|
|
3687
|
-
}
|
|
3688
3691
|
const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
3692
|
+
const state = typeof rawStatus === "string" ? hostedOrderStateFromSwapped(
|
|
3693
|
+
rawStatus,
|
|
3694
|
+
asString2(inner.transaction_id) ?? asString2(obj.transactionId)
|
|
3695
|
+
) : null;
|
|
3696
|
+
if (!state) return null;
|
|
3689
3697
|
return {
|
|
3690
|
-
|
|
3698
|
+
state,
|
|
3691
3699
|
orderId: asString2(inner.order_id) ?? asString2(obj.orderId),
|
|
3692
3700
|
externalCustomerId: asString2(inner.external_customer_id) ?? asString2(obj.external_customer_id) ?? asString2(inner.externalCustomerId) ?? asString2(obj.externalCustomerId),
|
|
3693
3701
|
orderCrypto: assetSymbol(
|
|
3694
3702
|
asString2(inner.order_crypto) ?? asString2(obj.orderCrypto)
|
|
3695
3703
|
),
|
|
3696
|
-
orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount)
|
|
3697
|
-
transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
|
|
3704
|
+
orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount)
|
|
3698
3705
|
};
|
|
3699
3706
|
}
|
|
3700
3707
|
function SwappedProviderStep({
|
|
@@ -3705,7 +3712,7 @@ function SwappedProviderStep({
|
|
|
3705
3712
|
iframeTitle,
|
|
3706
3713
|
loadErrorCode,
|
|
3707
3714
|
loadErrorFallback,
|
|
3708
|
-
|
|
3715
|
+
cancelledMessage,
|
|
3709
3716
|
onSwappedComplete,
|
|
3710
3717
|
onSwappedFailed,
|
|
3711
3718
|
onClose,
|
|
@@ -3738,6 +3745,8 @@ function SwappedProviderStep({
|
|
|
3738
3745
|
const expectedExternalCustomerIdRef = useRef6(null);
|
|
3739
3746
|
const baselineDepositTxHashRef = useRef6(void 0);
|
|
3740
3747
|
const currentDepositTxHashRef = useRef6(null);
|
|
3748
|
+
const deliveryTxHashRef = useRef6(null);
|
|
3749
|
+
deliveryTxHashRef.current = orderState?.deliveryTxHash ?? null;
|
|
3741
3750
|
const fastDepositPollEnabledRef = useRef6(false);
|
|
3742
3751
|
const rescheduleDepositPollRef = useRef6(
|
|
3743
3752
|
null
|
|
@@ -3861,7 +3870,10 @@ function SwappedProviderStep({
|
|
|
3861
3870
|
if (cancelled) return;
|
|
3862
3871
|
const isCurrentOrder = res !== null && res.orderId === expectedOrderUuidRef.current;
|
|
3863
3872
|
if (isCurrentOrder) {
|
|
3864
|
-
setOrderState(
|
|
3873
|
+
setOrderState((prev) => ({
|
|
3874
|
+
...res,
|
|
3875
|
+
...mergeHostedOrderState(prev, res)
|
|
3876
|
+
}));
|
|
3865
3877
|
}
|
|
3866
3878
|
} catch {
|
|
3867
3879
|
}
|
|
@@ -3898,15 +3910,29 @@ function SwappedProviderStep({
|
|
|
3898
3910
|
async function pollDeposit() {
|
|
3899
3911
|
if (cancelled) return;
|
|
3900
3912
|
try {
|
|
3901
|
-
const
|
|
3902
|
-
if (
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3913
|
+
const deliveryTxHash = deliveryTxHashRef.current;
|
|
3914
|
+
if (deliveryTxHash) {
|
|
3915
|
+
const { lastEvent } = await service.fetchStatus(
|
|
3916
|
+
smartAccount,
|
|
3917
|
+
deliveryTxHash
|
|
3918
|
+
);
|
|
3919
|
+
if (cancelled) return;
|
|
3920
|
+
const txHash = isDepositEvent(lastEvent) ? getEventTxHash(lastEvent) : void 0;
|
|
3921
|
+
if (lastEvent && txHash && txRefsMatch(txHash, deliveryTxHash)) {
|
|
3922
|
+
currentDepositTxHashRef.current = txHash;
|
|
3923
|
+
setLatestEvent(lastEvent);
|
|
3924
|
+
}
|
|
3925
|
+
} else {
|
|
3926
|
+
const status = await service.fetchLatestStatus(smartAccount);
|
|
3927
|
+
if (cancelled) return;
|
|
3928
|
+
const event = status.lastEvent;
|
|
3929
|
+
const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
|
|
3930
|
+
if (baselineDepositTxHashRef.current === void 0) {
|
|
3931
|
+
baselineDepositTxHashRef.current = eventTxHash;
|
|
3932
|
+
} else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
|
|
3933
|
+
currentDepositTxHashRef.current = eventTxHash;
|
|
3934
|
+
setLatestEvent(event ?? null);
|
|
3935
|
+
}
|
|
3910
3936
|
}
|
|
3911
3937
|
} catch {
|
|
3912
3938
|
}
|
|
@@ -3929,8 +3955,7 @@ function SwappedProviderStep({
|
|
|
3929
3955
|
}, [service, smartAccount]);
|
|
3930
3956
|
useEffect8(() => {
|
|
3931
3957
|
if (fastDepositPollEnabledRef.current) return;
|
|
3932
|
-
|
|
3933
|
-
if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
|
|
3958
|
+
if (!hasReached(orderState, "paid")) return;
|
|
3934
3959
|
fastDepositPollEnabledRef.current = true;
|
|
3935
3960
|
rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
|
|
3936
3961
|
}, [orderState]);
|
|
@@ -3954,10 +3979,9 @@ function SwappedProviderStep({
|
|
|
3954
3979
|
// Normalise to the uuid the backend poll also keys on, so orderState
|
|
3955
3980
|
// is consistent regardless of which path set it.
|
|
3956
3981
|
orderId: expectedOrderUuidRef.current ?? prev?.orderId ?? ext,
|
|
3957
|
-
|
|
3982
|
+
...mergeHostedOrderState(prev, parsed.state),
|
|
3958
3983
|
orderCrypto: parsed.orderCrypto ?? prev?.orderCrypto ?? null,
|
|
3959
3984
|
orderCryptoAmount: parsed.orderCryptoAmount ?? prev?.orderCryptoAmount ?? null,
|
|
3960
|
-
transactionId: parsed.transactionId ?? prev?.transactionId ?? null,
|
|
3961
3985
|
receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3962
3986
|
paidAmountUsd: prev?.paidAmountUsd ?? null,
|
|
3963
3987
|
paidAmountEur: prev?.paidAmountEur ?? null,
|
|
@@ -3969,13 +3993,13 @@ function SwappedProviderStep({
|
|
|
3969
3993
|
return () => window.removeEventListener("message", onMessage);
|
|
3970
3994
|
}, [openExternally]);
|
|
3971
3995
|
useEffect8(() => {
|
|
3972
|
-
const swappedProvesLive = orderState !== null &&
|
|
3996
|
+
const swappedProvesLive = orderState !== null && (variant !== "fiat" || hasReached(orderState, "paying") || orderState.outcome !== null);
|
|
3973
3997
|
if (phase === "provider" && (swappedProvesLive || latestEvent !== null)) {
|
|
3974
3998
|
setPhase("tracker");
|
|
3975
3999
|
}
|
|
3976
4000
|
}, [phase, orderState, latestEvent, variant]);
|
|
3977
4001
|
const stepStates = useMemo4(
|
|
3978
|
-
() => deriveStepStates(orderState
|
|
4002
|
+
() => deriveStepStates(orderState, latestEvent),
|
|
3979
4003
|
[orderState, latestEvent]
|
|
3980
4004
|
);
|
|
3981
4005
|
const terminalState = useMemo4(() => {
|
|
@@ -3985,15 +4009,15 @@ function SwappedProviderStep({
|
|
|
3985
4009
|
message: failureMessageForEvent(latestEvent ?? void 0)
|
|
3986
4010
|
};
|
|
3987
4011
|
}
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
return { kind: "cancelled", message:
|
|
4012
|
+
const outcome = orderState?.outcome;
|
|
4013
|
+
if (outcome) {
|
|
4014
|
+
return outcome === "cancelled" ? { kind: "cancelled", message: cancelledMessage } : { kind: "cancelled", ...OUTCOMES[outcome] };
|
|
3991
4015
|
}
|
|
3992
4016
|
return null;
|
|
3993
|
-
}, [latestEvent, orderState,
|
|
4017
|
+
}, [latestEvent, orderState, cancelledMessage]);
|
|
3994
4018
|
useEffect8(() => {
|
|
3995
|
-
if (orderState?.
|
|
3996
|
-
}, [onCancelled, orderState?.
|
|
4019
|
+
if (orderState?.outcome === "cancelled") onCancelled?.();
|
|
4020
|
+
}, [onCancelled, orderState?.outcome]);
|
|
3997
4021
|
useEffect8(() => {
|
|
3998
4022
|
if (completeFiredRef.current || failedFiredRef.current) return;
|
|
3999
4023
|
const t = latestEvent?.type;
|
|
@@ -4143,15 +4167,14 @@ function SwappedProviderStep({
|
|
|
4143
4167
|
loadError && /* @__PURE__ */ jsx17(PoweredBy, {})
|
|
4144
4168
|
] });
|
|
4145
4169
|
}
|
|
4146
|
-
function deriveStepStates(
|
|
4170
|
+
function deriveStepStates(order, latestEvent) {
|
|
4147
4171
|
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
4148
4172
|
return ["complete", "complete", "failed", "pending"];
|
|
4149
4173
|
}
|
|
4150
|
-
if (
|
|
4174
|
+
if (order?.outcome) {
|
|
4151
4175
|
return ["failed", "pending", "pending", "pending"];
|
|
4152
4176
|
}
|
|
4153
|
-
const
|
|
4154
|
-
const step2Complete = latestEvent !== null || swappedStatus === "order_broadcasted";
|
|
4177
|
+
const step2Complete = latestEvent !== null || hasReached(order, "sent");
|
|
4155
4178
|
const step3Complete = latestEvent?.type === "bridge-complete";
|
|
4156
4179
|
if (step3Complete) {
|
|
4157
4180
|
return ["complete", "complete", "complete", "complete"];
|
|
@@ -4159,65 +4182,70 @@ function deriveStepStates(swappedStatus, latestEvent) {
|
|
|
4159
4182
|
if (step2Complete) {
|
|
4160
4183
|
return ["complete", "complete", "active", "pending"];
|
|
4161
4184
|
}
|
|
4162
|
-
if (
|
|
4185
|
+
if (hasReached(order, "paid")) {
|
|
4163
4186
|
return ["complete", "active", "pending", "pending"];
|
|
4164
4187
|
}
|
|
4165
4188
|
return ["active", "pending", "pending", "pending"];
|
|
4166
4189
|
}
|
|
4167
4190
|
SwappedProviderStep.displayName = "SwappedProviderStep";
|
|
4168
4191
|
|
|
4169
|
-
// src/components/steps/
|
|
4192
|
+
// src/components/steps/RampOrderStep.tsx
|
|
4170
4193
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4194
|
+
var BankOnrampStep = lazy2(async () => {
|
|
4195
|
+
const module = await import("./BankOnrampStep-JTU7WS5R.mjs");
|
|
4196
|
+
return { default: module.BankOnrampStep };
|
|
4197
|
+
});
|
|
4198
|
+
var HOSTED = {
|
|
4199
|
+
fiat: {
|
|
4200
|
+
iframeTitle: "Buy crypto with Swapped",
|
|
4201
|
+
loadErrorCode: "SWAPPED_URL_FAILED",
|
|
4202
|
+
loadErrorFallback: "Failed to load on-ramp",
|
|
4203
|
+
cancelledMessage: "If you were charged, Swapped will refund within 5 business days."
|
|
4204
|
+
},
|
|
4205
|
+
exchange: {
|
|
4206
|
+
iframeTitle: "Fund from exchange via Swapped",
|
|
4207
|
+
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
4208
|
+
loadErrorFallback: "Failed to load Connect",
|
|
4209
|
+
cancelledMessage: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
4178
4210
|
}
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
}
|
|
4211
|
+
};
|
|
4212
|
+
function RampOrderStep(props) {
|
|
4213
|
+
const { order, smartAccount } = props;
|
|
4214
|
+
if (order.flow === "funding_account") {
|
|
4215
|
+
return /* @__PURE__ */ jsx18(
|
|
4216
|
+
BankOnrampStep,
|
|
4217
|
+
{
|
|
4218
|
+
backendUrl: order.backendUrl,
|
|
4219
|
+
smartAccount,
|
|
4220
|
+
getCustomerSession: order.getCustomerSession,
|
|
4221
|
+
onJourney: order.onJourney,
|
|
4222
|
+
onGoBack: props.onGoBack,
|
|
4223
|
+
onError: props.onError,
|
|
4224
|
+
openExternally: props.openExternally,
|
|
4225
|
+
onUnavailable: order.onUnavailable
|
|
4226
|
+
},
|
|
4227
|
+
`${order.backendUrl}:${smartAccount}`
|
|
4228
|
+
);
|
|
4195
4229
|
}
|
|
4230
|
+
return /* @__PURE__ */ jsx18(HostedOrder, { ...props, order });
|
|
4196
4231
|
}
|
|
4197
|
-
function
|
|
4232
|
+
function HostedOrder({
|
|
4233
|
+
order,
|
|
4198
4234
|
smartAccount,
|
|
4199
4235
|
service,
|
|
4200
|
-
|
|
4201
|
-
methodSelectionSource,
|
|
4202
|
-
consumePrefetchedUrl,
|
|
4203
|
-
onSwappedComplete,
|
|
4204
|
-
onSwappedFailed,
|
|
4205
|
-
onClose,
|
|
4206
|
-
onGoBack,
|
|
4207
|
-
onError,
|
|
4208
|
-
onAttemptConsumed,
|
|
4209
|
-
onProviderHandoff,
|
|
4210
|
-
onRetry,
|
|
4211
|
-
onCancelled,
|
|
4212
|
-
onImmersiveChange,
|
|
4213
|
-
openExternally
|
|
4236
|
+
...callbacks
|
|
4214
4237
|
}) {
|
|
4238
|
+
const method = order.kind === "fiat" ? order.method : void 0;
|
|
4239
|
+
const source = order.kind === "fiat" ? order.methodSelectionSource : void 0;
|
|
4240
|
+
const consumePrefetched = order.kind === "fiat" ? order.consumePrefetchedUrl : void 0;
|
|
4241
|
+
const connection = order.kind === "exchange" ? order.connection : void 0;
|
|
4242
|
+
const loadPrepared = order.kind === "exchange" ? order.loadPreparedUrl : void 0;
|
|
4215
4243
|
const loadUrl = useCallback3(async () => {
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
);
|
|
4244
|
+
if (connection !== void 0) {
|
|
4245
|
+
if (loadPrepared) return loadPrepared();
|
|
4246
|
+
return service.getSwappedConnectUrl({ smartAccount, connection });
|
|
4247
|
+
}
|
|
4248
|
+
const prefetched = consumePrefetched?.(smartAccount, method, source);
|
|
4221
4249
|
if (prefetched) {
|
|
4222
4250
|
try {
|
|
4223
4251
|
const cached = await prefetched;
|
|
@@ -4227,136 +4255,82 @@ function FiatOnrampStep({
|
|
|
4227
4255
|
}
|
|
4228
4256
|
return service.getSwappedWidgetUrl({
|
|
4229
4257
|
smartAccount,
|
|
4230
|
-
method
|
|
4231
|
-
methodSelectionSource
|
|
4258
|
+
method,
|
|
4259
|
+
methodSelectionSource: source
|
|
4232
4260
|
});
|
|
4233
4261
|
}, [
|
|
4234
4262
|
service,
|
|
4235
4263
|
smartAccount,
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4264
|
+
method,
|
|
4265
|
+
source,
|
|
4266
|
+
consumePrefetched,
|
|
4267
|
+
connection,
|
|
4268
|
+
loadPrepared
|
|
4239
4269
|
]);
|
|
4240
4270
|
return /* @__PURE__ */ jsx18(
|
|
4241
4271
|
SwappedProviderStep,
|
|
4242
4272
|
{
|
|
4243
4273
|
smartAccount,
|
|
4244
4274
|
service,
|
|
4245
|
-
variant: "fiat",
|
|
4275
|
+
variant: order.kind === "fiat" ? "fiat" : "connect",
|
|
4246
4276
|
loadUrl,
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
loadErrorFallback: "Failed to load on-ramp",
|
|
4250
|
-
bannerForStatus: fiatBannerForStatus,
|
|
4251
|
-
onSwappedComplete,
|
|
4252
|
-
onSwappedFailed,
|
|
4253
|
-
onClose,
|
|
4254
|
-
onGoBack,
|
|
4255
|
-
onError,
|
|
4256
|
-
onAttemptConsumed,
|
|
4257
|
-
onProviderHandoff,
|
|
4258
|
-
onRetry,
|
|
4259
|
-
onCancelled,
|
|
4260
|
-
onImmersiveChange,
|
|
4261
|
-
openExternally
|
|
4277
|
+
...HOSTED[order.kind],
|
|
4278
|
+
...callbacks
|
|
4262
4279
|
}
|
|
4263
4280
|
);
|
|
4264
4281
|
}
|
|
4265
|
-
|
|
4282
|
+
RampOrderStep.displayName = "RampOrderStep";
|
|
4266
4283
|
|
|
4267
|
-
// src/
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4284
|
+
// src/core/ramp-rows.ts
|
|
4285
|
+
var NOT_SERVED_NOTICE = "Bank transfer isn't available in your region.";
|
|
4286
|
+
function resolveRampRows(input) {
|
|
4287
|
+
const { providers } = input;
|
|
4288
|
+
const has = (provider, kind) => providers === null || providers !== "loading" && providers.some((p) => p.provider === provider && p.kinds.includes(kind));
|
|
4289
|
+
const loading = providers === "loading";
|
|
4290
|
+
const exchange = !input.enableExchangeConnect ? "hidden" : loading ? "loading" : has("swapped", "exchange") ? "offered" : "hidden";
|
|
4291
|
+
const bankRequested = input.virtualAccounts && input.customerSession && input.bankTransferAllowed;
|
|
4292
|
+
const swappedFiat = has("swapped", "fiat");
|
|
4293
|
+
const bankBy = !bankRequested ? null : has("noah", "fiat") && !input.noahNotServed ? "noah" : swappedFiat && !refusesBank(input.swappedMethods) ? "swapped" : null;
|
|
4294
|
+
const notice = bankRequested && input.noahNotServed && !bankBy ? NOT_SERVED_NOTICE : null;
|
|
4295
|
+
const offered = input.enableFiatOnramp && swappedFiat ? input.swappedMethods : { kind: "hidden" };
|
|
4296
|
+
const swapped = offered.kind === "hidden" && bankBy ? {
|
|
4297
|
+
kind: "list",
|
|
4298
|
+
methods: [],
|
|
4299
|
+
recommendedMethod: input.bankRow.method,
|
|
4300
|
+
country: null,
|
|
4301
|
+
source: "configured"
|
|
4302
|
+
} : offered;
|
|
4303
|
+
if (loading && (input.enableFiatOnramp || bankRequested)) {
|
|
4304
|
+
return { cash: { kind: "loading" }, exchange, notice: null };
|
|
4277
4305
|
}
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
};
|
|
4286
|
-
case "order_broadcasted":
|
|
4287
|
-
return {
|
|
4288
|
-
level: "success",
|
|
4289
|
-
title: "Crypto sent \u2014 confirming on-chain"
|
|
4290
|
-
};
|
|
4291
|
-
case "order_cancelled":
|
|
4292
|
-
return {
|
|
4293
|
-
level: "warning",
|
|
4294
|
-
title: "Order cancelled",
|
|
4295
|
-
detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
4296
|
-
};
|
|
4306
|
+
if (swapped.kind !== "list") return { cash: swapped, exchange, notice };
|
|
4307
|
+
const methods = swapped.methods.map((m) => ({
|
|
4308
|
+
...m,
|
|
4309
|
+
provider: isBankRow(m) && bankBy ? bankBy : "swapped"
|
|
4310
|
+
}));
|
|
4311
|
+
if (bankBy && !methods.some(isBankRow)) {
|
|
4312
|
+
methods.push({ ...input.bankRow, provider: bankBy });
|
|
4297
4313
|
}
|
|
4314
|
+
return { cash: { ...swapped, methods }, exchange, notice };
|
|
4298
4315
|
}
|
|
4299
|
-
function
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
onClose,
|
|
4307
|
-
onGoBack,
|
|
4308
|
-
onError,
|
|
4309
|
-
onAttemptConsumed,
|
|
4310
|
-
onProviderHandoff,
|
|
4311
|
-
onRetry,
|
|
4312
|
-
onCancelled,
|
|
4313
|
-
onImmersiveChange,
|
|
4314
|
-
openExternally
|
|
4315
|
-
}) {
|
|
4316
|
-
const loadUrl = useCallback4(async () => {
|
|
4317
|
-
if (loadPreparedUrl) return loadPreparedUrl();
|
|
4318
|
-
const res = await service.getSwappedConnectUrl({
|
|
4319
|
-
smartAccount,
|
|
4320
|
-
connection
|
|
4321
|
-
});
|
|
4322
|
-
return res;
|
|
4323
|
-
}, [loadPreparedUrl, service, smartAccount, connection]);
|
|
4324
|
-
return /* @__PURE__ */ jsx19(
|
|
4325
|
-
SwappedProviderStep,
|
|
4326
|
-
{
|
|
4327
|
-
smartAccount,
|
|
4328
|
-
service,
|
|
4329
|
-
variant: "connect",
|
|
4330
|
-
loadUrl,
|
|
4331
|
-
iframeTitle: "Fund from exchange via Swapped",
|
|
4332
|
-
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
4333
|
-
loadErrorFallback: "Failed to load Connect",
|
|
4334
|
-
bannerForStatus: connectBannerForStatus,
|
|
4335
|
-
onSwappedComplete,
|
|
4336
|
-
onSwappedFailed,
|
|
4337
|
-
onClose,
|
|
4338
|
-
onGoBack,
|
|
4339
|
-
onError,
|
|
4340
|
-
onAttemptConsumed,
|
|
4341
|
-
onProviderHandoff,
|
|
4342
|
-
onRetry,
|
|
4343
|
-
onCancelled,
|
|
4344
|
-
onImmersiveChange,
|
|
4345
|
-
openExternally
|
|
4346
|
-
}
|
|
4347
|
-
);
|
|
4316
|
+
function refusesBank(swapped) {
|
|
4317
|
+
if (swapped.kind === "hidden") return true;
|
|
4318
|
+
if (swapped.kind !== "list" || swapped.source === "fallback") return false;
|
|
4319
|
+
return !swapped.methods.some(isBankRow);
|
|
4320
|
+
}
|
|
4321
|
+
function isBankRow(m) {
|
|
4322
|
+
return m.method === "bank-transfer";
|
|
4348
4323
|
}
|
|
4349
|
-
ExchangeConnectStep.displayName = "ExchangeConnectStep";
|
|
4350
4324
|
|
|
4351
4325
|
// src/components/steps/ExchangeSelectStep.tsx
|
|
4352
|
-
import { useCallback as
|
|
4353
|
-
import { jsx as
|
|
4326
|
+
import { useCallback as useCallback4, useEffect as useEffect9, useState as useState9 } from "react";
|
|
4327
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4354
4328
|
function ExchangeLogo({ exchange }) {
|
|
4355
4329
|
const [failed, setFailed] = useState9(false);
|
|
4356
4330
|
if (!exchange.logoUrl || failed) {
|
|
4357
|
-
return /* @__PURE__ */
|
|
4331
|
+
return /* @__PURE__ */ jsx19(BankIcon, {});
|
|
4358
4332
|
}
|
|
4359
|
-
return /* @__PURE__ */
|
|
4333
|
+
return /* @__PURE__ */ jsx19(
|
|
4360
4334
|
"img",
|
|
4361
4335
|
{
|
|
4362
4336
|
src: exchange.logoUrl,
|
|
@@ -4378,7 +4352,7 @@ function ExchangeSelectStep({
|
|
|
4378
4352
|
null
|
|
4379
4353
|
);
|
|
4380
4354
|
const [selectionNotice, setSelectionNotice] = useState9(null);
|
|
4381
|
-
const retry =
|
|
4355
|
+
const retry = useCallback4(() => {
|
|
4382
4356
|
setRetryToken((n) => n + 1);
|
|
4383
4357
|
}, []);
|
|
4384
4358
|
useEffect9(() => {
|
|
@@ -4401,7 +4375,7 @@ function ExchangeSelectStep({
|
|
|
4401
4375
|
cancelled = true;
|
|
4402
4376
|
};
|
|
4403
4377
|
}, [service, retryToken, onError]);
|
|
4404
|
-
const selectExchange =
|
|
4378
|
+
const selectExchange = useCallback4(
|
|
4405
4379
|
async (connection) => {
|
|
4406
4380
|
setSelectingConnection(connection);
|
|
4407
4381
|
setSelectionNotice(null);
|
|
@@ -4419,18 +4393,18 @@ function ExchangeSelectStep({
|
|
|
4419
4393
|
);
|
|
4420
4394
|
return /* @__PURE__ */ jsxs16("div", { className: "rs-screen rs-exchange-select", children: [
|
|
4421
4395
|
/* @__PURE__ */ jsxs16("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4422
|
-
/* @__PURE__ */
|
|
4396
|
+
/* @__PURE__ */ jsx19(
|
|
4423
4397
|
BodyHeader,
|
|
4424
4398
|
{
|
|
4425
|
-
icon: /* @__PURE__ */
|
|
4399
|
+
icon: /* @__PURE__ */ jsx19(UnplugIcon, {}),
|
|
4426
4400
|
title: "Connect exchange",
|
|
4427
4401
|
subtitle: "Select an exchange to connect"
|
|
4428
4402
|
}
|
|
4429
4403
|
),
|
|
4430
|
-
loading && /* @__PURE__ */
|
|
4404
|
+
loading && /* @__PURE__ */ jsx19("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx19(Spinner, {}) }),
|
|
4431
4405
|
!loading && error && /* @__PURE__ */ jsxs16("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsx19("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
|
|
4407
|
+
/* @__PURE__ */ jsx19(
|
|
4434
4408
|
"button",
|
|
4435
4409
|
{
|
|
4436
4410
|
type: "button",
|
|
@@ -4441,8 +4415,8 @@ function ExchangeSelectStep({
|
|
|
4441
4415
|
)
|
|
4442
4416
|
] }),
|
|
4443
4417
|
!loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
4444
|
-
/* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
4418
|
+
/* @__PURE__ */ jsx19("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
|
|
4419
|
+
/* @__PURE__ */ jsx19(
|
|
4446
4420
|
"button",
|
|
4447
4421
|
{
|
|
4448
4422
|
type: "button",
|
|
@@ -4452,7 +4426,7 @@ function ExchangeSelectStep({
|
|
|
4452
4426
|
}
|
|
4453
4427
|
)
|
|
4454
4428
|
] }),
|
|
4455
|
-
!loading && !error && exchanges.length > 0 && /* @__PURE__ */
|
|
4429
|
+
!loading && !error && exchanges.length > 0 && /* @__PURE__ */ jsx19("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => {
|
|
4456
4430
|
const brand = getExchangeLogo(exchange.name, exchange.connection);
|
|
4457
4431
|
return /* @__PURE__ */ jsxs16(
|
|
4458
4432
|
"button",
|
|
@@ -4464,22 +4438,22 @@ function ExchangeSelectStep({
|
|
|
4464
4438
|
"aria-busy": selectingConnection === exchange.connection,
|
|
4465
4439
|
"aria-label": `Select ${exchange.name}`,
|
|
4466
4440
|
children: [
|
|
4467
|
-
/* @__PURE__ */
|
|
4441
|
+
/* @__PURE__ */ jsx19(
|
|
4468
4442
|
"span",
|
|
4469
4443
|
{
|
|
4470
4444
|
className: `rs-exchange-card-logo${brand ? " rs-exchange-card-logo--brand" : ""}`,
|
|
4471
|
-
children: brand ?? /* @__PURE__ */
|
|
4445
|
+
children: brand ?? /* @__PURE__ */ jsx19(ExchangeLogo, { exchange })
|
|
4472
4446
|
}
|
|
4473
4447
|
),
|
|
4474
|
-
/* @__PURE__ */
|
|
4448
|
+
/* @__PURE__ */ jsx19("span", { className: "rs-exchange-card-name", children: exchange.name })
|
|
4475
4449
|
]
|
|
4476
4450
|
},
|
|
4477
4451
|
exchange.connection
|
|
4478
4452
|
);
|
|
4479
4453
|
}) })
|
|
4480
4454
|
] }),
|
|
4481
|
-
/* @__PURE__ */
|
|
4482
|
-
selectionNotice && /* @__PURE__ */
|
|
4455
|
+
/* @__PURE__ */ jsx19(PoweredBy, {}),
|
|
4456
|
+
selectionNotice && /* @__PURE__ */ jsx19("p", { className: "rs-exchange-select-fee-note", role: "status", children: selectionNotice })
|
|
4483
4457
|
] });
|
|
4484
4458
|
}
|
|
4485
4459
|
ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
@@ -4487,7 +4461,7 @@ ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
|
4487
4461
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
4488
4462
|
import { useState as useState10, useEffect as useEffect10, useMemo as useMemo5 } from "react";
|
|
4489
4463
|
import { formatUnits as formatUnits4 } from "viem";
|
|
4490
|
-
import { jsx as
|
|
4464
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4491
4465
|
function SolanaTokenSelectStep({
|
|
4492
4466
|
solanaAddress,
|
|
4493
4467
|
service,
|
|
@@ -4595,28 +4569,28 @@ function SolanaTokenSelectStep({
|
|
|
4595
4569
|
const chainName = getChainName("solana");
|
|
4596
4570
|
return /* @__PURE__ */ jsxs17("div", { className: "rs-screen", children: [
|
|
4597
4571
|
/* @__PURE__ */ jsxs17("div", { className: "rs-screen-body", children: [
|
|
4598
|
-
/* @__PURE__ */
|
|
4572
|
+
/* @__PURE__ */ jsx20(
|
|
4599
4573
|
BodyHeader,
|
|
4600
4574
|
{
|
|
4601
|
-
icon: /* @__PURE__ */
|
|
4575
|
+
icon: /* @__PURE__ */ jsx20(WalletIcon, {}),
|
|
4602
4576
|
title: "Your assets",
|
|
4603
4577
|
subtitle: "Select source assets to transfer"
|
|
4604
4578
|
}
|
|
4605
4579
|
),
|
|
4606
4580
|
loading && /* @__PURE__ */ jsxs17("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
4607
|
-
/* @__PURE__ */
|
|
4608
|
-
/* @__PURE__ */
|
|
4581
|
+
/* @__PURE__ */ jsx20(Spinner, { className: "rs-text-tertiary" }),
|
|
4582
|
+
/* @__PURE__ */ jsx20("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
4609
4583
|
] }),
|
|
4610
|
-
error && /* @__PURE__ */
|
|
4584
|
+
error && /* @__PURE__ */ jsx20(Callout, { variant: "error", children: error }),
|
|
4611
4585
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs17("div", { className: "rs-empty-state", children: [
|
|
4612
|
-
/* @__PURE__ */
|
|
4613
|
-
/* @__PURE__ */
|
|
4586
|
+
/* @__PURE__ */ jsx20(WalletIcon, { className: "rs-empty-icon" }),
|
|
4587
|
+
/* @__PURE__ */ jsx20("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
4614
4588
|
/* @__PURE__ */ jsxs17("div", { className: "rs-empty-address", children: [
|
|
4615
4589
|
solanaAddress.slice(0, 6),
|
|
4616
4590
|
"...",
|
|
4617
4591
|
solanaAddress.slice(-4)
|
|
4618
4592
|
] }),
|
|
4619
|
-
onDisconnect && /* @__PURE__ */
|
|
4593
|
+
onDisconnect && /* @__PURE__ */ jsx20(
|
|
4620
4594
|
"button",
|
|
4621
4595
|
{
|
|
4622
4596
|
type: "button",
|
|
@@ -4626,7 +4600,7 @@ function SolanaTokenSelectStep({
|
|
|
4626
4600
|
}
|
|
4627
4601
|
)
|
|
4628
4602
|
] }),
|
|
4629
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
4603
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx20("div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
4630
4604
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
4631
4605
|
const tokenAmount = formatBalance(entry);
|
|
4632
4606
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -4639,7 +4613,7 @@ function SolanaTokenSelectStep({
|
|
|
4639
4613
|
children: [
|
|
4640
4614
|
/* @__PURE__ */ jsxs17("div", { className: "rs-asset-info", children: [
|
|
4641
4615
|
/* @__PURE__ */ jsxs17("div", { className: "rs-asset-icon-wrapper", children: [
|
|
4642
|
-
/* @__PURE__ */
|
|
4616
|
+
/* @__PURE__ */ jsx20("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx20(
|
|
4643
4617
|
TokenIcon,
|
|
4644
4618
|
{
|
|
4645
4619
|
token: { chain: "solana", address: entry.token.mint },
|
|
@@ -4647,11 +4621,11 @@ function SolanaTokenSelectStep({
|
|
|
4647
4621
|
fallback: entry.token.symbol.slice(0, 4)
|
|
4648
4622
|
}
|
|
4649
4623
|
) }),
|
|
4650
|
-
chainIcon && /* @__PURE__ */
|
|
4624
|
+
chainIcon && /* @__PURE__ */ jsx20("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx20(CdnIcon, { src: chainIcon, alt: chainName }) })
|
|
4651
4625
|
] }),
|
|
4652
4626
|
/* @__PURE__ */ jsxs17("div", { className: "rs-asset-text", children: [
|
|
4653
4627
|
/* @__PURE__ */ jsxs17("div", { className: "rs-asset-name-row", children: [
|
|
4654
|
-
/* @__PURE__ */
|
|
4628
|
+
/* @__PURE__ */ jsx20("span", { className: "rs-asset-name", children: entry.token.symbol }),
|
|
4655
4629
|
/* @__PURE__ */ jsxs17("span", { className: "rs-asset-chain", children: [
|
|
4656
4630
|
"on ",
|
|
4657
4631
|
chainName
|
|
@@ -4664,13 +4638,13 @@ function SolanaTokenSelectStep({
|
|
|
4664
4638
|
] })
|
|
4665
4639
|
] })
|
|
4666
4640
|
] }),
|
|
4667
|
-
/* @__PURE__ */
|
|
4641
|
+
/* @__PURE__ */ jsx20("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
4668
4642
|
]
|
|
4669
4643
|
},
|
|
4670
4644
|
entry.token.symbol
|
|
4671
4645
|
);
|
|
4672
4646
|
}) }),
|
|
4673
|
-
/* @__PURE__ */
|
|
4647
|
+
/* @__PURE__ */ jsx20(
|
|
4674
4648
|
Button,
|
|
4675
4649
|
{
|
|
4676
4650
|
onClick: () => selectedEntry && onContinue(
|
|
@@ -4684,14 +4658,14 @@ function SolanaTokenSelectStep({
|
|
|
4684
4658
|
}
|
|
4685
4659
|
)
|
|
4686
4660
|
] }),
|
|
4687
|
-
/* @__PURE__ */
|
|
4661
|
+
/* @__PURE__ */ jsx20(PoweredBy, {})
|
|
4688
4662
|
] });
|
|
4689
4663
|
}
|
|
4690
4664
|
|
|
4691
4665
|
// src/components/steps/SolanaAmountStep.tsx
|
|
4692
|
-
import { useCallback as
|
|
4666
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo6, useRef as useRef7, useState as useState11 } from "react";
|
|
4693
4667
|
import { formatUnits as formatUnits5, parseUnits as parseUnits4 } from "viem";
|
|
4694
|
-
import { Fragment as Fragment5, jsx as
|
|
4668
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4695
4669
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
4696
4670
|
var PRESETS2 = [
|
|
4697
4671
|
{ value: 25, label: "25%" },
|
|
@@ -4767,7 +4741,7 @@ function SolanaAmountStep({
|
|
|
4767
4741
|
return null;
|
|
4768
4742
|
}
|
|
4769
4743
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
4770
|
-
const computePresetAmount =
|
|
4744
|
+
const computePresetAmount = useCallback5(
|
|
4771
4745
|
(percentage) => {
|
|
4772
4746
|
try {
|
|
4773
4747
|
const spendableUnits = Number(
|
|
@@ -4899,10 +4873,10 @@ function SolanaAmountStep({
|
|
|
4899
4873
|
const continueDisabled = exceedsBalance || boundViolation !== null || numericAmount === 0 && !isBelowMin;
|
|
4900
4874
|
return /* @__PURE__ */ jsxs18("div", { className: "rs-screen", children: [
|
|
4901
4875
|
/* @__PURE__ */ jsxs18("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4902
|
-
/* @__PURE__ */
|
|
4876
|
+
/* @__PURE__ */ jsx21(BodyHeader, { icon: /* @__PURE__ */ jsx21(WalletIcon, {}), title: "Wallet deposit" }),
|
|
4903
4877
|
/* @__PURE__ */ jsxs18("div", { className: "rs-amount-section", children: [
|
|
4904
4878
|
/* @__PURE__ */ jsxs18("div", { className: "rs-amount-display", children: [
|
|
4905
|
-
/* @__PURE__ */
|
|
4879
|
+
/* @__PURE__ */ jsx21(
|
|
4906
4880
|
AnimatedAmountInput,
|
|
4907
4881
|
{
|
|
4908
4882
|
value: amount,
|
|
@@ -4929,7 +4903,7 @@ function SolanaAmountStep({
|
|
|
4929
4903
|
] })
|
|
4930
4904
|
] })
|
|
4931
4905
|
] }),
|
|
4932
|
-
/* @__PURE__ */
|
|
4906
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx21(
|
|
4933
4907
|
"button",
|
|
4934
4908
|
{
|
|
4935
4909
|
type: "button",
|
|
@@ -4942,13 +4916,13 @@ function SolanaAmountStep({
|
|
|
4942
4916
|
] }),
|
|
4943
4917
|
/* @__PURE__ */ jsxs18("div", { className: "rs-amount-details", children: [
|
|
4944
4918
|
/* @__PURE__ */ jsxs18("div", { className: "rs-amount-detail-row", children: [
|
|
4945
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsx21("span", { children: "You send" }),
|
|
4946
4920
|
/* @__PURE__ */ jsxs18("span", { className: "rs-amount-detail-value", children: [
|
|
4947
4921
|
/* @__PURE__ */ jsxs18("span", { children: [
|
|
4948
4922
|
"Solana ",
|
|
4949
4923
|
token.symbol
|
|
4950
4924
|
] }),
|
|
4951
|
-
/* @__PURE__ */
|
|
4925
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx21(
|
|
4952
4926
|
TokenIcon,
|
|
4953
4927
|
{
|
|
4954
4928
|
token: { chain: "solana", address: token.mint },
|
|
@@ -4958,23 +4932,23 @@ function SolanaAmountStep({
|
|
|
4958
4932
|
] })
|
|
4959
4933
|
] }),
|
|
4960
4934
|
targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs18("div", { className: "rs-amount-detail-row", children: [
|
|
4961
|
-
/* @__PURE__ */
|
|
4935
|
+
/* @__PURE__ */ jsx21("span", { children: "Receive" }),
|
|
4962
4936
|
/* @__PURE__ */ jsxs18("span", { className: "rs-amount-detail-value", children: [
|
|
4963
4937
|
/* @__PURE__ */ jsxs18("span", { children: [
|
|
4964
4938
|
targetChainName,
|
|
4965
4939
|
" ",
|
|
4966
4940
|
targetTokenSymbol
|
|
4967
4941
|
] }),
|
|
4968
|
-
/* @__PURE__ */
|
|
4942
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx21(TokenIcon, { token: targetToken, symbol: targetTokenSymbol }) })
|
|
4969
4943
|
] })
|
|
4970
4944
|
] }),
|
|
4971
4945
|
balanceAfterUsd !== null && /* @__PURE__ */ jsxs18("div", { className: "rs-amount-detail-row", children: [
|
|
4972
|
-
/* @__PURE__ */
|
|
4973
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx21("span", { children: "Balance after deposit" }),
|
|
4947
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
4974
4948
|
] })
|
|
4975
4949
|
] }),
|
|
4976
|
-
error && /* @__PURE__ */
|
|
4977
|
-
/* @__PURE__ */
|
|
4950
|
+
error && /* @__PURE__ */ jsx21(Callout, { variant: "error", children: error }),
|
|
4951
|
+
/* @__PURE__ */ jsx21(
|
|
4978
4952
|
Button,
|
|
4979
4953
|
{
|
|
4980
4954
|
onClick: handleContinue,
|
|
@@ -4984,7 +4958,7 @@ function SolanaAmountStep({
|
|
|
4984
4958
|
}
|
|
4985
4959
|
)
|
|
4986
4960
|
] }),
|
|
4987
|
-
/* @__PURE__ */
|
|
4961
|
+
/* @__PURE__ */ jsx21(PoweredBy, {})
|
|
4988
4962
|
] });
|
|
4989
4963
|
}
|
|
4990
4964
|
|
|
@@ -5102,7 +5076,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
|
5102
5076
|
}
|
|
5103
5077
|
|
|
5104
5078
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
5105
|
-
import { jsx as
|
|
5079
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5106
5080
|
function SolanaConfirmStep({
|
|
5107
5081
|
smartAccount,
|
|
5108
5082
|
solanaAddress,
|
|
@@ -5255,8 +5229,8 @@ function SolanaConfirmStep({
|
|
|
5255
5229
|
};
|
|
5256
5230
|
return /* @__PURE__ */ jsxs19("div", { className: "rs-screen", children: [
|
|
5257
5231
|
/* @__PURE__ */ jsxs19("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5258
|
-
/* @__PURE__ */
|
|
5259
|
-
/* @__PURE__ */
|
|
5232
|
+
/* @__PURE__ */ jsx22(BodyHeader, { icon: /* @__PURE__ */ jsx22(WalletIcon, {}), title: "Review deposit" }),
|
|
5233
|
+
/* @__PURE__ */ jsx22(
|
|
5260
5234
|
ReviewDetails,
|
|
5261
5235
|
{
|
|
5262
5236
|
sourceChainName,
|
|
@@ -5273,8 +5247,8 @@ function SolanaConfirmStep({
|
|
|
5273
5247
|
fee: { display: "$0.04", struck: feeSponsored, tooltip: feeTooltip }
|
|
5274
5248
|
}
|
|
5275
5249
|
),
|
|
5276
|
-
error && /* @__PURE__ */
|
|
5277
|
-
/* @__PURE__ */
|
|
5250
|
+
error && /* @__PURE__ */ jsx22(Callout, { variant: "error", children: error }),
|
|
5251
|
+
/* @__PURE__ */ jsx22(
|
|
5278
5252
|
Button,
|
|
5279
5253
|
{
|
|
5280
5254
|
onClick: handleConfirm,
|
|
@@ -5286,12 +5260,12 @@ function SolanaConfirmStep({
|
|
|
5286
5260
|
}
|
|
5287
5261
|
)
|
|
5288
5262
|
] }),
|
|
5289
|
-
/* @__PURE__ */
|
|
5263
|
+
/* @__PURE__ */ jsx22(PoweredBy, {})
|
|
5290
5264
|
] });
|
|
5291
5265
|
}
|
|
5292
5266
|
|
|
5293
5267
|
// src/components/steps/DappImportAssetSelectStep.tsx
|
|
5294
|
-
import { jsx as
|
|
5268
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5295
5269
|
function DappImportAssetSelectStep({
|
|
5296
5270
|
sourceLabel,
|
|
5297
5271
|
assets,
|
|
@@ -5300,16 +5274,16 @@ function DappImportAssetSelectStep({
|
|
|
5300
5274
|
}) {
|
|
5301
5275
|
return /* @__PURE__ */ jsxs20("div", { className: "rs-screen", children: [
|
|
5302
5276
|
/* @__PURE__ */ jsxs20("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5303
|
-
/* @__PURE__ */
|
|
5277
|
+
/* @__PURE__ */ jsx23(
|
|
5304
5278
|
BodyHeader,
|
|
5305
5279
|
{
|
|
5306
|
-
icon: /* @__PURE__ */
|
|
5280
|
+
icon: /* @__PURE__ */ jsx23(WalletIcon, {}),
|
|
5307
5281
|
title: `Transfer from ${sourceLabel}`,
|
|
5308
5282
|
subtitle: "Pick the balance to import"
|
|
5309
5283
|
}
|
|
5310
5284
|
),
|
|
5311
|
-
incompleteSummary && /* @__PURE__ */
|
|
5312
|
-
/* @__PURE__ */
|
|
5285
|
+
incompleteSummary && /* @__PURE__ */ jsx23("div", { className: "rs-asset-notice", role: "status", children: incompleteSummary }),
|
|
5286
|
+
/* @__PURE__ */ jsx23("div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
5313
5287
|
const tokenAmount = asset.balance ? tokenFormatter.format(
|
|
5314
5288
|
Number(asset.balance) / 10 ** asset.decimals
|
|
5315
5289
|
) : "0";
|
|
@@ -5326,7 +5300,7 @@ function DappImportAssetSelectStep({
|
|
|
5326
5300
|
children: [
|
|
5327
5301
|
/* @__PURE__ */ jsxs20("div", { className: "rs-asset-info", children: [
|
|
5328
5302
|
/* @__PURE__ */ jsxs20("div", { className: "rs-asset-icon-wrapper", children: [
|
|
5329
|
-
/* @__PURE__ */
|
|
5303
|
+
/* @__PURE__ */ jsx23("span", { className: "rs-asset-icon", children: assetIcon ? /* @__PURE__ */ jsx23(CdnIcon, { src: assetIcon, alt: asset.symbol }) : /* @__PURE__ */ jsx23(
|
|
5330
5304
|
TokenIcon,
|
|
5331
5305
|
{
|
|
5332
5306
|
token: { chain: asset.chainId, address: asset.token },
|
|
@@ -5334,7 +5308,7 @@ function DappImportAssetSelectStep({
|
|
|
5334
5308
|
fallback: asset.symbol.slice(0, 4)
|
|
5335
5309
|
}
|
|
5336
5310
|
) }),
|
|
5337
|
-
chainIcon ? /* @__PURE__ */
|
|
5311
|
+
chainIcon ? /* @__PURE__ */ jsx23("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx23(CdnIcon, { src: chainIcon, alt: getChainName(asset.chainId) }) }) : /* @__PURE__ */ jsx23(
|
|
5338
5312
|
"span",
|
|
5339
5313
|
{
|
|
5340
5314
|
className: "rs-asset-chain-badge",
|
|
@@ -5345,7 +5319,7 @@ function DappImportAssetSelectStep({
|
|
|
5345
5319
|
] }),
|
|
5346
5320
|
/* @__PURE__ */ jsxs20("div", { className: "rs-asset-text", children: [
|
|
5347
5321
|
/* @__PURE__ */ jsxs20("div", { className: "rs-asset-name-row", children: [
|
|
5348
|
-
/* @__PURE__ */
|
|
5322
|
+
/* @__PURE__ */ jsx23("span", { className: "rs-asset-name", children: asset.symbol }),
|
|
5349
5323
|
/* @__PURE__ */ jsxs20("span", { className: "rs-asset-chain", children: [
|
|
5350
5324
|
"on ",
|
|
5351
5325
|
asset.sourceLabel,
|
|
@@ -5359,20 +5333,20 @@ function DappImportAssetSelectStep({
|
|
|
5359
5333
|
] })
|
|
5360
5334
|
] })
|
|
5361
5335
|
] }),
|
|
5362
|
-
/* @__PURE__ */
|
|
5336
|
+
/* @__PURE__ */ jsx23("div", { className: "rs-asset-balance", children: balanceUsd })
|
|
5363
5337
|
]
|
|
5364
5338
|
},
|
|
5365
5339
|
asset.id
|
|
5366
5340
|
);
|
|
5367
5341
|
}) })
|
|
5368
5342
|
] }),
|
|
5369
|
-
/* @__PURE__ */
|
|
5343
|
+
/* @__PURE__ */ jsx23(PoweredBy, {})
|
|
5370
5344
|
] });
|
|
5371
5345
|
}
|
|
5372
5346
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
5373
5347
|
|
|
5374
5348
|
// src/components/steps/DappImportSelectStep.tsx
|
|
5375
|
-
import { jsx as
|
|
5349
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5376
5350
|
function describeRow(status, comingSoon) {
|
|
5377
5351
|
if (comingSoon) {
|
|
5378
5352
|
return { subtitle: "Coming soon", disabled: true, busy: false };
|
|
@@ -5410,28 +5384,28 @@ function DappImportSelectStep({
|
|
|
5410
5384
|
const brands = DAPP_IMPORT_CATALOG.filter((brand) => enabled.has(brand.id));
|
|
5411
5385
|
return /* @__PURE__ */ jsxs21("div", { className: "rs-screen", children: [
|
|
5412
5386
|
/* @__PURE__ */ jsxs21("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5413
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsx24(
|
|
5414
5388
|
BodyHeader,
|
|
5415
5389
|
{
|
|
5416
|
-
icon: /* @__PURE__ */
|
|
5390
|
+
icon: /* @__PURE__ */ jsx24(MigrateAssetsIcon, {}),
|
|
5417
5391
|
title: "Migrate assets",
|
|
5418
5392
|
subtitle: "Select a position to migrate"
|
|
5419
5393
|
}
|
|
5420
5394
|
),
|
|
5421
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsx24("div", { className: "rs-list", children: brands.map((brand) => {
|
|
5422
5396
|
const status = byId.get(brand.id);
|
|
5423
5397
|
const { subtitle, disabled, busy } = describeRow(
|
|
5424
5398
|
status,
|
|
5425
5399
|
Boolean(brand.comingSoon)
|
|
5426
5400
|
);
|
|
5427
|
-
return /* @__PURE__ */
|
|
5401
|
+
return /* @__PURE__ */ jsx24(
|
|
5428
5402
|
ListRow,
|
|
5429
5403
|
{
|
|
5430
5404
|
leadingMedia: brand.iconUrl,
|
|
5431
5405
|
title: brand.label,
|
|
5432
5406
|
subtitle,
|
|
5433
5407
|
disabled,
|
|
5434
|
-
trailing: busy ? /* @__PURE__ */
|
|
5408
|
+
trailing: busy ? /* @__PURE__ */ jsx24(Spinner, { className: "rs-spinner--sm" }) : void 0,
|
|
5435
5409
|
onClick: () => {
|
|
5436
5410
|
if (status === "needs-connect") {
|
|
5437
5411
|
onRequestConnect?.();
|
|
@@ -5444,13 +5418,13 @@ function DappImportSelectStep({
|
|
|
5444
5418
|
);
|
|
5445
5419
|
}) })
|
|
5446
5420
|
] }),
|
|
5447
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ jsx24(PoweredBy, {})
|
|
5448
5422
|
] });
|
|
5449
5423
|
}
|
|
5450
5424
|
DappImportSelectStep.displayName = "DappImportSelectStep";
|
|
5451
5425
|
|
|
5452
5426
|
// src/components/steps/DappImportAssetSelectSkeleton.tsx
|
|
5453
|
-
import { jsx as
|
|
5427
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5454
5428
|
function DappImportAssetSelectSkeleton({
|
|
5455
5429
|
sourceLabel,
|
|
5456
5430
|
rowCount = 3,
|
|
@@ -5458,64 +5432,64 @@ function DappImportAssetSelectSkeleton({
|
|
|
5458
5432
|
onRetry
|
|
5459
5433
|
}) {
|
|
5460
5434
|
return /* @__PURE__ */ jsxs22("div", { className: "rs-screen", "aria-busy": error ? "false" : "true", children: [
|
|
5461
|
-
/* @__PURE__ */
|
|
5435
|
+
/* @__PURE__ */ jsx25("span", { className: "rs-sr-only", role: "status", children: error ? "Couldn't load balances" : "Loading balances\u2026" }),
|
|
5462
5436
|
/* @__PURE__ */ jsxs22("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5463
|
-
/* @__PURE__ */
|
|
5437
|
+
/* @__PURE__ */ jsx25(
|
|
5464
5438
|
BodyHeader,
|
|
5465
5439
|
{
|
|
5466
|
-
icon: /* @__PURE__ */
|
|
5440
|
+
icon: /* @__PURE__ */ jsx25(WalletIcon, {}),
|
|
5467
5441
|
title: `Transfer from ${sourceLabel}`,
|
|
5468
5442
|
subtitle: "Pick the balance to import"
|
|
5469
5443
|
}
|
|
5470
5444
|
),
|
|
5471
|
-
error ? /* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
5474
|
-
] }) }) : /* @__PURE__ */
|
|
5445
|
+
error ? /* @__PURE__ */ jsx25("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsxs22("div", { className: "rs-loading-text", children: [
|
|
5446
|
+
/* @__PURE__ */ jsx25("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t load your balances" }),
|
|
5447
|
+
/* @__PURE__ */ jsx25("div", { className: "rs-loading-subtitle", children: "Check your connection and try again." })
|
|
5448
|
+
] }) }) : /* @__PURE__ */ jsx25("div", { className: "rs-asset-list", "aria-hidden": "true", children: Array.from({ length: rowCount }, (_, index) => /* @__PURE__ */ jsxs22(
|
|
5475
5449
|
"div",
|
|
5476
5450
|
{
|
|
5477
5451
|
className: "rs-asset-row rs-asset-row--skeleton",
|
|
5478
5452
|
children: [
|
|
5479
5453
|
/* @__PURE__ */ jsxs22("div", { className: "rs-asset-info", children: [
|
|
5480
5454
|
/* @__PURE__ */ jsxs22("div", { className: "rs-asset-icon-wrapper", children: [
|
|
5481
|
-
/* @__PURE__ */
|
|
5482
|
-
/* @__PURE__ */
|
|
5455
|
+
/* @__PURE__ */ jsx25("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx25("span", { className: "rs-skeleton rs-skeleton-fill" }) }),
|
|
5456
|
+
/* @__PURE__ */ jsx25("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx25("span", { className: "rs-skeleton rs-skeleton-fill" }) })
|
|
5483
5457
|
] }),
|
|
5484
5458
|
/* @__PURE__ */ jsxs22("div", { className: "rs-asset-text", children: [
|
|
5485
|
-
/* @__PURE__ */
|
|
5486
|
-
/* @__PURE__ */
|
|
5459
|
+
/* @__PURE__ */ jsx25("div", { className: "rs-asset-name-row", children: /* @__PURE__ */ jsx25("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--name" }) }),
|
|
5460
|
+
/* @__PURE__ */ jsx25("div", { className: "rs-asset-balance-small", children: /* @__PURE__ */ jsx25("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--balance" }) })
|
|
5487
5461
|
] })
|
|
5488
5462
|
] }),
|
|
5489
|
-
/* @__PURE__ */
|
|
5463
|
+
/* @__PURE__ */ jsx25("div", { className: "rs-asset-balance", children: /* @__PURE__ */ jsx25("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--usd" }) })
|
|
5490
5464
|
]
|
|
5491
5465
|
},
|
|
5492
5466
|
index
|
|
5493
5467
|
)) })
|
|
5494
5468
|
] }),
|
|
5495
|
-
error && onRetry && /* @__PURE__ */
|
|
5469
|
+
error && onRetry && /* @__PURE__ */ jsx25("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx25(
|
|
5496
5470
|
"button",
|
|
5497
5471
|
{
|
|
5498
5472
|
type: "button",
|
|
5499
5473
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
5500
5474
|
onClick: onRetry,
|
|
5501
|
-
children: /* @__PURE__ */
|
|
5475
|
+
children: /* @__PURE__ */ jsx25("span", { children: "Try again" })
|
|
5502
5476
|
}
|
|
5503
5477
|
) }),
|
|
5504
|
-
/* @__PURE__ */
|
|
5478
|
+
/* @__PURE__ */ jsx25(PoweredBy, {})
|
|
5505
5479
|
] });
|
|
5506
5480
|
}
|
|
5507
5481
|
DappImportAssetSelectSkeleton.displayName = "DappImportAssetSelectSkeleton";
|
|
5508
5482
|
|
|
5509
5483
|
// src/core/fiat-methods.ts
|
|
5510
5484
|
var REGIONAL_METHODS_TIMEOUT_MS = 3e3;
|
|
5511
|
-
var
|
|
5485
|
+
var PRODUCT_METHODS = /* @__PURE__ */ new Set([
|
|
5512
5486
|
"creditcard",
|
|
5513
5487
|
"bank-transfer",
|
|
5514
5488
|
"apple-pay"
|
|
5515
5489
|
]);
|
|
5516
5490
|
function serverMethodToOption(m) {
|
|
5517
5491
|
const icon = m.method === "bank-transfer" ? "bank" : m.method === "apple-pay" ? "apple" : "card";
|
|
5518
|
-
const remoteIcon =
|
|
5492
|
+
const remoteIcon = PRODUCT_METHODS.has(m.method) ? {} : {
|
|
5519
5493
|
iconUrl: m.iconUrl ?? void 0,
|
|
5520
5494
|
iconUrlLight: m.iconUrlLight ?? void 0
|
|
5521
5495
|
};
|
|
@@ -5550,8 +5524,9 @@ function composeFiatMethods(regional, fallbackMethods) {
|
|
|
5550
5524
|
source: "fallback"
|
|
5551
5525
|
};
|
|
5552
5526
|
}
|
|
5553
|
-
|
|
5554
|
-
|
|
5527
|
+
const methods = dedupe(
|
|
5528
|
+
regional.methods.filter((m) => PRODUCT_METHODS.has(m.method) || m.badge === "Popular").map(serverMethodToOption)
|
|
5529
|
+
);
|
|
5555
5530
|
if (methods.length === 0) return { kind: "hidden" };
|
|
5556
5531
|
const recommendedMethod = regional.recommendedMethod && methods.some(({ method }) => method === regional.recommendedMethod) ? regional.recommendedMethod : methods[0].method;
|
|
5557
5532
|
return {
|
|
@@ -6127,7 +6102,7 @@ import {
|
|
|
6127
6102
|
useContext,
|
|
6128
6103
|
useMemo as useMemo7
|
|
6129
6104
|
} from "react";
|
|
6130
|
-
import { jsx as
|
|
6105
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6131
6106
|
function fundingMethodForFlowMode(mode) {
|
|
6132
6107
|
switch (mode) {
|
|
6133
6108
|
case "wallet":
|
|
@@ -6188,7 +6163,16 @@ function analyticsStepForFlowStep(method, step) {
|
|
|
6188
6163
|
return "funding_method_home";
|
|
6189
6164
|
}
|
|
6190
6165
|
}
|
|
6166
|
+
var BANK_FAILURES = {
|
|
6167
|
+
BANK_ONRAMP_OPTIONS_FAILED: "bank_options_failed",
|
|
6168
|
+
BANK_ONRAMP_SESSION_REFUSED: "bank_session_refused",
|
|
6169
|
+
BANK_ONRAMP_SETUP_FAILED: "bank_setup_failed",
|
|
6170
|
+
BANK_ONRAMP_DETAILS_FAILED: "bank_details_failed",
|
|
6171
|
+
BANK_ONRAMP_DETAILS_PENDING: "bank_details_pending"
|
|
6172
|
+
};
|
|
6191
6173
|
function failureReasonForCode(code, cause) {
|
|
6174
|
+
const bank = code ? BANK_FAILURES[code] : void 0;
|
|
6175
|
+
if (bank) return bank;
|
|
6192
6176
|
const normalized = `${code ?? ""} ${cause ?? ""}`.toLowerCase();
|
|
6193
6177
|
if (normalized.includes("uncertain")) return "submission_uncertain";
|
|
6194
6178
|
if (normalized.includes("reject") && (normalized.includes("sign") || normalized.includes("permit"))) {
|
|
@@ -6423,7 +6407,7 @@ function DepositAnalyticsControllerProvider({
|
|
|
6423
6407
|
[emit]
|
|
6424
6408
|
);
|
|
6425
6409
|
if (controllerRef) controllerRef.current = controller;
|
|
6426
|
-
return /* @__PURE__ */
|
|
6410
|
+
return /* @__PURE__ */ jsx26(DepositAnalyticsControllerContext.Provider, { value: controller, children });
|
|
6427
6411
|
}
|
|
6428
6412
|
function useDepositAnalyticsController() {
|
|
6429
6413
|
return useContext(DepositAnalyticsControllerContext) ?? noopController;
|
|
@@ -6505,7 +6489,8 @@ function createInitialState(overrides) {
|
|
|
6505
6489
|
},
|
|
6506
6490
|
fiat: {
|
|
6507
6491
|
selectedMethod: null,
|
|
6508
|
-
methodSelectionSource: null
|
|
6492
|
+
methodSelectionSource: null,
|
|
6493
|
+
selectedProvider: null
|
|
6509
6494
|
},
|
|
6510
6495
|
exchange: {
|
|
6511
6496
|
selectedConnection: null
|
|
@@ -6793,7 +6778,8 @@ function applyAction(state, action) {
|
|
|
6793
6778
|
fiat: {
|
|
6794
6779
|
...state.fiat,
|
|
6795
6780
|
selectedMethod: action.paymentMethod ?? null,
|
|
6796
|
-
methodSelectionSource: action.methodSelectionSource ?? null
|
|
6781
|
+
methodSelectionSource: action.methodSelectionSource ?? null,
|
|
6782
|
+
selectedProvider: action.provider ?? null
|
|
6797
6783
|
},
|
|
6798
6784
|
// Pin on ENTRY, not on submit: a Swapped order only reports a
|
|
6799
6785
|
// submission on terminal success, so between paying and that callback
|
|
@@ -7374,7 +7360,11 @@ function applyAction(state, action) {
|
|
|
7374
7360
|
byKey: {},
|
|
7375
7361
|
nextRequestId: state.portfolio.nextRequestId
|
|
7376
7362
|
},
|
|
7377
|
-
fiat: {
|
|
7363
|
+
fiat: {
|
|
7364
|
+
selectedMethod: null,
|
|
7365
|
+
methodSelectionSource: null,
|
|
7366
|
+
selectedProvider: null
|
|
7367
|
+
},
|
|
7378
7368
|
exchange: { selectedConnection: null }
|
|
7379
7369
|
};
|
|
7380
7370
|
}
|
|
@@ -7450,11 +7440,7 @@ function useDepositStore(selector) {
|
|
|
7450
7440
|
}
|
|
7451
7441
|
|
|
7452
7442
|
// src/DepositFlow.tsx
|
|
7453
|
-
import { Fragment as Fragment6, jsx as
|
|
7454
|
-
var BankOnrampStep = lazy2(async () => {
|
|
7455
|
-
const module = await import("./BankOnrampStep-JG32OCM2.mjs");
|
|
7456
|
-
return { default: module.BankOnrampStep };
|
|
7457
|
-
});
|
|
7443
|
+
import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7458
7444
|
function swappedWidgetPrefetchKey(method, methodSelectionSource) {
|
|
7459
7445
|
return JSON.stringify([methodSelectionSource ?? null, method ?? null]);
|
|
7460
7446
|
}
|
|
@@ -7463,17 +7449,17 @@ function AccountPreparingSkeleton({
|
|
|
7463
7449
|
onRetry
|
|
7464
7450
|
}) {
|
|
7465
7451
|
return /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
|
|
7466
|
-
/* @__PURE__ */
|
|
7467
|
-
/* @__PURE__ */
|
|
7468
|
-
/* @__PURE__ */
|
|
7469
|
-
] }) : /* @__PURE__ */
|
|
7470
|
-
errorMessage && onRetry && /* @__PURE__ */
|
|
7452
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
7453
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
|
|
7454
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-loading-subtitle", children: errorMessage })
|
|
7455
|
+
] }) : /* @__PURE__ */ jsx27("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
|
|
7456
|
+
errorMessage && onRetry && /* @__PURE__ */ jsx27("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx27(
|
|
7471
7457
|
"button",
|
|
7472
7458
|
{
|
|
7473
7459
|
type: "button",
|
|
7474
7460
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
7475
7461
|
onClick: onRetry,
|
|
7476
|
-
children: /* @__PURE__ */
|
|
7462
|
+
children: /* @__PURE__ */ jsx27("span", { children: "Try again" })
|
|
7477
7463
|
}
|
|
7478
7464
|
) })
|
|
7479
7465
|
] });
|
|
@@ -7557,7 +7543,8 @@ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
|
7557
7543
|
type: "fiat-onramp",
|
|
7558
7544
|
smartAccount: committedAccount,
|
|
7559
7545
|
paymentMethod: fiat.selectedMethod ?? void 0,
|
|
7560
|
-
methodSelectionSource: fiat.methodSelectionSource ?? void 0
|
|
7546
|
+
methodSelectionSource: fiat.methodSelectionSource ?? void 0,
|
|
7547
|
+
provider: fiat.selectedProvider ?? void 0
|
|
7561
7548
|
};
|
|
7562
7549
|
case "exchange-select":
|
|
7563
7550
|
return { type: "exchange-select" };
|
|
@@ -7725,7 +7712,8 @@ function DepositFlow({
|
|
|
7725
7712
|
initialAssetMigration,
|
|
7726
7713
|
enableWallet = true,
|
|
7727
7714
|
enableFiatOnramp = false,
|
|
7728
|
-
|
|
7715
|
+
virtualAccountOnramp,
|
|
7716
|
+
getCustomerSession,
|
|
7729
7717
|
onBankJourney,
|
|
7730
7718
|
backendUrl,
|
|
7731
7719
|
enableQrTransfer = true,
|
|
@@ -7769,20 +7757,20 @@ function DepositFlow({
|
|
|
7769
7757
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState13(0);
|
|
7770
7758
|
const stableWalletSignerRef = useRef9(null);
|
|
7771
7759
|
const stableWalletSelectionKeyRef = useRef9(null);
|
|
7772
|
-
const logFlow =
|
|
7760
|
+
const logFlow = useCallback6(
|
|
7773
7761
|
(message, data) => {
|
|
7774
7762
|
debugLog(debug, "deposit-flow", message, data);
|
|
7775
7763
|
},
|
|
7776
7764
|
[debug]
|
|
7777
7765
|
);
|
|
7778
|
-
const logFlowError =
|
|
7766
|
+
const logFlowError = useCallback6(
|
|
7779
7767
|
(message, error, data) => {
|
|
7780
7768
|
debugError(debug, "deposit-flow", message, error, data);
|
|
7781
7769
|
},
|
|
7782
7770
|
[debug]
|
|
7783
7771
|
);
|
|
7784
7772
|
const bankOnrampEnabled = Boolean(
|
|
7785
|
-
|
|
7773
|
+
virtualAccountOnramp && getCustomerSession && (fiatMethods === void 0 || fiatMethods["bank-transfer"] === true)
|
|
7786
7774
|
);
|
|
7787
7775
|
const hasSwappedFiatMethod = Boolean(
|
|
7788
7776
|
enableFiatOnramp && (!fiatMethods || Object.entries(fiatMethods).some(
|
|
@@ -8129,7 +8117,7 @@ function DepositFlow({
|
|
|
8129
8117
|
]
|
|
8130
8118
|
);
|
|
8131
8119
|
const step = effectiveStep;
|
|
8132
|
-
const handleBack =
|
|
8120
|
+
const handleBack = useCallback6(() => {
|
|
8133
8121
|
if ([
|
|
8134
8122
|
"deposit-address",
|
|
8135
8123
|
"select-asset",
|
|
@@ -8157,7 +8145,7 @@ function DepositFlow({
|
|
|
8157
8145
|
hasWalletOptions,
|
|
8158
8146
|
walletSession
|
|
8159
8147
|
]);
|
|
8160
|
-
const handleProviderBack =
|
|
8148
|
+
const handleProviderBack = useCallback6(() => {
|
|
8161
8149
|
analytics.abandon("provider_back");
|
|
8162
8150
|
analytics.resetAttempt(
|
|
8163
8151
|
flowMode === "exchange-connect" ? "exchange_connect" : null
|
|
@@ -8167,7 +8155,7 @@ function DepositFlow({
|
|
|
8167
8155
|
hasWalletOptions: hasWalletOptions || Boolean(walletSession)
|
|
8168
8156
|
});
|
|
8169
8157
|
}, [analytics, flowMode, storeApi, hasWalletOptions, walletSession]);
|
|
8170
|
-
const handleWalletDisconnect =
|
|
8158
|
+
const handleWalletDisconnect = useCallback6(() => {
|
|
8171
8159
|
analytics.abandon("wallet_disconnect");
|
|
8172
8160
|
analytics.resetAttempt();
|
|
8173
8161
|
onDisconnect?.();
|
|
@@ -8290,11 +8278,11 @@ function DepositFlow({
|
|
|
8290
8278
|
const isDappImportMode = flowMode === "dapp-import";
|
|
8291
8279
|
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
8292
8280
|
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
8293
|
-
const handleSelectTransferCrypto =
|
|
8281
|
+
const handleSelectTransferCrypto = useCallback6(() => {
|
|
8294
8282
|
analytics.selectMethod("transfer", "user");
|
|
8295
8283
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
8296
8284
|
}, [analytics, storeApi]);
|
|
8297
|
-
const handleConfirmWallet =
|
|
8285
|
+
const handleConfirmWallet = useCallback6(
|
|
8298
8286
|
(walletId) => {
|
|
8299
8287
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
8300
8288
|
const mode = selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
|
|
@@ -8325,7 +8313,7 @@ function DepositFlow({
|
|
|
8325
8313
|
) ?? null : null,
|
|
8326
8314
|
[initialAssetMigration, enabledDappImportProviders]
|
|
8327
8315
|
);
|
|
8328
|
-
const handleSelectDappImport =
|
|
8316
|
+
const handleSelectDappImport = useCallback6(
|
|
8329
8317
|
(providerId) => {
|
|
8330
8318
|
const owner = dappImportOwner;
|
|
8331
8319
|
if (owner) {
|
|
@@ -8349,7 +8337,7 @@ function DepositFlow({
|
|
|
8349
8337
|
},
|
|
8350
8338
|
[analytics, storeApi, walletOptions, dappImportOwner]
|
|
8351
8339
|
);
|
|
8352
|
-
const handleDappImportAssetSelected =
|
|
8340
|
+
const handleDappImportAssetSelected = useCallback6(
|
|
8353
8341
|
(asset) => {
|
|
8354
8342
|
storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
|
|
8355
8343
|
},
|
|
@@ -8569,7 +8557,7 @@ function DepositFlow({
|
|
|
8569
8557
|
analytics,
|
|
8570
8558
|
storeApi
|
|
8571
8559
|
]);
|
|
8572
|
-
const handleBootRetry =
|
|
8560
|
+
const handleBootRetry = useCallback6(() => {
|
|
8573
8561
|
analytics.retry("migration_availability_failed", "migration_boot_resolve");
|
|
8574
8562
|
const snapshot = storeApi.getState();
|
|
8575
8563
|
const providerId = snapshot.dappImport.activeProviderId;
|
|
@@ -8593,32 +8581,34 @@ function DepositFlow({
|
|
|
8593
8581
|
providerId
|
|
8594
8582
|
});
|
|
8595
8583
|
}, [analytics, storeApi, dappImportOwner]);
|
|
8596
|
-
const handleSelectFiatMethod =
|
|
8597
|
-
(paymentMethod, methodSelectionSource) => {
|
|
8584
|
+
const handleSelectFiatMethod = useCallback6(
|
|
8585
|
+
(paymentMethod, methodSelectionSource, provider = "swapped") => {
|
|
8598
8586
|
analytics.selectMethod("fiat_onramp", "user", {
|
|
8599
8587
|
payment_method: paymentMethod,
|
|
8600
|
-
source: methodSelectionSource
|
|
8588
|
+
source: methodSelectionSource,
|
|
8589
|
+
provider
|
|
8601
8590
|
});
|
|
8602
8591
|
storeApi.dispatch({
|
|
8603
8592
|
type: "connect/fiat-onramp-selected",
|
|
8604
8593
|
paymentMethod,
|
|
8605
|
-
methodSelectionSource
|
|
8594
|
+
methodSelectionSource,
|
|
8595
|
+
provider
|
|
8606
8596
|
});
|
|
8607
8597
|
},
|
|
8608
8598
|
[analytics, storeApi]
|
|
8609
8599
|
);
|
|
8610
|
-
const handleSelectExchange =
|
|
8600
|
+
const handleSelectExchange = useCallback6(() => {
|
|
8611
8601
|
analytics.selectMethod("exchange_connect", "user");
|
|
8612
8602
|
storeApi.dispatch({ type: "connect/exchange-selected" });
|
|
8613
8603
|
}, [analytics, storeApi]);
|
|
8614
8604
|
const swappedAnalyticsCorrelatorRef = useRef9(null);
|
|
8615
|
-
const handleSwappedAttemptConsumed =
|
|
8605
|
+
const handleSwappedAttemptConsumed = useCallback6(
|
|
8616
8606
|
(externalCustomerId) => {
|
|
8617
8607
|
swappedAnalyticsCorrelatorRef.current = externalCustomerId;
|
|
8618
8608
|
},
|
|
8619
8609
|
[]
|
|
8620
8610
|
);
|
|
8621
|
-
const handleSwappedProviderHandoff =
|
|
8611
|
+
const handleSwappedProviderHandoff = useCallback6(() => {
|
|
8622
8612
|
const externalCustomerId = swappedAnalyticsCorrelatorRef.current;
|
|
8623
8613
|
if (!externalCustomerId) return;
|
|
8624
8614
|
analytics.handoff(
|
|
@@ -8627,7 +8617,7 @@ function DepositFlow({
|
|
|
8627
8617
|
flowMode === "exchange-connect" ? "exchange_provider_handoff" : "fiat_provider_handoff"
|
|
8628
8618
|
);
|
|
8629
8619
|
}, [analytics, flowMode]);
|
|
8630
|
-
const handleSwappedRetry =
|
|
8620
|
+
const handleSwappedRetry = useCallback6(() => {
|
|
8631
8621
|
analytics.retry(
|
|
8632
8622
|
"swapped_mint_failed",
|
|
8633
8623
|
flowMode === "exchange-connect" ? "exchange_provider_mint" : "fiat_provider_mint"
|
|
@@ -8635,7 +8625,7 @@ function DepositFlow({
|
|
|
8635
8625
|
swappedAnalyticsCorrelatorRef.current = null;
|
|
8636
8626
|
}, [analytics, flowMode]);
|
|
8637
8627
|
const swappedConnectUrlRef = useRef9(/* @__PURE__ */ new Map());
|
|
8638
|
-
const handleSelectExchangeConnection =
|
|
8628
|
+
const handleSelectExchangeConnection = useCallback6(
|
|
8639
8629
|
async (connection) => {
|
|
8640
8630
|
if (setupSlice.status !== "ready" || !setupSlice.smartAccount) {
|
|
8641
8631
|
throw new Error("Deposit account is not ready");
|
|
@@ -8666,7 +8656,7 @@ function DepositFlow({
|
|
|
8666
8656
|
},
|
|
8667
8657
|
[analytics, service, setupSlice.status, setupSlice.smartAccount, storeApi]
|
|
8668
8658
|
);
|
|
8669
|
-
const loadSwappedConnectUrl =
|
|
8659
|
+
const loadSwappedConnectUrl = useCallback6(
|
|
8670
8660
|
async (smartAccount, connection) => {
|
|
8671
8661
|
const key = `${smartAccount.toLowerCase()}:${connection}`;
|
|
8672
8662
|
const entry = swappedConnectUrlRef.current.get(key);
|
|
@@ -8676,7 +8666,7 @@ function DepositFlow({
|
|
|
8676
8666
|
[service]
|
|
8677
8667
|
);
|
|
8678
8668
|
const swappedUrlPrefetchRef = useRef9(/* @__PURE__ */ new Map());
|
|
8679
|
-
const prefetchSwappedWidgetUrl =
|
|
8669
|
+
const prefetchSwappedWidgetUrl = useCallback6(
|
|
8680
8670
|
(smartAccount, method, methodSelectionSource) => {
|
|
8681
8671
|
const cache = swappedUrlPrefetchRef.current;
|
|
8682
8672
|
const key = swappedWidgetPrefetchKey(method, methodSelectionSource);
|
|
@@ -8698,7 +8688,7 @@ function DepositFlow({
|
|
|
8698
8688
|
},
|
|
8699
8689
|
[service, logFlow]
|
|
8700
8690
|
);
|
|
8701
|
-
const consumeSwappedWidgetUrlPrefetch =
|
|
8691
|
+
const consumeSwappedWidgetUrlPrefetch = useCallback6(
|
|
8702
8692
|
(smartAccount, method, methodSelectionSource) => {
|
|
8703
8693
|
const cache = swappedUrlPrefetchRef.current;
|
|
8704
8694
|
const key = swappedWidgetPrefetchKey(method, methodSelectionSource);
|
|
@@ -8710,7 +8700,7 @@ function DepositFlow({
|
|
|
8710
8700
|
},
|
|
8711
8701
|
[]
|
|
8712
8702
|
);
|
|
8713
|
-
const handlePrefetchFiatMethod =
|
|
8703
|
+
const handlePrefetchFiatMethod = useCallback6(
|
|
8714
8704
|
(method, methodSelectionSource) => {
|
|
8715
8705
|
if (!fiatEnabled) return;
|
|
8716
8706
|
if (setupSlice.status !== "ready" || !setupSlice.smartAccount) return;
|
|
@@ -8732,6 +8722,26 @@ function DepositFlow({
|
|
|
8732
8722
|
swappedConnectUrlRef.current.clear();
|
|
8733
8723
|
}, [setupSlice.smartAccount]);
|
|
8734
8724
|
const hasConfiguredFiatMethods = fiatMethods !== void 0;
|
|
8725
|
+
const [providers, setProviders] = useState13("loading");
|
|
8726
|
+
useEffect13(() => {
|
|
8727
|
+
if (!enableFiatOnramp && !bankOnrampEnabled && !enableExchangeConnect) {
|
|
8728
|
+
return;
|
|
8729
|
+
}
|
|
8730
|
+
let settled = false;
|
|
8731
|
+
const settle = (list) => {
|
|
8732
|
+
if (settled) return;
|
|
8733
|
+
settled = true;
|
|
8734
|
+
clearTimeout(timer);
|
|
8735
|
+
setProviders(list);
|
|
8736
|
+
};
|
|
8737
|
+
setProviders("loading");
|
|
8738
|
+
const timer = setTimeout(() => settle(null), REGIONAL_METHODS_TIMEOUT_MS);
|
|
8739
|
+
void service.getOnrampProviders().then(settle);
|
|
8740
|
+
return () => {
|
|
8741
|
+
settled = true;
|
|
8742
|
+
clearTimeout(timer);
|
|
8743
|
+
};
|
|
8744
|
+
}, [bankOnrampEnabled, enableExchangeConnect, enableFiatOnramp, service]);
|
|
8735
8745
|
const [regionalMethods, setRegionalMethods] = useState13({
|
|
8736
8746
|
status: "loading",
|
|
8737
8747
|
country: null,
|
|
@@ -8778,46 +8788,51 @@ function DepositFlow({
|
|
|
8778
8788
|
clearTimeout(timeoutTimer);
|
|
8779
8789
|
};
|
|
8780
8790
|
}, [analytics, enableFiatOnramp, hasConfiguredFiatMethods, service]);
|
|
8781
|
-
const
|
|
8782
|
-
() =>
|
|
8791
|
+
const swappedMethods = useMemo8(
|
|
8792
|
+
() => hasConfiguredFiatMethods ? {
|
|
8783
8793
|
kind: "list",
|
|
8784
8794
|
methods: configuredFiatMethods,
|
|
8785
8795
|
recommendedMethod: configuredFiatMethods[0]?.method ?? "bank-transfer",
|
|
8786
8796
|
country: null,
|
|
8787
8797
|
source: "configured"
|
|
8788
8798
|
} : composeFiatMethods(regionalMethods, FIAT_ONRAMP_METHODS),
|
|
8799
|
+
[configuredFiatMethods, hasConfiguredFiatMethods, regionalMethods]
|
|
8800
|
+
);
|
|
8801
|
+
const [noahNotServedFor, setNoahNotServedFor] = useState13(null);
|
|
8802
|
+
const noahNotServed = noahNotServedFor !== null && noahNotServedFor === setupSlice.smartAccount?.toLowerCase();
|
|
8803
|
+
const rampRowInputs = useMemo8(
|
|
8804
|
+
() => ({
|
|
8805
|
+
enableFiatOnramp,
|
|
8806
|
+
virtualAccounts: Boolean(virtualAccountOnramp),
|
|
8807
|
+
customerSession: Boolean(getCustomerSession),
|
|
8808
|
+
bankTransferAllowed: fiatMethods === void 0 || fiatMethods["bank-transfer"] === true,
|
|
8809
|
+
enableExchangeConnect,
|
|
8810
|
+
providers,
|
|
8811
|
+
swappedMethods,
|
|
8812
|
+
bankRow: FIAT_ONRAMP_METHODS.find(({ method }) => method === "bank-transfer"),
|
|
8813
|
+
noahNotServed
|
|
8814
|
+
}),
|
|
8789
8815
|
[
|
|
8790
|
-
|
|
8816
|
+
enableExchangeConnect,
|
|
8791
8817
|
enableFiatOnramp,
|
|
8792
|
-
|
|
8793
|
-
|
|
8818
|
+
fiatMethods,
|
|
8819
|
+
getCustomerSession,
|
|
8820
|
+
noahNotServed,
|
|
8821
|
+
providers,
|
|
8822
|
+
swappedMethods,
|
|
8823
|
+
virtualAccountOnramp
|
|
8794
8824
|
]
|
|
8795
8825
|
);
|
|
8796
|
-
const
|
|
8797
|
-
const
|
|
8798
|
-
const
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
if (!bankRowOffered || swappedDisplay.kind === "loading") {
|
|
8807
|
-
return swappedDisplay;
|
|
8808
|
-
}
|
|
8809
|
-
if (swappedOffersBank) return swappedDisplay;
|
|
8810
|
-
const bankTransfer = FIAT_ONRAMP_METHODS.find(
|
|
8811
|
-
({ method }) => method === "bank-transfer"
|
|
8812
|
-
);
|
|
8813
|
-
return {
|
|
8814
|
-
kind: "list",
|
|
8815
|
-
methods: swappedDisplay.kind === "list" ? [...swappedDisplay.methods, bankTransfer] : [bankTransfer],
|
|
8816
|
-
recommendedMethod: swappedDisplay.kind === "list" ? swappedDisplay.recommendedMethod : bankTransfer.method,
|
|
8817
|
-
country: swappedDisplay.kind === "list" ? swappedDisplay.country : null,
|
|
8818
|
-
source: swappedDisplay.kind === "list" ? swappedDisplay.source : "configured"
|
|
8819
|
-
};
|
|
8820
|
-
}, [bankRowOffered, swappedCashDisplay, swappedOffersBank]);
|
|
8826
|
+
const rampRows = useMemo8(() => resolveRampRows(rampRowInputs), [rampRowInputs]);
|
|
8827
|
+
const cashDisplay = rampRows.cash;
|
|
8828
|
+
const handleNoahNotServed = useCallback6(
|
|
8829
|
+
(smartAccount) => {
|
|
8830
|
+
setNoahNotServedFor(smartAccount.toLowerCase());
|
|
8831
|
+
const after = resolveRampRows({ ...rampRowInputs, noahNotServed: true });
|
|
8832
|
+
if (after.notice) handleProviderBack();
|
|
8833
|
+
},
|
|
8834
|
+
[handleProviderBack, rampRowInputs]
|
|
8835
|
+
);
|
|
8821
8836
|
useEffect13(() => {
|
|
8822
8837
|
if (cashDisplay.kind === "hidden" && fiatEnabled) {
|
|
8823
8838
|
analytics.friction(
|
|
@@ -8832,22 +8847,25 @@ function DepositFlow({
|
|
|
8832
8847
|
}
|
|
8833
8848
|
}, [analytics, cashDisplay, fiatEnabled, hasConfiguredFiatMethods]);
|
|
8834
8849
|
const displayedFiatSource = cashDisplay.kind === "list" ? cashDisplay.source : void 0;
|
|
8835
|
-
const
|
|
8850
|
+
const providerOf = useCallback6(
|
|
8851
|
+
(method) => cashDisplay.kind === "list" && cashDisplay.methods.find((m) => m.method === method)?.provider || "swapped",
|
|
8852
|
+
[cashDisplay]
|
|
8853
|
+
);
|
|
8854
|
+
const handleSelectDisplayedFiatMethod = useCallback6(
|
|
8836
8855
|
(method) => {
|
|
8837
8856
|
if (!displayedFiatSource) return;
|
|
8838
|
-
handleSelectFiatMethod(method, displayedFiatSource);
|
|
8857
|
+
handleSelectFiatMethod(method, displayedFiatSource, providerOf(method));
|
|
8839
8858
|
},
|
|
8840
|
-
[displayedFiatSource, handleSelectFiatMethod]
|
|
8859
|
+
[displayedFiatSource, handleSelectFiatMethod, providerOf]
|
|
8841
8860
|
);
|
|
8842
|
-
const handlePrefetchDisplayedFiatMethod =
|
|
8861
|
+
const handlePrefetchDisplayedFiatMethod = useCallback6(
|
|
8843
8862
|
(method) => {
|
|
8844
|
-
if (!displayedFiatSource) return;
|
|
8845
|
-
if (bankRowOffered && method === "bank-transfer") return;
|
|
8863
|
+
if (!displayedFiatSource || providerOf(method) !== "swapped") return;
|
|
8846
8864
|
handlePrefetchFiatMethod(method, displayedFiatSource);
|
|
8847
8865
|
},
|
|
8848
|
-
[
|
|
8866
|
+
[displayedFiatSource, handlePrefetchFiatMethod, providerOf]
|
|
8849
8867
|
);
|
|
8850
|
-
const handleNewDeposit =
|
|
8868
|
+
const handleNewDeposit = useCallback6(() => {
|
|
8851
8869
|
analytics.completeStep();
|
|
8852
8870
|
analytics.resetAttempt();
|
|
8853
8871
|
onLifecycleRef.current?.({
|
|
@@ -8995,7 +9013,7 @@ function DepositFlow({
|
|
|
8995
9013
|
})();
|
|
8996
9014
|
});
|
|
8997
9015
|
}, [desiredPortfolios, service, storeApi, portfolioSlice.byKey]);
|
|
8998
|
-
const handleDepositAddressSubmitted =
|
|
9016
|
+
const handleDepositAddressSubmitted = useCallback6(
|
|
8999
9017
|
(data) => {
|
|
9000
9018
|
logFlow("deposit-address:detected", {
|
|
9001
9019
|
txHash: data.txHash,
|
|
@@ -9010,7 +9028,7 @@ function DepositFlow({
|
|
|
9010
9028
|
},
|
|
9011
9029
|
[analytics, logFlow, onLifecycleRef]
|
|
9012
9030
|
);
|
|
9013
|
-
const handleSolanaTokenContinue =
|
|
9031
|
+
const handleSolanaTokenContinue = useCallback6(
|
|
9014
9032
|
(token, balance, balanceUsd) => {
|
|
9015
9033
|
logFlow("solana:token:continue", { token: token.symbol });
|
|
9016
9034
|
storeApi.dispatch({
|
|
@@ -9023,7 +9041,7 @@ function DepositFlow({
|
|
|
9023
9041
|
},
|
|
9024
9042
|
[defaultAmount, logFlow, storeApi]
|
|
9025
9043
|
);
|
|
9026
|
-
const handleSolanaAmountContinue =
|
|
9044
|
+
const handleSolanaAmountContinue = useCallback6(
|
|
9027
9045
|
(token, sourceAmount, inputAmountUsd) => {
|
|
9028
9046
|
const targetTokenPriceUsd = isTargetStablecoin ? 1 : targetMarketPriceRef.current;
|
|
9029
9047
|
logFlow("solana:amount:continue", {
|
|
@@ -9043,7 +9061,7 @@ function DepositFlow({
|
|
|
9043
9061
|
},
|
|
9044
9062
|
[isTargetStablecoin, targetSymbol, logFlow, storeApi]
|
|
9045
9063
|
);
|
|
9046
|
-
const handleSolanaConfirmed =
|
|
9064
|
+
const handleSolanaConfirmed = useCallback6(
|
|
9047
9065
|
(txHash, amountUnits, routed) => {
|
|
9048
9066
|
const depositAtSubmit = storeApi.getState().deposit;
|
|
9049
9067
|
const tokenAtSubmit = depositAtSubmit.selectedSolanaToken;
|
|
@@ -9084,7 +9102,7 @@ function DepositFlow({
|
|
|
9084
9102
|
},
|
|
9085
9103
|
[analytics, logFlow, onLifecycleRef, storeApi]
|
|
9086
9104
|
);
|
|
9087
|
-
const handleAssetContinue =
|
|
9105
|
+
const handleAssetContinue = useCallback6(
|
|
9088
9106
|
(asset) => {
|
|
9089
9107
|
analytics.completeStep("wallet_source_asset");
|
|
9090
9108
|
storeApi.dispatch({
|
|
@@ -9095,7 +9113,7 @@ function DepositFlow({
|
|
|
9095
9113
|
},
|
|
9096
9114
|
[analytics, defaultAmount, storeApi]
|
|
9097
9115
|
);
|
|
9098
|
-
const handleAmountContinue =
|
|
9116
|
+
const handleAmountContinue = useCallback6(
|
|
9099
9117
|
(amount, targetAmount, balance) => {
|
|
9100
9118
|
const entry = storeApi.getState().setup;
|
|
9101
9119
|
if (entry.status !== "ready") return;
|
|
@@ -9110,13 +9128,13 @@ function DepositFlow({
|
|
|
9110
9128
|
},
|
|
9111
9129
|
[isTargetStablecoin, storeApi, activeOwner]
|
|
9112
9130
|
);
|
|
9113
|
-
const handleQrReviewRequested =
|
|
9131
|
+
const handleQrReviewRequested = useCallback6(
|
|
9114
9132
|
(asset) => {
|
|
9115
9133
|
storeApi.dispatch({ type: "qr/review-requested", asset });
|
|
9116
9134
|
},
|
|
9117
9135
|
[storeApi]
|
|
9118
9136
|
);
|
|
9119
|
-
const handleQrAmountContinue =
|
|
9137
|
+
const handleQrAmountContinue = useCallback6(
|
|
9120
9138
|
(amount, targetAmount) => {
|
|
9121
9139
|
const targetTokenPriceUsd = isTargetStablecoin ? 1 : targetMarketPriceRef.current;
|
|
9122
9140
|
storeApi.dispatch({
|
|
@@ -9128,7 +9146,7 @@ function DepositFlow({
|
|
|
9128
9146
|
},
|
|
9129
9147
|
[isTargetStablecoin, storeApi]
|
|
9130
9148
|
);
|
|
9131
|
-
const handleDepositSubmitted =
|
|
9149
|
+
const handleDepositSubmitted = useCallback6(
|
|
9132
9150
|
(txHash, chainId, amount, token, quote, routed) => {
|
|
9133
9151
|
logFlow("evm:submitted", {
|
|
9134
9152
|
txHash,
|
|
@@ -9174,7 +9192,7 @@ function DepositFlow({
|
|
|
9174
9192
|
},
|
|
9175
9193
|
[analytics, flowMode, logFlow, storeApi]
|
|
9176
9194
|
);
|
|
9177
|
-
const handleSwappedComplete =
|
|
9195
|
+
const handleSwappedComplete = useCallback6(
|
|
9178
9196
|
(info) => {
|
|
9179
9197
|
logFlow("swapped:complete", {
|
|
9180
9198
|
txHash: info.txHash,
|
|
@@ -9231,7 +9249,7 @@ function DepositFlow({
|
|
|
9231
9249
|
},
|
|
9232
9250
|
[logFlow, onLifecycleRef, service, storeApi]
|
|
9233
9251
|
);
|
|
9234
|
-
const handleDepositSubmittedCallback =
|
|
9252
|
+
const handleDepositSubmittedCallback = useCallback6(
|
|
9235
9253
|
(txHash, sourceChain, amount) => {
|
|
9236
9254
|
const depositAtSubmit = storeApi.getState().deposit;
|
|
9237
9255
|
onLifecycleRef.current?.({
|
|
@@ -9245,7 +9263,7 @@ function DepositFlow({
|
|
|
9245
9263
|
},
|
|
9246
9264
|
[onLifecycleRef, storeApi]
|
|
9247
9265
|
);
|
|
9248
|
-
const handleDepositComplete =
|
|
9266
|
+
const handleDepositComplete = useCallback6(
|
|
9249
9267
|
(txHash, destinationTxHash, context) => {
|
|
9250
9268
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
9251
9269
|
analytics.openStep(
|
|
@@ -9261,7 +9279,7 @@ function DepositFlow({
|
|
|
9261
9279
|
},
|
|
9262
9280
|
[analytics, analyticsMethod, logFlow, onLifecycleRef]
|
|
9263
9281
|
);
|
|
9264
|
-
const handleDepositFailed =
|
|
9282
|
+
const handleDepositFailed = useCallback6(
|
|
9265
9283
|
(txHash, error) => {
|
|
9266
9284
|
logFlowError("deposit:failed", error, { txHash });
|
|
9267
9285
|
analytics.openStep(
|
|
@@ -9273,7 +9291,7 @@ function DepositFlow({
|
|
|
9273
9291
|
},
|
|
9274
9292
|
[analytics, analyticsMethod, logFlowError, onLifecycleRef]
|
|
9275
9293
|
);
|
|
9276
|
-
const handleError =
|
|
9294
|
+
const handleError = useCallback6(
|
|
9277
9295
|
(message, code, cause) => {
|
|
9278
9296
|
logFlowError("flow:error", cause ?? message, { code });
|
|
9279
9297
|
if (code === "PROCESS_TIMEOUT") {
|
|
@@ -9295,7 +9313,7 @@ function DepositFlow({
|
|
|
9295
9313
|
},
|
|
9296
9314
|
[analytics, logFlowError, onErrorRef]
|
|
9297
9315
|
);
|
|
9298
|
-
const handleTotalBalanceComputed =
|
|
9316
|
+
const handleTotalBalanceComputed = useCallback6((total) => {
|
|
9299
9317
|
setTotalBalanceUsd(total);
|
|
9300
9318
|
}, []);
|
|
9301
9319
|
useEffect13(() => {
|
|
@@ -9348,12 +9366,12 @@ function DepositFlow({
|
|
|
9348
9366
|
}, [enableWallet, walletOptions, setupSlice, portfolioSlice]);
|
|
9349
9367
|
const transferCryptoEntry = setupSlice;
|
|
9350
9368
|
const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
|
|
9351
|
-
const handleRetrySetup =
|
|
9369
|
+
const handleRetrySetup = useCallback6(() => {
|
|
9352
9370
|
analytics.retry("account_setup_failed", "account_setup");
|
|
9353
9371
|
storeApi.dispatch({ type: "setup/retry-requested" });
|
|
9354
9372
|
}, [analytics, storeApi]);
|
|
9355
9373
|
if (showConnectStep) {
|
|
9356
|
-
return /* @__PURE__ */
|
|
9374
|
+
return /* @__PURE__ */ jsx27("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx27(
|
|
9357
9375
|
ConnectStep,
|
|
9358
9376
|
{
|
|
9359
9377
|
title: payment ? "Pay" : void 0,
|
|
@@ -9375,11 +9393,12 @@ function DepositFlow({
|
|
|
9375
9393
|
),
|
|
9376
9394
|
fiatPaymentMethods: cashDisplay.kind === "list" ? cashDisplay.methods : void 0,
|
|
9377
9395
|
fiatLoading: cashDisplay.kind === "loading",
|
|
9378
|
-
fiatNotice:
|
|
9396
|
+
fiatNotice: rampRows.notice ?? void 0,
|
|
9379
9397
|
recommendedMethod: cashDisplay.kind === "list" ? cashDisplay.recommendedMethod : void 0,
|
|
9380
9398
|
onSelectFiatMethod: cashDisplay.kind === "list" ? handleSelectDisplayedFiatMethod : void 0,
|
|
9381
9399
|
onPrefetchFiatMethod: cashDisplay.kind === "list" ? handlePrefetchDisplayedFiatMethod : void 0,
|
|
9382
|
-
onSelectFundFromExchange:
|
|
9400
|
+
onSelectFundFromExchange: rampRows.exchange === "hidden" ? void 0 : () => handleSelectExchange(),
|
|
9401
|
+
fundFromExchangeLoading: rampRows.exchange === "loading",
|
|
9383
9402
|
onRequestConnect: enableWallet ? onRequestConnect : void 0,
|
|
9384
9403
|
onConnect: enableWallet ? onConnect : void 0,
|
|
9385
9404
|
onDisconnect,
|
|
@@ -9412,14 +9431,14 @@ function DepositFlow({
|
|
|
9412
9431
|
}
|
|
9413
9432
|
if (isDepositAddressMode) {
|
|
9414
9433
|
return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
|
|
9415
|
-
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */
|
|
9434
|
+
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx27(
|
|
9416
9435
|
AccountPreparingSkeleton,
|
|
9417
9436
|
{
|
|
9418
9437
|
errorMessage: activeEntry.message ?? void 0,
|
|
9419
9438
|
onRetry: () => handleRetrySetup()
|
|
9420
9439
|
}
|
|
9421
|
-
) : /* @__PURE__ */
|
|
9422
|
-
effectiveStep.type === "deposit-address" && /* @__PURE__ */
|
|
9440
|
+
) : /* @__PURE__ */ jsx27(DepositAddressSkeleton, { uiConfig })),
|
|
9441
|
+
effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx27(
|
|
9423
9442
|
DepositAddressStep,
|
|
9424
9443
|
{
|
|
9425
9444
|
payment,
|
|
@@ -9464,7 +9483,7 @@ function DepositFlow({
|
|
|
9464
9483
|
debug
|
|
9465
9484
|
}
|
|
9466
9485
|
),
|
|
9467
|
-
effectiveStep.type === "qr-amount" && /* @__PURE__ */
|
|
9486
|
+
effectiveStep.type === "qr-amount" && /* @__PURE__ */ jsx27(
|
|
9468
9487
|
AmountStep,
|
|
9469
9488
|
{
|
|
9470
9489
|
asset: effectiveStep.asset,
|
|
@@ -9480,7 +9499,7 @@ function DepositFlow({
|
|
|
9480
9499
|
onContinue: handleQrAmountContinue
|
|
9481
9500
|
}
|
|
9482
9501
|
),
|
|
9483
|
-
effectiveStep.type === "qr-review" && /* @__PURE__ */
|
|
9502
|
+
effectiveStep.type === "qr-review" && /* @__PURE__ */ jsx27(
|
|
9484
9503
|
QrReviewStep,
|
|
9485
9504
|
{
|
|
9486
9505
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -9496,30 +9515,21 @@ function DepositFlow({
|
|
|
9496
9515
|
)
|
|
9497
9516
|
] });
|
|
9498
9517
|
}
|
|
9518
|
+
const rampCallbacks = {
|
|
9519
|
+
service,
|
|
9520
|
+
onSwappedComplete: handleSwappedComplete,
|
|
9521
|
+
onSwappedFailed: handleDepositFailed,
|
|
9522
|
+
onClose: () => onClose?.(openExternally ? "native_dismiss_request" : "header_button"),
|
|
9523
|
+
onGoBack: handleProviderBack,
|
|
9524
|
+
onError: handleError,
|
|
9525
|
+
onAttemptConsumed: handleSwappedAttemptConsumed,
|
|
9526
|
+
onProviderHandoff: handleSwappedProviderHandoff,
|
|
9527
|
+
onRetry: handleSwappedRetry,
|
|
9528
|
+
onCancelled: () => analytics.outcome("cancelled"),
|
|
9529
|
+
onImmersiveChange: onSwappedImmersiveChange,
|
|
9530
|
+
openExternally
|
|
9531
|
+
};
|
|
9499
9532
|
if (isFiatOnrampMode) {
|
|
9500
|
-
const swappedStep = step.type === "fiat-onramp" ? /* @__PURE__ */ jsx28(
|
|
9501
|
-
FiatOnrampStep,
|
|
9502
|
-
{
|
|
9503
|
-
smartAccount: step.smartAccount,
|
|
9504
|
-
service,
|
|
9505
|
-
paymentMethod: step.paymentMethod,
|
|
9506
|
-
methodSelectionSource: step.methodSelectionSource,
|
|
9507
|
-
consumePrefetchedUrl: consumeSwappedWidgetUrlPrefetch,
|
|
9508
|
-
onSwappedComplete: handleSwappedComplete,
|
|
9509
|
-
onSwappedFailed: handleDepositFailed,
|
|
9510
|
-
onClose: () => onClose?.(
|
|
9511
|
-
openExternally ? "native_dismiss_request" : "header_button"
|
|
9512
|
-
),
|
|
9513
|
-
onGoBack: handleProviderBack,
|
|
9514
|
-
onError: handleError,
|
|
9515
|
-
onAttemptConsumed: handleSwappedAttemptConsumed,
|
|
9516
|
-
onProviderHandoff: handleSwappedProviderHandoff,
|
|
9517
|
-
onRetry: handleSwappedRetry,
|
|
9518
|
-
onCancelled: () => analytics.outcome("cancelled"),
|
|
9519
|
-
onImmersiveChange: onSwappedImmersiveChange,
|
|
9520
|
-
openExternally
|
|
9521
|
-
}
|
|
9522
|
-
) : null;
|
|
9523
9533
|
return /* @__PURE__ */ jsxs23(
|
|
9524
9534
|
"div",
|
|
9525
9535
|
{
|
|
@@ -9527,29 +9537,34 @@ function DepositFlow({
|
|
|
9527
9537
|
"data-flow-mode": "fiat-onramp",
|
|
9528
9538
|
"data-step-type": step.type,
|
|
9529
9539
|
children: [
|
|
9530
|
-
step.type === "setup" && /* @__PURE__ */
|
|
9540
|
+
step.type === "setup" && /* @__PURE__ */ jsx27(
|
|
9531
9541
|
AccountPreparingSkeleton,
|
|
9532
9542
|
{
|
|
9533
9543
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
9534
9544
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
|
|
9535
9545
|
}
|
|
9536
9546
|
),
|
|
9537
|
-
step.type === "fiat-onramp" &&
|
|
9538
|
-
|
|
9547
|
+
step.type === "fiat-onramp" && /* @__PURE__ */ jsx27(Suspense2, { fallback: /* @__PURE__ */ jsx27(AccountPreparingSkeleton, {}), children: /* @__PURE__ */ jsx27(
|
|
9548
|
+
RampOrderStep,
|
|
9539
9549
|
{
|
|
9540
|
-
|
|
9550
|
+
...rampCallbacks,
|
|
9541
9551
|
smartAccount: step.smartAccount,
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9552
|
+
order: step.provider === "noah" && !noahNotServed && getCustomerSession ? {
|
|
9553
|
+
flow: "funding_account",
|
|
9554
|
+
backendUrl,
|
|
9555
|
+
getCustomerSession,
|
|
9556
|
+
onJourney: onBankJourney,
|
|
9557
|
+
onUnavailable: () => handleNoahNotServed(step.smartAccount)
|
|
9558
|
+
} : {
|
|
9559
|
+
flow: "hosted",
|
|
9560
|
+
kind: "fiat",
|
|
9561
|
+
method: step.paymentMethod,
|
|
9562
|
+
methodSelectionSource: step.methodSelectionSource,
|
|
9563
|
+
consumePrefetchedUrl: consumeSwappedWidgetUrlPrefetch
|
|
9564
|
+
}
|
|
9565
|
+
}
|
|
9550
9566
|
) }),
|
|
9551
|
-
step.type === "
|
|
9552
|
-
step.type === "processing" && /* @__PURE__ */ jsx28(
|
|
9567
|
+
step.type === "processing" && /* @__PURE__ */ jsx27(
|
|
9553
9568
|
ProcessingStep,
|
|
9554
9569
|
{
|
|
9555
9570
|
flowLabel: payment ? "payment" : void 0,
|
|
@@ -9593,14 +9608,14 @@ function DepositFlow({
|
|
|
9593
9608
|
"data-flow-mode": "exchange-connect",
|
|
9594
9609
|
"data-step-type": step.type,
|
|
9595
9610
|
children: [
|
|
9596
|
-
step.type === "setup" && /* @__PURE__ */
|
|
9611
|
+
step.type === "setup" && /* @__PURE__ */ jsx27(
|
|
9597
9612
|
AccountPreparingSkeleton,
|
|
9598
9613
|
{
|
|
9599
9614
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
9600
9615
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
|
|
9601
9616
|
}
|
|
9602
9617
|
),
|
|
9603
|
-
step.type === "exchange-select" && /* @__PURE__ */
|
|
9618
|
+
step.type === "exchange-select" && /* @__PURE__ */ jsx27(
|
|
9604
9619
|
ExchangeSelectStep,
|
|
9605
9620
|
{
|
|
9606
9621
|
service,
|
|
@@ -9608,29 +9623,20 @@ function DepositFlow({
|
|
|
9608
9623
|
onError: handleError
|
|
9609
9624
|
}
|
|
9610
9625
|
),
|
|
9611
|
-
step.type === "exchange-connect" && /* @__PURE__ */
|
|
9612
|
-
|
|
9626
|
+
step.type === "exchange-connect" && /* @__PURE__ */ jsx27(
|
|
9627
|
+
RampOrderStep,
|
|
9613
9628
|
{
|
|
9629
|
+
...rampCallbacks,
|
|
9614
9630
|
smartAccount: step.smartAccount,
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
openExternally ? "native_dismiss_request" : "header_button"
|
|
9622
|
-
),
|
|
9623
|
-
onGoBack: handleProviderBack,
|
|
9624
|
-
onError: handleError,
|
|
9625
|
-
onAttemptConsumed: handleSwappedAttemptConsumed,
|
|
9626
|
-
onProviderHandoff: handleSwappedProviderHandoff,
|
|
9627
|
-
onRetry: handleSwappedRetry,
|
|
9628
|
-
onCancelled: () => analytics.outcome("cancelled"),
|
|
9629
|
-
onImmersiveChange: onSwappedImmersiveChange,
|
|
9630
|
-
openExternally
|
|
9631
|
+
order: {
|
|
9632
|
+
flow: "hosted",
|
|
9633
|
+
kind: "exchange",
|
|
9634
|
+
connection: step.connection,
|
|
9635
|
+
loadPreparedUrl: () => loadSwappedConnectUrl(step.smartAccount, step.connection)
|
|
9636
|
+
}
|
|
9631
9637
|
}
|
|
9632
9638
|
),
|
|
9633
|
-
step.type === "processing" && /* @__PURE__ */
|
|
9639
|
+
step.type === "processing" && /* @__PURE__ */ jsx27(
|
|
9634
9640
|
ProcessingStep,
|
|
9635
9641
|
{
|
|
9636
9642
|
flowLabel: payment ? "payment" : void 0,
|
|
@@ -9670,14 +9676,14 @@ function DepositFlow({
|
|
|
9670
9676
|
const solanaAddr = walletSession?.solanaAddress;
|
|
9671
9677
|
const solanaProvider = walletSession?.solanaProvider;
|
|
9672
9678
|
return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
|
|
9673
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
9679
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx27(
|
|
9674
9680
|
AccountPreparingSkeleton,
|
|
9675
9681
|
{
|
|
9676
9682
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
9677
9683
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
|
|
9678
9684
|
}
|
|
9679
9685
|
),
|
|
9680
|
-
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
9686
|
+
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx27(
|
|
9681
9687
|
SolanaTokenSelectStep,
|
|
9682
9688
|
{
|
|
9683
9689
|
solanaAddress: solanaAddr,
|
|
@@ -9688,7 +9694,7 @@ function DepositFlow({
|
|
|
9688
9694
|
debug
|
|
9689
9695
|
}
|
|
9690
9696
|
),
|
|
9691
|
-
effectiveStep.type === "solana-amount" && /* @__PURE__ */
|
|
9697
|
+
effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx27(
|
|
9692
9698
|
SolanaAmountStep,
|
|
9693
9699
|
{
|
|
9694
9700
|
token: effectiveStep.token,
|
|
@@ -9705,7 +9711,7 @@ function DepositFlow({
|
|
|
9705
9711
|
debug
|
|
9706
9712
|
}
|
|
9707
9713
|
),
|
|
9708
|
-
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
9714
|
+
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx27(
|
|
9709
9715
|
SolanaConfirmStep,
|
|
9710
9716
|
{
|
|
9711
9717
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -9729,14 +9735,14 @@ function DepositFlow({
|
|
|
9729
9735
|
}
|
|
9730
9736
|
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
|
|
9731
9737
|
/* @__PURE__ */ jsxs23("div", { className: "rs-loading-state", children: [
|
|
9732
|
-
/* @__PURE__ */
|
|
9738
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx27(
|
|
9733
9739
|
"svg",
|
|
9734
9740
|
{
|
|
9735
9741
|
viewBox: "0 0 24 24",
|
|
9736
9742
|
fill: "none",
|
|
9737
9743
|
stroke: "currentColor",
|
|
9738
9744
|
strokeWidth: "2",
|
|
9739
|
-
children: /* @__PURE__ */
|
|
9745
|
+
children: /* @__PURE__ */ jsx27(
|
|
9740
9746
|
"path",
|
|
9741
9747
|
{
|
|
9742
9748
|
strokeLinecap: "round",
|
|
@@ -9747,21 +9753,21 @@ function DepositFlow({
|
|
|
9747
9753
|
}
|
|
9748
9754
|
) }),
|
|
9749
9755
|
/* @__PURE__ */ jsxs23("div", { className: "rs-loading-text", children: [
|
|
9750
|
-
/* @__PURE__ */
|
|
9751
|
-
/* @__PURE__ */
|
|
9756
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
|
|
9757
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
|
|
9752
9758
|
] })
|
|
9753
9759
|
] }),
|
|
9754
|
-
/* @__PURE__ */
|
|
9760
|
+
/* @__PURE__ */ jsx27("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx27(
|
|
9755
9761
|
"button",
|
|
9756
9762
|
{
|
|
9757
9763
|
type: "button",
|
|
9758
9764
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
9759
9765
|
onClick: handleBack,
|
|
9760
|
-
children: /* @__PURE__ */
|
|
9766
|
+
children: /* @__PURE__ */ jsx27("span", { children: "Go Back" })
|
|
9761
9767
|
}
|
|
9762
9768
|
) })
|
|
9763
9769
|
] }) : null,
|
|
9764
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
9770
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx27(
|
|
9765
9771
|
ProcessingStep,
|
|
9766
9772
|
{
|
|
9767
9773
|
flowLabel: payment ? "payment" : void 0,
|
|
@@ -9793,13 +9799,13 @@ function DepositFlow({
|
|
|
9793
9799
|
] });
|
|
9794
9800
|
}
|
|
9795
9801
|
if (isDappImportMode && effectiveStep.type === "dapp-import-resolving") {
|
|
9796
|
-
return /* @__PURE__ */
|
|
9802
|
+
return /* @__PURE__ */ jsx27(
|
|
9797
9803
|
"div",
|
|
9798
9804
|
{
|
|
9799
9805
|
className: "rs-modal-body",
|
|
9800
9806
|
"data-flow-mode": "dapp-import",
|
|
9801
9807
|
"data-step-type": effectiveStep.type,
|
|
9802
|
-
children: /* @__PURE__ */
|
|
9808
|
+
children: /* @__PURE__ */ jsx27(
|
|
9803
9809
|
DappImportAssetSelectSkeleton,
|
|
9804
9810
|
{
|
|
9805
9811
|
sourceLabel: activeDappImportProvider?.sourceLabel ?? "",
|
|
@@ -9811,13 +9817,13 @@ function DepositFlow({
|
|
|
9811
9817
|
);
|
|
9812
9818
|
}
|
|
9813
9819
|
if (effectiveStep.type === "dapp-import-select") {
|
|
9814
|
-
return /* @__PURE__ */
|
|
9820
|
+
return /* @__PURE__ */ jsx27(
|
|
9815
9821
|
"div",
|
|
9816
9822
|
{
|
|
9817
9823
|
className: "rs-modal-body",
|
|
9818
9824
|
"data-flow-mode": "dapp-import",
|
|
9819
9825
|
"data-step-type": effectiveStep.type,
|
|
9820
|
-
children: /* @__PURE__ */
|
|
9826
|
+
children: /* @__PURE__ */ jsx27(
|
|
9821
9827
|
DappImportSelectStep,
|
|
9822
9828
|
{
|
|
9823
9829
|
enabledIds: enabledAssetMigrationIds,
|
|
@@ -9844,7 +9850,7 @@ function DepositFlow({
|
|
|
9844
9850
|
);
|
|
9845
9851
|
}
|
|
9846
9852
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
9847
|
-
return /* @__PURE__ */
|
|
9853
|
+
return /* @__PURE__ */ jsx27("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx27("div", { className: "rs-step", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
|
|
9848
9854
|
}
|
|
9849
9855
|
const ownerAddress = signerContext.ownerAddress;
|
|
9850
9856
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
|
|
@@ -9855,14 +9861,14 @@ function DepositFlow({
|
|
|
9855
9861
|
return getPublicClient(chainId, rpcUrls);
|
|
9856
9862
|
};
|
|
9857
9863
|
return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
|
|
9858
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
9864
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx27(
|
|
9859
9865
|
AccountPreparingSkeleton,
|
|
9860
9866
|
{
|
|
9861
9867
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
9862
9868
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
|
|
9863
9869
|
}
|
|
9864
9870
|
),
|
|
9865
|
-
effectiveStep.type === "select-asset" && /* @__PURE__ */
|
|
9871
|
+
effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx27(
|
|
9866
9872
|
AssetSelectStep,
|
|
9867
9873
|
{
|
|
9868
9874
|
address: ownerAddress,
|
|
@@ -9875,7 +9881,7 @@ function DepositFlow({
|
|
|
9875
9881
|
onDisconnect: onDisconnect ? handleWalletDisconnect : void 0
|
|
9876
9882
|
}
|
|
9877
9883
|
),
|
|
9878
|
-
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */
|
|
9884
|
+
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx27(
|
|
9879
9885
|
DappImportAssetSelectStep,
|
|
9880
9886
|
{
|
|
9881
9887
|
sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.sourceLabel,
|
|
@@ -9884,7 +9890,7 @@ function DepositFlow({
|
|
|
9884
9890
|
onSelect: handleDappImportAssetSelected
|
|
9885
9891
|
}
|
|
9886
9892
|
),
|
|
9887
|
-
effectiveStep.type === "amount" && /* @__PURE__ */
|
|
9893
|
+
effectiveStep.type === "amount" && /* @__PURE__ */ jsx27(
|
|
9888
9894
|
AmountStep,
|
|
9889
9895
|
{
|
|
9890
9896
|
walletClient: signerContext.walletClient,
|
|
@@ -9908,7 +9914,7 @@ function DepositFlow({
|
|
|
9908
9914
|
}
|
|
9909
9915
|
}
|
|
9910
9916
|
),
|
|
9911
|
-
effectiveStep.type === "confirm" && /* @__PURE__ */
|
|
9917
|
+
effectiveStep.type === "confirm" && /* @__PURE__ */ jsx27(
|
|
9912
9918
|
ConfirmStep,
|
|
9913
9919
|
{
|
|
9914
9920
|
walletClient: signerContext.walletClient,
|
|
@@ -9959,7 +9965,7 @@ function DepositFlow({
|
|
|
9959
9965
|
onError: handleError
|
|
9960
9966
|
}
|
|
9961
9967
|
),
|
|
9962
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
9968
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx27(
|
|
9963
9969
|
ProcessingStep,
|
|
9964
9970
|
{
|
|
9965
9971
|
flowLabel: payment ? "payment" : void 0,
|
|
@@ -9997,9 +10003,9 @@ function DepositFlow({
|
|
|
9997
10003
|
] });
|
|
9998
10004
|
}
|
|
9999
10005
|
|
|
10000
|
-
// src/components/history/
|
|
10001
|
-
import { useCallback as
|
|
10002
|
-
function
|
|
10006
|
+
// src/components/history/useOrderHistory.ts
|
|
10007
|
+
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo9, useRef as useRef10, useState as useState14 } from "react";
|
|
10008
|
+
function useOrderHistory(source, open, panelOpen) {
|
|
10003
10009
|
const [orders, setOrders] = useState14([]);
|
|
10004
10010
|
const [unread, setUnread] = useState14(false);
|
|
10005
10011
|
const [loading, setLoading] = useState14(false);
|
|
@@ -10012,7 +10018,7 @@ function useBankHistory(source, open, panelOpen) {
|
|
|
10012
10018
|
const paged = useRef10(false);
|
|
10013
10019
|
const panel = useRef10(panelOpen);
|
|
10014
10020
|
panel.current = panelOpen;
|
|
10015
|
-
const load =
|
|
10021
|
+
const load = useCallback7(
|
|
10016
10022
|
async (next) => {
|
|
10017
10023
|
if (!source || !open || busy.current || document.visibilityState === "hidden")
|
|
10018
10024
|
return;
|
|
@@ -10025,9 +10031,11 @@ function useBankHistory(source, open, panelOpen) {
|
|
|
10025
10031
|
...next ? { cursor: next } : {}
|
|
10026
10032
|
});
|
|
10027
10033
|
if (current !== generation.current) return;
|
|
10028
|
-
const
|
|
10034
|
+
const listed = page.items.filter(
|
|
10035
|
+
(order) => order.provider === "noah" || hostedOrderState(order).progress !== "awaiting_payment"
|
|
10036
|
+
);
|
|
10029
10037
|
let changed = false;
|
|
10030
|
-
for (const order of
|
|
10038
|
+
for (const order of listed) {
|
|
10031
10039
|
const fingerprint = JSON.stringify(order.stages);
|
|
10032
10040
|
if (!next && seen.current.get(order.id) !== fingerprint)
|
|
10033
10041
|
changed = true;
|
|
@@ -10037,7 +10045,7 @@ function useBankHistory(source, open, panelOpen) {
|
|
|
10037
10045
|
if (!next) baselined.current = true;
|
|
10038
10046
|
setOrders((previous) => {
|
|
10039
10047
|
const merged = new Map(previous.map((order) => [order.id, order]));
|
|
10040
|
-
for (const order of
|
|
10048
|
+
for (const order of listed) merged.set(order.id, order);
|
|
10041
10049
|
return [...merged.values()].sort(
|
|
10042
10050
|
(a, b) => b.createdAt.localeCompare(a.createdAt)
|
|
10043
10051
|
);
|
|
@@ -10047,7 +10055,7 @@ function useBankHistory(source, open, panelOpen) {
|
|
|
10047
10055
|
setError(null);
|
|
10048
10056
|
} catch {
|
|
10049
10057
|
if (current === generation.current)
|
|
10050
|
-
setError("
|
|
10058
|
+
setError("Order history is unavailable. Try again shortly.");
|
|
10051
10059
|
} finally {
|
|
10052
10060
|
if (current === generation.current) {
|
|
10053
10061
|
busy.current = false;
|
|
@@ -10100,12 +10108,53 @@ function useBankHistory(source, open, panelOpen) {
|
|
|
10100
10108
|
}
|
|
10101
10109
|
};
|
|
10102
10110
|
}
|
|
10111
|
+
function useSessionOrders(backendUrl, getCustomerSession, smartAccount) {
|
|
10112
|
+
const getSession = useLatestRef(getCustomerSession);
|
|
10113
|
+
const enabled = Boolean(getCustomerSession);
|
|
10114
|
+
return useMemo9(() => {
|
|
10115
|
+
if (!enabled || !smartAccount) return null;
|
|
10116
|
+
return {
|
|
10117
|
+
listOrders: async ({ cursor, limit }) => {
|
|
10118
|
+
let refused = false;
|
|
10119
|
+
const request = createBearerTransport({
|
|
10120
|
+
backendUrl,
|
|
10121
|
+
getSession: async () => {
|
|
10122
|
+
try {
|
|
10123
|
+
return await getSession.current(smartAccount, {
|
|
10124
|
+
resumeOnly: true
|
|
10125
|
+
});
|
|
10126
|
+
} catch (error) {
|
|
10127
|
+
refused = true;
|
|
10128
|
+
throw error;
|
|
10129
|
+
}
|
|
10130
|
+
}
|
|
10131
|
+
});
|
|
10132
|
+
try {
|
|
10133
|
+
return await request(
|
|
10134
|
+
`/onramp/orders?${rampQuery({ cursor, limit })}`
|
|
10135
|
+
);
|
|
10136
|
+
} catch (error) {
|
|
10137
|
+
if (refused) return { items: [], nextCursor: null };
|
|
10138
|
+
throw error;
|
|
10139
|
+
}
|
|
10140
|
+
}
|
|
10141
|
+
};
|
|
10142
|
+
}, [backendUrl, enabled, smartAccount, getSession]);
|
|
10143
|
+
}
|
|
10103
10144
|
|
|
10104
10145
|
// src/DepositModal.tsx
|
|
10105
|
-
import { jsx as
|
|
10106
|
-
var
|
|
10146
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10147
|
+
var warnedNoCustomerSession = false;
|
|
10148
|
+
function warnNoCustomerSession() {
|
|
10149
|
+
if (warnedNoCustomerSession) return;
|
|
10150
|
+
warnedNoCustomerSession = true;
|
|
10151
|
+
console.warn(
|
|
10152
|
+
"[rhinestone] `virtualAccountOnramp` needs `getCustomerSession`; it is ignored without one."
|
|
10153
|
+
);
|
|
10154
|
+
}
|
|
10155
|
+
var ReownDepositInner = lazy4(async () => {
|
|
10107
10156
|
await loadReownDependencies();
|
|
10108
|
-
const module = await import("./DepositModalReown-
|
|
10157
|
+
const module = await import("./DepositModalReown-FJBSF4VL.mjs");
|
|
10109
10158
|
return { default: module.DepositModalReown };
|
|
10110
10159
|
});
|
|
10111
10160
|
function buildDepositAnalyticsSessionProperties({
|
|
@@ -10164,11 +10213,12 @@ function hasSuppliedWalletClient(props) {
|
|
|
10164
10213
|
}
|
|
10165
10214
|
function DepositModal(props) {
|
|
10166
10215
|
warnRemovedProps("DepositModal", props);
|
|
10216
|
+
if (props.virtualAccountOnramp && !props.getCustomerSession) warnNoCustomerSession();
|
|
10167
10217
|
checkBackendUrl("DepositModal", props.backendUrl);
|
|
10168
10218
|
const needsReown = !!props.reownAppId;
|
|
10169
10219
|
const hasWalletClientProp = hasSuppliedWalletClient(props);
|
|
10170
10220
|
if (needsReown) {
|
|
10171
|
-
return /* @__PURE__ */
|
|
10221
|
+
return /* @__PURE__ */ jsx28(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx28(
|
|
10172
10222
|
ReownDepositInner,
|
|
10173
10223
|
{
|
|
10174
10224
|
...props,
|
|
@@ -10176,7 +10226,7 @@ function DepositModal(props) {
|
|
|
10176
10226
|
}
|
|
10177
10227
|
) });
|
|
10178
10228
|
}
|
|
10179
|
-
return /* @__PURE__ */
|
|
10229
|
+
return /* @__PURE__ */ jsx28(
|
|
10180
10230
|
DepositModalInner,
|
|
10181
10231
|
{
|
|
10182
10232
|
...props,
|
|
@@ -10207,7 +10257,8 @@ function DepositModalInner({
|
|
|
10207
10257
|
assetMigrations,
|
|
10208
10258
|
initialAssetMigration,
|
|
10209
10259
|
enableFiatOnramp = false,
|
|
10210
|
-
|
|
10260
|
+
virtualAccountOnramp,
|
|
10261
|
+
getCustomerSession,
|
|
10211
10262
|
enableQrTransfer = true,
|
|
10212
10263
|
enableGaslessDeposit = false,
|
|
10213
10264
|
fiatMethods,
|
|
@@ -10241,22 +10292,10 @@ function DepositModalInner({
|
|
|
10241
10292
|
const onReadyRef = useLatestRef(onReady);
|
|
10242
10293
|
const onUiStateRef = useLatestRef(onUiState);
|
|
10243
10294
|
const [currentScreen, setCurrentScreen] = useState15("connect");
|
|
10244
|
-
const bankScope = `${backendUrl}:${recipient}:${typeof targetChainProp === "string" ? targetChainProp : getChainId(targetChainProp)}:${targetToken}`;
|
|
10245
|
-
const [bankSession, setBankSession] = useState15(null);
|
|
10246
10295
|
const [bankJourneyVisible, setBankJourneyVisible] = useState15(false);
|
|
10247
|
-
const
|
|
10248
|
-
setBankJourneyVisible(Boolean(journey));
|
|
10249
|
-
if (journey)
|
|
10250
|
-
setBankSession(
|
|
10251
|
-
journey.source ? { source: journey.source, scope: bankScope } : null
|
|
10252
|
-
);
|
|
10253
|
-
}, [bankScope]);
|
|
10254
|
-
const bankSource = bankSession?.scope === bankScope ? bankSession.source : null;
|
|
10296
|
+
const [smartAccount, setSmartAccount] = useState15(null);
|
|
10255
10297
|
useEffect15(() => {
|
|
10256
|
-
if (!isOpen)
|
|
10257
|
-
setBankSession(null);
|
|
10258
|
-
setBankJourneyVisible(false);
|
|
10259
|
-
}
|
|
10298
|
+
if (!isOpen) setBankJourneyVisible(false);
|
|
10260
10299
|
}, [isOpen]);
|
|
10261
10300
|
const [swappedImmersive, setSwappedImmersive] = useState15(false);
|
|
10262
10301
|
const [submitting, setSubmitting] = useState15(false);
|
|
@@ -10271,15 +10310,21 @@ function DepositModalInner({
|
|
|
10271
10310
|
}));
|
|
10272
10311
|
const targetChain = typeof targetChainProp === "string" ? targetChainProp : getChainId(targetChainProp);
|
|
10273
10312
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
10313
|
+
const accountScope = `${isOpen}|${backendUrl}|${recipient}|${targetChain}|${targetToken}`;
|
|
10314
|
+
const [scope, setScope] = useState15(accountScope);
|
|
10315
|
+
if (scope !== accountScope) {
|
|
10316
|
+
setScope(accountScope);
|
|
10317
|
+
setSmartAccount(null);
|
|
10318
|
+
}
|
|
10274
10319
|
const rpcUrls = useStableRpcUrls(rpcUrlsProp);
|
|
10275
|
-
const service =
|
|
10320
|
+
const service = useMemo10(
|
|
10276
10321
|
() => createDepositService(backendUrl, {
|
|
10277
10322
|
debug,
|
|
10278
10323
|
debugScope: "service:deposit"
|
|
10279
10324
|
}),
|
|
10280
10325
|
[backendUrl, debug]
|
|
10281
10326
|
);
|
|
10282
|
-
const historyAnalytics =
|
|
10327
|
+
const historyAnalytics = useMemo10(
|
|
10283
10328
|
() => createHistoryAnalytics({
|
|
10284
10329
|
modal: "deposit",
|
|
10285
10330
|
controllerRef: analyticsControllerRef,
|
|
@@ -10294,18 +10339,21 @@ function DepositModalInner({
|
|
|
10294
10339
|
canRecover: Boolean(signRecovery),
|
|
10295
10340
|
analytics: historyAnalytics
|
|
10296
10341
|
});
|
|
10297
|
-
const
|
|
10298
|
-
|
|
10342
|
+
const orderHistory = useOrderHistory(
|
|
10343
|
+
useSessionOrders(backendUrl, getCustomerSession, smartAccount),
|
|
10344
|
+
isOpen && !payment,
|
|
10345
|
+
history.isPanelOpen
|
|
10346
|
+
);
|
|
10299
10347
|
const historyDepositsRef = useLatestRef(history.deposits);
|
|
10300
10348
|
useEffect15(() => {
|
|
10301
|
-
const waitingForSettlement =
|
|
10349
|
+
const waitingForSettlement = orderHistory.orders.some((order) => {
|
|
10302
10350
|
if (order.stages.delivery.status !== "completed") return false;
|
|
10303
10351
|
const { depositId } = order.stages.delivery;
|
|
10304
10352
|
const deposit = historyDepositsRef.current.find((item) => item.id === depositId);
|
|
10305
10353
|
return !deposit || deposit.status === "pending" || deposit.status === "processing";
|
|
10306
10354
|
});
|
|
10307
10355
|
if (waitingForSettlement) history.markStale();
|
|
10308
|
-
}, [
|
|
10356
|
+
}, [orderHistory.orders, history.markStale, historyDepositsRef]);
|
|
10309
10357
|
const {
|
|
10310
10358
|
markStale: markHistoryStale,
|
|
10311
10359
|
invalidate: invalidateHistory,
|
|
@@ -10329,7 +10377,7 @@ function DepositModalInner({
|
|
|
10329
10377
|
console.debug("[deposit] client setup config (not shown yet)", clientSetup);
|
|
10330
10378
|
}
|
|
10331
10379
|
}, [debug, clientSetup]);
|
|
10332
|
-
const store =
|
|
10380
|
+
const store = useMemo10(
|
|
10333
10381
|
() => createDepositStore({ targetChain, targetToken }),
|
|
10334
10382
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10335
10383
|
[]
|
|
@@ -10361,7 +10409,7 @@ function DepositModalInner({
|
|
|
10361
10409
|
recoverySubmitting,
|
|
10362
10410
|
onUiStateRef
|
|
10363
10411
|
]);
|
|
10364
|
-
const handleStepChange =
|
|
10412
|
+
const handleStepChange = useCallback8(
|
|
10365
10413
|
(onBack, screen) => {
|
|
10366
10414
|
setBackHandler(() => onBack);
|
|
10367
10415
|
if (screen) setCurrentScreen(screen);
|
|
@@ -10369,11 +10417,12 @@ function DepositModalInner({
|
|
|
10369
10417
|
[]
|
|
10370
10418
|
);
|
|
10371
10419
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
10372
|
-
const handleLifecycle =
|
|
10420
|
+
const handleLifecycle = useCallback8(
|
|
10373
10421
|
(event) => {
|
|
10374
10422
|
onLifecycleRef.current?.(event);
|
|
10375
|
-
if (event.type === "smart-account-changed"
|
|
10376
|
-
|
|
10423
|
+
if (event.type === "smart-account-changed") {
|
|
10424
|
+
setSmartAccount(event.evm);
|
|
10425
|
+
if (!event.evm && !event.solana) invalidateHistory();
|
|
10377
10426
|
}
|
|
10378
10427
|
if (event.type === "submitted" || event.type === "complete" || event.type === "failed") {
|
|
10379
10428
|
markHistoryStale();
|
|
@@ -10381,7 +10430,7 @@ function DepositModalInner({
|
|
|
10381
10430
|
},
|
|
10382
10431
|
[onLifecycleRef, markHistoryStale, invalidateHistory]
|
|
10383
10432
|
);
|
|
10384
|
-
const closeWithSource =
|
|
10433
|
+
const closeWithSource = useCallback8(
|
|
10385
10434
|
(source) => {
|
|
10386
10435
|
if (recoverySubmitting) return;
|
|
10387
10436
|
const analytics = analyticsControllerRef.current;
|
|
@@ -10391,7 +10440,7 @@ function DepositModalInner({
|
|
|
10391
10440
|
},
|
|
10392
10441
|
[onClose, recoverySubmitting]
|
|
10393
10442
|
);
|
|
10394
|
-
const handleModalDismiss =
|
|
10443
|
+
const handleModalDismiss = useCallback8(
|
|
10395
10444
|
(reason) => {
|
|
10396
10445
|
closeWithSource(
|
|
10397
10446
|
reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
|
|
@@ -10437,7 +10486,7 @@ function DepositModalInner({
|
|
|
10437
10486
|
sourceToken,
|
|
10438
10487
|
defaultAmount,
|
|
10439
10488
|
bankOnrampEnabled: Boolean(
|
|
10440
|
-
|
|
10489
|
+
virtualAccountOnramp && getCustomerSession && (fiatMethods === void 0 || fiatMethods["bank-transfer"] === true)
|
|
10441
10490
|
),
|
|
10442
10491
|
walletIntegration,
|
|
10443
10492
|
targetChain,
|
|
@@ -10447,7 +10496,7 @@ function DepositModalInner({
|
|
|
10447
10496
|
const canGoBack = backHandler !== void 0;
|
|
10448
10497
|
const hideHeaderChrome = swappedImmersive;
|
|
10449
10498
|
const modalClassName = `rs-modal${hideHeaderChrome ? " rs-modal--swapped-iframe" : ""}`;
|
|
10450
|
-
return /* @__PURE__ */
|
|
10499
|
+
return /* @__PURE__ */ jsx28(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx28(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx28(AssetMetadataProvider, { service, children: /* @__PURE__ */ jsx28(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx28(
|
|
10451
10500
|
Modal,
|
|
10452
10501
|
{
|
|
10453
10502
|
isOpen,
|
|
@@ -10456,7 +10505,7 @@ function DepositModalInner({
|
|
|
10456
10505
|
inline,
|
|
10457
10506
|
closeOnOverlayClick,
|
|
10458
10507
|
ariaLabel: "Deposit",
|
|
10459
|
-
children: /* @__PURE__ */
|
|
10508
|
+
children: /* @__PURE__ */ jsx28(
|
|
10460
10509
|
AnalyticsSession,
|
|
10461
10510
|
{
|
|
10462
10511
|
modal: "deposit",
|
|
@@ -10466,45 +10515,45 @@ function DepositModalInner({
|
|
|
10466
10515
|
enableIngest: enableAnalyticsIngest,
|
|
10467
10516
|
ingestUrl: analyticsIngestUrl,
|
|
10468
10517
|
sessionIdRef: analyticsSessionIdRef,
|
|
10469
|
-
children: /* @__PURE__ */
|
|
10518
|
+
children: /* @__PURE__ */ jsx28(
|
|
10470
10519
|
DepositAnalyticsControllerProvider,
|
|
10471
10520
|
{
|
|
10472
10521
|
controllerRef: analyticsControllerRef,
|
|
10473
10522
|
children: /* @__PURE__ */ jsxs24("div", { ref: modalRef, className: modalClassName, children: [
|
|
10474
10523
|
!hideHeaderChrome && /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
|
|
10475
|
-
/* @__PURE__ */
|
|
10524
|
+
/* @__PURE__ */ jsx28("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx28(
|
|
10476
10525
|
"button",
|
|
10477
10526
|
{
|
|
10478
10527
|
type: "button",
|
|
10479
10528
|
className: "rs-modal-header-back",
|
|
10480
10529
|
"aria-label": "Go back",
|
|
10481
10530
|
onClick: backHandler,
|
|
10482
|
-
children: /* @__PURE__ */
|
|
10531
|
+
children: /* @__PURE__ */ jsx28(ChevronLeftIcon, {})
|
|
10483
10532
|
}
|
|
10484
10533
|
) }),
|
|
10485
10534
|
/* @__PURE__ */ jsxs24("div", { className: "rs-modal-header-nav-right", children: [
|
|
10486
|
-
historyButtonVisible && /* @__PURE__ */
|
|
10535
|
+
historyButtonVisible && /* @__PURE__ */ jsx28(
|
|
10487
10536
|
HistoryEntryButton,
|
|
10488
10537
|
{
|
|
10489
10538
|
badge: bankJourneyVisible ? null : history.badge,
|
|
10490
|
-
unread:
|
|
10539
|
+
unread: orderHistory.unread,
|
|
10491
10540
|
onClick: history.openPanel,
|
|
10492
10541
|
disabled: !recipient
|
|
10493
10542
|
}
|
|
10494
10543
|
),
|
|
10495
|
-
/* @__PURE__ */
|
|
10544
|
+
/* @__PURE__ */ jsx28(
|
|
10496
10545
|
"button",
|
|
10497
10546
|
{
|
|
10498
10547
|
type: "button",
|
|
10499
10548
|
onClick: () => closeWithSource("header_button"),
|
|
10500
10549
|
className: "rs-modal-close",
|
|
10501
10550
|
"aria-label": "Close",
|
|
10502
|
-
children: /* @__PURE__ */
|
|
10551
|
+
children: /* @__PURE__ */ jsx28(CloseIcon, {})
|
|
10503
10552
|
}
|
|
10504
10553
|
)
|
|
10505
10554
|
] })
|
|
10506
10555
|
] }),
|
|
10507
|
-
/* @__PURE__ */
|
|
10556
|
+
/* @__PURE__ */ jsx28(
|
|
10508
10557
|
DepositFlow,
|
|
10509
10558
|
{
|
|
10510
10559
|
walletClientProp,
|
|
@@ -10525,8 +10574,9 @@ function DepositModalInner({
|
|
|
10525
10574
|
assetMigrations,
|
|
10526
10575
|
initialAssetMigration,
|
|
10527
10576
|
enableFiatOnramp,
|
|
10528
|
-
|
|
10529
|
-
|
|
10577
|
+
virtualAccountOnramp,
|
|
10578
|
+
getCustomerSession,
|
|
10579
|
+
onBankJourney: setBankJourneyVisible,
|
|
10530
10580
|
backendUrl,
|
|
10531
10581
|
enableQrTransfer,
|
|
10532
10582
|
enableGaslessDeposit,
|
|
@@ -10552,12 +10602,12 @@ function DepositModalInner({
|
|
|
10552
10602
|
debug
|
|
10553
10603
|
}
|
|
10554
10604
|
),
|
|
10555
|
-
history.isPanelOpen && /* @__PURE__ */
|
|
10605
|
+
history.isPanelOpen && /* @__PURE__ */ jsx28(
|
|
10556
10606
|
HistoryOverlay,
|
|
10557
10607
|
{
|
|
10558
10608
|
controller: history,
|
|
10559
|
-
|
|
10560
|
-
bankSupportUrl:
|
|
10609
|
+
orderHistory,
|
|
10610
|
+
bankSupportUrl: virtualAccountOnramp?.supportUrl,
|
|
10561
10611
|
backLabel: "Deposit",
|
|
10562
10612
|
recipient,
|
|
10563
10613
|
backendUrl,
|