@rhinestone/deposit-modal 0.0.0-dev-20260619105734 → 0.0.0-dev-20260619134244
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-KKN6NSW5.mjs → DepositModalReown-EXI7MW65.mjs} +1 -1
- package/dist/{DepositModalReown-57L66M4T.cjs → DepositModalReown-FMAPWBQM.cjs} +2 -2
- package/dist/{WithdrawModalReown-DMUAZJY2.cjs → WithdrawModalReown-CTT3EXMG.cjs} +2 -2
- package/dist/{WithdrawModalReown-XYBEGAOH.mjs → WithdrawModalReown-G7EM6HXO.mjs} +1 -1
- package/dist/{chunk-PURTNYRW.mjs → chunk-3GLQC2KQ.mjs} +55 -7
- package/dist/{chunk-4DGKZD56.cjs → chunk-BTDRUAPJ.cjs} +77 -120
- package/dist/{chunk-543J7MZT.cjs → chunk-JHT2MJ42.cjs} +55 -7
- package/dist/{chunk-75WJQYCX.mjs → chunk-RTAIW3WW.mjs} +1 -44
- package/dist/deposit.cjs +2 -2
- package/dist/deposit.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2 -2
- package/dist/withdraw.cjs +2 -2
- package/dist/withdraw.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBTDRUAPJcjs = require('./chunk-BTDRUAPJ.cjs');
|
|
4
4
|
require('./chunk-NRNJAQUA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ function DepositModalWithReown(props) {
|
|
|
37
37
|
reown.disconnect();
|
|
38
38
|
}, [reown.disconnect]);
|
|
39
39
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
40
|
-
|
|
40
|
+
_chunkBTDRUAPJcjs.DepositModalInner,
|
|
41
41
|
{
|
|
42
42
|
...props,
|
|
43
43
|
reownWallet: reownWithSolana,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJHT2MJ42cjs = require('./chunk-JHT2MJ42.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@ function WithdrawModalWithReown(props) {
|
|
|
21
21
|
reown.disconnect();
|
|
22
22
|
}, [reown.disconnect]);
|
|
23
23
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
24
|
-
|
|
24
|
+
_chunkJHT2MJ42cjs.WithdrawModalInner,
|
|
25
25
|
{
|
|
26
26
|
...props,
|
|
27
27
|
reownWallet: reown,
|
|
@@ -784,6 +784,7 @@ import { encodeFunctionData, erc20Abi as erc20Abi2, parseUnits as parseUnits2 }
|
|
|
784
784
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
785
785
|
var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
786
786
|
var REGISTRATION_DEBOUNCE_MS = 600;
|
|
787
|
+
var WITHDRAW_INDEXING_DELAY_MS = 2e3;
|
|
787
788
|
function resolveSessionOwner(eoaAddress) {
|
|
788
789
|
const localOwner = loadSessionOwnerFromStorage(eoaAddress);
|
|
789
790
|
if (localOwner) {
|
|
@@ -832,6 +833,14 @@ function WithdrawFlow({
|
|
|
832
833
|
const onEventRef = useLatestRef(onEvent);
|
|
833
834
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
834
835
|
const onErrorRef = useLatestRef(onError);
|
|
836
|
+
const isFlowActiveRef = useRef2(true);
|
|
837
|
+
const submitGenerationRef = useRef2(0);
|
|
838
|
+
useEffect2(() => {
|
|
839
|
+
isFlowActiveRef.current = true;
|
|
840
|
+
return () => {
|
|
841
|
+
isFlowActiveRef.current = false;
|
|
842
|
+
};
|
|
843
|
+
}, []);
|
|
835
844
|
const logFlow = useCallback2(
|
|
836
845
|
(message, data) => {
|
|
837
846
|
debugLog(debug, "withdraw-flow", message, data);
|
|
@@ -905,6 +914,7 @@ function WithdrawFlow({
|
|
|
905
914
|
const selectedWalletId = useWithdrawStore((s) => s.selectedWalletId);
|
|
906
915
|
const registration = useWithdrawStore((s) => s.registration);
|
|
907
916
|
const flowStep = useWithdrawStore((s) => s.step);
|
|
917
|
+
const reviewedRecipient = useWithdrawStore((s) => s.recipient);
|
|
908
918
|
const setSelectedWalletId = useCallback2(
|
|
909
919
|
(walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
|
|
910
920
|
[storeApi]
|
|
@@ -965,7 +975,7 @@ function WithdrawFlow({
|
|
|
965
975
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
966
976
|
}, [recipientInput]);
|
|
967
977
|
useEffect2(() => {
|
|
968
|
-
if (!ownerAddress) return;
|
|
978
|
+
if (!ownerAddress || !recipientForRegistration) return;
|
|
969
979
|
const desiredTarget = {
|
|
970
980
|
chain: targetChain,
|
|
971
981
|
token: targetToken,
|
|
@@ -1098,7 +1108,14 @@ function WithdrawFlow({
|
|
|
1098
1108
|
}, [sourceChain, sourceToken]);
|
|
1099
1109
|
const isSourceNative = sourceToken.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1100
1110
|
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1111
|
+
const reviewedTarget = reviewedRecipient ? {
|
|
1112
|
+
chain: targetChain,
|
|
1113
|
+
token: targetToken,
|
|
1114
|
+
recipient: reviewedRecipient
|
|
1115
|
+
} : null;
|
|
1116
|
+
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1101
1117
|
const reviewBackHandler = useCallback2(() => {
|
|
1118
|
+
submitGenerationRef.current += 1;
|
|
1102
1119
|
storeApi.dispatch({ type: "review/back" });
|
|
1103
1120
|
}, [storeApi]);
|
|
1104
1121
|
useEffect2(() => {
|
|
@@ -1173,19 +1190,38 @@ function WithdrawFlow({
|
|
|
1173
1190
|
const handleReviewConfirm = useCallback2(
|
|
1174
1191
|
async () => {
|
|
1175
1192
|
const state = storeApi.getState();
|
|
1176
|
-
if (state.registration.kind !== "ready") {
|
|
1177
|
-
throw new Error("Session not ready");
|
|
1178
|
-
}
|
|
1179
|
-
const smartAccount = state.registration.smartAccount;
|
|
1180
1193
|
const recipient = state.recipient;
|
|
1181
1194
|
const amountValue = state.amount;
|
|
1182
1195
|
if (!recipient || !amountValue) {
|
|
1183
1196
|
throw new Error("Missing recipient or amount");
|
|
1184
1197
|
}
|
|
1198
|
+
const desiredTarget = {
|
|
1199
|
+
chain: targetChain,
|
|
1200
|
+
token: targetToken,
|
|
1201
|
+
recipient
|
|
1202
|
+
};
|
|
1203
|
+
const getMatchingRegistration = () => {
|
|
1204
|
+
const current = storeApi.getState().registration;
|
|
1205
|
+
return current.kind === "ready" && targetsEqual(current.registeredTarget, desiredTarget) ? current : null;
|
|
1206
|
+
};
|
|
1207
|
+
const matchingRegistration = getMatchingRegistration();
|
|
1208
|
+
if (!matchingRegistration) {
|
|
1209
|
+
throw new Error("Withdrawal target is still being prepared");
|
|
1210
|
+
}
|
|
1211
|
+
const smartAccount = matchingRegistration.smartAccount;
|
|
1185
1212
|
if (!onSignTransaction && !signerContext?.walletClient) {
|
|
1186
1213
|
throw new Error("Wallet not connected");
|
|
1187
1214
|
}
|
|
1215
|
+
const submitGeneration = submitGenerationRef.current += 1;
|
|
1216
|
+
const isSubmissionLive = () => isFlowActiveRef.current && submitGenerationRef.current === submitGeneration;
|
|
1188
1217
|
try {
|
|
1218
|
+
await new Promise((resolve) => {
|
|
1219
|
+
setTimeout(resolve, WITHDRAW_INDEXING_DELAY_MS);
|
|
1220
|
+
});
|
|
1221
|
+
if (!isSubmissionLive()) return;
|
|
1222
|
+
if (!getMatchingRegistration()) {
|
|
1223
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1224
|
+
}
|
|
1189
1225
|
logFlow("submit:start", {
|
|
1190
1226
|
smartAccount,
|
|
1191
1227
|
recipient,
|
|
@@ -1217,7 +1253,12 @@ function WithdrawFlow({
|
|
|
1217
1253
|
data: transferData.data,
|
|
1218
1254
|
chainId: sourceChain
|
|
1219
1255
|
});
|
|
1256
|
+
if (!isSubmissionLive()) return;
|
|
1220
1257
|
const { signature } = await onSignTransaction(request);
|
|
1258
|
+
if (!isSubmissionLive()) return;
|
|
1259
|
+
if (!getMatchingRegistration()) {
|
|
1260
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1261
|
+
}
|
|
1221
1262
|
const relayResult = await service.relayWithdraw({
|
|
1222
1263
|
smartAccount,
|
|
1223
1264
|
chainId: toEvmCaip2(sourceChain),
|
|
@@ -1230,6 +1271,9 @@ function WithdrawFlow({
|
|
|
1230
1271
|
}
|
|
1231
1272
|
result = { txHash: relayResult.txHash };
|
|
1232
1273
|
} else if (isSourceNative) {
|
|
1274
|
+
if (!getMatchingRegistration()) {
|
|
1275
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1276
|
+
}
|
|
1233
1277
|
result = await executeSafeEthTransfer({
|
|
1234
1278
|
walletClient: signerContext.walletClient,
|
|
1235
1279
|
publicClient: pc,
|
|
@@ -1239,6 +1283,9 @@ function WithdrawFlow({
|
|
|
1239
1283
|
chainId: sourceChain
|
|
1240
1284
|
});
|
|
1241
1285
|
} else {
|
|
1286
|
+
if (!getMatchingRegistration()) {
|
|
1287
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1288
|
+
}
|
|
1242
1289
|
result = await executeSafeErc20Transfer({
|
|
1243
1290
|
walletClient: signerContext.walletClient,
|
|
1244
1291
|
publicClient: pc,
|
|
@@ -1249,6 +1296,7 @@ function WithdrawFlow({
|
|
|
1249
1296
|
chainId: sourceChain
|
|
1250
1297
|
});
|
|
1251
1298
|
}
|
|
1299
|
+
if (!isSubmissionLive()) return;
|
|
1252
1300
|
logFlow("withdraw:submitted", {
|
|
1253
1301
|
txHash: result.txHash,
|
|
1254
1302
|
smartAccount,
|
|
@@ -1467,7 +1515,7 @@ function WithdrawFlow({
|
|
|
1467
1515
|
amount: storeApi.getState().amount ?? "0",
|
|
1468
1516
|
recipient: storeApi.getState().recipient ?? recipientForRegistration ?? "0x0",
|
|
1469
1517
|
service,
|
|
1470
|
-
registrationPending: registration.kind === "pending" || registration.kind === "stale",
|
|
1518
|
+
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1471
1519
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1472
1520
|
onConfirm: handleReviewConfirm,
|
|
1473
1521
|
onError: handleError
|
|
@@ -1516,7 +1564,7 @@ function deriveStepView(step, _registration) {
|
|
|
1516
1564
|
// src/WithdrawModal.tsx
|
|
1517
1565
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1518
1566
|
var ReownWithdrawInner = lazy(
|
|
1519
|
-
() => import("./WithdrawModalReown-
|
|
1567
|
+
() => import("./WithdrawModalReown-G7EM6HXO.mjs").then((m) => ({
|
|
1520
1568
|
default: m.WithdrawModalReown
|
|
1521
1569
|
}))
|
|
1522
1570
|
);
|
|
@@ -5152,7 +5152,6 @@ function AccountPreparingSkeleton({
|
|
|
5152
5152
|
) })
|
|
5153
5153
|
] });
|
|
5154
5154
|
}
|
|
5155
|
-
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
5156
5155
|
var DAPP_IMPORT_RESOLVE_TIMEOUT_MS = 1e4;
|
|
5157
5156
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
5158
5157
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
@@ -5360,12 +5359,6 @@ function DepositFlow({
|
|
|
5360
5359
|
const onEventRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onEvent);
|
|
5361
5360
|
const onLifecycleRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onLifecycle);
|
|
5362
5361
|
const onErrorRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onError);
|
|
5363
|
-
const hasInitialReownSession = Boolean(
|
|
5364
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _139 => _139.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _140 => _140.address]) : _optionalChain([reownWallet, 'optionalAccess', _141 => _141.address])
|
|
5365
|
-
);
|
|
5366
|
-
const hasInitialWalletHydrationPending = Boolean(
|
|
5367
|
-
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
5368
|
-
);
|
|
5369
5362
|
const storeApi = useDepositStoreApi();
|
|
5370
5363
|
const flowSlice = useDepositStore((s) => s.flow);
|
|
5371
5364
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
@@ -5375,10 +5368,8 @@ function DepositFlow({
|
|
|
5375
5368
|
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
5376
5369
|
const flowMode = flowSlice.mode;
|
|
5377
5370
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
5378
|
-
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
5379
5371
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
5380
5372
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
5381
|
-
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = _react.useState.call(void 0, () => !hasInitialWalletHydrationPending);
|
|
5382
5373
|
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
5383
5374
|
const stableWalletSignerRef = _react.useRef.call(void 0, null);
|
|
5384
5375
|
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
@@ -5413,12 +5404,12 @@ function DepositFlow({
|
|
|
5413
5404
|
return null;
|
|
5414
5405
|
}, []);
|
|
5415
5406
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
5416
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5407
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _139 => _139.switchChain])) return void 0;
|
|
5417
5408
|
return async (chainId) => {
|
|
5418
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
5409
|
+
await _optionalChain([dappWalletClient, 'access', _140 => _140.switchChain, 'optionalCall', _141 => _141({ id: chainId })]);
|
|
5419
5410
|
};
|
|
5420
5411
|
}, [dappWalletClient]);
|
|
5421
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5412
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _142 => _142.account, 'optionalAccess', _143 => _143.address]), () => ( null));
|
|
5422
5413
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
5423
5414
|
const options = [];
|
|
5424
5415
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -5432,7 +5423,7 @@ function DepositFlow({
|
|
|
5432
5423
|
});
|
|
5433
5424
|
seen.add(id);
|
|
5434
5425
|
}
|
|
5435
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
5426
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _144 => _144.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
5436
5427
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
5437
5428
|
if (!seen.has(id)) {
|
|
5438
5429
|
options.push({
|
|
@@ -5444,7 +5435,7 @@ function DepositFlow({
|
|
|
5444
5435
|
});
|
|
5445
5436
|
seen.add(id);
|
|
5446
5437
|
}
|
|
5447
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
5438
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _145 => _145.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
5448
5439
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
5449
5440
|
if (!seen.has(id)) {
|
|
5450
5441
|
options.push({
|
|
@@ -5461,39 +5452,25 @@ function DepositFlow({
|
|
|
5461
5452
|
}, [
|
|
5462
5453
|
connectedWalletAddress,
|
|
5463
5454
|
dappAddress,
|
|
5464
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5465
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5466
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5467
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5468
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5455
|
+
_optionalChain([reownWallet, 'optionalAccess', _146 => _146.address]),
|
|
5456
|
+
_optionalChain([reownWallet, 'optionalAccess', _147 => _147.isConnected]),
|
|
5457
|
+
_optionalChain([reownWallet, 'optionalAccess', _148 => _148.walletClient]),
|
|
5458
|
+
_optionalChain([reownWallet, 'optionalAccess', _149 => _149.publicClient]),
|
|
5459
|
+
_optionalChain([reownWallet, 'optionalAccess', _150 => _150.icon]),
|
|
5469
5460
|
enableSolana,
|
|
5470
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5471
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5472
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5461
|
+
_optionalChain([reownWallet, 'optionalAccess', _151 => _151.isSolana]),
|
|
5462
|
+
_optionalChain([reownWallet, 'optionalAccess', _152 => _152.solanaAddress]),
|
|
5463
|
+
_optionalChain([reownWallet, 'optionalAccess', _153 => _153.caipAddress])
|
|
5473
5464
|
]);
|
|
5474
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
5465
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _154 => _154.account]) && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
5475
5466
|
const hasWalletOptions = walletOptions.length > 0;
|
|
5476
5467
|
const hasReownSession = Boolean(
|
|
5477
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
5478
|
-
);
|
|
5479
|
-
const isWalletHydrationPending = Boolean(
|
|
5480
|
-
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
5468
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _155 => _155.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _156 => _156.address]) : _optionalChain([reownWallet, 'optionalAccess', _157 => _157.address])
|
|
5481
5469
|
);
|
|
5482
5470
|
const isDappImportWalletHydrating = Boolean(
|
|
5483
5471
|
hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady
|
|
5484
5472
|
);
|
|
5485
5473
|
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
5486
|
-
_react.useEffect.call(void 0, () => {
|
|
5487
|
-
if (!isWalletHydrationPending) {
|
|
5488
|
-
setHasQrAutoAdvanceGraceElapsed(true);
|
|
5489
|
-
return;
|
|
5490
|
-
}
|
|
5491
|
-
setHasQrAutoAdvanceGraceElapsed(false);
|
|
5492
|
-
const timeout = window.setTimeout(() => {
|
|
5493
|
-
setHasQrAutoAdvanceGraceElapsed(true);
|
|
5494
|
-
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
5495
|
-
return () => window.clearTimeout(timeout);
|
|
5496
|
-
}, [isWalletHydrationPending]);
|
|
5497
5474
|
const walletSelectionKey = _react.useMemo.call(void 0, () => {
|
|
5498
5475
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
5499
5476
|
if (canAutoLock) {
|
|
@@ -5541,7 +5518,7 @@ function DepositFlow({
|
|
|
5541
5518
|
};
|
|
5542
5519
|
}
|
|
5543
5520
|
if (canAutoLock) {
|
|
5544
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5521
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _158 => _158.chain, 'optionalAccess', _159 => _159.id]), () => ( setupChainId));
|
|
5545
5522
|
return {
|
|
5546
5523
|
ownerAddress: dappWalletClient.account.address,
|
|
5547
5524
|
walletClient: dappWalletClient,
|
|
@@ -5563,8 +5540,8 @@ function DepositFlow({
|
|
|
5563
5540
|
switchChain: void 0
|
|
5564
5541
|
};
|
|
5565
5542
|
}
|
|
5566
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
5567
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5543
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _160 => _160.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
5544
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _161 => _161.chain, 'optionalAccess', _162 => _162.id]), () => ( setupChainId));
|
|
5568
5545
|
return {
|
|
5569
5546
|
ownerAddress: dappWalletClient.account.address,
|
|
5570
5547
|
walletClient: dappWalletClient,
|
|
@@ -5572,7 +5549,7 @@ function DepositFlow({
|
|
|
5572
5549
|
switchChain: dappSwitchChain
|
|
5573
5550
|
};
|
|
5574
5551
|
}
|
|
5575
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
5552
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _163 => _163.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
5576
5553
|
return {
|
|
5577
5554
|
ownerAddress: reownWallet.address,
|
|
5578
5555
|
walletClient: reownWallet.walletClient,
|
|
@@ -5639,37 +5616,37 @@ function DepositFlow({
|
|
|
5639
5616
|
const selectedEvmWalletOwner = _react.useMemo.call(void 0, () => {
|
|
5640
5617
|
if (!selectedWalletId) return null;
|
|
5641
5618
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
5642
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
5619
|
+
if (_optionalChain([opt, 'optionalAccess', _164 => _164.kind]) === "external" && opt.address) {
|
|
5643
5620
|
return opt.address;
|
|
5644
5621
|
}
|
|
5645
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
5622
|
+
if (_optionalChain([opt, 'optionalAccess', _165 => _165.kind]) === "connected" && opt.address) {
|
|
5646
5623
|
return opt.address;
|
|
5647
5624
|
}
|
|
5648
5625
|
return null;
|
|
5649
5626
|
}, [selectedWalletId, walletOptions]);
|
|
5650
5627
|
const dappImportOwner = _react.useMemo.call(void 0, () => {
|
|
5651
5628
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
5652
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
5629
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _166 => _166.address]) && reownWallet.isConnected) {
|
|
5653
5630
|
return reownWallet.address;
|
|
5654
5631
|
}
|
|
5655
5632
|
if (connectedWalletAddress) return connectedWalletAddress;
|
|
5656
5633
|
return null;
|
|
5657
5634
|
}, [
|
|
5658
5635
|
selectedEvmWalletOwner,
|
|
5659
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5660
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5636
|
+
_optionalChain([reownWallet, 'optionalAccess', _167 => _167.address]),
|
|
5637
|
+
_optionalChain([reownWallet, 'optionalAccess', _168 => _168.isConnected]),
|
|
5661
5638
|
connectedWalletAddress
|
|
5662
5639
|
]);
|
|
5663
5640
|
const activeOwner = _react.useMemo.call(void 0,
|
|
5664
5641
|
() => resolveOwnerForMode(flowMode, {
|
|
5665
5642
|
dappAddress,
|
|
5666
|
-
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
5643
|
+
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _169 => _169.ownerAddress]), () => ( (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner))),
|
|
5667
5644
|
dappImportOwner
|
|
5668
5645
|
}),
|
|
5669
5646
|
[
|
|
5670
5647
|
flowMode,
|
|
5671
5648
|
dappAddress,
|
|
5672
|
-
_optionalChain([signerContext, 'optionalAccess',
|
|
5649
|
+
_optionalChain([signerContext, 'optionalAccess', _170 => _170.ownerAddress]),
|
|
5673
5650
|
canAutoLock,
|
|
5674
5651
|
connectedWalletAddress,
|
|
5675
5652
|
selectedEvmWalletOwner,
|
|
@@ -5698,12 +5675,12 @@ function DepositFlow({
|
|
|
5698
5675
|
return;
|
|
5699
5676
|
}
|
|
5700
5677
|
lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
|
|
5701
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5678
|
+
_optionalChain([onLifecycleRef, 'access', _171 => _171.current, 'optionalCall', _172 => _172({
|
|
5702
5679
|
type: "smart-account-changed",
|
|
5703
5680
|
evm: activeEntry.smartAccount,
|
|
5704
5681
|
solana: _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( null))
|
|
5705
5682
|
})]);
|
|
5706
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5683
|
+
_optionalChain([onLifecycleRef, 'access', _173 => _173.current, 'optionalCall', _174 => _174({
|
|
5707
5684
|
type: "connected",
|
|
5708
5685
|
address: activeOwner,
|
|
5709
5686
|
smartAccount: activeEntry.smartAccount
|
|
@@ -5753,7 +5730,7 @@ function DepositFlow({
|
|
|
5753
5730
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
5754
5731
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
5755
5732
|
_react.useEffect.call(void 0, () => {
|
|
5756
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
5733
|
+
_optionalChain([onStepChangeRef, 'access', _175 => _175.current, 'optionalCall', _176 => _176(currentBackHandler, currentScreen)]);
|
|
5757
5734
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
5758
5735
|
const lastModalHeightRef = _react.useRef.call(void 0, 0);
|
|
5759
5736
|
const modalContentElRef = _react.useRef.call(void 0, null);
|
|
@@ -5763,7 +5740,7 @@ function DepositFlow({
|
|
|
5763
5740
|
modalContentElRef.current = mc;
|
|
5764
5741
|
const ro = new ResizeObserver((entries) => {
|
|
5765
5742
|
for (const entry of entries) {
|
|
5766
|
-
const border = _optionalChain([entry, 'access',
|
|
5743
|
+
const border = _optionalChain([entry, 'access', _177 => _177.borderBoxSize, 'optionalAccess', _178 => _178[0], 'optionalAccess', _179 => _179.blockSize]);
|
|
5767
5744
|
lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
|
|
5768
5745
|
}
|
|
5769
5746
|
});
|
|
@@ -5804,7 +5781,7 @@ function DepositFlow({
|
|
|
5804
5781
|
}
|
|
5805
5782
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
5806
5783
|
if (effectiveStep.type === "select-asset") {
|
|
5807
|
-
_optionalChain([onEventRef, 'access',
|
|
5784
|
+
_optionalChain([onEventRef, 'access', _180 => _180.current, 'optionalCall', _181 => _181({
|
|
5808
5785
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
5809
5786
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
5810
5787
|
pred_balance: totalBalanceUsd
|
|
@@ -5812,7 +5789,7 @@ function DepositFlow({
|
|
|
5812
5789
|
} else if (effectiveStep.type === "deposit-address") {
|
|
5813
5790
|
const chainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
5814
5791
|
const tokenSymbol = _chunkABVRVW3Pcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5815
|
-
_optionalChain([onEventRef, 'access',
|
|
5792
|
+
_optionalChain([onEventRef, 'access', _182 => _182.current, 'optionalCall', _183 => _183({
|
|
5816
5793
|
type: "deposit_modal_transfer_crypto_open",
|
|
5817
5794
|
default_chain: chainName,
|
|
5818
5795
|
default_token: tokenSymbol,
|
|
@@ -5820,7 +5797,7 @@ function DepositFlow({
|
|
|
5820
5797
|
})]);
|
|
5821
5798
|
} else if (effectiveStep.type === "amount" && stepSendToken) {
|
|
5822
5799
|
const receiveSymbol = _chunkABVRVW3Pcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5823
|
-
_optionalChain([onEventRef, 'access',
|
|
5800
|
+
_optionalChain([onEventRef, 'access', _184 => _184.current, 'optionalCall', _185 => _185({
|
|
5824
5801
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
5825
5802
|
send_token: stepSendToken,
|
|
5826
5803
|
receive_token: receiveSymbol,
|
|
@@ -5853,7 +5830,7 @@ function DepositFlow({
|
|
|
5853
5830
|
targetToken
|
|
5854
5831
|
]);
|
|
5855
5832
|
_react.useEffect.call(void 0, () => {
|
|
5856
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5833
|
+
_optionalChain([onLifecycleRef, 'access', _186 => _186.current, 'optionalCall', _187 => _187({
|
|
5857
5834
|
type: "balance-changed",
|
|
5858
5835
|
totalUsd: totalBalanceUsd
|
|
5859
5836
|
})]);
|
|
@@ -5869,7 +5846,7 @@ function DepositFlow({
|
|
|
5869
5846
|
const handleConfirmWallet = _react.useCallback.call(void 0,
|
|
5870
5847
|
(walletId) => {
|
|
5871
5848
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
5872
|
-
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
5849
|
+
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess', _188 => _188.kind]) === "solana" ? "solana-wallet" : "wallet";
|
|
5873
5850
|
storeApi.dispatch({
|
|
5874
5851
|
type: "connect/wallet-confirmed",
|
|
5875
5852
|
walletId,
|
|
@@ -5879,7 +5856,7 @@ function DepositFlow({
|
|
|
5879
5856
|
[walletOptions, enableSolana, storeApi]
|
|
5880
5857
|
);
|
|
5881
5858
|
const isSolanaWalletConnected = Boolean(
|
|
5882
|
-
enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
5859
|
+
enableSolana && _optionalChain([reownWallet, 'optionalAccess', _189 => _189.isConnected]) && _optionalChain([reownWallet, 'optionalAccess', _190 => _190.isSolana])
|
|
5883
5860
|
);
|
|
5884
5861
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
5885
5862
|
const enabledDappImportProviders = _react.useMemo.call(void 0,
|
|
@@ -5896,7 +5873,7 @@ function DepositFlow({
|
|
|
5896
5873
|
const owner = dappImportOwner;
|
|
5897
5874
|
if (owner) {
|
|
5898
5875
|
const wallet = walletOptions.find(
|
|
5899
|
-
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess',
|
|
5876
|
+
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _191 => _191.toLowerCase, 'call', _192 => _192()]) === owner.toLowerCase()
|
|
5900
5877
|
);
|
|
5901
5878
|
if (wallet) {
|
|
5902
5879
|
storeApi.dispatch({
|
|
@@ -6013,7 +5990,7 @@ function DepositFlow({
|
|
|
6013
5990
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
6014
5991
|
const activeDappImportAvailability = _react.useMemo.call(void 0, () => {
|
|
6015
5992
|
if (!activeDappImportProviderId) return null;
|
|
6016
|
-
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
5993
|
+
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _193 => _193.toLowerCase, 'call', _194 => _194()]) !== dappImportOwner.toLowerCase()) {
|
|
6017
5994
|
return null;
|
|
6018
5995
|
}
|
|
6019
5996
|
const entry = dappImportAvailability[activeDappImportProviderId];
|
|
@@ -6054,7 +6031,7 @@ function DepositFlow({
|
|
|
6054
6031
|
setup: setupSlice
|
|
6055
6032
|
});
|
|
6056
6033
|
const pinnableWallet = dappImportOwner ? _nullishCoalesce(walletOptions.find(
|
|
6057
|
-
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess',
|
|
6034
|
+
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _195 => _195.toLowerCase, 'call', _196 => _196()]) === dappImportOwner.toLowerCase()
|
|
6058
6035
|
), () => ( null)) : null;
|
|
6059
6036
|
const outcome = resolveBootOutcome({
|
|
6060
6037
|
status,
|
|
@@ -6096,7 +6073,7 @@ function DepositFlow({
|
|
|
6096
6073
|
if (dappImportOwner) {
|
|
6097
6074
|
const plan = bootRetryPlan({
|
|
6098
6075
|
setupStatus: readSetupForOwner(snapshot.setup, dappImportOwner).status,
|
|
6099
|
-
availabilityEntry: _optionalChain([snapshot, 'access',
|
|
6076
|
+
availabilityEntry: _optionalChain([snapshot, 'access', _197 => _197.dappImport, 'access', _198 => _198.availabilityOwner, 'optionalAccess', _199 => _199.toLowerCase, 'call', _200 => _200()]) === dappImportOwner.toLowerCase() ? snapshot.dappImport.availability[providerId] : void 0
|
|
6100
6077
|
});
|
|
6101
6078
|
if (plan.restartSetup) {
|
|
6102
6079
|
storeApi.dispatch({
|
|
@@ -6137,7 +6114,7 @@ function DepositFlow({
|
|
|
6137
6114
|
[storeApi]
|
|
6138
6115
|
);
|
|
6139
6116
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
6140
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6117
|
+
_optionalChain([onLifecycleRef, 'access', _201 => _201.current, 'optionalCall', _202 => _202({
|
|
6141
6118
|
type: "smart-account-changed",
|
|
6142
6119
|
evm: null,
|
|
6143
6120
|
solana: null
|
|
@@ -6185,13 +6162,13 @@ function DepositFlow({
|
|
|
6185
6162
|
};
|
|
6186
6163
|
push(dappAddress);
|
|
6187
6164
|
push(connectedWalletAddress);
|
|
6188
|
-
push(_optionalChain([reownWallet, 'optionalAccess',
|
|
6165
|
+
push(_optionalChain([reownWallet, 'optionalAccess', _203 => _203.address]));
|
|
6189
6166
|
push(dappImportOwner);
|
|
6190
6167
|
return owners;
|
|
6191
6168
|
}, [
|
|
6192
6169
|
dappAddress,
|
|
6193
6170
|
connectedWalletAddress,
|
|
6194
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
6171
|
+
_optionalChain([reownWallet, 'optionalAccess', _204 => _204.address]),
|
|
6195
6172
|
dappImportOwner
|
|
6196
6173
|
]);
|
|
6197
6174
|
_react.useEffect.call(void 0, () => {
|
|
@@ -6296,7 +6273,7 @@ function DepositFlow({
|
|
|
6296
6273
|
sourceChain: data.sourceChain,
|
|
6297
6274
|
amount: data.amount
|
|
6298
6275
|
});
|
|
6299
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6276
|
+
_optionalChain([onLifecycleRef, 'access', _205 => _205.current, 'optionalCall', _206 => _206({ type: "submitted", ...data })]);
|
|
6300
6277
|
},
|
|
6301
6278
|
[logFlow, onLifecycleRef]
|
|
6302
6279
|
);
|
|
@@ -6356,7 +6333,7 @@ function DepositFlow({
|
|
|
6356
6333
|
sourceDecimals: tokenAtSubmit.decimals,
|
|
6357
6334
|
inputAmountUsd: amountUsd
|
|
6358
6335
|
});
|
|
6359
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6336
|
+
_optionalChain([onLifecycleRef, 'access', _207 => _207.current, 'optionalCall', _208 => _208({
|
|
6360
6337
|
type: "submitted",
|
|
6361
6338
|
txHash,
|
|
6362
6339
|
sourceChain: "solana",
|
|
@@ -6369,7 +6346,7 @@ function DepositFlow({
|
|
|
6369
6346
|
);
|
|
6370
6347
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
6371
6348
|
(asset) => {
|
|
6372
|
-
_optionalChain([onEventRef, 'access',
|
|
6349
|
+
_optionalChain([onEventRef, 'access', _209 => _209.current, 'optionalCall', _210 => _210({
|
|
6373
6350
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
6374
6351
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
6375
6352
|
pred_balance: totalBalanceUsd,
|
|
@@ -6423,8 +6400,8 @@ function DepositFlow({
|
|
|
6423
6400
|
sourceChain: chainId,
|
|
6424
6401
|
sourceToken: token,
|
|
6425
6402
|
amount,
|
|
6426
|
-
sourceSymbol: _optionalChain([asset, 'optionalAccess',
|
|
6427
|
-
sourceDecimals: _optionalChain([asset, 'optionalAccess',
|
|
6403
|
+
sourceSymbol: _optionalChain([asset, 'optionalAccess', _211 => _211.symbol]),
|
|
6404
|
+
sourceDecimals: _optionalChain([asset, 'optionalAccess', _212 => _212.decimals]),
|
|
6428
6405
|
inputAmountUsd: _nullishCoalesce(depositAtSubmit.inputAmountUsd, () => ( void 0)),
|
|
6429
6406
|
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
6430
6407
|
});
|
|
@@ -6447,7 +6424,7 @@ function DepositFlow({
|
|
|
6447
6424
|
sourceSymbol: _nullishCoalesce(info.orderCrypto, () => ( "USDC")),
|
|
6448
6425
|
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6449
6426
|
});
|
|
6450
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6427
|
+
_optionalChain([onLifecycleRef, 'access', _213 => _213.current, 'optionalCall', _214 => _214({
|
|
6451
6428
|
type: "submitted",
|
|
6452
6429
|
txHash: info.txHash,
|
|
6453
6430
|
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
@@ -6460,12 +6437,12 @@ function DepositFlow({
|
|
|
6460
6437
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
6461
6438
|
(txHash, sourceChain, amount) => {
|
|
6462
6439
|
const depositAtSubmit = storeApi.getState().deposit;
|
|
6463
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6440
|
+
_optionalChain([onLifecycleRef, 'access', _215 => _215.current, 'optionalCall', _216 => _216({
|
|
6464
6441
|
type: "submitted",
|
|
6465
6442
|
txHash,
|
|
6466
6443
|
sourceChain,
|
|
6467
6444
|
amount,
|
|
6468
|
-
sourceDecimals: _optionalChain([depositAtSubmit, 'access',
|
|
6445
|
+
sourceDecimals: _optionalChain([depositAtSubmit, 'access', _217 => _217.selectedAsset, 'optionalAccess', _218 => _218.decimals]),
|
|
6469
6446
|
amountUsd: _nullishCoalesce(depositAtSubmit.inputAmountUsd, () => ( void 0))
|
|
6470
6447
|
})]);
|
|
6471
6448
|
},
|
|
@@ -6474,7 +6451,7 @@ function DepositFlow({
|
|
|
6474
6451
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
6475
6452
|
(txHash, destinationTxHash, context) => {
|
|
6476
6453
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
6477
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6454
|
+
_optionalChain([onLifecycleRef, 'access', _219 => _219.current, 'optionalCall', _220 => _220({
|
|
6478
6455
|
type: "complete",
|
|
6479
6456
|
txHash,
|
|
6480
6457
|
destinationTxHash,
|
|
@@ -6486,14 +6463,14 @@ function DepositFlow({
|
|
|
6486
6463
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
6487
6464
|
(txHash, error) => {
|
|
6488
6465
|
logFlowError("deposit:failed", error, { txHash });
|
|
6489
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6466
|
+
_optionalChain([onLifecycleRef, 'access', _221 => _221.current, 'optionalCall', _222 => _222({ type: "failed", txHash, error })]);
|
|
6490
6467
|
},
|
|
6491
6468
|
[logFlowError, onLifecycleRef]
|
|
6492
6469
|
);
|
|
6493
6470
|
const handleError = _react.useCallback.call(void 0,
|
|
6494
6471
|
(message, code) => {
|
|
6495
6472
|
logFlowError("flow:error", message, { code });
|
|
6496
|
-
_optionalChain([onErrorRef, 'access',
|
|
6473
|
+
_optionalChain([onErrorRef, 'access', _223 => _223.current, 'optionalCall', _224 => _224({ message, code })]);
|
|
6497
6474
|
},
|
|
6498
6475
|
[logFlowError, onErrorRef]
|
|
6499
6476
|
);
|
|
@@ -6535,26 +6512,6 @@ function DepositFlow({
|
|
|
6535
6512
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
6536
6513
|
}
|
|
6537
6514
|
}, [enableSolana, flowMode, storeApi]);
|
|
6538
|
-
_react.useEffect.call(void 0, () => {
|
|
6539
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect || initialDappImportProvider) {
|
|
6540
|
-
return;
|
|
6541
|
-
}
|
|
6542
|
-
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6543
|
-
handleSelectTransferCrypto();
|
|
6544
|
-
}
|
|
6545
|
-
}, [
|
|
6546
|
-
enableQrTransfer,
|
|
6547
|
-
hasWalletOptions,
|
|
6548
|
-
hasReownSession,
|
|
6549
|
-
hasQrAutoAdvanceGraceElapsed,
|
|
6550
|
-
isConnectSelectionConfirmed,
|
|
6551
|
-
flowMode,
|
|
6552
|
-
hasNavigatedBack,
|
|
6553
|
-
dappAddress,
|
|
6554
|
-
dappWalletClient,
|
|
6555
|
-
initialDappImportProvider,
|
|
6556
|
-
handleSelectTransferCrypto
|
|
6557
|
-
]);
|
|
6558
6515
|
const walletRows = _react.useMemo.call(void 0, () => {
|
|
6559
6516
|
return walletOptions.map((option) => {
|
|
6560
6517
|
const ownerForRow = option.kind === "solana" ? dappAddress : _nullishCoalesce(option.address, () => ( null));
|
|
@@ -6616,7 +6573,7 @@ function DepositFlow({
|
|
|
6616
6573
|
},
|
|
6617
6574
|
dappImports: connectStepDappImports,
|
|
6618
6575
|
onSelectDappImport: (providerId) => {
|
|
6619
|
-
const availabilityEntry = dappImportOwner && _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
6576
|
+
const availabilityEntry = dappImportOwner && _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _225 => _225.toLowerCase, 'call', _226 => _226()]) === dappImportOwner.toLowerCase() ? dappImportAvailability[providerId] : void 0;
|
|
6620
6577
|
if (availabilityEntry === "error") {
|
|
6621
6578
|
storeApi.dispatch({
|
|
6622
6579
|
type: "dapp-import/availability-retry-requested"
|
|
@@ -6662,7 +6619,7 @@ function DepositFlow({
|
|
|
6662
6619
|
allowedRoutes,
|
|
6663
6620
|
targetChain,
|
|
6664
6621
|
targetToken,
|
|
6665
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6622
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _227 => _227.length])),
|
|
6666
6623
|
uiConfig,
|
|
6667
6624
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
6668
6625
|
onDepositComplete: handleDepositComplete,
|
|
@@ -6670,7 +6627,7 @@ function DepositFlow({
|
|
|
6670
6627
|
onCopyAddress: () => {
|
|
6671
6628
|
const chainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
6672
6629
|
const tokenSymbol = _chunkABVRVW3Pcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
6673
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
6630
|
+
_optionalChain([onEvent, 'optionalCall', _228 => _228({
|
|
6674
6631
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
6675
6632
|
default_chain: chainName,
|
|
6676
6633
|
default_token: tokenSymbol,
|
|
@@ -6727,7 +6684,7 @@ function DepositFlow({
|
|
|
6727
6684
|
sourceSymbol: step.sourceSymbol,
|
|
6728
6685
|
sourceDecimals: step.sourceDecimals,
|
|
6729
6686
|
amountUsd: step.inputAmountUsd,
|
|
6730
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6687
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _229 => _229.length])),
|
|
6731
6688
|
service,
|
|
6732
6689
|
directTransfer: step.directTransfer,
|
|
6733
6690
|
isSwappedOrder: true,
|
|
@@ -6794,7 +6751,7 @@ function DepositFlow({
|
|
|
6794
6751
|
sourceSymbol: step.sourceSymbol,
|
|
6795
6752
|
sourceDecimals: step.sourceDecimals,
|
|
6796
6753
|
amountUsd: step.inputAmountUsd,
|
|
6797
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6754
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _230 => _230.length])),
|
|
6798
6755
|
service,
|
|
6799
6756
|
directTransfer: step.directTransfer,
|
|
6800
6757
|
isSwappedOrder: true,
|
|
@@ -6812,8 +6769,8 @@ function DepositFlow({
|
|
|
6812
6769
|
}
|
|
6813
6770
|
if (isSolanaWalletMode) {
|
|
6814
6771
|
if (!dappAddress) return null;
|
|
6815
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
6816
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
6772
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _231 => _231.solanaAddress]);
|
|
6773
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _232 => _232.solanaProvider]);
|
|
6817
6774
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
6818
6775
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6819
6776
|
AccountPreparingSkeleton,
|
|
@@ -6870,7 +6827,7 @@ function DepositFlow({
|
|
|
6870
6827
|
targetToken,
|
|
6871
6828
|
service,
|
|
6872
6829
|
solanaProvider,
|
|
6873
|
-
solanaConnection: _optionalChain([reownWallet, 'optionalAccess',
|
|
6830
|
+
solanaConnection: _optionalChain([reownWallet, 'optionalAccess', _233 => _233.solanaConnection]),
|
|
6874
6831
|
uiConfig,
|
|
6875
6832
|
onConfirm: handleSolanaConfirmed,
|
|
6876
6833
|
onError: handleError,
|
|
@@ -6924,7 +6881,7 @@ function DepositFlow({
|
|
|
6924
6881
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
6925
6882
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
6926
6883
|
amountUsd: effectiveStep.inputAmountUsd,
|
|
6927
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6884
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _234 => _234.length])),
|
|
6928
6885
|
service,
|
|
6929
6886
|
directTransfer: effectiveStep.directTransfer,
|
|
6930
6887
|
onClose,
|
|
@@ -6947,7 +6904,7 @@ function DepositFlow({
|
|
|
6947
6904
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6948
6905
|
DappImportAssetSelectSkeleton,
|
|
6949
6906
|
{
|
|
6950
|
-
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportProvider, 'optionalAccess',
|
|
6907
|
+
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportProvider, 'optionalAccess', _235 => _235.sourceLabel]), () => ( "")),
|
|
6951
6908
|
error: dappImportBootError,
|
|
6952
6909
|
onRetry: handleBootRetry
|
|
6953
6910
|
}
|
|
@@ -6955,13 +6912,13 @@ function DepositFlow({
|
|
|
6955
6912
|
}
|
|
6956
6913
|
);
|
|
6957
6914
|
}
|
|
6958
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
6915
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _236 => _236.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _237 => _237.publicClient])) {
|
|
6959
6916
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
|
|
6960
6917
|
}
|
|
6961
6918
|
const ownerAddress = signerContext.ownerAddress;
|
|
6962
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
6919
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _238 => _238.walletClient, 'optionalAccess', _239 => _239.chain, 'optionalAccess', _240 => _240.id]), () => ( _optionalChain([signerContext, 'access', _241 => _241.publicClient, 'access', _242 => _242.chain, 'optionalAccess', _243 => _243.id]))), () => ( setupChainId));
|
|
6963
6920
|
const getReadClientForChain = (chainId) => {
|
|
6964
|
-
if (_optionalChain([signerContext, 'access',
|
|
6921
|
+
if (_optionalChain([signerContext, 'access', _244 => _244.publicClient, 'access', _245 => _245.chain, 'optionalAccess', _246 => _246.id]) === chainId) {
|
|
6965
6922
|
return signerContext.publicClient;
|
|
6966
6923
|
}
|
|
6967
6924
|
return _chunkLJJCPDZOcjs.getPublicClient.call(void 0, chainId);
|
|
@@ -6995,7 +6952,7 @@ function DepositFlow({
|
|
|
6995
6952
|
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6996
6953
|
DappImportAssetSelectStep,
|
|
6997
6954
|
{
|
|
6998
|
-
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access',
|
|
6955
|
+
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access', _247 => _247.assets, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.sourceLabel]), () => ( activeDappImportProvider.sourceLabel)),
|
|
6999
6956
|
assets: activeDappImportAvailability.assets,
|
|
7000
6957
|
onSelect: handleDappImportAssetSelected
|
|
7001
6958
|
}
|
|
@@ -7022,7 +6979,7 @@ function DepositFlow({
|
|
|
7022
6979
|
onContinue: handleAmountContinue,
|
|
7023
6980
|
onCtaClick: (ctaName) => {
|
|
7024
6981
|
const receiveSymbol = _chunkABVRVW3Pcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
7025
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
6982
|
+
_optionalChain([onEvent, 'optionalCall', _250 => _250({
|
|
7026
6983
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
7027
6984
|
send_token: effectiveStep.asset.symbol,
|
|
7028
6985
|
receive_token: receiveSymbol,
|
|
@@ -7087,7 +7044,7 @@ function DepositFlow({
|
|
|
7087
7044
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
7088
7045
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
7089
7046
|
amountUsd: effectiveStep.inputAmountUsd,
|
|
7090
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
7047
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _251 => _251.length])),
|
|
7091
7048
|
service,
|
|
7092
7049
|
directTransfer: effectiveStep.directTransfer,
|
|
7093
7050
|
uiConfig,
|
|
@@ -7226,7 +7183,7 @@ function DepositHistoryPanel({
|
|
|
7226
7183
|
);
|
|
7227
7184
|
const visibleDeposits = _react.useMemo.call(void 0, () => {
|
|
7228
7185
|
const sourceHashes = new Set(
|
|
7229
|
-
deposits.map((d) => _optionalChain([d, 'access',
|
|
7186
|
+
deposits.map((d) => _optionalChain([d, 'access', _252 => _252.sourceTxHash, 'optionalAccess', _253 => _253.toLowerCase, 'call', _254 => _254()])).filter((h) => Boolean(h))
|
|
7230
7187
|
);
|
|
7231
7188
|
return deposits.filter(
|
|
7232
7189
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
@@ -7390,7 +7347,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
7390
7347
|
// src/DepositModal.tsx
|
|
7391
7348
|
|
|
7392
7349
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
7393
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
7350
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-FMAPWBQM.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
7394
7351
|
);
|
|
7395
7352
|
function sortByCreatedAtDesc(items) {
|
|
7396
7353
|
return [...items].sort((a, b) => {
|
|
@@ -7474,7 +7431,7 @@ function DepositModalInner({
|
|
|
7474
7431
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
7475
7432
|
void 0
|
|
7476
7433
|
);
|
|
7477
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7434
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _255 => _255.showHistoryButton]), () => ( false));
|
|
7478
7435
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
7479
7436
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
7480
7437
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -7500,7 +7457,7 @@ function DepositModalInner({
|
|
|
7500
7457
|
const isContract = _chunkABVRVW3Pcjs.isContractBytecode.call(void 0, code);
|
|
7501
7458
|
setRecipientIsContract(isContract);
|
|
7502
7459
|
if (isContract) {
|
|
7503
|
-
_optionalChain([onErrorRef, 'access',
|
|
7460
|
+
_optionalChain([onErrorRef, 'access', _256 => _256.current, 'optionalCall', _257 => _257({
|
|
7504
7461
|
message: "HyperCore deposits require an EOA recipient; the configured recipient is a smart contract.",
|
|
7505
7462
|
code: "HYPERCORE_RECIPIENT_NOT_EOA"
|
|
7506
7463
|
})]);
|
|
@@ -7537,7 +7494,7 @@ function DepositModalInner({
|
|
|
7537
7494
|
}, [solanaRpcUrl]);
|
|
7538
7495
|
_react.useEffect.call(void 0, () => {
|
|
7539
7496
|
if (isOpen) {
|
|
7540
|
-
_optionalChain([onReadyRef, 'access',
|
|
7497
|
+
_optionalChain([onReadyRef, 'access', _258 => _258.current, 'optionalCall', _259 => _259()]);
|
|
7541
7498
|
}
|
|
7542
7499
|
}, [isOpen, onReadyRef]);
|
|
7543
7500
|
const handleStepChange = _react.useCallback.call(void 0,
|
|
@@ -7616,7 +7573,7 @@ function DepositModalInner({
|
|
|
7616
7573
|
const onLifecycleRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onLifecycle);
|
|
7617
7574
|
const handleLifecycle = _react.useCallback.call(void 0,
|
|
7618
7575
|
(event) => {
|
|
7619
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
7576
|
+
_optionalChain([onLifecycleRef, 'access', _260 => _260.current, 'optionalCall', _261 => _261(event)]);
|
|
7620
7577
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
7621
7578
|
historyStaleRef.current = true;
|
|
7622
7579
|
}
|
|
@@ -7642,7 +7599,7 @@ function DepositModalInner({
|
|
|
7642
7599
|
store.dispatch({ type: "flow/reset" });
|
|
7643
7600
|
}
|
|
7644
7601
|
}, [isOpen, store]);
|
|
7645
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7602
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _262 => _262.showBackButton]), () => ( true));
|
|
7646
7603
|
const canGoBack = backHandler !== void 0;
|
|
7647
7604
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7648
7605
|
_chunkLJJCPDZOcjs.Modal,
|
|
@@ -784,6 +784,7 @@ WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
|
784
784
|
|
|
785
785
|
var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
786
786
|
var REGISTRATION_DEBOUNCE_MS = 600;
|
|
787
|
+
var WITHDRAW_INDEXING_DELAY_MS = 2e3;
|
|
787
788
|
function resolveSessionOwner(eoaAddress) {
|
|
788
789
|
const localOwner = _chunkLJJCPDZOcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
789
790
|
if (localOwner) {
|
|
@@ -832,6 +833,14 @@ function WithdrawFlow({
|
|
|
832
833
|
const onEventRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onEvent);
|
|
833
834
|
const onLifecycleRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onLifecycle);
|
|
834
835
|
const onErrorRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onError);
|
|
836
|
+
const isFlowActiveRef = _react.useRef.call(void 0, true);
|
|
837
|
+
const submitGenerationRef = _react.useRef.call(void 0, 0);
|
|
838
|
+
_react.useEffect.call(void 0, () => {
|
|
839
|
+
isFlowActiveRef.current = true;
|
|
840
|
+
return () => {
|
|
841
|
+
isFlowActiveRef.current = false;
|
|
842
|
+
};
|
|
843
|
+
}, []);
|
|
835
844
|
const logFlow = _react.useCallback.call(void 0,
|
|
836
845
|
(message, data) => {
|
|
837
846
|
_chunkLJJCPDZOcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
@@ -905,6 +914,7 @@ function WithdrawFlow({
|
|
|
905
914
|
const selectedWalletId = useWithdrawStore((s) => s.selectedWalletId);
|
|
906
915
|
const registration = useWithdrawStore((s) => s.registration);
|
|
907
916
|
const flowStep = useWithdrawStore((s) => s.step);
|
|
917
|
+
const reviewedRecipient = useWithdrawStore((s) => s.recipient);
|
|
908
918
|
const setSelectedWalletId = _react.useCallback.call(void 0,
|
|
909
919
|
(walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
|
|
910
920
|
[storeApi]
|
|
@@ -965,7 +975,7 @@ function WithdrawFlow({
|
|
|
965
975
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
966
976
|
}, [recipientInput]);
|
|
967
977
|
_react.useEffect.call(void 0, () => {
|
|
968
|
-
if (!ownerAddress) return;
|
|
978
|
+
if (!ownerAddress || !recipientForRegistration) return;
|
|
969
979
|
const desiredTarget = {
|
|
970
980
|
chain: targetChain,
|
|
971
981
|
token: targetToken,
|
|
@@ -1098,7 +1108,14 @@ function WithdrawFlow({
|
|
|
1098
1108
|
}, [sourceChain, sourceToken]);
|
|
1099
1109
|
const isSourceNative = sourceToken.toLowerCase() === _chunkABVRVW3Pcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1100
1110
|
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1111
|
+
const reviewedTarget = reviewedRecipient ? {
|
|
1112
|
+
chain: targetChain,
|
|
1113
|
+
token: targetToken,
|
|
1114
|
+
recipient: reviewedRecipient
|
|
1115
|
+
} : null;
|
|
1116
|
+
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1101
1117
|
const reviewBackHandler = _react.useCallback.call(void 0, () => {
|
|
1118
|
+
submitGenerationRef.current += 1;
|
|
1102
1119
|
storeApi.dispatch({ type: "review/back" });
|
|
1103
1120
|
}, [storeApi]);
|
|
1104
1121
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1173,19 +1190,38 @@ function WithdrawFlow({
|
|
|
1173
1190
|
const handleReviewConfirm = _react.useCallback.call(void 0,
|
|
1174
1191
|
async () => {
|
|
1175
1192
|
const state = storeApi.getState();
|
|
1176
|
-
if (state.registration.kind !== "ready") {
|
|
1177
|
-
throw new Error("Session not ready");
|
|
1178
|
-
}
|
|
1179
|
-
const smartAccount = state.registration.smartAccount;
|
|
1180
1193
|
const recipient = state.recipient;
|
|
1181
1194
|
const amountValue = state.amount;
|
|
1182
1195
|
if (!recipient || !amountValue) {
|
|
1183
1196
|
throw new Error("Missing recipient or amount");
|
|
1184
1197
|
}
|
|
1198
|
+
const desiredTarget = {
|
|
1199
|
+
chain: targetChain,
|
|
1200
|
+
token: targetToken,
|
|
1201
|
+
recipient
|
|
1202
|
+
};
|
|
1203
|
+
const getMatchingRegistration = () => {
|
|
1204
|
+
const current = storeApi.getState().registration;
|
|
1205
|
+
return current.kind === "ready" && targetsEqual(current.registeredTarget, desiredTarget) ? current : null;
|
|
1206
|
+
};
|
|
1207
|
+
const matchingRegistration = getMatchingRegistration();
|
|
1208
|
+
if (!matchingRegistration) {
|
|
1209
|
+
throw new Error("Withdrawal target is still being prepared");
|
|
1210
|
+
}
|
|
1211
|
+
const smartAccount = matchingRegistration.smartAccount;
|
|
1185
1212
|
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _43 => _43.walletClient])) {
|
|
1186
1213
|
throw new Error("Wallet not connected");
|
|
1187
1214
|
}
|
|
1215
|
+
const submitGeneration = submitGenerationRef.current += 1;
|
|
1216
|
+
const isSubmissionLive = () => isFlowActiveRef.current && submitGenerationRef.current === submitGeneration;
|
|
1188
1217
|
try {
|
|
1218
|
+
await new Promise((resolve) => {
|
|
1219
|
+
setTimeout(resolve, WITHDRAW_INDEXING_DELAY_MS);
|
|
1220
|
+
});
|
|
1221
|
+
if (!isSubmissionLive()) return;
|
|
1222
|
+
if (!getMatchingRegistration()) {
|
|
1223
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1224
|
+
}
|
|
1189
1225
|
logFlow("submit:start", {
|
|
1190
1226
|
smartAccount,
|
|
1191
1227
|
recipient,
|
|
@@ -1217,7 +1253,12 @@ function WithdrawFlow({
|
|
|
1217
1253
|
data: transferData.data,
|
|
1218
1254
|
chainId: sourceChain
|
|
1219
1255
|
});
|
|
1256
|
+
if (!isSubmissionLive()) return;
|
|
1220
1257
|
const { signature } = await onSignTransaction(request);
|
|
1258
|
+
if (!isSubmissionLive()) return;
|
|
1259
|
+
if (!getMatchingRegistration()) {
|
|
1260
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1261
|
+
}
|
|
1221
1262
|
const relayResult = await service.relayWithdraw({
|
|
1222
1263
|
smartAccount,
|
|
1223
1264
|
chainId: _chunkABVRVW3Pcjs.toEvmCaip2.call(void 0, sourceChain),
|
|
@@ -1230,6 +1271,9 @@ function WithdrawFlow({
|
|
|
1230
1271
|
}
|
|
1231
1272
|
result = { txHash: relayResult.txHash };
|
|
1232
1273
|
} else if (isSourceNative) {
|
|
1274
|
+
if (!getMatchingRegistration()) {
|
|
1275
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1276
|
+
}
|
|
1233
1277
|
result = await _chunkUEKPBRBYcjs.executeSafeEthTransfer.call(void 0, {
|
|
1234
1278
|
walletClient: signerContext.walletClient,
|
|
1235
1279
|
publicClient: pc,
|
|
@@ -1239,6 +1283,9 @@ function WithdrawFlow({
|
|
|
1239
1283
|
chainId: sourceChain
|
|
1240
1284
|
});
|
|
1241
1285
|
} else {
|
|
1286
|
+
if (!getMatchingRegistration()) {
|
|
1287
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1288
|
+
}
|
|
1242
1289
|
result = await _chunkUEKPBRBYcjs.executeSafeErc20Transfer.call(void 0, {
|
|
1243
1290
|
walletClient: signerContext.walletClient,
|
|
1244
1291
|
publicClient: pc,
|
|
@@ -1249,6 +1296,7 @@ function WithdrawFlow({
|
|
|
1249
1296
|
chainId: sourceChain
|
|
1250
1297
|
});
|
|
1251
1298
|
}
|
|
1299
|
+
if (!isSubmissionLive()) return;
|
|
1252
1300
|
logFlow("withdraw:submitted", {
|
|
1253
1301
|
txHash: result.txHash,
|
|
1254
1302
|
smartAccount,
|
|
@@ -1467,7 +1515,7 @@ function WithdrawFlow({
|
|
|
1467
1515
|
amount: _nullishCoalesce(storeApi.getState().amount, () => ( "0")),
|
|
1468
1516
|
recipient: _nullishCoalesce(_nullishCoalesce(storeApi.getState().recipient, () => ( recipientForRegistration)), () => ( "0x0")),
|
|
1469
1517
|
service,
|
|
1470
|
-
registrationPending: registration.kind === "pending" || registration.kind === "stale",
|
|
1518
|
+
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1471
1519
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1472
1520
|
onConfirm: handleReviewConfirm,
|
|
1473
1521
|
onError: handleError
|
|
@@ -1516,7 +1564,7 @@ function deriveStepView(step, _registration) {
|
|
|
1516
1564
|
// src/WithdrawModal.tsx
|
|
1517
1565
|
|
|
1518
1566
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1519
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1567
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-CTT3EXMG.cjs"))).then((m) => ({
|
|
1520
1568
|
default: m.WithdrawModalReown
|
|
1521
1569
|
}))
|
|
1522
1570
|
);
|
|
@@ -5152,7 +5152,6 @@ function AccountPreparingSkeleton({
|
|
|
5152
5152
|
) })
|
|
5153
5153
|
] });
|
|
5154
5154
|
}
|
|
5155
|
-
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
5156
5155
|
var DAPP_IMPORT_RESOLVE_TIMEOUT_MS = 1e4;
|
|
5157
5156
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
5158
5157
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
@@ -5360,12 +5359,6 @@ function DepositFlow({
|
|
|
5360
5359
|
const onEventRef = useLatestRef(onEvent);
|
|
5361
5360
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
5362
5361
|
const onErrorRef = useLatestRef(onError);
|
|
5363
|
-
const hasInitialReownSession = Boolean(
|
|
5364
|
-
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
5365
|
-
);
|
|
5366
|
-
const hasInitialWalletHydrationPending = Boolean(
|
|
5367
|
-
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
5368
|
-
);
|
|
5369
5362
|
const storeApi = useDepositStoreApi();
|
|
5370
5363
|
const flowSlice = useDepositStore((s) => s.flow);
|
|
5371
5364
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
@@ -5375,10 +5368,8 @@ function DepositFlow({
|
|
|
5375
5368
|
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
5376
5369
|
const flowMode = flowSlice.mode;
|
|
5377
5370
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
5378
|
-
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
5379
5371
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
5380
5372
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState11(0);
|
|
5381
|
-
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState11(() => !hasInitialWalletHydrationPending);
|
|
5382
5373
|
const portfolioAssetsRef = useRef8([]);
|
|
5383
5374
|
const stableWalletSignerRef = useRef8(null);
|
|
5384
5375
|
const stableWalletSelectionKeyRef = useRef8(null);
|
|
@@ -5476,24 +5467,10 @@ function DepositFlow({
|
|
|
5476
5467
|
const hasReownSession = Boolean(
|
|
5477
5468
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
5478
5469
|
);
|
|
5479
|
-
const isWalletHydrationPending = Boolean(
|
|
5480
|
-
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
5481
|
-
);
|
|
5482
5470
|
const isDappImportWalletHydrating = Boolean(
|
|
5483
5471
|
hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady
|
|
5484
5472
|
);
|
|
5485
5473
|
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
5486
|
-
useEffect10(() => {
|
|
5487
|
-
if (!isWalletHydrationPending) {
|
|
5488
|
-
setHasQrAutoAdvanceGraceElapsed(true);
|
|
5489
|
-
return;
|
|
5490
|
-
}
|
|
5491
|
-
setHasQrAutoAdvanceGraceElapsed(false);
|
|
5492
|
-
const timeout = window.setTimeout(() => {
|
|
5493
|
-
setHasQrAutoAdvanceGraceElapsed(true);
|
|
5494
|
-
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
5495
|
-
return () => window.clearTimeout(timeout);
|
|
5496
|
-
}, [isWalletHydrationPending]);
|
|
5497
5474
|
const walletSelectionKey = useMemo7(() => {
|
|
5498
5475
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
5499
5476
|
if (canAutoLock) {
|
|
@@ -6535,26 +6512,6 @@ function DepositFlow({
|
|
|
6535
6512
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
6536
6513
|
}
|
|
6537
6514
|
}, [enableSolana, flowMode, storeApi]);
|
|
6538
|
-
useEffect10(() => {
|
|
6539
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect || initialDappImportProvider) {
|
|
6540
|
-
return;
|
|
6541
|
-
}
|
|
6542
|
-
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6543
|
-
handleSelectTransferCrypto();
|
|
6544
|
-
}
|
|
6545
|
-
}, [
|
|
6546
|
-
enableQrTransfer,
|
|
6547
|
-
hasWalletOptions,
|
|
6548
|
-
hasReownSession,
|
|
6549
|
-
hasQrAutoAdvanceGraceElapsed,
|
|
6550
|
-
isConnectSelectionConfirmed,
|
|
6551
|
-
flowMode,
|
|
6552
|
-
hasNavigatedBack,
|
|
6553
|
-
dappAddress,
|
|
6554
|
-
dappWalletClient,
|
|
6555
|
-
initialDappImportProvider,
|
|
6556
|
-
handleSelectTransferCrypto
|
|
6557
|
-
]);
|
|
6558
6515
|
const walletRows = useMemo7(() => {
|
|
6559
6516
|
return walletOptions.map((option) => {
|
|
6560
6517
|
const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
|
|
@@ -7390,7 +7347,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
7390
7347
|
// src/DepositModal.tsx
|
|
7391
7348
|
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7392
7349
|
var ReownDepositInner = lazy2(
|
|
7393
|
-
() => import("./DepositModalReown-
|
|
7350
|
+
() => import("./DepositModalReown-EXI7MW65.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
7394
7351
|
);
|
|
7395
7352
|
function sortByCreatedAtDesc(items) {
|
|
7396
7353
|
return [...items].sort((a, b) => {
|
package/dist/deposit.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBTDRUAPJcjs = require('./chunk-BTDRUAPJ.cjs');
|
|
4
4
|
require('./chunk-NRNJAQUA.cjs');
|
|
5
5
|
require('./chunk-LJJCPDZO.cjs');
|
|
6
6
|
require('./chunk-UEKPBRBY.cjs');
|
|
7
7
|
require('./chunk-ABVRVW3P.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.DepositModal =
|
|
10
|
+
exports.DepositModal = _chunkBTDRUAPJcjs.DepositModal;
|
package/dist/deposit.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBTDRUAPJcjs = require('./chunk-BTDRUAPJ.cjs');
|
|
4
4
|
require('./chunk-NRNJAQUA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkJHT2MJ42cjs = require('./chunk-JHT2MJ42.cjs');
|
|
8
8
|
require('./chunk-LJJCPDZO.cjs');
|
|
9
9
|
require('./chunk-UEKPBRBY.cjs');
|
|
10
10
|
|
|
@@ -85,4 +85,4 @@ async function disconnectWallet() {
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
exports.CHAIN_BY_ID = _chunkABVRVW3Pcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkABVRVW3Pcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkABVRVW3Pcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal =
|
|
88
|
+
exports.CHAIN_BY_ID = _chunkABVRVW3Pcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkABVRVW3Pcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkABVRVW3Pcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkBTDRUAPJcjs.DepositModal; exports.HYPERCORE_CHAIN_ID = _chunkABVRVW3Pcjs.HYPERCORE_CHAIN_ID; exports.HYPERCORE_USDC_ADDRESS = _chunkABVRVW3Pcjs.HYPERCORE_USDC_ADDRESS; exports.NATIVE_TOKEN_ADDRESS = _chunkABVRVW3Pcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkABVRVW3Pcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkABVRVW3Pcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkJHT2MJ42cjs.WithdrawModal; exports.chainRegistry = _chunkABVRVW3Pcjs.chainRegistry; exports.disconnectWallet = disconnectWallet; exports.findChainIdForToken = _chunkABVRVW3Pcjs.findChainIdForToken; exports.getChainBadge = _chunkABVRVW3Pcjs.getChainBadge; exports.getChainIcon = _chunkABVRVW3Pcjs.getChainIcon; exports.getChainId = _chunkABVRVW3Pcjs.getChainId; exports.getChainName = _chunkABVRVW3Pcjs.getChainName; exports.getChainObject = _chunkABVRVW3Pcjs.getChainObject; exports.getExplorerName = _chunkABVRVW3Pcjs.getExplorerName; exports.getExplorerTxUrl = _chunkABVRVW3Pcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkABVRVW3Pcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkABVRVW3Pcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkABVRVW3Pcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkABVRVW3Pcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkABVRVW3Pcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkABVRVW3Pcjs.getTokenAddress; exports.getTokenDecimals = _chunkABVRVW3Pcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkABVRVW3Pcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkABVRVW3Pcjs.getTokenIcon; exports.getTokenSymbol = _chunkABVRVW3Pcjs.getTokenSymbol; exports.getUsdcAddress = _chunkABVRVW3Pcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkABVRVW3Pcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkABVRVW3Pcjs.isSupportedTokenAddressForChain;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RTAIW3WW.mjs";
|
|
4
4
|
import "./chunk-FJWLC4AM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
WithdrawModal
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3GLQC2KQ.mjs";
|
|
8
8
|
import "./chunk-A33QFRKD.mjs";
|
|
9
9
|
import "./chunk-F7P4MV72.mjs";
|
|
10
10
|
import {
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJHT2MJ42cjs = require('./chunk-JHT2MJ42.cjs');
|
|
4
4
|
require('./chunk-LJJCPDZO.cjs');
|
|
5
5
|
require('./chunk-UEKPBRBY.cjs');
|
|
6
6
|
require('./chunk-ABVRVW3P.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.WithdrawModal =
|
|
9
|
+
exports.WithdrawModal = _chunkJHT2MJ42cjs.WithdrawModal;
|
package/dist/withdraw.mjs
CHANGED
package/package.json
CHANGED