@rhinestone/deposit-modal 0.1.59 → 0.1.61
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-X3XPNZNZ.mjs → DepositModalReown-727JVH7Q.mjs} +1 -1
- package/dist/{DepositModalReown-DPCGEQT5.cjs → DepositModalReown-BKMRNZNX.cjs} +2 -2
- package/dist/{WithdrawModalReown-PFGUPZFN.mjs → WithdrawModalReown-OHTYDGI5.mjs} +1 -1
- package/dist/{WithdrawModalReown-TUBSUJQ6.cjs → WithdrawModalReown-ZNQPXAS6.cjs} +2 -2
- package/dist/{chunk-3FEFGN7H.cjs → chunk-C5TWF4ZE.cjs} +56 -29
- package/dist/{chunk-E4YPPHZF.mjs → chunk-IKTHUMGZ.mjs} +70 -5
- package/dist/{chunk-3ESBSOB7.mjs → chunk-RRYC5EZF.mjs} +29 -2
- package/dist/{chunk-M4QDXLIN.cjs → chunk-TBUOMWKJ.cjs} +145 -80
- package/dist/deposit.cjs +2 -2
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/reown.cjs +3 -3
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +2 -2
- package/dist/{types-Dp8Wj8Vt.d.cts → types-7IoN8k-P.d.cts} +51 -1
- package/dist/{types-CB9x9ab7.d.ts → types-BLIqLF0c.d.ts} +51 -1
- package/dist/withdraw.cjs +2 -2
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +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 _chunkTBUOMWKJcjs = require('./chunk-TBUOMWKJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ function DepositModalWithReown(props) {
|
|
|
32
32
|
reown.disconnect();
|
|
33
33
|
}, [reown.disconnect]);
|
|
34
34
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
-
|
|
35
|
+
_chunkTBUOMWKJcjs.DepositModalInner,
|
|
36
36
|
{
|
|
37
37
|
...props,
|
|
38
38
|
reownWallet: reownWithSolana,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkC5TWF4ZEcjs = require('./chunk-C5TWF4ZE.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ function WithdrawModalWithReown(props) {
|
|
|
20
20
|
reown.disconnect();
|
|
21
21
|
}, [reown.disconnect]);
|
|
22
22
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
|
|
23
|
+
_chunkC5TWF4ZEcjs.WithdrawModalInner,
|
|
24
24
|
{
|
|
25
25
|
...props,
|
|
26
26
|
reownWallet: reown,
|
|
@@ -901,6 +901,7 @@ function WithdrawFlow({
|
|
|
901
901
|
onWithdrawSubmitted,
|
|
902
902
|
onWithdrawComplete,
|
|
903
903
|
onWithdrawFailed,
|
|
904
|
+
onEvent,
|
|
904
905
|
onError,
|
|
905
906
|
debug
|
|
906
907
|
}) {
|
|
@@ -1037,6 +1038,18 @@ function WithdrawFlow({
|
|
|
1037
1038
|
_react.useEffect.call(void 0, () => {
|
|
1038
1039
|
_optionalChain([onStepChange, 'optionalCall', _20 => _20(stepIndex, currentBackHandler)]);
|
|
1039
1040
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1041
|
+
_react.useEffect.call(void 0, () => {
|
|
1042
|
+
if (step.type === "form") {
|
|
1043
|
+
const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1044
|
+
const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
|
|
1045
|
+
_optionalChain([onEvent, 'optionalCall', _21 => _21({
|
|
1046
|
+
type: "withdraw_modal_select_amount_open",
|
|
1047
|
+
pred_balance: totalBalanceUsd,
|
|
1048
|
+
default_token: tokenSymbol,
|
|
1049
|
+
default_chain: chainName
|
|
1050
|
+
})]);
|
|
1051
|
+
}
|
|
1052
|
+
}, [step.type, onEvent]);
|
|
1040
1053
|
_react.useEffect.call(void 0, () => {
|
|
1041
1054
|
logFlow("state:changed", {
|
|
1042
1055
|
step: step.type,
|
|
@@ -1056,19 +1069,19 @@ function WithdrawFlow({
|
|
|
1056
1069
|
targetToken
|
|
1057
1070
|
]);
|
|
1058
1071
|
_react.useEffect.call(void 0, () => {
|
|
1059
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
1072
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _22 => _22(totalBalanceUsd)]);
|
|
1060
1073
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1061
1074
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1062
1075
|
(addr, smartAccount) => {
|
|
1063
1076
|
logFlow("setup:connected", { address: addr, smartAccount });
|
|
1064
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1077
|
+
_optionalChain([onConnected, 'optionalCall', _23 => _23({ address: addr, smartAccount })]);
|
|
1065
1078
|
},
|
|
1066
1079
|
[logFlow, onConnected]
|
|
1067
1080
|
);
|
|
1068
1081
|
const handleError = _react.useCallback.call(void 0,
|
|
1069
1082
|
(message, code) => {
|
|
1070
1083
|
logFlowError("flow:error", message, { code });
|
|
1071
|
-
_optionalChain([onError, 'optionalCall',
|
|
1084
|
+
_optionalChain([onError, 'optionalCall', _24 => _24({ message, code })]);
|
|
1072
1085
|
},
|
|
1073
1086
|
[logFlowError, onError]
|
|
1074
1087
|
);
|
|
@@ -1089,11 +1102,21 @@ function WithdrawFlow({
|
|
|
1089
1102
|
}, []);
|
|
1090
1103
|
const handleFormSubmit = _react.useCallback.call(void 0,
|
|
1091
1104
|
async (recipient, amountValue) => {
|
|
1092
|
-
const
|
|
1105
|
+
const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1106
|
+
const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
|
|
1107
|
+
_optionalChain([onEvent, 'optionalCall', _25 => _25({
|
|
1108
|
+
type: "withdraw_modal_select_amount_cta_click",
|
|
1109
|
+
pred_balance: totalBalanceUsd,
|
|
1110
|
+
selected_token: tokenSymbol,
|
|
1111
|
+
selected_chain: chainName,
|
|
1112
|
+
amount: amountValue,
|
|
1113
|
+
cta_name: "withdraw"
|
|
1114
|
+
})]);
|
|
1115
|
+
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _26 => _26.ownerAddress]);
|
|
1093
1116
|
if (!ownerAddress2) {
|
|
1094
1117
|
throw new Error("Wallet not connected");
|
|
1095
1118
|
}
|
|
1096
|
-
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess',
|
|
1119
|
+
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _27 => _27.walletClient])) {
|
|
1097
1120
|
throw new Error("Wallet not connected");
|
|
1098
1121
|
}
|
|
1099
1122
|
setIsSubmitting(true);
|
|
@@ -1161,7 +1184,7 @@ function WithdrawFlow({
|
|
|
1161
1184
|
}
|
|
1162
1185
|
handleConnected(ownerAddress2, smartAccount);
|
|
1163
1186
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1164
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
1187
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _28 => _28.publicClient]), () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, sourceChain)));
|
|
1165
1188
|
let result;
|
|
1166
1189
|
if (onSignTransaction) {
|
|
1167
1190
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1220,7 +1243,7 @@ function WithdrawFlow({
|
|
|
1220
1243
|
sourceChain,
|
|
1221
1244
|
sourceToken
|
|
1222
1245
|
});
|
|
1223
|
-
_optionalChain([onWithdrawSubmitted, 'optionalCall',
|
|
1246
|
+
_optionalChain([onWithdrawSubmitted, 'optionalCall', _29 => _29({
|
|
1224
1247
|
txHash: result.txHash,
|
|
1225
1248
|
sourceChain,
|
|
1226
1249
|
amount: amountUnits.toString(),
|
|
@@ -1267,13 +1290,15 @@ function WithdrawFlow({
|
|
|
1267
1290
|
isSourceNative,
|
|
1268
1291
|
handleError,
|
|
1269
1292
|
logFlow,
|
|
1270
|
-
logFlowError
|
|
1293
|
+
logFlowError,
|
|
1294
|
+
onEvent,
|
|
1295
|
+
totalBalanceUsd
|
|
1271
1296
|
]
|
|
1272
1297
|
);
|
|
1273
1298
|
const handleWithdrawComplete = _react.useCallback.call(void 0,
|
|
1274
1299
|
(txHash, destinationTxHash, context) => {
|
|
1275
1300
|
logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
|
|
1276
|
-
_optionalChain([onWithdrawComplete, 'optionalCall',
|
|
1301
|
+
_optionalChain([onWithdrawComplete, 'optionalCall', _30 => _30({
|
|
1277
1302
|
txHash,
|
|
1278
1303
|
destinationTxHash,
|
|
1279
1304
|
amount: context.amount,
|
|
@@ -1288,17 +1313,17 @@ function WithdrawFlow({
|
|
|
1288
1313
|
const handleWithdrawFailed = _react.useCallback.call(void 0,
|
|
1289
1314
|
(txHash, error) => {
|
|
1290
1315
|
logFlowError("withdraw:failed", error, { txHash });
|
|
1291
|
-
_optionalChain([onWithdrawFailed, 'optionalCall',
|
|
1316
|
+
_optionalChain([onWithdrawFailed, 'optionalCall', _31 => _31({ txHash, error })]);
|
|
1292
1317
|
},
|
|
1293
1318
|
[logFlowError, onWithdrawFailed]
|
|
1294
1319
|
);
|
|
1295
1320
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1296
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1297
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1321
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _32 => _32.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1322
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _33 => _33.sourceChains])]
|
|
1298
1323
|
);
|
|
1299
1324
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1300
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1301
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1325
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _34 => _34.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1326
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _35 => _35.sourceTokens])]
|
|
1302
1327
|
);
|
|
1303
1328
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1304
1329
|
return _chunkR6U6BHCVcjs.SOURCE_CHAINS.filter((chain) => {
|
|
@@ -1367,14 +1392,14 @@ function WithdrawFlow({
|
|
|
1367
1392
|
setIsConnectSelectionConfirmed(false);
|
|
1368
1393
|
}
|
|
1369
1394
|
}, [showConnectStep, isConnectSelectionConfirmed, signerContext]);
|
|
1370
|
-
const ownerAddress = _optionalChain([signerContext, 'optionalAccess',
|
|
1395
|
+
const ownerAddress = _optionalChain([signerContext, 'optionalAccess', _36 => _36.ownerAddress]);
|
|
1371
1396
|
const selectedWalletIcon = _react.useMemo.call(void 0, () => {
|
|
1372
|
-
if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess',
|
|
1397
|
+
if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess', _37 => _37.icon]);
|
|
1373
1398
|
const selected = walletOptions.find(
|
|
1374
|
-
(o) => _optionalChain([o, 'access',
|
|
1399
|
+
(o) => _optionalChain([o, 'access', _38 => _38.address, 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40()]) === ownerAddress.toLowerCase()
|
|
1375
1400
|
);
|
|
1376
|
-
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess',
|
|
1377
|
-
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess',
|
|
1401
|
+
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _41 => _41.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _42 => _42.icon])));
|
|
1402
|
+
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _43 => _43.icon])]);
|
|
1378
1403
|
if (showConnectStep) {
|
|
1379
1404
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1380
1405
|
_chunkTQ6IIGRScjs.ConnectStep,
|
|
@@ -1398,7 +1423,7 @@ function WithdrawFlow({
|
|
|
1398
1423
|
if (!signerContext) return null;
|
|
1399
1424
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1400
1425
|
const resolvedOwnerAddress = signerContext.ownerAddress;
|
|
1401
|
-
const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
1426
|
+
const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _44 => _44.walletClient, 'optionalAccess', _45 => _45.account, 'optionalAccess', _46 => _46.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _47 => _47.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _48 => _48.account, 'optionalAccess', _49 => _49.address]))), () => ( resolvedOwnerAddress));
|
|
1402
1427
|
const resolvedDefaultRecipient = _nullishCoalesce(defaultRecipient, () => ( resolvedConnectedAddress));
|
|
1403
1428
|
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, sourceChain)));
|
|
1404
1429
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
@@ -1453,7 +1478,7 @@ function WithdrawFlow({
|
|
|
1453
1478
|
// src/WithdrawModal.tsx
|
|
1454
1479
|
|
|
1455
1480
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1456
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1481
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-ZNQPXAS6.cjs"))).then((m) => ({
|
|
1457
1482
|
default: m.WithdrawModalReown
|
|
1458
1483
|
}))
|
|
1459
1484
|
);
|
|
@@ -1501,6 +1526,7 @@ function WithdrawModalInner({
|
|
|
1501
1526
|
onWithdrawSubmitted,
|
|
1502
1527
|
onWithdrawComplete,
|
|
1503
1528
|
onWithdrawFailed,
|
|
1529
|
+
onEvent,
|
|
1504
1530
|
onError,
|
|
1505
1531
|
debug
|
|
1506
1532
|
}) {
|
|
@@ -1523,7 +1549,7 @@ function WithdrawModalInner({
|
|
|
1523
1549
|
_react.useEffect.call(void 0, () => {
|
|
1524
1550
|
if (isOpen && !hasCalledReady.current) {
|
|
1525
1551
|
hasCalledReady.current = true;
|
|
1526
|
-
_optionalChain([onReady, 'optionalCall',
|
|
1552
|
+
_optionalChain([onReady, 'optionalCall', _50 => _50()]);
|
|
1527
1553
|
}
|
|
1528
1554
|
}, [isOpen, onReady]);
|
|
1529
1555
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1542,14 +1568,14 @@ function WithdrawModalInner({
|
|
|
1542
1568
|
setTotalBalanceUsd(balance2);
|
|
1543
1569
|
}, []);
|
|
1544
1570
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
1545
|
-
_optionalChain([backHandlerRef, 'access',
|
|
1571
|
+
_optionalChain([backHandlerRef, 'access', _51 => _51.current, 'optionalCall', _52 => _52()]);
|
|
1546
1572
|
}, []);
|
|
1547
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1548
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1549
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1550
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
1551
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1552
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1573
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _53 => _53.showLogo]), () => ( false));
|
|
1574
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _54 => _54.showStepper]), () => ( false));
|
|
1575
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _55 => _55.showBackButton]), () => ( true));
|
|
1576
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _56 => _56.balance]);
|
|
1577
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _57 => _57.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
1578
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _58 => _58.title]), () => ( "Withdraw"));
|
|
1553
1579
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1554
1580
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1555
1581
|
_chunkTQ6IIGRScjs.Modal,
|
|
@@ -1673,6 +1699,7 @@ function WithdrawModalInner({
|
|
|
1673
1699
|
onWithdrawSubmitted,
|
|
1674
1700
|
onWithdrawComplete,
|
|
1675
1701
|
onWithdrawFailed,
|
|
1702
|
+
onEvent,
|
|
1676
1703
|
onError,
|
|
1677
1704
|
debug
|
|
1678
1705
|
}
|
|
@@ -554,7 +554,8 @@ function AmountStep({
|
|
|
554
554
|
uiConfig,
|
|
555
555
|
tokenPriceUsdOverride,
|
|
556
556
|
onBalanceUsdChange,
|
|
557
|
-
onContinue
|
|
557
|
+
onContinue,
|
|
558
|
+
onCtaClick
|
|
558
559
|
}) {
|
|
559
560
|
const [amount, setAmount] = useState3("");
|
|
560
561
|
const [balance, setBalance] = useState3(null);
|
|
@@ -658,6 +659,8 @@ function AmountStep({
|
|
|
658
659
|
}, [balance, asset.decimals]);
|
|
659
660
|
const handlePresetClick = (percentage) => {
|
|
660
661
|
if (balance === null) return;
|
|
662
|
+
const ctaName = percentage === 100 ? "Max" : `${percentage}%`;
|
|
663
|
+
onCtaClick?.(ctaName);
|
|
661
664
|
try {
|
|
662
665
|
const balanceUnits = Number(formatUnits2(balance, asset.decimals));
|
|
663
666
|
if (!Number.isFinite(balanceUnits)) return;
|
|
@@ -716,6 +719,7 @@ function AmountStep({
|
|
|
716
719
|
return;
|
|
717
720
|
}
|
|
718
721
|
setError(null);
|
|
722
|
+
onCtaClick?.("continue");
|
|
719
723
|
onContinue(tokenAmountStr, amount, balance ?? void 0);
|
|
720
724
|
};
|
|
721
725
|
return /* @__PURE__ */ jsxs3("div", { className: "rs-step", children: [
|
|
@@ -1458,6 +1462,7 @@ function DepositAddressStep({
|
|
|
1458
1462
|
service,
|
|
1459
1463
|
allowedRoutes,
|
|
1460
1464
|
onDepositDetected,
|
|
1465
|
+
onCopyAddress,
|
|
1461
1466
|
onError
|
|
1462
1467
|
}) {
|
|
1463
1468
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
@@ -1542,6 +1547,7 @@ function DepositAddressStep({
|
|
|
1542
1547
|
};
|
|
1543
1548
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1544
1549
|
const handleCopy = useCallback2(async () => {
|
|
1550
|
+
onCopyAddress?.();
|
|
1545
1551
|
try {
|
|
1546
1552
|
await navigator.clipboard.writeText(displayAddress);
|
|
1547
1553
|
setCopied(true);
|
|
@@ -1558,7 +1564,7 @@ function DepositAddressStep({
|
|
|
1558
1564
|
setCopied(true);
|
|
1559
1565
|
setTimeout(() => setCopied(false), 2e3);
|
|
1560
1566
|
}
|
|
1561
|
-
}, [displayAddress]);
|
|
1567
|
+
}, [displayAddress, onCopyAddress]);
|
|
1562
1568
|
useEffect6(() => {
|
|
1563
1569
|
setCopied(false);
|
|
1564
1570
|
setChainDropdownOpen(false);
|
|
@@ -2582,6 +2588,7 @@ function DepositFlow({
|
|
|
2582
2588
|
onDepositSubmitted,
|
|
2583
2589
|
onDepositComplete,
|
|
2584
2590
|
onDepositFailed,
|
|
2591
|
+
onEvent,
|
|
2585
2592
|
onError,
|
|
2586
2593
|
debug
|
|
2587
2594
|
}) {
|
|
@@ -2911,6 +2918,33 @@ function DepositFlow({
|
|
|
2911
2918
|
useEffect9(() => {
|
|
2912
2919
|
onStepChange?.(stepIndex, currentBackHandler);
|
|
2913
2920
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
2921
|
+
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
2922
|
+
useEffect9(() => {
|
|
2923
|
+
if (step.type === "select-asset") {
|
|
2924
|
+
onEvent?.({
|
|
2925
|
+
type: "deposit_modal_connected_wallet_select_source_open",
|
|
2926
|
+
total_balance_in_external_wallet: totalBalanceUsd,
|
|
2927
|
+
pred_balance: totalBalanceUsd
|
|
2928
|
+
});
|
|
2929
|
+
} else if (step.type === "deposit-address") {
|
|
2930
|
+
const chainName = getChainName(targetChain);
|
|
2931
|
+
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2932
|
+
onEvent?.({
|
|
2933
|
+
type: "deposit_modal_transfer_crypto_open",
|
|
2934
|
+
default_chain: chainName,
|
|
2935
|
+
default_token: tokenSymbol,
|
|
2936
|
+
pred_balance: totalBalanceUsd
|
|
2937
|
+
});
|
|
2938
|
+
} else if (step.type === "amount" && stepSendToken) {
|
|
2939
|
+
const receiveSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2940
|
+
onEvent?.({
|
|
2941
|
+
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
2942
|
+
send_token: stepSendToken,
|
|
2943
|
+
receive_token: receiveSymbol,
|
|
2944
|
+
pred_balance: totalBalanceUsd
|
|
2945
|
+
});
|
|
2946
|
+
}
|
|
2947
|
+
}, [step.type, stepSendToken, onEvent]);
|
|
2914
2948
|
useEffect9(() => {
|
|
2915
2949
|
logFlow("state:changed", {
|
|
2916
2950
|
step: step.type,
|
|
@@ -3093,6 +3127,14 @@ function DepositFlow({
|
|
|
3093
3127
|
);
|
|
3094
3128
|
const handleAssetContinue = useCallback3(
|
|
3095
3129
|
(asset) => {
|
|
3130
|
+
onEvent?.({
|
|
3131
|
+
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
3132
|
+
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3133
|
+
pred_balance: totalBalanceUsd,
|
|
3134
|
+
cta_name: "token_selected",
|
|
3135
|
+
token_name: asset.symbol,
|
|
3136
|
+
token_balance: asset.balance ?? "0"
|
|
3137
|
+
});
|
|
3096
3138
|
setStep((prev) => {
|
|
3097
3139
|
if (prev.type !== "select-asset") return prev;
|
|
3098
3140
|
return {
|
|
@@ -3103,7 +3145,7 @@ function DepositFlow({
|
|
|
3103
3145
|
};
|
|
3104
3146
|
});
|
|
3105
3147
|
},
|
|
3106
|
-
[defaultAmount]
|
|
3148
|
+
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3107
3149
|
);
|
|
3108
3150
|
const handleAmountContinue = useCallback3(
|
|
3109
3151
|
(amount, targetAmount, balance) => {
|
|
@@ -3317,6 +3359,17 @@ function DepositFlow({
|
|
|
3317
3359
|
service,
|
|
3318
3360
|
allowedRoutes,
|
|
3319
3361
|
onDepositDetected: handleDepositAddressDetected,
|
|
3362
|
+
onCopyAddress: () => {
|
|
3363
|
+
const chainName = getChainName(targetChain);
|
|
3364
|
+
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
3365
|
+
onEvent?.({
|
|
3366
|
+
type: "deposit_modal_transfer_crypto_cta_click",
|
|
3367
|
+
default_chain: chainName,
|
|
3368
|
+
default_token: tokenSymbol,
|
|
3369
|
+
pred_balance: totalBalanceUsd,
|
|
3370
|
+
cta_name: "copy"
|
|
3371
|
+
});
|
|
3372
|
+
},
|
|
3320
3373
|
onError: handleError
|
|
3321
3374
|
}
|
|
3322
3375
|
),
|
|
@@ -3525,7 +3578,17 @@ function DepositFlow({
|
|
|
3525
3578
|
targetChain,
|
|
3526
3579
|
targetToken,
|
|
3527
3580
|
uiConfig,
|
|
3528
|
-
onContinue: handleAmountContinue
|
|
3581
|
+
onContinue: handleAmountContinue,
|
|
3582
|
+
onCtaClick: (ctaName) => {
|
|
3583
|
+
const receiveSymbol = getTokenSymbol(targetToken, targetChain);
|
|
3584
|
+
onEvent?.({
|
|
3585
|
+
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
3586
|
+
send_token: step.asset.symbol,
|
|
3587
|
+
receive_token: receiveSymbol,
|
|
3588
|
+
pred_balance: totalBalanceUsd,
|
|
3589
|
+
cta_name: ctaName
|
|
3590
|
+
});
|
|
3591
|
+
}
|
|
3529
3592
|
}
|
|
3530
3593
|
),
|
|
3531
3594
|
step.type === "confirm" && /* @__PURE__ */ jsx10(
|
|
@@ -3577,7 +3640,7 @@ function DepositFlow({
|
|
|
3577
3640
|
// src/DepositModal.tsx
|
|
3578
3641
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3579
3642
|
var ReownDepositInner = lazy(
|
|
3580
|
-
() => import("./DepositModalReown-
|
|
3643
|
+
() => import("./DepositModalReown-727JVH7Q.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
3581
3644
|
);
|
|
3582
3645
|
function DepositModal(props) {
|
|
3583
3646
|
const needsReown = !!props.reownAppId;
|
|
@@ -3641,6 +3704,7 @@ function DepositModalInner({
|
|
|
3641
3704
|
onDepositSubmitted,
|
|
3642
3705
|
onDepositComplete,
|
|
3643
3706
|
onDepositFailed,
|
|
3707
|
+
onEvent,
|
|
3644
3708
|
onError,
|
|
3645
3709
|
debug
|
|
3646
3710
|
}) {
|
|
@@ -3855,6 +3919,7 @@ function DepositModalInner({
|
|
|
3855
3919
|
onDepositSubmitted,
|
|
3856
3920
|
onDepositComplete,
|
|
3857
3921
|
onDepositFailed,
|
|
3922
|
+
onEvent,
|
|
3858
3923
|
onError,
|
|
3859
3924
|
debug
|
|
3860
3925
|
}
|
|
@@ -901,6 +901,7 @@ function WithdrawFlow({
|
|
|
901
901
|
onWithdrawSubmitted,
|
|
902
902
|
onWithdrawComplete,
|
|
903
903
|
onWithdrawFailed,
|
|
904
|
+
onEvent,
|
|
904
905
|
onError,
|
|
905
906
|
debug
|
|
906
907
|
}) {
|
|
@@ -1037,6 +1038,18 @@ function WithdrawFlow({
|
|
|
1037
1038
|
useEffect2(() => {
|
|
1038
1039
|
onStepChange?.(stepIndex, currentBackHandler);
|
|
1039
1040
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1041
|
+
useEffect2(() => {
|
|
1042
|
+
if (step.type === "form") {
|
|
1043
|
+
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
1044
|
+
const chainName = getChainName(targetChain);
|
|
1045
|
+
onEvent?.({
|
|
1046
|
+
type: "withdraw_modal_select_amount_open",
|
|
1047
|
+
pred_balance: totalBalanceUsd,
|
|
1048
|
+
default_token: tokenSymbol,
|
|
1049
|
+
default_chain: chainName
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
}, [step.type, onEvent]);
|
|
1040
1053
|
useEffect2(() => {
|
|
1041
1054
|
logFlow("state:changed", {
|
|
1042
1055
|
step: step.type,
|
|
@@ -1089,6 +1102,16 @@ function WithdrawFlow({
|
|
|
1089
1102
|
}, []);
|
|
1090
1103
|
const handleFormSubmit = useCallback2(
|
|
1091
1104
|
async (recipient, amountValue) => {
|
|
1105
|
+
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
1106
|
+
const chainName = getChainName(targetChain);
|
|
1107
|
+
onEvent?.({
|
|
1108
|
+
type: "withdraw_modal_select_amount_cta_click",
|
|
1109
|
+
pred_balance: totalBalanceUsd,
|
|
1110
|
+
selected_token: tokenSymbol,
|
|
1111
|
+
selected_chain: chainName,
|
|
1112
|
+
amount: amountValue,
|
|
1113
|
+
cta_name: "withdraw"
|
|
1114
|
+
});
|
|
1092
1115
|
const ownerAddress2 = signerContext?.ownerAddress;
|
|
1093
1116
|
if (!ownerAddress2) {
|
|
1094
1117
|
throw new Error("Wallet not connected");
|
|
@@ -1267,7 +1290,9 @@ function WithdrawFlow({
|
|
|
1267
1290
|
isSourceNative,
|
|
1268
1291
|
handleError,
|
|
1269
1292
|
logFlow,
|
|
1270
|
-
logFlowError
|
|
1293
|
+
logFlowError,
|
|
1294
|
+
onEvent,
|
|
1295
|
+
totalBalanceUsd
|
|
1271
1296
|
]
|
|
1272
1297
|
);
|
|
1273
1298
|
const handleWithdrawComplete = useCallback2(
|
|
@@ -1453,7 +1478,7 @@ function WithdrawFlow({
|
|
|
1453
1478
|
// src/WithdrawModal.tsx
|
|
1454
1479
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1455
1480
|
var ReownWithdrawInner = lazy(
|
|
1456
|
-
() => import("./WithdrawModalReown-
|
|
1481
|
+
() => import("./WithdrawModalReown-OHTYDGI5.mjs").then((m) => ({
|
|
1457
1482
|
default: m.WithdrawModalReown
|
|
1458
1483
|
}))
|
|
1459
1484
|
);
|
|
@@ -1501,6 +1526,7 @@ function WithdrawModalInner({
|
|
|
1501
1526
|
onWithdrawSubmitted,
|
|
1502
1527
|
onWithdrawComplete,
|
|
1503
1528
|
onWithdrawFailed,
|
|
1529
|
+
onEvent,
|
|
1504
1530
|
onError,
|
|
1505
1531
|
debug
|
|
1506
1532
|
}) {
|
|
@@ -1673,6 +1699,7 @@ function WithdrawModalInner({
|
|
|
1673
1699
|
onWithdrawSubmitted,
|
|
1674
1700
|
onWithdrawComplete,
|
|
1675
1701
|
onWithdrawFailed,
|
|
1702
|
+
onEvent,
|
|
1676
1703
|
onError,
|
|
1677
1704
|
debug
|
|
1678
1705
|
}
|