@dubsdotapp/expo 0.2.35 → 0.2.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/index.js +27 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +0 -13
- package/src/hooks/useClaim.ts +26 -24
package/dist/index.js
CHANGED
|
@@ -151,12 +151,6 @@ var SOLANA_PROGRAM_ERRORS = {
|
|
|
151
151
|
6048: { code: "no_survivors_to_distribute", message: "No survivors to distribute winnings to" },
|
|
152
152
|
6049: { code: "too_many_survivors", message: "Too many survivors (max 50 per batch)" }
|
|
153
153
|
};
|
|
154
|
-
var WALLET_ERROR_PATTERNS = [
|
|
155
|
-
{ pattern: /CancellationException/i, error: { code: "transaction_rejected", message: "Transaction was rejected by the wallet" } },
|
|
156
|
-
{ pattern: /declined/i, error: { code: "user_declined", message: "Transaction was declined" } },
|
|
157
|
-
{ pattern: /timeout/i, error: { code: "transaction_timeout", message: "Transaction timed out" } },
|
|
158
|
-
{ pattern: /not connected/i, error: { code: "wallet_not_connected", message: "Wallet is not connected" } }
|
|
159
|
-
];
|
|
160
154
|
var SOLANA_BUILTIN_ERRORS = {
|
|
161
155
|
0: { code: "generic_error", message: "Generic instruction error" },
|
|
162
156
|
1: { code: "invalid_argument", message: "Invalid argument passed to program" },
|
|
@@ -173,9 +167,6 @@ function parseSolanaError(err) {
|
|
|
173
167
|
if (!err) return { code: "unknown_error", message: "Unknown transaction error" };
|
|
174
168
|
let parsed = err;
|
|
175
169
|
if (typeof parsed === "string") {
|
|
176
|
-
for (const { pattern, error } of WALLET_ERROR_PATTERNS) {
|
|
177
|
-
if (pattern.test(parsed)) return error;
|
|
178
|
-
}
|
|
179
170
|
try {
|
|
180
171
|
const jsonMatch = parsed.match(/\{.*\}/s);
|
|
181
172
|
if (jsonMatch) parsed = JSON.parse(jsonMatch[0]);
|
|
@@ -1887,25 +1878,34 @@ function useClaim() {
|
|
|
1887
1878
|
console.log("[useClaim] Complete!");
|
|
1888
1879
|
return result;
|
|
1889
1880
|
} catch (err) {
|
|
1890
|
-
console.error("[useClaim] FAILED:", err);
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1906
|
-
} catch (checkErr) {
|
|
1907
|
-
if (checkErr?.code === "already_claimed") throw checkErr;
|
|
1881
|
+
console.error("[useClaim] FAILED \u2014 raw error:", err);
|
|
1882
|
+
console.log("[useClaim] Error type:", typeof err);
|
|
1883
|
+
console.log("[useClaim] Error constructor:", err?.constructor?.name);
|
|
1884
|
+
console.log("[useClaim] Error message:", err?.message);
|
|
1885
|
+
console.log("[useClaim] Error keys:", err && typeof err === "object" ? Object.keys(err) : "N/A");
|
|
1886
|
+
try {
|
|
1887
|
+
console.log("[useClaim] JSON.stringify(err):", JSON.stringify(err));
|
|
1888
|
+
} catch {
|
|
1889
|
+
console.log("[useClaim] JSON.stringify failed");
|
|
1890
|
+
}
|
|
1891
|
+
let rawError;
|
|
1892
|
+
if (err instanceof Error) {
|
|
1893
|
+
const extras = {};
|
|
1894
|
+
for (const key of Object.keys(err)) {
|
|
1895
|
+
extras[key] = err[key];
|
|
1908
1896
|
}
|
|
1897
|
+
rawError = { message: err.message, ...extras };
|
|
1898
|
+
} else {
|
|
1899
|
+
rawError = err;
|
|
1900
|
+
}
|
|
1901
|
+
console.log("[useClaim] Serialized for /errors/parse:", JSON.stringify(rawError));
|
|
1902
|
+
let parsed;
|
|
1903
|
+
try {
|
|
1904
|
+
parsed = await client.parseError(rawError);
|
|
1905
|
+
console.log("[useClaim] Server parsed result:", JSON.stringify(parsed));
|
|
1906
|
+
} catch (parseErr) {
|
|
1907
|
+
console.error("[useClaim] /errors/parse call failed:", parseErr);
|
|
1908
|
+
parsed = { code: "transaction_failed", message: err instanceof Error ? err.message : String(err) };
|
|
1909
1909
|
}
|
|
1910
1910
|
const error2 = new Error(parsed.message);
|
|
1911
1911
|
error2.code = parsed.code;
|