@rhinestone/deposit-modal 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -24
- package/bridge-transcript.json +14 -0
- package/dist/{DepositModalReown-GAD45GIC.cjs → DepositModalReown-IFN6YLZJ.cjs} +20 -22
- package/dist/{DepositModalReown-2EVV64OA.mjs → DepositModalReown-R7UROJPJ.mjs} +5 -7
- package/dist/WithdrawModal-SZEAI473.cjs +11 -0
- package/dist/WithdrawModal-XKSSHVEJ.mjs +11 -0
- package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
- package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
- package/dist/{chunk-A6JPBMYY.cjs → chunk-24N4KMJX.cjs} +234 -115
- package/dist/{chunk-LMG46EP2.mjs → chunk-3HCCR54R.mjs} +1 -1
- package/dist/{chunk-AQVJUXSG.cjs → chunk-5CM3ZQ5U.cjs} +1 -1
- package/dist/chunk-EA5CE2UZ.mjs +7599 -0
- package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
- package/dist/{chunk-5Q5CSVKF.mjs → chunk-F6ROQ6RJ.mjs} +215 -517
- package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
- package/dist/chunk-H4O22O7Y.cjs +7599 -0
- package/dist/{chunk-GZ4GQ5MC.mjs → chunk-HMB2XQGD.mjs} +172 -53
- package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
- package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
- package/dist/{chunk-NQMC5VKQ.cjs → chunk-V466XQSG.cjs} +551 -853
- package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
- package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +6 -8
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +5 -7
- package/dist/embed.cjs +130 -80
- package/dist/embed.d.cts +3 -9
- package/dist/embed.d.ts +3 -9
- package/dist/embed.mjs +112 -62
- package/dist/index.cjs +8 -11
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.mjs +10 -13
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/styles.css +147 -100
- package/dist/{types-DP_3KwlD.d.cts → types-B9SbZQIG.d.ts} +145 -108
- package/dist/{types-Bho4OA03.d.ts → types-SwGGf0eH.d.cts} +145 -108
- package/dist/withdraw.cjs +5 -6
- package/dist/withdraw.d.cts +33 -5
- package/dist/withdraw.d.ts +33 -5
- package/dist/withdraw.mjs +4 -5
- package/package.json +6 -37
- package/dist/ClaimModal-GDFENSLV.mjs +0 -13
- package/dist/ClaimModal-L3FUBI5U.cjs +0 -13
- package/dist/WithdrawModal-FAQH35NG.cjs +0 -12
- package/dist/WithdrawModal-IKUHF5CF.mjs +0 -12
- package/dist/chunk-4J5ADVIN.cjs +0 -1848
- package/dist/chunk-62UCV2LG.cjs +0 -81
- package/dist/chunk-7AZFT2MV.cjs +0 -163
- package/dist/chunk-HAQOFI3D.cjs +0 -3699
- package/dist/chunk-QACOOLOE.mjs +0 -1062
- package/dist/chunk-R5UQ3TN4.mjs +0 -81
- package/dist/chunk-UX35GYLM.mjs +0 -3699
- package/dist/chunk-VALXN5IO.mjs +0 -163
- package/dist/chunk-XCTRKCNM.mjs +0 -1848
- package/dist/chunk-YP7QVKQ6.cjs +0 -1062
- package/dist/claim.cjs +0 -11
- package/dist/claim.d.cts +0 -17
- package/dist/claim.d.ts +0 -17
- package/dist/claim.mjs +0 -11
- package/dist/modal-ui-state-OD1RmKkK.d.cts +0 -30
- package/dist/modal-ui-state-OD1RmKkK.d.ts +0 -30
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProcessingStep,
|
|
3
|
-
analyticsTargetProperties,
|
|
4
|
-
deriveAccountSalt,
|
|
5
|
-
isSubmissionUncertain,
|
|
6
|
-
useTokenPrices,
|
|
7
|
-
warnRemovedProps
|
|
8
|
-
} from "./chunk-XCTRKCNM.mjs";
|
|
9
1
|
import {
|
|
10
2
|
AnalyticsSession,
|
|
11
3
|
BodyHeader,
|
|
@@ -17,31 +9,42 @@ import {
|
|
|
17
9
|
ChevronLeftIcon,
|
|
18
10
|
CircleArrowOutUpLeftIcon,
|
|
19
11
|
CloseIcon,
|
|
12
|
+
HistoryEntryButton,
|
|
13
|
+
HistoryOverlay,
|
|
20
14
|
Modal,
|
|
21
15
|
PoweredBy,
|
|
16
|
+
ProcessingStep,
|
|
22
17
|
RpcUrlsProvider,
|
|
23
18
|
Spinner,
|
|
24
19
|
TokenIcon,
|
|
20
|
+
analyticsTargetProperties,
|
|
25
21
|
applyTheme,
|
|
26
22
|
checkBackendUrl,
|
|
27
23
|
createDepositService,
|
|
24
|
+
createHistoryAnalytics,
|
|
28
25
|
currencyFormatter,
|
|
29
26
|
debugError,
|
|
30
27
|
debugLog,
|
|
28
|
+
deriveAccountSalt,
|
|
31
29
|
formatReceiveEstimate,
|
|
32
30
|
formatTokenAmount,
|
|
33
31
|
formatUserError,
|
|
34
32
|
getAssetId,
|
|
33
|
+
isHistoryEntryVisible,
|
|
35
34
|
isNativeAsset,
|
|
36
35
|
isRecognizedToken,
|
|
36
|
+
isSubmissionUncertain,
|
|
37
37
|
useDestinationChains,
|
|
38
|
+
useHistoryPanel,
|
|
38
39
|
useLatestRef,
|
|
39
40
|
useReadClient,
|
|
40
41
|
useRpcUrls,
|
|
41
42
|
useStableRpcUrls,
|
|
42
43
|
useTargetTokens,
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
useTokenPrices,
|
|
45
|
+
useWithdrawAnalyticsEmitter,
|
|
46
|
+
warnRemovedProps
|
|
47
|
+
} from "./chunk-EA5CE2UZ.mjs";
|
|
45
48
|
import {
|
|
46
49
|
NATIVE_TOKEN_ADDRESS,
|
|
47
50
|
getChainIcon,
|
|
@@ -50,13 +53,13 @@ import {
|
|
|
50
53
|
getTokenDecimalsByAddress,
|
|
51
54
|
getTokenSymbol,
|
|
52
55
|
targetChainToCaip2
|
|
53
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-EAGMY3QE.mjs";
|
|
54
57
|
|
|
55
58
|
// src/WithdrawModal.tsx
|
|
56
|
-
import { useCallback as useCallback3, useEffect as
|
|
59
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef4, useState as useState4 } from "react";
|
|
57
60
|
|
|
58
61
|
// src/WithdrawFlow.tsx
|
|
59
|
-
import { useCallback as useCallback2, useEffect as
|
|
62
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
|
|
60
63
|
|
|
61
64
|
// src/store/withdraw.ts
|
|
62
65
|
import { createContext, createElement, useContext } from "react";
|
|
@@ -622,7 +625,7 @@ function WithdrawFormStep({
|
|
|
622
625
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
623
626
|
|
|
624
627
|
// src/components/steps/WithdrawReviewStep.tsx
|
|
625
|
-
import { useState as useState2 } from "react";
|
|
628
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
626
629
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
627
630
|
function shortenAddress(addr) {
|
|
628
631
|
return addr.length > 12 ? `${addr.slice(0, 6)}\u2026${addr.slice(-4)}` : addr;
|
|
@@ -639,11 +642,18 @@ function WithdrawReviewStep({
|
|
|
639
642
|
registrationPending = false,
|
|
640
643
|
registrationError = null,
|
|
641
644
|
service,
|
|
645
|
+
onSubmittingChange,
|
|
642
646
|
onConfirm,
|
|
643
647
|
onError
|
|
644
648
|
}) {
|
|
645
649
|
const [isSubmitting, setIsSubmitting] = useState2(false);
|
|
646
650
|
const [error, setError] = useState2(null);
|
|
651
|
+
const onSubmittingChangeRef = useRef2(onSubmittingChange);
|
|
652
|
+
onSubmittingChangeRef.current = onSubmittingChange;
|
|
653
|
+
useEffect2(() => {
|
|
654
|
+
onSubmittingChangeRef.current?.(isSubmitting);
|
|
655
|
+
return () => onSubmittingChangeRef.current?.(false);
|
|
656
|
+
}, [isSubmitting]);
|
|
647
657
|
const sourceChainName = getChainName(sourceChain);
|
|
648
658
|
const sourceChainIcon = getChainIcon(sourceChain);
|
|
649
659
|
const targetSymbol = getTokenSymbol(targetToken, targetChain);
|
|
@@ -798,6 +808,23 @@ function createWithdrawAnalyticsController(emit) {
|
|
|
798
808
|
opened = true;
|
|
799
809
|
emit({ type: "withdraw_modal_open" });
|
|
800
810
|
},
|
|
811
|
+
// Never deduplicated: the visit id and the per-visit dedupe belong to the
|
|
812
|
+
// history adapter, which knows what a visit is.
|
|
813
|
+
historyOpened(detail) {
|
|
814
|
+
send({ type: "withdraw_modal_history_open", ...detail });
|
|
815
|
+
},
|
|
816
|
+
historyRowViewed(detail) {
|
|
817
|
+
send({ type: "withdraw_modal_history_row_view", ...detail });
|
|
818
|
+
},
|
|
819
|
+
historyLoadMore(detail) {
|
|
820
|
+
send({ type: "withdraw_modal_history_load_more", ...detail });
|
|
821
|
+
},
|
|
822
|
+
historyFallbackOpened(detail) {
|
|
823
|
+
send({ type: "withdraw_modal_history_fallback_open", ...detail });
|
|
824
|
+
},
|
|
825
|
+
historyRecoveryStarted(detail) {
|
|
826
|
+
send({ type: "withdraw_modal_history_recovery_start", ...detail });
|
|
827
|
+
},
|
|
801
828
|
openStep(nextStep) {
|
|
802
829
|
controller.openSession();
|
|
803
830
|
if (step === nextStep) return;
|
|
@@ -938,6 +965,8 @@ function WithdrawFlow({
|
|
|
938
965
|
onSendTransaction,
|
|
939
966
|
onStepChange,
|
|
940
967
|
onClose,
|
|
968
|
+
onDestinationChange,
|
|
969
|
+
onSubmittingChange,
|
|
941
970
|
onLifecycle,
|
|
942
971
|
onError,
|
|
943
972
|
debug
|
|
@@ -947,12 +976,12 @@ function WithdrawFlow({
|
|
|
947
976
|
const analytics = useWithdrawAnalyticsController();
|
|
948
977
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
949
978
|
const onErrorRef = useLatestRef(onError);
|
|
950
|
-
const isFlowActiveRef =
|
|
951
|
-
const submitGenerationRef =
|
|
952
|
-
const lastSubmitFailureRef =
|
|
979
|
+
const isFlowActiveRef = useRef3(true);
|
|
980
|
+
const submitGenerationRef = useRef3(0);
|
|
981
|
+
const lastSubmitFailureRef = useRef3(
|
|
953
982
|
null
|
|
954
983
|
);
|
|
955
|
-
|
|
984
|
+
useEffect3(() => {
|
|
956
985
|
isFlowActiveRef.current = true;
|
|
957
986
|
return () => {
|
|
958
987
|
isFlowActiveRef.current = false;
|
|
@@ -975,13 +1004,13 @@ function WithdrawFlow({
|
|
|
975
1004
|
const [recipientInput, setRecipientInput] = useState3(
|
|
976
1005
|
defaultRecipient ?? ""
|
|
977
1006
|
);
|
|
978
|
-
|
|
1007
|
+
useEffect3(() => {
|
|
979
1008
|
setTargetChain(targetChainProp);
|
|
980
1009
|
}, [targetChainProp]);
|
|
981
|
-
|
|
1010
|
+
useEffect3(() => {
|
|
982
1011
|
setTargetToken(targetTokenProp);
|
|
983
1012
|
}, [targetTokenProp]);
|
|
984
|
-
|
|
1013
|
+
useEffect3(() => {
|
|
985
1014
|
if (defaultRecipient) setRecipientInput(defaultRecipient);
|
|
986
1015
|
}, [defaultRecipient]);
|
|
987
1016
|
const storeApi = useWithdrawStoreApi();
|
|
@@ -993,7 +1022,22 @@ function WithdrawFlow({
|
|
|
993
1022
|
if (!recipientInput) return void 0;
|
|
994
1023
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
995
1024
|
}, [recipientInput]);
|
|
996
|
-
|
|
1025
|
+
const onDestinationChangeRef = useLatestRef(onDestinationChange);
|
|
1026
|
+
const reportedDestinationRef = useRef3(void 0);
|
|
1027
|
+
useEffect3(() => {
|
|
1028
|
+
if (reportedDestinationRef.current === recipientForRegistration) return;
|
|
1029
|
+
const report = () => {
|
|
1030
|
+
reportedDestinationRef.current = recipientForRegistration;
|
|
1031
|
+
onDestinationChangeRef.current?.(recipientForRegistration);
|
|
1032
|
+
};
|
|
1033
|
+
if (!reportedDestinationRef.current) {
|
|
1034
|
+
report();
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
const timeout = setTimeout(report, REGISTRATION_DEBOUNCE_MS);
|
|
1038
|
+
return () => clearTimeout(timeout);
|
|
1039
|
+
}, [recipientForRegistration, onDestinationChangeRef]);
|
|
1040
|
+
useEffect3(() => {
|
|
997
1041
|
if (!recipientForRegistration) return;
|
|
998
1042
|
const desiredTarget = {
|
|
999
1043
|
chain: targetChain,
|
|
@@ -1094,7 +1138,7 @@ function WithdrawFlow({
|
|
|
1094
1138
|
recipient: reviewedRecipient
|
|
1095
1139
|
} : null;
|
|
1096
1140
|
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1097
|
-
|
|
1141
|
+
useEffect3(() => {
|
|
1098
1142
|
if (flowStep !== "review") return;
|
|
1099
1143
|
if (registration.kind !== "ready" || isReviewedTargetReady) return;
|
|
1100
1144
|
analytics.friction("registration_stale", "review");
|
|
@@ -1104,17 +1148,17 @@ function WithdrawFlow({
|
|
|
1104
1148
|
analytics.abandon("back");
|
|
1105
1149
|
storeApi.dispatch({ type: "review/back" });
|
|
1106
1150
|
}, [analytics, storeApi]);
|
|
1107
|
-
|
|
1151
|
+
useEffect3(() => {
|
|
1108
1152
|
onStepChangeRef.current?.(
|
|
1109
1153
|
flowStep === "review" ? reviewBackHandler : void 0,
|
|
1110
1154
|
flowStep
|
|
1111
1155
|
);
|
|
1112
1156
|
}, [flowStep, reviewBackHandler, onStepChangeRef]);
|
|
1113
|
-
|
|
1157
|
+
useEffect3(() => {
|
|
1114
1158
|
analytics.openSession();
|
|
1115
1159
|
analytics.openStep(analyticsStepForFlowStep(flowStep));
|
|
1116
1160
|
}, [analytics, flowStep]);
|
|
1117
|
-
|
|
1161
|
+
useEffect3(() => {
|
|
1118
1162
|
if (registration.kind === "pending") {
|
|
1119
1163
|
analytics.friction("registration_pending");
|
|
1120
1164
|
} else if (registration.kind === "stale") {
|
|
@@ -1123,7 +1167,7 @@ function WithdrawFlow({
|
|
|
1123
1167
|
analytics.failure("registration_failed", true);
|
|
1124
1168
|
}
|
|
1125
1169
|
}, [analytics, registration.kind]);
|
|
1126
|
-
|
|
1170
|
+
useEffect3(() => {
|
|
1127
1171
|
logFlow("state:changed", {
|
|
1128
1172
|
step: flowStep,
|
|
1129
1173
|
sourceChain,
|
|
@@ -1341,7 +1385,7 @@ function WithdrawFlow({
|
|
|
1341
1385
|
() => targetTokensFor(targetChain),
|
|
1342
1386
|
[targetChain, targetTokensFor]
|
|
1343
1387
|
);
|
|
1344
|
-
|
|
1388
|
+
useEffect3(() => {
|
|
1345
1389
|
if (targetTokenOptions.length === 0) return;
|
|
1346
1390
|
const matches = targetTokenOptions.some(
|
|
1347
1391
|
(option) => option.address.toLowerCase() === targetToken.toLowerCase()
|
|
@@ -1409,6 +1453,7 @@ function WithdrawFlow({
|
|
|
1409
1453
|
service,
|
|
1410
1454
|
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1411
1455
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1456
|
+
onSubmittingChange,
|
|
1412
1457
|
onConfirm: handleReviewConfirm,
|
|
1413
1458
|
onError: handleError
|
|
1414
1459
|
}
|
|
@@ -1515,6 +1560,7 @@ function WithdrawModal({
|
|
|
1515
1560
|
onError,
|
|
1516
1561
|
enableAnalyticsIngest,
|
|
1517
1562
|
analyticsIngestUrl,
|
|
1563
|
+
signRecovery,
|
|
1518
1564
|
debug,
|
|
1519
1565
|
// Every prop 0.9.0 removed lands here, since none of them is named above.
|
|
1520
1566
|
// `uiConfig` is destructured, so its removed nested key isn't scanned — that
|
|
@@ -1526,16 +1572,21 @@ function WithdrawModal({
|
|
|
1526
1572
|
}) {
|
|
1527
1573
|
warnRemovedProps("WithdrawModal", removedProps);
|
|
1528
1574
|
checkBackendUrl("WithdrawModal", backendUrl);
|
|
1529
|
-
const modalRef =
|
|
1575
|
+
const modalRef = useRef4(null);
|
|
1530
1576
|
const onReadyRef = useLatestRef(onReady);
|
|
1531
|
-
const analyticsControllerRef =
|
|
1577
|
+
const analyticsControllerRef = useRef4(
|
|
1532
1578
|
null
|
|
1533
1579
|
);
|
|
1534
|
-
const
|
|
1580
|
+
const analyticsSessionIdRef = useRef4(null);
|
|
1581
|
+
const previousOpenRef = useRef4(isOpen);
|
|
1535
1582
|
const [backHandler, setBackHandler] = useState4(
|
|
1536
1583
|
void 0
|
|
1537
1584
|
);
|
|
1538
1585
|
const [screen, setScreen] = useState4("form");
|
|
1586
|
+
const [submitting, setSubmitting] = useState4(false);
|
|
1587
|
+
const [historyRecipient, setHistoryRecipient] = useState4(
|
|
1588
|
+
recipient
|
|
1589
|
+
);
|
|
1539
1590
|
const onUiStateRef = useLatestRef(onUiState);
|
|
1540
1591
|
const targetChain = getChainId(targetChainProp ?? sourceChainProp);
|
|
1541
1592
|
const sourceChain = getChainId(sourceChainProp);
|
|
@@ -1544,9 +1595,30 @@ function WithdrawModal({
|
|
|
1544
1595
|
() => createDepositService(backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1545
1596
|
[backendUrl, debug]
|
|
1546
1597
|
);
|
|
1598
|
+
const historyAnalytics = useMemo4(
|
|
1599
|
+
() => createHistoryAnalytics({
|
|
1600
|
+
modal: "withdraw",
|
|
1601
|
+
controllerRef: analyticsControllerRef,
|
|
1602
|
+
sessionIdRef: analyticsSessionIdRef
|
|
1603
|
+
}),
|
|
1604
|
+
[]
|
|
1605
|
+
);
|
|
1606
|
+
const history = useHistoryPanel({
|
|
1607
|
+
isOpen,
|
|
1608
|
+
recipient: historyRecipient,
|
|
1609
|
+
service,
|
|
1610
|
+
canRecover: Boolean(signRecovery),
|
|
1611
|
+
analytics: historyAnalytics
|
|
1612
|
+
});
|
|
1613
|
+
const { markStale: markHistoryStale, recoverySubmitting } = history;
|
|
1614
|
+
const historyButtonVisible = isHistoryEntryVisible({
|
|
1615
|
+
screen,
|
|
1616
|
+
submitting,
|
|
1617
|
+
settled: false
|
|
1618
|
+
});
|
|
1547
1619
|
const store = useMemo4(() => createWithdrawStore(), []);
|
|
1548
1620
|
const onErrorRef = useLatestRef(onError);
|
|
1549
|
-
|
|
1621
|
+
useEffect4(() => {
|
|
1550
1622
|
if (isOpen && typeof onSendTransaction !== "function") {
|
|
1551
1623
|
onErrorRef.current?.({
|
|
1552
1624
|
message: "WithdrawModal requires an `onSendTransaction` function.",
|
|
@@ -1561,12 +1633,13 @@ function WithdrawModal({
|
|
|
1561
1633
|
}, [isOpen, onSendTransaction, onErrorRef]);
|
|
1562
1634
|
const closeWithSource = useCallback3(
|
|
1563
1635
|
(source) => {
|
|
1636
|
+
if (submitting || recoverySubmitting) return;
|
|
1564
1637
|
const analytics = analyticsControllerRef.current;
|
|
1565
1638
|
analytics?.abandon("modal_close");
|
|
1566
1639
|
analytics?.close(source);
|
|
1567
1640
|
onClose();
|
|
1568
1641
|
},
|
|
1569
|
-
[onClose]
|
|
1642
|
+
[onClose, submitting, recoverySubmitting]
|
|
1570
1643
|
);
|
|
1571
1644
|
const handleModalDismiss = useCallback3(
|
|
1572
1645
|
(reason) => {
|
|
@@ -1576,7 +1649,7 @@ function WithdrawModal({
|
|
|
1576
1649
|
},
|
|
1577
1650
|
[closeWithSource]
|
|
1578
1651
|
);
|
|
1579
|
-
|
|
1652
|
+
useEffect4(() => {
|
|
1580
1653
|
if (previousOpenRef.current && !isOpen) {
|
|
1581
1654
|
const analytics = analyticsControllerRef.current;
|
|
1582
1655
|
analytics?.abandon("modal_close");
|
|
@@ -1584,31 +1657,44 @@ function WithdrawModal({
|
|
|
1584
1657
|
}
|
|
1585
1658
|
previousOpenRef.current = isOpen;
|
|
1586
1659
|
}, [isOpen]);
|
|
1587
|
-
|
|
1660
|
+
useEffect4(() => {
|
|
1588
1661
|
if (!isOpen || !modalRef.current) return;
|
|
1589
1662
|
return applyTheme(modalRef.current, theme);
|
|
1590
1663
|
}, [isOpen, theme]);
|
|
1591
|
-
|
|
1664
|
+
useEffect4(() => {
|
|
1592
1665
|
if (isOpen) {
|
|
1593
1666
|
onReadyRef.current?.();
|
|
1594
1667
|
}
|
|
1595
1668
|
}, [isOpen, onReadyRef]);
|
|
1596
|
-
|
|
1669
|
+
useEffect4(() => {
|
|
1597
1670
|
if (!isOpen) {
|
|
1598
1671
|
store.dispatch({ type: "modal/reset" });
|
|
1672
|
+
setHistoryRecipient(recipient);
|
|
1599
1673
|
}
|
|
1600
|
-
}, [isOpen, store]);
|
|
1674
|
+
}, [isOpen, store, recipient]);
|
|
1601
1675
|
const handleStepChange = useCallback3((onBack, next) => {
|
|
1602
1676
|
setBackHandler(() => onBack);
|
|
1603
1677
|
if (next) setScreen(next);
|
|
1604
1678
|
}, []);
|
|
1605
|
-
|
|
1679
|
+
useEffect4(() => {
|
|
1606
1680
|
onUiStateRef.current?.({
|
|
1607
1681
|
screen,
|
|
1608
1682
|
back: backHandler,
|
|
1609
|
-
|
|
1683
|
+
// A transfer or a recovery in flight is a submission whose outcome is
|
|
1684
|
+
// unknown, so a native host's dismissal lock has to hold through it.
|
|
1685
|
+
submitting: submitting || recoverySubmitting
|
|
1610
1686
|
});
|
|
1611
|
-
}, [screen, backHandler, onUiStateRef]);
|
|
1687
|
+
}, [screen, backHandler, submitting, recoverySubmitting, onUiStateRef]);
|
|
1688
|
+
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
1689
|
+
const handleLifecycle = useCallback3(
|
|
1690
|
+
(event) => {
|
|
1691
|
+
onLifecycleRef.current?.(event);
|
|
1692
|
+
if (event.type === "submitted" || event.type === "complete" || event.type === "failed") {
|
|
1693
|
+
markHistoryStale();
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
[onLifecycleRef, markHistoryStale]
|
|
1697
|
+
);
|
|
1612
1698
|
const analyticsSessionProperties = buildWithdrawAnalyticsSessionProperties({
|
|
1613
1699
|
inline,
|
|
1614
1700
|
closeOnOverlayClick,
|
|
@@ -1620,7 +1706,7 @@ function WithdrawModal({
|
|
|
1620
1706
|
seedTargetToken: targetToken ?? sourceToken
|
|
1621
1707
|
});
|
|
1622
1708
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
1623
|
-
const canGoBack = backHandler !== void 0;
|
|
1709
|
+
const canGoBack = backHandler !== void 0 && !submitting;
|
|
1624
1710
|
return /* @__PURE__ */ jsx5(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx5(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx5(WithdrawStoreProvider, { store, children: /* @__PURE__ */ jsx5(
|
|
1625
1711
|
Modal,
|
|
1626
1712
|
{
|
|
@@ -1629,6 +1715,7 @@ function WithdrawModal({
|
|
|
1629
1715
|
className,
|
|
1630
1716
|
inline,
|
|
1631
1717
|
closeOnOverlayClick,
|
|
1718
|
+
ariaLabel: "Withdraw",
|
|
1632
1719
|
children: /* @__PURE__ */ jsx5(
|
|
1633
1720
|
AnalyticsSession,
|
|
1634
1721
|
{
|
|
@@ -1638,6 +1725,7 @@ function WithdrawModal({
|
|
|
1638
1725
|
backendUrl,
|
|
1639
1726
|
enableIngest: enableAnalyticsIngest,
|
|
1640
1727
|
ingestUrl: analyticsIngestUrl,
|
|
1728
|
+
sessionIdRef: analyticsSessionIdRef,
|
|
1641
1729
|
children: /* @__PURE__ */ jsx5(
|
|
1642
1730
|
WithdrawAnalyticsControllerProvider,
|
|
1643
1731
|
{
|
|
@@ -1654,16 +1742,25 @@ function WithdrawModal({
|
|
|
1654
1742
|
children: /* @__PURE__ */ jsx5(ChevronLeftIcon, {})
|
|
1655
1743
|
}
|
|
1656
1744
|
) }),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1745
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-modal-header-nav-right", children: [
|
|
1746
|
+
historyButtonVisible && historyRecipient && /* @__PURE__ */ jsx5(
|
|
1747
|
+
HistoryEntryButton,
|
|
1748
|
+
{
|
|
1749
|
+
badge: history.badge,
|
|
1750
|
+
onClick: history.openPanel
|
|
1751
|
+
}
|
|
1752
|
+
),
|
|
1753
|
+
/* @__PURE__ */ jsx5(
|
|
1754
|
+
"button",
|
|
1755
|
+
{
|
|
1756
|
+
type: "button",
|
|
1757
|
+
onClick: () => closeWithSource("header_button"),
|
|
1758
|
+
className: "rs-modal-close",
|
|
1759
|
+
"aria-label": "Close",
|
|
1760
|
+
children: /* @__PURE__ */ jsx5(CloseIcon, {})
|
|
1761
|
+
}
|
|
1762
|
+
)
|
|
1763
|
+
] })
|
|
1667
1764
|
] }),
|
|
1668
1765
|
/* @__PURE__ */ jsx5(
|
|
1669
1766
|
WithdrawFlow,
|
|
@@ -1680,10 +1777,32 @@ function WithdrawModal({
|
|
|
1680
1777
|
onSendTransaction,
|
|
1681
1778
|
onStepChange: handleStepChange,
|
|
1682
1779
|
onClose: closeWithSource,
|
|
1683
|
-
|
|
1780
|
+
onDestinationChange: setHistoryRecipient,
|
|
1781
|
+
onSubmittingChange: setSubmitting,
|
|
1782
|
+
onLifecycle: handleLifecycle,
|
|
1684
1783
|
onError,
|
|
1685
1784
|
debug
|
|
1686
1785
|
}
|
|
1786
|
+
),
|
|
1787
|
+
history.isPanelOpen && /* @__PURE__ */ jsx5(
|
|
1788
|
+
HistoryOverlay,
|
|
1789
|
+
{
|
|
1790
|
+
controller: history,
|
|
1791
|
+
backLabel: "Withdraw",
|
|
1792
|
+
title: "Deposit history",
|
|
1793
|
+
recipient: historyRecipient,
|
|
1794
|
+
backendUrl,
|
|
1795
|
+
service,
|
|
1796
|
+
signRecovery,
|
|
1797
|
+
debug,
|
|
1798
|
+
onCloseModal: () => closeWithSource("header_button"),
|
|
1799
|
+
analytics: historyAnalytics,
|
|
1800
|
+
inline,
|
|
1801
|
+
closeOnOverlayClick,
|
|
1802
|
+
enableAnalyticsIngest,
|
|
1803
|
+
analyticsIngestUrl,
|
|
1804
|
+
onEvent
|
|
1805
|
+
}
|
|
1687
1806
|
)
|
|
1688
1807
|
] })
|
|
1689
1808
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
|
|
4
4
|
|
|
5
5
|
// src/core/dapp-imports/polymarket/constants.ts
|
|
6
6
|
var POLYMARKET_POLYGON_CHAIN_ID = 137;
|
|
@@ -10,7 +10,7 @@ var POLYMARKET_USDCE_ADDRESS = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
|
|
|
10
10
|
var POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
|
|
11
11
|
var SAFE_MULTI_SEND_CALL_ONLY_ADDRESS = "0x40A2aCCbd92BCA938b02010E17A5b8929b49130D";
|
|
12
12
|
var GAMMA_API_PUBLIC_PROFILE = "https://gamma-api.polymarket.com/public-profile";
|
|
13
|
-
var POLYMARKET_ICON_URL =
|
|
13
|
+
var POLYMARKET_ICON_URL = _chunkOY5N3E6Lcjs.cdnIconUrl.call(void 0, "dapps", "polymarket");
|
|
14
14
|
|
|
15
15
|
// src/core/dapp-imports/polymarket/gamma-api.ts
|
|
16
16
|
var _viem = require('viem');
|