@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dubsdotapp/expo",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "React Native SDK for the Dubs betting platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -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
- // Parse Solana program errors into human-readable messages
69
- const raw = err instanceof Error ? err.message : String(err);
70
- const parsed = parseSolanaError(raw);
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);