@rash2x/bridge-widget 0.8.6 → 0.8.9
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-BSfpUPGz.cjs → index--9cCU23B.cjs} +2 -2
- package/dist/{index-BSfpUPGz.cjs.map → index--9cCU23B.cjs.map} +1 -1
- package/dist/{index-DUoTGuFx.cjs → index-BLnE8fLp.cjs} +165 -49
- package/dist/index-BLnE8fLp.cjs.map +1 -0
- package/dist/{index-B9_Kn_rc.js → index-Bl4_W_Mc.js} +2 -2
- package/dist/{index-B9_Kn_rc.js.map → index-Bl4_W_Mc.js.map} +1 -1
- package/dist/{index-UBA5Oxdc.js → index-IZ7t2PGj.js} +165 -49
- package/dist/index-IZ7t2PGj.js.map +1 -0
- package/package.json +1 -1
- package/dist/index-DUoTGuFx.cjs.map +0 -1
- package/dist/index-UBA5Oxdc.js.map +0 -1
|
@@ -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);
|
|
@@ -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,
|
|
@@ -5595,6 +5606,14 @@ const SuccessStep = ({
|
|
|
5595
5606
|
const { t: t2 } = useBridgeTranslation();
|
|
5596
5607
|
const metadata = current?.metadata;
|
|
5597
5608
|
const srcTxHash = current?.tonTransactionHash || current?.srcTxHash;
|
|
5609
|
+
const srcAmount = metadata?.srcAmountHuman;
|
|
5610
|
+
const hasSrcAmount = Number.isFinite(srcAmount);
|
|
5611
|
+
const srcTokenSymbol = metadata?.srcTokenSymbol ?? "default";
|
|
5612
|
+
const formatSrcAmount = (value) => {
|
|
5613
|
+
if (value <= 0) return "0";
|
|
5614
|
+
if (value >= 1) return formatBalance(value, 2);
|
|
5615
|
+
return value.toFixed(6).replace(/\.?0+$/, "");
|
|
5616
|
+
};
|
|
5598
5617
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5599
5618
|
dialog.DialogContent,
|
|
5600
5619
|
{
|
|
@@ -5605,17 +5624,17 @@ const SuccessStep = ({
|
|
|
5605
5624
|
icon,
|
|
5606
5625
|
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "z-10 relative p-0", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-[28px] text-center", children: t2("transaction.success") }) }),
|
|
5607
5626
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full space-y-2 mt-5 relative z-10 pb-14", children: [
|
|
5608
|
-
|
|
5627
|
+
hasSrcAmount && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
5609
5628
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: t2("transaction.bridged") }),
|
|
5610
5629
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 font-medium", children: [
|
|
5611
|
-
|
|
5630
|
+
formatSrcAmount(srcAmount ?? 0),
|
|
5612
5631
|
" ",
|
|
5613
|
-
|
|
5632
|
+
srcTokenSymbol,
|
|
5614
5633
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5615
5634
|
TokenSymbol,
|
|
5616
5635
|
{
|
|
5617
5636
|
className: "w-[18px] h-[18px]",
|
|
5618
|
-
symbol:
|
|
5637
|
+
symbol: srcTokenSymbol
|
|
5619
5638
|
}
|
|
5620
5639
|
)
|
|
5621
5640
|
] })
|
|
@@ -5903,7 +5922,7 @@ class EvmChainStrategy {
|
|
|
5903
5922
|
return !!this.config.evmIsConnected;
|
|
5904
5923
|
}
|
|
5905
5924
|
isConnecting() {
|
|
5906
|
-
return
|
|
5925
|
+
return !!this.config.evmIsReconnecting;
|
|
5907
5926
|
}
|
|
5908
5927
|
getAccount() {
|
|
5909
5928
|
return this.config.evmAddress || null;
|
|
@@ -5920,15 +5939,49 @@ class EvmChainStrategy {
|
|
|
5920
5939
|
getClient() {
|
|
5921
5940
|
return this.walletClient;
|
|
5922
5941
|
}
|
|
5923
|
-
|
|
5924
|
-
const chainKey = tokens[0]?.chainKey;
|
|
5942
|
+
resolvePublicClientForChain(chainKey) {
|
|
5925
5943
|
let client = this.publicClient;
|
|
5926
|
-
if (chainKey
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5944
|
+
if (!chainKey || !this.config.getPublicClientForChain || !this.config.chainKeyToId) {
|
|
5945
|
+
return client;
|
|
5946
|
+
}
|
|
5947
|
+
const chainId = this.config.chainKeyToId[chainKey.toLowerCase()];
|
|
5948
|
+
if (!chainId) {
|
|
5949
|
+
return client;
|
|
5931
5950
|
}
|
|
5951
|
+
client = this.config.getPublicClientForChain(chainId) ?? client;
|
|
5952
|
+
return client;
|
|
5953
|
+
}
|
|
5954
|
+
getRpcErrorDetails(error) {
|
|
5955
|
+
if (error instanceof Error) {
|
|
5956
|
+
const rpcError = error;
|
|
5957
|
+
return {
|
|
5958
|
+
code: rpcError.code,
|
|
5959
|
+
message: rpcError.message,
|
|
5960
|
+
shortMessage: rpcError.shortMessage,
|
|
5961
|
+
details: rpcError.details
|
|
5962
|
+
};
|
|
5963
|
+
}
|
|
5964
|
+
if (typeof error === "object" && error !== null) {
|
|
5965
|
+
const candidate = error;
|
|
5966
|
+
return {
|
|
5967
|
+
code: typeof candidate.code === "number" ? candidate.code : void 0,
|
|
5968
|
+
message: typeof candidate.message === "string" ? candidate.message : String(error),
|
|
5969
|
+
shortMessage: typeof candidate.shortMessage === "string" ? candidate.shortMessage : void 0,
|
|
5970
|
+
details: typeof candidate.details === "string" ? candidate.details : void 0
|
|
5971
|
+
};
|
|
5972
|
+
}
|
|
5973
|
+
return { message: String(error) };
|
|
5974
|
+
}
|
|
5975
|
+
logRpcWarning(context, error, extra) {
|
|
5976
|
+
const rpcError = this.getRpcErrorDetails(error);
|
|
5977
|
+
console.warn(`[evm] ${context}`, {
|
|
5978
|
+
...extra,
|
|
5979
|
+
...rpcError
|
|
5980
|
+
});
|
|
5981
|
+
}
|
|
5982
|
+
async getBalances(address, tokens) {
|
|
5983
|
+
const chainKey = tokens[0]?.chainKey;
|
|
5984
|
+
const client = this.resolvePublicClientForChain(chainKey);
|
|
5932
5985
|
if (!client) {
|
|
5933
5986
|
return {};
|
|
5934
5987
|
}
|
|
@@ -5967,7 +6020,7 @@ class EvmChainStrategy {
|
|
|
5967
6020
|
}
|
|
5968
6021
|
}
|
|
5969
6022
|
async estimateNetworkFee(steps) {
|
|
5970
|
-
if (!this.
|
|
6023
|
+
if (!this.config.evmAddress) {
|
|
5971
6024
|
return 0;
|
|
5972
6025
|
}
|
|
5973
6026
|
const account = this.config.evmAddress;
|
|
@@ -5984,23 +6037,67 @@ class EvmChainStrategy {
|
|
|
5984
6037
|
return (feePerGas * scaled + 99n) / 100n;
|
|
5985
6038
|
};
|
|
5986
6039
|
let totalFeeWei = 0n;
|
|
5987
|
-
for (
|
|
6040
|
+
for (let i3 = 0; i3 < txSteps.length; i3++) {
|
|
6041
|
+
const step = txSteps[i3];
|
|
5988
6042
|
const tx = step.transaction;
|
|
5989
6043
|
if (!tx?.to) continue;
|
|
6044
|
+
const client = this.resolvePublicClientForChain(step.chainKey);
|
|
6045
|
+
if (!client) {
|
|
6046
|
+
this.logRpcWarning("Skipped network fee estimation: no public client", "no-client", {
|
|
6047
|
+
chainKey: step.chainKey,
|
|
6048
|
+
stepType: step.type,
|
|
6049
|
+
stepIndex: i3 + 1,
|
|
6050
|
+
totalSteps: txSteps.length
|
|
6051
|
+
});
|
|
6052
|
+
continue;
|
|
6053
|
+
}
|
|
5990
6054
|
try {
|
|
5991
|
-
const
|
|
6055
|
+
const gas = await client.estimateGas({
|
|
5992
6056
|
account: tx.from || account,
|
|
5993
6057
|
to: tx.to,
|
|
5994
6058
|
data: tx.data,
|
|
5995
|
-
value: tx.value ? BigInt(tx.value) : void 0
|
|
5996
|
-
chain: this.walletClient.chain
|
|
6059
|
+
value: tx.value ? BigInt(tx.value) : void 0
|
|
5997
6060
|
});
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6061
|
+
let feePerGas;
|
|
6062
|
+
try {
|
|
6063
|
+
const estimatedFees = await client.estimateFeesPerGas();
|
|
6064
|
+
feePerGas = estimatedFees.maxFeePerGas ?? estimatedFees.gasPrice;
|
|
6065
|
+
} catch (feeError) {
|
|
6066
|
+
this.logRpcWarning(
|
|
6067
|
+
"Failed to estimate fees per gas, falling back to gas price",
|
|
6068
|
+
feeError,
|
|
6069
|
+
{
|
|
6070
|
+
chainKey: step.chainKey,
|
|
6071
|
+
stepType: step.type,
|
|
6072
|
+
stepIndex: i3 + 1,
|
|
6073
|
+
totalSteps: txSteps.length
|
|
6074
|
+
}
|
|
6075
|
+
);
|
|
6076
|
+
try {
|
|
6077
|
+
feePerGas = await client.getGasPrice();
|
|
6078
|
+
} catch (gasPriceError) {
|
|
6079
|
+
this.logRpcWarning("Failed to get gas price for network fee estimation", gasPriceError, {
|
|
6080
|
+
chainKey: step.chainKey,
|
|
6081
|
+
stepType: step.type,
|
|
6082
|
+
stepIndex: i3 + 1,
|
|
6083
|
+
totalSteps: txSteps.length
|
|
6084
|
+
});
|
|
6085
|
+
}
|
|
6002
6086
|
}
|
|
6003
|
-
|
|
6087
|
+
if (gas && feePerGas) {
|
|
6088
|
+
totalFeeWei += gas * applyFeeMultiplier(feePerGas);
|
|
6089
|
+
}
|
|
6090
|
+
} catch (error) {
|
|
6091
|
+
this.logRpcWarning("Failed to estimate gas for network fee", error, {
|
|
6092
|
+
chainKey: step.chainKey,
|
|
6093
|
+
stepType: step.type,
|
|
6094
|
+
stepIndex: i3 + 1,
|
|
6095
|
+
totalSteps: txSteps.length,
|
|
6096
|
+
to: tx.to,
|
|
6097
|
+
from: tx.from || account,
|
|
6098
|
+
hasData: Boolean(tx.data),
|
|
6099
|
+
hasValue: Boolean(tx.value)
|
|
6100
|
+
});
|
|
6004
6101
|
}
|
|
6005
6102
|
}
|
|
6006
6103
|
if (totalFeeWei === 0n) {
|
|
@@ -7205,6 +7302,7 @@ function ChainStrategyProvider({
|
|
|
7205
7302
|
() => new EvmChainStrategy({
|
|
7206
7303
|
evmAddress: evmWallet.address,
|
|
7207
7304
|
evmIsConnected: evmWallet.isConnected,
|
|
7305
|
+
evmIsReconnecting: evmWallet.isReconnecting,
|
|
7208
7306
|
evmDisconnect: evmWallet.disconnect,
|
|
7209
7307
|
walletClient: evmWallet.walletClient,
|
|
7210
7308
|
publicClient: evmWallet.publicClient,
|
|
@@ -7214,6 +7312,7 @@ function ChainStrategyProvider({
|
|
|
7214
7312
|
[
|
|
7215
7313
|
evmWallet.address,
|
|
7216
7314
|
evmWallet.isConnected,
|
|
7315
|
+
evmWallet.isReconnecting,
|
|
7217
7316
|
evmWallet.disconnect,
|
|
7218
7317
|
evmWallet.walletClient,
|
|
7219
7318
|
evmWallet.publicClient,
|
|
@@ -26666,7 +26765,7 @@ class WalletConnectModal {
|
|
|
26666
26765
|
}
|
|
26667
26766
|
async initUi() {
|
|
26668
26767
|
if (typeof window !== "undefined") {
|
|
26669
|
-
await Promise.resolve().then(() => require("./index
|
|
26768
|
+
await Promise.resolve().then(() => require("./index--9cCU23B.cjs"));
|
|
26670
26769
|
const modal = document.createElement("wcm-modal");
|
|
26671
26770
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26672
26771
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26783,10 +26882,12 @@ function useTronWalletConnect(projectId) {
|
|
|
26783
26882
|
appliedThemeRef.current = appliedTheme;
|
|
26784
26883
|
React.useEffect(() => {
|
|
26785
26884
|
if (!projectId || providerRef.current) return;
|
|
26885
|
+
let cancelled = false;
|
|
26786
26886
|
const initProvider = async () => {
|
|
26787
26887
|
try {
|
|
26788
26888
|
const provider = await N.init({
|
|
26789
26889
|
projectId,
|
|
26890
|
+
name: "evaa-bridge-tron",
|
|
26790
26891
|
metadata: {
|
|
26791
26892
|
name: "EVAA Bridge",
|
|
26792
26893
|
description: "Cross-chain bridge powered by Stargate Protocol",
|
|
@@ -26794,6 +26895,7 @@ function useTronWalletConnect(projectId) {
|
|
|
26794
26895
|
icons: [`${window.location.origin}/favicon.ico`]
|
|
26795
26896
|
}
|
|
26796
26897
|
});
|
|
26898
|
+
if (cancelled) return;
|
|
26797
26899
|
providerRef.current = provider;
|
|
26798
26900
|
if (projectId) {
|
|
26799
26901
|
const modal = new WalletConnectModal({
|
|
@@ -26823,17 +26925,32 @@ function useTronWalletConnect(projectId) {
|
|
|
26823
26925
|
console.log("TRON WalletConnect session deleted");
|
|
26824
26926
|
setAddress(null);
|
|
26825
26927
|
});
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
)
|
|
26928
|
+
let tronAccounts = [];
|
|
26929
|
+
if (provider.session?.namespaces?.tron?.accounts?.length) {
|
|
26930
|
+
tronAccounts = provider.session.namespaces.tron.accounts;
|
|
26931
|
+
console.log("TRON WalletConnect: found session via provider.session");
|
|
26932
|
+
} else if (provider.client?.session) {
|
|
26933
|
+
const allSessions = provider.client.session.getAll();
|
|
26934
|
+
console.log("TRON WalletConnect: searching all sessions, count:", allSessions.length);
|
|
26935
|
+
const tronSession = allSessions.find(
|
|
26936
|
+
(s2) => s2.namespaces?.tron?.accounts?.length
|
|
26937
|
+
);
|
|
26938
|
+
if (tronSession) {
|
|
26939
|
+
tronAccounts = tronSession.namespaces.tron.accounts;
|
|
26940
|
+
console.log("TRON WalletConnect: found tron session in all sessions");
|
|
26941
|
+
}
|
|
26942
|
+
}
|
|
26943
|
+
if (tronAccounts.length > 0) {
|
|
26944
|
+
const extractedAddress = tronAccounts[0].split(":")[2];
|
|
26945
|
+
console.log(
|
|
26946
|
+
"TRON WalletConnect restored session:",
|
|
26947
|
+
extractedAddress
|
|
26948
|
+
);
|
|
26949
|
+
if (!cancelled) {
|
|
26835
26950
|
setAddress(extractedAddress);
|
|
26836
26951
|
}
|
|
26952
|
+
} else {
|
|
26953
|
+
console.log("TRON WalletConnect: no tron session found to restore");
|
|
26837
26954
|
}
|
|
26838
26955
|
} catch (error) {
|
|
26839
26956
|
console.error("Failed to initialize TRON WalletConnect:", error);
|
|
@@ -26841,17 +26958,15 @@ function useTronWalletConnect(projectId) {
|
|
|
26841
26958
|
};
|
|
26842
26959
|
initProvider();
|
|
26843
26960
|
return () => {
|
|
26844
|
-
|
|
26961
|
+
cancelled = true;
|
|
26845
26962
|
if (abortControllerRef.current) {
|
|
26846
26963
|
abortControllerRef.current.abort();
|
|
26847
26964
|
}
|
|
26848
|
-
if (providerRef.current) {
|
|
26849
|
-
console.warn("TRON WalletConnect: disconnecting provider in cleanup");
|
|
26850
|
-
providerRef.current.disconnect();
|
|
26851
|
-
}
|
|
26852
26965
|
if (modalRef.current) {
|
|
26853
26966
|
modalRef.current.closeModal();
|
|
26854
26967
|
}
|
|
26968
|
+
providerRef.current = null;
|
|
26969
|
+
modalRef.current = null;
|
|
26855
26970
|
};
|
|
26856
26971
|
}, [projectId, setAddress]);
|
|
26857
26972
|
React.useEffect(() => {
|
|
@@ -27238,7 +27353,7 @@ function useUrlSync(options) {
|
|
|
27238
27353
|
const EvaaBridgeWithProviders = (props) => {
|
|
27239
27354
|
const [tonConnectUI] = uiReact.useTonConnectUI();
|
|
27240
27355
|
const tonAddress = uiReact.useTonAddress();
|
|
27241
|
-
const { address: evmAddress, isConnected: evmIsConnected } = wagmi.useAccount();
|
|
27356
|
+
const { address: evmAddress, isConnected: evmIsConnected, isReconnecting: evmIsReconnecting } = wagmi.useAccount();
|
|
27242
27357
|
const wagmiConfig = wagmi.useConfig();
|
|
27243
27358
|
const { disconnect: evmDisconnect } = wagmi.useDisconnect();
|
|
27244
27359
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
@@ -27302,6 +27417,7 @@ const EvaaBridgeWithProviders = (props) => {
|
|
|
27302
27417
|
evmWallet: {
|
|
27303
27418
|
address: evmAddress,
|
|
27304
27419
|
isConnected: evmIsConnected,
|
|
27420
|
+
isReconnecting: evmIsReconnecting,
|
|
27305
27421
|
disconnect: evmDisconnect,
|
|
27306
27422
|
walletClient,
|
|
27307
27423
|
publicClient,
|
|
@@ -27571,4 +27687,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
27571
27687
|
exports.useSwapModel = useSwapModel;
|
|
27572
27688
|
exports.useTokensStore = useTokensStore;
|
|
27573
27689
|
exports.useTransactionStore = useTransactionStore;
|
|
27574
|
-
//# sourceMappingURL=index-
|
|
27690
|
+
//# sourceMappingURL=index-BLnE8fLp.cjs.map
|