@multiversx/sdk-dapp-liquidity 1.0.6 → 1.0.7
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/package.json
CHANGED
|
@@ -13,7 +13,18 @@ const useGetRateMutation = () => {
|
|
|
13
13
|
return data;
|
|
14
14
|
};
|
|
15
15
|
return reactQuery.useMutation({
|
|
16
|
-
mutationFn
|
|
16
|
+
mutationFn,
|
|
17
|
+
onSuccess: (data) => {
|
|
18
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
19
|
+
if (data.expiresAt && new Date(data.expiresAt).getTime() < currentTime) {
|
|
20
|
+
console.warn("Retrying due to expired rate");
|
|
21
|
+
throw new Error("Retrying due to expired rate");
|
|
22
|
+
}
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
retry: (failureCount, error) => {
|
|
26
|
+
return error.message === "Retrying due to expired rate" && failureCount < 2;
|
|
27
|
+
}
|
|
17
28
|
});
|
|
18
29
|
};
|
|
19
30
|
exports.useGetRateMutation = useGetRateMutation;
|
|
@@ -10,7 +10,18 @@ const useGetRateMutation = () => {
|
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return useMutation({
|
|
13
|
-
mutationFn
|
|
13
|
+
mutationFn,
|
|
14
|
+
onSuccess: (data) => {
|
|
15
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
16
|
+
if (data.expiresAt && new Date(data.expiresAt).getTime() < currentTime) {
|
|
17
|
+
console.warn("Retrying due to expired rate");
|
|
18
|
+
throw new Error("Retrying due to expired rate");
|
|
19
|
+
}
|
|
20
|
+
return data;
|
|
21
|
+
},
|
|
22
|
+
retry: (failureCount, error) => {
|
|
23
|
+
return error.message === "Retrying due to expired rate" && failureCount < 2;
|
|
24
|
+
}
|
|
14
25
|
});
|
|
15
26
|
};
|
|
16
27
|
export {
|