@rhinestone/deposit-modal 0.3.0-alpha.14 → 0.3.0-alpha.16
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-4I47KSPN.cjs → DepositModalReown-QRLLANTS.cjs} +7 -7
- package/dist/{DepositModalReown-DIUIB3MU.mjs → DepositModalReown-THU2QG76.mjs} +4 -4
- package/dist/{WithdrawModalReown-Y3NRAKXJ.cjs → WithdrawModalReown-PHWLYDZQ.cjs} +7 -7
- package/dist/{WithdrawModalReown-WRUEALDP.mjs → WithdrawModalReown-SSRJNUGZ.mjs} +4 -4
- package/dist/{constants-DqVn968d.d.ts → caip-CrQ2KKU-.d.cts} +11 -1
- package/dist/{constants-DqVn968d.d.cts → caip-CrQ2KKU-.d.ts} +11 -1
- package/dist/{chunk-SZIYS42B.mjs → chunk-6YRDD462.mjs} +63 -3
- package/dist/{chunk-N4XRQPVA.cjs → chunk-7W5M6WEE.cjs} +226 -203
- package/dist/{chunk-JTMGFWXO.mjs → chunk-E2K7XWMN.mjs} +2 -2
- package/dist/{chunk-2NUXDEEO.cjs → chunk-G5YDICEN.cjs} +93 -93
- package/dist/{chunk-7JIDIX27.cjs → chunk-MILJQWPT.cjs} +73 -13
- package/dist/{chunk-VD4WTEHP.mjs → chunk-PAK3NUGY.mjs} +5 -5
- package/dist/{chunk-3CYGTYMY.cjs → chunk-PXQBJMNF.cjs} +526 -451
- package/dist/{chunk-JTULAFMU.cjs → chunk-UD6QUZJS.cjs} +5 -5
- package/dist/{chunk-XG474KUR.mjs → chunk-YX3I7C2R.mjs} +101 -26
- package/dist/{chunk-4ZN726P5.mjs → chunk-Z7OJPEV2.mjs} +258 -235
- package/dist/constants.cjs +6 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +5 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +9 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +8 -4
- package/dist/{types-C8i2ebY1.d.cts → types-cXr3j4NV.d.cts} +26 -0
- package/dist/{types-C8i2ebY1.d.ts → types-cXr3j4NV.d.ts} +26 -0
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7W5M6WEEcjs = require('./chunk-7W5M6WEE.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkMILJQWPTcjs = require('./chunk-MILJQWPT.cjs');
|
|
8
8
|
|
|
9
9
|
// src/core/reown.tsx
|
|
10
10
|
var _react = require('react');
|
|
@@ -45,7 +45,7 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
45
45
|
[_networks.soneium.id]: _networks.soneium,
|
|
46
46
|
[_networks.plasma.id]: _networks.plasma
|
|
47
47
|
};
|
|
48
|
-
var EVM_NETWORKS =
|
|
48
|
+
var EVM_NETWORKS = _chunkMILJQWPTcjs.SUPPORTED_CHAINS.map((chain) => {
|
|
49
49
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|
|
50
50
|
if (!network) {
|
|
51
51
|
throw new Error(
|
|
@@ -145,9 +145,9 @@ function useReownWallet() {
|
|
|
145
145
|
await switchChainAsync({ chainId });
|
|
146
146
|
}
|
|
147
147
|
} catch (err) {
|
|
148
|
-
if (
|
|
148
|
+
if (_chunk7W5M6WEEcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
149
149
|
throw new Error(
|
|
150
|
-
`Switch to ${
|
|
150
|
+
`Switch to ${_chunkMILJQWPTcjs.getChainName.call(void 0, chainId)} in your wallet to continue`
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
throw err;
|
|
@@ -39,26 +39,27 @@ import {
|
|
|
39
39
|
getAssetId,
|
|
40
40
|
getEventSourceDetails,
|
|
41
41
|
getEventTxHash,
|
|
42
|
+
getHyperEvmReadClient,
|
|
42
43
|
getPublicClient,
|
|
43
44
|
isDepositEvent,
|
|
44
45
|
isFailedEvent,
|
|
45
46
|
isNativeAsset,
|
|
46
|
-
isSolanaCaip2,
|
|
47
47
|
loadSessionOwnerFromStorage,
|
|
48
|
-
parseEvmChainId,
|
|
49
48
|
portfolioToAssets,
|
|
50
49
|
saveSessionOwnerToStorage,
|
|
51
|
-
targetChainToCaip2,
|
|
52
50
|
tokenFormatter,
|
|
53
51
|
txRefsMatch,
|
|
54
52
|
useLatestRef
|
|
55
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-Z7OJPEV2.mjs";
|
|
56
54
|
import {
|
|
57
55
|
DEFAULT_BACKEND_URL,
|
|
58
56
|
DEFAULT_SIGNER_ADDRESS,
|
|
57
|
+
HYPERCORE_CHAIN_ID,
|
|
58
|
+
HYPERCORE_MIN_DEPOSIT_USD,
|
|
59
59
|
NATIVE_TOKEN_ADDRESS,
|
|
60
60
|
SOLANA_TOKENS,
|
|
61
61
|
SOURCE_CHAINS,
|
|
62
|
+
findTokenDecimals,
|
|
62
63
|
getChainBadge,
|
|
63
64
|
getChainIcon,
|
|
64
65
|
getChainId,
|
|
@@ -72,9 +73,14 @@ import {
|
|
|
72
73
|
getTokenDecimalsByAddress,
|
|
73
74
|
getTokenIcon,
|
|
74
75
|
getTokenSymbol,
|
|
76
|
+
isContractBytecode,
|
|
75
77
|
isNativeSol,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
isSolanaCaip2,
|
|
79
|
+
isStablecoinSymbol,
|
|
80
|
+
isVirtualDestination,
|
|
81
|
+
parseEvmChainId,
|
|
82
|
+
targetChainToCaip2
|
|
83
|
+
} from "./chunk-6YRDD462.mjs";
|
|
78
84
|
|
|
79
85
|
// src/DepositModal.tsx
|
|
80
86
|
import {
|
|
@@ -86,6 +92,7 @@ import {
|
|
|
86
92
|
lazy as lazy2,
|
|
87
93
|
Suspense as Suspense2
|
|
88
94
|
} from "react";
|
|
95
|
+
import { isAddress as isAddress2 } from "viem";
|
|
89
96
|
|
|
90
97
|
// src/DepositFlow.tsx
|
|
91
98
|
import {
|
|
@@ -625,7 +632,7 @@ function AmountStep({
|
|
|
625
632
|
return null;
|
|
626
633
|
}
|
|
627
634
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
|
|
628
|
-
const minDepositUsd = uiConfig?.minDepositUsd ?? null;
|
|
635
|
+
const minDepositUsd = targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? null;
|
|
629
636
|
const maxDepositUsd = uiConfig?.maxDepositUsd ?? null;
|
|
630
637
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
|
|
631
638
|
const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
|
|
@@ -795,6 +802,7 @@ function AmountStep({
|
|
|
795
802
|
/* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
796
803
|
] })
|
|
797
804
|
] }),
|
|
805
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx3(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
798
806
|
error && /* @__PURE__ */ jsx3(Callout, { variant: "error", children: error }),
|
|
799
807
|
/* @__PURE__ */ jsx3(
|
|
800
808
|
Button,
|
|
@@ -1012,6 +1020,7 @@ function ConfirmStep({
|
|
|
1012
1020
|
] })
|
|
1013
1021
|
] })
|
|
1014
1022
|
] }),
|
|
1023
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx4(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
1015
1024
|
error && /* @__PURE__ */ jsx4(Callout, { variant: "error", children: error }),
|
|
1016
1025
|
/* @__PURE__ */ jsx4(
|
|
1017
1026
|
Button,
|
|
@@ -1113,7 +1122,15 @@ function DepositNotification({
|
|
|
1113
1122
|
onFailed,
|
|
1114
1123
|
onDismiss
|
|
1115
1124
|
}) {
|
|
1116
|
-
const {
|
|
1125
|
+
const {
|
|
1126
|
+
txHash,
|
|
1127
|
+
sourceChain,
|
|
1128
|
+
amount,
|
|
1129
|
+
token,
|
|
1130
|
+
sourceDecimals,
|
|
1131
|
+
detectedAt,
|
|
1132
|
+
directTransfer
|
|
1133
|
+
} = deposit;
|
|
1117
1134
|
const [status, setStatus] = useState4(
|
|
1118
1135
|
directTransfer ? "complete" : "processing"
|
|
1119
1136
|
);
|
|
@@ -1131,6 +1148,7 @@ function DepositNotification({
|
|
|
1131
1148
|
amount,
|
|
1132
1149
|
sourceChain,
|
|
1133
1150
|
sourceToken: token,
|
|
1151
|
+
sourceDecimals,
|
|
1134
1152
|
targetChain,
|
|
1135
1153
|
targetToken,
|
|
1136
1154
|
hasPostBridgeActions
|
|
@@ -1149,6 +1167,7 @@ function DepositNotification({
|
|
|
1149
1167
|
amount: context.amount,
|
|
1150
1168
|
sourceChain: context.sourceChain,
|
|
1151
1169
|
sourceToken: context.sourceToken,
|
|
1170
|
+
sourceDecimals: context.sourceDecimals,
|
|
1152
1171
|
targetChain: context.targetChain,
|
|
1153
1172
|
targetToken: context.targetToken
|
|
1154
1173
|
});
|
|
@@ -1662,10 +1681,13 @@ function DepositAddressStep({
|
|
|
1662
1681
|
const amount = details.amount ?? "0";
|
|
1663
1682
|
const token = details.token;
|
|
1664
1683
|
const sourceSymbol = details.sourceSymbol;
|
|
1665
|
-
const sourceDecimals = details.sourceDecimals;
|
|
1666
1684
|
baselineTxHashRef.current = eventTxHash;
|
|
1667
1685
|
isTrackingRef.current = true;
|
|
1668
1686
|
const isEvmToken = token ? /^0x[a-fA-F0-9]{40}$/.test(token) : false;
|
|
1687
|
+
const sourceDecimals = details.sourceDecimals ?? (isEvmToken ? findTokenDecimals(
|
|
1688
|
+
token,
|
|
1689
|
+
typeof chainId === "number" ? chainId : void 0
|
|
1690
|
+
) : void 0);
|
|
1669
1691
|
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
|
|
1670
1692
|
chainId,
|
|
1671
1693
|
token,
|
|
@@ -1688,7 +1710,8 @@ function DepositAddressStep({
|
|
|
1688
1710
|
onDepositSubmittedRef.current?.({
|
|
1689
1711
|
txHash: eventTxHash,
|
|
1690
1712
|
sourceChain: chainId,
|
|
1691
|
-
amount
|
|
1713
|
+
amount,
|
|
1714
|
+
sourceDecimals
|
|
1692
1715
|
});
|
|
1693
1716
|
}
|
|
1694
1717
|
setPollingError(null);
|
|
@@ -1783,7 +1806,7 @@ function DepositAddressStep({
|
|
|
1783
1806
|
/* @__PURE__ */ jsx6("span", { children: "Supported token" }),
|
|
1784
1807
|
/* @__PURE__ */ jsxs6("span", { className: "rs-deposit-address-min", children: [
|
|
1785
1808
|
"Min.$",
|
|
1786
|
-
(uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
1809
|
+
(targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
1787
1810
|
/* @__PURE__ */ jsx6(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx6(
|
|
1788
1811
|
InfoIcon,
|
|
1789
1812
|
{
|
|
@@ -1872,6 +1895,7 @@ function DepositAddressStep({
|
|
|
1872
1895
|
]
|
|
1873
1896
|
}
|
|
1874
1897
|
),
|
|
1898
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx6(Callout, { variant: "warning", children: "HyperCore's first deposit to a new account includes a ~1 USDC activation fee \u2014 send at least 1 USDC or it will fail." }),
|
|
1875
1899
|
/* @__PURE__ */ jsxs6(
|
|
1876
1900
|
"div",
|
|
1877
1901
|
{
|
|
@@ -2970,6 +2994,7 @@ function SolanaAmountStep({
|
|
|
2970
2994
|
balanceUsd,
|
|
2971
2995
|
defaultAmount,
|
|
2972
2996
|
uiConfig,
|
|
2997
|
+
targetChain,
|
|
2973
2998
|
targetChainName,
|
|
2974
2999
|
targetTokenSymbol,
|
|
2975
3000
|
targetTokenIcon,
|
|
@@ -3083,7 +3108,7 @@ function SolanaAmountStep({
|
|
|
3083
3108
|
return null;
|
|
3084
3109
|
}
|
|
3085
3110
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
|
|
3086
|
-
const minDepositUsd = uiConfig?.minDepositUsd ?? null;
|
|
3111
|
+
const minDepositUsd = targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? null;
|
|
3087
3112
|
const maxDepositUsd = uiConfig?.maxDepositUsd ?? null;
|
|
3088
3113
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
|
|
3089
3114
|
const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
|
|
@@ -3226,6 +3251,7 @@ function SolanaAmountStep({
|
|
|
3226
3251
|
/* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
3227
3252
|
] })
|
|
3228
3253
|
] }),
|
|
3254
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx14(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
3229
3255
|
error && /* @__PURE__ */ jsx14(Callout, { variant: "error", children: error }),
|
|
3230
3256
|
/* @__PURE__ */ jsx14(
|
|
3231
3257
|
Button,
|
|
@@ -4577,7 +4603,11 @@ function applyAction(state, action) {
|
|
|
4577
4603
|
sourceChain: action.sourceChain,
|
|
4578
4604
|
sourceToken: action.sourceToken ?? null,
|
|
4579
4605
|
sourceSymbol: action.sourceSymbol ?? null,
|
|
4580
|
-
sourceDecimals: action.sourceDecimals ?? null
|
|
4606
|
+
sourceDecimals: action.sourceDecimals ?? null,
|
|
4607
|
+
// The submit site's declared USD value, not the lingering typed
|
|
4608
|
+
// input — a submit that doesn't know it (fiat onramp) must not
|
|
4609
|
+
// inherit one from an abandoned wallet attempt.
|
|
4610
|
+
inputAmountUsd: action.inputAmountUsd ?? null
|
|
4581
4611
|
},
|
|
4582
4612
|
processing: {
|
|
4583
4613
|
...state.processing,
|
|
@@ -5096,6 +5126,7 @@ function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
|
5096
5126
|
}
|
|
5097
5127
|
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5098
5128
|
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5129
|
+
var SWAPPED_SOURCE_DECIMALS = 6;
|
|
5099
5130
|
function getAddressKey(address) {
|
|
5100
5131
|
return address ? address.toLowerCase() : null;
|
|
5101
5132
|
}
|
|
@@ -5211,6 +5242,7 @@ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
|
5211
5242
|
amount: d.amount,
|
|
5212
5243
|
sourceSymbol: d.sourceSymbol ?? void 0,
|
|
5213
5244
|
sourceDecimals: d.sourceDecimals ?? void 0,
|
|
5245
|
+
inputAmountUsd: d.inputAmountUsd ?? void 0,
|
|
5214
5246
|
directTransfer: p.directTransfer
|
|
5215
5247
|
};
|
|
5216
5248
|
}
|
|
@@ -5417,7 +5449,7 @@ function DepositFlow({
|
|
|
5417
5449
|
isConnectSelectionConfirmed,
|
|
5418
5450
|
selectedWalletId
|
|
5419
5451
|
]);
|
|
5420
|
-
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
5452
|
+
const setupChainId = typeof targetChain === "number" && !isVirtualDestination(targetChain) ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
5421
5453
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
5422
5454
|
const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
|
|
5423
5455
|
const targetMarketPriceRef = useRef8(null);
|
|
@@ -6161,8 +6193,10 @@ function DepositFlow({
|
|
|
6161
6193
|
);
|
|
6162
6194
|
const handleSolanaConfirmed = useCallback7(
|
|
6163
6195
|
(txHash, amountUnits) => {
|
|
6164
|
-
const
|
|
6196
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6197
|
+
const tokenAtSubmit = depositAtSubmit.selectedSolanaToken;
|
|
6165
6198
|
if (!tokenAtSubmit) return;
|
|
6199
|
+
const amountUsd = depositAtSubmit.inputAmountUsd ?? void 0;
|
|
6166
6200
|
logFlow("solana:submitted", {
|
|
6167
6201
|
txHash,
|
|
6168
6202
|
amountUnits,
|
|
@@ -6175,13 +6209,16 @@ function DepositFlow({
|
|
|
6175
6209
|
sourceToken: tokenAtSubmit.mint,
|
|
6176
6210
|
amount: amountUnits,
|
|
6177
6211
|
sourceSymbol: tokenAtSubmit.symbol,
|
|
6178
|
-
sourceDecimals: tokenAtSubmit.decimals
|
|
6212
|
+
sourceDecimals: tokenAtSubmit.decimals,
|
|
6213
|
+
inputAmountUsd: amountUsd
|
|
6179
6214
|
});
|
|
6180
6215
|
onLifecycleRef.current?.({
|
|
6181
6216
|
type: "submitted",
|
|
6182
6217
|
txHash,
|
|
6183
6218
|
sourceChain: "solana",
|
|
6184
|
-
amount: amountUnits
|
|
6219
|
+
amount: amountUnits,
|
|
6220
|
+
sourceDecimals: tokenAtSubmit.decimals,
|
|
6221
|
+
amountUsd
|
|
6185
6222
|
});
|
|
6186
6223
|
},
|
|
6187
6224
|
[logFlow, onLifecycleRef, storeApi]
|
|
@@ -6233,7 +6270,8 @@ function DepositFlow({
|
|
|
6233
6270
|
sourceToken: token,
|
|
6234
6271
|
amount
|
|
6235
6272
|
});
|
|
6236
|
-
const
|
|
6273
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6274
|
+
const asset = depositAtSubmit.selectedAsset;
|
|
6237
6275
|
const dappImport = asset && isDappImportAsset(asset) ? asset : null;
|
|
6238
6276
|
storeApi.dispatch({
|
|
6239
6277
|
type: "deposit/submitted",
|
|
@@ -6241,8 +6279,9 @@ function DepositFlow({
|
|
|
6241
6279
|
sourceChain: chainId,
|
|
6242
6280
|
sourceToken: token,
|
|
6243
6281
|
amount,
|
|
6244
|
-
sourceSymbol:
|
|
6245
|
-
sourceDecimals:
|
|
6282
|
+
sourceSymbol: asset?.symbol,
|
|
6283
|
+
sourceDecimals: asset?.decimals,
|
|
6284
|
+
inputAmountUsd: depositAtSubmit.inputAmountUsd ?? void 0,
|
|
6246
6285
|
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
6247
6286
|
});
|
|
6248
6287
|
},
|
|
@@ -6262,27 +6301,31 @@ function DepositFlow({
|
|
|
6262
6301
|
sourceToken: SWAPPED_SOURCE_TOKEN,
|
|
6263
6302
|
amount,
|
|
6264
6303
|
sourceSymbol: info.orderCrypto ?? "USDC",
|
|
6265
|
-
sourceDecimals:
|
|
6304
|
+
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6266
6305
|
});
|
|
6267
6306
|
onLifecycleRef.current?.({
|
|
6268
6307
|
type: "submitted",
|
|
6269
6308
|
txHash: info.txHash,
|
|
6270
6309
|
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6271
|
-
amount
|
|
6310
|
+
amount,
|
|
6311
|
+
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6272
6312
|
});
|
|
6273
6313
|
},
|
|
6274
6314
|
[logFlow, storeApi, onLifecycleRef]
|
|
6275
6315
|
);
|
|
6276
6316
|
const handleDepositSubmittedCallback = useCallback7(
|
|
6277
6317
|
(txHash, sourceChain, amount) => {
|
|
6318
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6278
6319
|
onLifecycleRef.current?.({
|
|
6279
6320
|
type: "submitted",
|
|
6280
6321
|
txHash,
|
|
6281
6322
|
sourceChain,
|
|
6282
|
-
amount
|
|
6323
|
+
amount,
|
|
6324
|
+
sourceDecimals: depositAtSubmit.selectedAsset?.decimals,
|
|
6325
|
+
amountUsd: depositAtSubmit.inputAmountUsd ?? void 0
|
|
6283
6326
|
});
|
|
6284
6327
|
},
|
|
6285
|
-
[onLifecycleRef]
|
|
6328
|
+
[onLifecycleRef, storeApi]
|
|
6286
6329
|
);
|
|
6287
6330
|
const handleDepositComplete = useCallback7(
|
|
6288
6331
|
(txHash, destinationTxHash, context) => {
|
|
@@ -6525,9 +6568,11 @@ function DepositFlow({
|
|
|
6525
6568
|
amount: step.amount,
|
|
6526
6569
|
sourceSymbol: step.sourceSymbol,
|
|
6527
6570
|
sourceDecimals: step.sourceDecimals,
|
|
6571
|
+
amountUsd: step.inputAmountUsd,
|
|
6528
6572
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6529
6573
|
service,
|
|
6530
6574
|
directTransfer: step.directTransfer,
|
|
6575
|
+
isSwappedOrder: true,
|
|
6531
6576
|
onClose,
|
|
6532
6577
|
onNewDeposit: handleNewDeposit,
|
|
6533
6578
|
onDepositComplete: handleDepositComplete,
|
|
@@ -6590,9 +6635,11 @@ function DepositFlow({
|
|
|
6590
6635
|
amount: step.amount,
|
|
6591
6636
|
sourceSymbol: step.sourceSymbol,
|
|
6592
6637
|
sourceDecimals: step.sourceDecimals,
|
|
6638
|
+
amountUsd: step.inputAmountUsd,
|
|
6593
6639
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6594
6640
|
service,
|
|
6595
6641
|
directTransfer: step.directTransfer,
|
|
6642
|
+
isSwappedOrder: true,
|
|
6596
6643
|
onClose,
|
|
6597
6644
|
onNewDeposit: handleNewDeposit,
|
|
6598
6645
|
onDepositComplete: handleDepositComplete,
|
|
@@ -6639,6 +6686,7 @@ function DepositFlow({
|
|
|
6639
6686
|
balanceUsd: effectiveStep.balanceUsd,
|
|
6640
6687
|
defaultAmount: effectiveStep.inputAmountUsd,
|
|
6641
6688
|
uiConfig,
|
|
6689
|
+
targetChain,
|
|
6642
6690
|
targetChainName: getChainName(targetChain),
|
|
6643
6691
|
targetTokenSymbol: getTargetTokenSymbol(targetToken, targetChain),
|
|
6644
6692
|
targetTokenIcon: getTokenIcon(
|
|
@@ -6717,6 +6765,7 @@ function DepositFlow({
|
|
|
6717
6765
|
amount: effectiveStep.amount,
|
|
6718
6766
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
6719
6767
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
6768
|
+
amountUsd: effectiveStep.inputAmountUsd,
|
|
6720
6769
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6721
6770
|
service,
|
|
6722
6771
|
directTransfer: effectiveStep.directTransfer,
|
|
@@ -6860,6 +6909,7 @@ function DepositFlow({
|
|
|
6860
6909
|
amount: effectiveStep.amount,
|
|
6861
6910
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
6862
6911
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
6912
|
+
amountUsd: effectiveStep.inputAmountUsd,
|
|
6863
6913
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6864
6914
|
service,
|
|
6865
6915
|
directTransfer: effectiveStep.directTransfer,
|
|
@@ -7163,7 +7213,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
7163
7213
|
// src/DepositModal.tsx
|
|
7164
7214
|
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7165
7215
|
var ReownDepositInner = lazy2(
|
|
7166
|
-
() => import("./DepositModalReown-
|
|
7216
|
+
() => import("./DepositModalReown-THU2QG76.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
7167
7217
|
);
|
|
7168
7218
|
function sortByCreatedAtDesc(items) {
|
|
7169
7219
|
return [...items].sort((a, b) => {
|
|
@@ -7259,6 +7309,31 @@ function DepositModalInner({
|
|
|
7259
7309
|
const historyLoadedRef = useRef9(false);
|
|
7260
7310
|
const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
|
|
7261
7311
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
7312
|
+
const [recipientIsContract, setRecipientIsContract] = useState13(false);
|
|
7313
|
+
const onErrorRef = useLatestRef(onError);
|
|
7314
|
+
useEffect11(() => {
|
|
7315
|
+
if (targetChain !== HYPERCORE_CHAIN_ID || !isAddress2(recipient, { strict: false })) {
|
|
7316
|
+
setRecipientIsContract(false);
|
|
7317
|
+
return;
|
|
7318
|
+
}
|
|
7319
|
+
let cancelled = false;
|
|
7320
|
+
getHyperEvmReadClient().getCode({ address: recipient }).then((code) => {
|
|
7321
|
+
if (cancelled) return;
|
|
7322
|
+
const isContract = isContractBytecode(code);
|
|
7323
|
+
setRecipientIsContract(isContract);
|
|
7324
|
+
if (isContract) {
|
|
7325
|
+
onErrorRef.current?.({
|
|
7326
|
+
message: "HyperCore deposits require an EOA recipient; the configured recipient is a smart contract.",
|
|
7327
|
+
code: "HYPERCORE_RECIPIENT_NOT_EOA"
|
|
7328
|
+
});
|
|
7329
|
+
}
|
|
7330
|
+
}).catch(() => {
|
|
7331
|
+
if (!cancelled) setRecipientIsContract(false);
|
|
7332
|
+
});
|
|
7333
|
+
return () => {
|
|
7334
|
+
cancelled = true;
|
|
7335
|
+
};
|
|
7336
|
+
}, [targetChain, recipient, onErrorRef]);
|
|
7262
7337
|
const service = useMemo9(
|
|
7263
7338
|
() => createDepositService(backendUrl, {
|
|
7264
7339
|
debug,
|
|
@@ -7435,7 +7510,7 @@ function DepositModalInner({
|
|
|
7435
7510
|
)
|
|
7436
7511
|
] })
|
|
7437
7512
|
] }),
|
|
7438
|
-
/* @__PURE__ */ jsx19(
|
|
7513
|
+
recipientIsContract ? /* @__PURE__ */ jsx19("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx19(Callout, { variant: "error", children: "HyperCore deposits require an EOA recipient. The configured recipient is a smart contract, which is not supported." }) }) : /* @__PURE__ */ jsx19(
|
|
7439
7514
|
DepositFlow,
|
|
7440
7515
|
{
|
|
7441
7516
|
dappWalletClient,
|