@rash2x/bridge-widget 0.8.2 → 0.8.4
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-BiPDLFPf.js → index-B5QQQ8Nj.js} +71 -31
- package/dist/index-B5QQQ8Nj.js.map +1 -0
- package/dist/{index-BcqN6B-E.cjs → index-BDGHvxEQ.cjs} +71 -31
- package/dist/index-BDGHvxEQ.cjs.map +1 -0
- package/dist/{index-BqxDubHD.js → index-BKyBBUlY.js} +2 -2
- package/dist/{index-BqxDubHD.js.map → index-BKyBBUlY.js.map} +1 -1
- package/dist/{index-CFKU946o.cjs → index-BdfMMh_j.cjs} +2 -2
- package/dist/{index-CFKU946o.cjs.map → index-BdfMMh_j.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BcqN6B-E.cjs.map +0 -1
- package/dist/index-BiPDLFPf.js.map +0 -1
|
@@ -2462,6 +2462,7 @@ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcCh
|
|
|
2462
2462
|
let messageFeeUsd = 0;
|
|
2463
2463
|
let messageFeeAmount = 0;
|
|
2464
2464
|
let messageFeeSymbol = "";
|
|
2465
|
+
let messageFeeTokenPriceUsd = 0;
|
|
2465
2466
|
const messageFees = quote.fees.filter((f4) => f4.type === "message");
|
|
2466
2467
|
for (const f4 of messageFees) {
|
|
2467
2468
|
const { decimals, priceUsd } = lookupTokenMeta(
|
|
@@ -2479,6 +2480,7 @@ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcCh
|
|
|
2479
2480
|
(t2) => t2.chainKey === f4.chainKey && t2.address.toLowerCase() === f4.token.toLowerCase()
|
|
2480
2481
|
);
|
|
2481
2482
|
messageFeeSymbol = token?.symbol?.toUpperCase() ?? chain2?.nativeCurrency?.symbol?.toUpperCase() ?? "";
|
|
2483
|
+
messageFeeTokenPriceUsd = priceUsd ?? 0;
|
|
2482
2484
|
}
|
|
2483
2485
|
}
|
|
2484
2486
|
let bridgeFeeAmount = 0;
|
|
@@ -2509,7 +2511,14 @@ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcCh
|
|
|
2509
2511
|
dstGasUsd = dstGasAmount * (priceUsd ?? 0);
|
|
2510
2512
|
}
|
|
2511
2513
|
}
|
|
2512
|
-
|
|
2514
|
+
if (dstGasAmount > 0 && messageFeeSymbol) {
|
|
2515
|
+
if (messageFeeSymbol === dstGasSymbol) {
|
|
2516
|
+
messageFeeAmount += dstGasAmount;
|
|
2517
|
+
} else if (messageFeeTokenPriceUsd > 0) {
|
|
2518
|
+
messageFeeAmount += dstGasUsd / messageFeeTokenPriceUsd;
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
const totalFeeUsd = messageFeeUsd + bridgeFeeUsd;
|
|
2513
2522
|
return {
|
|
2514
2523
|
messageFeeAmount,
|
|
2515
2524
|
messageFeeSymbol,
|
|
@@ -5047,6 +5056,44 @@ const MainButton = ({
|
|
|
5047
5056
|
)
|
|
5048
5057
|
] });
|
|
5049
5058
|
};
|
|
5059
|
+
const MOBILE_UA_REGEX = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i;
|
|
5060
|
+
function isMobileDevice() {
|
|
5061
|
+
if (typeof navigator === "undefined") return false;
|
|
5062
|
+
return MOBILE_UA_REGEX.test(navigator.userAgent);
|
|
5063
|
+
}
|
|
5064
|
+
function isTronLinkInstalled() {
|
|
5065
|
+
if (typeof window === "undefined") {
|
|
5066
|
+
return false;
|
|
5067
|
+
}
|
|
5068
|
+
const win = window;
|
|
5069
|
+
if (!win.tronWeb) {
|
|
5070
|
+
return false;
|
|
5071
|
+
}
|
|
5072
|
+
const tronLink = win.tronWeb;
|
|
5073
|
+
if (typeof tronLink.isTronLink === "boolean") {
|
|
5074
|
+
return tronLink.isTronLink;
|
|
5075
|
+
}
|
|
5076
|
+
if (typeof tronLink.ready === "boolean") {
|
|
5077
|
+
return tronLink.ready;
|
|
5078
|
+
}
|
|
5079
|
+
return true;
|
|
5080
|
+
}
|
|
5081
|
+
function buildTronLinkDeepLink(targetUrl) {
|
|
5082
|
+
const param = encodeURIComponent(
|
|
5083
|
+
JSON.stringify({
|
|
5084
|
+
url: targetUrl,
|
|
5085
|
+
action: "open",
|
|
5086
|
+
protocol: "tronlink",
|
|
5087
|
+
version: "1.0"
|
|
5088
|
+
})
|
|
5089
|
+
);
|
|
5090
|
+
return `tronlinkoutside://pull.activity?param=${param}`;
|
|
5091
|
+
}
|
|
5092
|
+
function openInTronLink(targetUrl) {
|
|
5093
|
+
if (typeof window === "undefined") return false;
|
|
5094
|
+
window.location.href = buildTronLinkDeepLink(targetUrl);
|
|
5095
|
+
return true;
|
|
5096
|
+
}
|
|
5050
5097
|
const WalletModalButton = (props) => {
|
|
5051
5098
|
const { t: t2 } = reactI18next.useTranslation();
|
|
5052
5099
|
const { icon: IconComponent, name, onClose } = props;
|
|
@@ -5103,6 +5150,17 @@ const WalletModalButton = (props) => {
|
|
|
5103
5150
|
const strategy = chainRegistry.getStrategyByType("ton");
|
|
5104
5151
|
await strategy?.connect();
|
|
5105
5152
|
} else {
|
|
5153
|
+
if (walletId === "tronlink" && isMobileDevice() && !isTronLinkInstalled()) {
|
|
5154
|
+
const opened = openInTronLink(window.location.href);
|
|
5155
|
+
if (!opened) {
|
|
5156
|
+
sonner.toast.error(
|
|
5157
|
+
"Failed to open TronLink app. Please use WalletConnect."
|
|
5158
|
+
);
|
|
5159
|
+
return;
|
|
5160
|
+
}
|
|
5161
|
+
onClose?.();
|
|
5162
|
+
return;
|
|
5163
|
+
}
|
|
5106
5164
|
const strategy = chainRegistry.getStrategyByType("tron");
|
|
5107
5165
|
const provider = walletId === "tronwc" ? "walletconnect" : "tronlink";
|
|
5108
5166
|
await strategy?.connect({ provider });
|
|
@@ -6299,14 +6357,17 @@ class TronChainStrategy {
|
|
|
6299
6357
|
await walletConnect.connect();
|
|
6300
6358
|
return;
|
|
6301
6359
|
}
|
|
6302
|
-
if (!
|
|
6303
|
-
if (typeof window !== "undefined") {
|
|
6360
|
+
if (!isTronLinkInstalled()) {
|
|
6361
|
+
if (typeof window !== "undefined" && !isMobileDevice()) {
|
|
6304
6362
|
window.open("https://www.tronlink.org/", "_blank");
|
|
6305
6363
|
}
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6364
|
+
if (isMobileDevice()) {
|
|
6365
|
+
throw new ProviderNotAvailableError(
|
|
6366
|
+
"tron",
|
|
6367
|
+
"TronLink is not available in this mobile browser. Use WalletConnect or open this dApp in TronLink's in-app browser."
|
|
6368
|
+
);
|
|
6369
|
+
}
|
|
6370
|
+
throw new WalletNotFoundError("tron", "TronLink");
|
|
6310
6371
|
}
|
|
6311
6372
|
if (this.config.tronLink.connected && this.config.tronLink.address) {
|
|
6312
6373
|
console.log("TronLink already connected, skipping connection");
|
|
@@ -6516,7 +6577,7 @@ class TronChainStrategy {
|
|
|
6516
6577
|
if (preferProvider === "walletconnect") {
|
|
6517
6578
|
return this.getFallbackClient();
|
|
6518
6579
|
}
|
|
6519
|
-
if (typeof window !== "undefined" && window.tronWeb &&
|
|
6580
|
+
if (typeof window !== "undefined" && window.tronWeb && isTronLinkInstalled()) {
|
|
6520
6581
|
this.applyTronApiKey(window.tronWeb);
|
|
6521
6582
|
return window.tronWeb;
|
|
6522
6583
|
}
|
|
@@ -6571,27 +6632,6 @@ class TronChainStrategy {
|
|
|
6571
6632
|
} catch {
|
|
6572
6633
|
}
|
|
6573
6634
|
}
|
|
6574
|
-
/**
|
|
6575
|
-
* Check if TronLink wallet is actually installed
|
|
6576
|
-
* This excludes Bybit Wallet which also injects tronLink for compatibility
|
|
6577
|
-
*/
|
|
6578
|
-
isTronLinkInstalled() {
|
|
6579
|
-
if (typeof window === "undefined") {
|
|
6580
|
-
return false;
|
|
6581
|
-
}
|
|
6582
|
-
const win = window;
|
|
6583
|
-
if (!win.tronWeb) {
|
|
6584
|
-
return false;
|
|
6585
|
-
}
|
|
6586
|
-
const tronLink = win.tronWeb;
|
|
6587
|
-
if (typeof tronLink.isTronLink === "boolean") {
|
|
6588
|
-
return tronLink.isTronLink;
|
|
6589
|
-
}
|
|
6590
|
-
if (typeof tronLink.ready === "boolean") {
|
|
6591
|
-
return tronLink.ready;
|
|
6592
|
-
}
|
|
6593
|
-
return true;
|
|
6594
|
-
}
|
|
6595
6635
|
ensureDefaultAddress(tronWeb, address) {
|
|
6596
6636
|
if (!address) return;
|
|
6597
6637
|
try {
|
|
@@ -26522,7 +26562,7 @@ class WalletConnectModal {
|
|
|
26522
26562
|
}
|
|
26523
26563
|
async initUi() {
|
|
26524
26564
|
if (typeof window !== "undefined") {
|
|
26525
|
-
await Promise.resolve().then(() => require("./index-
|
|
26565
|
+
await Promise.resolve().then(() => require("./index-BdfMMh_j.cjs"));
|
|
26526
26566
|
const modal = document.createElement("wcm-modal");
|
|
26527
26567
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26528
26568
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -27425,4 +27465,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
27425
27465
|
exports.useSwapModel = useSwapModel;
|
|
27426
27466
|
exports.useTokensStore = useTokensStore;
|
|
27427
27467
|
exports.useTransactionStore = useTransactionStore;
|
|
27428
|
-
//# sourceMappingURL=index-
|
|
27468
|
+
//# sourceMappingURL=index-BDGHvxEQ.cjs.map
|