@rash2x/bridge-widget 0.8.6 → 0.8.8
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-DUoTGuFx.cjs → index-CCiUu9QP.cjs} +155 -47
- package/dist/{index-DUoTGuFx.cjs.map → index-CCiUu9QP.cjs.map} +1 -1
- package/dist/{index-B9_Kn_rc.js → index-CZGfdIKB.js} +2 -2
- package/dist/{index-B9_Kn_rc.js.map → index-CZGfdIKB.js.map} +1 -1
- package/dist/{index-BSfpUPGz.cjs → index-CrZzrVbc.cjs} +2 -2
- package/dist/{index-BSfpUPGz.cjs.map → index-CrZzrVbc.cjs.map} +1 -1
- package/dist/{index-UBA5Oxdc.js → index-JmSrX7Hz.js} +155 -47
- package/dist/{index-UBA5Oxdc.js.map → index-JmSrX7Hz.js.map} +1 -1
- package/package.json +1 -1
package/dist/evaa-bridge.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-CCiUu9QP.cjs");
|
|
4
4
|
exports.DEFAULT_SLIPPAGE_BPS = index.DEFAULT_SLIPPAGE_BPS;
|
|
5
5
|
exports.EvaaBridge = index.EvaaBridge;
|
|
6
6
|
exports.RoutePriority = index.RoutePriority;
|
package/dist/evaa-bridge.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P, d, f, e, D, U, H, y, B, W, w, s, v, r, p, q, G, $, a8, a1, a5, x, z, a2, A, a0, a6, a7, Z, _, V, a3, S, I, X, a4, Y, a9, aa, N, L, J, K, F, Q, t, o, i, u, l, m, j, n, h, k } from "./index-
|
|
1
|
+
import { P, d, f, e, D, U, H, y, B, W, w, s, v, r, p, q, G, $, a8, a1, a5, x, z, a2, A, a0, a6, a7, Z, _, V, a3, S, I, X, a4, Y, a9, aa, N, L, J, K, F, Q, t, o, i, u, l, m, j, n, h, k } from "./index-JmSrX7Hz.js";
|
|
2
2
|
export {
|
|
3
3
|
P as DEFAULT_SLIPPAGE_BPS,
|
|
4
4
|
d as EvaaBridge,
|
|
@@ -1088,6 +1088,7 @@ const useTokensStore = zustand.create((set2) => ({
|
|
|
1088
1088
|
});
|
|
1089
1089
|
}
|
|
1090
1090
|
}));
|
|
1091
|
+
const STARGATE_API_BASE_URL = "https://stargate-archive.vercel.app/api/";
|
|
1091
1092
|
const ALLOWED_TO_CHAINS = /* @__PURE__ */ new Set([
|
|
1092
1093
|
"ethereum",
|
|
1093
1094
|
"manta",
|
|
@@ -1132,7 +1133,7 @@ function isAllowedToChain(chainKey) {
|
|
|
1132
1133
|
return ALLOWED_TO_CHAINS.has(chainKey);
|
|
1133
1134
|
}
|
|
1134
1135
|
async function getChains() {
|
|
1135
|
-
const res = await fetch(
|
|
1136
|
+
const res = await fetch(`${STARGATE_API_BASE_URL}v1/chains`, {
|
|
1136
1137
|
credentials: "same-origin"
|
|
1137
1138
|
});
|
|
1138
1139
|
if (!res.ok) {
|
|
@@ -1143,7 +1144,7 @@ async function getChains() {
|
|
|
1143
1144
|
return all.filter((c2) => ALLOWED_TO_CHAINS.has(c2.chainKey));
|
|
1144
1145
|
}
|
|
1145
1146
|
async function getTokens() {
|
|
1146
|
-
const res = await fetch(
|
|
1147
|
+
const res = await fetch(`${STARGATE_API_BASE_URL}v1/tokens`, {
|
|
1147
1148
|
credentials: "same-origin"
|
|
1148
1149
|
});
|
|
1149
1150
|
if (!res.ok) {
|
|
@@ -1154,7 +1155,7 @@ async function getTokens() {
|
|
|
1154
1155
|
return tokens.map(normalizeTokenSymbol);
|
|
1155
1156
|
}
|
|
1156
1157
|
async function getDestTokens(srcChainKey, srcTokenAddr) {
|
|
1157
|
-
const url = new URL(
|
|
1158
|
+
const url = new URL(`${STARGATE_API_BASE_URL}v1/tokens`);
|
|
1158
1159
|
url.searchParams.set("srcChainKey", srcChainKey);
|
|
1159
1160
|
url.searchParams.set("srcToken", srcTokenAddr);
|
|
1160
1161
|
const res = await fetch(url.toString(), { credentials: "omit" });
|
|
@@ -1678,6 +1679,7 @@ const WalletInlineButton = ({
|
|
|
1678
1679
|
const connection = chainRegistry.getStrategyByType(walletType);
|
|
1679
1680
|
const account = connection?.getAccount();
|
|
1680
1681
|
const isConnected = connection?.isConnected();
|
|
1682
|
+
const isReconnecting = connection?.isConnecting();
|
|
1681
1683
|
const error = connection?.getError();
|
|
1682
1684
|
const availableConnections = React.useMemo(
|
|
1683
1685
|
() => connection?.getAvailableConnections() ?? [],
|
|
@@ -1701,10 +1703,11 @@ const WalletInlineButton = ({
|
|
|
1701
1703
|
}, [onOpen, addressType]);
|
|
1702
1704
|
const buttonText = React.useMemo(() => {
|
|
1703
1705
|
if (isConnected && account) return formatAddress(account);
|
|
1706
|
+
if (isReconnecting) return t2("wallets.reconnecting") ?? "Reconnecting...";
|
|
1704
1707
|
if (wallet === "ton") return t2("wallets.addTonWallet");
|
|
1705
1708
|
if (wallet === "tronlink") return t2("wallets.addTronWallet");
|
|
1706
1709
|
return t2("wallets.addEvmWallet");
|
|
1707
|
-
}, [wallet, isConnected, account, t2]);
|
|
1710
|
+
}, [wallet, isConnected, isReconnecting, account, t2]);
|
|
1708
1711
|
const connectedIcon = React.useMemo(() => {
|
|
1709
1712
|
if (!isConnected) return null;
|
|
1710
1713
|
if (walletType === "tron" && activeTronConnection) {
|
|
@@ -2275,7 +2278,7 @@ async function fetchQuotes(req) {
|
|
|
2275
2278
|
if (req.dstNativeAmount && req.dstNativeAmount !== "0")
|
|
2276
2279
|
params.dstNativeAmount = req.dstNativeAmount;
|
|
2277
2280
|
if (req.slippage && req.slippage > 0) params.slippage = String(req.slippage);
|
|
2278
|
-
const url =
|
|
2281
|
+
const url = `${STARGATE_API_BASE_URL}v1/quotes?${new URLSearchParams(
|
|
2279
2282
|
params
|
|
2280
2283
|
).toString()}`;
|
|
2281
2284
|
const res = await fetch(url);
|
|
@@ -4481,9 +4484,9 @@ async function getDeliveryStatus(params) {
|
|
|
4481
4484
|
if (params.dstChainKey) query.set("dstChainKey", params.dstChainKey);
|
|
4482
4485
|
query.set("srcTxHash", params.srcTxHash);
|
|
4483
4486
|
const bases2 = [
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
+
`${STARGATE_API_BASE_URL}v1/transactions?${query.toString()}`,
|
|
4488
|
+
`${STARGATE_API_BASE_URL}v1/txStatus?${query.toString()}`,
|
|
4489
|
+
`${STARGATE_API_BASE_URL}v1/messageStatus?${query.toString()}`
|
|
4487
4490
|
];
|
|
4488
4491
|
for (const url of bases2) {
|
|
4489
4492
|
const json = await tryFetch(url);
|
|
@@ -4640,7 +4643,7 @@ function useBridgeTransaction() {
|
|
|
4640
4643
|
const txStore = useTransactionStore();
|
|
4641
4644
|
const gas = useGasEstimate();
|
|
4642
4645
|
const srcToken = React.useMemo(
|
|
4643
|
-
() =>
|
|
4646
|
+
() => resolveTokenOnChainFromMatrix$1(
|
|
4644
4647
|
assetMatrix,
|
|
4645
4648
|
selectedAssetSymbol,
|
|
4646
4649
|
quote?.srcChainKey
|
|
@@ -4648,7 +4651,7 @@ function useBridgeTransaction() {
|
|
|
4648
4651
|
[assetMatrix, selectedAssetSymbol, quote?.srcChainKey]
|
|
4649
4652
|
);
|
|
4650
4653
|
const dstToken = React.useMemo(
|
|
4651
|
-
() =>
|
|
4654
|
+
() => resolveTokenOnChainFromMatrix$1(
|
|
4652
4655
|
assetMatrix,
|
|
4653
4656
|
selectedAssetSymbol,
|
|
4654
4657
|
quote?.dstChainKey
|
|
@@ -5306,7 +5309,7 @@ const WalletSelectModal = () => {
|
|
|
5306
5309
|
const { t: t2 } = useBridgeTranslation();
|
|
5307
5310
|
const { isOpen, onClose } = useWalletSelectModal();
|
|
5308
5311
|
const { connectors } = wagmi.useConnect();
|
|
5309
|
-
const { address: evmAddress, connector: connectedConnector } = wagmi.useAccount();
|
|
5312
|
+
const { address: evmAddress, connector: connectedConnector, isReconnecting: evmIsReconnecting } = wagmi.useAccount();
|
|
5310
5313
|
const { chainRegistry } = useChainStrategies();
|
|
5311
5314
|
const tonWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TON);
|
|
5312
5315
|
const metaMaskWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.EVM);
|
|
@@ -5350,6 +5353,14 @@ const WalletSelectModal = () => {
|
|
|
5350
5353
|
address: evmAddress,
|
|
5351
5354
|
onDisconnect: () => metaMaskWallet?.disconnect()
|
|
5352
5355
|
});
|
|
5356
|
+
} else if (evmIsReconnecting) {
|
|
5357
|
+
evmConnectedWallets.push({
|
|
5358
|
+
id: "walletConnect",
|
|
5359
|
+
name: t2("wallets.reconnecting") || "Reconnecting...",
|
|
5360
|
+
icon: WalletConnectIcon,
|
|
5361
|
+
address: "...",
|
|
5362
|
+
onDisconnect: () => metaMaskWallet?.disconnect()
|
|
5363
|
+
});
|
|
5353
5364
|
}
|
|
5354
5365
|
const tronConnectedWallets = [];
|
|
5355
5366
|
tronConnections.forEach((connection) => {
|
|
@@ -5371,7 +5382,7 @@ const WalletSelectModal = () => {
|
|
|
5371
5382
|
enabled: true
|
|
5372
5383
|
}
|
|
5373
5384
|
];
|
|
5374
|
-
const evmWallets = evmConnectedWallets.length > 0 ? [] : connectors.filter(
|
|
5385
|
+
const evmWallets = evmConnectedWallets.length > 0 || evmIsReconnecting ? [] : connectors.filter(
|
|
5375
5386
|
(connector) => connector.id === "walletConnect" || connector.id === "metaMaskSDK"
|
|
5376
5387
|
).map((connector) => ({
|
|
5377
5388
|
id: connector.id,
|
|
@@ -5903,7 +5914,7 @@ class EvmChainStrategy {
|
|
|
5903
5914
|
return !!this.config.evmIsConnected;
|
|
5904
5915
|
}
|
|
5905
5916
|
isConnecting() {
|
|
5906
|
-
return
|
|
5917
|
+
return !!this.config.evmIsReconnecting;
|
|
5907
5918
|
}
|
|
5908
5919
|
getAccount() {
|
|
5909
5920
|
return this.config.evmAddress || null;
|
|
@@ -5920,15 +5931,49 @@ class EvmChainStrategy {
|
|
|
5920
5931
|
getClient() {
|
|
5921
5932
|
return this.walletClient;
|
|
5922
5933
|
}
|
|
5923
|
-
|
|
5924
|
-
const chainKey = tokens[0]?.chainKey;
|
|
5934
|
+
resolvePublicClientForChain(chainKey) {
|
|
5925
5935
|
let client = this.publicClient;
|
|
5926
|
-
if (chainKey
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5936
|
+
if (!chainKey || !this.config.getPublicClientForChain || !this.config.chainKeyToId) {
|
|
5937
|
+
return client;
|
|
5938
|
+
}
|
|
5939
|
+
const chainId = this.config.chainKeyToId[chainKey.toLowerCase()];
|
|
5940
|
+
if (!chainId) {
|
|
5941
|
+
return client;
|
|
5942
|
+
}
|
|
5943
|
+
client = this.config.getPublicClientForChain(chainId) ?? client;
|
|
5944
|
+
return client;
|
|
5945
|
+
}
|
|
5946
|
+
getRpcErrorDetails(error) {
|
|
5947
|
+
if (error instanceof Error) {
|
|
5948
|
+
const rpcError = error;
|
|
5949
|
+
return {
|
|
5950
|
+
code: rpcError.code,
|
|
5951
|
+
message: rpcError.message,
|
|
5952
|
+
shortMessage: rpcError.shortMessage,
|
|
5953
|
+
details: rpcError.details
|
|
5954
|
+
};
|
|
5955
|
+
}
|
|
5956
|
+
if (typeof error === "object" && error !== null) {
|
|
5957
|
+
const candidate = error;
|
|
5958
|
+
return {
|
|
5959
|
+
code: typeof candidate.code === "number" ? candidate.code : void 0,
|
|
5960
|
+
message: typeof candidate.message === "string" ? candidate.message : String(error),
|
|
5961
|
+
shortMessage: typeof candidate.shortMessage === "string" ? candidate.shortMessage : void 0,
|
|
5962
|
+
details: typeof candidate.details === "string" ? candidate.details : void 0
|
|
5963
|
+
};
|
|
5931
5964
|
}
|
|
5965
|
+
return { message: String(error) };
|
|
5966
|
+
}
|
|
5967
|
+
logRpcWarning(context, error, extra) {
|
|
5968
|
+
const rpcError = this.getRpcErrorDetails(error);
|
|
5969
|
+
console.warn(`[evm] ${context}`, {
|
|
5970
|
+
...extra,
|
|
5971
|
+
...rpcError
|
|
5972
|
+
});
|
|
5973
|
+
}
|
|
5974
|
+
async getBalances(address, tokens) {
|
|
5975
|
+
const chainKey = tokens[0]?.chainKey;
|
|
5976
|
+
const client = this.resolvePublicClientForChain(chainKey);
|
|
5932
5977
|
if (!client) {
|
|
5933
5978
|
return {};
|
|
5934
5979
|
}
|
|
@@ -5967,7 +6012,7 @@ class EvmChainStrategy {
|
|
|
5967
6012
|
}
|
|
5968
6013
|
}
|
|
5969
6014
|
async estimateNetworkFee(steps) {
|
|
5970
|
-
if (!this.
|
|
6015
|
+
if (!this.config.evmAddress) {
|
|
5971
6016
|
return 0;
|
|
5972
6017
|
}
|
|
5973
6018
|
const account = this.config.evmAddress;
|
|
@@ -5984,23 +6029,67 @@ class EvmChainStrategy {
|
|
|
5984
6029
|
return (feePerGas * scaled + 99n) / 100n;
|
|
5985
6030
|
};
|
|
5986
6031
|
let totalFeeWei = 0n;
|
|
5987
|
-
for (
|
|
6032
|
+
for (let i3 = 0; i3 < txSteps.length; i3++) {
|
|
6033
|
+
const step = txSteps[i3];
|
|
5988
6034
|
const tx = step.transaction;
|
|
5989
6035
|
if (!tx?.to) continue;
|
|
6036
|
+
const client = this.resolvePublicClientForChain(step.chainKey);
|
|
6037
|
+
if (!client) {
|
|
6038
|
+
this.logRpcWarning("Skipped network fee estimation: no public client", "no-client", {
|
|
6039
|
+
chainKey: step.chainKey,
|
|
6040
|
+
stepType: step.type,
|
|
6041
|
+
stepIndex: i3 + 1,
|
|
6042
|
+
totalSteps: txSteps.length
|
|
6043
|
+
});
|
|
6044
|
+
continue;
|
|
6045
|
+
}
|
|
5990
6046
|
try {
|
|
5991
|
-
const
|
|
6047
|
+
const gas = await client.estimateGas({
|
|
5992
6048
|
account: tx.from || account,
|
|
5993
6049
|
to: tx.to,
|
|
5994
6050
|
data: tx.data,
|
|
5995
|
-
value: tx.value ? BigInt(tx.value) : void 0
|
|
5996
|
-
chain: this.walletClient.chain
|
|
6051
|
+
value: tx.value ? BigInt(tx.value) : void 0
|
|
5997
6052
|
});
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6053
|
+
let feePerGas;
|
|
6054
|
+
try {
|
|
6055
|
+
const estimatedFees = await client.estimateFeesPerGas();
|
|
6056
|
+
feePerGas = estimatedFees.maxFeePerGas ?? estimatedFees.gasPrice;
|
|
6057
|
+
} catch (feeError) {
|
|
6058
|
+
this.logRpcWarning(
|
|
6059
|
+
"Failed to estimate fees per gas, falling back to gas price",
|
|
6060
|
+
feeError,
|
|
6061
|
+
{
|
|
6062
|
+
chainKey: step.chainKey,
|
|
6063
|
+
stepType: step.type,
|
|
6064
|
+
stepIndex: i3 + 1,
|
|
6065
|
+
totalSteps: txSteps.length
|
|
6066
|
+
}
|
|
6067
|
+
);
|
|
6068
|
+
try {
|
|
6069
|
+
feePerGas = await client.getGasPrice();
|
|
6070
|
+
} catch (gasPriceError) {
|
|
6071
|
+
this.logRpcWarning("Failed to get gas price for network fee estimation", gasPriceError, {
|
|
6072
|
+
chainKey: step.chainKey,
|
|
6073
|
+
stepType: step.type,
|
|
6074
|
+
stepIndex: i3 + 1,
|
|
6075
|
+
totalSteps: txSteps.length
|
|
6076
|
+
});
|
|
6077
|
+
}
|
|
6002
6078
|
}
|
|
6003
|
-
|
|
6079
|
+
if (gas && feePerGas) {
|
|
6080
|
+
totalFeeWei += gas * applyFeeMultiplier(feePerGas);
|
|
6081
|
+
}
|
|
6082
|
+
} catch (error) {
|
|
6083
|
+
this.logRpcWarning("Failed to estimate gas for network fee", error, {
|
|
6084
|
+
chainKey: step.chainKey,
|
|
6085
|
+
stepType: step.type,
|
|
6086
|
+
stepIndex: i3 + 1,
|
|
6087
|
+
totalSteps: txSteps.length,
|
|
6088
|
+
to: tx.to,
|
|
6089
|
+
from: tx.from || account,
|
|
6090
|
+
hasData: Boolean(tx.data),
|
|
6091
|
+
hasValue: Boolean(tx.value)
|
|
6092
|
+
});
|
|
6004
6093
|
}
|
|
6005
6094
|
}
|
|
6006
6095
|
if (totalFeeWei === 0n) {
|
|
@@ -7205,6 +7294,7 @@ function ChainStrategyProvider({
|
|
|
7205
7294
|
() => new EvmChainStrategy({
|
|
7206
7295
|
evmAddress: evmWallet.address,
|
|
7207
7296
|
evmIsConnected: evmWallet.isConnected,
|
|
7297
|
+
evmIsReconnecting: evmWallet.isReconnecting,
|
|
7208
7298
|
evmDisconnect: evmWallet.disconnect,
|
|
7209
7299
|
walletClient: evmWallet.walletClient,
|
|
7210
7300
|
publicClient: evmWallet.publicClient,
|
|
@@ -7214,6 +7304,7 @@ function ChainStrategyProvider({
|
|
|
7214
7304
|
[
|
|
7215
7305
|
evmWallet.address,
|
|
7216
7306
|
evmWallet.isConnected,
|
|
7307
|
+
evmWallet.isReconnecting,
|
|
7217
7308
|
evmWallet.disconnect,
|
|
7218
7309
|
evmWallet.walletClient,
|
|
7219
7310
|
evmWallet.publicClient,
|
|
@@ -26666,7 +26757,7 @@ class WalletConnectModal {
|
|
|
26666
26757
|
}
|
|
26667
26758
|
async initUi() {
|
|
26668
26759
|
if (typeof window !== "undefined") {
|
|
26669
|
-
await Promise.resolve().then(() => require("./index-
|
|
26760
|
+
await Promise.resolve().then(() => require("./index-CrZzrVbc.cjs"));
|
|
26670
26761
|
const modal = document.createElement("wcm-modal");
|
|
26671
26762
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26672
26763
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26783,10 +26874,12 @@ function useTronWalletConnect(projectId) {
|
|
|
26783
26874
|
appliedThemeRef.current = appliedTheme;
|
|
26784
26875
|
React.useEffect(() => {
|
|
26785
26876
|
if (!projectId || providerRef.current) return;
|
|
26877
|
+
let cancelled = false;
|
|
26786
26878
|
const initProvider = async () => {
|
|
26787
26879
|
try {
|
|
26788
26880
|
const provider = await N.init({
|
|
26789
26881
|
projectId,
|
|
26882
|
+
name: "evaa-bridge-tron",
|
|
26790
26883
|
metadata: {
|
|
26791
26884
|
name: "EVAA Bridge",
|
|
26792
26885
|
description: "Cross-chain bridge powered by Stargate Protocol",
|
|
@@ -26794,6 +26887,7 @@ function useTronWalletConnect(projectId) {
|
|
|
26794
26887
|
icons: [`${window.location.origin}/favicon.ico`]
|
|
26795
26888
|
}
|
|
26796
26889
|
});
|
|
26890
|
+
if (cancelled) return;
|
|
26797
26891
|
providerRef.current = provider;
|
|
26798
26892
|
if (projectId) {
|
|
26799
26893
|
const modal = new WalletConnectModal({
|
|
@@ -26823,17 +26917,32 @@ function useTronWalletConnect(projectId) {
|
|
|
26823
26917
|
console.log("TRON WalletConnect session deleted");
|
|
26824
26918
|
setAddress(null);
|
|
26825
26919
|
});
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
)
|
|
26920
|
+
let tronAccounts = [];
|
|
26921
|
+
if (provider.session?.namespaces?.tron?.accounts?.length) {
|
|
26922
|
+
tronAccounts = provider.session.namespaces.tron.accounts;
|
|
26923
|
+
console.log("TRON WalletConnect: found session via provider.session");
|
|
26924
|
+
} else if (provider.client?.session) {
|
|
26925
|
+
const allSessions = provider.client.session.getAll();
|
|
26926
|
+
console.log("TRON WalletConnect: searching all sessions, count:", allSessions.length);
|
|
26927
|
+
const tronSession = allSessions.find(
|
|
26928
|
+
(s2) => s2.namespaces?.tron?.accounts?.length
|
|
26929
|
+
);
|
|
26930
|
+
if (tronSession) {
|
|
26931
|
+
tronAccounts = tronSession.namespaces.tron.accounts;
|
|
26932
|
+
console.log("TRON WalletConnect: found tron session in all sessions");
|
|
26933
|
+
}
|
|
26934
|
+
}
|
|
26935
|
+
if (tronAccounts.length > 0) {
|
|
26936
|
+
const extractedAddress = tronAccounts[0].split(":")[2];
|
|
26937
|
+
console.log(
|
|
26938
|
+
"TRON WalletConnect restored session:",
|
|
26939
|
+
extractedAddress
|
|
26940
|
+
);
|
|
26941
|
+
if (!cancelled) {
|
|
26835
26942
|
setAddress(extractedAddress);
|
|
26836
26943
|
}
|
|
26944
|
+
} else {
|
|
26945
|
+
console.log("TRON WalletConnect: no tron session found to restore");
|
|
26837
26946
|
}
|
|
26838
26947
|
} catch (error) {
|
|
26839
26948
|
console.error("Failed to initialize TRON WalletConnect:", error);
|
|
@@ -26841,17 +26950,15 @@ function useTronWalletConnect(projectId) {
|
|
|
26841
26950
|
};
|
|
26842
26951
|
initProvider();
|
|
26843
26952
|
return () => {
|
|
26844
|
-
|
|
26953
|
+
cancelled = true;
|
|
26845
26954
|
if (abortControllerRef.current) {
|
|
26846
26955
|
abortControllerRef.current.abort();
|
|
26847
26956
|
}
|
|
26848
|
-
if (providerRef.current) {
|
|
26849
|
-
console.warn("TRON WalletConnect: disconnecting provider in cleanup");
|
|
26850
|
-
providerRef.current.disconnect();
|
|
26851
|
-
}
|
|
26852
26957
|
if (modalRef.current) {
|
|
26853
26958
|
modalRef.current.closeModal();
|
|
26854
26959
|
}
|
|
26960
|
+
providerRef.current = null;
|
|
26961
|
+
modalRef.current = null;
|
|
26855
26962
|
};
|
|
26856
26963
|
}, [projectId, setAddress]);
|
|
26857
26964
|
React.useEffect(() => {
|
|
@@ -27238,7 +27345,7 @@ function useUrlSync(options) {
|
|
|
27238
27345
|
const EvaaBridgeWithProviders = (props) => {
|
|
27239
27346
|
const [tonConnectUI] = uiReact.useTonConnectUI();
|
|
27240
27347
|
const tonAddress = uiReact.useTonAddress();
|
|
27241
|
-
const { address: evmAddress, isConnected: evmIsConnected } = wagmi.useAccount();
|
|
27348
|
+
const { address: evmAddress, isConnected: evmIsConnected, isReconnecting: evmIsReconnecting } = wagmi.useAccount();
|
|
27242
27349
|
const wagmiConfig = wagmi.useConfig();
|
|
27243
27350
|
const { disconnect: evmDisconnect } = wagmi.useDisconnect();
|
|
27244
27351
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
@@ -27302,6 +27409,7 @@ const EvaaBridgeWithProviders = (props) => {
|
|
|
27302
27409
|
evmWallet: {
|
|
27303
27410
|
address: evmAddress,
|
|
27304
27411
|
isConnected: evmIsConnected,
|
|
27412
|
+
isReconnecting: evmIsReconnecting,
|
|
27305
27413
|
disconnect: evmDisconnect,
|
|
27306
27414
|
walletClient,
|
|
27307
27415
|
publicClient,
|
|
@@ -27571,4 +27679,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
27571
27679
|
exports.useSwapModel = useSwapModel;
|
|
27572
27680
|
exports.useTokensStore = useTokensStore;
|
|
27573
27681
|
exports.useTransactionStore = useTransactionStore;
|
|
27574
|
-
//# sourceMappingURL=index-
|
|
27682
|
+
//# sourceMappingURL=index-CCiUu9QP.cjs.map
|