@rhinestone/deposit-modal 0.1.58 → 0.1.60
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-C3WPJW3E.mjs → DepositModalReown-S24YS35X.mjs} +1 -1
- package/dist/{DepositModalReown-KONUZXHJ.cjs → DepositModalReown-VP5E2JRC.cjs} +2 -2
- package/dist/{WithdrawModalReown-TUBSUJQ6.cjs → WithdrawModalReown-7JLR264N.cjs} +2 -2
- package/dist/{WithdrawModalReown-PFGUPZFN.mjs → WithdrawModalReown-Y2ETJQON.mjs} +1 -1
- package/dist/{chunk-3FEFGN7H.cjs → chunk-3CANBYBN.cjs} +56 -29
- package/dist/{chunk-VOGD6Y4U.mjs → chunk-6SM3IQKZ.mjs} +79 -6
- package/dist/{chunk-Z2TKNB6C.cjs → chunk-HX7LLE2V.cjs} +165 -92
- package/dist/{chunk-3ESBSOB7.mjs → chunk-JJMPCRKB.mjs} +29 -2
- 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/styles.css +4 -4
- package/dist/{types-CL7ec666.d.cts → types-7IoN8k-P.d.cts} +58 -1
- package/dist/{types-B7UuWCtD.d.ts → types-BLIqLF0c.d.ts} +58 -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 _chunkHX7LLE2Vcjs = require('./chunk-HX7LLE2V.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
|
+
_chunkHX7LLE2Vcjs.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 _chunk3CANBYBNcjs = require('./chunk-3CANBYBN.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
|
+
_chunk3CANBYBNcjs.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, totalBalanceUsd, targetChain, targetToken]);
|
|
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-7JLR264N.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
|
}
|
|
@@ -83,6 +83,7 @@ function SetupStep({
|
|
|
83
83
|
signerAddress,
|
|
84
84
|
sessionChainIds,
|
|
85
85
|
recipient,
|
|
86
|
+
postBridgeActions,
|
|
86
87
|
forceRegister,
|
|
87
88
|
enableSolana = true,
|
|
88
89
|
service,
|
|
@@ -149,7 +150,8 @@ function SetupStep({
|
|
|
149
150
|
target: {
|
|
150
151
|
chain: toEvmCaip2(targetChain),
|
|
151
152
|
token: targetToken,
|
|
152
|
-
...recipient && { recipient }
|
|
153
|
+
...recipient && { recipient },
|
|
154
|
+
...postBridgeActions?.length && { postBridgeActions }
|
|
153
155
|
}
|
|
154
156
|
});
|
|
155
157
|
setState({ type: "ready", smartAccount });
|
|
@@ -171,6 +173,7 @@ function SetupStep({
|
|
|
171
173
|
signerAddress,
|
|
172
174
|
sessionChainIds,
|
|
173
175
|
recipient,
|
|
176
|
+
postBridgeActions,
|
|
174
177
|
forceRegister,
|
|
175
178
|
enableSolana,
|
|
176
179
|
service,
|
|
@@ -551,7 +554,8 @@ function AmountStep({
|
|
|
551
554
|
uiConfig,
|
|
552
555
|
tokenPriceUsdOverride,
|
|
553
556
|
onBalanceUsdChange,
|
|
554
|
-
onContinue
|
|
557
|
+
onContinue,
|
|
558
|
+
onCtaClick
|
|
555
559
|
}) {
|
|
556
560
|
const [amount, setAmount] = useState3("");
|
|
557
561
|
const [balance, setBalance] = useState3(null);
|
|
@@ -655,6 +659,8 @@ function AmountStep({
|
|
|
655
659
|
}, [balance, asset.decimals]);
|
|
656
660
|
const handlePresetClick = (percentage) => {
|
|
657
661
|
if (balance === null) return;
|
|
662
|
+
const ctaName = percentage === 100 ? "Max" : `${percentage}%`;
|
|
663
|
+
onCtaClick?.(ctaName);
|
|
658
664
|
try {
|
|
659
665
|
const balanceUnits = Number(formatUnits2(balance, asset.decimals));
|
|
660
666
|
if (!Number.isFinite(balanceUnits)) return;
|
|
@@ -713,6 +719,7 @@ function AmountStep({
|
|
|
713
719
|
return;
|
|
714
720
|
}
|
|
715
721
|
setError(null);
|
|
722
|
+
onCtaClick?.("continue");
|
|
716
723
|
onContinue(tokenAmountStr, amount, balance ?? void 0);
|
|
717
724
|
};
|
|
718
725
|
return /* @__PURE__ */ jsxs3("div", { className: "rs-step", children: [
|
|
@@ -1455,6 +1462,7 @@ function DepositAddressStep({
|
|
|
1455
1462
|
service,
|
|
1456
1463
|
allowedRoutes,
|
|
1457
1464
|
onDepositDetected,
|
|
1465
|
+
onCopyAddress,
|
|
1458
1466
|
onError
|
|
1459
1467
|
}) {
|
|
1460
1468
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
@@ -1539,6 +1547,7 @@ function DepositAddressStep({
|
|
|
1539
1547
|
};
|
|
1540
1548
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1541
1549
|
const handleCopy = useCallback2(async () => {
|
|
1550
|
+
onCopyAddress?.();
|
|
1542
1551
|
try {
|
|
1543
1552
|
await navigator.clipboard.writeText(displayAddress);
|
|
1544
1553
|
setCopied(true);
|
|
@@ -1555,7 +1564,7 @@ function DepositAddressStep({
|
|
|
1555
1564
|
setCopied(true);
|
|
1556
1565
|
setTimeout(() => setCopied(false), 2e3);
|
|
1557
1566
|
}
|
|
1558
|
-
}, [displayAddress]);
|
|
1567
|
+
}, [displayAddress, onCopyAddress]);
|
|
1559
1568
|
useEffect6(() => {
|
|
1560
1569
|
setCopied(false);
|
|
1561
1570
|
setChainDropdownOpen(false);
|
|
@@ -2559,6 +2568,7 @@ function DepositFlow({
|
|
|
2559
2568
|
sourceToken: defaultSourceToken,
|
|
2560
2569
|
amount: defaultAmount,
|
|
2561
2570
|
recipient,
|
|
2571
|
+
postBridgeActions,
|
|
2562
2572
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
2563
2573
|
sessionChainIds,
|
|
2564
2574
|
forceRegister = false,
|
|
@@ -2578,6 +2588,7 @@ function DepositFlow({
|
|
|
2578
2588
|
onDepositSubmitted,
|
|
2579
2589
|
onDepositComplete,
|
|
2580
2590
|
onDepositFailed,
|
|
2591
|
+
onEvent,
|
|
2581
2592
|
onError,
|
|
2582
2593
|
debug
|
|
2583
2594
|
}) {
|
|
@@ -2907,6 +2918,32 @@ function DepositFlow({
|
|
|
2907
2918
|
useEffect9(() => {
|
|
2908
2919
|
onStepChange?.(stepIndex, currentBackHandler);
|
|
2909
2920
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
2921
|
+
useEffect9(() => {
|
|
2922
|
+
if (step.type === "select-asset") {
|
|
2923
|
+
onEvent?.({
|
|
2924
|
+
type: "deposit_modal_connected_wallet_select_source_open",
|
|
2925
|
+
total_balance_in_external_wallet: totalBalanceUsd,
|
|
2926
|
+
pred_balance: totalBalanceUsd
|
|
2927
|
+
});
|
|
2928
|
+
} else if (step.type === "deposit-address") {
|
|
2929
|
+
const chainName = getChainName(targetChain);
|
|
2930
|
+
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2931
|
+
onEvent?.({
|
|
2932
|
+
type: "deposit_modal_transfer_crypto_open",
|
|
2933
|
+
default_chain: chainName,
|
|
2934
|
+
default_token: tokenSymbol,
|
|
2935
|
+
pred_balance: totalBalanceUsd
|
|
2936
|
+
});
|
|
2937
|
+
} else if (step.type === "amount") {
|
|
2938
|
+
const receiveSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2939
|
+
onEvent?.({
|
|
2940
|
+
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
2941
|
+
send_token: step.asset.symbol,
|
|
2942
|
+
receive_token: receiveSymbol,
|
|
2943
|
+
pred_balance: totalBalanceUsd
|
|
2944
|
+
});
|
|
2945
|
+
}
|
|
2946
|
+
}, [step, onEvent, totalBalanceUsd, targetChain, targetToken]);
|
|
2910
2947
|
useEffect9(() => {
|
|
2911
2948
|
logFlow("state:changed", {
|
|
2912
2949
|
step: step.type,
|
|
@@ -3089,6 +3126,14 @@ function DepositFlow({
|
|
|
3089
3126
|
);
|
|
3090
3127
|
const handleAssetContinue = useCallback3(
|
|
3091
3128
|
(asset) => {
|
|
3129
|
+
onEvent?.({
|
|
3130
|
+
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
3131
|
+
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3132
|
+
pred_balance: totalBalanceUsd,
|
|
3133
|
+
cta_name: "token_selected",
|
|
3134
|
+
token_name: asset.symbol,
|
|
3135
|
+
token_balance: asset.balance ?? "0"
|
|
3136
|
+
});
|
|
3092
3137
|
setStep((prev) => {
|
|
3093
3138
|
if (prev.type !== "select-asset") return prev;
|
|
3094
3139
|
return {
|
|
@@ -3099,7 +3144,7 @@ function DepositFlow({
|
|
|
3099
3144
|
};
|
|
3100
3145
|
});
|
|
3101
3146
|
},
|
|
3102
|
-
[defaultAmount]
|
|
3147
|
+
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3103
3148
|
);
|
|
3104
3149
|
const handleAmountContinue = useCallback3(
|
|
3105
3150
|
(amount, targetAmount, balance) => {
|
|
@@ -3296,6 +3341,7 @@ function DepositFlow({
|
|
|
3296
3341
|
signerAddress,
|
|
3297
3342
|
sessionChainIds,
|
|
3298
3343
|
recipient,
|
|
3344
|
+
postBridgeActions,
|
|
3299
3345
|
forceRegister,
|
|
3300
3346
|
enableSolana,
|
|
3301
3347
|
service,
|
|
@@ -3312,6 +3358,17 @@ function DepositFlow({
|
|
|
3312
3358
|
service,
|
|
3313
3359
|
allowedRoutes,
|
|
3314
3360
|
onDepositDetected: handleDepositAddressDetected,
|
|
3361
|
+
onCopyAddress: () => {
|
|
3362
|
+
const chainName = getChainName(targetChain);
|
|
3363
|
+
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
3364
|
+
onEvent?.({
|
|
3365
|
+
type: "deposit_modal_transfer_crypto_cta_click",
|
|
3366
|
+
default_chain: chainName,
|
|
3367
|
+
default_token: tokenSymbol,
|
|
3368
|
+
pred_balance: totalBalanceUsd,
|
|
3369
|
+
cta_name: "copy"
|
|
3370
|
+
});
|
|
3371
|
+
},
|
|
3315
3372
|
onError: handleError
|
|
3316
3373
|
}
|
|
3317
3374
|
),
|
|
@@ -3354,6 +3411,7 @@ function DepositFlow({
|
|
|
3354
3411
|
signerAddress,
|
|
3355
3412
|
sessionChainIds,
|
|
3356
3413
|
recipient,
|
|
3414
|
+
postBridgeActions,
|
|
3357
3415
|
forceRegister,
|
|
3358
3416
|
enableSolana,
|
|
3359
3417
|
service,
|
|
@@ -3484,6 +3542,7 @@ function DepositFlow({
|
|
|
3484
3542
|
signerAddress,
|
|
3485
3543
|
sessionChainIds,
|
|
3486
3544
|
recipient,
|
|
3545
|
+
postBridgeActions,
|
|
3487
3546
|
forceRegister,
|
|
3488
3547
|
enableSolana,
|
|
3489
3548
|
service,
|
|
@@ -3518,7 +3577,17 @@ function DepositFlow({
|
|
|
3518
3577
|
targetChain,
|
|
3519
3578
|
targetToken,
|
|
3520
3579
|
uiConfig,
|
|
3521
|
-
onContinue: handleAmountContinue
|
|
3580
|
+
onContinue: handleAmountContinue,
|
|
3581
|
+
onCtaClick: (ctaName) => {
|
|
3582
|
+
const receiveSymbol = getTokenSymbol(targetToken, targetChain);
|
|
3583
|
+
onEvent?.({
|
|
3584
|
+
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
3585
|
+
send_token: step.asset.symbol,
|
|
3586
|
+
receive_token: receiveSymbol,
|
|
3587
|
+
pred_balance: totalBalanceUsd,
|
|
3588
|
+
cta_name: ctaName
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3522
3591
|
}
|
|
3523
3592
|
),
|
|
3524
3593
|
step.type === "confirm" && /* @__PURE__ */ jsx10(
|
|
@@ -3570,7 +3639,7 @@ function DepositFlow({
|
|
|
3570
3639
|
// src/DepositModal.tsx
|
|
3571
3640
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3572
3641
|
var ReownDepositInner = lazy(
|
|
3573
|
-
() => import("./DepositModalReown-
|
|
3642
|
+
() => import("./DepositModalReown-S24YS35X.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
3574
3643
|
);
|
|
3575
3644
|
function DepositModal(props) {
|
|
3576
3645
|
const needsReown = !!props.reownAppId;
|
|
@@ -3618,6 +3687,7 @@ function DepositModalInner({
|
|
|
3618
3687
|
forceRegister = false,
|
|
3619
3688
|
waitForFinalTx = true,
|
|
3620
3689
|
enableSolana = true,
|
|
3690
|
+
postBridgeActions,
|
|
3621
3691
|
reownWallet,
|
|
3622
3692
|
onConnect,
|
|
3623
3693
|
onDisconnect,
|
|
@@ -3633,6 +3703,7 @@ function DepositModalInner({
|
|
|
3633
3703
|
onDepositSubmitted,
|
|
3634
3704
|
onDepositComplete,
|
|
3635
3705
|
onDepositFailed,
|
|
3706
|
+
onEvent,
|
|
3636
3707
|
onError,
|
|
3637
3708
|
debug
|
|
3638
3709
|
}) {
|
|
@@ -3827,6 +3898,7 @@ function DepositModalInner({
|
|
|
3827
3898
|
sourceToken,
|
|
3828
3899
|
amount: defaultAmount,
|
|
3829
3900
|
recipient,
|
|
3901
|
+
postBridgeActions,
|
|
3830
3902
|
signerAddress,
|
|
3831
3903
|
sessionChainIds,
|
|
3832
3904
|
forceRegister,
|
|
@@ -3846,6 +3918,7 @@ function DepositModalInner({
|
|
|
3846
3918
|
onDepositSubmitted,
|
|
3847
3919
|
onDepositComplete,
|
|
3848
3920
|
onDepositFailed,
|
|
3921
|
+
onEvent,
|
|
3849
3922
|
onError,
|
|
3850
3923
|
debug
|
|
3851
3924
|
}
|