@dubsdotapp/expo 0.2.37 → 0.2.39

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.37",
3
+ "version": "0.2.39",
4
4
  "description": "React Native SDK for the Dubs betting platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -62,8 +62,17 @@ export function useClaim() {
62
62
  setStatus('success');
63
63
  console.log('[useClaim] Complete!');
64
64
  return result;
65
- } catch (err) {
66
- console.error('[useClaim] FAILED:', err);
65
+ } catch (err: any) {
66
+ console.error('[useClaim] ===== CLAIM ERROR DUMP =====');
67
+ console.error('[useClaim] typeof:', typeof err);
68
+ console.error('[useClaim] value:', err);
69
+ console.error('[useClaim] message:', err?.message);
70
+ console.error('[useClaim] name:', err?.name);
71
+ console.error('[useClaim] code:', err?.code);
72
+ console.error('[useClaim] cause:', err?.cause);
73
+ console.error('[useClaim] stack:', err?.stack);
74
+ console.error('[useClaim] JSON:', (() => { try { return JSON.stringify(err, Object.getOwnPropertyNames(err ?? {})); } catch { return 'unstringifiable'; } })());
75
+ console.error('[useClaim] ===== END DUMP =====');
67
76
  const error = err instanceof Error ? err : new Error(String(err));
68
77
  setError(error);
69
78
  setStatus('error');
@@ -21,6 +21,8 @@ export interface ClaimPrizeSheetProps {
21
21
  gameId: string;
22
22
  /** Prize amount in SOL */
23
23
  prizeAmount: number;
24
+ /** When true, shows refund language instead of prize language */
25
+ isRefund?: boolean;
24
26
  /** Callbacks */
25
27
  onSuccess?: (result: ClaimMutationResult) => void;
26
28
  onError?: (error: Error) => void;
@@ -38,6 +40,7 @@ export function ClaimPrizeSheet({
38
40
  onDismiss,
39
41
  gameId,
40
42
  prizeAmount,
43
+ isRefund = false,
41
44
  onSuccess,
42
45
  onError,
43
46
  }: ClaimPrizeSheetProps) {
@@ -148,7 +151,9 @@ export function ClaimPrizeSheet({
148
151
  {/* Header */}
149
152
  <View style={styles.header}>
150
153
  <Text style={[styles.headerTitle, { color: t.text }]}>
151
- {showCelebration ? 'Prize Claimed!' : 'Claim Prize'}
154
+ {showCelebration
155
+ ? (isRefund ? 'Refund Claimed!' : 'Prize Claimed!')
156
+ : (isRefund ? 'Claim Refund' : 'Claim Prize')}
152
157
  </Text>
153
158
  <TouchableOpacity onPress={onDismiss} activeOpacity={0.8}>
154
159
  <Text style={[styles.closeButton, { color: t.textMuted }]}>{'\u2715'}</Text>
@@ -171,7 +176,7 @@ export function ClaimPrizeSheet({
171
176
  +{prizeAmount} SOL
172
177
  </Text>
173
178
  <Text style={[styles.celebrationSubtext, { color: t.textMuted }]}>
174
- Winnings sent to your wallet
179
+ {isRefund ? 'Refund sent to your wallet' : 'Winnings sent to your wallet'}
175
180
  </Text>
176
181
  </Animated.View>
177
182
  )}
@@ -180,7 +185,7 @@ export function ClaimPrizeSheet({
180
185
  {!showCelebration && (
181
186
  <View style={[styles.summaryCard, { backgroundColor: t.surface, borderColor: t.border }]}>
182
187
  <View style={styles.summaryRow}>
183
- <Text style={[styles.summaryLabel, { color: t.textMuted }]}>Prize</Text>
188
+ <Text style={[styles.summaryLabel, { color: t.textMuted }]}>{isRefund ? 'Refund' : 'Prize'}</Text>
184
189
  <Text style={[styles.summaryValue, { color: t.success }]}>
185
190
  {prizeAmount} SOL
186
191
  </Text>
@@ -223,7 +228,7 @@ export function ClaimPrizeSheet({
223
228
  </View>
224
229
  ) : (
225
230
  <Text style={[styles.ctaText, !canClaim && { opacity: 0.5 }]}>
226
- Claim Prize — {prizeAmount} SOL
231
+ {isRefund ? 'Claim Refund' : 'Claim Prize'} — {prizeAmount} SOL
227
232
  </Text>
228
233
  )}
229
234
  </TouchableOpacity>
@@ -152,15 +152,30 @@ export class MwaWalletAdapter implements WalletAdapter {
152
152
  async signAndSendTransaction(transaction: Transaction): Promise<string> {
153
153
  if (!this._connected) throw new Error('Wallet not connected');
154
154
 
155
- const signature = await this.transact(async (wallet) => {
156
- const reauth = await wallet.reauthorize({ auth_token: this._authToken });
157
- this.applyAuthResult(reauth);
158
-
159
- const result = await wallet.signAndSendTransactions({
160
- transactions: [transaction],
155
+ let signature: any;
156
+ try {
157
+ signature = await this.transact(async (wallet) => {
158
+ const reauth = await wallet.reauthorize({ auth_token: this._authToken });
159
+ this.applyAuthResult(reauth);
160
+
161
+ const result = await wallet.signAndSendTransactions({
162
+ transactions: [transaction],
163
+ });
164
+ return result[0];
161
165
  });
162
- return result[0];
163
- });
166
+ } catch (err: any) {
167
+ console.error('[Dubs:MWA] ===== signAndSendTransaction ERROR DUMP =====');
168
+ console.error('[Dubs:MWA] typeof:', typeof err);
169
+ console.error('[Dubs:MWA] value:', err);
170
+ console.error('[Dubs:MWA] message:', err?.message);
171
+ console.error('[Dubs:MWA] name:', err?.name);
172
+ console.error('[Dubs:MWA] code:', err?.code);
173
+ console.error('[Dubs:MWA] cause:', err?.cause);
174
+ console.error('[Dubs:MWA] stack:', err?.stack);
175
+ console.error('[Dubs:MWA] JSON:', (() => { try { return JSON.stringify(err, Object.getOwnPropertyNames(err ?? {})); } catch { return 'unstringifiable'; } })());
176
+ console.error('[Dubs:MWA] ===== END DUMP =====');
177
+ throw err;
178
+ }
164
179
 
165
180
  // MWA returns Uint8Array signature — convert to base58 string
166
181
  if (signature instanceof Uint8Array) {