@rash2x/bridge-widget 0.6.35 → 0.6.36
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-DJbbVeMD.cjs → index-B3GlyTKi.cjs} +2 -2
- package/dist/{index-DJbbVeMD.cjs.map → index-B3GlyTKi.cjs.map} +1 -1
- package/dist/{index-Cd_UnZsU.js → index-CoCqMlsg.js} +2 -2
- package/dist/{index-Cd_UnZsU.js.map → index-CoCqMlsg.js.map} +1 -1
- package/dist/{index-DvKN7Y1C.js → index-Dzam-3-q.js} +46 -8
- package/dist/{index-DvKN7Y1C.js.map → index-Dzam-3-q.js.map} +1 -1
- package/dist/{index-BXp-N4UF.cjs → index-ogZzdWIQ.cjs} +46 -8
- package/dist/{index-BXp-N4UF.cjs.map → index-ogZzdWIQ.cjs.map} +1 -1
- package/package.json +1 -1
|
@@ -498,6 +498,7 @@ const useTronWalletConnectStore = create(
|
|
|
498
498
|
isConnecting: false,
|
|
499
499
|
connect: null,
|
|
500
500
|
disconnect: null,
|
|
501
|
+
cancelConnection: null,
|
|
501
502
|
signTransaction: null,
|
|
502
503
|
setAddress: (address) => set2({
|
|
503
504
|
address,
|
|
@@ -507,6 +508,7 @@ const useTronWalletConnectStore = create(
|
|
|
507
508
|
setActions: (actions) => set2({
|
|
508
509
|
connect: actions.connect,
|
|
509
510
|
disconnect: actions.disconnect,
|
|
511
|
+
cancelConnection: actions.cancelConnection,
|
|
510
512
|
signTransaction: actions.signTransaction
|
|
511
513
|
}),
|
|
512
514
|
reset: () => set2({
|
|
@@ -3784,15 +3786,19 @@ function useBridgeTransaction() {
|
|
|
3784
3786
|
txStore.setError("COMPLETION_TRACKING_FAILED");
|
|
3785
3787
|
}
|
|
3786
3788
|
console.error("Error tracking completion:", err);
|
|
3789
|
+
}).finally(() => {
|
|
3790
|
+
setIsProcessing(false);
|
|
3787
3791
|
});
|
|
3792
|
+
return txResult;
|
|
3788
3793
|
} else {
|
|
3794
|
+
setIsProcessing(false);
|
|
3789
3795
|
throw new TransactionFailedError(
|
|
3790
3796
|
chainKey,
|
|
3791
3797
|
"Transaction hash not received from wallet"
|
|
3792
3798
|
);
|
|
3793
3799
|
}
|
|
3794
|
-
return txResult;
|
|
3795
3800
|
} catch (err) {
|
|
3801
|
+
setIsProcessing(false);
|
|
3796
3802
|
if (isUserRejection(err)) {
|
|
3797
3803
|
txStore.setError("TRANSACTION_REJECTED");
|
|
3798
3804
|
throw new TransactionFailedError(
|
|
@@ -3808,8 +3814,6 @@ function useBridgeTransaction() {
|
|
|
3808
3814
|
console.log(err);
|
|
3809
3815
|
txStore.setError("UNKNOWN_ERROR");
|
|
3810
3816
|
throw err;
|
|
3811
|
-
} finally {
|
|
3812
|
-
setIsProcessing(false);
|
|
3813
3817
|
}
|
|
3814
3818
|
};
|
|
3815
3819
|
return {
|
|
@@ -6937,7 +6941,6 @@ const TokenSelectModal = ({
|
|
|
6937
6941
|
useLayoutEffect(() => {
|
|
6938
6942
|
const updateHeight = () => {
|
|
6939
6943
|
const container2 = document.getElementById("token-select-list");
|
|
6940
|
-
console.log("CONTAINER", container2);
|
|
6941
6944
|
if (!container2) return;
|
|
6942
6945
|
const height = container2.getBoundingClientRect().height;
|
|
6943
6946
|
if (height > 0) {
|
|
@@ -25914,7 +25917,7 @@ class WalletConnectModal {
|
|
|
25914
25917
|
}
|
|
25915
25918
|
async initUi() {
|
|
25916
25919
|
if (typeof window !== "undefined") {
|
|
25917
|
-
await import("./index-
|
|
25920
|
+
await import("./index-CoCqMlsg.js");
|
|
25918
25921
|
const modal = document.createElement("wcm-modal");
|
|
25919
25922
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
25920
25923
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -25959,11 +25962,13 @@ const useThemeStore = create((set2) => ({
|
|
|
25959
25962
|
}
|
|
25960
25963
|
}));
|
|
25961
25964
|
const TRON_MAINNET_CHAIN_ID = "tron:0x2b6653dc";
|
|
25965
|
+
const CONNECTION_TIMEOUT = 6e4;
|
|
25962
25966
|
function useTronWalletConnect(projectId) {
|
|
25963
25967
|
const { address, isConnected, isConnecting } = useTronWalletConnectStore();
|
|
25964
25968
|
const { setAddress, setIsConnecting, setActions, reset } = useTronWalletConnectStore();
|
|
25965
25969
|
const providerRef = useRef(null);
|
|
25966
25970
|
const modalRef = useRef(null);
|
|
25971
|
+
const abortControllerRef = useRef(null);
|
|
25967
25972
|
const { onClose: closeWalletSelectModal } = useWalletSelectModal();
|
|
25968
25973
|
const appliedTheme = useThemeStore((state2) => state2.appliedTheme);
|
|
25969
25974
|
useEffect(() => {
|
|
@@ -26026,6 +26031,9 @@ function useTronWalletConnect(projectId) {
|
|
|
26026
26031
|
};
|
|
26027
26032
|
initProvider();
|
|
26028
26033
|
return () => {
|
|
26034
|
+
if (abortControllerRef.current) {
|
|
26035
|
+
abortControllerRef.current.abort();
|
|
26036
|
+
}
|
|
26029
26037
|
if (providerRef.current) {
|
|
26030
26038
|
providerRef.current.disconnect();
|
|
26031
26039
|
}
|
|
@@ -26052,9 +26060,14 @@ function useTronWalletConnect(projectId) {
|
|
|
26052
26060
|
"WalletConnect not initialized. Please provide a valid project ID."
|
|
26053
26061
|
);
|
|
26054
26062
|
}
|
|
26063
|
+
if (abortControllerRef.current) {
|
|
26064
|
+
abortControllerRef.current.abort();
|
|
26065
|
+
}
|
|
26066
|
+
abortControllerRef.current = new AbortController();
|
|
26067
|
+
const abortController = abortControllerRef.current;
|
|
26055
26068
|
setIsConnecting(true);
|
|
26056
26069
|
try {
|
|
26057
|
-
const
|
|
26070
|
+
const connectionPromise = providerRef.current.connect({
|
|
26058
26071
|
namespaces: {
|
|
26059
26072
|
tron: {
|
|
26060
26073
|
methods: ["tron_signTransaction", "tron_signMessage"],
|
|
@@ -26063,6 +26076,19 @@ function useTronWalletConnect(projectId) {
|
|
|
26063
26076
|
}
|
|
26064
26077
|
}
|
|
26065
26078
|
});
|
|
26079
|
+
const timeoutPromise = new Promise((_3, reject) => {
|
|
26080
|
+
const timeoutId = setTimeout(() => {
|
|
26081
|
+
reject(new Error("Connection timeout - please try again"));
|
|
26082
|
+
}, CONNECTION_TIMEOUT);
|
|
26083
|
+
abortController.signal.addEventListener("abort", () => {
|
|
26084
|
+
clearTimeout(timeoutId);
|
|
26085
|
+
reject(new Error("Connection cancelled"));
|
|
26086
|
+
});
|
|
26087
|
+
});
|
|
26088
|
+
const session = await Promise.race([connectionPromise, timeoutPromise]);
|
|
26089
|
+
if (abortController.signal.aborted) {
|
|
26090
|
+
throw new Error("Connection cancelled");
|
|
26091
|
+
}
|
|
26066
26092
|
if (session) {
|
|
26067
26093
|
const accounts = session.namespaces?.tron?.accounts || [];
|
|
26068
26094
|
if (accounts.length > 0) {
|
|
@@ -26087,8 +26113,18 @@ function useTronWalletConnect(projectId) {
|
|
|
26087
26113
|
throw error;
|
|
26088
26114
|
} finally {
|
|
26089
26115
|
setIsConnecting(false);
|
|
26116
|
+
abortControllerRef.current = null;
|
|
26090
26117
|
}
|
|
26091
26118
|
}, [setAddress, setIsConnecting]);
|
|
26119
|
+
const cancelConnection = useCallback(() => {
|
|
26120
|
+
if (abortControllerRef.current) {
|
|
26121
|
+
abortControllerRef.current.abort();
|
|
26122
|
+
console.log("TRON WalletConnect connection cancelled");
|
|
26123
|
+
}
|
|
26124
|
+
if (modalRef.current) {
|
|
26125
|
+
modalRef.current.closeModal();
|
|
26126
|
+
}
|
|
26127
|
+
}, []);
|
|
26092
26128
|
const disconnect = useCallback(async () => {
|
|
26093
26129
|
if (!providerRef.current) return;
|
|
26094
26130
|
try {
|
|
@@ -26125,15 +26161,17 @@ function useTronWalletConnect(projectId) {
|
|
|
26125
26161
|
setActions({
|
|
26126
26162
|
connect,
|
|
26127
26163
|
disconnect,
|
|
26164
|
+
cancelConnection,
|
|
26128
26165
|
signTransaction
|
|
26129
26166
|
});
|
|
26130
|
-
}, [connect, disconnect, signTransaction, setActions]);
|
|
26167
|
+
}, [connect, disconnect, cancelConnection, signTransaction, setActions]);
|
|
26131
26168
|
return {
|
|
26132
26169
|
address,
|
|
26133
26170
|
isConnected,
|
|
26134
26171
|
isConnecting,
|
|
26135
26172
|
connect,
|
|
26136
26173
|
disconnect,
|
|
26174
|
+
cancelConnection,
|
|
26137
26175
|
signTransaction
|
|
26138
26176
|
};
|
|
26139
26177
|
}
|
|
@@ -26638,4 +26676,4 @@ export {
|
|
|
26638
26676
|
getQuoteFees as y,
|
|
26639
26677
|
calculateMinReceived as z
|
|
26640
26678
|
};
|
|
26641
|
-
//# sourceMappingURL=index-
|
|
26679
|
+
//# sourceMappingURL=index-Dzam-3-q.js.map
|