@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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +50 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useClaim.ts +11 -2
- package/src/ui/game/ClaimPrizeSheet.tsx +9 -4
- package/src/wallet/mwa-adapter.ts +23 -8
package/dist/index.d.mts
CHANGED
|
@@ -964,11 +964,13 @@ interface ClaimPrizeSheetProps {
|
|
|
964
964
|
gameId: string;
|
|
965
965
|
/** Prize amount in SOL */
|
|
966
966
|
prizeAmount: number;
|
|
967
|
+
/** When true, shows refund language instead of prize language */
|
|
968
|
+
isRefund?: boolean;
|
|
967
969
|
/** Callbacks */
|
|
968
970
|
onSuccess?: (result: ClaimMutationResult) => void;
|
|
969
971
|
onError?: (error: Error) => void;
|
|
970
972
|
}
|
|
971
|
-
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
973
|
+
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, isRefund, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
972
974
|
|
|
973
975
|
/**
|
|
974
976
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
package/dist/index.d.ts
CHANGED
|
@@ -964,11 +964,13 @@ interface ClaimPrizeSheetProps {
|
|
|
964
964
|
gameId: string;
|
|
965
965
|
/** Prize amount in SOL */
|
|
966
966
|
prizeAmount: number;
|
|
967
|
+
/** When true, shows refund language instead of prize language */
|
|
968
|
+
isRefund?: boolean;
|
|
967
969
|
/** Callbacks */
|
|
968
970
|
onSuccess?: (result: ClaimMutationResult) => void;
|
|
969
971
|
onError?: (error: Error) => void;
|
|
970
972
|
}
|
|
971
|
-
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
973
|
+
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, isRefund, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
972
974
|
|
|
973
975
|
/**
|
|
974
976
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
package/dist/index.js
CHANGED
|
@@ -685,14 +685,35 @@ var MwaWalletAdapter = class {
|
|
|
685
685
|
}
|
|
686
686
|
async signAndSendTransaction(transaction) {
|
|
687
687
|
if (!this._connected) throw new Error("Wallet not connected");
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
this.
|
|
691
|
-
|
|
692
|
-
|
|
688
|
+
let signature;
|
|
689
|
+
try {
|
|
690
|
+
signature = await this.transact(async (wallet) => {
|
|
691
|
+
const reauth = await wallet.reauthorize({ auth_token: this._authToken });
|
|
692
|
+
this.applyAuthResult(reauth);
|
|
693
|
+
const result = await wallet.signAndSendTransactions({
|
|
694
|
+
transactions: [transaction]
|
|
695
|
+
});
|
|
696
|
+
return result[0];
|
|
693
697
|
});
|
|
694
|
-
|
|
695
|
-
|
|
698
|
+
} catch (err) {
|
|
699
|
+
console.error("[Dubs:MWA] ===== signAndSendTransaction ERROR DUMP =====");
|
|
700
|
+
console.error("[Dubs:MWA] typeof:", typeof err);
|
|
701
|
+
console.error("[Dubs:MWA] value:", err);
|
|
702
|
+
console.error("[Dubs:MWA] message:", err?.message);
|
|
703
|
+
console.error("[Dubs:MWA] name:", err?.name);
|
|
704
|
+
console.error("[Dubs:MWA] code:", err?.code);
|
|
705
|
+
console.error("[Dubs:MWA] cause:", err?.cause);
|
|
706
|
+
console.error("[Dubs:MWA] stack:", err?.stack);
|
|
707
|
+
console.error("[Dubs:MWA] JSON:", (() => {
|
|
708
|
+
try {
|
|
709
|
+
return JSON.stringify(err, Object.getOwnPropertyNames(err ?? {}));
|
|
710
|
+
} catch {
|
|
711
|
+
return "unstringifiable";
|
|
712
|
+
}
|
|
713
|
+
})());
|
|
714
|
+
console.error("[Dubs:MWA] ===== END DUMP =====");
|
|
715
|
+
throw err;
|
|
716
|
+
}
|
|
696
717
|
if (signature instanceof Uint8Array) {
|
|
697
718
|
return new import_web3.PublicKey(signature).toBase58();
|
|
698
719
|
}
|
|
@@ -1878,7 +1899,22 @@ function useClaim() {
|
|
|
1878
1899
|
console.log("[useClaim] Complete!");
|
|
1879
1900
|
return result;
|
|
1880
1901
|
} catch (err) {
|
|
1881
|
-
console.error("[useClaim]
|
|
1902
|
+
console.error("[useClaim] ===== CLAIM ERROR DUMP =====");
|
|
1903
|
+
console.error("[useClaim] typeof:", typeof err);
|
|
1904
|
+
console.error("[useClaim] value:", err);
|
|
1905
|
+
console.error("[useClaim] message:", err?.message);
|
|
1906
|
+
console.error("[useClaim] name:", err?.name);
|
|
1907
|
+
console.error("[useClaim] code:", err?.code);
|
|
1908
|
+
console.error("[useClaim] cause:", err?.cause);
|
|
1909
|
+
console.error("[useClaim] stack:", err?.stack);
|
|
1910
|
+
console.error("[useClaim] JSON:", (() => {
|
|
1911
|
+
try {
|
|
1912
|
+
return JSON.stringify(err, Object.getOwnPropertyNames(err ?? {}));
|
|
1913
|
+
} catch {
|
|
1914
|
+
return "unstringifiable";
|
|
1915
|
+
}
|
|
1916
|
+
})());
|
|
1917
|
+
console.error("[useClaim] ===== END DUMP =====");
|
|
1882
1918
|
const error2 = err instanceof Error ? err : new Error(String(err));
|
|
1883
1919
|
setError(error2);
|
|
1884
1920
|
setStatus("error");
|
|
@@ -4300,6 +4336,7 @@ function ClaimPrizeSheet({
|
|
|
4300
4336
|
onDismiss,
|
|
4301
4337
|
gameId,
|
|
4302
4338
|
prizeAmount,
|
|
4339
|
+
isRefund = false,
|
|
4303
4340
|
onSuccess,
|
|
4304
4341
|
onError
|
|
4305
4342
|
}) {
|
|
@@ -4384,7 +4421,7 @@ function ClaimPrizeSheet({
|
|
|
4384
4421
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: styles11.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: [styles11.sheet, { backgroundColor: t.background }], children: [
|
|
4385
4422
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: styles11.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: [styles11.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4386
4423
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: styles11.header, children: [
|
|
4387
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.headerTitle, { color: t.text }], children: showCelebration ? "Prize Claimed!" : "Claim Prize" }),
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.headerTitle, { color: t.text }], children: showCelebration ? isRefund ? "Refund Claimed!" : "Prize Claimed!" : isRefund ? "Claim Refund" : "Claim Prize" }),
|
|
4388
4425
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4389
4426
|
] }),
|
|
4390
4427
|
showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -4404,13 +4441,13 @@ function ClaimPrizeSheet({
|
|
|
4404
4441
|
prizeAmount,
|
|
4405
4442
|
" SOL"
|
|
4406
4443
|
] }),
|
|
4407
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.celebrationSubtext, { color: t.textMuted }], children: "Winnings sent to your wallet" })
|
|
4444
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
4408
4445
|
]
|
|
4409
4446
|
}
|
|
4410
4447
|
),
|
|
4411
4448
|
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: [styles11.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4412
4449
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: styles11.summaryRow, children: [
|
|
4413
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Prize" }),
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.summaryLabel, { color: t.textMuted }], children: isRefund ? "Refund" : "Prize" }),
|
|
4414
4451
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.Text, { style: [styles11.summaryValue, { color: t.success }], children: [
|
|
4415
4452
|
prizeAmount,
|
|
4416
4453
|
" SOL"
|
|
@@ -4448,7 +4485,8 @@ function ClaimPrizeSheet({
|
|
|
4448
4485
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
4449
4486
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: styles11.ctaText, children: statusLabel })
|
|
4450
4487
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.Text, { style: [styles11.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
4451
|
-
"Claim
|
|
4488
|
+
isRefund ? "Claim Refund" : "Claim Prize",
|
|
4489
|
+
" \u2014 ",
|
|
4452
4490
|
prizeAmount,
|
|
4453
4491
|
" SOL"
|
|
4454
4492
|
] })
|