@rash2x/bridge-widget 0.7.4 → 0.7.6
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/evaa-bridge.cjs +3 -1
- package/dist/evaa-bridge.cjs.map +1 -1
- package/dist/evaa-bridge.mjs +14 -12
- package/dist/{index-Giyq4_RJ.js → index-CDaFAnWU.js} +2 -2
- package/dist/{index-Giyq4_RJ.js.map → index-CDaFAnWU.js.map} +1 -1
- package/dist/{index-DGMnvCZU.js → index-CF3yEUFF.js} +113 -49
- package/dist/index-CF3yEUFF.js.map +1 -0
- package/dist/{index-Cvo_dMKt.cjs → index-CbuEGPY8.cjs} +102 -38
- package/dist/index-CbuEGPY8.cjs.map +1 -0
- package/dist/{index-B9T9OLH8.cjs → index-DzUouoJg.cjs} +2 -2
- package/dist/{index-B9T9OLH8.cjs.map → index-DzUouoJg.cjs.map} +1 -1
- package/dist/index.d.ts +9 -3
- package/package.json +1 -1
- package/dist/index-Cvo_dMKt.cjs.map +0 -1
- package/dist/index-DGMnvCZU.js.map +0 -1
|
@@ -35,7 +35,7 @@ const reactWindow = require("react-window");
|
|
|
35
35
|
const common$1 = { "connecting": "Connecting…", "initializing": "Initializing...", "loading": "Loading...", "paste": "paste", "close": "Close", "zeroPlaceholder": "0", "nativeToken": "Native Token" };
|
|
36
36
|
const wallets$1 = { "addTonWallet": "Add TON wallet", "addEvmWallet": "Add EVM wallet", "connectTonWallet": "Connect TON wallet", "connectEvmWallet": "Connect EVM wallet", "initializingMetamask": "Initializing MetaMask SDK...", "initializingTronlink": "Initializing TronLink...", "failedToConnectTon": "Failed to connect to TON wallet", "failedToDisconnect": "Failed to disconnect", "metamaskConnectionError": "MetaMask connection error", "failedToConnectMetamask": "Failed to connect to MetaMask", "failedToDisconnectMetamask": "Failed to disconnect from MetaMask", "selectWallet": "Select Wallet", "tonWallets": "TON", "evmWallets": "EVM", "tronWallets": "TRON", "tonconnect": "TonConnect", "metaMask": "WalletConnect", "walletConnect": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Add Tron wallet", "comingSoon": "Coming Soon", "connected": "CONNECTED", "connectedStatus": "Connected", "disconnect": "Disconnect", "chooseWallet": "Connect wallet", "oneWalletPerEnv": "You can only connect one wallet per environment.", "connect": "Connect", "connectTronWallet": "Connect Tron wallet", "connectWallet": "Connect wallet" };
|
|
37
37
|
const bridge$1 = { "max": "Max", "sourceNetwork": "Source network", "destinationNetwork": "Destination network", "selectToken": "Select token", "selectNetwork": "Select network", "selectSourceNetwork": "Select source network", "selectDestinationNetwork": "Select destination network", "searchToken": "Search token", "myTokens": "My tokens", "allTokens": "All tokens", "search": "Search", "select": "Select", "willChangeSourceChain": "Will change source network", "willChangeDestinationChain": "Will change destination network", "willChangeBothChains": "Will change both networks", "willChangeSourceNetworkAndToken": "Will change source token", "noBalancesFound": "No balances found.", "noResults": "No results", "tokenNotFound": "We couldn't find a token with that name or symbol. Please try again.", "chainNotFound": "We couldn't find a chain with that name. Please try again.", "sendToAnotherAddress": "Send to another address", "youWillReceive": "You will receive", "anotherAddressPlaceholder": "Address", "addressDoesntMatch": "Address doesn't match the {{network}} network", "checkBeforeTransfer": "Check correctness before transfer" };
|
|
38
|
-
const transaction$1 = { "enterAmount": "Enter amount", "transfer": "Transfer", "getQuote": "Get quote", "failed": "Transaction Failed", "confirm": "Confirm transaction", "signTransaction": "Sign in transaction in wallet", "quoting": "Quoting...", "inProgress": "Transaction in progress...", "checkingBalance": "Checking balance...", "insufficientBalance": "Insufficient balance", "amountTooSmall": "Min {{min}}", "amountTooLarge": "Max {{max}}", "success": "Success", "successTitle": "Success", "done": "Done", "hashCopied": "Hash copied to clipboard", "bridged": "Bridged", "transferTitle": "Transfer", "hash": "Hash", "layerzeroScan": "TxHash", "finalFee": "Final Fee", "route": "Route", "routeTooltip": "Route is the path your transfer takes between networks. The bridge is powered by LayerZero, and the specific path can affect the fee, slippage, and estimated time.", "estTime": "Est. Time", "estTimeTooltip": "Estimated time is the approximate completion time. It depends on the route and network load; actual time may vary.", "slippage": "Slippage", "slippageTooltip": "If the received amount goes below this tolerance, the transaction will be reverted.", "minimumReceived": "Minimum received", "messageFee": "Message Fee", "messageFeeTooltip": "Message fee is the LayerZero cross-chain messaging cost paid to relay your transaction between networks.", "bridgeFee": "Bridge Fee", "bridgeFeeTooltip": "Bridge fee is the difference between the amount you send and the amount you receive, charged by the bridge protocol.", "totalFee": "Total Fee", "totalFeeTooltip": "Total fee is the estimated total cost of the transfer, including message and bridge fees. The final fee may vary slightly.", "gasEstimate": "Gas: {{gas}}", "noRouteFound": "No route found", "notEnoughGas": "Not enough gas", "pasteAddressToTransfer": "Paste address to transfer", "noRouteFoundForSettings": "No route found for current settings.", "tryAdjustSettings": "Try disabling Gas on Destination, or adjust amount/networks.", "quoteError": "Quote error", "steps": { "sent": "Sent", "approving": "Approving Token", "approvingNote": "Step {{current}} of {{total}}: Confirm approval in wallet", "bridging": "Bridging", "processing": "Processing", "processingNote": "Up to 2 minutes", "completed": "Completed" } };
|
|
38
|
+
const transaction$1 = { "enterAmount": "Enter amount", "transfer": "Transfer", "getQuote": "Get quote", "failed": "Transaction Failed", "confirm": "Confirm transaction", "signTransaction": "Sign in transaction in wallet", "quoting": "Quoting...", "inProgress": "Transaction in progress...", "checkingBalance": "Checking balance...", "insufficientBalance": "Insufficient balance", "amountTooSmall": "Min {{min}}", "amountTooLarge": "Max {{max}}", "success": "Success", "successTitle": "Success", "done": "Done", "hashCopied": "Hash copied to clipboard", "bridged": "Bridged", "transferTitle": "Transfer", "hash": "Hash", "layerzeroScan": "TxHash", "finalFee": "Final Fee", "route": "Route", "routeTooltip": "Route is the path your transfer takes between networks. The bridge is powered by LayerZero, and the specific path can affect the fee, slippage, and estimated time.", "estTime": "Est. Time", "estTimeTooltip": "Estimated time is the approximate completion time. It depends on the route and network load; actual time may vary.", "slippage": "Slippage", "slippageTooltip": "If the received amount goes below this tolerance, the transaction will be reverted.", "minimumReceived": "Minimum received", "messageFee": "Message Fee", "messageFeeTooltip": "Message fee is the LayerZero cross-chain messaging cost paid to relay your transaction between networks.", "bridgeFee": "Bridge Fee", "bridgeFeeTooltip": "Bridge fee is the difference between the amount you send and the amount you receive, charged by the bridge protocol.", "totalFee": "Total Fee", "totalFeeTooltip": "Total fee is the estimated total cost of the transfer, including message and bridge fees. The final fee may vary slightly.", "gasEstimate": "Gas: {{gas}}", "noRouteFound": "No route found", "noRouteAlert": "No supported route found. Choose a different source or destination network.", "notEnoughGas": "Not enough gas", "pasteAddressToTransfer": "Paste address to transfer", "noRouteFoundForSettings": "No route found for current settings.", "tryAdjustSettings": "Try disabling Gas on Destination, or adjust amount/networks.", "quoteError": "Quote error", "steps": { "sent": "Sent", "approving": "Approving Token", "approvingNote": "Step {{current}} of {{total}}: Confirm approval in wallet", "bridging": "Bridging", "processing": "Processing", "processingNote": "Up to 2 minutes", "completed": "Completed" } };
|
|
39
39
|
const telegram$1 = { "openWebVersion": "Open EVAA Web to Bridge", "restrictionMessage": "You can bridge between the chosen networks on EVAA web version" };
|
|
40
40
|
const app$1 = { "stargateWidgetName": "Stargate Bridge Widget", "liveWidget": "Live Widget", "getStarted": "Get Started" };
|
|
41
41
|
const settings$1 = { "title": "Settings", "gasOnDestination": "Gas on destination", "gasOnDestinationTooltip": "Adds the destination network's native token to cover fees for transactions after bridging. Increases the total fee.", "slippageTolerance": "Slippage tolerance", "slippageToleranceTooltip": "If the received amount goes below this tolerance, the transaction will be reverted.", "routePriority": "Route Priority", "routePriorityTooltip": "Select how the bridge chooses a route. Recommended balances options to find the best overall cost. Fastest prioritizes completion speed over everything else.", "highSlippageWarning": "High slippage warning", "gasPresets": { "auto": "Auto", "none": "None", "medium": "Medium", "max": "Max" }, "routePresets": { "fastest": "Fastest", "cheapest": "Cheapest", "recommended": "Recommended" } };
|
|
@@ -53,7 +53,7 @@ const en$3 = {
|
|
|
53
53
|
const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
|
|
54
54
|
const wallets = { "addTonWallet": "Добавить TON кошелёк", "addEvmWallet": "Добавить EVM кошелёк", "connectTonWallet": "Подключить TON кошелёк", "connectEvmWallet": "Подключить EVM кошелёк", "initializingMetamask": "Инициализация MetaMask SDK...", "initializingTronlink": "Инициализация TronLink...", "failedToConnectTon": "Не удалось подключиться к TON кошельку", "failedToDisconnect": "Не удалось отключиться", "metamaskConnectionError": "Ошибка подключения MetaMask", "failedToConnectMetamask": "Не удалось подключиться к MetaMask", "failedToDisconnectMetamask": "Не удалось отключиться от MetaMask", "selectWallet": "Выберите кошелёк", "tonWallets": "TON", "evmWallets": "EVM", "tronWallets": "TRON", "tonconnect": "TonConnect", "metaMask": "WalletConnect", "walletConnect": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Добавить Tron кошелёк", "comingSoon": "Скоро", "connected": "ПОДКЛЮЧЕНО", "connectedStatus": "Подключён", "disconnect": "Отключить", "chooseWallet": "Подключите кошелек", "oneWalletPerEnv": "Можно подключить только один кошелёк на окружение.", "connect": "Подключить", "connectTronWallet": "Подключить Tron кошелёк", "connectWallet": "Подключить кошелёк" };
|
|
55
55
|
const bridge = { "max": "Макс", "sourceNetwork": "Исходная сеть", "destinationNetwork": "Целевая сеть", "selectToken": "Выбрать токен", "selectNetwork": "Выбрать сеть", "selectSourceNetwork": "Выбрать исходную сеть", "selectDestinationNetwork": "Выбрать целевую сеть", "searchToken": "Поиск токена", "myTokens": "Мои токены", "allTokens": "Все токены", "search": "Поиск", "select": "Выбрать", "willChangeSourceChain": "Сменит исходную сеть", "willChangeDestinationChain": "Сменит целевую сеть", "willChangeBothChains": "Сменит обе сети", "willChangeSourceNetworkAndToken": "Сменит исходный токен", "noBalancesFound": "Балансы не найдены.", "noResults": "Нет результатов", "tokenNotFound": "Мы не смогли найти токен с таким названием или символом. Пожалуйста, попробуйте снова.", "chainNotFound": "Мы не смогли найти сеть с таким названием. Пожалуйста, попробуйте снова.", "sendToAnotherAddress": "Отправить на другой адрес", "youWillReceive": "Вы получите", "anotherAddressPlaceholder": "Адрес", "addressDoesntMatch": "Адрес не соответствует сети {{network}}", "checkBeforeTransfer": "Проверьте корректность перед переводом" };
|
|
56
|
-
const transaction = { "enterAmount": "Введите сумму", "transfer": "Перевести", "getQuote": "Получить котировку", "quoting": "Расчет котировки...", "failed": "Ошибка транзакции", "confirm": "Подтвердите транзакцию", "signTransaction": "Подпишите транзакцию в кошельке", "inProgress": "Транзакция выполняется...", "checkingBalance": "Проверка баланса...", "insufficientBalance": "Недостаточно средств", "amountTooSmall": "Минимум {{min}}", "amountTooLarge": "Максимум {{max}}", "success": "Успех", "successTitle": "Успех", "done": "Готово", "hashCopied": "Хэш скопирован в буфер обмена", "bridged": "Переведено", "transferTitle": "Перевод", "hash": "Хэш", "layerzeroScan": "TxHash", "finalFee": "Итоговая комиссия", "route": "Маршрут", "routeTooltip": "Маршрут — это путь, по которому будет выполнен перевод. Мост работает на базе LayerZero, а конкретный путь передачи между сетями может влиять на комиссию, проскальзывание и время.", "estTime": "Время", "estTimeTooltip": "Среднее время — примерное время завершения перевода. Зависит от маршрута и нагрузки сети; фактическое время может отличаться.", "slippage": "Проскальзывание", "slippageTooltip": "Если получаемая сумма окажется ниже этого допуска, транзакция будет отклонена.", "minimumReceived": "Минимум к получению", "messageFee": "Комиссия сообщения", "messageFeeTooltip": "Комиссия сообщения — стоимость кросс-чейн передачи через LayerZero для ретрансляции транзакции между сетями.", "bridgeFee": "Комиссия моста", "bridgeFeeTooltip": "Комиссия моста — разница между отправленной и полученной суммой, взимаемая протоколом моста.", "totalFee": "Общая комиссия", "totalFeeTooltip": "Общая комиссия за перевод, включая комиссию сообщения и моста. Фактическая сумма может немного измениться.", "gasEstimate": "Газ: {{gas}}", "noRouteFound": "Маршрут не найден", "notEnoughGas": "Недостаточно газа", "pasteAddressToTransfer": "Укажите адрес получателя", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки", "steps": { "sent": "Отправлено", "approving": "Одобрение токена", "approvingNote": "Шаг {{current}} из {{total}}: Подтвердите одобрение в кошельке", "bridging": "Перевод через мост", "processing": "Обработка", "processingNote": "До 2 минут", "completed": "Завершено" } };
|
|
56
|
+
const transaction = { "enterAmount": "Введите сумму", "transfer": "Перевести", "getQuote": "Получить котировку", "quoting": "Расчет котировки...", "failed": "Ошибка транзакции", "confirm": "Подтвердите транзакцию", "signTransaction": "Подпишите транзакцию в кошельке", "inProgress": "Транзакция выполняется...", "checkingBalance": "Проверка баланса...", "insufficientBalance": "Недостаточно средств", "amountTooSmall": "Минимум {{min}}", "amountTooLarge": "Максимум {{max}}", "success": "Успех", "successTitle": "Успех", "done": "Готово", "hashCopied": "Хэш скопирован в буфер обмена", "bridged": "Переведено", "transferTitle": "Перевод", "hash": "Хэш", "layerzeroScan": "TxHash", "finalFee": "Итоговая комиссия", "route": "Маршрут", "routeTooltip": "Маршрут — это путь, по которому будет выполнен перевод. Мост работает на базе LayerZero, а конкретный путь передачи между сетями может влиять на комиссию, проскальзывание и время.", "estTime": "Время", "estTimeTooltip": "Среднее время — примерное время завершения перевода. Зависит от маршрута и нагрузки сети; фактическое время может отличаться.", "slippage": "Проскальзывание", "slippageTooltip": "Если получаемая сумма окажется ниже этого допуска, транзакция будет отклонена.", "minimumReceived": "Минимум к получению", "messageFee": "Комиссия сообщения", "messageFeeTooltip": "Комиссия сообщения — стоимость кросс-чейн передачи через LayerZero для ретрансляции транзакции между сетями.", "bridgeFee": "Комиссия моста", "bridgeFeeTooltip": "Комиссия моста — разница между отправленной и полученной суммой, взимаемая протоколом моста.", "totalFee": "Общая комиссия", "totalFeeTooltip": "Общая комиссия за перевод, включая комиссию сообщения и моста. Фактическая сумма может немного измениться.", "gasEstimate": "Газ: {{gas}}", "noRouteFound": "Маршрут не найден", "noRouteAlert": "Маршрут не найден. Выберите другую сеть отправления или получения.", "notEnoughGas": "Недостаточно газа", "pasteAddressToTransfer": "Укажите адрес получателя", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки", "steps": { "sent": "Отправлено", "approving": "Одобрение токена", "approvingNote": "Шаг {{current}} из {{total}}: Подтвердите одобрение в кошельке", "bridging": "Перевод через мост", "processing": "Обработка", "processingNote": "До 2 минут", "completed": "Завершено" } };
|
|
57
57
|
const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
|
|
58
58
|
const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
|
|
59
59
|
const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "gasOnDestinationTooltip": "Добавляет нативный токен целевой сети для оплаты комиссий за транзакции после бриджа. Увеличивает общую комиссию.", "slippageTolerance": "Толерантность к проскальзыванию", "slippageToleranceTooltip": "Если получаемая сумма окажется ниже этого допуска, транзакция будет отклонена.", "routePriority": "Приоритет маршрута", "routePriorityTooltip": "Выберите маршрут перевода. Рекомендуемый — подбирает самый выгодный вариант по общей стоимости. Быстрый — выбирает маршрут с приоритетом скорости, даже если это дороже.", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрый", "cheapest": "Дешевый", "recommended": "Рекомендуемый" } };
|
|
@@ -506,10 +506,7 @@ const ExitIcon = (props) => {
|
|
|
506
506
|
}
|
|
507
507
|
);
|
|
508
508
|
};
|
|
509
|
-
const SwapButton = ({
|
|
510
|
-
canSwap,
|
|
511
|
-
onSwap
|
|
512
|
-
}) => {
|
|
509
|
+
const SwapButton = ({ canSwap, onSwap }) => {
|
|
513
510
|
const [turns, setTurns] = react.useState(0);
|
|
514
511
|
const [isSwapping, setIsSwapping] = react.useState(false);
|
|
515
512
|
const handleSwap = react.useCallback(() => {
|
|
@@ -1074,6 +1071,49 @@ const useTokensStore = zustand.create((set2) => ({
|
|
|
1074
1071
|
});
|
|
1075
1072
|
}
|
|
1076
1073
|
}));
|
|
1074
|
+
const ALLOWED_TO_CHAINS = /* @__PURE__ */ new Set([
|
|
1075
|
+
"ethereum",
|
|
1076
|
+
"manta",
|
|
1077
|
+
"opbnb",
|
|
1078
|
+
"polygon",
|
|
1079
|
+
"conflux",
|
|
1080
|
+
"ton",
|
|
1081
|
+
"tron",
|
|
1082
|
+
"megaeth",
|
|
1083
|
+
"mantle",
|
|
1084
|
+
"base",
|
|
1085
|
+
"plasma",
|
|
1086
|
+
"monad",
|
|
1087
|
+
"celo",
|
|
1088
|
+
"linea",
|
|
1089
|
+
"blast",
|
|
1090
|
+
"scroll",
|
|
1091
|
+
"cronosevm",
|
|
1092
|
+
"optimism",
|
|
1093
|
+
"gnosis",
|
|
1094
|
+
"sonic",
|
|
1095
|
+
"fantom",
|
|
1096
|
+
"zksync",
|
|
1097
|
+
"metis",
|
|
1098
|
+
"zkevm",
|
|
1099
|
+
"moonbeam",
|
|
1100
|
+
"moonriver",
|
|
1101
|
+
"kava",
|
|
1102
|
+
"klaytn",
|
|
1103
|
+
"avalanche",
|
|
1104
|
+
"arbitrum",
|
|
1105
|
+
"bsc",
|
|
1106
|
+
"aurora"
|
|
1107
|
+
]);
|
|
1108
|
+
const ALLOWED_FROM_CHAINS = new Set(
|
|
1109
|
+
[...ALLOWED_TO_CHAINS].filter((k2) => k2 !== "tron")
|
|
1110
|
+
);
|
|
1111
|
+
function isAllowedFromChain(chainKey) {
|
|
1112
|
+
return ALLOWED_FROM_CHAINS.has(chainKey);
|
|
1113
|
+
}
|
|
1114
|
+
function isAllowedToChain(chainKey) {
|
|
1115
|
+
return ALLOWED_TO_CHAINS.has(chainKey);
|
|
1116
|
+
}
|
|
1077
1117
|
async function getChains() {
|
|
1078
1118
|
const res = await fetch("https://stargate.finance/api/v1/chains", {
|
|
1079
1119
|
credentials: "same-origin"
|
|
@@ -1082,7 +1122,8 @@ async function getChains() {
|
|
|
1082
1122
|
throw new Error(`Failed to load chains: ${res.status}`);
|
|
1083
1123
|
}
|
|
1084
1124
|
const data = await res.json();
|
|
1085
|
-
|
|
1125
|
+
const all = Array.isArray(data) ? data : data.chains ?? [];
|
|
1126
|
+
return all.filter((c2) => ALLOWED_TO_CHAINS.has(c2.chainKey));
|
|
1086
1127
|
}
|
|
1087
1128
|
async function getTokens() {
|
|
1088
1129
|
const res = await fetch("https://stargate.finance/api/v1/tokens", {
|
|
@@ -1225,17 +1266,18 @@ const ChainSelectModal = ({
|
|
|
1225
1266
|
);
|
|
1226
1267
|
const groupedChains = react.useMemo(() => {
|
|
1227
1268
|
const q3 = query.trim().toLowerCase();
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1230
|
-
|
|
1269
|
+
const isAllowed = isSource ? isAllowedFromChain : isAllowedToChain;
|
|
1270
|
+
const filtered = (items ?? []).filter((c2) => isAllowed(c2.chainKey)).filter(
|
|
1271
|
+
(c2) => !q3 || c2.name.toLowerCase().includes(q3) || c2.chainKey.toLowerCase().includes(q3)
|
|
1272
|
+
);
|
|
1231
1273
|
const groups = {
|
|
1232
1274
|
available: [],
|
|
1233
1275
|
willChangeSrc: [],
|
|
1234
1276
|
willChangeTokenAndSrc: []
|
|
1235
1277
|
};
|
|
1236
1278
|
for (const chain2 of filtered) {
|
|
1237
|
-
const
|
|
1238
|
-
if (
|
|
1279
|
+
const isAllowed2 = allowedItems?.some((c2) => c2.chainKey === chain2.chainKey) || false;
|
|
1280
|
+
if (isAllowed2) {
|
|
1239
1281
|
groups.available.push(chain2);
|
|
1240
1282
|
} else {
|
|
1241
1283
|
const compatibleSrc = findCompatibleSrcChain(chain2);
|
|
@@ -1258,7 +1300,8 @@ const ChainSelectModal = ({
|
|
|
1258
1300
|
query,
|
|
1259
1301
|
allowedItems,
|
|
1260
1302
|
findCompatibleSrcChain,
|
|
1261
|
-
findCompatibleTokenAndSrcChain
|
|
1303
|
+
findCompatibleTokenAndSrcChain,
|
|
1304
|
+
isSource
|
|
1262
1305
|
]);
|
|
1263
1306
|
const PRIORITY_CHAINS = react.useMemo(
|
|
1264
1307
|
() => ["ethereum", "arbitrum", "bsc", "polygon", "optimism", "base"],
|
|
@@ -2164,7 +2207,8 @@ async function fetchQuotes(req) {
|
|
|
2164
2207
|
).toString()}`;
|
|
2165
2208
|
const res = await fetch(url);
|
|
2166
2209
|
const data = await res.json();
|
|
2167
|
-
|
|
2210
|
+
const quotes = data?.quotes ?? [];
|
|
2211
|
+
return quotes.filter((q3) => !q3.error);
|
|
2168
2212
|
}
|
|
2169
2213
|
function selectQuoteByPriority(routes, priority) {
|
|
2170
2214
|
if (priority === RoutePriority.FASTEST) {
|
|
@@ -2357,9 +2401,9 @@ function calculateMinReceived(quote, slippageBps, dstToken) {
|
|
|
2357
2401
|
const minAmountLD = dstAmountLD * BigInt(1e4 - slippageBps) / BigInt(1e4);
|
|
2358
2402
|
return fromLD(minAmountLD.toString(), dstToken.decimals);
|
|
2359
2403
|
}
|
|
2360
|
-
function getQuoteDetails(quote, srcToken, dstToken, tokens, chains, slippageBps) {
|
|
2404
|
+
function getQuoteDetails(quote, srcToken, dstToken, tokens, chains, slippageBps, srcChain, dstChain) {
|
|
2361
2405
|
const amounts = getQuoteAmounts(quote, srcToken, dstToken);
|
|
2362
|
-
const fees = computeFeeBreakdownUsd(quote, srcToken, tokens, chains);
|
|
2406
|
+
const fees = computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstChain);
|
|
2363
2407
|
const minimumReceived = calculateMinReceived(quote, slippageBps, dstToken);
|
|
2364
2408
|
return {
|
|
2365
2409
|
inputAmount: amounts.inputHuman,
|
|
@@ -2379,16 +2423,19 @@ function getRouteDisplayName(route) {
|
|
|
2379
2423
|
if (routeLower.includes("v2")) return "Stargate V2";
|
|
2380
2424
|
return route.split(/[/\-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
2381
2425
|
}
|
|
2382
|
-
function computeFeeBreakdownUsd(quote, srcToken, tokens, chains) {
|
|
2426
|
+
function computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstChain) {
|
|
2427
|
+
const defaultMsgSymbol = srcChain?.nativeCurrency?.symbol?.toUpperCase() ?? "";
|
|
2428
|
+
const defaultBridgeSymbol = srcToken?.symbol?.toUpperCase() ?? "";
|
|
2429
|
+
const defaultDstGasSymbol = dstChain?.nativeCurrency?.symbol?.toUpperCase() ?? "";
|
|
2383
2430
|
const empty = {
|
|
2384
2431
|
messageFeeAmount: 0,
|
|
2385
|
-
messageFeeSymbol:
|
|
2432
|
+
messageFeeSymbol: defaultMsgSymbol,
|
|
2386
2433
|
messageFeeUsd: 0,
|
|
2387
2434
|
bridgeFeeAmount: 0,
|
|
2388
|
-
bridgeFeeSymbol:
|
|
2435
|
+
bridgeFeeSymbol: defaultBridgeSymbol,
|
|
2389
2436
|
bridgeFeeUsd: 0,
|
|
2390
2437
|
dstGasAmount: 0,
|
|
2391
|
-
dstGasSymbol:
|
|
2438
|
+
dstGasSymbol: defaultDstGasSymbol,
|
|
2392
2439
|
dstGasUsd: 0,
|
|
2393
2440
|
totalFeeUsd: 0
|
|
2394
2441
|
};
|
|
@@ -2430,16 +2477,16 @@ function computeFeeBreakdownUsd(quote, srcToken, tokens, chains) {
|
|
|
2430
2477
|
let dstGasUsd = 0;
|
|
2431
2478
|
const dstNativeAmountLD = quote.dstNativeAmount;
|
|
2432
2479
|
if (dstNativeAmountLD && BigInt(dstNativeAmountLD || "0") > 0n) {
|
|
2433
|
-
const
|
|
2434
|
-
if (
|
|
2480
|
+
const dstChain2 = chains?.find((c2) => c2.chainKey === quote.dstChainKey);
|
|
2481
|
+
if (dstChain2) {
|
|
2435
2482
|
const { decimals, priceUsd } = lookupTokenMeta(
|
|
2436
2483
|
tokens,
|
|
2437
2484
|
chains,
|
|
2438
|
-
|
|
2439
|
-
|
|
2485
|
+
dstChain2.chainKey,
|
|
2486
|
+
dstChain2.nativeCurrency.address
|
|
2440
2487
|
);
|
|
2441
2488
|
dstGasAmount = fromLD(dstNativeAmountLD, decimals);
|
|
2442
|
-
dstGasSymbol =
|
|
2489
|
+
dstGasSymbol = dstChain2.nativeCurrency.symbol?.toUpperCase() ?? "";
|
|
2443
2490
|
dstGasUsd = dstGasAmount * (priceUsd ?? 0);
|
|
2444
2491
|
}
|
|
2445
2492
|
}
|
|
@@ -2619,14 +2666,16 @@ function useBridgeQuote() {
|
|
|
2619
2666
|
slippage: slippageDecimal,
|
|
2620
2667
|
routePriority
|
|
2621
2668
|
});
|
|
2622
|
-
if (quoteRoute
|
|
2623
|
-
|
|
2624
|
-
|
|
2669
|
+
if (!quoteRoute || quoteRoute.route === null) {
|
|
2670
|
+
if (!cancelled) {
|
|
2671
|
+
setNoRoute(true);
|
|
2672
|
+
setLoading(false);
|
|
2673
|
+
}
|
|
2625
2674
|
return;
|
|
2626
2675
|
} else {
|
|
2627
2676
|
setNoRoute(false);
|
|
2628
2677
|
}
|
|
2629
|
-
if (!quoteRoute
|
|
2678
|
+
if (!quoteRoute.dstAmount || BigInt(quoteRoute.dstAmount) === BigInt(0)) {
|
|
2630
2679
|
if (!cancelled) resetUi();
|
|
2631
2680
|
return;
|
|
2632
2681
|
}
|
|
@@ -2697,7 +2746,7 @@ const useChainDerivations = () => {
|
|
|
2697
2746
|
return [];
|
|
2698
2747
|
const byChain = assetMatrix[selectedAssetSymbol.toUpperCase()];
|
|
2699
2748
|
const keys2 = new Set(Object.keys(byChain ?? {}));
|
|
2700
|
-
const result = chains.filter((c2) => keys2.has(c2.chainKey));
|
|
2749
|
+
const result = chains.filter((c2) => keys2.has(c2.chainKey) && isAllowedFromChain(c2.chainKey));
|
|
2701
2750
|
return result;
|
|
2702
2751
|
}, [selectedAssetSymbol, assetMatrix, chains]);
|
|
2703
2752
|
react.useEffect(() => {
|
|
@@ -2761,7 +2810,7 @@ const useChainDerivations = () => {
|
|
|
2761
2810
|
return !!symbolMatch;
|
|
2762
2811
|
});
|
|
2763
2812
|
const keys2 = new Set(filteredDest.map((t2) => t2.chainKey));
|
|
2764
|
-
let list = chains.filter((c2) => keys2.has(c2.chainKey));
|
|
2813
|
+
let list = chains.filter((c2) => keys2.has(c2.chainKey) && isAllowedToChain(c2.chainKey));
|
|
2765
2814
|
if (fromChain?.chainKey) {
|
|
2766
2815
|
list = list.filter((c2) => c2.chainKey !== fromChain.chainKey);
|
|
2767
2816
|
}
|
|
@@ -2930,6 +2979,7 @@ function useSwapModel() {
|
|
|
2930
2979
|
const toChain = chainsStore.toChain;
|
|
2931
2980
|
const sym = (tokensStore.selectedAssetSymbol ?? "").toUpperCase();
|
|
2932
2981
|
if (!fromChain || !toChain || !sym) return;
|
|
2982
|
+
if (!isAllowedFromChain(toChain.chainKey)) return;
|
|
2933
2983
|
chainsStore.setAllowedToChains([]);
|
|
2934
2984
|
chainsStore.setFromChain(toChain);
|
|
2935
2985
|
const tokenOnNewFrom = tokensStore.assetMatrix?.[sym]?.[toChain.chainKey];
|
|
@@ -2995,15 +3045,15 @@ const TokenSymbol = ({
|
|
|
2995
3045
|
function useFeeBreakdown() {
|
|
2996
3046
|
const { quote } = useBridgeQuoteStore();
|
|
2997
3047
|
const { tokens, allTokens, selectedAssetSymbol, assetMatrix } = useTokensStore();
|
|
2998
|
-
const { fromChain, chains } = useChainsStore();
|
|
3048
|
+
const { fromChain, toChain, chains } = useChainsStore();
|
|
2999
3049
|
return react.useMemo(() => {
|
|
3000
3050
|
const srcToken = resolveTokenOnChainFromMatrix$1(
|
|
3001
3051
|
assetMatrix,
|
|
3002
3052
|
selectedAssetSymbol,
|
|
3003
3053
|
fromChain?.chainKey
|
|
3004
3054
|
);
|
|
3005
|
-
return computeFeeBreakdownUsd(quote, srcToken, allTokens ?? tokens, chains);
|
|
3006
|
-
}, [quote, allTokens, tokens, chains, selectedAssetSymbol, assetMatrix, fromChain]);
|
|
3055
|
+
return computeFeeBreakdownUsd(quote, srcToken, allTokens ?? tokens, chains, fromChain, toChain);
|
|
3056
|
+
}, [quote, allTokens, tokens, chains, selectedAssetSymbol, assetMatrix, fromChain, toChain]);
|
|
3007
3057
|
}
|
|
3008
3058
|
function useBridgeExternalData(options) {
|
|
3009
3059
|
const selectedAssetSymbol = useTokensStore(
|
|
@@ -3090,7 +3140,9 @@ function buildBridgeExternalData({
|
|
|
3090
3140
|
destinationToken,
|
|
3091
3141
|
tokens,
|
|
3092
3142
|
chains,
|
|
3093
|
-
slippageBps
|
|
3143
|
+
slippageBps,
|
|
3144
|
+
fromChain,
|
|
3145
|
+
toChain
|
|
3094
3146
|
);
|
|
3095
3147
|
const etaText = quoteDetails.etaSeconds != null ? `≈ ${Math.max(1, Math.round(quoteDetails.etaSeconds / 60))}m` : "—";
|
|
3096
3148
|
const currentSlippageText = !quote ? "—" : formatPercentage(slippageBps);
|
|
@@ -4218,6 +4270,14 @@ const MainButton = ({
|
|
|
4218
4270
|
children: /* @__PURE__ */ jsxRuntime.jsx(alert.AlertDescription, { className: "leading-snug tracking-wide", children: t2("telegram.restrictionMessage") })
|
|
4219
4271
|
}
|
|
4220
4272
|
),
|
|
4273
|
+
noRoute && !isTelegramRestricted && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4274
|
+
alert.Alert,
|
|
4275
|
+
{
|
|
4276
|
+
variant: "warning",
|
|
4277
|
+
className: "mt-2 text-sm font-medium text-center px-2 py-2",
|
|
4278
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(alert.AlertDescription, { className: "leading-snug tracking-wide", children: t2("transaction.noRouteAlert") })
|
|
4279
|
+
}
|
|
4280
|
+
),
|
|
4221
4281
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4222
4282
|
button.Button,
|
|
4223
4283
|
{
|
|
@@ -26047,7 +26107,7 @@ class WalletConnectModal {
|
|
|
26047
26107
|
}
|
|
26048
26108
|
async initUi() {
|
|
26049
26109
|
if (typeof window !== "undefined") {
|
|
26050
|
-
await Promise.resolve().then(() => require("./index-
|
|
26110
|
+
await Promise.resolve().then(() => require("./index-DzUouoJg.cjs"));
|
|
26051
26111
|
const modal = document.createElement("wcm-modal");
|
|
26052
26112
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26053
26113
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26755,7 +26815,9 @@ const EvaaBridgeContent = ({
|
|
|
26755
26815
|
const allowedFromChains = swap.allowedFromChains;
|
|
26756
26816
|
const allowedToChains = swap.allowedToChains;
|
|
26757
26817
|
const { chains } = useChainsStore();
|
|
26758
|
-
const canSwap = Boolean(
|
|
26818
|
+
const canSwap = Boolean(
|
|
26819
|
+
fromChain && toChain && selectedAssetSymbol && isAllowedFromChain(toChain.chainKey)
|
|
26820
|
+
);
|
|
26759
26821
|
const outputAmount = react.useMemo(() => {
|
|
26760
26822
|
if (!quote || loading) return "";
|
|
26761
26823
|
const srcToken = resolveTokenOnChainFromMatrix$1(
|
|
@@ -26923,6 +26985,8 @@ exports.getRouteDisplayName = getRouteDisplayName;
|
|
|
26923
26985
|
exports.getTokens = getTokens;
|
|
26924
26986
|
exports.getTonBalances = getTonBalances;
|
|
26925
26987
|
exports.getTronBalances = getTronBalances;
|
|
26988
|
+
exports.isAllowedFromChain = isAllowedFromChain;
|
|
26989
|
+
exports.isAllowedToChain = isAllowedToChain;
|
|
26926
26990
|
exports.isNativeAddrEqual = isNativeAddrEqual;
|
|
26927
26991
|
exports.isNativeAddress = isNativeAddress;
|
|
26928
26992
|
exports.isZeroAddr = isZeroAddr;
|
|
@@ -26945,4 +27009,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
26945
27009
|
exports.useSwapModel = useSwapModel;
|
|
26946
27010
|
exports.useTokensStore = useTokensStore;
|
|
26947
27011
|
exports.useTransactionStore = useTransactionStore;
|
|
26948
|
-
//# sourceMappingURL=index-
|
|
27012
|
+
//# sourceMappingURL=index-CbuEGPY8.cjs.map
|