@rango-dev/widget-embedded 0.42.3-next.1 → 0.42.3-next.2
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/constants/errors.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/types/quote.d.ts +1 -0
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +2 -2
- package/src/constants/errors.ts +6 -7
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +1 -1
- package/src/types/quote.ts +4 -1
package/package.json
CHANGED
package/src/constants/errors.ts
CHANGED
|
@@ -52,12 +52,11 @@ export const errorMessages = () => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export function getQuoteErrorMessage(error: QuoteError) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return errorMessages().genericServerError;
|
|
60
|
-
default:
|
|
61
|
-
return '';
|
|
55
|
+
if (error.type === QuoteErrorType.NO_RESULT) {
|
|
56
|
+
return error.diagnosisMessage ?? errorMessages().noResultError.title;
|
|
57
|
+
} else if (error.type === QuoteErrorType.REQUEST_FAILED) {
|
|
58
|
+
return error.diagnosisMessage ?? errorMessages().genericServerError;
|
|
62
59
|
}
|
|
60
|
+
|
|
61
|
+
return '';
|
|
63
62
|
}
|
|
@@ -72,7 +72,7 @@ export function useConfirmSwap(): ConfirmSwap {
|
|
|
72
72
|
const { result } = response;
|
|
73
73
|
|
|
74
74
|
if (!result) {
|
|
75
|
-
throw new Error('Error fetching updated
|
|
75
|
+
throw new Error(response.error ?? 'Error fetching updated quote');
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
throwErrorIfResponseIsNotValid({
|
package/src/types/quote.ts
CHANGED
|
@@ -36,7 +36,10 @@ export type InsufficientSlippageError = {
|
|
|
36
36
|
minRequiredSlippage: string | null;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export type QuoteRequestFailed = {
|
|
39
|
+
export type QuoteRequestFailed = {
|
|
40
|
+
type: QuoteErrorType.REQUEST_FAILED;
|
|
41
|
+
diagnosisMessage?: string;
|
|
42
|
+
};
|
|
40
43
|
export type QuoteRequestCanceled = { type: QuoteErrorType.REQUEST_CANCELED };
|
|
41
44
|
|
|
42
45
|
export type QuoteError =
|