@dubsdotapp/expo 0.2.34 → 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 +29 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useClaim.ts +30 -5
package/package.json
CHANGED
package/src/hooks/useClaim.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
import { useDubs } from '../provider';
|
|
3
3
|
import { signAndSendBase64Transaction } from '../utils/transaction';
|
|
4
|
-
import { parseSolanaError } from '../errors';
|
|
5
4
|
import type { BuildClaimParams, MutationStatus } from '../types';
|
|
6
5
|
|
|
7
6
|
export interface ClaimMutationResult {
|
|
@@ -64,10 +63,36 @@ export function useClaim() {
|
|
|
64
63
|
console.log('[useClaim] Complete!');
|
|
65
64
|
return result;
|
|
66
65
|
} catch (err) {
|
|
67
|
-
console.error('[useClaim] FAILED:', err);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
console.error('[useClaim] FAILED — raw error:', err);
|
|
67
|
+
console.log('[useClaim] Error type:', typeof err);
|
|
68
|
+
console.log('[useClaim] Error constructor:', (err as any)?.constructor?.name);
|
|
69
|
+
console.log('[useClaim] Error message:', (err as any)?.message);
|
|
70
|
+
console.log('[useClaim] Error keys:', err && typeof err === 'object' ? Object.keys(err) : 'N/A');
|
|
71
|
+
try { console.log('[useClaim] JSON.stringify(err):', JSON.stringify(err)); } catch { console.log('[useClaim] JSON.stringify failed'); }
|
|
72
|
+
|
|
73
|
+
// Serialize the full error — preserve all properties, not just .message
|
|
74
|
+
let rawError: unknown;
|
|
75
|
+
if (err instanceof Error) {
|
|
76
|
+
const extras: Record<string, unknown> = {};
|
|
77
|
+
for (const key of Object.keys(err)) {
|
|
78
|
+
extras[key] = (err as any)[key];
|
|
79
|
+
}
|
|
80
|
+
rawError = { message: err.message, ...extras };
|
|
81
|
+
} else {
|
|
82
|
+
rawError = err;
|
|
83
|
+
}
|
|
84
|
+
console.log('[useClaim] Serialized for /errors/parse:', JSON.stringify(rawError));
|
|
85
|
+
|
|
86
|
+
// Send the raw error to the server for proper parsing
|
|
87
|
+
let parsed: { code: string; message: string };
|
|
88
|
+
try {
|
|
89
|
+
parsed = await client.parseError(rawError);
|
|
90
|
+
console.log('[useClaim] Server parsed result:', JSON.stringify(parsed));
|
|
91
|
+
} catch (parseErr) {
|
|
92
|
+
console.error('[useClaim] /errors/parse call failed:', parseErr);
|
|
93
|
+
parsed = { code: 'transaction_failed', message: err instanceof Error ? err.message : String(err) };
|
|
94
|
+
}
|
|
95
|
+
|
|
71
96
|
const error = new Error(parsed.message);
|
|
72
97
|
(error as any).code = parsed.code;
|
|
73
98
|
setError(error);
|