@medialane/ui 0.163.0 → 0.165.0
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/components/activities-feed.cjs +211 -0
- package/dist/components/activities-feed.cjs.map +1 -0
- package/dist/components/activities-feed.d.cts +9 -0
- package/dist/components/activities-feed.d.ts +9 -0
- package/dist/components/activities-feed.js +177 -0
- package/dist/components/activities-feed.js.map +1 -0
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/describe-error.cjs +130 -0
- package/dist/utils/describe-error.cjs.map +1 -0
- package/dist/utils/describe-error.d.cts +15 -0
- package/dist/utils/describe-error.d.ts +15 -0
- package/dist/utils/describe-error.js +107 -0
- package/dist/utils/describe-error.js.map +1 -0
- package/dist/utils/wallet-error.cjs +2 -82
- package/dist/utils/wallet-error.cjs.map +1 -1
- package/dist/utils/wallet-error.d.cts +2 -8
- package/dist/utils/wallet-error.d.ts +2 -8
- package/dist/utils/wallet-error.js +1 -81
- package/dist/utils/wallet-error.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/describe-error.ts"],"sourcesContent":["import { MedialaneApiError, PasskeyCancelledError } from \"@medialane/sdk\";\nimport {\n WrongNetworkError,\n isBareExecuteFailure,\n isUserRejectedRequest,\n collectErrorText,\n} from \"./wallet-error.js\";\n\nexport const NOT_SUBMITTED = \"Request not completed. Nothing was submitted.\";\nexport const GENERIC = \"Something went wrong. Please try again.\";\nexport const NETWORK_BUSY =\n \"The network is busy right now. Nothing was submitted. Please try again in a moment.\";\n\nexport interface ErrorNotice {\n title: string;\n message: string;\n description?: string;\n isUserRejection: boolean;\n}\n\nexport class UserFacingError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UserFacingError\";\n }\n}\n\nfunction isTransientStatus(status: number): boolean {\n return status === 408 || status === 429 || status >= 500;\n}\n\nfunction isTransientNetworkError(text: string): boolean {\n return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(\n text,\n );\n}\n\nexport function describeError(error: unknown, fallback?: string): ErrorNotice {\n if (error instanceof PasskeyCancelledError) {\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: \"Your device did not confirm this request. Nothing was submitted. Try again when you are ready.\",\n isUserRejection: true,\n };\n }\n\n if (isBareExecuteFailure(error)) {\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: \"Your wallet didn't complete this request. This usually means you closed or declined it, your wallet needs extra verification (like 2FA) before it can sign, or your wallet hit a temporary network hiccup. Nothing was submitted. Try again in a moment.\",\n isUserRejection: true,\n };\n }\n\n if (isUserRejectedRequest(error)) {\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: \"Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign. Nothing was submitted.\",\n isUserRejection: true,\n };\n }\n\n if (error instanceof WrongNetworkError) {\n return {\n title: \"Wrong network\",\n message: \"Your wallet is connected to the wrong network. Nothing was submitted.\",\n description: \"Switch your wallet to Starknet Mainnet, then try again.\",\n isUserRejection: false,\n };\n }\n\n if (error instanceof UserFacingError) {\n return { title: \"Something went wrong\", message: error.message, isUserRejection: false };\n }\n\n if (error instanceof MedialaneApiError) {\n if (error.isAuthored) {\n return { title: \"Something went wrong\", message: error.message, isUserRejection: false };\n }\n if (isTransientStatus(error.status)) {\n return { title: \"Network busy\", message: NETWORK_BUSY, isUserRejection: false };\n }\n return { title: \"Something went wrong\", message: fallback ?? GENERIC, isUserRejection: false };\n }\n\n const raw = collectErrorText(error);\n\n if (isTransientNetworkError(raw)) {\n return { title: \"Network busy\", message: NETWORK_BUSY, isUserRejection: false };\n }\n\n const lower = raw.toLowerCase();\n if (lower.includes(\"insufficient\") && /balance|allowance|funds/.test(lower)) {\n return {\n title: \"Insufficient balance\",\n message: \"You don't have enough balance to complete this transaction.\",\n isUserRejection: false,\n };\n }\n\n const stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack.toLowerCase() : \"\";\n if (lower.includes(\"validation failure\") && (lower.includes(\"jscontrollererror\") || stack.includes(\"jscontrollererror\"))) {\n return {\n title: \"Not enough gas\",\n message: \"Your wallet doesn't have enough STRK (or ETH) to pay for this transaction's gas fee.\",\n description: \"Add funds to your wallet, then try again.\",\n isUserRejection: false,\n };\n }\n\n if (/unknown_error/i.test(raw) || (typeof error === \"object\" && error !== null && (error as { code?: unknown }).code === 163)) {\n return {\n title: \"Something went wrong\",\n message: \"Your wallet couldn't complete this transaction. Nothing was submitted. Try again, or try a different wallet or device if it keeps happening.\",\n isUserRejection: false,\n };\n }\n\n return { title: \"Something went wrong\", message: fallback ?? GENERIC, isUserRejection: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAyD;AACzD,0BAKO;AAEA,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,eACX;AASK,MAAM,wBAAwB,MAAM;AAAA,EACzC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,kBAAkB,QAAyB;AAClD,SAAO,WAAW,OAAO,WAAW,OAAO,UAAU;AACvD;AAEA,SAAS,wBAAwB,MAAuB;AACtD,SAAO,qMAAqM;AAAA,IAC1M;AAAA,EACF;AACF;AAEO,SAAS,cAAc,OAAgB,UAAgC;AAC5E,MAAI,iBAAiB,kCAAuB;AAC1C,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AAAA,EACF;AAE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G,MAAI,MAAM,SAAS,oBAAoB,MAAM,MAAM,SAAS,mBAAmB,KAAK,MAAM,SAAS,mBAAmB,IAAI;AACxH,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,iBAAiB,KAAK,GAAG,KAAM,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,KAAM;AAC7H,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,wBAAwB,SAAS,YAAY,SAAS,iBAAiB,MAAM;AAC/F;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const NOT_SUBMITTED = "Request not completed. Nothing was submitted.";
|
|
2
|
+
declare const GENERIC = "Something went wrong. Please try again.";
|
|
3
|
+
declare const NETWORK_BUSY = "The network is busy right now. Nothing was submitted. Please try again in a moment.";
|
|
4
|
+
interface ErrorNotice {
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
isUserRejection: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare class UserFacingError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
declare function describeError(error: unknown, fallback?: string): ErrorNotice;
|
|
14
|
+
|
|
15
|
+
export { type ErrorNotice, GENERIC, NETWORK_BUSY, NOT_SUBMITTED, UserFacingError, describeError };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const NOT_SUBMITTED = "Request not completed. Nothing was submitted.";
|
|
2
|
+
declare const GENERIC = "Something went wrong. Please try again.";
|
|
3
|
+
declare const NETWORK_BUSY = "The network is busy right now. Nothing was submitted. Please try again in a moment.";
|
|
4
|
+
interface ErrorNotice {
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
isUserRejection: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare class UserFacingError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
declare function describeError(error: unknown, fallback?: string): ErrorNotice;
|
|
14
|
+
|
|
15
|
+
export { type ErrorNotice, GENERIC, NETWORK_BUSY, NOT_SUBMITTED, UserFacingError, describeError };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { MedialaneApiError, PasskeyCancelledError } from "@medialane/sdk";
|
|
2
|
+
import {
|
|
3
|
+
WrongNetworkError,
|
|
4
|
+
isBareExecuteFailure,
|
|
5
|
+
isUserRejectedRequest,
|
|
6
|
+
collectErrorText
|
|
7
|
+
} from "./wallet-error.js";
|
|
8
|
+
const NOT_SUBMITTED = "Request not completed. Nothing was submitted.";
|
|
9
|
+
const GENERIC = "Something went wrong. Please try again.";
|
|
10
|
+
const NETWORK_BUSY = "The network is busy right now. Nothing was submitted. Please try again in a moment.";
|
|
11
|
+
class UserFacingError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "UserFacingError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function isTransientStatus(status) {
|
|
18
|
+
return status === 408 || status === 429 || status >= 500;
|
|
19
|
+
}
|
|
20
|
+
function isTransientNetworkError(text) {
|
|
21
|
+
return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(
|
|
22
|
+
text
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function describeError(error, fallback) {
|
|
26
|
+
if (error instanceof PasskeyCancelledError) {
|
|
27
|
+
return {
|
|
28
|
+
title: "Request not completed",
|
|
29
|
+
message: NOT_SUBMITTED,
|
|
30
|
+
description: "Your device did not confirm this request. Nothing was submitted. Try again when you are ready.",
|
|
31
|
+
isUserRejection: true
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (isBareExecuteFailure(error)) {
|
|
35
|
+
return {
|
|
36
|
+
title: "Request not completed",
|
|
37
|
+
message: NOT_SUBMITTED,
|
|
38
|
+
description: "Your wallet didn't complete this request. This usually means you closed or declined it, your wallet needs extra verification (like 2FA) before it can sign, or your wallet hit a temporary network hiccup. Nothing was submitted. Try again in a moment.",
|
|
39
|
+
isUserRejection: true
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (isUserRejectedRequest(error)) {
|
|
43
|
+
return {
|
|
44
|
+
title: "Request not completed",
|
|
45
|
+
message: NOT_SUBMITTED,
|
|
46
|
+
description: "Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign. Nothing was submitted.",
|
|
47
|
+
isUserRejection: true
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (error instanceof WrongNetworkError) {
|
|
51
|
+
return {
|
|
52
|
+
title: "Wrong network",
|
|
53
|
+
message: "Your wallet is connected to the wrong network. Nothing was submitted.",
|
|
54
|
+
description: "Switch your wallet to Starknet Mainnet, then try again.",
|
|
55
|
+
isUserRejection: false
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (error instanceof UserFacingError) {
|
|
59
|
+
return { title: "Something went wrong", message: error.message, isUserRejection: false };
|
|
60
|
+
}
|
|
61
|
+
if (error instanceof MedialaneApiError) {
|
|
62
|
+
if (error.isAuthored) {
|
|
63
|
+
return { title: "Something went wrong", message: error.message, isUserRejection: false };
|
|
64
|
+
}
|
|
65
|
+
if (isTransientStatus(error.status)) {
|
|
66
|
+
return { title: "Network busy", message: NETWORK_BUSY, isUserRejection: false };
|
|
67
|
+
}
|
|
68
|
+
return { title: "Something went wrong", message: fallback ?? GENERIC, isUserRejection: false };
|
|
69
|
+
}
|
|
70
|
+
const raw = collectErrorText(error);
|
|
71
|
+
if (isTransientNetworkError(raw)) {
|
|
72
|
+
return { title: "Network busy", message: NETWORK_BUSY, isUserRejection: false };
|
|
73
|
+
}
|
|
74
|
+
const lower = raw.toLowerCase();
|
|
75
|
+
if (lower.includes("insufficient") && /balance|allowance|funds/.test(lower)) {
|
|
76
|
+
return {
|
|
77
|
+
title: "Insufficient balance",
|
|
78
|
+
message: "You don't have enough balance to complete this transaction.",
|
|
79
|
+
isUserRejection: false
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const stack = error instanceof Error && typeof error.stack === "string" ? error.stack.toLowerCase() : "";
|
|
83
|
+
if (lower.includes("validation failure") && (lower.includes("jscontrollererror") || stack.includes("jscontrollererror"))) {
|
|
84
|
+
return {
|
|
85
|
+
title: "Not enough gas",
|
|
86
|
+
message: "Your wallet doesn't have enough STRK (or ETH) to pay for this transaction's gas fee.",
|
|
87
|
+
description: "Add funds to your wallet, then try again.",
|
|
88
|
+
isUserRejection: false
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (/unknown_error/i.test(raw) || typeof error === "object" && error !== null && error.code === 163) {
|
|
92
|
+
return {
|
|
93
|
+
title: "Something went wrong",
|
|
94
|
+
message: "Your wallet couldn't complete this transaction. Nothing was submitted. Try again, or try a different wallet or device if it keeps happening.",
|
|
95
|
+
isUserRejection: false
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return { title: "Something went wrong", message: fallback ?? GENERIC, isUserRejection: false };
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
GENERIC,
|
|
102
|
+
NETWORK_BUSY,
|
|
103
|
+
NOT_SUBMITTED,
|
|
104
|
+
UserFacingError,
|
|
105
|
+
describeError
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=describe-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/describe-error.ts"],"sourcesContent":["import { MedialaneApiError, PasskeyCancelledError } from \"@medialane/sdk\";\nimport {\n WrongNetworkError,\n isBareExecuteFailure,\n isUserRejectedRequest,\n collectErrorText,\n} from \"./wallet-error.js\";\n\nexport const NOT_SUBMITTED = \"Request not completed. Nothing was submitted.\";\nexport const GENERIC = \"Something went wrong. Please try again.\";\nexport const NETWORK_BUSY =\n \"The network is busy right now. Nothing was submitted. Please try again in a moment.\";\n\nexport interface ErrorNotice {\n title: string;\n message: string;\n description?: string;\n isUserRejection: boolean;\n}\n\nexport class UserFacingError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UserFacingError\";\n }\n}\n\nfunction isTransientStatus(status: number): boolean {\n return status === 408 || status === 429 || status >= 500;\n}\n\nfunction isTransientNetworkError(text: string): boolean {\n return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(\n text,\n );\n}\n\nexport function describeError(error: unknown, fallback?: string): ErrorNotice {\n if (error instanceof PasskeyCancelledError) {\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: \"Your device did not confirm this request. Nothing was submitted. Try again when you are ready.\",\n isUserRejection: true,\n };\n }\n\n if (isBareExecuteFailure(error)) {\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: \"Your wallet didn't complete this request. This usually means you closed or declined it, your wallet needs extra verification (like 2FA) before it can sign, or your wallet hit a temporary network hiccup. Nothing was submitted. Try again in a moment.\",\n isUserRejection: true,\n };\n }\n\n if (isUserRejectedRequest(error)) {\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: \"Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign. Nothing was submitted.\",\n isUserRejection: true,\n };\n }\n\n if (error instanceof WrongNetworkError) {\n return {\n title: \"Wrong network\",\n message: \"Your wallet is connected to the wrong network. Nothing was submitted.\",\n description: \"Switch your wallet to Starknet Mainnet, then try again.\",\n isUserRejection: false,\n };\n }\n\n if (error instanceof UserFacingError) {\n return { title: \"Something went wrong\", message: error.message, isUserRejection: false };\n }\n\n if (error instanceof MedialaneApiError) {\n if (error.isAuthored) {\n return { title: \"Something went wrong\", message: error.message, isUserRejection: false };\n }\n if (isTransientStatus(error.status)) {\n return { title: \"Network busy\", message: NETWORK_BUSY, isUserRejection: false };\n }\n return { title: \"Something went wrong\", message: fallback ?? GENERIC, isUserRejection: false };\n }\n\n const raw = collectErrorText(error);\n\n if (isTransientNetworkError(raw)) {\n return { title: \"Network busy\", message: NETWORK_BUSY, isUserRejection: false };\n }\n\n const lower = raw.toLowerCase();\n if (lower.includes(\"insufficient\") && /balance|allowance|funds/.test(lower)) {\n return {\n title: \"Insufficient balance\",\n message: \"You don't have enough balance to complete this transaction.\",\n isUserRejection: false,\n };\n }\n\n const stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack.toLowerCase() : \"\";\n if (lower.includes(\"validation failure\") && (lower.includes(\"jscontrollererror\") || stack.includes(\"jscontrollererror\"))) {\n return {\n title: \"Not enough gas\",\n message: \"Your wallet doesn't have enough STRK (or ETH) to pay for this transaction's gas fee.\",\n description: \"Add funds to your wallet, then try again.\",\n isUserRejection: false,\n };\n }\n\n if (/unknown_error/i.test(raw) || (typeof error === \"object\" && error !== null && (error as { code?: unknown }).code === 163)) {\n return {\n title: \"Something went wrong\",\n message: \"Your wallet couldn't complete this transaction. Nothing was submitted. Try again, or try a different wallet or device if it keeps happening.\",\n isUserRejection: false,\n };\n }\n\n return { title: \"Something went wrong\", message: fallback ?? GENERIC, isUserRejection: false };\n}\n"],"mappings":"AAAA,SAAS,mBAAmB,6BAA6B;AACzD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,eACX;AASK,MAAM,wBAAwB,MAAM;AAAA,EACzC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,kBAAkB,QAAyB;AAClD,SAAO,WAAW,OAAO,WAAW,OAAO,UAAU;AACvD;AAEA,SAAS,wBAAwB,MAAuB;AACtD,SAAO,qMAAqM;AAAA,IAC1M;AAAA,EACF;AACF;A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3E,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,QAAM,QAAQ,iBAAiB,SAAS,OAAO,MAAM,UAAU,WAAW,MAAM,MAAM,YAAY,IAAI;AACtG,MAAI,MAAM,SAAS,oBAAoB,MAAM,MAAM,SAAS,mBAAmB,KAAK,MAAM,SAAS,mBAAmB,IAAI;AACxH,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,iBAAiB,KAAK,GAAG,KAAM,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,KAAM;AAC7H,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,wBAAwB,SAAS,YAAY,SAAS,iBAAiB,MAAM;AAC/F;","names":[]}
|
|
@@ -20,7 +20,7 @@ var wallet_error_exports = {};
|
|
|
20
20
|
__export(wallet_error_exports, {
|
|
21
21
|
WrongNetworkError: () => WrongNetworkError,
|
|
22
22
|
assertCorrectNetwork: () => assertCorrectNetwork,
|
|
23
|
-
|
|
23
|
+
collectErrorText: () => collectErrorText,
|
|
24
24
|
isBareExecuteFailure: () => isBareExecuteFailure,
|
|
25
25
|
isUserRejectedRequest: () => isUserRejectedRequest,
|
|
26
26
|
isWrongNetwork: () => isWrongNetwork
|
|
@@ -66,91 +66,11 @@ function isUserRejectedRequest(error) {
|
|
|
66
66
|
const text = collectErrorText(error).toLowerCase();
|
|
67
67
|
return text.includes("user_refused_op") || text.includes("user refused") || text.includes("user rejected") || text.includes("user abort") || text.includes("user denied") || text.includes("request rejected") || text.includes("rejected by user") || text.includes("cancelled") || text.includes("canceled") || isBareExecuteFailure(error);
|
|
68
68
|
}
|
|
69
|
-
function isTransientNetworkError(text) {
|
|
70
|
-
return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed|\b50[234]\b|\b429\b/i.test(
|
|
71
|
-
text
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
function looksTechnical(text) {
|
|
75
|
-
return /rpc:|jsonrpc|starknet_call|entry_point_selector|contract_address|fetchendpoint|errorhandler|at async|baseerror|"code"\s*:\s*-?\d|https?:\/\//i.test(
|
|
76
|
-
text
|
|
77
|
-
) || text.length > 160;
|
|
78
|
-
}
|
|
79
|
-
function getFriendlyWalletError(error) {
|
|
80
|
-
if (isBareExecuteFailure(error)) {
|
|
81
|
-
return {
|
|
82
|
-
title: "Request not completed",
|
|
83
|
-
message: "Request not completed. Nothing was submitted.",
|
|
84
|
-
description: "Your wallet didn't complete this request. This usually means you closed or declined it, your wallet needs extra verification (like 2FA) before it can sign, or your wallet hit a temporary network hiccup. Nothing was submitted. Try again in a moment.",
|
|
85
|
-
isUserRejection: true
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (isUserRejectedRequest(error)) {
|
|
89
|
-
return {
|
|
90
|
-
title: "Request not completed",
|
|
91
|
-
message: "Request not completed. Nothing was submitted.",
|
|
92
|
-
description: "Your wallet didn't complete this request. You may have closed or declined it, or your wallet may require extra verification (like 2FA) before it can sign. Check your wallet for details, then try again.",
|
|
93
|
-
isUserRejection: true
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
if (error instanceof WrongNetworkError) {
|
|
97
|
-
return {
|
|
98
|
-
title: "Wrong network",
|
|
99
|
-
message: "Your wallet is connected to the wrong network. Nothing was submitted.",
|
|
100
|
-
description: "Switch your wallet to Starknet Mainnet, then try again.",
|
|
101
|
-
isUserRejection: false
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
const raw = collectErrorText(error);
|
|
105
|
-
if (isTransientNetworkError(raw)) {
|
|
106
|
-
return {
|
|
107
|
-
title: "Network busy",
|
|
108
|
-
message: "The network is busy right now. Nothing was submitted, and your asset is safe. Please try again in a moment.",
|
|
109
|
-
isUserRejection: false
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
const lower = raw.toLowerCase();
|
|
113
|
-
const stack = error instanceof Error && typeof error.stack === "string" ? error.stack.toLowerCase() : "";
|
|
114
|
-
if (lower.includes("validation failure") && (lower.includes("jscontrollererror") || stack.includes("jscontrollererror"))) {
|
|
115
|
-
return {
|
|
116
|
-
title: "Not enough gas",
|
|
117
|
-
message: "Your wallet doesn't have enough STRK (or ETH) to pay for this transaction's gas fee.",
|
|
118
|
-
description: "Add funds to your wallet, then try again.",
|
|
119
|
-
isUserRejection: false
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
if (lower.includes("insufficient") && (lower.includes("balance") || lower.includes("allowance") || lower.includes("funds"))) {
|
|
123
|
-
return {
|
|
124
|
-
title: "Insufficient balance",
|
|
125
|
-
message: "You don't have enough balance to complete this transaction.",
|
|
126
|
-
isUserRejection: false
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
if (/unknown_error/i.test(raw) || typeof error === "object" && error !== null && error.code === 163) {
|
|
130
|
-
return {
|
|
131
|
-
title: "Something went wrong",
|
|
132
|
-
message: "Your wallet couldn't complete this transaction. Nothing was submitted. Try again, or try a different wallet or device if it keeps happening.",
|
|
133
|
-
isUserRejection: false
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
if (!raw || looksTechnical(raw)) {
|
|
137
|
-
return {
|
|
138
|
-
title: "Something went wrong",
|
|
139
|
-
message: "We couldn't complete that action. Please try again in a moment. If it keeps happening, try a different wallet or refresh the page.",
|
|
140
|
-
isUserRejection: false
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
title: "Something went wrong",
|
|
145
|
-
message: raw,
|
|
146
|
-
isUserRejection: false
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
150
70
|
0 && (module.exports = {
|
|
151
71
|
WrongNetworkError,
|
|
152
72
|
assertCorrectNetwork,
|
|
153
|
-
|
|
73
|
+
collectErrorText,
|
|
154
74
|
isBareExecuteFailure,
|
|
155
75
|
isUserRejectedRequest,
|
|
156
76
|
isWrongNetwork
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/wallet-error.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/wallet-error.ts"],"sourcesContent":["\nexport class WrongNetworkError extends Error {\n constructor() {\n super(\"Your wallet is connected to the wrong network.\");\n this.name = \"WrongNetworkError\";\n }\n}\n\nexport function isWrongNetwork(\n chainId: bigint | string | undefined,\n expectedChainId: string,\n): boolean {\n return chainId != null && BigInt(chainId).toString() !== expectedChainId;\n}\n\nexport function assertCorrectNetwork(\n chainId: bigint | string | undefined,\n expectedChainId: string,\n): void {\n if (isWrongNetwork(chainId, expectedChainId)) {\n throw new WrongNetworkError();\n }\n}\n\nexport function collectErrorText(error: unknown): string {\n if (!error) return \"\";\n if (typeof error === \"string\") return error;\n if (error instanceof Error) return error.message;\n\n if (typeof error === \"object\") {\n const source = error as Record<string, unknown>;\n const parts: string[] = [];\n\n for (const key of [\"message\", \"name\", \"code\", \"shortMessage\"]) {\n const value = source[key];\n if (value !== undefined) parts.push(String(value));\n }\n\n const messages = source.errorMessages;\n if (messages && typeof messages === \"object\") {\n parts.push(...Object.values(messages).map(String));\n }\n\n return parts.join(\" \");\n }\n\n return String(error);\n}\n\nexport function isBareExecuteFailure(error: unknown): boolean {\n return collectErrorText(error).trim().toLowerCase() === \"execute failed\";\n}\n\nexport function isUserRejectedRequest(error: unknown): boolean {\n const text = collectErrorText(error).toLowerCase();\n return (\n text.includes(\"user_refused_op\") ||\n text.includes(\"user refused\") ||\n text.includes(\"user rejected\") ||\n text.includes(\"user abort\") ||\n text.includes(\"user denied\") ||\n text.includes(\"request rejected\") ||\n text.includes(\"rejected by user\") ||\n text.includes(\"cancelled\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AS,cAAc,KAC5B,KAAK,SAAS,eAAe,KAC7B,KAAK,SAAS,YAAY,KAC1B,KAAK,SAAS,aAAa,KAC3B,KAAK,SAAS,kBAAkB,KAChC,KAAK,SAAS,kBAAkB,KAChC,KAAK,SAAS,WAAW,KACzB,KAAK,SAAS,UAAU,KACxB,qBAAqB,KAAK;AAE9B;","names":[]}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
interface FriendlyWalletError {
|
|
2
|
-
title: string;
|
|
3
|
-
message: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
isUserRejection: boolean;
|
|
6
|
-
}
|
|
7
1
|
declare class WrongNetworkError extends Error {
|
|
8
2
|
constructor();
|
|
9
3
|
}
|
|
10
4
|
declare function isWrongNetwork(chainId: bigint | string | undefined, expectedChainId: string): boolean;
|
|
11
5
|
declare function assertCorrectNetwork(chainId: bigint | string | undefined, expectedChainId: string): void;
|
|
6
|
+
declare function collectErrorText(error: unknown): string;
|
|
12
7
|
declare function isBareExecuteFailure(error: unknown): boolean;
|
|
13
8
|
declare function isUserRejectedRequest(error: unknown): boolean;
|
|
14
|
-
declare function getFriendlyWalletError(error: unknown): FriendlyWalletError;
|
|
15
9
|
|
|
16
|
-
export {
|
|
10
|
+
export { WrongNetworkError, assertCorrectNetwork, collectErrorText, isBareExecuteFailure, isUserRejectedRequest, isWrongNetwork };
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
interface FriendlyWalletError {
|
|
2
|
-
title: string;
|
|
3
|
-
message: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
isUserRejection: boolean;
|
|
6
|
-
}
|
|
7
1
|
declare class WrongNetworkError extends Error {
|
|
8
2
|
constructor();
|
|
9
3
|
}
|
|
10
4
|
declare function isWrongNetwork(chainId: bigint | string | undefined, expectedChainId: string): boolean;
|
|
11
5
|
declare function assertCorrectNetwork(chainId: bigint | string | undefined, expectedChainId: string): void;
|
|
6
|
+
declare function collectErrorText(error: unknown): string;
|
|
12
7
|
declare function isBareExecuteFailure(error: unknown): boolean;
|
|
13
8
|
declare function isUserRejectedRequest(error: unknown): boolean;
|
|
14
|
-
declare function getFriendlyWalletError(error: unknown): FriendlyWalletError;
|
|
15
9
|
|
|
16
|
-
export {
|
|
10
|
+
export { WrongNetworkError, assertCorrectNetwork, collectErrorText, isBareExecuteFailure, isUserRejectedRequest, isWrongNetwork };
|
|
@@ -38,90 +38,10 @@ function isUserRejectedRequest(error) {
|
|
|
38
38
|
const text = collectErrorText(error).toLowerCase();
|
|
39
39
|
return text.includes("user_refused_op") || text.includes("user refused") || text.includes("user rejected") || text.includes("user abort") || text.includes("user denied") || text.includes("request rejected") || text.includes("rejected by user") || text.includes("cancelled") || text.includes("canceled") || isBareExecuteFailure(error);
|
|
40
40
|
}
|
|
41
|
-
function isTransientNetworkError(text) {
|
|
42
|
-
return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed|\b50[234]\b|\b429\b/i.test(
|
|
43
|
-
text
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
function looksTechnical(text) {
|
|
47
|
-
return /rpc:|jsonrpc|starknet_call|entry_point_selector|contract_address|fetchendpoint|errorhandler|at async|baseerror|"code"\s*:\s*-?\d|https?:\/\//i.test(
|
|
48
|
-
text
|
|
49
|
-
) || text.length > 160;
|
|
50
|
-
}
|
|
51
|
-
function getFriendlyWalletError(error) {
|
|
52
|
-
if (isBareExecuteFailure(error)) {
|
|
53
|
-
return {
|
|
54
|
-
title: "Request not completed",
|
|
55
|
-
message: "Request not completed. Nothing was submitted.",
|
|
56
|
-
description: "Your wallet didn't complete this request. This usually means you closed or declined it, your wallet needs extra verification (like 2FA) before it can sign, or your wallet hit a temporary network hiccup. Nothing was submitted. Try again in a moment.",
|
|
57
|
-
isUserRejection: true
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (isUserRejectedRequest(error)) {
|
|
61
|
-
return {
|
|
62
|
-
title: "Request not completed",
|
|
63
|
-
message: "Request not completed. Nothing was submitted.",
|
|
64
|
-
description: "Your wallet didn't complete this request. You may have closed or declined it, or your wallet may require extra verification (like 2FA) before it can sign. Check your wallet for details, then try again.",
|
|
65
|
-
isUserRejection: true
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
if (error instanceof WrongNetworkError) {
|
|
69
|
-
return {
|
|
70
|
-
title: "Wrong network",
|
|
71
|
-
message: "Your wallet is connected to the wrong network. Nothing was submitted.",
|
|
72
|
-
description: "Switch your wallet to Starknet Mainnet, then try again.",
|
|
73
|
-
isUserRejection: false
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
const raw = collectErrorText(error);
|
|
77
|
-
if (isTransientNetworkError(raw)) {
|
|
78
|
-
return {
|
|
79
|
-
title: "Network busy",
|
|
80
|
-
message: "The network is busy right now. Nothing was submitted, and your asset is safe. Please try again in a moment.",
|
|
81
|
-
isUserRejection: false
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
const lower = raw.toLowerCase();
|
|
85
|
-
const stack = error instanceof Error && typeof error.stack === "string" ? error.stack.toLowerCase() : "";
|
|
86
|
-
if (lower.includes("validation failure") && (lower.includes("jscontrollererror") || stack.includes("jscontrollererror"))) {
|
|
87
|
-
return {
|
|
88
|
-
title: "Not enough gas",
|
|
89
|
-
message: "Your wallet doesn't have enough STRK (or ETH) to pay for this transaction's gas fee.",
|
|
90
|
-
description: "Add funds to your wallet, then try again.",
|
|
91
|
-
isUserRejection: false
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
if (lower.includes("insufficient") && (lower.includes("balance") || lower.includes("allowance") || lower.includes("funds"))) {
|
|
95
|
-
return {
|
|
96
|
-
title: "Insufficient balance",
|
|
97
|
-
message: "You don't have enough balance to complete this transaction.",
|
|
98
|
-
isUserRejection: false
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (/unknown_error/i.test(raw) || typeof error === "object" && error !== null && error.code === 163) {
|
|
102
|
-
return {
|
|
103
|
-
title: "Something went wrong",
|
|
104
|
-
message: "Your wallet couldn't complete this transaction. Nothing was submitted. Try again, or try a different wallet or device if it keeps happening.",
|
|
105
|
-
isUserRejection: false
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
if (!raw || looksTechnical(raw)) {
|
|
109
|
-
return {
|
|
110
|
-
title: "Something went wrong",
|
|
111
|
-
message: "We couldn't complete that action. Please try again in a moment. If it keeps happening, try a different wallet or refresh the page.",
|
|
112
|
-
isUserRejection: false
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
title: "Something went wrong",
|
|
117
|
-
message: raw,
|
|
118
|
-
isUserRejection: false
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
41
|
export {
|
|
122
42
|
WrongNetworkError,
|
|
123
43
|
assertCorrectNetwork,
|
|
124
|
-
|
|
44
|
+
collectErrorText,
|
|
125
45
|
isBareExecuteFailure,
|
|
126
46
|
isUserRejectedRequest,
|
|
127
47
|
isWrongNetwork
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/wallet-error.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/wallet-error.ts"],"sourcesContent":["\nexport class WrongNetworkError extends Error {\n constructor() {\n super(\"Your wallet is connected to the wrong network.\");\n this.name = \"WrongNetworkError\";\n }\n}\n\nexport function isWrongNetwork(\n chainId: bigint | string | undefined,\n expectedChainId: string,\n): boolean {\n return chainId != null && BigInt(chainId).toString() !== expectedChainId;\n}\n\nexport function assertCorrectNetwork(\n chainId: bigint | string | undefined,\n expectedChainId: string,\n): void {\n if (isWrongNetwork(chainId, expectedChainId)) {\n throw new WrongNetworkError();\n }\n}\n\nexport function collectErrorText(error: unknown): string {\n if (!error) return \"\";\n if (typeof error === \"string\") return error;\n if (error instanceof Error) return error.message;\n\n if (typeof error === \"object\") {\n const source = error as Record<string, unknown>;\n const parts: string[] = [];\n\n for (const key of [\"message\", \"name\", \"code\", \"shortMessage\"]) {\n const value = source[key];\n if (value !== undefined) parts.push(String(value));\n }\n\n const messages = source.errorMessages;\n if (messages && typeof messages === \"object\") {\n parts.push(...Object.values(messages).map(String));\n }\n\n return parts.join(\" \");\n }\n\n return String(error);\n}\n\nexport function isBareExecuteFailure(error: unknown): boolean {\n return collectErrorText(error).trim().toLowerCase() === \"execute failed\";\n}\n\nexport function isUserRejectedRequest(error: unknown): boolean {\n const text = collectErrorText(error).toLowerCase();\n return (\n text.includes(\"user_refused_op\") ||\n text.includes(\"user refused\") ||\n text.includes(\"user rejected\") ||\n text.includes(\"user abort\") ||\n text.includes(\"user denied\") ||\n text.includes(\"request rejected\") ||\n text.includes(\"rejected by user\") ||\n text.includes(\"cancelled\") ||\n text.includes(\"canceled\") ||\n isBareExecuteFailure(error)\n );\n}\n\n\n"],"mappings":"AACO,MAAM,0BAA0B,MAAM;AAAA,EAC3C,cAAc;AACZ,UAAM,gDAAgD;AACtD,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,eACd,SACA,iBACS;AACT,SAAO,WAAW,QAAQ,OAAO,OAAO,EAAE,SAAS,MAAM;AAC3D;AAEO,SAAS,qBACd,SACA,iBACM;AACN,MAAI,eAAe,SAAS,eAAe,GAAG;AAC5C,UAAM,IAAI,kBAAkB;AAAA,EAC9B;AACF;AAEO,SAAS,iBAAiB,OAAwB;AACvD,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,iBAAiB,MAAO,QAAO,MAAM;AAEzC,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,SAAS;AACf,UAAM,QAAkB,CAAC;AAEzB,eAAW,OAAO,CAAC,WAAW,QAAQ,QAAQ,cAAc,GAAG;AAC7D,YAAM,QAAQ,OAAO,GAAG;AACxB,UAAI,UAAU,OAAW,OAAM,KAAK,OAAO,KAAK,CAAC;AAAA,IACnD;AAEA,UAAM,WAAW,OAAO;AACxB,QAAI,YAAY,OAAO,aAAa,UAAU;AAC5C,YAAM,KAAK,GAAG,OAAO,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC;AAAA,IACnD;AAEA,WAAO,MAAM,KAAK,GAAG;AAAA,EACvB;AAEA,SAAO,OAAO,KAAK;AACrB;AAEO,SAAS,qBAAqB,OAAyB;AAC5D,SAAO,iBAAiB,KAAK,EAAE,KAAK,EAAE,YAAY,MAAM;AAC1D;AAEO,SAAS,sBAAsB,OAAyB;AAC7D,QAAM,OAAO,iBAAiB,KAAK,EAAE,YAAY;AACjD,SACE,KAAK,SAAS,iBAAiB,KAC/B,KAAK,SAAS,cAAc,KAC5B,KAAK,SAAS,eAAe,KAC7B,KAAK,SAAS,YAAY,KAC1B,KAAK,SAAS,aAAa,KAC3B,KAAK,SAAS,kBAAkB,KAChC,KAAK,SAAS,kBAAkB,KAChC,KAAK,SAAS,WAAW,KACzB,KAAK,SAAS,UAAU,KACxB,qBAAqB,KAAK;AAE9B;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medialane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.165.0",
|
|
4
4
|
"description": "Shared UI components for Medialane apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"preview": "vite --config preview/vite.config.ts"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@medialane/sdk": ">=0.
|
|
54
|
+
"@medialane/sdk": ">=0.127.0",
|
|
55
55
|
"@radix-ui/react-checkbox": ">=1.1.0",
|
|
56
56
|
"@radix-ui/react-collapsible": ">=1.1.0",
|
|
57
57
|
"@radix-ui/react-dialog": ">=1.1.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"zod": "^3.25.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@medialane/sdk": "0.
|
|
82
|
+
"@medialane/sdk": "0.127.0",
|
|
83
83
|
"@radix-ui/react-checkbox": "^1.3.8",
|
|
84
84
|
"@radix-ui/react-collapsible": "^1.1.17",
|
|
85
85
|
"@radix-ui/react-dialog": "^1.1.20",
|