@rash2x/bridge-widget 0.7.9 → 0.8.1
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 +1 -1
- package/dist/evaa-bridge.mjs +1 -1
- package/dist/{index-CWgNX6rD.cjs → index-BA7b93G2.cjs} +2 -2
- package/dist/{index-CWgNX6rD.cjs.map → index-BA7b93G2.cjs.map} +1 -1
- package/dist/{index-D7lsGQY9.js → index-BgRN7kwd.js} +263 -8
- package/dist/index-BgRN7kwd.js.map +1 -0
- package/dist/{index-ClSyIB0n.js → index-CA5BH32n.js} +2 -2
- package/dist/{index-ClSyIB0n.js.map → index-CA5BH32n.js.map} +1 -1
- package/dist/{index-Y5S-J1RC.cjs → index-CEfGNliz.cjs} +263 -8
- package/dist/index-CEfGNliz.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-D7lsGQY9.js.map +0 -1
- package/dist/index-Y5S-J1RC.cjs.map +0 -1
|
@@ -69,7 +69,7 @@ const en$3 = {
|
|
|
69
69
|
};
|
|
70
70
|
const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
|
|
71
71
|
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": "Подключить кошелёк" };
|
|
72
|
-
const bridge = { "max": "Макс", "sourceNetwork": "Исходная сеть", "destinationNetwork": "Целевая сеть", "selectToken": "Выбрать токен", "selectNetwork": "Выбрать сеть", "selectSourceNetwork": "
|
|
72
|
+
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": "Проверьте корректность перед переводом" };
|
|
73
73
|
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": "Завершено" } };
|
|
74
74
|
const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
|
|
75
75
|
const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
|
|
@@ -1486,8 +1486,10 @@ function useChainStrategies() {
|
|
|
1486
1486
|
const useWalletSelectModal = zustand.create((set2) => ({
|
|
1487
1487
|
isOpen: false,
|
|
1488
1488
|
addressType: void 0,
|
|
1489
|
-
|
|
1490
|
-
|
|
1489
|
+
lastConnectionAddressType: void 0,
|
|
1490
|
+
onOpen: (addressType) => set2({ isOpen: true, addressType, lastConnectionAddressType: addressType }),
|
|
1491
|
+
onClose: () => set2({ isOpen: false, addressType: void 0 }),
|
|
1492
|
+
setLastConnectionAddressType: (addressType) => set2({ lastConnectionAddressType: addressType })
|
|
1491
1493
|
}));
|
|
1492
1494
|
const truncateToDecimals = (num, decimals) => {
|
|
1493
1495
|
if (!isFinite(num) || isNaN(num)) return "0";
|
|
@@ -5036,6 +5038,197 @@ function getTonClient(customClient, apiKey) {
|
|
|
5036
5038
|
}
|
|
5037
5039
|
return tonClientInstance;
|
|
5038
5040
|
}
|
|
5041
|
+
const NETWORK_CONFIGS = {
|
|
5042
|
+
1: {
|
|
5043
|
+
chainId: "0x1",
|
|
5044
|
+
chainName: "Ethereum Mainnet",
|
|
5045
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5046
|
+
rpcUrls: ["https://eth.llamarpc.com"],
|
|
5047
|
+
blockExplorerUrls: ["https://etherscan.io"]
|
|
5048
|
+
},
|
|
5049
|
+
42161: {
|
|
5050
|
+
chainId: "0xa4b1",
|
|
5051
|
+
chainName: "Arbitrum One",
|
|
5052
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5053
|
+
rpcUrls: ["https://arbitrum.llamarpc.com"],
|
|
5054
|
+
blockExplorerUrls: ["https://arbiscan.io"]
|
|
5055
|
+
},
|
|
5056
|
+
10: {
|
|
5057
|
+
chainId: "0xa",
|
|
5058
|
+
chainName: "Optimism",
|
|
5059
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5060
|
+
rpcUrls: ["https://optimism.llamarpc.com"],
|
|
5061
|
+
blockExplorerUrls: ["https://optimistic.etherscan.io"]
|
|
5062
|
+
},
|
|
5063
|
+
137: {
|
|
5064
|
+
chainId: "0x89",
|
|
5065
|
+
chainName: "Polygon",
|
|
5066
|
+
nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18 },
|
|
5067
|
+
rpcUrls: ["https://polygon.llamarpc.com"],
|
|
5068
|
+
blockExplorerUrls: ["https://polygonscan.com"]
|
|
5069
|
+
},
|
|
5070
|
+
8453: {
|
|
5071
|
+
chainId: "0x2105",
|
|
5072
|
+
chainName: "Base",
|
|
5073
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5074
|
+
rpcUrls: ["https://mainnet.base.org"],
|
|
5075
|
+
blockExplorerUrls: ["https://basescan.org"]
|
|
5076
|
+
},
|
|
5077
|
+
56: {
|
|
5078
|
+
chainId: "0x38",
|
|
5079
|
+
chainName: "BNB Smart Chain",
|
|
5080
|
+
nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
|
|
5081
|
+
rpcUrls: ["https://bsc-dataseed.binance.org"],
|
|
5082
|
+
blockExplorerUrls: ["https://bscscan.com"]
|
|
5083
|
+
},
|
|
5084
|
+
169: {
|
|
5085
|
+
chainId: "0xa9",
|
|
5086
|
+
chainName: "Manta Pacific",
|
|
5087
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5088
|
+
rpcUrls: ["https://pacific-rpc.manta.network/http"],
|
|
5089
|
+
blockExplorerUrls: ["https://pacific-explorer.manta.network"]
|
|
5090
|
+
},
|
|
5091
|
+
204: {
|
|
5092
|
+
chainId: "0xcc",
|
|
5093
|
+
chainName: "opBNB",
|
|
5094
|
+
nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
|
|
5095
|
+
rpcUrls: ["https://opbnb-mainnet-rpc.bnbchain.org"],
|
|
5096
|
+
blockExplorerUrls: ["https://opbnbscan.com"]
|
|
5097
|
+
},
|
|
5098
|
+
1030: {
|
|
5099
|
+
chainId: "0x406",
|
|
5100
|
+
chainName: "Conflux eSpace",
|
|
5101
|
+
nativeCurrency: { name: "CFX", symbol: "CFX", decimals: 18 },
|
|
5102
|
+
rpcUrls: ["https://evm.confluxrpc.com"],
|
|
5103
|
+
blockExplorerUrls: ["https://evm.confluxscan.net"]
|
|
5104
|
+
},
|
|
5105
|
+
5e3: {
|
|
5106
|
+
chainId: "0x1388",
|
|
5107
|
+
chainName: "Mantle",
|
|
5108
|
+
nativeCurrency: { name: "MNT", symbol: "MNT", decimals: 18 },
|
|
5109
|
+
rpcUrls: ["https://rpc.mantle.xyz"],
|
|
5110
|
+
blockExplorerUrls: ["https://explorer.mantle.xyz"]
|
|
5111
|
+
},
|
|
5112
|
+
42220: {
|
|
5113
|
+
chainId: "0xa4ec",
|
|
5114
|
+
chainName: "Celo",
|
|
5115
|
+
nativeCurrency: { name: "CELO", symbol: "CELO", decimals: 18 },
|
|
5116
|
+
rpcUrls: ["https://forno.celo.org"],
|
|
5117
|
+
blockExplorerUrls: ["https://explorer.celo.org"]
|
|
5118
|
+
},
|
|
5119
|
+
59144: {
|
|
5120
|
+
chainId: "0xe708",
|
|
5121
|
+
chainName: "Linea",
|
|
5122
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5123
|
+
rpcUrls: ["https://rpc.linea.build"],
|
|
5124
|
+
blockExplorerUrls: ["https://lineascan.build"]
|
|
5125
|
+
},
|
|
5126
|
+
81457: {
|
|
5127
|
+
chainId: "0x13e31",
|
|
5128
|
+
chainName: "Blast",
|
|
5129
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5130
|
+
rpcUrls: ["https://rpc.blast.io"],
|
|
5131
|
+
blockExplorerUrls: ["https://blastscan.io"]
|
|
5132
|
+
},
|
|
5133
|
+
534352: {
|
|
5134
|
+
chainId: "0x82750",
|
|
5135
|
+
chainName: "Scroll",
|
|
5136
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5137
|
+
rpcUrls: ["https://rpc.scroll.io"],
|
|
5138
|
+
blockExplorerUrls: ["https://scrollscan.com"]
|
|
5139
|
+
},
|
|
5140
|
+
25: {
|
|
5141
|
+
chainId: "0x19",
|
|
5142
|
+
chainName: "Cronos",
|
|
5143
|
+
nativeCurrency: { name: "CRO", symbol: "CRO", decimals: 18 },
|
|
5144
|
+
rpcUrls: ["https://evm.cronos.org"],
|
|
5145
|
+
blockExplorerUrls: ["https://cronoscan.com"]
|
|
5146
|
+
},
|
|
5147
|
+
100: {
|
|
5148
|
+
chainId: "0x64",
|
|
5149
|
+
chainName: "Gnosis",
|
|
5150
|
+
nativeCurrency: { name: "xDAI", symbol: "xDAI", decimals: 18 },
|
|
5151
|
+
rpcUrls: ["https://rpc.gnosischain.com"],
|
|
5152
|
+
blockExplorerUrls: ["https://gnosisscan.io"]
|
|
5153
|
+
},
|
|
5154
|
+
146: {
|
|
5155
|
+
chainId: "0x92",
|
|
5156
|
+
chainName: "Sonic",
|
|
5157
|
+
nativeCurrency: { name: "S", symbol: "S", decimals: 18 },
|
|
5158
|
+
rpcUrls: ["https://rpc.soniclabs.com"],
|
|
5159
|
+
blockExplorerUrls: ["https://sonicscan.org"]
|
|
5160
|
+
},
|
|
5161
|
+
250: {
|
|
5162
|
+
chainId: "0xfa",
|
|
5163
|
+
chainName: "Fantom Opera",
|
|
5164
|
+
nativeCurrency: { name: "FTM", symbol: "FTM", decimals: 18 },
|
|
5165
|
+
rpcUrls: ["https://rpcapi.fantom.network"],
|
|
5166
|
+
blockExplorerUrls: ["https://ftmscan.com"]
|
|
5167
|
+
},
|
|
5168
|
+
324: {
|
|
5169
|
+
chainId: "0x144",
|
|
5170
|
+
chainName: "zkSync Era",
|
|
5171
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5172
|
+
rpcUrls: ["https://mainnet.era.zksync.io"],
|
|
5173
|
+
blockExplorerUrls: ["https://explorer.zksync.io"]
|
|
5174
|
+
},
|
|
5175
|
+
1088: {
|
|
5176
|
+
chainId: "0x440",
|
|
5177
|
+
chainName: "Metis Andromeda",
|
|
5178
|
+
nativeCurrency: { name: "Metis", symbol: "METIS", decimals: 18 },
|
|
5179
|
+
rpcUrls: ["https://andromeda.metis.io/?owner=1088"],
|
|
5180
|
+
blockExplorerUrls: ["https://andromeda-explorer.metis.io"]
|
|
5181
|
+
},
|
|
5182
|
+
1101: {
|
|
5183
|
+
chainId: "0x44d",
|
|
5184
|
+
chainName: "Polygon zkEVM",
|
|
5185
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5186
|
+
rpcUrls: ["https://zkevm-rpc.com"],
|
|
5187
|
+
blockExplorerUrls: ["https://zkevm.polygonscan.com"]
|
|
5188
|
+
},
|
|
5189
|
+
1284: {
|
|
5190
|
+
chainId: "0x504",
|
|
5191
|
+
chainName: "Moonbeam",
|
|
5192
|
+
nativeCurrency: { name: "GLMR", symbol: "GLMR", decimals: 18 },
|
|
5193
|
+
rpcUrls: ["https://rpc.api.moonbeam.network"],
|
|
5194
|
+
blockExplorerUrls: ["https://moonscan.io"]
|
|
5195
|
+
},
|
|
5196
|
+
1285: {
|
|
5197
|
+
chainId: "0x505",
|
|
5198
|
+
chainName: "Moonriver",
|
|
5199
|
+
nativeCurrency: { name: "MOVR", symbol: "MOVR", decimals: 18 },
|
|
5200
|
+
rpcUrls: ["https://rpc.api.moonriver.moonbeam.network"],
|
|
5201
|
+
blockExplorerUrls: ["https://moonriver.moonscan.io"]
|
|
5202
|
+
},
|
|
5203
|
+
2222: {
|
|
5204
|
+
chainId: "0x8ae",
|
|
5205
|
+
chainName: "Kava EVM",
|
|
5206
|
+
nativeCurrency: { name: "KAVA", symbol: "KAVA", decimals: 18 },
|
|
5207
|
+
rpcUrls: ["https://evm.kava.io"],
|
|
5208
|
+
blockExplorerUrls: ["https://explorer.kava.io"]
|
|
5209
|
+
},
|
|
5210
|
+
8217: {
|
|
5211
|
+
chainId: "0x2019",
|
|
5212
|
+
chainName: "Klaytn",
|
|
5213
|
+
nativeCurrency: { name: "KLAY", symbol: "KLAY", decimals: 18 },
|
|
5214
|
+
rpcUrls: ["https://public-en-cypress.klaytn.net"],
|
|
5215
|
+
blockExplorerUrls: ["https://scope.klaytn.com"]
|
|
5216
|
+
},
|
|
5217
|
+
43114: {
|
|
5218
|
+
chainId: "0xa86a",
|
|
5219
|
+
chainName: "Avalanche C-Chain",
|
|
5220
|
+
nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },
|
|
5221
|
+
rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
|
|
5222
|
+
blockExplorerUrls: ["https://snowtrace.io"]
|
|
5223
|
+
},
|
|
5224
|
+
1313161554: {
|
|
5225
|
+
chainId: "0x4e454152",
|
|
5226
|
+
chainName: "Aurora",
|
|
5227
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
5228
|
+
rpcUrls: ["https://mainnet.aurora.dev"],
|
|
5229
|
+
blockExplorerUrls: ["https://aurorascan.dev"]
|
|
5230
|
+
}
|
|
5231
|
+
};
|
|
5039
5232
|
function isNativeAddress(addr) {
|
|
5040
5233
|
if (!addr) return false;
|
|
5041
5234
|
const a2 = addr.toLowerCase();
|
|
@@ -5562,12 +5755,67 @@ class EvmChainStrategy {
|
|
|
5562
5755
|
}
|
|
5563
5756
|
return Number(viem.formatUnits(totalFeeWei, 18));
|
|
5564
5757
|
}
|
|
5758
|
+
/**
|
|
5759
|
+
* Switch wallet to the specified chain
|
|
5760
|
+
* If the chain is not in the wallet, attempts to add it
|
|
5761
|
+
*/
|
|
5762
|
+
async switchToChain(chainId) {
|
|
5763
|
+
if (!this.walletClient) {
|
|
5764
|
+
throw new WalletNotConnectedError("evm");
|
|
5765
|
+
}
|
|
5766
|
+
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
5767
|
+
try {
|
|
5768
|
+
await this.walletClient.request({
|
|
5769
|
+
method: "wallet_switchEthereumChain",
|
|
5770
|
+
params: [{ chainId: chainIdHex }]
|
|
5771
|
+
});
|
|
5772
|
+
console.log(`Switched to chain ${chainId}`);
|
|
5773
|
+
} catch (switchError) {
|
|
5774
|
+
const error = switchError;
|
|
5775
|
+
if (error.code === 4902) {
|
|
5776
|
+
const networkConfig = NETWORK_CONFIGS[chainId];
|
|
5777
|
+
if (!networkConfig) {
|
|
5778
|
+
throw new InvalidStepsError(
|
|
5779
|
+
"evm",
|
|
5780
|
+
`No network configuration found for chain ID ${chainId}`
|
|
5781
|
+
);
|
|
5782
|
+
}
|
|
5783
|
+
try {
|
|
5784
|
+
await this.walletClient.request({
|
|
5785
|
+
method: "wallet_addEthereumChain",
|
|
5786
|
+
params: [networkConfig]
|
|
5787
|
+
});
|
|
5788
|
+
console.log(`Added and switched to chain ${chainId}`);
|
|
5789
|
+
} catch (addError) {
|
|
5790
|
+
throw new TransactionFailedError(
|
|
5791
|
+
"evm",
|
|
5792
|
+
`Failed to add network ${networkConfig.chainName}`,
|
|
5793
|
+
void 0,
|
|
5794
|
+
addError instanceof Error ? addError : void 0
|
|
5795
|
+
);
|
|
5796
|
+
}
|
|
5797
|
+
} else {
|
|
5798
|
+
throw toChainStrategyError(switchError, "evm", "network-switch");
|
|
5799
|
+
}
|
|
5800
|
+
}
|
|
5801
|
+
}
|
|
5565
5802
|
async executeSteps(steps, _context, onStepComplete) {
|
|
5566
5803
|
if (!this.isConnected() || !this.walletClient) {
|
|
5567
5804
|
throw new WalletNotConnectedError("evm");
|
|
5568
5805
|
}
|
|
5569
5806
|
this.validateSteps(steps);
|
|
5570
5807
|
try {
|
|
5808
|
+
const firstChainKey = steps[0]?.chainKey;
|
|
5809
|
+
if (firstChainKey && this.config.chainKeyToId) {
|
|
5810
|
+
const requiredChainId = this.config.chainKeyToId[firstChainKey.toLowerCase()];
|
|
5811
|
+
const currentChainId = this.walletClient.chain?.id;
|
|
5812
|
+
if (requiredChainId && currentChainId !== requiredChainId) {
|
|
5813
|
+
console.log(`Switching from chain ${currentChainId} to ${requiredChainId}`);
|
|
5814
|
+
await this.switchToChain(requiredChainId);
|
|
5815
|
+
} else {
|
|
5816
|
+
console.log(`Already on correct chain ${currentChainId}`);
|
|
5817
|
+
}
|
|
5818
|
+
}
|
|
5571
5819
|
let firstTxHash;
|
|
5572
5820
|
const totalSteps = steps.length;
|
|
5573
5821
|
for (let i3 = 0; i3 < steps.length; i3++) {
|
|
@@ -7527,7 +7775,8 @@ const useAutoSelectNetwork = ({
|
|
|
7527
7775
|
evmIsConnected
|
|
7528
7776
|
}) => {
|
|
7529
7777
|
const { hasAnyWallet } = useConnectedWalletsStore();
|
|
7530
|
-
const { chains, setFromChain } = useChainsStore();
|
|
7778
|
+
const { chains, setFromChain, setToChain } = useChainsStore();
|
|
7779
|
+
const { lastConnectionAddressType } = useWalletSelectModal();
|
|
7531
7780
|
const previousHadWallet = React.useRef(hasAnyWallet());
|
|
7532
7781
|
React.useEffect(() => {
|
|
7533
7782
|
const currentHasWallet = hasAnyWallet();
|
|
@@ -7546,7 +7795,11 @@ const useAutoSelectNetwork = ({
|
|
|
7546
7795
|
(chain2) => chain2.chainKey.toLowerCase() === targetChainKey
|
|
7547
7796
|
);
|
|
7548
7797
|
if (matchingChain) {
|
|
7549
|
-
|
|
7798
|
+
if (lastConnectionAddressType === "dst") {
|
|
7799
|
+
setToChain(matchingChain);
|
|
7800
|
+
} else {
|
|
7801
|
+
setFromChain(matchingChain);
|
|
7802
|
+
}
|
|
7550
7803
|
}
|
|
7551
7804
|
}
|
|
7552
7805
|
}
|
|
@@ -7557,7 +7810,9 @@ const useAutoSelectNetwork = ({
|
|
|
7557
7810
|
evmIsConnected,
|
|
7558
7811
|
hasAnyWallet,
|
|
7559
7812
|
chains,
|
|
7560
|
-
setFromChain
|
|
7813
|
+
setFromChain,
|
|
7814
|
+
setToChain,
|
|
7815
|
+
lastConnectionAddressType
|
|
7561
7816
|
]);
|
|
7562
7817
|
};
|
|
7563
7818
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
@@ -26170,7 +26425,7 @@ class WalletConnectModal {
|
|
|
26170
26425
|
}
|
|
26171
26426
|
async initUi() {
|
|
26172
26427
|
if (typeof window !== "undefined") {
|
|
26173
|
-
await Promise.resolve().then(() => require("./index-
|
|
26428
|
+
await Promise.resolve().then(() => require("./index-BA7b93G2.cjs"));
|
|
26174
26429
|
const modal = document.createElement("wcm-modal");
|
|
26175
26430
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26176
26431
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -27072,4 +27327,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
27072
27327
|
exports.useSwapModel = useSwapModel;
|
|
27073
27328
|
exports.useTokensStore = useTokensStore;
|
|
27074
27329
|
exports.useTransactionStore = useTransactionStore;
|
|
27075
|
-
//# sourceMappingURL=index-
|
|
27330
|
+
//# sourceMappingURL=index-CEfGNliz.cjs.map
|