@rhinestone/deposit-modal 0.2.4 → 0.2.5-alpha.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/dist/{DepositModalReown-CY5MSQGK.mjs → DepositModalReown-GIODYNOK.mjs} +4 -2
- package/dist/{DepositModalReown-2UMPITRN.cjs → DepositModalReown-SVVA3OZ6.cjs} +5 -3
- package/dist/{WithdrawModalReown-YSRO5ZTA.mjs → WithdrawModalReown-HTEB4XGU.mjs} +3 -2
- package/dist/{WithdrawModalReown-Z5BUZQ4Z.cjs → WithdrawModalReown-VNTKGALT.cjs} +4 -3
- package/dist/{chunk-QUOP5C6V.cjs → chunk-4S262VLP.cjs} +54 -338
- package/dist/{chunk-ARGMXV6E.cjs → chunk-AHQY2O3U.cjs} +507 -235
- package/dist/{chunk-WNFGZS56.mjs → chunk-DUGDAMAF.mjs} +134 -132
- package/dist/chunk-J2SWZSXL.mjs +295 -0
- package/dist/{chunk-NFXJEOE6.cjs → chunk-KE6CJVOV.cjs} +88 -86
- package/dist/chunk-LHOHM67Z.mjs +234 -0
- package/dist/{chunk-HFQV7EHS.mjs → chunk-RQ2VCKLS.mjs} +451 -179
- package/dist/{chunk-KJEHVIPZ.mjs → chunk-WA4RA4HB.mjs} +14 -298
- package/dist/chunk-YKGL66EF.cjs +295 -0
- package/dist/chunk-ZHLQMSQM.cjs +234 -0
- package/dist/deposit.cjs +5 -3
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +4 -2
- package/dist/index.cjs +6 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +5 -3
- package/dist/reown.cjs +6 -4
- package/dist/reown.d.cts +2 -2
- package/dist/reown.d.ts +2 -2
- package/dist/reown.mjs +5 -3
- package/dist/safe-CB7TvRCc.d.cts +62 -0
- package/dist/safe-CB7TvRCc.d.ts +62 -0
- package/dist/safe.cjs +22 -1
- package/dist/safe.d.cts +11 -59
- package/dist/safe.d.ts +11 -59
- package/dist/safe.mjs +22 -0
- package/dist/{types-DGQzvl6v.d.ts → types-CeFbJ-MW.d.ts} +8 -1
- package/dist/{types-DJ1fzNC7.d.cts → types-D0NawmZ8.d.cts} +8 -1
- package/dist/withdraw.cjs +4 -3
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +3 -2
- package/package.json +1 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
POLYMARKET_POLYGON_CHAIN_ID,
|
|
3
|
+
executePolymarketSafeTransfer,
|
|
4
|
+
fetchPolymarketBalances,
|
|
5
|
+
isPolymarketAsset
|
|
6
|
+
} from "./chunk-LHOHM67Z.mjs";
|
|
1
7
|
import {
|
|
2
8
|
Button,
|
|
3
9
|
ConnectStep,
|
|
@@ -28,7 +34,7 @@ import {
|
|
|
28
34
|
tokenFormatter,
|
|
29
35
|
txRefsMatch,
|
|
30
36
|
useLatestRef
|
|
31
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-DUGDAMAF.mjs";
|
|
32
38
|
import {
|
|
33
39
|
DEFAULT_BACKEND_URL,
|
|
34
40
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -52,17 +58,17 @@ import {
|
|
|
52
58
|
// src/DepositModal.tsx
|
|
53
59
|
import {
|
|
54
60
|
useMemo as useMemo7,
|
|
55
|
-
useEffect as
|
|
61
|
+
useEffect as useEffect12,
|
|
56
62
|
useRef as useRef8,
|
|
57
|
-
useState as
|
|
63
|
+
useState as useState13,
|
|
58
64
|
useCallback as useCallback7,
|
|
59
65
|
lazy,
|
|
60
66
|
Suspense
|
|
61
67
|
} from "react";
|
|
62
68
|
|
|
63
69
|
// src/DepositFlow.tsx
|
|
64
|
-
import { useState as
|
|
65
|
-
import { formatUnits as
|
|
70
|
+
import { useState as useState12, useCallback as useCallback5, useMemo as useMemo6, useEffect as useEffect11, useRef as useRef7 } from "react";
|
|
71
|
+
import { formatUnits as formatUnits7 } from "viem";
|
|
66
72
|
|
|
67
73
|
// src/components/steps/SetupStep.tsx
|
|
68
74
|
import { useState, useEffect, useRef, useCallback } from "react";
|
|
@@ -754,7 +760,7 @@ function AmountStep({
|
|
|
754
760
|
try {
|
|
755
761
|
const liquidity = await service.checkLiquidity({
|
|
756
762
|
sourceChainId: asset.chainId,
|
|
757
|
-
sourceToken: asset.token,
|
|
763
|
+
sourceToken: asset.depositToken ?? asset.token,
|
|
758
764
|
destinationChainId: targetChain,
|
|
759
765
|
destinationToken: targetToken,
|
|
760
766
|
amount: amountInUnits.toString()
|
|
@@ -1002,7 +1008,8 @@ function ConfirmStep({
|
|
|
1002
1008
|
liquidityWarning,
|
|
1003
1009
|
onConfirm,
|
|
1004
1010
|
onError,
|
|
1005
|
-
onDepositSubmitted
|
|
1011
|
+
onDepositSubmitted,
|
|
1012
|
+
onExecuteTransfer
|
|
1006
1013
|
}) {
|
|
1007
1014
|
const [isSubmitting, setIsSubmitting] = useState4(false);
|
|
1008
1015
|
const [error, setError] = useState4(null);
|
|
@@ -1071,6 +1078,22 @@ function ConfirmStep({
|
|
|
1071
1078
|
if (!account || !chain) {
|
|
1072
1079
|
throw new Error("Wallet not properly connected");
|
|
1073
1080
|
}
|
|
1081
|
+
if (onExecuteTransfer) {
|
|
1082
|
+
const result = await onExecuteTransfer(amountUnits);
|
|
1083
|
+
onDepositSubmitted?.(result.txHash, asset.chainId, amountUnits.toString());
|
|
1084
|
+
onConfirm(
|
|
1085
|
+
result.txHash,
|
|
1086
|
+
asset.chainId,
|
|
1087
|
+
amountUnits.toString(),
|
|
1088
|
+
result.sourceToken,
|
|
1089
|
+
{
|
|
1090
|
+
directTransfer: result.directTransfer,
|
|
1091
|
+
sourceSymbol: result.sourceSymbol,
|
|
1092
|
+
sourceDecimals: result.sourceDecimals
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1074
1097
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1075
1098
|
const hash = isNativeAsset(asset) ? await walletClient.sendTransaction({
|
|
1076
1099
|
account,
|
|
@@ -1149,7 +1172,7 @@ function ConfirmStep({
|
|
|
1149
1172
|
] }),
|
|
1150
1173
|
/* @__PURE__ */ jsxs4("div", { className: "rs-card", children: [
|
|
1151
1174
|
/* @__PURE__ */ jsxs4("div", { className: "rs-card-row", children: [
|
|
1152
|
-
/* @__PURE__ */ jsx4("span", { className: "rs-card-label", children: "You send" }),
|
|
1175
|
+
/* @__PURE__ */ jsx4("span", { className: "rs-card-label", children: asset.reviewLabel ?? "You send" }),
|
|
1153
1176
|
/* @__PURE__ */ jsxs4(
|
|
1154
1177
|
"span",
|
|
1155
1178
|
{
|
|
@@ -1171,6 +1194,18 @@ function ConfirmStep({
|
|
|
1171
1194
|
}
|
|
1172
1195
|
)
|
|
1173
1196
|
] }),
|
|
1197
|
+
asset.reviewHelperText && /* @__PURE__ */ jsx4(
|
|
1198
|
+
"div",
|
|
1199
|
+
{
|
|
1200
|
+
style: {
|
|
1201
|
+
fontSize: 11,
|
|
1202
|
+
color: "var(--rs-muted-foreground)",
|
|
1203
|
+
lineHeight: 1.4,
|
|
1204
|
+
marginTop: 8
|
|
1205
|
+
},
|
|
1206
|
+
children: asset.reviewHelperText
|
|
1207
|
+
}
|
|
1208
|
+
),
|
|
1174
1209
|
/* @__PURE__ */ jsxs4("div", { className: "rs-card-row", children: [
|
|
1175
1210
|
/* @__PURE__ */ jsx4("span", { className: "rs-card-label", children: "You receive" }),
|
|
1176
1211
|
/* @__PURE__ */ jsxs4(
|
|
@@ -3319,8 +3354,103 @@ function SolanaConfirmStep({
|
|
|
3319
3354
|
] });
|
|
3320
3355
|
}
|
|
3321
3356
|
|
|
3322
|
-
// src/
|
|
3357
|
+
// src/components/steps/PolymarketMigrationStep.tsx
|
|
3358
|
+
import { useEffect as useEffect10, useState as useState11 } from "react";
|
|
3359
|
+
import { formatUnits as formatUnits6 } from "viem";
|
|
3323
3360
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3361
|
+
function PolymarketMigrationStep({
|
|
3362
|
+
safeAddress,
|
|
3363
|
+
assets,
|
|
3364
|
+
loading,
|
|
3365
|
+
error,
|
|
3366
|
+
onContinue
|
|
3367
|
+
}) {
|
|
3368
|
+
const [selectedAssetId, setSelectedAssetId] = useState11(null);
|
|
3369
|
+
useEffect10(() => {
|
|
3370
|
+
if (selectedAssetId && assets.some((asset) => asset.id === selectedAssetId))
|
|
3371
|
+
return;
|
|
3372
|
+
setSelectedAssetId(assets[0]?.id ?? null);
|
|
3373
|
+
}, [assets, selectedAssetId]);
|
|
3374
|
+
const selectedAsset = assets.find((asset) => asset.id === selectedAssetId);
|
|
3375
|
+
const shortSafe = safeAddress ? `${safeAddress.slice(0, 6)}...${safeAddress.slice(-4)}` : null;
|
|
3376
|
+
return /* @__PURE__ */ jsxs11("div", { className: "rs-step", children: [
|
|
3377
|
+
/* @__PURE__ */ jsx12("div", { style: { padding: "12px 12px 8px" }, children: /* @__PURE__ */ jsx12("div", { className: "rs-step-title", children: "Migrate from Polymarket" }) }),
|
|
3378
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
|
|
3379
|
+
loading && /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", style: { padding: "28px 12px" }, children: [
|
|
3380
|
+
/* @__PURE__ */ jsx12(Spinner, { className: "rs-text-tertiary" }),
|
|
3381
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-text-sm rs-text-tertiary", children: "Checking Polymarket balance" })
|
|
3382
|
+
] }),
|
|
3383
|
+
!loading && error && /* @__PURE__ */ jsx12("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx12("span", { className: "rs-alert-text", children: error }) }),
|
|
3384
|
+
!loading && !error && assets.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-empty-state", children: [
|
|
3385
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-empty-text", children: "No Polymarket balance found" }),
|
|
3386
|
+
shortSafe && /* @__PURE__ */ jsx12("div", { className: "rs-empty-address", children: shortSafe })
|
|
3387
|
+
] }),
|
|
3388
|
+
!loading && !error && assets.length > 0 && /* @__PURE__ */ jsx12("div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
3389
|
+
const selected = asset.id === selectedAssetId;
|
|
3390
|
+
const raw = formatUnits6(BigInt(asset.balance ?? "0"), 6);
|
|
3391
|
+
const numeric = Number(raw);
|
|
3392
|
+
const tokenAmount = Number.isFinite(numeric) ? tokenFormatter.format(numeric) : raw;
|
|
3393
|
+
const tokenIcon = getTokenIcon(asset.symbol);
|
|
3394
|
+
const chainIcon = getChainIcon(asset.chainId);
|
|
3395
|
+
return /* @__PURE__ */ jsxs11(
|
|
3396
|
+
"button",
|
|
3397
|
+
{
|
|
3398
|
+
type: "button",
|
|
3399
|
+
className: `rs-asset-row ${selected ? "rs-asset-row--selected" : ""}`,
|
|
3400
|
+
onClick: () => setSelectedAssetId(asset.id),
|
|
3401
|
+
style: { textAlign: "left" },
|
|
3402
|
+
children: [
|
|
3403
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-info", children: [
|
|
3404
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-icon-wrapper", children: [
|
|
3405
|
+
tokenIcon ? /* @__PURE__ */ jsx12(
|
|
3406
|
+
"img",
|
|
3407
|
+
{
|
|
3408
|
+
src: tokenIcon,
|
|
3409
|
+
alt: asset.symbol,
|
|
3410
|
+
className: "rs-asset-icon",
|
|
3411
|
+
style: { background: "transparent" }
|
|
3412
|
+
}
|
|
3413
|
+
) : /* @__PURE__ */ jsx12("div", { className: "rs-asset-icon", children: asset.symbol.slice(0, 4) }),
|
|
3414
|
+
chainIcon && /* @__PURE__ */ jsx12(
|
|
3415
|
+
"img",
|
|
3416
|
+
{
|
|
3417
|
+
src: chainIcon,
|
|
3418
|
+
alt: getChainName(asset.chainId),
|
|
3419
|
+
className: "rs-asset-chain-badge"
|
|
3420
|
+
}
|
|
3421
|
+
)
|
|
3422
|
+
] }),
|
|
3423
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3424
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-asset-name", children: asset.symbol }),
|
|
3425
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-balance-small", children: [
|
|
3426
|
+
tokenAmount,
|
|
3427
|
+
" ",
|
|
3428
|
+
asset.symbol
|
|
3429
|
+
] })
|
|
3430
|
+
] })
|
|
3431
|
+
] }),
|
|
3432
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-asset-balance", children: currencyFormatter.format(asset.balanceUsd ?? 0) })
|
|
3433
|
+
]
|
|
3434
|
+
},
|
|
3435
|
+
asset.id
|
|
3436
|
+
);
|
|
3437
|
+
}) })
|
|
3438
|
+
] }),
|
|
3439
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx12(
|
|
3440
|
+
Button,
|
|
3441
|
+
{
|
|
3442
|
+
fullWidth: true,
|
|
3443
|
+
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
3444
|
+
disabled: !selectedAsset || loading,
|
|
3445
|
+
children: "Continue"
|
|
3446
|
+
}
|
|
3447
|
+
) }),
|
|
3448
|
+
/* @__PURE__ */ jsx12(PoweredBy, {})
|
|
3449
|
+
] });
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
// src/DepositFlow.tsx
|
|
3453
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3324
3454
|
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
3325
3455
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
3326
3456
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
@@ -3348,6 +3478,7 @@ function DepositFlow({
|
|
|
3348
3478
|
forceRegister = false,
|
|
3349
3479
|
waitForFinalTx = true,
|
|
3350
3480
|
enableSolana = true,
|
|
3481
|
+
enablePolymarketMigration = false,
|
|
3351
3482
|
reownWallet,
|
|
3352
3483
|
onConnect,
|
|
3353
3484
|
onDisconnect,
|
|
@@ -3381,13 +3512,17 @@ function DepositFlow({
|
|
|
3381
3512
|
const hasInitialWalletHydrationPending = Boolean(
|
|
3382
3513
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
3383
3514
|
);
|
|
3384
|
-
const [step, setStep] =
|
|
3385
|
-
const [flowMode, setFlowMode] =
|
|
3386
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
3387
|
-
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] =
|
|
3388
|
-
const [selectedWalletId, setSelectedWalletId] =
|
|
3389
|
-
const [
|
|
3515
|
+
const [step, setStep] = useState12({ type: "setup" });
|
|
3516
|
+
const [flowMode, setFlowMode] = useState12(null);
|
|
3517
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = useState12(0);
|
|
3518
|
+
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState12(false);
|
|
3519
|
+
const [selectedWalletId, setSelectedWalletId] = useState12(null);
|
|
3520
|
+
const [polymarketBalances, setPolymarketBalances] = useState12(null);
|
|
3521
|
+
const [isPolymarketLoading, setIsPolymarketLoading] = useState12(false);
|
|
3522
|
+
const [polymarketError, setPolymarketError] = useState12(null);
|
|
3523
|
+
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState12(() => !hasInitialWalletHydrationPending);
|
|
3390
3524
|
const flowModeRef = useRef7(null);
|
|
3525
|
+
const pendingPolymarketConnectRef = useRef7(false);
|
|
3391
3526
|
const portfolioAssetsRef = useRef7([]);
|
|
3392
3527
|
const stableWalletSignerRef = useRef7(null);
|
|
3393
3528
|
const stableWalletSelectionKeyRef = useRef7(null);
|
|
@@ -3413,7 +3548,7 @@ function DepositFlow({
|
|
|
3413
3548
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
3414
3549
|
try {
|
|
3415
3550
|
const balanceUnits = Number(
|
|
3416
|
-
|
|
3551
|
+
formatUnits7(BigInt(asset.balance), asset.decimals)
|
|
3417
3552
|
);
|
|
3418
3553
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
3419
3554
|
} catch {
|
|
@@ -3429,6 +3564,39 @@ function DepositFlow({
|
|
|
3429
3564
|
};
|
|
3430
3565
|
}, [dappWalletClient]);
|
|
3431
3566
|
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
3567
|
+
const connectedPolymarketOwner = connectedWalletAddress ?? reownWallet?.address ?? null;
|
|
3568
|
+
useEffect11(() => {
|
|
3569
|
+
let active = true;
|
|
3570
|
+
async function loadPolymarketBalance(owner) {
|
|
3571
|
+
setIsPolymarketLoading(true);
|
|
3572
|
+
setPolymarketError(null);
|
|
3573
|
+
try {
|
|
3574
|
+
const balances = await fetchPolymarketBalances({
|
|
3575
|
+
publicClient: getPublicClient(POLYMARKET_POLYGON_CHAIN_ID),
|
|
3576
|
+
owner
|
|
3577
|
+
});
|
|
3578
|
+
if (active) setPolymarketBalances(balances);
|
|
3579
|
+
} catch (err) {
|
|
3580
|
+
if (!active) return;
|
|
3581
|
+
setPolymarketBalances(null);
|
|
3582
|
+
setPolymarketError(
|
|
3583
|
+
err instanceof Error ? err.message : "Failed to load Polymarket balance"
|
|
3584
|
+
);
|
|
3585
|
+
} finally {
|
|
3586
|
+
if (active) setIsPolymarketLoading(false);
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
if (!enablePolymarketMigration || !connectedPolymarketOwner) {
|
|
3590
|
+
setPolymarketBalances(null);
|
|
3591
|
+
setPolymarketError(null);
|
|
3592
|
+
setIsPolymarketLoading(false);
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
loadPolymarketBalance(connectedPolymarketOwner);
|
|
3596
|
+
return () => {
|
|
3597
|
+
active = false;
|
|
3598
|
+
};
|
|
3599
|
+
}, [enablePolymarketMigration, connectedPolymarketOwner]);
|
|
3432
3600
|
const walletOptions = useMemo6(() => {
|
|
3433
3601
|
const options = [];
|
|
3434
3602
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3481,7 +3649,7 @@ function DepositFlow({
|
|
|
3481
3649
|
reownWallet?.solanaAddress,
|
|
3482
3650
|
reownWallet?.caipAddress
|
|
3483
3651
|
]);
|
|
3484
|
-
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
3652
|
+
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet && !enablePolymarketMigration;
|
|
3485
3653
|
const hasWalletOptions = walletOptions.length > 0;
|
|
3486
3654
|
const hasReownSession = Boolean(
|
|
3487
3655
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
@@ -3490,7 +3658,7 @@ function DepositFlow({
|
|
|
3490
3658
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
3491
3659
|
);
|
|
3492
3660
|
const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
|
|
3493
|
-
|
|
3661
|
+
useEffect11(() => {
|
|
3494
3662
|
if (!isWalletHydrationPending) {
|
|
3495
3663
|
setHasQrAutoAdvanceGraceElapsed(true);
|
|
3496
3664
|
return;
|
|
@@ -3502,7 +3670,7 @@ function DepositFlow({
|
|
|
3502
3670
|
return () => window.clearTimeout(timeout);
|
|
3503
3671
|
}, [isWalletHydrationPending]);
|
|
3504
3672
|
const walletSelectionKey = useMemo6(() => {
|
|
3505
|
-
if (flowMode !== "wallet") return null;
|
|
3673
|
+
if (flowMode !== "wallet" && flowMode !== "polymarket") return null;
|
|
3506
3674
|
if (canAutoLock) {
|
|
3507
3675
|
return getAddressKey(connectedWalletAddress);
|
|
3508
3676
|
}
|
|
@@ -3581,8 +3749,8 @@ function DepositFlow({
|
|
|
3581
3749
|
reownWallet,
|
|
3582
3750
|
targetChain
|
|
3583
3751
|
]);
|
|
3584
|
-
|
|
3585
|
-
if (flowMode !== "wallet") {
|
|
3752
|
+
useEffect11(() => {
|
|
3753
|
+
if (flowMode !== "wallet" && flowMode !== "polymarket") {
|
|
3586
3754
|
stableWalletSelectionKeyRef.current = null;
|
|
3587
3755
|
stableWalletSignerRef.current = null;
|
|
3588
3756
|
return;
|
|
@@ -3606,7 +3774,7 @@ function DepositFlow({
|
|
|
3606
3774
|
switchChain: void 0
|
|
3607
3775
|
};
|
|
3608
3776
|
}
|
|
3609
|
-
if (flowMode !== "wallet") {
|
|
3777
|
+
if (flowMode !== "wallet" && flowMode !== "polymarket") {
|
|
3610
3778
|
return null;
|
|
3611
3779
|
}
|
|
3612
3780
|
if (walletSignerContext) {
|
|
@@ -3626,7 +3794,7 @@ function DepositFlow({
|
|
|
3626
3794
|
]);
|
|
3627
3795
|
const sessionKeyAddress = dappAddress ?? signerContext?.ownerAddress ?? null;
|
|
3628
3796
|
const lastTargetRef = useRef7(null);
|
|
3629
|
-
|
|
3797
|
+
useEffect11(() => {
|
|
3630
3798
|
const prev = lastTargetRef.current;
|
|
3631
3799
|
if (prev && (prev.chain !== targetChain || prev.token.toLowerCase() !== targetToken.toLowerCase())) {
|
|
3632
3800
|
if (step.type !== "processing") {
|
|
@@ -3638,6 +3806,9 @@ function DepositFlow({
|
|
|
3638
3806
|
const handleBackFromAmount = useCallback5(() => {
|
|
3639
3807
|
setStep((prev) => {
|
|
3640
3808
|
if (prev.type !== "amount") return prev;
|
|
3809
|
+
if (isPolymarketAsset(prev.asset)) {
|
|
3810
|
+
return { type: "polymarket-source", smartAccount: prev.smartAccount };
|
|
3811
|
+
}
|
|
3641
3812
|
return { type: "select-asset", smartAccount: prev.smartAccount };
|
|
3642
3813
|
});
|
|
3643
3814
|
}, []);
|
|
@@ -3664,6 +3835,14 @@ function DepositFlow({
|
|
|
3664
3835
|
setIsConnectSelectionConfirmed(false);
|
|
3665
3836
|
}
|
|
3666
3837
|
}, [hasWalletOptions, reownWallet]);
|
|
3838
|
+
const handleBackFromPolymarketSource = useCallback5(() => {
|
|
3839
|
+
setFlowMode(null);
|
|
3840
|
+
setStep({ type: "setup" });
|
|
3841
|
+
if (hasWalletOptions || reownWallet) {
|
|
3842
|
+
hasNavigatedBackRef.current = true;
|
|
3843
|
+
setIsConnectSelectionConfirmed(false);
|
|
3844
|
+
}
|
|
3845
|
+
}, [hasWalletOptions, reownWallet]);
|
|
3667
3846
|
const handleBackFromSolanaAmount = useCallback5(() => {
|
|
3668
3847
|
setStep((prev) => {
|
|
3669
3848
|
if (prev.type !== "solana-amount") return prev;
|
|
@@ -3698,15 +3877,15 @@ function DepositFlow({
|
|
|
3698
3877
|
};
|
|
3699
3878
|
});
|
|
3700
3879
|
}, []);
|
|
3701
|
-
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
3702
|
-
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3703
|
-
|
|
3880
|
+
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "polymarket-source" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
3881
|
+
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "polymarket-source" ? handleBackFromPolymarketSource : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3882
|
+
useEffect11(() => {
|
|
3704
3883
|
onStepChangeRef.current?.(stepIndex, currentBackHandler);
|
|
3705
3884
|
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
3706
3885
|
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
3707
3886
|
const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
3708
3887
|
const lastStepOpenEventKeyRef = useRef7(null);
|
|
3709
|
-
|
|
3888
|
+
useEffect11(() => {
|
|
3710
3889
|
if (!stepOpenEventKey) {
|
|
3711
3890
|
lastStepOpenEventKeyRef.current = null;
|
|
3712
3891
|
return;
|
|
@@ -3748,7 +3927,7 @@ function DepositFlow({
|
|
|
3748
3927
|
totalBalanceUsd,
|
|
3749
3928
|
onEventRef
|
|
3750
3929
|
]);
|
|
3751
|
-
|
|
3930
|
+
useEffect11(() => {
|
|
3752
3931
|
logFlow("state:changed", {
|
|
3753
3932
|
step: step.type,
|
|
3754
3933
|
flowMode,
|
|
@@ -3764,14 +3943,18 @@ function DepositFlow({
|
|
|
3764
3943
|
targetChain,
|
|
3765
3944
|
targetToken
|
|
3766
3945
|
]);
|
|
3767
|
-
|
|
3946
|
+
useEffect11(() => {
|
|
3768
3947
|
onTotalBalanceChangeRef.current?.(totalBalanceUsd);
|
|
3769
3948
|
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
3770
3949
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
3771
3950
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
3951
|
+
const isPolymarketMode = flowMode === "polymarket";
|
|
3772
3952
|
const handleSelectProvider = useCallback5(() => {
|
|
3773
3953
|
setFlowMode("wallet");
|
|
3774
3954
|
}, []);
|
|
3955
|
+
const handleSelectPolymarket = useCallback5(() => {
|
|
3956
|
+
setFlowMode("polymarket");
|
|
3957
|
+
}, []);
|
|
3775
3958
|
const handleSelectSolanaWallet = useCallback5(() => {
|
|
3776
3959
|
setFlowMode("solana-wallet");
|
|
3777
3960
|
}, []);
|
|
@@ -3792,7 +3975,7 @@ function DepositFlow({
|
|
|
3792
3975
|
logFlow("setup:complete", {
|
|
3793
3976
|
smartAccount,
|
|
3794
3977
|
hasSolanaDepositAddress: Boolean(solanaDepositAddress),
|
|
3795
|
-
flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
|
|
3978
|
+
flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : isPolymarketMode ? "polymarket" : "wallet"
|
|
3796
3979
|
});
|
|
3797
3980
|
onSmartAccountChangeRef.current?.({
|
|
3798
3981
|
evm: smartAccount,
|
|
@@ -3817,11 +4000,22 @@ function DepositFlow({
|
|
|
3817
4000
|
code: "SOLANA_SETUP_FAILED"
|
|
3818
4001
|
});
|
|
3819
4002
|
}
|
|
4003
|
+
} else if (isPolymarketMode) {
|
|
4004
|
+
setStep({
|
|
4005
|
+
type: "polymarket-source",
|
|
4006
|
+
smartAccount
|
|
4007
|
+
});
|
|
3820
4008
|
} else {
|
|
3821
4009
|
setStep({ type: "select-asset", smartAccount });
|
|
3822
4010
|
}
|
|
3823
4011
|
},
|
|
3824
|
-
[
|
|
4012
|
+
[
|
|
4013
|
+
isDepositAddressMode,
|
|
4014
|
+
isSolanaWalletMode,
|
|
4015
|
+
isPolymarketMode,
|
|
4016
|
+
logFlow,
|
|
4017
|
+
onSmartAccountChangeRef
|
|
4018
|
+
]
|
|
3825
4019
|
);
|
|
3826
4020
|
const handleDepositAddressSubmitted = useCallback5(
|
|
3827
4021
|
(data) => {
|
|
@@ -3939,6 +4133,20 @@ function DepositFlow({
|
|
|
3939
4133
|
},
|
|
3940
4134
|
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3941
4135
|
);
|
|
4136
|
+
const handlePolymarketAssetContinue = useCallback5(
|
|
4137
|
+
(asset) => {
|
|
4138
|
+
setStep((prev) => {
|
|
4139
|
+
if (prev.type !== "polymarket-source") return prev;
|
|
4140
|
+
return {
|
|
4141
|
+
type: "amount",
|
|
4142
|
+
smartAccount: prev.smartAccount,
|
|
4143
|
+
asset,
|
|
4144
|
+
amount: defaultAmount
|
|
4145
|
+
};
|
|
4146
|
+
});
|
|
4147
|
+
},
|
|
4148
|
+
[defaultAmount]
|
|
4149
|
+
);
|
|
3942
4150
|
const handleAmountContinue = useCallback5(
|
|
3943
4151
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
3944
4152
|
const targetSym = getTokenSymbol(targetToken, targetChain);
|
|
@@ -3961,7 +4169,7 @@ function DepositFlow({
|
|
|
3961
4169
|
[targetToken, targetChain, getTokenPriceUsd]
|
|
3962
4170
|
);
|
|
3963
4171
|
const handleDepositSubmitted = useCallback5(
|
|
3964
|
-
(txHash, chainId, amount, token) => {
|
|
4172
|
+
(txHash, chainId, amount, token, options) => {
|
|
3965
4173
|
logFlow("evm:submitted", {
|
|
3966
4174
|
txHash,
|
|
3967
4175
|
sourceChain: chainId,
|
|
@@ -3977,7 +4185,9 @@ function DepositFlow({
|
|
|
3977
4185
|
sourceChain: chainId,
|
|
3978
4186
|
sourceToken: token,
|
|
3979
4187
|
amount,
|
|
3980
|
-
|
|
4188
|
+
sourceSymbol: options?.sourceSymbol,
|
|
4189
|
+
sourceDecimals: options?.sourceDecimals,
|
|
4190
|
+
directTransfer: options?.directTransfer ?? isSameRoute2(chainId, token, targetChain, targetToken)
|
|
3981
4191
|
};
|
|
3982
4192
|
});
|
|
3983
4193
|
},
|
|
@@ -4020,12 +4230,36 @@ function DepositFlow({
|
|
|
4020
4230
|
}
|
|
4021
4231
|
return null;
|
|
4022
4232
|
}, [selectedWalletId, walletOptions]);
|
|
4233
|
+
const polymarketWalletId = useMemo6(() => {
|
|
4234
|
+
if (selectedWalletIdEffective && walletOptions.find((option) => option.id === selectedWalletIdEffective)?.kind !== "solana") {
|
|
4235
|
+
return selectedWalletIdEffective;
|
|
4236
|
+
}
|
|
4237
|
+
return walletOptions.find((option) => option.kind !== "solana")?.id ?? null;
|
|
4238
|
+
}, [selectedWalletIdEffective, walletOptions]);
|
|
4239
|
+
const handleConnectPolymarket = useCallback5(() => {
|
|
4240
|
+
pendingPolymarketConnectRef.current = true;
|
|
4241
|
+
if (hasWalletOptions && polymarketWalletId) {
|
|
4242
|
+
setSelectedWalletId(polymarketWalletId);
|
|
4243
|
+
handleSelectPolymarket();
|
|
4244
|
+
setIsConnectSelectionConfirmed(true);
|
|
4245
|
+
pendingPolymarketConnectRef.current = false;
|
|
4246
|
+
return;
|
|
4247
|
+
}
|
|
4248
|
+
const connect = onConnect ?? onRequestConnect;
|
|
4249
|
+
connect?.();
|
|
4250
|
+
}, [
|
|
4251
|
+
hasWalletOptions,
|
|
4252
|
+
polymarketWalletId,
|
|
4253
|
+
handleSelectPolymarket,
|
|
4254
|
+
onConnect,
|
|
4255
|
+
onRequestConnect
|
|
4256
|
+
]);
|
|
4023
4257
|
const walletOptionsKey = useMemo6(
|
|
4024
4258
|
() => walletOptions.map((option) => option.id).join(","),
|
|
4025
4259
|
[walletOptions]
|
|
4026
4260
|
);
|
|
4027
4261
|
const hasNavigatedBackRef = useRef7(false);
|
|
4028
|
-
|
|
4262
|
+
useEffect11(() => {
|
|
4029
4263
|
if (flowModeRef.current) {
|
|
4030
4264
|
return;
|
|
4031
4265
|
}
|
|
@@ -4036,14 +4270,14 @@ function DepositFlow({
|
|
|
4036
4270
|
setStep({ type: "setup" });
|
|
4037
4271
|
}
|
|
4038
4272
|
}, [walletOptionsKey]);
|
|
4039
|
-
|
|
4040
|
-
if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
|
|
4273
|
+
useEffect11(() => {
|
|
4274
|
+
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "polymarket") && !signerContext) {
|
|
4041
4275
|
setSelectedWalletId(null);
|
|
4042
4276
|
setIsConnectSelectionConfirmed(false);
|
|
4043
4277
|
setFlowMode(null);
|
|
4044
4278
|
}
|
|
4045
4279
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext]);
|
|
4046
|
-
|
|
4280
|
+
useEffect11(() => {
|
|
4047
4281
|
if (enableSolana || flowMode !== "solana-wallet") {
|
|
4048
4282
|
return;
|
|
4049
4283
|
}
|
|
@@ -4054,16 +4288,22 @@ function DepositFlow({
|
|
|
4054
4288
|
setStep({ type: "setup" });
|
|
4055
4289
|
}
|
|
4056
4290
|
}, [enableSolana, flowMode, step.type]);
|
|
4057
|
-
|
|
4291
|
+
useEffect11(() => {
|
|
4058
4292
|
if (hasNavigatedBackRef.current || isConnectSelectionConfirmed || flowMode) {
|
|
4059
4293
|
return;
|
|
4060
4294
|
}
|
|
4061
4295
|
if (hasWalletOptions) {
|
|
4062
|
-
const walletId = selectedWalletIdEffective;
|
|
4296
|
+
const walletId = pendingPolymarketConnectRef.current ? polymarketWalletId : selectedWalletIdEffective;
|
|
4063
4297
|
if (walletId) {
|
|
4298
|
+
if (enablePolymarketMigration && !pendingPolymarketConnectRef.current) {
|
|
4299
|
+
return;
|
|
4300
|
+
}
|
|
4064
4301
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4065
4302
|
setSelectedWalletId(walletId);
|
|
4066
|
-
if (
|
|
4303
|
+
if (pendingPolymarketConnectRef.current) {
|
|
4304
|
+
pendingPolymarketConnectRef.current = false;
|
|
4305
|
+
handleSelectPolymarket();
|
|
4306
|
+
} else if (enableSolana && selectedOption?.kind === "solana") {
|
|
4067
4307
|
handleSelectSolanaWallet();
|
|
4068
4308
|
} else {
|
|
4069
4309
|
handleSelectProvider();
|
|
@@ -4072,7 +4312,7 @@ function DepositFlow({
|
|
|
4072
4312
|
return;
|
|
4073
4313
|
}
|
|
4074
4314
|
}
|
|
4075
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
4315
|
+
if (!enablePolymarketMigration && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
4076
4316
|
handleSelectTransferCrypto();
|
|
4077
4317
|
setIsConnectSelectionConfirmed(true);
|
|
4078
4318
|
}
|
|
@@ -4081,37 +4321,28 @@ function DepositFlow({
|
|
|
4081
4321
|
hasReownSession,
|
|
4082
4322
|
hasQrAutoAdvanceGraceElapsed,
|
|
4083
4323
|
enableSolana,
|
|
4324
|
+
enablePolymarketMigration,
|
|
4084
4325
|
isConnectSelectionConfirmed,
|
|
4085
4326
|
flowMode,
|
|
4086
4327
|
selectedWalletIdEffective,
|
|
4328
|
+
polymarketWalletId,
|
|
4087
4329
|
dappAddress,
|
|
4088
4330
|
dappWalletClient,
|
|
4089
4331
|
walletOptions,
|
|
4090
4332
|
handleSelectProvider,
|
|
4333
|
+
handleSelectPolymarket,
|
|
4091
4334
|
handleSelectSolanaWallet,
|
|
4092
4335
|
handleSelectTransferCrypto
|
|
4093
4336
|
]);
|
|
4094
4337
|
if (showConnectStep) {
|
|
4095
|
-
return /* @__PURE__ */
|
|
4338
|
+
return /* @__PURE__ */ jsx13("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx13(
|
|
4096
4339
|
ConnectStep,
|
|
4097
4340
|
{
|
|
4098
4341
|
walletOptions,
|
|
4099
|
-
|
|
4100
|
-
onSelectWallet:
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
setIsConnectSelectionConfirmed(true);
|
|
4104
|
-
} : void 0,
|
|
4105
|
-
onRequestConnect,
|
|
4106
|
-
onConnect,
|
|
4107
|
-
onDisconnect,
|
|
4108
|
-
onContinue: () => {
|
|
4109
|
-
if (selectedWalletIdEffective) {
|
|
4110
|
-
setSelectedWalletId(selectedWalletIdEffective);
|
|
4111
|
-
}
|
|
4112
|
-
const selectedOption = walletOptions.find(
|
|
4113
|
-
(o) => o.id === selectedWalletIdEffective
|
|
4114
|
-
);
|
|
4342
|
+
enablePolymarketMigration,
|
|
4343
|
+
onSelectWallet: (walletId) => {
|
|
4344
|
+
setSelectedWalletId(walletId);
|
|
4345
|
+
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4115
4346
|
if (enableSolana && selectedOption?.kind === "solana") {
|
|
4116
4347
|
handleSelectSolanaWallet();
|
|
4117
4348
|
} else {
|
|
@@ -4119,14 +4350,22 @@ function DepositFlow({
|
|
|
4119
4350
|
}
|
|
4120
4351
|
setIsConnectSelectionConfirmed(true);
|
|
4121
4352
|
},
|
|
4353
|
+
onSelectTransferCrypto: dappAddress ? () => {
|
|
4354
|
+
handleSelectTransferCrypto();
|
|
4355
|
+
setIsConnectSelectionConfirmed(true);
|
|
4356
|
+
} : void 0,
|
|
4357
|
+
onRequestConnect,
|
|
4358
|
+
onConnect,
|
|
4359
|
+
onDisconnect,
|
|
4360
|
+
onSelectPolymarket: handleConnectPolymarket,
|
|
4122
4361
|
connectButtonLabel
|
|
4123
4362
|
}
|
|
4124
4363
|
) });
|
|
4125
4364
|
}
|
|
4126
4365
|
if (isDepositAddressMode) {
|
|
4127
4366
|
if (!dappAddress || !sessionKeyAddress) return null;
|
|
4128
|
-
return /* @__PURE__ */
|
|
4129
|
-
step.type === "setup" && /* @__PURE__ */
|
|
4367
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-modal-body", children: [
|
|
4368
|
+
step.type === "setup" && /* @__PURE__ */ jsx13(
|
|
4130
4369
|
SetupStep,
|
|
4131
4370
|
{
|
|
4132
4371
|
address: sessionKeyAddress,
|
|
@@ -4146,7 +4385,7 @@ function DepositFlow({
|
|
|
4146
4385
|
onError: handleError
|
|
4147
4386
|
}
|
|
4148
4387
|
),
|
|
4149
|
-
step.type === "deposit-address" && /* @__PURE__ */
|
|
4388
|
+
step.type === "deposit-address" && /* @__PURE__ */ jsx13(
|
|
4150
4389
|
DepositAddressStep,
|
|
4151
4390
|
{
|
|
4152
4391
|
smartAccount: step.smartAccount,
|
|
@@ -4182,8 +4421,8 @@ function DepositFlow({
|
|
|
4182
4421
|
if (!sessionKeyAddress) return null;
|
|
4183
4422
|
const solanaAddr = reownWallet?.solanaAddress;
|
|
4184
4423
|
const solanaProvider = reownWallet?.solanaProvider;
|
|
4185
|
-
return /* @__PURE__ */
|
|
4186
|
-
step.type === "setup" && /* @__PURE__ */
|
|
4424
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-modal-body", children: [
|
|
4425
|
+
step.type === "setup" && /* @__PURE__ */ jsx13(
|
|
4187
4426
|
SetupStep,
|
|
4188
4427
|
{
|
|
4189
4428
|
address: sessionKeyAddress,
|
|
@@ -4203,7 +4442,7 @@ function DepositFlow({
|
|
|
4203
4442
|
onError: handleError
|
|
4204
4443
|
}
|
|
4205
4444
|
),
|
|
4206
|
-
step.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
4445
|
+
step.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx13(
|
|
4207
4446
|
SolanaTokenSelectStep,
|
|
4208
4447
|
{
|
|
4209
4448
|
solanaAddress: solanaAddr,
|
|
@@ -4213,7 +4452,7 @@ function DepositFlow({
|
|
|
4213
4452
|
debug
|
|
4214
4453
|
}
|
|
4215
4454
|
),
|
|
4216
|
-
step.type === "solana-amount" && /* @__PURE__ */
|
|
4455
|
+
step.type === "solana-amount" && /* @__PURE__ */ jsx13(
|
|
4217
4456
|
SolanaAmountStep,
|
|
4218
4457
|
{
|
|
4219
4458
|
token: step.token,
|
|
@@ -4225,7 +4464,7 @@ function DepositFlow({
|
|
|
4225
4464
|
debug
|
|
4226
4465
|
}
|
|
4227
4466
|
),
|
|
4228
|
-
step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
4467
|
+
step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx13(
|
|
4229
4468
|
SolanaConfirmStep,
|
|
4230
4469
|
{
|
|
4231
4470
|
smartAccount: step.smartAccount,
|
|
@@ -4244,16 +4483,16 @@ function DepositFlow({
|
|
|
4244
4483
|
onError: handleError,
|
|
4245
4484
|
debug
|
|
4246
4485
|
}
|
|
4247
|
-
) : step.type === "solana-confirm" ? /* @__PURE__ */
|
|
4248
|
-
/* @__PURE__ */
|
|
4249
|
-
/* @__PURE__ */
|
|
4486
|
+
) : step.type === "solana-confirm" ? /* @__PURE__ */ jsxs12("div", { className: "rs-step", children: [
|
|
4487
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-loading-state", children: [
|
|
4488
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx13(
|
|
4250
4489
|
"svg",
|
|
4251
4490
|
{
|
|
4252
4491
|
viewBox: "0 0 24 24",
|
|
4253
4492
|
fill: "none",
|
|
4254
4493
|
stroke: "currentColor",
|
|
4255
4494
|
strokeWidth: "2",
|
|
4256
|
-
children: /* @__PURE__ */
|
|
4495
|
+
children: /* @__PURE__ */ jsx13(
|
|
4257
4496
|
"path",
|
|
4258
4497
|
{
|
|
4259
4498
|
strokeLinecap: "round",
|
|
@@ -4263,22 +4502,22 @@ function DepositFlow({
|
|
|
4263
4502
|
)
|
|
4264
4503
|
}
|
|
4265
4504
|
) }),
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
/* @__PURE__ */
|
|
4268
|
-
/* @__PURE__ */
|
|
4505
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-loading-text", children: [
|
|
4506
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
|
|
4507
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
|
|
4269
4508
|
] })
|
|
4270
4509
|
] }),
|
|
4271
|
-
/* @__PURE__ */
|
|
4510
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx13(
|
|
4272
4511
|
"button",
|
|
4273
4512
|
{
|
|
4274
4513
|
type: "button",
|
|
4275
4514
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
4276
4515
|
onClick: handleBackFromSolanaConfirm,
|
|
4277
|
-
children: /* @__PURE__ */
|
|
4516
|
+
children: /* @__PURE__ */ jsx13("span", { children: "Go Back" })
|
|
4278
4517
|
}
|
|
4279
4518
|
) })
|
|
4280
4519
|
] }) : null,
|
|
4281
|
-
step.type === "processing" && /* @__PURE__ */
|
|
4520
|
+
step.type === "processing" && /* @__PURE__ */ jsx13(
|
|
4282
4521
|
ProcessingStep,
|
|
4283
4522
|
{
|
|
4284
4523
|
smartAccount: step.smartAccount,
|
|
@@ -4306,7 +4545,7 @@ function DepositFlow({
|
|
|
4306
4545
|
] });
|
|
4307
4546
|
}
|
|
4308
4547
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
4309
|
-
return /* @__PURE__ */
|
|
4548
|
+
return /* @__PURE__ */ jsx13("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx13("div", { className: "rs-step", children: /* @__PURE__ */ jsx13("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx13("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx13("div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
|
|
4310
4549
|
}
|
|
4311
4550
|
const ownerAddress = signerContext.ownerAddress;
|
|
4312
4551
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? targetChain;
|
|
@@ -4316,8 +4555,9 @@ function DepositFlow({
|
|
|
4316
4555
|
}
|
|
4317
4556
|
return getPublicClient(chainId);
|
|
4318
4557
|
};
|
|
4319
|
-
|
|
4320
|
-
|
|
4558
|
+
const confirmPolymarketAsset = step.type === "confirm" && isPolymarketAsset(step.asset) ? step.asset : null;
|
|
4559
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-modal-body", children: [
|
|
4560
|
+
step.type === "setup" && /* @__PURE__ */ jsx13(
|
|
4321
4561
|
SetupStep,
|
|
4322
4562
|
{
|
|
4323
4563
|
walletClient: signerContext.walletClient,
|
|
@@ -4338,7 +4578,7 @@ function DepositFlow({
|
|
|
4338
4578
|
onError: handleError
|
|
4339
4579
|
}
|
|
4340
4580
|
),
|
|
4341
|
-
step.type === "select-asset" && /* @__PURE__ */
|
|
4581
|
+
step.type === "select-asset" && /* @__PURE__ */ jsx13(
|
|
4342
4582
|
AssetSelectStep,
|
|
4343
4583
|
{
|
|
4344
4584
|
address: ownerAddress,
|
|
@@ -4356,12 +4596,23 @@ function DepositFlow({
|
|
|
4356
4596
|
} : void 0
|
|
4357
4597
|
}
|
|
4358
4598
|
),
|
|
4359
|
-
step.type === "
|
|
4599
|
+
step.type === "polymarket-source" && /* @__PURE__ */ jsx13(
|
|
4600
|
+
PolymarketMigrationStep,
|
|
4601
|
+
{
|
|
4602
|
+
safeAddress: polymarketBalances?.safeAddress ?? null,
|
|
4603
|
+
assets: polymarketBalances?.assets ?? [],
|
|
4604
|
+
loading: isPolymarketLoading,
|
|
4605
|
+
error: polymarketError,
|
|
4606
|
+
onContinue: handlePolymarketAssetContinue
|
|
4607
|
+
}
|
|
4608
|
+
),
|
|
4609
|
+
step.type === "amount" && /* @__PURE__ */ jsx13(
|
|
4360
4610
|
AmountStep,
|
|
4361
4611
|
{
|
|
4362
4612
|
walletClient: signerContext.walletClient,
|
|
4363
4613
|
publicClient: getReadClientForChain(step.asset.chainId),
|
|
4364
4614
|
address: ownerAddress,
|
|
4615
|
+
balanceAddress: step.asset.balanceAddress,
|
|
4365
4616
|
asset: step.asset,
|
|
4366
4617
|
defaultAmount: step.amount ?? defaultAmount,
|
|
4367
4618
|
switchChain: signerContext.switchChain,
|
|
@@ -4382,7 +4633,7 @@ function DepositFlow({
|
|
|
4382
4633
|
}
|
|
4383
4634
|
}
|
|
4384
4635
|
),
|
|
4385
|
-
step.type === "confirm" && /* @__PURE__ */
|
|
4636
|
+
step.type === "confirm" && /* @__PURE__ */ jsx13(
|
|
4386
4637
|
ConfirmStep,
|
|
4387
4638
|
{
|
|
4388
4639
|
walletClient: signerContext.walletClient,
|
|
@@ -4398,12 +4649,31 @@ function DepositFlow({
|
|
|
4398
4649
|
targetToken,
|
|
4399
4650
|
switchChain: signerContext.switchChain,
|
|
4400
4651
|
liquidityWarning: step.liquidityWarning,
|
|
4652
|
+
onExecuteTransfer: confirmPolymarketAsset ? async (amountUnits) => {
|
|
4653
|
+
const result = await executePolymarketSafeTransfer({
|
|
4654
|
+
walletClient: signerContext.walletClient,
|
|
4655
|
+
publicClient: getReadClientForChain(
|
|
4656
|
+
POLYMARKET_POLYGON_CHAIN_ID
|
|
4657
|
+
),
|
|
4658
|
+
safeAddress: confirmPolymarketAsset.polymarketSafeAddress,
|
|
4659
|
+
recipient: step.smartAccount,
|
|
4660
|
+
amount: amountUnits,
|
|
4661
|
+
tokenKind: confirmPolymarketAsset.polymarketTokenKind
|
|
4662
|
+
});
|
|
4663
|
+
return {
|
|
4664
|
+
txHash: result.txHash,
|
|
4665
|
+
sourceToken: result.sourceToken,
|
|
4666
|
+
sourceSymbol: result.sourceSymbol,
|
|
4667
|
+
sourceDecimals: 6,
|
|
4668
|
+
directTransfer: false
|
|
4669
|
+
};
|
|
4670
|
+
} : void 0,
|
|
4401
4671
|
onConfirm: handleDepositSubmitted,
|
|
4402
4672
|
onDepositSubmitted: handleDepositSubmittedCallback,
|
|
4403
4673
|
onError: handleError
|
|
4404
4674
|
}
|
|
4405
4675
|
),
|
|
4406
|
-
step.type === "processing" && /* @__PURE__ */
|
|
4676
|
+
step.type === "processing" && /* @__PURE__ */ jsx13(
|
|
4407
4677
|
ProcessingStep,
|
|
4408
4678
|
{
|
|
4409
4679
|
smartAccount: step.smartAccount,
|
|
@@ -4433,7 +4703,7 @@ function DepositFlow({
|
|
|
4433
4703
|
|
|
4434
4704
|
// src/components/history/DepositHistoryPanel.tsx
|
|
4435
4705
|
import { useCallback as useCallback6 } from "react";
|
|
4436
|
-
import { Fragment as Fragment2, jsx as
|
|
4706
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4437
4707
|
function shortenHash(hash) {
|
|
4438
4708
|
if (hash.length <= 14) return hash;
|
|
4439
4709
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
@@ -4541,7 +4811,7 @@ var STATUS_LABEL = {
|
|
|
4541
4811
|
spam: "Spam token"
|
|
4542
4812
|
};
|
|
4543
4813
|
function ExternalLinkIcon() {
|
|
4544
|
-
return /* @__PURE__ */
|
|
4814
|
+
return /* @__PURE__ */ jsx14("svg", { className: "rs-history-ext-icon", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 1.5H2.25A.75.75 0 0 0 1.5 2.25v7.5c0 .414.336.75.75.75h7.5a.75.75 0 0 0 .75-.75V7.5m-3-6h3m0 0v3m0-3L6 6" }) });
|
|
4545
4815
|
}
|
|
4546
4816
|
function DepositHistoryPanel({
|
|
4547
4817
|
deposits,
|
|
@@ -4561,7 +4831,7 @@ function DepositHistoryPanel({
|
|
|
4561
4831
|
},
|
|
4562
4832
|
[onClose]
|
|
4563
4833
|
);
|
|
4564
|
-
return /* @__PURE__ */
|
|
4834
|
+
return /* @__PURE__ */ jsxs13(
|
|
4565
4835
|
"div",
|
|
4566
4836
|
{
|
|
4567
4837
|
className: "rs-history-panel",
|
|
@@ -4569,40 +4839,40 @@ function DepositHistoryPanel({
|
|
|
4569
4839
|
"aria-label": "Deposit history",
|
|
4570
4840
|
onKeyDown: handleKeyDown,
|
|
4571
4841
|
children: [
|
|
4572
|
-
/* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
4842
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-history-header", children: [
|
|
4843
|
+
/* @__PURE__ */ jsx14(
|
|
4574
4844
|
"button",
|
|
4575
4845
|
{
|
|
4576
4846
|
type: "button",
|
|
4577
4847
|
className: "rs-history-back",
|
|
4578
4848
|
"aria-label": "Close history",
|
|
4579
4849
|
onClick: onClose,
|
|
4580
|
-
children: /* @__PURE__ */
|
|
4850
|
+
children: /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5L8.25 12l7.5-7.5" }) })
|
|
4581
4851
|
}
|
|
4582
4852
|
),
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-header-title", children: "History" }),
|
|
4854
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-history-header-spacer" })
|
|
4585
4855
|
] }),
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
4588
|
-
/* @__PURE__ */
|
|
4589
|
-
/* @__PURE__ */
|
|
4856
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-history-body", children: [
|
|
4857
|
+
isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs13("div", { className: "rs-history-state", children: [
|
|
4858
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-history-spinner", children: /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx14("path", { d: "M12 2v4m0 12v4m-7.07-3.93l2.83-2.83m8.48-8.48l2.83-2.83M2 12h4m12 0h4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83", strokeLinecap: "round" }) }) }),
|
|
4859
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-state-text", children: "Loading history..." })
|
|
4590
4860
|
] }),
|
|
4591
|
-
error && !isLoading && /* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4593
|
-
/* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4861
|
+
error && !isLoading && /* @__PURE__ */ jsxs13("div", { className: "rs-history-state", children: [
|
|
4862
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-history-state-icon rs-history-state-icon--error", children: /* @__PURE__ */ jsxs13("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
4863
|
+
/* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "10" }),
|
|
4864
|
+
/* @__PURE__ */ jsx14("path", { strokeLinecap: "round", d: "M12 8v4m0 4h.01" })
|
|
4595
4865
|
] }) }),
|
|
4596
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-state-text", children: error })
|
|
4597
4867
|
] }),
|
|
4598
|
-
!isLoading && !error && deposits.length === 0 && /* @__PURE__ */
|
|
4599
|
-
/* @__PURE__ */
|
|
4600
|
-
/* @__PURE__ */
|
|
4601
|
-
/* @__PURE__ */
|
|
4868
|
+
!isLoading && !error && deposits.length === 0 && /* @__PURE__ */ jsxs13("div", { className: "rs-history-state", children: [
|
|
4869
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-history-state-icon", children: /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" }) }) }),
|
|
4870
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-state-text", children: "No deposits yet" }),
|
|
4871
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-state-hint", children: "Your deposit history will appear here" })
|
|
4602
4872
|
] }),
|
|
4603
|
-
deposits.length > 0 && /* @__PURE__ */
|
|
4604
|
-
deposits.map((deposit, i) => /* @__PURE__ */
|
|
4605
|
-
hasMore && /* @__PURE__ */
|
|
4873
|
+
deposits.length > 0 && /* @__PURE__ */ jsxs13("div", { className: "rs-history-list", children: [
|
|
4874
|
+
deposits.map((deposit, i) => /* @__PURE__ */ jsx14(HistoryRow, { deposit }, deposit.txHash || i)),
|
|
4875
|
+
hasMore && /* @__PURE__ */ jsx14(
|
|
4606
4876
|
"button",
|
|
4607
4877
|
{
|
|
4608
4878
|
type: "button",
|
|
@@ -4633,38 +4903,38 @@ function HistoryRow({ deposit }) {
|
|
|
4633
4903
|
const timestamp = deposit.createdAt ? formatTimestamp2(deposit.createdAt) : null;
|
|
4634
4904
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
4635
4905
|
const dstTxUrl = deposit.destinationTxHash ? getTxExplorerUrl(deposit.destinationTxHash, targetChainId) : null;
|
|
4636
|
-
return /* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4638
|
-
/* @__PURE__ */
|
|
4639
|
-
/* @__PURE__ */
|
|
4640
|
-
sourceChainIcon && /* @__PURE__ */
|
|
4641
|
-
/* @__PURE__ */
|
|
4906
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-history-row", children: [
|
|
4907
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-history-row-primary", children: [
|
|
4908
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-history-route", children: [
|
|
4909
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-history-chain", children: [
|
|
4910
|
+
sourceChainIcon && /* @__PURE__ */ jsx14("img", { src: sourceChainIcon, alt: "", className: "rs-history-chain-icon" }),
|
|
4911
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-chain-name", children: sourceChainName ?? "Unknown" })
|
|
4642
4912
|
] }),
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
4645
|
-
targetChainIcon && /* @__PURE__ */
|
|
4646
|
-
/* @__PURE__ */
|
|
4913
|
+
/* @__PURE__ */ jsx14("svg", { className: "rs-history-route-arrow", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2.5 6h7m0 0L7 3.5M9.5 6 7 8.5" }) }),
|
|
4914
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-history-chain", children: [
|
|
4915
|
+
targetChainIcon && /* @__PURE__ */ jsx14("img", { src: targetChainIcon, alt: "", className: "rs-history-chain-icon" }),
|
|
4916
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-chain-name", children: targetChainName ?? "Unknown" })
|
|
4647
4917
|
] })
|
|
4648
4918
|
] }),
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsxs13("span", { className: `rs-history-status rs-history-status--${status}`, children: [
|
|
4920
|
+
/* @__PURE__ */ jsx14("span", { className: `rs-history-dot rs-history-dot--${status}` }),
|
|
4651
4921
|
STATUS_LABEL[status]
|
|
4652
4922
|
] })
|
|
4653
4923
|
] }),
|
|
4654
|
-
/* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4924
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-history-row-secondary", children: [
|
|
4925
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-amount", children: formattedAmount ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
4656
4926
|
formattedAmount,
|
|
4657
4927
|
" ",
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
targetSymbol && sourceSymbol !== targetSymbol && /* @__PURE__ */
|
|
4928
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-token", children: sourceSymbol }),
|
|
4929
|
+
targetSymbol && sourceSymbol !== targetSymbol && /* @__PURE__ */ jsxs13("span", { className: "rs-history-token-target", children: [
|
|
4660
4930
|
" \u2192 ",
|
|
4661
4931
|
targetSymbol
|
|
4662
4932
|
] })
|
|
4663
|
-
] }) : /* @__PURE__ */
|
|
4664
|
-
timestamp && /* @__PURE__ */
|
|
4933
|
+
] }) : /* @__PURE__ */ jsx14("span", { className: "rs-history-no-amount", children: "\u2014" }) }),
|
|
4934
|
+
timestamp && /* @__PURE__ */ jsx14("span", { className: "rs-history-time", children: timestamp })
|
|
4665
4935
|
] }),
|
|
4666
|
-
(srcTxUrl || dstTxUrl) && /* @__PURE__ */
|
|
4667
|
-
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */
|
|
4936
|
+
(srcTxUrl || dstTxUrl) && /* @__PURE__ */ jsxs13("div", { className: "rs-history-row-links", children: [
|
|
4937
|
+
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs13(
|
|
4668
4938
|
"a",
|
|
4669
4939
|
{
|
|
4670
4940
|
href: srcTxUrl,
|
|
@@ -4673,12 +4943,12 @@ function HistoryRow({ deposit }) {
|
|
|
4673
4943
|
className: "rs-history-tx-link",
|
|
4674
4944
|
title: deposit.sourceTxHash,
|
|
4675
4945
|
children: [
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-tx-hash", children: shortenHash(deposit.sourceTxHash) }),
|
|
4947
|
+
/* @__PURE__ */ jsx14(ExternalLinkIcon, {})
|
|
4678
4948
|
]
|
|
4679
4949
|
}
|
|
4680
4950
|
),
|
|
4681
|
-
dstTxUrl && deposit.destinationTxHash && /* @__PURE__ */
|
|
4951
|
+
dstTxUrl && deposit.destinationTxHash && /* @__PURE__ */ jsxs13(
|
|
4682
4952
|
"a",
|
|
4683
4953
|
{
|
|
4684
4954
|
href: dstTxUrl,
|
|
@@ -4687,8 +4957,8 @@ function HistoryRow({ deposit }) {
|
|
|
4687
4957
|
className: "rs-history-tx-link",
|
|
4688
4958
|
title: deposit.destinationTxHash,
|
|
4689
4959
|
children: [
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
/* @__PURE__ */
|
|
4960
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-history-tx-hash", children: shortenHash(deposit.destinationTxHash) }),
|
|
4961
|
+
/* @__PURE__ */ jsx14(ExternalLinkIcon, {})
|
|
4692
4962
|
]
|
|
4693
4963
|
}
|
|
4694
4964
|
)
|
|
@@ -4698,9 +4968,9 @@ function HistoryRow({ deposit }) {
|
|
|
4698
4968
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
4699
4969
|
|
|
4700
4970
|
// src/DepositModal.tsx
|
|
4701
|
-
import { jsx as
|
|
4971
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4702
4972
|
var ReownDepositInner = lazy(
|
|
4703
|
-
() => import("./DepositModalReown-
|
|
4973
|
+
() => import("./DepositModalReown-GIODYNOK.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
4704
4974
|
);
|
|
4705
4975
|
function sortByCreatedAtDesc(items) {
|
|
4706
4976
|
return [...items].sort((a, b) => {
|
|
@@ -4716,7 +4986,7 @@ function DepositModal(props) {
|
|
|
4716
4986
|
"dappWalletClient"
|
|
4717
4987
|
);
|
|
4718
4988
|
if (needsReown) {
|
|
4719
|
-
return /* @__PURE__ */
|
|
4989
|
+
return /* @__PURE__ */ jsx15(Suspense, { fallback: null, children: /* @__PURE__ */ jsx15(
|
|
4720
4990
|
ReownDepositInner,
|
|
4721
4991
|
{
|
|
4722
4992
|
...props,
|
|
@@ -4724,7 +4994,7 @@ function DepositModal(props) {
|
|
|
4724
4994
|
}
|
|
4725
4995
|
) });
|
|
4726
4996
|
}
|
|
4727
|
-
return /* @__PURE__ */
|
|
4997
|
+
return /* @__PURE__ */ jsx15(
|
|
4728
4998
|
DepositModalInner,
|
|
4729
4999
|
{
|
|
4730
5000
|
...props,
|
|
@@ -4755,6 +5025,7 @@ function DepositModalInner({
|
|
|
4755
5025
|
forceRegister = false,
|
|
4756
5026
|
waitForFinalTx = true,
|
|
4757
5027
|
enableSolana = true,
|
|
5028
|
+
enablePolymarketMigration = false,
|
|
4758
5029
|
postBridgeActions,
|
|
4759
5030
|
outputTokenRules,
|
|
4760
5031
|
rejectUnmapped,
|
|
@@ -4779,20 +5050,20 @@ function DepositModalInner({
|
|
|
4779
5050
|
}) {
|
|
4780
5051
|
const modalRef = useRef8(null);
|
|
4781
5052
|
const onReadyRef = useLatestRef(onReady);
|
|
4782
|
-
const [currentStepIndex, setCurrentStepIndex] =
|
|
4783
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
5053
|
+
const [currentStepIndex, setCurrentStepIndex] = useState13(0);
|
|
5054
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = useState13(null);
|
|
4784
5055
|
const backHandlerRef = useRef8(void 0);
|
|
4785
5056
|
const showHistoryButton = uiConfig?.showHistoryButton ?? false;
|
|
4786
|
-
const [activeEvmAccount, setActiveEvmAccount] =
|
|
4787
|
-
const [activeSolanaAccount, setActiveSolanaAccount] =
|
|
5057
|
+
const [activeEvmAccount, setActiveEvmAccount] = useState13(null);
|
|
5058
|
+
const [activeSolanaAccount, setActiveSolanaAccount] = useState13(
|
|
4788
5059
|
null
|
|
4789
5060
|
);
|
|
4790
|
-
const [historyOpen, setHistoryOpen] =
|
|
4791
|
-
const [historyDeposits, setHistoryDeposits] =
|
|
4792
|
-
const [hasMoreHistory, setHasMoreHistory] =
|
|
4793
|
-
const [historyLoading, setHistoryLoading] =
|
|
4794
|
-
const [historyLoadingMore, setHistoryLoadingMore] =
|
|
4795
|
-
const [historyError, setHistoryError] =
|
|
5061
|
+
const [historyOpen, setHistoryOpen] = useState13(false);
|
|
5062
|
+
const [historyDeposits, setHistoryDeposits] = useState13([]);
|
|
5063
|
+
const [hasMoreHistory, setHasMoreHistory] = useState13(false);
|
|
5064
|
+
const [historyLoading, setHistoryLoading] = useState13(false);
|
|
5065
|
+
const [historyLoadingMore, setHistoryLoadingMore] = useState13(false);
|
|
5066
|
+
const [historyError, setHistoryError] = useState13(null);
|
|
4796
5067
|
const evmCursorRef = useRef8(null);
|
|
4797
5068
|
const solanaCursorRef = useRef8(null);
|
|
4798
5069
|
const historyStaleRef = useRef8(false);
|
|
@@ -4806,20 +5077,20 @@ function DepositModalInner({
|
|
|
4806
5077
|
}),
|
|
4807
5078
|
[backendUrl, debug]
|
|
4808
5079
|
);
|
|
4809
|
-
|
|
5080
|
+
useEffect12(() => {
|
|
4810
5081
|
if (isOpen && modalRef.current) {
|
|
4811
5082
|
applyTheme(modalRef.current, theme);
|
|
4812
5083
|
}
|
|
4813
5084
|
}, [isOpen, theme]);
|
|
4814
|
-
|
|
5085
|
+
useEffect12(() => {
|
|
4815
5086
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
4816
5087
|
}, [solanaRpcUrl]);
|
|
4817
|
-
|
|
5088
|
+
useEffect12(() => {
|
|
4818
5089
|
if (isOpen) {
|
|
4819
5090
|
onReadyRef.current?.();
|
|
4820
5091
|
}
|
|
4821
5092
|
}, [isOpen, onReadyRef]);
|
|
4822
|
-
|
|
5093
|
+
useEffect12(() => {
|
|
4823
5094
|
if (!isOpen) {
|
|
4824
5095
|
setCurrentStepIndex(0);
|
|
4825
5096
|
}
|
|
@@ -4964,7 +5235,7 @@ function DepositModalInner({
|
|
|
4964
5235
|
},
|
|
4965
5236
|
[onDepositFailedRef, showHistoryButton, markHistoryStale]
|
|
4966
5237
|
);
|
|
4967
|
-
|
|
5238
|
+
useEffect12(() => {
|
|
4968
5239
|
if (!isOpen) {
|
|
4969
5240
|
setHistoryOpen(false);
|
|
4970
5241
|
setHistoryDeposits([]);
|
|
@@ -4985,7 +5256,7 @@ function DepositModalInner({
|
|
|
4985
5256
|
const logoUrl = branding?.logoUrl ?? "https://github.com/rhinestonewtf.png";
|
|
4986
5257
|
const title = branding?.title ?? "Deposit";
|
|
4987
5258
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4988
|
-
return /* @__PURE__ */
|
|
5259
|
+
return /* @__PURE__ */ jsx15(
|
|
4989
5260
|
Modal,
|
|
4990
5261
|
{
|
|
4991
5262
|
isOpen,
|
|
@@ -4993,23 +5264,23 @@ function DepositModalInner({
|
|
|
4993
5264
|
className,
|
|
4994
5265
|
inline,
|
|
4995
5266
|
closeOnOverlayClick,
|
|
4996
|
-
children: /* @__PURE__ */
|
|
4997
|
-
/* @__PURE__ */
|
|
4998
|
-
/* @__PURE__ */
|
|
5267
|
+
children: /* @__PURE__ */ jsxs14("div", { ref: modalRef, className: "rs-modal", children: [
|
|
5268
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header--redesigned", children: [
|
|
5269
|
+
/* @__PURE__ */ jsx15("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx15(
|
|
4999
5270
|
"button",
|
|
5000
5271
|
{
|
|
5001
5272
|
type: "button",
|
|
5002
5273
|
className: "rs-modal-header-back",
|
|
5003
5274
|
"aria-label": "Go back",
|
|
5004
5275
|
onClick: handleBack,
|
|
5005
|
-
children: /* @__PURE__ */
|
|
5276
|
+
children: /* @__PURE__ */ jsx15(
|
|
5006
5277
|
"svg",
|
|
5007
5278
|
{
|
|
5008
5279
|
viewBox: "0 0 24 24",
|
|
5009
5280
|
fill: "none",
|
|
5010
5281
|
stroke: "currentColor",
|
|
5011
5282
|
strokeWidth: "2",
|
|
5012
|
-
children: /* @__PURE__ */
|
|
5283
|
+
children: /* @__PURE__ */ jsx15(
|
|
5013
5284
|
"path",
|
|
5014
5285
|
{
|
|
5015
5286
|
strokeLinecap: "round",
|
|
@@ -5021,9 +5292,9 @@ function DepositModalInner({
|
|
|
5021
5292
|
)
|
|
5022
5293
|
}
|
|
5023
5294
|
) }),
|
|
5024
|
-
/* @__PURE__ */
|
|
5025
|
-
/* @__PURE__ */
|
|
5026
|
-
showLogo && logoUrl && /* @__PURE__ */
|
|
5295
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-nav-center", children: [
|
|
5296
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-title-row", children: [
|
|
5297
|
+
showLogo && logoUrl && /* @__PURE__ */ jsx15(
|
|
5027
5298
|
"img",
|
|
5028
5299
|
{
|
|
5029
5300
|
src: logoUrl,
|
|
@@ -5034,20 +5305,20 @@ function DepositModalInner({
|
|
|
5034
5305
|
}
|
|
5035
5306
|
}
|
|
5036
5307
|
),
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
showStepper && currentStepIndex >= 2 && /* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5308
|
+
/* @__PURE__ */ jsx15("span", { className: "rs-modal-header-title", children: title }),
|
|
5309
|
+
showStepper && currentStepIndex >= 2 && /* @__PURE__ */ jsxs14("div", { className: "rs-step-indicator", style: { marginLeft: 8 }, children: [
|
|
5310
|
+
/* @__PURE__ */ jsx15(
|
|
5040
5311
|
"div",
|
|
5041
5312
|
{
|
|
5042
5313
|
className: `rs-step-indicator-node ${currentStepIndex >= 4 ? "rs-step-indicator-node--complete" : "rs-step-indicator-node--active"}`,
|
|
5043
|
-
children: currentStepIndex >= 4 ? /* @__PURE__ */
|
|
5314
|
+
children: currentStepIndex >= 4 ? /* @__PURE__ */ jsx15(
|
|
5044
5315
|
"svg",
|
|
5045
5316
|
{
|
|
5046
5317
|
viewBox: "0 0 24 24",
|
|
5047
5318
|
fill: "none",
|
|
5048
5319
|
stroke: "currentColor",
|
|
5049
5320
|
strokeWidth: "3",
|
|
5050
|
-
children: /* @__PURE__ */
|
|
5321
|
+
children: /* @__PURE__ */ jsx15(
|
|
5051
5322
|
"path",
|
|
5052
5323
|
{
|
|
5053
5324
|
strokeLinecap: "round",
|
|
@@ -5059,13 +5330,13 @@ function DepositModalInner({
|
|
|
5059
5330
|
) : "1"
|
|
5060
5331
|
}
|
|
5061
5332
|
),
|
|
5062
|
-
/* @__PURE__ */
|
|
5333
|
+
/* @__PURE__ */ jsx15(
|
|
5063
5334
|
"div",
|
|
5064
5335
|
{
|
|
5065
5336
|
className: `rs-step-indicator-line ${currentStepIndex >= 4 ? "rs-step-indicator-line--active" : ""}`
|
|
5066
5337
|
}
|
|
5067
5338
|
),
|
|
5068
|
-
/* @__PURE__ */
|
|
5339
|
+
/* @__PURE__ */ jsx15(
|
|
5069
5340
|
"div",
|
|
5070
5341
|
{
|
|
5071
5342
|
className: `rs-step-indicator-node ${currentStepIndex >= 4 ? "rs-step-indicator-node--active" : "rs-step-indicator-node--inactive"}`,
|
|
@@ -5074,16 +5345,16 @@ function DepositModalInner({
|
|
|
5074
5345
|
)
|
|
5075
5346
|
] })
|
|
5076
5347
|
] }),
|
|
5077
|
-
balance && /* @__PURE__ */
|
|
5078
|
-
/* @__PURE__ */
|
|
5348
|
+
balance && /* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-balance", children: [
|
|
5349
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
5079
5350
|
balance.title,
|
|
5080
5351
|
":"
|
|
5081
5352
|
] }),
|
|
5082
|
-
/* @__PURE__ */
|
|
5353
|
+
/* @__PURE__ */ jsx15("span", { className: "rs-modal-header-balance-value", children: balance.amount ?? (totalBalanceUsd !== null ? currencyFormatter.format(totalBalanceUsd) : null) })
|
|
5083
5354
|
] })
|
|
5084
5355
|
] }),
|
|
5085
|
-
/* @__PURE__ */
|
|
5086
|
-
showHistoryButton && /* @__PURE__ */
|
|
5356
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-nav-right", children: [
|
|
5357
|
+
showHistoryButton && /* @__PURE__ */ jsx15(
|
|
5087
5358
|
"button",
|
|
5088
5359
|
{
|
|
5089
5360
|
type: "button",
|
|
@@ -5091,14 +5362,14 @@ function DepositModalInner({
|
|
|
5091
5362
|
"aria-label": "Deposit history",
|
|
5092
5363
|
onClick: handleHistoryOpen,
|
|
5093
5364
|
disabled: !activeEvmAccount && !activeSolanaAccount,
|
|
5094
|
-
children: /* @__PURE__ */
|
|
5365
|
+
children: /* @__PURE__ */ jsx15(
|
|
5095
5366
|
"svg",
|
|
5096
5367
|
{
|
|
5097
5368
|
viewBox: "0 0 24 24",
|
|
5098
5369
|
fill: "none",
|
|
5099
5370
|
stroke: "currentColor",
|
|
5100
5371
|
strokeWidth: "1.75",
|
|
5101
|
-
children: /* @__PURE__ */
|
|
5372
|
+
children: /* @__PURE__ */ jsx15(
|
|
5102
5373
|
"path",
|
|
5103
5374
|
{
|
|
5104
5375
|
strokeLinecap: "round",
|
|
@@ -5110,21 +5381,21 @@ function DepositModalInner({
|
|
|
5110
5381
|
)
|
|
5111
5382
|
}
|
|
5112
5383
|
),
|
|
5113
|
-
/* @__PURE__ */
|
|
5384
|
+
/* @__PURE__ */ jsx15(
|
|
5114
5385
|
"button",
|
|
5115
5386
|
{
|
|
5116
5387
|
type: "button",
|
|
5117
5388
|
onClick: onClose,
|
|
5118
5389
|
className: "rs-modal-close",
|
|
5119
5390
|
"aria-label": "Close",
|
|
5120
|
-
children: /* @__PURE__ */
|
|
5391
|
+
children: /* @__PURE__ */ jsx15(
|
|
5121
5392
|
"svg",
|
|
5122
5393
|
{
|
|
5123
5394
|
viewBox: "0 0 24 24",
|
|
5124
5395
|
fill: "none",
|
|
5125
5396
|
stroke: "currentColor",
|
|
5126
5397
|
strokeWidth: "2",
|
|
5127
|
-
children: /* @__PURE__ */
|
|
5398
|
+
children: /* @__PURE__ */ jsx15(
|
|
5128
5399
|
"path",
|
|
5129
5400
|
{
|
|
5130
5401
|
strokeLinecap: "round",
|
|
@@ -5138,7 +5409,7 @@ function DepositModalInner({
|
|
|
5138
5409
|
)
|
|
5139
5410
|
] })
|
|
5140
5411
|
] }),
|
|
5141
|
-
/* @__PURE__ */
|
|
5412
|
+
/* @__PURE__ */ jsx15(
|
|
5142
5413
|
DepositFlow,
|
|
5143
5414
|
{
|
|
5144
5415
|
dappWalletClient,
|
|
@@ -5160,6 +5431,7 @@ function DepositModalInner({
|
|
|
5160
5431
|
forceRegister,
|
|
5161
5432
|
waitForFinalTx,
|
|
5162
5433
|
enableSolana,
|
|
5434
|
+
enablePolymarketMigration,
|
|
5163
5435
|
reownWallet,
|
|
5164
5436
|
onConnect,
|
|
5165
5437
|
onDisconnect,
|
|
@@ -5180,7 +5452,7 @@ function DepositModalInner({
|
|
|
5180
5452
|
debug
|
|
5181
5453
|
}
|
|
5182
5454
|
),
|
|
5183
|
-
showHistoryButton && historyOpen && /* @__PURE__ */
|
|
5455
|
+
showHistoryButton && historyOpen && /* @__PURE__ */ jsx15(
|
|
5184
5456
|
DepositHistoryPanel,
|
|
5185
5457
|
{
|
|
5186
5458
|
deposits: historyDeposits,
|