@rhinestone/deposit-modal 0.1.48 → 0.1.50
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 +3 -0
- package/dist/{DepositModalReown-3V2EFXH5.mjs → DepositModalReown-EKRWDULN.mjs} +17 -6
- package/dist/{DepositModalReown-SV6QIUTL.cjs → DepositModalReown-SUED62QO.cjs} +20 -9
- package/dist/{WithdrawModalReown-FODH7PY5.mjs → WithdrawModalReown-AHHM3VTB.mjs} +2 -2
- package/dist/{WithdrawModalReown-ZSR3RP44.cjs → WithdrawModalReown-JIKBNJU7.cjs} +5 -5
- package/dist/{chunk-PW55TOFK.cjs → chunk-CTZVI5NR.cjs} +1 -1
- package/dist/{chunk-HCZNF6CR.mjs → chunk-GZIGVCI2.mjs} +1 -1
- package/dist/{chunk-ZK6VAHSB.cjs → chunk-HXNHL64V.cjs} +211 -117
- package/dist/{chunk-ZAQISJAP.mjs → chunk-N5BRA3ZN.mjs} +178 -84
- package/dist/{chunk-JGB6XSYS.mjs → chunk-UPA7N6GY.mjs} +11 -12
- package/dist/{chunk-XLRQCIYD.cjs → chunk-XAGXQV4K.cjs} +11 -12
- 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-dY70pF2y.d.cts → types-C2uBaYtU.d.cts} +1 -0
- package/dist/{types-B0FLVdXb.d.ts → types-Qv3sYfjZ.d.ts} +1 -0
- 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
|
@@ -56,7 +56,6 @@ var _react = require('react');
|
|
|
56
56
|
|
|
57
57
|
// src/DepositFlow.tsx
|
|
58
58
|
|
|
59
|
-
var _viem = require('viem');
|
|
60
59
|
|
|
61
60
|
// src/components/steps/SetupStep.tsx
|
|
62
61
|
|
|
@@ -85,6 +84,7 @@ function SetupStep({
|
|
|
85
84
|
sessionChainIds,
|
|
86
85
|
recipient,
|
|
87
86
|
forceRegister,
|
|
87
|
+
enableSolana = true,
|
|
88
88
|
service,
|
|
89
89
|
onSetupComplete,
|
|
90
90
|
onError,
|
|
@@ -115,7 +115,10 @@ function SetupStep({
|
|
|
115
115
|
if (!setup.needsRegistration) {
|
|
116
116
|
setState({ type: "ready", smartAccount });
|
|
117
117
|
_optionalChain([onConnected, 'optionalCall', _ => _(address, smartAccount)]);
|
|
118
|
-
onSetupComplete(
|
|
118
|
+
onSetupComplete(
|
|
119
|
+
smartAccount,
|
|
120
|
+
enableSolana ? setup.solanaDepositAddress : void 0
|
|
121
|
+
);
|
|
119
122
|
return;
|
|
120
123
|
}
|
|
121
124
|
setState({ type: "signing-session" });
|
|
@@ -151,7 +154,10 @@ function SetupStep({
|
|
|
151
154
|
});
|
|
152
155
|
setState({ type: "ready", smartAccount });
|
|
153
156
|
_optionalChain([onConnected, 'optionalCall', _2 => _2(address, smartAccount)]);
|
|
154
|
-
onSetupComplete(
|
|
157
|
+
onSetupComplete(
|
|
158
|
+
smartAccount,
|
|
159
|
+
enableSolana ? registerResult.solanaDepositAddress : void 0
|
|
160
|
+
);
|
|
155
161
|
} catch (error) {
|
|
156
162
|
const message = error instanceof Error ? error.message : "Setup failed";
|
|
157
163
|
setState({ type: "error", message });
|
|
@@ -166,6 +172,7 @@ function SetupStep({
|
|
|
166
172
|
sessionChainIds,
|
|
167
173
|
recipient,
|
|
168
174
|
forceRegister,
|
|
175
|
+
enableSolana,
|
|
169
176
|
service,
|
|
170
177
|
onSetupComplete,
|
|
171
178
|
onError,
|
|
@@ -246,7 +253,7 @@ function SetupStep({
|
|
|
246
253
|
|
|
247
254
|
// src/components/steps/AssetSelectStep.tsx
|
|
248
255
|
|
|
249
|
-
|
|
256
|
+
var _viem = require('viem');
|
|
250
257
|
|
|
251
258
|
function AssetSelectStep({
|
|
252
259
|
address,
|
|
@@ -2006,35 +2013,81 @@ function SolanaAmountStep({
|
|
|
2006
2013
|
token,
|
|
2007
2014
|
balance,
|
|
2008
2015
|
balanceUsd,
|
|
2016
|
+
defaultAmount,
|
|
2017
|
+
uiConfig,
|
|
2009
2018
|
onContinue,
|
|
2010
2019
|
debug
|
|
2011
2020
|
}) {
|
|
2012
2021
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2013
2022
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2023
|
+
const isSourceStablecoin = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2024
|
+
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2025
|
+
if (isSourceStablecoin) return 1;
|
|
2026
|
+
try {
|
|
2027
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, token.decimals));
|
|
2028
|
+
if (!Number.isFinite(balanceUnits) || balanceUnits <= 0 || balanceUsd <= 0) {
|
|
2029
|
+
return null;
|
|
2030
|
+
}
|
|
2031
|
+
const price = balanceUsd / balanceUnits;
|
|
2032
|
+
return price > 0 ? price : null;
|
|
2033
|
+
} catch (e15) {
|
|
2034
|
+
return null;
|
|
2035
|
+
}
|
|
2036
|
+
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2037
|
+
const hasPricing = tokenPriceUsd !== null;
|
|
2038
|
+
_react.useEffect.call(void 0, () => {
|
|
2039
|
+
if (defaultAmount && !amount) {
|
|
2040
|
+
const parsed = Number(defaultAmount);
|
|
2041
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
2042
|
+
setAmount(parsed.toString());
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
}, [defaultAmount, amount]);
|
|
2014
2046
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
2015
2047
|
try {
|
|
2016
2048
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2017
2049
|
const numeric = Number(raw);
|
|
2018
2050
|
if (!Number.isFinite(numeric)) return raw;
|
|
2019
2051
|
return _chunk7HJ7IBRHcjs.tokenFormatter.format(numeric);
|
|
2020
|
-
} catch (
|
|
2052
|
+
} catch (e16) {
|
|
2021
2053
|
return "...";
|
|
2022
2054
|
}
|
|
2023
2055
|
}, [balance, token.decimals]);
|
|
2056
|
+
const computedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2057
|
+
try {
|
|
2058
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, token.decimals));
|
|
2059
|
+
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
2060
|
+
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2061
|
+
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2062
|
+
return null;
|
|
2063
|
+
} catch (e17) {
|
|
2064
|
+
return null;
|
|
2065
|
+
}
|
|
2066
|
+
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2024
2067
|
const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2025
|
-
if (
|
|
2026
|
-
return _chunk7HJ7IBRHcjs.currencyFormatter.format(
|
|
2027
|
-
}, [
|
|
2068
|
+
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2069
|
+
return _chunk7HJ7IBRHcjs.currencyFormatter.format(computedBalanceUsd);
|
|
2070
|
+
}, [computedBalanceUsd]);
|
|
2028
2071
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2029
2072
|
if (!isNativeSol(token)) return balance;
|
|
2030
2073
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2031
2074
|
}, [balance, token]);
|
|
2075
|
+
const spendableBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2076
|
+
try {
|
|
2077
|
+
const spendableUnits = Number(_viem.formatUnits.call(void 0, spendableBalance, token.decimals));
|
|
2078
|
+
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2079
|
+
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2080
|
+
return null;
|
|
2081
|
+
} catch (e18) {
|
|
2082
|
+
return null;
|
|
2083
|
+
}
|
|
2084
|
+
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2032
2085
|
const handlePresetClick = (percentage) => {
|
|
2033
2086
|
try {
|
|
2034
2087
|
const spendableUnits = Number(_viem.formatUnits.call(void 0, spendableBalance, token.decimals));
|
|
2035
2088
|
if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return;
|
|
2036
|
-
const value = spendableUnits * percentage / 100;
|
|
2037
|
-
const maxDecimals =
|
|
2089
|
+
const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (_nullishCoalesce(spendableBalanceUsd, () => ( 0))) * percentage / 100;
|
|
2090
|
+
const maxDecimals = 3;
|
|
2038
2091
|
const factor = 10 ** maxDecimals;
|
|
2039
2092
|
const truncated = Math.floor(value * factor) / factor;
|
|
2040
2093
|
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
@@ -2044,7 +2097,7 @@ function SolanaAmountStep({
|
|
|
2044
2097
|
formatted
|
|
2045
2098
|
});
|
|
2046
2099
|
setAmount(formatted);
|
|
2047
|
-
} catch (
|
|
2100
|
+
} catch (e19) {
|
|
2048
2101
|
return;
|
|
2049
2102
|
}
|
|
2050
2103
|
if (error) setError(null);
|
|
@@ -2059,12 +2112,30 @@ function SolanaAmountStep({
|
|
|
2059
2112
|
setError("Please enter a valid amount");
|
|
2060
2113
|
return;
|
|
2061
2114
|
}
|
|
2115
|
+
const sourceAmount = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / tokenPriceUsd;
|
|
2116
|
+
if (hasPricing) {
|
|
2117
|
+
const usdValue = numericAmount;
|
|
2118
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _38 => _38.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
2119
|
+
setError(
|
|
2120
|
+
`Maximum deposit is ${_chunk7HJ7IBRHcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
2121
|
+
);
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2124
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _39 => _39.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
2125
|
+
setError(
|
|
2126
|
+
`Minimum deposit is ${_chunk7HJ7IBRHcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
2127
|
+
);
|
|
2128
|
+
return;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
const sourceAmountStr = sourceAmount.toString();
|
|
2062
2132
|
let amountInUnits;
|
|
2063
2133
|
try {
|
|
2064
|
-
amountInUnits = _viem.parseUnits.call(void 0,
|
|
2065
|
-
} catch (
|
|
2134
|
+
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2135
|
+
} catch (e20) {
|
|
2066
2136
|
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2067
2137
|
amount,
|
|
2138
|
+
sourceAmount: sourceAmountStr,
|
|
2068
2139
|
reason: "parse-units-failed"
|
|
2069
2140
|
});
|
|
2070
2141
|
setError("Please enter a valid amount");
|
|
@@ -2086,46 +2157,47 @@ function SolanaAmountStep({
|
|
|
2086
2157
|
}
|
|
2087
2158
|
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2088
2159
|
symbol: token.symbol,
|
|
2089
|
-
amount,
|
|
2160
|
+
inputAmountUsd: amount,
|
|
2161
|
+
sourceAmount: sourceAmountStr,
|
|
2090
2162
|
amountInUnits: amountInUnits.toString()
|
|
2091
2163
|
});
|
|
2092
2164
|
setError(null);
|
|
2093
|
-
onContinue(token, amount);
|
|
2165
|
+
onContinue(token, sourceAmountStr, amount);
|
|
2094
2166
|
};
|
|
2095
2167
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
2096
2168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Enter amount" }) }),
|
|
2097
2169
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
2098
2170
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
2099
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2172
|
+
"input",
|
|
2173
|
+
{
|
|
2174
|
+
type: "text",
|
|
2175
|
+
inputMode: "decimal",
|
|
2176
|
+
className: "rs-amount-input-large",
|
|
2177
|
+
placeholder: "$0.00",
|
|
2178
|
+
value: amount ? `$${amount}` : "",
|
|
2179
|
+
onChange: (e) => {
|
|
2180
|
+
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
2181
|
+
const parts = raw.split(".");
|
|
2182
|
+
if (parts.length > 2) return;
|
|
2183
|
+
setAmount(raw);
|
|
2184
|
+
if (error) setError(null);
|
|
2185
|
+
},
|
|
2186
|
+
autoFocus: true
|
|
2187
|
+
}
|
|
2188
|
+
) }),
|
|
2189
|
+
!isSourceStablecoin && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-available", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
|
|
2190
|
+
formattedBalance,
|
|
2191
|
+
" ",
|
|
2192
|
+
token.symbol,
|
|
2193
|
+
" available",
|
|
2194
|
+
formattedBalanceUsd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
2123
2195
|
" ",
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
] })
|
|
2196
|
+
"(",
|
|
2197
|
+
formattedBalanceUsd,
|
|
2198
|
+
")"
|
|
2199
|
+
] })
|
|
2200
|
+
] }) })
|
|
2129
2201
|
] }),
|
|
2130
2202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-presets", children: [
|
|
2131
2203
|
[25, 50, 75].map((pct) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2195,7 +2267,8 @@ function SolanaConfirmStep({
|
|
|
2195
2267
|
solanaAddress,
|
|
2196
2268
|
solanaDepositAddress,
|
|
2197
2269
|
token,
|
|
2198
|
-
|
|
2270
|
+
sourceAmount,
|
|
2271
|
+
inputAmountUsd,
|
|
2199
2272
|
targetAmount,
|
|
2200
2273
|
targetTokenPriceUsd,
|
|
2201
2274
|
targetChain,
|
|
@@ -2210,7 +2283,7 @@ function SolanaConfirmStep({
|
|
|
2210
2283
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2211
2284
|
const targetSymbol = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2212
2285
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2213
|
-
const formattedAmount =
|
|
2286
|
+
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
2214
2287
|
const formattedReceiveAmount = (() => {
|
|
2215
2288
|
if (isSameToken) return formattedAmount;
|
|
2216
2289
|
const dollarValue = Number(targetAmount);
|
|
@@ -2231,11 +2304,11 @@ function SolanaConfirmStep({
|
|
|
2231
2304
|
setError("Solana wallet not connected");
|
|
2232
2305
|
return;
|
|
2233
2306
|
}
|
|
2234
|
-
const parsedAmount = parseFloat(
|
|
2307
|
+
const parsedAmount = parseFloat(sourceAmount);
|
|
2235
2308
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2236
2309
|
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2237
2310
|
reason: "invalid-amount",
|
|
2238
|
-
|
|
2311
|
+
sourceAmount
|
|
2239
2312
|
});
|
|
2240
2313
|
setError("Please enter a valid amount");
|
|
2241
2314
|
return;
|
|
@@ -2247,7 +2320,8 @@ function SolanaConfirmStep({
|
|
|
2247
2320
|
solanaAddress,
|
|
2248
2321
|
solanaDepositAddress,
|
|
2249
2322
|
token: token.symbol,
|
|
2250
|
-
|
|
2323
|
+
sourceAmount,
|
|
2324
|
+
inputAmountUsd
|
|
2251
2325
|
});
|
|
2252
2326
|
try {
|
|
2253
2327
|
const check = await service.checkAccount(smartAccount);
|
|
@@ -2263,10 +2337,10 @@ function SolanaConfirmStep({
|
|
|
2263
2337
|
);
|
|
2264
2338
|
}
|
|
2265
2339
|
const connection = getSolanaConnection();
|
|
2266
|
-
const amountUnits = _viem.parseUnits.call(void 0,
|
|
2340
|
+
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2267
2341
|
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2268
2342
|
token: token.symbol,
|
|
2269
|
-
|
|
2343
|
+
sourceAmount,
|
|
2270
2344
|
amountUnits: amountUnits.toString()
|
|
2271
2345
|
});
|
|
2272
2346
|
const transaction = isNativeSol(token) ? await buildSolTransferTransaction(
|
|
@@ -2284,7 +2358,7 @@ function SolanaConfirmStep({
|
|
|
2284
2358
|
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2285
2359
|
token: token.symbol,
|
|
2286
2360
|
instructionCount: transaction.instructions.length,
|
|
2287
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
2361
|
+
feePayer: _optionalChain([transaction, 'access', _40 => _40.feePayer, 'optionalAccess', _41 => _41.toBase58, 'call', _42 => _42()]),
|
|
2288
2362
|
recentBlockhash: transaction.recentBlockhash
|
|
2289
2363
|
});
|
|
2290
2364
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2303,10 +2377,10 @@ function SolanaConfirmStep({
|
|
|
2303
2377
|
_chunk7HJ7IBRHcjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2304
2378
|
smartAccount,
|
|
2305
2379
|
token: token.symbol,
|
|
2306
|
-
|
|
2380
|
+
sourceAmount
|
|
2307
2381
|
});
|
|
2308
2382
|
setError(message);
|
|
2309
|
-
_optionalChain([onError, 'optionalCall',
|
|
2383
|
+
_optionalChain([onError, 'optionalCall', _43 => _43(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2310
2384
|
} finally {
|
|
2311
2385
|
setIsSubmitting(false);
|
|
2312
2386
|
}
|
|
@@ -2437,7 +2511,7 @@ function SolanaConfirmStep({
|
|
|
2437
2511
|
{
|
|
2438
2512
|
onClick: handleConfirm,
|
|
2439
2513
|
loading: isSubmitting,
|
|
2440
|
-
disabled: !
|
|
2514
|
+
disabled: !sourceAmount || Number(sourceAmount) <= 0,
|
|
2441
2515
|
fullWidth: true,
|
|
2442
2516
|
children: "Confirm Order"
|
|
2443
2517
|
}
|
|
@@ -2469,6 +2543,7 @@ function DepositFlow({
|
|
|
2469
2543
|
sessionChainIds,
|
|
2470
2544
|
forceRegister = false,
|
|
2471
2545
|
waitForFinalTx = true,
|
|
2546
|
+
enableSolana = true,
|
|
2472
2547
|
reownWallet,
|
|
2473
2548
|
onConnect,
|
|
2474
2549
|
onDisconnect,
|
|
@@ -2518,19 +2593,19 @@ function DepositFlow({
|
|
|
2518
2593
|
try {
|
|
2519
2594
|
const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
|
|
2520
2595
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
2521
|
-
} catch (
|
|
2596
|
+
} catch (e21) {
|
|
2522
2597
|
}
|
|
2523
2598
|
}
|
|
2524
2599
|
}
|
|
2525
2600
|
return null;
|
|
2526
2601
|
}, []);
|
|
2527
2602
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
2528
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2603
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _44 => _44.switchChain])) return void 0;
|
|
2529
2604
|
return async (chainId) => {
|
|
2530
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
2605
|
+
await _optionalChain([dappWalletClient, 'access', _45 => _45.switchChain, 'optionalCall', _46 => _46({ id: chainId })]);
|
|
2531
2606
|
};
|
|
2532
2607
|
}, [dappWalletClient]);
|
|
2533
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2608
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _47 => _47.account, 'optionalAccess', _48 => _48.address]), () => ( null));
|
|
2534
2609
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
2535
2610
|
const options = [];
|
|
2536
2611
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2544,7 +2619,7 @@ function DepositFlow({
|
|
|
2544
2619
|
});
|
|
2545
2620
|
seen.add(id);
|
|
2546
2621
|
}
|
|
2547
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
2622
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _49 => _49.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
2548
2623
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
2549
2624
|
if (!seen.has(id)) {
|
|
2550
2625
|
options.push({
|
|
@@ -2556,7 +2631,7 @@ function DepositFlow({
|
|
|
2556
2631
|
});
|
|
2557
2632
|
seen.add(id);
|
|
2558
2633
|
}
|
|
2559
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
2634
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _50 => _50.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
2560
2635
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
2561
2636
|
if (!seen.has(id)) {
|
|
2562
2637
|
options.push({
|
|
@@ -2573,19 +2648,20 @@ function DepositFlow({
|
|
|
2573
2648
|
}, [
|
|
2574
2649
|
connectedWalletAddress,
|
|
2575
2650
|
dappAddress,
|
|
2576
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2577
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2578
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2579
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2580
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2581
|
-
|
|
2582
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2583
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2651
|
+
_optionalChain([reownWallet, 'optionalAccess', _51 => _51.address]),
|
|
2652
|
+
_optionalChain([reownWallet, 'optionalAccess', _52 => _52.isConnected]),
|
|
2653
|
+
_optionalChain([reownWallet, 'optionalAccess', _53 => _53.walletClient]),
|
|
2654
|
+
_optionalChain([reownWallet, 'optionalAccess', _54 => _54.publicClient]),
|
|
2655
|
+
_optionalChain([reownWallet, 'optionalAccess', _55 => _55.icon]),
|
|
2656
|
+
enableSolana,
|
|
2657
|
+
_optionalChain([reownWallet, 'optionalAccess', _56 => _56.isSolana]),
|
|
2658
|
+
_optionalChain([reownWallet, 'optionalAccess', _57 => _57.solanaAddress]),
|
|
2659
|
+
_optionalChain([reownWallet, 'optionalAccess', _58 => _58.caipAddress])
|
|
2584
2660
|
]);
|
|
2585
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
2661
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _59 => _59.account]) && dappAddress && !reownWallet;
|
|
2586
2662
|
const hasWalletOptions = walletOptions.length > 0;
|
|
2587
2663
|
const hasReownSession = Boolean(
|
|
2588
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2664
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _60 => _60.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _61 => _61.address]) : _optionalChain([reownWallet, 'optionalAccess', _62 => _62.address])
|
|
2589
2665
|
);
|
|
2590
2666
|
const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
|
|
2591
2667
|
const walletSelectionKey = _react.useMemo.call(void 0, () => {
|
|
@@ -2616,7 +2692,7 @@ function DepositFlow({
|
|
|
2616
2692
|
};
|
|
2617
2693
|
}
|
|
2618
2694
|
if (canAutoLock) {
|
|
2619
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2695
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _63 => _63.chain, 'optionalAccess', _64 => _64.id]), () => ( targetChain));
|
|
2620
2696
|
return {
|
|
2621
2697
|
ownerAddress: dappWalletClient.account.address,
|
|
2622
2698
|
walletClient: dappWalletClient,
|
|
@@ -2638,8 +2714,8 @@ function DepositFlow({
|
|
|
2638
2714
|
switchChain: void 0
|
|
2639
2715
|
};
|
|
2640
2716
|
}
|
|
2641
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
2642
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2717
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _65 => _65.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
2718
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _66 => _66.chain, 'optionalAccess', _67 => _67.id]), () => ( targetChain));
|
|
2643
2719
|
return {
|
|
2644
2720
|
ownerAddress: dappWalletClient.account.address,
|
|
2645
2721
|
walletClient: dappWalletClient,
|
|
@@ -2647,7 +2723,7 @@ function DepositFlow({
|
|
|
2647
2723
|
switchChain: dappSwitchChain
|
|
2648
2724
|
};
|
|
2649
2725
|
}
|
|
2650
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
2726
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _68 => _68.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
2651
2727
|
return {
|
|
2652
2728
|
ownerAddress: reownWallet.address,
|
|
2653
2729
|
walletClient: reownWallet.walletClient,
|
|
@@ -2711,7 +2787,7 @@ function DepositFlow({
|
|
|
2711
2787
|
walletSignerContext,
|
|
2712
2788
|
walletSelectionKey
|
|
2713
2789
|
]);
|
|
2714
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
2790
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _69 => _69.ownerAddress]))), () => ( null));
|
|
2715
2791
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
2716
2792
|
_react.useEffect.call(void 0, () => {
|
|
2717
2793
|
const prev = lastTargetRef.current;
|
|
@@ -2770,7 +2846,8 @@ function DepositFlow({
|
|
|
2770
2846
|
solanaDepositAddress: prev.solanaDepositAddress,
|
|
2771
2847
|
token: prev.token,
|
|
2772
2848
|
balance: prev.balance,
|
|
2773
|
-
balanceUsd: prev.balanceUsd
|
|
2849
|
+
balanceUsd: prev.balanceUsd,
|
|
2850
|
+
inputAmountUsd: prev.inputAmountUsd
|
|
2774
2851
|
};
|
|
2775
2852
|
});
|
|
2776
2853
|
}, []);
|
|
@@ -2787,7 +2864,7 @@ function DepositFlow({
|
|
|
2787
2864
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
2788
2865
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
2789
2866
|
_react.useEffect.call(void 0, () => {
|
|
2790
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
2867
|
+
_optionalChain([onStepChange, 'optionalCall', _70 => _70(stepIndex, currentBackHandler)]);
|
|
2791
2868
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
2792
2869
|
_react.useEffect.call(void 0, () => {
|
|
2793
2870
|
logFlow("state:changed", {
|
|
@@ -2806,7 +2883,7 @@ function DepositFlow({
|
|
|
2806
2883
|
targetToken
|
|
2807
2884
|
]);
|
|
2808
2885
|
_react.useEffect.call(void 0, () => {
|
|
2809
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
2886
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _71 => _71(totalBalanceUsd)]);
|
|
2810
2887
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
2811
2888
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
2812
2889
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
@@ -2848,7 +2925,7 @@ function DepositFlow({
|
|
|
2848
2925
|
solanaDepositAddress
|
|
2849
2926
|
});
|
|
2850
2927
|
} else {
|
|
2851
|
-
_optionalChain([onError, 'optionalCall',
|
|
2928
|
+
_optionalChain([onError, 'optionalCall', _72 => _72({
|
|
2852
2929
|
message: "Solana deposit address not available. Please try again.",
|
|
2853
2930
|
code: "SOLANA_SETUP_FAILED"
|
|
2854
2931
|
})]);
|
|
@@ -2883,7 +2960,7 @@ function DepositFlow({
|
|
|
2883
2960
|
directTransfer
|
|
2884
2961
|
};
|
|
2885
2962
|
});
|
|
2886
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
2963
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _73 => _73({ txHash, sourceChain: chainId, amount })]);
|
|
2887
2964
|
},
|
|
2888
2965
|
[onDepositSubmitted, targetChain, targetToken]
|
|
2889
2966
|
);
|
|
@@ -2898,38 +2975,35 @@ function DepositFlow({
|
|
|
2898
2975
|
solanaDepositAddress: prev.solanaDepositAddress,
|
|
2899
2976
|
token,
|
|
2900
2977
|
balance,
|
|
2901
|
-
balanceUsd
|
|
2978
|
+
balanceUsd,
|
|
2979
|
+
inputAmountUsd: defaultAmount
|
|
2902
2980
|
};
|
|
2903
2981
|
});
|
|
2904
2982
|
},
|
|
2905
|
-
[logFlow]
|
|
2983
|
+
[defaultAmount, logFlow]
|
|
2906
2984
|
);
|
|
2907
2985
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
2908
|
-
(token,
|
|
2986
|
+
(token, sourceAmount, inputAmountUsd) => {
|
|
2909
2987
|
const targetSym = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2910
2988
|
const isTargetStable = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
2911
2989
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
2912
2990
|
logFlow("solana:amount:continue", {
|
|
2913
2991
|
token: token.symbol,
|
|
2914
|
-
|
|
2992
|
+
sourceAmount,
|
|
2993
|
+
inputAmountUsd,
|
|
2915
2994
|
targetSymbol: targetSym,
|
|
2916
2995
|
targetTokenPriceUsd
|
|
2917
2996
|
});
|
|
2918
2997
|
setStep((prev) => {
|
|
2919
2998
|
if (prev.type !== "solana-amount") return prev;
|
|
2920
|
-
const sourceBalance = Number(
|
|
2921
|
-
_viem.formatUnits.call(void 0, prev.balance, prev.token.decimals)
|
|
2922
|
-
);
|
|
2923
|
-
const sourceTokenPriceUsd = Number.isFinite(sourceBalance) && sourceBalance > 0 && prev.balanceUsd > 0 ? prev.balanceUsd / sourceBalance : null;
|
|
2924
|
-
const parsedAmount = Number(amount);
|
|
2925
|
-
const targetAmount = sourceTokenPriceUsd !== null && Number.isFinite(parsedAmount) && parsedAmount > 0 ? (parsedAmount * sourceTokenPriceUsd).toString() : amount;
|
|
2926
2999
|
return {
|
|
2927
3000
|
type: "solana-confirm",
|
|
2928
3001
|
smartAccount: prev.smartAccount,
|
|
2929
3002
|
solanaDepositAddress: prev.solanaDepositAddress,
|
|
2930
3003
|
token,
|
|
2931
|
-
|
|
2932
|
-
|
|
3004
|
+
sourceAmount,
|
|
3005
|
+
inputAmountUsd,
|
|
3006
|
+
targetAmount: inputAmountUsd,
|
|
2933
3007
|
targetTokenPriceUsd,
|
|
2934
3008
|
balance: prev.balance,
|
|
2935
3009
|
balanceUsd: prev.balanceUsd
|
|
@@ -2958,7 +3032,7 @@ function DepositFlow({
|
|
|
2958
3032
|
sourceDecimals: prev.token.decimals
|
|
2959
3033
|
};
|
|
2960
3034
|
});
|
|
2961
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
3035
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _74 => _74({
|
|
2962
3036
|
txHash,
|
|
2963
3037
|
sourceChain: "solana",
|
|
2964
3038
|
amount: amountUnits
|
|
@@ -2968,7 +3042,7 @@ function DepositFlow({
|
|
|
2968
3042
|
);
|
|
2969
3043
|
const handleConnected = _react.useCallback.call(void 0,
|
|
2970
3044
|
(addr, smartAccount) => {
|
|
2971
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
3045
|
+
_optionalChain([onConnected, 'optionalCall', _75 => _75({ address: addr, smartAccount })]);
|
|
2972
3046
|
},
|
|
2973
3047
|
[onConnected]
|
|
2974
3048
|
);
|
|
@@ -3031,28 +3105,28 @@ function DepositFlow({
|
|
|
3031
3105
|
);
|
|
3032
3106
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
3033
3107
|
(txHash, sourceChain, amount) => {
|
|
3034
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
3108
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _76 => _76({ txHash, sourceChain, amount })]);
|
|
3035
3109
|
},
|
|
3036
3110
|
[onDepositSubmitted]
|
|
3037
3111
|
);
|
|
3038
3112
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
3039
3113
|
(txHash, destinationTxHash) => {
|
|
3040
3114
|
logFlow("deposit:complete", { txHash, destinationTxHash });
|
|
3041
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
3115
|
+
_optionalChain([onDepositComplete, 'optionalCall', _77 => _77({ txHash, destinationTxHash })]);
|
|
3042
3116
|
},
|
|
3043
3117
|
[logFlow, onDepositComplete]
|
|
3044
3118
|
);
|
|
3045
3119
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
3046
3120
|
(txHash, error) => {
|
|
3047
3121
|
logFlowError("deposit:failed", error, { txHash });
|
|
3048
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
3122
|
+
_optionalChain([onDepositFailed, 'optionalCall', _78 => _78({ txHash, error })]);
|
|
3049
3123
|
},
|
|
3050
3124
|
[logFlowError, onDepositFailed]
|
|
3051
3125
|
);
|
|
3052
3126
|
const handleError = _react.useCallback.call(void 0,
|
|
3053
3127
|
(message, code) => {
|
|
3054
3128
|
logFlowError("flow:error", message, { code });
|
|
3055
|
-
_optionalChain([onError, 'optionalCall',
|
|
3129
|
+
_optionalChain([onError, 'optionalCall', _79 => _79({ message, code })]);
|
|
3056
3130
|
},
|
|
3057
3131
|
[logFlowError, onError]
|
|
3058
3132
|
);
|
|
@@ -3089,6 +3163,17 @@ function DepositFlow({
|
|
|
3089
3163
|
setFlowMode(null);
|
|
3090
3164
|
}
|
|
3091
3165
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext]);
|
|
3166
|
+
_react.useEffect.call(void 0, () => {
|
|
3167
|
+
if (enableSolana || flowMode !== "solana-wallet") {
|
|
3168
|
+
return;
|
|
3169
|
+
}
|
|
3170
|
+
setFlowMode(null);
|
|
3171
|
+
setIsConnectSelectionConfirmed(false);
|
|
3172
|
+
setSelectedWalletId(null);
|
|
3173
|
+
if (step.type !== "processing") {
|
|
3174
|
+
setStep({ type: "setup" });
|
|
3175
|
+
}
|
|
3176
|
+
}, [enableSolana, flowMode, step.type]);
|
|
3092
3177
|
_react.useEffect.call(void 0, () => {
|
|
3093
3178
|
if (hasNavigatedBackRef.current || isConnectSelectionConfirmed || flowMode) {
|
|
3094
3179
|
return;
|
|
@@ -3098,7 +3183,7 @@ function DepositFlow({
|
|
|
3098
3183
|
if (walletId) {
|
|
3099
3184
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
3100
3185
|
setSelectedWalletId(walletId);
|
|
3101
|
-
if (_optionalChain([selectedOption, 'optionalAccess',
|
|
3186
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _80 => _80.kind]) === "solana") {
|
|
3102
3187
|
handleSelectSolanaWallet();
|
|
3103
3188
|
} else {
|
|
3104
3189
|
handleSelectProvider();
|
|
@@ -3114,6 +3199,7 @@ function DepositFlow({
|
|
|
3114
3199
|
}, [
|
|
3115
3200
|
hasWalletOptions,
|
|
3116
3201
|
hasReownSession,
|
|
3202
|
+
enableSolana,
|
|
3117
3203
|
isConnectSelectionConfirmed,
|
|
3118
3204
|
flowMode,
|
|
3119
3205
|
selectedWalletIdEffective,
|
|
@@ -3145,7 +3231,7 @@ function DepositFlow({
|
|
|
3145
3231
|
const selectedOption = walletOptions.find(
|
|
3146
3232
|
(o) => o.id === selectedWalletIdEffective
|
|
3147
3233
|
);
|
|
3148
|
-
if (_optionalChain([selectedOption, 'optionalAccess',
|
|
3234
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _81 => _81.kind]) === "solana") {
|
|
3149
3235
|
handleSelectSolanaWallet();
|
|
3150
3236
|
} else {
|
|
3151
3237
|
handleSelectProvider();
|
|
@@ -3169,6 +3255,7 @@ function DepositFlow({
|
|
|
3169
3255
|
sessionChainIds,
|
|
3170
3256
|
recipient,
|
|
3171
3257
|
forceRegister,
|
|
3258
|
+
enableSolana,
|
|
3172
3259
|
service,
|
|
3173
3260
|
onSetupComplete: handleSetupComplete,
|
|
3174
3261
|
onConnected: handleConnected,
|
|
@@ -3179,7 +3266,7 @@ function DepositFlow({
|
|
|
3179
3266
|
DepositAddressStep,
|
|
3180
3267
|
{
|
|
3181
3268
|
smartAccount: step.smartAccount,
|
|
3182
|
-
solanaDepositAddress: step.solanaDepositAddress,
|
|
3269
|
+
solanaDepositAddress: enableSolana ? step.solanaDepositAddress : void 0,
|
|
3183
3270
|
service,
|
|
3184
3271
|
onDepositDetected: handleDepositAddressDetected,
|
|
3185
3272
|
onError: handleError
|
|
@@ -3211,8 +3298,8 @@ function DepositFlow({
|
|
|
3211
3298
|
}
|
|
3212
3299
|
if (isSolanaWalletMode) {
|
|
3213
3300
|
if (!sessionKeyAddress) return null;
|
|
3214
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
3215
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
3301
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _82 => _82.solanaAddress]);
|
|
3302
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _83 => _83.solanaProvider]);
|
|
3216
3303
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3217
3304
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3218
3305
|
SetupStep,
|
|
@@ -3224,6 +3311,7 @@ function DepositFlow({
|
|
|
3224
3311
|
sessionChainIds,
|
|
3225
3312
|
recipient,
|
|
3226
3313
|
forceRegister,
|
|
3314
|
+
enableSolana,
|
|
3227
3315
|
service,
|
|
3228
3316
|
onSetupComplete: handleSetupComplete,
|
|
3229
3317
|
onConnected: handleConnected,
|
|
@@ -3246,6 +3334,8 @@ function DepositFlow({
|
|
|
3246
3334
|
token: step.token,
|
|
3247
3335
|
balance: step.balance,
|
|
3248
3336
|
balanceUsd: step.balanceUsd,
|
|
3337
|
+
defaultAmount: step.inputAmountUsd,
|
|
3338
|
+
uiConfig,
|
|
3249
3339
|
onContinue: handleSolanaAmountContinue,
|
|
3250
3340
|
debug
|
|
3251
3341
|
}
|
|
@@ -3257,7 +3347,8 @@ function DepositFlow({
|
|
|
3257
3347
|
solanaAddress: solanaAddr,
|
|
3258
3348
|
solanaDepositAddress: step.solanaDepositAddress,
|
|
3259
3349
|
token: step.token,
|
|
3260
|
-
|
|
3350
|
+
sourceAmount: step.sourceAmount,
|
|
3351
|
+
inputAmountUsd: step.inputAmountUsd,
|
|
3261
3352
|
targetAmount: step.targetAmount,
|
|
3262
3353
|
targetTokenPriceUsd: step.targetTokenPriceUsd,
|
|
3263
3354
|
targetChain,
|
|
@@ -3326,13 +3417,13 @@ function DepositFlow({
|
|
|
3326
3417
|
)
|
|
3327
3418
|
] });
|
|
3328
3419
|
}
|
|
3329
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
3420
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _84 => _84.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _85 => _85.publicClient])) {
|
|
3330
3421
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
|
|
3331
3422
|
}
|
|
3332
3423
|
const ownerAddress = signerContext.ownerAddress;
|
|
3333
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
3424
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _86 => _86.walletClient, 'optionalAccess', _87 => _87.chain, 'optionalAccess', _88 => _88.id]), () => ( _optionalChain([signerContext, 'access', _89 => _89.publicClient, 'access', _90 => _90.chain, 'optionalAccess', _91 => _91.id]))), () => ( targetChain));
|
|
3334
3425
|
const getReadClientForChain = (chainId) => {
|
|
3335
|
-
if (_optionalChain([signerContext, 'access',
|
|
3426
|
+
if (_optionalChain([signerContext, 'access', _92 => _92.publicClient, 'access', _93 => _93.chain, 'optionalAccess', _94 => _94.id]) === chainId) {
|
|
3336
3427
|
return signerContext.publicClient;
|
|
3337
3428
|
}
|
|
3338
3429
|
return _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, chainId);
|
|
@@ -3349,6 +3440,7 @@ function DepositFlow({
|
|
|
3349
3440
|
sessionChainIds,
|
|
3350
3441
|
recipient,
|
|
3351
3442
|
forceRegister,
|
|
3443
|
+
enableSolana,
|
|
3352
3444
|
service,
|
|
3353
3445
|
onSetupComplete: handleSetupComplete,
|
|
3354
3446
|
onConnected: handleConnected,
|
|
@@ -3432,7 +3524,7 @@ function DepositFlow({
|
|
|
3432
3524
|
// src/DepositModal.tsx
|
|
3433
3525
|
|
|
3434
3526
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
3435
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
3527
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-SUED62QO.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
3436
3528
|
);
|
|
3437
3529
|
function DepositModal(props) {
|
|
3438
3530
|
const needsReown = !!props.reownAppId;
|
|
@@ -3461,6 +3553,7 @@ function DepositModalInner({
|
|
|
3461
3553
|
sessionChainIds,
|
|
3462
3554
|
forceRegister = false,
|
|
3463
3555
|
waitForFinalTx = true,
|
|
3556
|
+
enableSolana = true,
|
|
3464
3557
|
reownWallet,
|
|
3465
3558
|
onConnect,
|
|
3466
3559
|
onDisconnect,
|
|
@@ -3504,7 +3597,7 @@ function DepositModalInner({
|
|
|
3504
3597
|
_react.useEffect.call(void 0, () => {
|
|
3505
3598
|
if (isOpen && !hasCalledReady.current) {
|
|
3506
3599
|
hasCalledReady.current = true;
|
|
3507
|
-
_optionalChain([onReady, 'optionalCall',
|
|
3600
|
+
_optionalChain([onReady, 'optionalCall', _95 => _95()]);
|
|
3508
3601
|
}
|
|
3509
3602
|
}, [isOpen, onReady]);
|
|
3510
3603
|
_react.useEffect.call(void 0, () => {
|
|
@@ -3523,14 +3616,14 @@ function DepositModalInner({
|
|
|
3523
3616
|
setTotalBalanceUsd(balance2);
|
|
3524
3617
|
}, []);
|
|
3525
3618
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
3526
|
-
_optionalChain([backHandlerRef, 'access',
|
|
3619
|
+
_optionalChain([backHandlerRef, 'access', _96 => _96.current, 'optionalCall', _97 => _97()]);
|
|
3527
3620
|
}, []);
|
|
3528
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3529
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3530
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3531
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
3532
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
3533
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
3621
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _98 => _98.showLogo]), () => ( false));
|
|
3622
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _99 => _99.showStepper]), () => ( false));
|
|
3623
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _100 => _100.showBackButton]), () => ( true));
|
|
3624
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _101 => _101.balance]);
|
|
3625
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _102 => _102.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
3626
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _103 => _103.title]), () => ( "Deposit"));
|
|
3534
3627
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
3535
3628
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3536
3629
|
_chunk7HJ7IBRHcjs.Modal,
|
|
@@ -3641,6 +3734,7 @@ function DepositModalInner({
|
|
|
3641
3734
|
sessionChainIds,
|
|
3642
3735
|
forceRegister,
|
|
3643
3736
|
waitForFinalTx,
|
|
3737
|
+
enableSolana,
|
|
3644
3738
|
reownWallet,
|
|
3645
3739
|
onConnect,
|
|
3646
3740
|
onDisconnect,
|