@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
|
@@ -34,7 +34,7 @@ import { FixedSizeList } from "react-window";
|
|
|
34
34
|
const common$1 = { "connecting": "Connecting…", "initializing": "Initializing...", "loading": "Loading...", "paste": "paste", "close": "Close", "zeroPlaceholder": "0", "nativeToken": "Native Token" };
|
|
35
35
|
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" };
|
|
36
36
|
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" };
|
|
37
|
-
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" } };
|
|
37
|
+
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" } };
|
|
38
38
|
const telegram$1 = { "openWebVersion": "Open EVAA Web to Bridge", "restrictionMessage": "You can bridge between the chosen networks on EVAA web version" };
|
|
39
39
|
const app$1 = { "stargateWidgetName": "Stargate Bridge Widget", "liveWidget": "Live Widget", "getStarted": "Get Started" };
|
|
40
40
|
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" } };
|
|
@@ -52,7 +52,7 @@ const en$3 = {
|
|
|
52
52
|
const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
|
|
53
53
|
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": "Подключить кошелёк" };
|
|
54
54
|
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": "Проверьте корректность перед переводом" };
|
|
55
|
-
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": "Завершено" } };
|
|
55
|
+
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": "Завершено" } };
|
|
56
56
|
const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
|
|
57
57
|
const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
|
|
58
58
|
const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "gasOnDestinationTooltip": "Добавляет нативный токен целевой сети для оплаты комиссий за транзакции после бриджа. Увеличивает общую комиссию.", "slippageTolerance": "Толерантность к проскальзыванию", "slippageToleranceTooltip": "Если получаемая сумма окажется ниже этого допуска, транзакция будет отклонена.", "routePriority": "Приоритет маршрута", "routePriorityTooltip": "Выберите маршрут перевода. Рекомендуемый — подбирает самый выгодный вариант по общей стоимости. Быстрый — выбирает маршрут с приоритетом скорости, даже если это дороже.", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрый", "cheapest": "Дешевый", "recommended": "Рекомендуемый" } };
|
|
@@ -505,10 +505,7 @@ const ExitIcon = (props) => {
|
|
|
505
505
|
}
|
|
506
506
|
);
|
|
507
507
|
};
|
|
508
|
-
const SwapButton = ({
|
|
509
|
-
canSwap,
|
|
510
|
-
onSwap
|
|
511
|
-
}) => {
|
|
508
|
+
const SwapButton = ({ canSwap, onSwap }) => {
|
|
512
509
|
const [turns, setTurns] = useState(0);
|
|
513
510
|
const [isSwapping, setIsSwapping] = useState(false);
|
|
514
511
|
const handleSwap = useCallback(() => {
|
|
@@ -1073,6 +1070,49 @@ const useTokensStore = create((set2) => ({
|
|
|
1073
1070
|
});
|
|
1074
1071
|
}
|
|
1075
1072
|
}));
|
|
1073
|
+
const ALLOWED_TO_CHAINS = /* @__PURE__ */ new Set([
|
|
1074
|
+
"ethereum",
|
|
1075
|
+
"manta",
|
|
1076
|
+
"opbnb",
|
|
1077
|
+
"polygon",
|
|
1078
|
+
"conflux",
|
|
1079
|
+
"ton",
|
|
1080
|
+
"tron",
|
|
1081
|
+
"megaeth",
|
|
1082
|
+
"mantle",
|
|
1083
|
+
"base",
|
|
1084
|
+
"plasma",
|
|
1085
|
+
"monad",
|
|
1086
|
+
"celo",
|
|
1087
|
+
"linea",
|
|
1088
|
+
"blast",
|
|
1089
|
+
"scroll",
|
|
1090
|
+
"cronosevm",
|
|
1091
|
+
"optimism",
|
|
1092
|
+
"gnosis",
|
|
1093
|
+
"sonic",
|
|
1094
|
+
"fantom",
|
|
1095
|
+
"zksync",
|
|
1096
|
+
"metis",
|
|
1097
|
+
"zkevm",
|
|
1098
|
+
"moonbeam",
|
|
1099
|
+
"moonriver",
|
|
1100
|
+
"kava",
|
|
1101
|
+
"klaytn",
|
|
1102
|
+
"avalanche",
|
|
1103
|
+
"arbitrum",
|
|
1104
|
+
"bsc",
|
|
1105
|
+
"aurora"
|
|
1106
|
+
]);
|
|
1107
|
+
const ALLOWED_FROM_CHAINS = new Set(
|
|
1108
|
+
[...ALLOWED_TO_CHAINS].filter((k2) => k2 !== "tron")
|
|
1109
|
+
);
|
|
1110
|
+
function isAllowedFromChain(chainKey) {
|
|
1111
|
+
return ALLOWED_FROM_CHAINS.has(chainKey);
|
|
1112
|
+
}
|
|
1113
|
+
function isAllowedToChain(chainKey) {
|
|
1114
|
+
return ALLOWED_TO_CHAINS.has(chainKey);
|
|
1115
|
+
}
|
|
1076
1116
|
async function getChains() {
|
|
1077
1117
|
const res = await fetch("https://stargate.finance/api/v1/chains", {
|
|
1078
1118
|
credentials: "same-origin"
|
|
@@ -1081,7 +1121,8 @@ async function getChains() {
|
|
|
1081
1121
|
throw new Error(`Failed to load chains: ${res.status}`);
|
|
1082
1122
|
}
|
|
1083
1123
|
const data = await res.json();
|
|
1084
|
-
|
|
1124
|
+
const all = Array.isArray(data) ? data : data.chains ?? [];
|
|
1125
|
+
return all.filter((c2) => ALLOWED_TO_CHAINS.has(c2.chainKey));
|
|
1085
1126
|
}
|
|
1086
1127
|
async function getTokens() {
|
|
1087
1128
|
const res = await fetch("https://stargate.finance/api/v1/tokens", {
|
|
@@ -1224,17 +1265,18 @@ const ChainSelectModal = ({
|
|
|
1224
1265
|
);
|
|
1225
1266
|
const groupedChains = useMemo(() => {
|
|
1226
1267
|
const q3 = query.trim().toLowerCase();
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
|
|
1268
|
+
const isAllowed = isSource ? isAllowedFromChain : isAllowedToChain;
|
|
1269
|
+
const filtered = (items ?? []).filter((c2) => isAllowed(c2.chainKey)).filter(
|
|
1270
|
+
(c2) => !q3 || c2.name.toLowerCase().includes(q3) || c2.chainKey.toLowerCase().includes(q3)
|
|
1271
|
+
);
|
|
1230
1272
|
const groups = {
|
|
1231
1273
|
available: [],
|
|
1232
1274
|
willChangeSrc: [],
|
|
1233
1275
|
willChangeTokenAndSrc: []
|
|
1234
1276
|
};
|
|
1235
1277
|
for (const chain2 of filtered) {
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1278
|
+
const isAllowed2 = allowedItems?.some((c2) => c2.chainKey === chain2.chainKey) || false;
|
|
1279
|
+
if (isAllowed2) {
|
|
1238
1280
|
groups.available.push(chain2);
|
|
1239
1281
|
} else {
|
|
1240
1282
|
const compatibleSrc = findCompatibleSrcChain(chain2);
|
|
@@ -1257,7 +1299,8 @@ const ChainSelectModal = ({
|
|
|
1257
1299
|
query,
|
|
1258
1300
|
allowedItems,
|
|
1259
1301
|
findCompatibleSrcChain,
|
|
1260
|
-
findCompatibleTokenAndSrcChain
|
|
1302
|
+
findCompatibleTokenAndSrcChain,
|
|
1303
|
+
isSource
|
|
1261
1304
|
]);
|
|
1262
1305
|
const PRIORITY_CHAINS = useMemo(
|
|
1263
1306
|
() => ["ethereum", "arbitrum", "bsc", "polygon", "optimism", "base"],
|
|
@@ -2163,7 +2206,8 @@ async function fetchQuotes(req) {
|
|
|
2163
2206
|
).toString()}`;
|
|
2164
2207
|
const res = await fetch(url);
|
|
2165
2208
|
const data = await res.json();
|
|
2166
|
-
|
|
2209
|
+
const quotes = data?.quotes ?? [];
|
|
2210
|
+
return quotes.filter((q3) => !q3.error);
|
|
2167
2211
|
}
|
|
2168
2212
|
function selectQuoteByPriority(routes, priority) {
|
|
2169
2213
|
if (priority === RoutePriority.FASTEST) {
|
|
@@ -2356,9 +2400,9 @@ function calculateMinReceived(quote, slippageBps, dstToken) {
|
|
|
2356
2400
|
const minAmountLD = dstAmountLD * BigInt(1e4 - slippageBps) / BigInt(1e4);
|
|
2357
2401
|
return fromLD(minAmountLD.toString(), dstToken.decimals);
|
|
2358
2402
|
}
|
|
2359
|
-
function getQuoteDetails(quote, srcToken, dstToken, tokens, chains, slippageBps) {
|
|
2403
|
+
function getQuoteDetails(quote, srcToken, dstToken, tokens, chains, slippageBps, srcChain, dstChain) {
|
|
2360
2404
|
const amounts = getQuoteAmounts(quote, srcToken, dstToken);
|
|
2361
|
-
const fees = computeFeeBreakdownUsd(quote, srcToken, tokens, chains);
|
|
2405
|
+
const fees = computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstChain);
|
|
2362
2406
|
const minimumReceived = calculateMinReceived(quote, slippageBps, dstToken);
|
|
2363
2407
|
return {
|
|
2364
2408
|
inputAmount: amounts.inputHuman,
|
|
@@ -2378,16 +2422,19 @@ function getRouteDisplayName(route) {
|
|
|
2378
2422
|
if (routeLower.includes("v2")) return "Stargate V2";
|
|
2379
2423
|
return route.split(/[/\-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
2380
2424
|
}
|
|
2381
|
-
function computeFeeBreakdownUsd(quote, srcToken, tokens, chains) {
|
|
2425
|
+
function computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstChain) {
|
|
2426
|
+
const defaultMsgSymbol = srcChain?.nativeCurrency?.symbol?.toUpperCase() ?? "";
|
|
2427
|
+
const defaultBridgeSymbol = srcToken?.symbol?.toUpperCase() ?? "";
|
|
2428
|
+
const defaultDstGasSymbol = dstChain?.nativeCurrency?.symbol?.toUpperCase() ?? "";
|
|
2382
2429
|
const empty = {
|
|
2383
2430
|
messageFeeAmount: 0,
|
|
2384
|
-
messageFeeSymbol:
|
|
2431
|
+
messageFeeSymbol: defaultMsgSymbol,
|
|
2385
2432
|
messageFeeUsd: 0,
|
|
2386
2433
|
bridgeFeeAmount: 0,
|
|
2387
|
-
bridgeFeeSymbol:
|
|
2434
|
+
bridgeFeeSymbol: defaultBridgeSymbol,
|
|
2388
2435
|
bridgeFeeUsd: 0,
|
|
2389
2436
|
dstGasAmount: 0,
|
|
2390
|
-
dstGasSymbol:
|
|
2437
|
+
dstGasSymbol: defaultDstGasSymbol,
|
|
2391
2438
|
dstGasUsd: 0,
|
|
2392
2439
|
totalFeeUsd: 0
|
|
2393
2440
|
};
|
|
@@ -2429,16 +2476,16 @@ function computeFeeBreakdownUsd(quote, srcToken, tokens, chains) {
|
|
|
2429
2476
|
let dstGasUsd = 0;
|
|
2430
2477
|
const dstNativeAmountLD = quote.dstNativeAmount;
|
|
2431
2478
|
if (dstNativeAmountLD && BigInt(dstNativeAmountLD || "0") > 0n) {
|
|
2432
|
-
const
|
|
2433
|
-
if (
|
|
2479
|
+
const dstChain2 = chains?.find((c2) => c2.chainKey === quote.dstChainKey);
|
|
2480
|
+
if (dstChain2) {
|
|
2434
2481
|
const { decimals, priceUsd } = lookupTokenMeta(
|
|
2435
2482
|
tokens,
|
|
2436
2483
|
chains,
|
|
2437
|
-
|
|
2438
|
-
|
|
2484
|
+
dstChain2.chainKey,
|
|
2485
|
+
dstChain2.nativeCurrency.address
|
|
2439
2486
|
);
|
|
2440
2487
|
dstGasAmount = fromLD(dstNativeAmountLD, decimals);
|
|
2441
|
-
dstGasSymbol =
|
|
2488
|
+
dstGasSymbol = dstChain2.nativeCurrency.symbol?.toUpperCase() ?? "";
|
|
2442
2489
|
dstGasUsd = dstGasAmount * (priceUsd ?? 0);
|
|
2443
2490
|
}
|
|
2444
2491
|
}
|
|
@@ -2618,14 +2665,16 @@ function useBridgeQuote() {
|
|
|
2618
2665
|
slippage: slippageDecimal,
|
|
2619
2666
|
routePriority
|
|
2620
2667
|
});
|
|
2621
|
-
if (quoteRoute
|
|
2622
|
-
|
|
2623
|
-
|
|
2668
|
+
if (!quoteRoute || quoteRoute.route === null) {
|
|
2669
|
+
if (!cancelled) {
|
|
2670
|
+
setNoRoute(true);
|
|
2671
|
+
setLoading(false);
|
|
2672
|
+
}
|
|
2624
2673
|
return;
|
|
2625
2674
|
} else {
|
|
2626
2675
|
setNoRoute(false);
|
|
2627
2676
|
}
|
|
2628
|
-
if (!quoteRoute
|
|
2677
|
+
if (!quoteRoute.dstAmount || BigInt(quoteRoute.dstAmount) === BigInt(0)) {
|
|
2629
2678
|
if (!cancelled) resetUi();
|
|
2630
2679
|
return;
|
|
2631
2680
|
}
|
|
@@ -2696,7 +2745,7 @@ const useChainDerivations = () => {
|
|
|
2696
2745
|
return [];
|
|
2697
2746
|
const byChain = assetMatrix[selectedAssetSymbol.toUpperCase()];
|
|
2698
2747
|
const keys2 = new Set(Object.keys(byChain ?? {}));
|
|
2699
|
-
const result = chains.filter((c2) => keys2.has(c2.chainKey));
|
|
2748
|
+
const result = chains.filter((c2) => keys2.has(c2.chainKey) && isAllowedFromChain(c2.chainKey));
|
|
2700
2749
|
return result;
|
|
2701
2750
|
}, [selectedAssetSymbol, assetMatrix, chains]);
|
|
2702
2751
|
useEffect(() => {
|
|
@@ -2760,7 +2809,7 @@ const useChainDerivations = () => {
|
|
|
2760
2809
|
return !!symbolMatch;
|
|
2761
2810
|
});
|
|
2762
2811
|
const keys2 = new Set(filteredDest.map((t2) => t2.chainKey));
|
|
2763
|
-
let list = chains.filter((c2) => keys2.has(c2.chainKey));
|
|
2812
|
+
let list = chains.filter((c2) => keys2.has(c2.chainKey) && isAllowedToChain(c2.chainKey));
|
|
2764
2813
|
if (fromChain?.chainKey) {
|
|
2765
2814
|
list = list.filter((c2) => c2.chainKey !== fromChain.chainKey);
|
|
2766
2815
|
}
|
|
@@ -2929,6 +2978,7 @@ function useSwapModel() {
|
|
|
2929
2978
|
const toChain = chainsStore.toChain;
|
|
2930
2979
|
const sym = (tokensStore.selectedAssetSymbol ?? "").toUpperCase();
|
|
2931
2980
|
if (!fromChain || !toChain || !sym) return;
|
|
2981
|
+
if (!isAllowedFromChain(toChain.chainKey)) return;
|
|
2932
2982
|
chainsStore.setAllowedToChains([]);
|
|
2933
2983
|
chainsStore.setFromChain(toChain);
|
|
2934
2984
|
const tokenOnNewFrom = tokensStore.assetMatrix?.[sym]?.[toChain.chainKey];
|
|
@@ -2994,15 +3044,15 @@ const TokenSymbol = ({
|
|
|
2994
3044
|
function useFeeBreakdown() {
|
|
2995
3045
|
const { quote } = useBridgeQuoteStore();
|
|
2996
3046
|
const { tokens, allTokens, selectedAssetSymbol, assetMatrix } = useTokensStore();
|
|
2997
|
-
const { fromChain, chains } = useChainsStore();
|
|
3047
|
+
const { fromChain, toChain, chains } = useChainsStore();
|
|
2998
3048
|
return useMemo(() => {
|
|
2999
3049
|
const srcToken = resolveTokenOnChainFromMatrix$1(
|
|
3000
3050
|
assetMatrix,
|
|
3001
3051
|
selectedAssetSymbol,
|
|
3002
3052
|
fromChain?.chainKey
|
|
3003
3053
|
);
|
|
3004
|
-
return computeFeeBreakdownUsd(quote, srcToken, allTokens ?? tokens, chains);
|
|
3005
|
-
}, [quote, allTokens, tokens, chains, selectedAssetSymbol, assetMatrix, fromChain]);
|
|
3054
|
+
return computeFeeBreakdownUsd(quote, srcToken, allTokens ?? tokens, chains, fromChain, toChain);
|
|
3055
|
+
}, [quote, allTokens, tokens, chains, selectedAssetSymbol, assetMatrix, fromChain, toChain]);
|
|
3006
3056
|
}
|
|
3007
3057
|
function useBridgeExternalData(options) {
|
|
3008
3058
|
const selectedAssetSymbol = useTokensStore(
|
|
@@ -3089,7 +3139,9 @@ function buildBridgeExternalData({
|
|
|
3089
3139
|
destinationToken,
|
|
3090
3140
|
tokens,
|
|
3091
3141
|
chains,
|
|
3092
|
-
slippageBps
|
|
3142
|
+
slippageBps,
|
|
3143
|
+
fromChain,
|
|
3144
|
+
toChain
|
|
3093
3145
|
);
|
|
3094
3146
|
const etaText = quoteDetails.etaSeconds != null ? `≈ ${Math.max(1, Math.round(quoteDetails.etaSeconds / 60))}m` : "—";
|
|
3095
3147
|
const currentSlippageText = !quote ? "—" : formatPercentage(slippageBps);
|
|
@@ -4217,6 +4269,14 @@ const MainButton = ({
|
|
|
4217
4269
|
children: /* @__PURE__ */ jsx(AlertDescription, { className: "leading-snug tracking-wide", children: t2("telegram.restrictionMessage") })
|
|
4218
4270
|
}
|
|
4219
4271
|
),
|
|
4272
|
+
noRoute && !isTelegramRestricted && /* @__PURE__ */ jsx(
|
|
4273
|
+
Alert,
|
|
4274
|
+
{
|
|
4275
|
+
variant: "warning",
|
|
4276
|
+
className: "mt-2 text-sm font-medium text-center px-2 py-2",
|
|
4277
|
+
children: /* @__PURE__ */ jsx(AlertDescription, { className: "leading-snug tracking-wide", children: t2("transaction.noRouteAlert") })
|
|
4278
|
+
}
|
|
4279
|
+
),
|
|
4220
4280
|
/* @__PURE__ */ jsx(
|
|
4221
4281
|
Button,
|
|
4222
4282
|
{
|
|
@@ -26046,7 +26106,7 @@ class WalletConnectModal {
|
|
|
26046
26106
|
}
|
|
26047
26107
|
async initUi() {
|
|
26048
26108
|
if (typeof window !== "undefined") {
|
|
26049
|
-
await import("./index-
|
|
26109
|
+
await import("./index-CDaFAnWU.js");
|
|
26050
26110
|
const modal = document.createElement("wcm-modal");
|
|
26051
26111
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26052
26112
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26754,7 +26814,9 @@ const EvaaBridgeContent = ({
|
|
|
26754
26814
|
const allowedFromChains = swap.allowedFromChains;
|
|
26755
26815
|
const allowedToChains = swap.allowedToChains;
|
|
26756
26816
|
const { chains } = useChainsStore();
|
|
26757
|
-
const canSwap = Boolean(
|
|
26817
|
+
const canSwap = Boolean(
|
|
26818
|
+
fromChain && toChain && selectedAssetSymbol && isAllowedFromChain(toChain.chainKey)
|
|
26819
|
+
);
|
|
26758
26820
|
const outputAmount = useMemo(() => {
|
|
26759
26821
|
if (!quote || loading) return "";
|
|
26760
26822
|
const srcToken = resolveTokenOnChainFromMatrix$1(
|
|
@@ -26885,7 +26947,7 @@ const EvaaBridgeContent = ({
|
|
|
26885
26947
|
};
|
|
26886
26948
|
const EvaaBridge = EvaaBridgeWithProviders;
|
|
26887
26949
|
export {
|
|
26888
|
-
|
|
26950
|
+
getDestTokens as $,
|
|
26889
26951
|
getRouteDisplayName as A,
|
|
26890
26952
|
computeFeeBreakdownUsd as B,
|
|
26891
26953
|
ConfigCtrl as C,
|
|
@@ -26909,17 +26971,19 @@ export {
|
|
|
26909
26971
|
findNativeMeta as U,
|
|
26910
26972
|
lookupTokenMeta as V,
|
|
26911
26973
|
normalizeTickerSymbol$1 as W,
|
|
26912
|
-
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
|
|
26974
|
+
isAllowedFromChain as X,
|
|
26975
|
+
isAllowedToChain as Y,
|
|
26976
|
+
getChains as Z,
|
|
26977
|
+
getTokens as _,
|
|
26916
26978
|
ThemeCtrl as a,
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
|
|
26979
|
+
getQuotesByPriority as a0,
|
|
26980
|
+
isNativeAddress as a1,
|
|
26981
|
+
getEvmBalances as a2,
|
|
26982
|
+
getTonBalances as a3,
|
|
26983
|
+
getTronBalances as a4,
|
|
26984
|
+
getDeliveryStatus as a5,
|
|
26985
|
+
pollUntilDelivered as a6,
|
|
26986
|
+
reportBridgeTransaction as a7,
|
|
26923
26987
|
ExplorerCtrl as b,
|
|
26924
26988
|
CoreUtil as c,
|
|
26925
26989
|
EvaaBridge as d,
|
|
@@ -26946,4 +27010,4 @@ export {
|
|
|
26946
27010
|
calculateMinReceived as y,
|
|
26947
27011
|
getQuoteDetails as z
|
|
26948
27012
|
};
|
|
26949
|
-
//# sourceMappingURL=index-
|
|
27013
|
+
//# sourceMappingURL=index-CF3yEUFF.js.map
|