@rash2x/bridge-widget 0.6.81 → 0.6.83
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 -2
- package/dist/evaa-bridge.cjs.map +1 -1
- package/dist/evaa-bridge.mjs +42 -43
- package/dist/{index-CGOaOD6h.cjs → index-4Tkk8Kek.cjs} +2 -2
- package/dist/{index-CGOaOD6h.cjs.map → index-4Tkk8Kek.cjs.map} +1 -1
- package/dist/{index-DJSauetI.js → index-7Rh1biLW.js} +106 -82
- package/dist/index-7Rh1biLW.js.map +1 -0
- package/dist/{index-h3n0j3BF.cjs → index-Bym1eouV.cjs} +65 -41
- package/dist/index-Bym1eouV.cjs.map +1 -0
- package/dist/{index-88BW4a4g.js → index-CJeHQDmm.js} +2 -2
- package/dist/{index-88BW4a4g.js.map → index-CJeHQDmm.js.map} +1 -1
- package/dist/index.d.ts +7 -19
- package/package.json +1 -1
- package/dist/index-DJSauetI.js.map +0 -1
- package/dist/index-h3n0j3BF.cjs.map +0 -1
|
@@ -1132,7 +1132,7 @@ function useBridgeQuote() {
|
|
|
1132
1132
|
const { assetMatrix, selectedAssetSymbol } = useTokensStore();
|
|
1133
1133
|
const { fromChain, toChain, chains } = useChainsStore();
|
|
1134
1134
|
const { srcAddress, dstAddress } = useAddresses();
|
|
1135
|
-
const { slippageBps, routePriority, getDstNativeAmount, getSlippageDecimal } = useSettingsStore();
|
|
1135
|
+
const { slippageBps, routePriority, gasPreset, getDstNativeAmount, getSlippageDecimal } = useSettingsStore();
|
|
1136
1136
|
const {
|
|
1137
1137
|
inputAmount,
|
|
1138
1138
|
refetchTrigger,
|
|
@@ -1269,6 +1269,7 @@ function useBridgeQuote() {
|
|
|
1269
1269
|
setQError,
|
|
1270
1270
|
slippageBps,
|
|
1271
1271
|
routePriority,
|
|
1272
|
+
gasPreset,
|
|
1272
1273
|
refetchTrigger,
|
|
1273
1274
|
chainRegistry,
|
|
1274
1275
|
chains,
|
|
@@ -2848,7 +2849,7 @@ const Tip = (props) => {
|
|
|
2848
2849
|
const { children, text } = props;
|
|
2849
2850
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
2850
2851
|
/* @__PURE__ */ jsx(TooltipTrigger, { className: "w-4 h-4 rounded-full bg-muted text-muted-foreground", children }),
|
|
2851
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-64", children:
|
|
2852
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-64", children: text })
|
|
2852
2853
|
] });
|
|
2853
2854
|
};
|
|
2854
2855
|
const BASE_URL = "https://icons-ckg.pages.dev/stargate-light/tokens";
|
|
@@ -3443,26 +3444,6 @@ async function waitForLayerZeroCompletion(txHash, timeoutMs = 6e5, pollIntervalM
|
|
|
3443
3444
|
status: "TIMEOUT"
|
|
3444
3445
|
};
|
|
3445
3446
|
}
|
|
3446
|
-
const useBridgeReportStore = create((set2) => ({
|
|
3447
|
-
config: {
|
|
3448
|
-
enabled: false,
|
|
3449
|
-
authToken: void 0,
|
|
3450
|
-
baseUrl: void 0
|
|
3451
|
-
},
|
|
3452
|
-
setConfig: (config) => {
|
|
3453
|
-
set2({ config });
|
|
3454
|
-
},
|
|
3455
|
-
setAuthToken: (token) => {
|
|
3456
|
-
set2((state2) => ({
|
|
3457
|
-
config: { ...state2.config, authToken: token }
|
|
3458
|
-
}));
|
|
3459
|
-
},
|
|
3460
|
-
setEnabled: (enabled) => {
|
|
3461
|
-
set2((state2) => ({
|
|
3462
|
-
config: { ...state2.config, enabled }
|
|
3463
|
-
}));
|
|
3464
|
-
}
|
|
3465
|
-
}));
|
|
3466
3447
|
async function tryFetch(url) {
|
|
3467
3448
|
try {
|
|
3468
3449
|
const res = await fetch(url);
|
|
@@ -3559,7 +3540,6 @@ function useBridgeTransaction() {
|
|
|
3559
3540
|
const { assetMatrix, selectedAssetSymbol, allTokens } = useTokensStore();
|
|
3560
3541
|
const { chains } = useChainsStore();
|
|
3561
3542
|
const txStore = useTransactionStore();
|
|
3562
|
-
const { config: bridgeReportConfig } = useBridgeReportStore();
|
|
3563
3543
|
const gas = useGasEstimate();
|
|
3564
3544
|
const srcToken = useMemo(
|
|
3565
3545
|
() => resolveTokenOnChainFromMatrix$2(
|
|
@@ -3577,7 +3557,7 @@ function useBridgeTransaction() {
|
|
|
3577
3557
|
),
|
|
3578
3558
|
[assetMatrix, selectedAssetSymbol, quote?.dstChainKey]
|
|
3579
3559
|
);
|
|
3580
|
-
const executeTransaction = async () => {
|
|
3560
|
+
const executeTransaction = async (callbacks, bridgeReportConfig) => {
|
|
3581
3561
|
if (!quote) {
|
|
3582
3562
|
throw new InvalidStepsError("bridge", "No quote available");
|
|
3583
3563
|
}
|
|
@@ -3594,8 +3574,16 @@ function useBridgeTransaction() {
|
|
|
3594
3574
|
dstTokenSymbol: dstToken?.symbol || quote.dstToken,
|
|
3595
3575
|
srcAmountHuman: amounts.inputHuman,
|
|
3596
3576
|
dstAmountHuman: amounts.outputHuman
|
|
3597
|
-
// Actual fee will be updated when transaction completes
|
|
3598
3577
|
};
|
|
3578
|
+
const shouldStart = await callbacks?.onSwapStart?.({
|
|
3579
|
+
fromChain: metadata.srcChainName,
|
|
3580
|
+
toChain: metadata.dstChainName,
|
|
3581
|
+
amount: amounts.inputHuman.toString(),
|
|
3582
|
+
tokenSymbol: metadata.srcTokenSymbol
|
|
3583
|
+
});
|
|
3584
|
+
if (shouldStart === false) {
|
|
3585
|
+
return { hash: void 0 };
|
|
3586
|
+
}
|
|
3599
3587
|
txStore.setTransaction(quote, "executing", metadata);
|
|
3600
3588
|
try {
|
|
3601
3589
|
const steps = quote.steps || [];
|
|
@@ -3658,7 +3646,7 @@ function useBridgeTransaction() {
|
|
|
3658
3646
|
console.warn("Failed to convert TON message hash to tx hash");
|
|
3659
3647
|
}
|
|
3660
3648
|
}
|
|
3661
|
-
if (bridgeReportConfig
|
|
3649
|
+
if (bridgeReportConfig?.enabled) {
|
|
3662
3650
|
reportBridgeTransaction(
|
|
3663
3651
|
{
|
|
3664
3652
|
lz_tx_hash: hashForLayerZero,
|
|
@@ -3681,6 +3669,13 @@ function useBridgeTransaction() {
|
|
|
3681
3669
|
6e5,
|
|
3682
3670
|
1e4
|
|
3683
3671
|
);
|
|
3672
|
+
const successData = {
|
|
3673
|
+
fromChain: metadata.srcChainName,
|
|
3674
|
+
toChain: metadata.dstChainName,
|
|
3675
|
+
amount: amounts.inputHuman.toString(),
|
|
3676
|
+
tokenSymbol: metadata.srcTokenSymbol,
|
|
3677
|
+
transactionHash: txResult.hash
|
|
3678
|
+
};
|
|
3684
3679
|
if (lzResult.completed) {
|
|
3685
3680
|
if (lzResult.dstTxHash) {
|
|
3686
3681
|
txStore.setDstHash(lzResult.dstTxHash);
|
|
@@ -3706,12 +3701,21 @@ function useBridgeTransaction() {
|
|
|
3706
3701
|
console.warn("Failed to compute source cost:", error);
|
|
3707
3702
|
}
|
|
3708
3703
|
}
|
|
3704
|
+
callbacks?.onSwapSuccess?.(successData);
|
|
3709
3705
|
txStore.updateStatus("completed");
|
|
3710
3706
|
} else {
|
|
3711
3707
|
if (lzResult.status === "FAILED") {
|
|
3708
|
+
callbacks?.onSwapError?.({
|
|
3709
|
+
error: "TRANSACTION_FAILED_TO_COMPLETE",
|
|
3710
|
+
fromChain: metadata.srcChainName,
|
|
3711
|
+
toChain: metadata.dstChainName,
|
|
3712
|
+
amount: amounts.inputHuman.toString(),
|
|
3713
|
+
tokenSymbol: metadata.srcTokenSymbol
|
|
3714
|
+
});
|
|
3712
3715
|
txStore.setError("TRANSACTION_FAILED_TO_COMPLETE");
|
|
3713
3716
|
console.error("LayerZero delivery failed");
|
|
3714
3717
|
} else {
|
|
3718
|
+
callbacks?.onSwapSuccess?.(successData);
|
|
3715
3719
|
txStore.updateStatus("completed");
|
|
3716
3720
|
console.warn(
|
|
3717
3721
|
"LayerZero tracking timed out, marking as completed"
|
|
@@ -3720,6 +3724,14 @@ function useBridgeTransaction() {
|
|
|
3720
3724
|
}
|
|
3721
3725
|
};
|
|
3722
3726
|
trackWithLayerZero().catch((err) => {
|
|
3727
|
+
const errorData = {
|
|
3728
|
+
error: isUserRejection(err) ? "TRANSACTION_REJECTED" : ChainStrategyError.isChainStrategyError(err) ? err.code : "COMPLETION_TRACKING_FAILED",
|
|
3729
|
+
fromChain: metadata.srcChainName,
|
|
3730
|
+
toChain: metadata.dstChainName,
|
|
3731
|
+
amount: amounts.inputHuman.toString(),
|
|
3732
|
+
tokenSymbol: metadata.srcTokenSymbol
|
|
3733
|
+
};
|
|
3734
|
+
callbacks?.onSwapError?.(errorData);
|
|
3723
3735
|
if (isUserRejection(err)) {
|
|
3724
3736
|
txStore.setError("TRANSACTION_REJECTED");
|
|
3725
3737
|
} else if (ChainStrategyError.isChainStrategyError(err)) {
|
|
@@ -3737,6 +3749,14 @@ function useBridgeTransaction() {
|
|
|
3737
3749
|
);
|
|
3738
3750
|
}
|
|
3739
3751
|
} catch (err) {
|
|
3752
|
+
const errorCode = isUserRejection(err) ? "TRANSACTION_REJECTED" : ChainStrategyError.isChainStrategyError(err) ? err.code : "UNKNOWN_ERROR";
|
|
3753
|
+
callbacks?.onSwapError?.({
|
|
3754
|
+
error: errorCode,
|
|
3755
|
+
fromChain: metadata.srcChainName,
|
|
3756
|
+
toChain: metadata.dstChainName,
|
|
3757
|
+
amount: amounts.inputHuman.toString(),
|
|
3758
|
+
tokenSymbol: metadata.srcTokenSymbol
|
|
3759
|
+
});
|
|
3740
3760
|
if (isUserRejection(err)) {
|
|
3741
3761
|
txStore.setError("TRANSACTION_REJECTED");
|
|
3742
3762
|
throw new TransactionFailedError(
|
|
@@ -3913,7 +3933,10 @@ function useTelegramRestriction() {
|
|
|
3913
3933
|
}, [fromChain?.chainKey, toChain?.chainKey]);
|
|
3914
3934
|
return restriction;
|
|
3915
3935
|
}
|
|
3916
|
-
const MainButton = (
|
|
3936
|
+
const MainButton = ({
|
|
3937
|
+
swapCallbacks,
|
|
3938
|
+
bridgeReport
|
|
3939
|
+
}) => {
|
|
3917
3940
|
const { t: t2 } = useBridgeTranslation();
|
|
3918
3941
|
const { chainRegistry } = useChainStrategies();
|
|
3919
3942
|
const { srcAddress, dstAddress, isCustomAddressEnabled } = useAddresses();
|
|
@@ -4010,7 +4033,7 @@ const MainButton = () => {
|
|
|
4010
4033
|
}
|
|
4011
4034
|
if (canTransfer) {
|
|
4012
4035
|
try {
|
|
4013
|
-
await executeTransaction();
|
|
4036
|
+
await executeTransaction(swapCallbacks, bridgeReport);
|
|
4014
4037
|
} catch (error) {
|
|
4015
4038
|
console.warn(error);
|
|
4016
4039
|
}
|
|
@@ -25854,7 +25877,7 @@ class WalletConnectModal {
|
|
|
25854
25877
|
}
|
|
25855
25878
|
async initUi() {
|
|
25856
25879
|
if (typeof window !== "undefined") {
|
|
25857
|
-
await import("./index-
|
|
25880
|
+
await import("./index-CJeHQDmm.js");
|
|
25858
25881
|
const modal = document.createElement("wcm-modal");
|
|
25859
25882
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
25860
25883
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26296,14 +26319,6 @@ function useUrlSync(options) {
|
|
|
26296
26319
|
const EvaaBridgeWithProviders = (props) => {
|
|
26297
26320
|
const [tonConnectUI] = useTonConnectUI();
|
|
26298
26321
|
const tonAddress = useTonAddress();
|
|
26299
|
-
const { setConfig: setBridgeReportConfig } = useBridgeReportStore();
|
|
26300
|
-
useEffect(() => {
|
|
26301
|
-
if (props.bridgeReport) {
|
|
26302
|
-
setBridgeReportConfig(props.bridgeReport);
|
|
26303
|
-
} else {
|
|
26304
|
-
setBridgeReportConfig({ enabled: false });
|
|
26305
|
-
}
|
|
26306
|
-
}, [props.bridgeReport, setBridgeReportConfig]);
|
|
26307
26322
|
const { address: evmAddress, isConnected: evmIsConnected } = useAccount();
|
|
26308
26323
|
const { disconnect: evmDisconnect } = useDisconnect();
|
|
26309
26324
|
const { data: walletClient } = useWalletClient();
|
|
@@ -26393,7 +26408,11 @@ const EvaaBridgeContent = ({
|
|
|
26393
26408
|
urlParams,
|
|
26394
26409
|
onUrlParamsChange,
|
|
26395
26410
|
onInitialized,
|
|
26396
|
-
|
|
26411
|
+
onSwapStart,
|
|
26412
|
+
onSwapSuccess,
|
|
26413
|
+
onSwapError,
|
|
26414
|
+
onDataUpdate,
|
|
26415
|
+
bridgeReport
|
|
26397
26416
|
} = {}) => {
|
|
26398
26417
|
const { t: t2 } = useBridgeTranslation();
|
|
26399
26418
|
useTokens();
|
|
@@ -26528,7 +26547,13 @@ const EvaaBridgeContent = ({
|
|
|
26528
26547
|
}
|
|
26529
26548
|
),
|
|
26530
26549
|
/* @__PURE__ */ jsx(AnotherAddress, {}),
|
|
26531
|
-
/* @__PURE__ */ jsx(
|
|
26550
|
+
/* @__PURE__ */ jsx(
|
|
26551
|
+
MainButton,
|
|
26552
|
+
{
|
|
26553
|
+
swapCallbacks: { onSwapStart, onSwapSuccess, onSwapError },
|
|
26554
|
+
bridgeReport
|
|
26555
|
+
}
|
|
26556
|
+
)
|
|
26532
26557
|
] }),
|
|
26533
26558
|
/* @__PURE__ */ jsx(CardFooter, { className: "p-0", children: /* @__PURE__ */ jsx(Details, {}) })
|
|
26534
26559
|
]
|
|
@@ -26541,44 +26566,43 @@ const EvaaBridgeContent = ({
|
|
|
26541
26566
|
};
|
|
26542
26567
|
const EvaaBridge = EvaaBridgeWithProviders;
|
|
26543
26568
|
export {
|
|
26544
|
-
|
|
26545
|
-
|
|
26546
|
-
|
|
26569
|
+
getDestTokens as $,
|
|
26570
|
+
getQuoteDetails as A,
|
|
26571
|
+
getRouteDisplayName as B,
|
|
26547
26572
|
ConfigCtrl as C,
|
|
26548
|
-
|
|
26573
|
+
addNetworkFeesToQuote as D,
|
|
26549
26574
|
EventsCtrl as E,
|
|
26550
|
-
|
|
26551
|
-
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
|
|
26555
|
-
|
|
26556
|
-
|
|
26575
|
+
toLD as F,
|
|
26576
|
+
fromLD as G,
|
|
26577
|
+
buildAssetMatrix as H,
|
|
26578
|
+
listAssetsForSelect as I,
|
|
26579
|
+
resolveTokenOnChain as J,
|
|
26580
|
+
resolveTokenOnChainFromMatrix$2 as K,
|
|
26581
|
+
DEFAULT_SLIPPAGE_BPS as L,
|
|
26557
26582
|
ModalCtrl as M,
|
|
26558
|
-
|
|
26583
|
+
tonNorm as N,
|
|
26559
26584
|
OptionsCtrl as O,
|
|
26560
|
-
|
|
26561
|
-
|
|
26585
|
+
isZeroAddr as P,
|
|
26586
|
+
addrForApi as Q,
|
|
26562
26587
|
RouterCtrl as R,
|
|
26563
|
-
|
|
26588
|
+
isNativeAddrEqual as S,
|
|
26564
26589
|
ToastCtrl as T,
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26590
|
+
findNativeMeta as U,
|
|
26591
|
+
lookupTokenMeta as V,
|
|
26592
|
+
computeFeesUsdFromArray as W,
|
|
26593
|
+
sumFeeByTokenLD as X,
|
|
26594
|
+
normalizeTickerSymbol$1 as Y,
|
|
26595
|
+
getChains as Z,
|
|
26596
|
+
getTokens as _,
|
|
26572
26597
|
ThemeCtrl as a,
|
|
26573
|
-
|
|
26574
|
-
|
|
26575
|
-
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
reportBridgeTransaction as a8,
|
|
26598
|
+
getQuotesByPriority as a0,
|
|
26599
|
+
isNativeAddress as a1,
|
|
26600
|
+
getEvmBalances as a2,
|
|
26601
|
+
getTonBalances as a3,
|
|
26602
|
+
getTronBalances as a4,
|
|
26603
|
+
getDeliveryStatus as a5,
|
|
26604
|
+
pollUntilDelivered as a6,
|
|
26605
|
+
reportBridgeTransaction as a7,
|
|
26582
26606
|
ExplorerCtrl as b,
|
|
26583
26607
|
CoreUtil as c,
|
|
26584
26608
|
EvaaBridge as d,
|
|
@@ -26591,18 +26615,18 @@ export {
|
|
|
26591
26615
|
useTransactionStore as k,
|
|
26592
26616
|
useConnectedWalletsStore as l,
|
|
26593
26617
|
useCustomAddressStore as m,
|
|
26594
|
-
|
|
26595
|
-
|
|
26596
|
-
|
|
26597
|
-
|
|
26598
|
-
|
|
26599
|
-
|
|
26618
|
+
useSwapModel as n,
|
|
26619
|
+
useBridgeExternalData as o,
|
|
26620
|
+
formatTokenAmount as p,
|
|
26621
|
+
formatUsd as q,
|
|
26622
|
+
formatPercentage as r,
|
|
26623
|
+
formatBalance as s,
|
|
26600
26624
|
truncateToDecimals as t,
|
|
26601
26625
|
useChainsStore as u,
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
|
|
26606
|
-
|
|
26626
|
+
formatHash as v,
|
|
26627
|
+
formatAddress as w,
|
|
26628
|
+
getQuoteAmounts as x,
|
|
26629
|
+
getQuoteFees as y,
|
|
26630
|
+
calculateMinReceived as z
|
|
26607
26631
|
};
|
|
26608
|
-
//# sourceMappingURL=index-
|
|
26632
|
+
//# sourceMappingURL=index-7Rh1biLW.js.map
|