@b3dotfun/sdk 0.1.70-alpha.1 → 0.1.70

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.
Files changed (116) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
  3. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
  5. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
  7. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +9 -3
  8. package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
  9. package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
  10. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
  11. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
  12. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
  13. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  14. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
  15. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
  16. package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
  17. package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
  18. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  19. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
  20. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
  21. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
  22. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  23. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +2 -2
  24. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  25. package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
  26. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
  27. package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +13 -3
  28. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
  29. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
  30. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -17
  31. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -3
  32. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +5 -6
  33. package/dist/cjs/global-account/react/components/index.d.ts +0 -1
  34. package/dist/cjs/global-account/react/components/index.js +3 -5
  35. package/dist/cjs/global-account/react/hooks/useBetterAuth.js +13 -14
  36. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +28 -0
  37. package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  38. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
  39. package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  40. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
  41. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
  42. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
  43. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +10 -4
  44. package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
  45. package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
  46. package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
  47. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
  48. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
  49. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  50. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
  51. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
  52. package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
  53. package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
  54. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  55. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
  56. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
  57. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
  58. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  59. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +2 -2
  60. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  61. package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
  62. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
  63. package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +14 -4
  64. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
  65. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
  66. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -17
  67. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -3
  68. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +3 -4
  69. package/dist/esm/global-account/react/components/index.d.ts +0 -1
  70. package/dist/esm/global-account/react/components/index.js +0 -1
  71. package/dist/esm/global-account/react/hooks/useBetterAuth.js +6 -7
  72. package/dist/esm/global-account/react/stores/useModalStore.d.ts +28 -0
  73. package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  74. package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  75. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
  76. package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
  77. package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
  78. package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
  79. package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
  80. package/dist/types/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
  81. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  82. package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
  83. package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
  84. package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
  85. package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
  86. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
  87. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -17
  88. package/dist/types/global-account/react/components/index.d.ts +0 -1
  89. package/dist/types/global-account/react/stores/useModalStore.d.ts +28 -0
  90. package/package.json +1 -1
  91. package/src/anyspend/react/components/AnySpendBondKit.tsx +2 -0
  92. package/src/anyspend/react/components/AnySpendBuySpin.tsx +3 -0
  93. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +29 -14
  94. package/src/anyspend/react/components/AnySpendDeposit.tsx +13 -3
  95. package/src/anyspend/react/components/AnySpendDepositUpside.tsx +3 -0
  96. package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -0
  97. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +3 -0
  98. package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
  99. package/src/anyspend/react/components/AnySpendWorkflowTrigger.tsx +4 -0
  100. package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
  101. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +3 -0
  102. package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +4 -0
  103. package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
  104. package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +97 -79
  105. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -6
  106. package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -36
  107. package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +3 -4
  108. package/src/global-account/react/components/index.ts +0 -1
  109. package/src/global-account/react/hooks/useBetterAuth.ts +6 -7
  110. package/src/global-account/react/stores/useModalStore.ts +28 -0
  111. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
  112. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.js +0 -31
  113. package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
  114. package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.js +0 -27
  115. package/dist/types/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
  116. package/src/global-account/react/components/B3Provider/BetterAuthClientProvider.tsx +0 -40
@@ -41,6 +41,8 @@ interface CheckoutPaymentPanelProps {
41
41
  feeOnTop?: boolean;
42
42
  /** When true, identity verification (KYC) is required before card payment. Defaults to false. */
43
43
  kycEnabled?: boolean;
44
+ /** Whether to show fiat payment options (card + coinbase). Defaults to true. */
45
+ showFiatOption?: boolean;
44
46
  }
45
47
 
46
48
  function RadioCircle({ selected, themeColor }: { selected: boolean; themeColor?: string }) {
@@ -138,8 +140,20 @@ export function CheckoutPaymentPanel({
138
140
  isFormValid = true,
139
141
  feeOnTop,
140
142
  kycEnabled = false,
143
+ showFiatOption = true,
141
144
  }: CheckoutPaymentPanelProps) {
142
- const [paymentMethod, setPaymentMethod] = useState<PaymentMethod | null>(defaultPaymentMethod ?? null);
145
+ const [paymentMethod, setPaymentMethod] = useState<PaymentMethod | null>(() => {
146
+ if (!showFiatOption && (defaultPaymentMethod === "card" || defaultPaymentMethod === "coinbase")) {
147
+ return "crypto";
148
+ }
149
+ return defaultPaymentMethod ?? null;
150
+ });
151
+
152
+ useEffect(() => {
153
+ if (!showFiatOption && (paymentMethod === "card" || paymentMethod === "coinbase")) {
154
+ setPaymentMethod("crypto");
155
+ }
156
+ }, [showFiatOption, paymentMethod]);
143
157
 
144
158
  // Restore activeOrderId from sessionStorage (handles page refresh / Coinbase return)
145
159
  const [activeOrderId, setActiveOrderId] = useState<string | null>(() => {
@@ -259,88 +273,92 @@ export function CheckoutPaymentPanel({
259
273
  </AnimatePresence>
260
274
  </div>
261
275
 
262
- {/* Credit or Debit Card */}
263
- <div className="anyspend-method-card">
264
- <button
265
- onClick={() => setPaymentMethod(paymentMethod === "card" ? null : "card")}
266
- className={accordionButtonClass(paymentMethod === "card")}
267
- >
268
- <RadioCircle selected={paymentMethod === "card"} themeColor={themeColor} />
269
- <CreditCard className="h-5 w-5 text-gray-700 dark:text-gray-300" />
270
- <span className="text-sm font-medium text-gray-900 dark:text-gray-100">Credit or debit card</span>
271
- <div className="ml-auto flex items-center gap-1">
272
- <VisaLogo />
273
- <MastercardLogo />
274
- <AmexLogo />
275
- </div>
276
- </button>
277
- <AnimatePresence initial={false}>
278
- {paymentMethod === "card" && (
279
- <motion.div
280
- key="card-panel"
281
- initial={{ height: 0, opacity: 0 }}
282
- animate={{ height: "auto", opacity: 1 }}
283
- exit={{ height: 0, opacity: 0 }}
284
- transition={{ duration: 0.2, ease: "easeOut" }}
285
- style={{ overflow: "hidden" }}
276
+ {showFiatOption && (
277
+ <>
278
+ {/* Credit or Debit Card */}
279
+ <div className="anyspend-method-card">
280
+ <button
281
+ onClick={() => setPaymentMethod(paymentMethod === "card" ? null : "card")}
282
+ className={accordionButtonClass(paymentMethod === "card")}
286
283
  >
287
- <div className={expandedPanelClass}>
288
- <FiatCheckoutPanel
289
- recipientAddress={recipientAddress}
290
- destinationTokenAddress={destinationTokenAddress}
291
- destinationTokenChainId={destinationTokenChainId}
292
- totalAmount={totalAmount}
293
- themeColor={themeColor}
294
- onOrderCreated={handleOrderCreated}
295
- onError={onError}
296
- callbackMetadata={callbackMetadata}
297
- classes={classes}
298
- feeOnTop={feeOnTop}
299
- kycEnabled={kycEnabled}
300
- />
284
+ <RadioCircle selected={paymentMethod === "card"} themeColor={themeColor} />
285
+ <CreditCard className="h-5 w-5 text-gray-700 dark:text-gray-300" />
286
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">Credit or debit card</span>
287
+ <div className="ml-auto flex items-center gap-1">
288
+ <VisaLogo />
289
+ <MastercardLogo />
290
+ <AmexLogo />
301
291
  </div>
302
- </motion.div>
303
- )}
304
- </AnimatePresence>
305
- </div>
292
+ </button>
293
+ <AnimatePresence initial={false}>
294
+ {paymentMethod === "card" && (
295
+ <motion.div
296
+ key="card-panel"
297
+ initial={{ height: 0, opacity: 0 }}
298
+ animate={{ height: "auto", opacity: 1 }}
299
+ exit={{ height: 0, opacity: 0 }}
300
+ transition={{ duration: 0.2, ease: "easeOut" }}
301
+ style={{ overflow: "hidden" }}
302
+ >
303
+ <div className={expandedPanelClass}>
304
+ <FiatCheckoutPanel
305
+ recipientAddress={recipientAddress}
306
+ destinationTokenAddress={destinationTokenAddress}
307
+ destinationTokenChainId={destinationTokenChainId}
308
+ totalAmount={totalAmount}
309
+ themeColor={themeColor}
310
+ onOrderCreated={handleOrderCreated}
311
+ onError={onError}
312
+ callbackMetadata={callbackMetadata}
313
+ classes={classes}
314
+ feeOnTop={feeOnTop}
315
+ kycEnabled={kycEnabled}
316
+ />
317
+ </div>
318
+ </motion.div>
319
+ )}
320
+ </AnimatePresence>
321
+ </div>
306
322
 
307
- {/* Coinbase Pay */}
308
- <div className="anyspend-method-coinbase">
309
- <button
310
- onClick={() => setPaymentMethod(paymentMethod === "coinbase" ? null : "coinbase")}
311
- className={accordionButtonClass(paymentMethod === "coinbase")}
312
- >
313
- <RadioCircle selected={paymentMethod === "coinbase"} themeColor={themeColor} />
314
- <CoinbaseLogo />
315
- <span className="text-sm font-medium text-gray-900 dark:text-gray-100">Coinbase Pay</span>
316
- </button>
317
- <AnimatePresence initial={false}>
318
- {paymentMethod === "coinbase" && (
319
- <motion.div
320
- key="coinbase-panel"
321
- initial={{ height: 0, opacity: 0 }}
322
- animate={{ height: "auto", opacity: 1 }}
323
- exit={{ height: 0, opacity: 0 }}
324
- transition={{ duration: 0.2, ease: "easeOut" }}
325
- style={{ overflow: "hidden" }}
323
+ {/* Coinbase Pay */}
324
+ <div className="anyspend-method-coinbase">
325
+ <button
326
+ onClick={() => setPaymentMethod(paymentMethod === "coinbase" ? null : "coinbase")}
327
+ className={accordionButtonClass(paymentMethod === "coinbase")}
326
328
  >
327
- <div className={expandedPanelClass}>
328
- <CoinbaseCheckoutPanel
329
- recipientAddress={recipientAddress}
330
- destinationTokenAddress={destinationTokenAddress}
331
- destinationTokenChainId={destinationTokenChainId}
332
- totalAmount={totalAmount}
333
- themeColor={themeColor}
334
- onOrderCreated={handleOrderCreated}
335
- onError={onError}
336
- callbackMetadata={callbackMetadata}
337
- classes={classes}
338
- />
339
- </div>
340
- </motion.div>
341
- )}
342
- </AnimatePresence>
343
- </div>
329
+ <RadioCircle selected={paymentMethod === "coinbase"} themeColor={themeColor} />
330
+ <CoinbaseLogo />
331
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">Coinbase Pay</span>
332
+ </button>
333
+ <AnimatePresence initial={false}>
334
+ {paymentMethod === "coinbase" && (
335
+ <motion.div
336
+ key="coinbase-panel"
337
+ initial={{ height: 0, opacity: 0 }}
338
+ animate={{ height: "auto", opacity: 1 }}
339
+ exit={{ height: 0, opacity: 0 }}
340
+ transition={{ duration: 0.2, ease: "easeOut" }}
341
+ style={{ overflow: "hidden" }}
342
+ >
343
+ <div className={expandedPanelClass}>
344
+ <CoinbaseCheckoutPanel
345
+ recipientAddress={recipientAddress}
346
+ destinationTokenAddress={destinationTokenAddress}
347
+ destinationTokenChainId={destinationTokenChainId}
348
+ totalAmount={totalAmount}
349
+ themeColor={themeColor}
350
+ onOrderCreated={handleOrderCreated}
351
+ onError={onError}
352
+ callbackMetadata={callbackMetadata}
353
+ classes={classes}
354
+ />
355
+ </div>
356
+ </motion.div>
357
+ )}
358
+ </AnimatePresence>
359
+ </div>
360
+ </>
361
+ )}
344
362
  </div>
345
363
  </div>
346
364
  );
@@ -28,8 +28,6 @@ export interface B3ConfigContextType {
28
28
  stripePublishableKey?: string;
29
29
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
30
30
  authStrategy: AuthStrategy;
31
- /** Override the API base URL for all auth operations (Better Auth client, Feathers JWT exchange). */
32
- apiUrl?: string;
33
31
  }
34
32
 
35
33
  const B3ConfigContext = createContext<B3ConfigContextType | null>(null);
@@ -46,7 +44,6 @@ export function B3ConfigProvider({
46
44
  stripePublishableKey,
47
45
  createClientReferenceId,
48
46
  authStrategy = "thirdweb",
49
- apiUrl,
50
47
  }: {
51
48
  children: React.ReactNode;
52
49
  accountOverride?: Account;
@@ -59,8 +56,6 @@ export function B3ConfigProvider({
59
56
  stripePublishableKey?: string;
60
57
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
61
58
  authStrategy?: AuthStrategy;
62
- /** Override the API base URL for all auth operations (Better Auth client, Feathers JWT exchange). */
63
- apiUrl?: string;
64
59
  }) {
65
60
  return (
66
61
  <B3ConfigContext.Provider
@@ -75,7 +70,6 @@ export function B3ConfigProvider({
75
70
  stripePublishableKey,
76
71
  createClientReferenceId,
77
72
  authStrategy,
78
- apiUrl,
79
73
  }}
80
74
  >
81
75
  {children}
@@ -16,7 +16,6 @@ import { StyleRoot } from "../StyleRoot";
16
16
  import { setToastContext, ToastProvider, useToastContext } from "../Toast/index";
17
17
  import AuthenticationProvider from "./AuthenticationProvider";
18
18
  import { B3ConfigProvider } from "./B3ConfigProvider";
19
- import { BetterAuthClientProvider } from "./BetterAuthClientProvider";
20
19
  import BetterAuthProvider from "./BetterAuthProvider";
21
20
  import { LocalSDKProvider } from "./LocalSDKProvider";
22
21
 
@@ -46,7 +45,6 @@ export function B3Provider({
46
45
  disableBSMNTAuthentication = false,
47
46
  queryClient,
48
47
  authStrategy = "thirdweb",
49
- apiUrl,
50
48
  }: {
51
49
  theme: "light" | "dark";
52
50
  children: React.ReactNode;
@@ -76,22 +74,6 @@ export function B3Provider({
76
74
  queryClient?: QueryClient;
77
75
  /** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
78
76
  authStrategy?: AuthStrategy;
79
- /**
80
- * Override the API base URL for Better Auth operations.
81
- *
82
- * When set, the Better Auth client (signIn, signUp, signOut, getSession) will
83
- * target this URL instead of the default `B3_API_URL` / `NEXT_PUBLIC_B3_API`.
84
- *
85
- * Useful for local development where the frontend runs on localhost:3003 and
86
- * the b3-api runs on localhost:3031 — keeps the entire OAuth flow local so
87
- * sessions, cookies, and token exchange all hit the same server.
88
- *
89
- * @example
90
- * ```tsx
91
- * <B3Provider apiUrl="http://localhost:3031" ... />
92
- * ```
93
- */
94
- apiUrl?: string;
95
77
  }) {
96
78
  // Initialize Google Analytics on mount
97
79
  useEffect(() => {
@@ -128,25 +110,22 @@ export function B3Provider({
128
110
  createClientReferenceId={createClientReferenceId}
129
111
  defaultPermissions={defaultPermissions}
130
112
  authStrategy={authStrategy}
131
- apiUrl={apiUrl}
132
113
  >
133
- <BetterAuthClientProvider apiUrl={apiUrl}>
134
- <ToastContextConnector />
135
- <RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
136
- {children}
137
- {/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
138
- <StyleRoot id="b3-root" />
139
- </RelayKitProviderWrapper>
140
- {authStrategy === "better-auth" ? (
141
- <BetterAuthProvider partnerId={partnerId} />
142
- ) : (
143
- <AuthenticationProvider
144
- partnerId={partnerId}
145
- automaticallySetFirstEoa={!!automaticallySetFirstEoa}
146
- defaultEoaProvider={defaultEoaProvider}
147
- />
148
- )}
149
- </BetterAuthClientProvider>
114
+ <ToastContextConnector />
115
+ <RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
116
+ {children}
117
+ {/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
118
+ <StyleRoot id="b3-root" />
119
+ </RelayKitProviderWrapper>
120
+ {authStrategy === "better-auth" ? (
121
+ <BetterAuthProvider partnerId={partnerId} />
122
+ ) : (
123
+ <AuthenticationProvider
124
+ partnerId={partnerId}
125
+ automaticallySetFirstEoa={!!automaticallySetFirstEoa}
126
+ defaultEoaProvider={defaultEoaProvider}
127
+ />
128
+ )}
150
129
  </B3ConfigProvider>
151
130
  </LocalSDKProvider>
152
131
  </ToastProvider>
@@ -4,8 +4,8 @@ import { B3_AUTH_COOKIE_NAME } from "@b3dotfun/sdk/shared/constants";
4
4
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
5
5
  import Cookies from "js-cookie";
6
6
  import { useEffect, useRef } from "react";
7
+ import { betterAuthClient } from "../../../better-auth-client";
7
8
  import { useUserQuery } from "../../hooks/useUserQuery";
8
- import { useBetterAuthClient } from "./BetterAuthClientProvider";
9
9
 
10
10
  const debug = debugB3React("BetterAuthProvider");
11
11
 
@@ -22,7 +22,6 @@ const debug = debugB3React("BetterAuthProvider");
22
22
  * useAuth, SignIn component, etc.) automatically clears the Better Auth session.
23
23
  */
24
24
  const BetterAuthProvider = ({ partnerId }: { partnerId: string }) => {
25
- const betterAuthClient = useBetterAuthClient();
26
25
  const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
27
26
  const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
28
27
  const setIsConnected = useAuthStore(state => state.setIsConnected);
@@ -55,7 +54,7 @@ const BetterAuthProvider = ({ partnerId }: { partnerId: string }) => {
55
54
  (app as any).logout = originalLogout;
56
55
  hasPatched.current = false;
57
56
  };
58
- }, [betterAuthClient]);
57
+ }, []);
59
58
 
60
59
  // Session restore on mount
61
60
  useEffect(() => {
@@ -120,7 +119,7 @@ const BetterAuthProvider = ({ partnerId }: { partnerId: string }) => {
120
119
  };
121
120
 
122
121
  restoreSession();
123
- }, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId, betterAuthClient]);
122
+ }, [setIsAuthenticated, setIsAuthenticating, setIsConnected, setUser, partnerId]);
124
123
 
125
124
  return null;
126
125
  };
@@ -7,7 +7,6 @@ export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
7
7
  export { useB3 } from "./B3Provider/useB3";
8
8
  export { useB3Account } from "./B3Provider/useB3Account";
9
9
  export { useB3Config } from "./B3Provider/useB3Config";
10
- export { useBetterAuthClient } from "./B3Provider/BetterAuthClientProvider";
11
10
  export { StyleRoot } from "./StyleRoot";
12
11
 
13
12
  // SignInWithB3 Components
@@ -2,7 +2,7 @@ import app from "@b3dotfun/sdk/global-account/app";
2
2
  import { useAuthStore, useB3Config } from "@b3dotfun/sdk/global-account/react";
3
3
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
4
4
  import { useCallback } from "react";
5
- import { useBetterAuthClient } from "../components/B3Provider/BetterAuthClientProvider";
5
+ import { betterAuthClient } from "../../better-auth-client";
6
6
  import { useUserQuery } from "./useUserQuery";
7
7
 
8
8
  const debug = debugB3React("useBetterAuth");
@@ -27,7 +27,6 @@ export class EmailVerificationRequiredError extends Error {
27
27
  */
28
28
  export function useBetterAuth() {
29
29
  const { partnerId } = useB3Config();
30
- const betterAuthClient = useBetterAuthClient();
31
30
  const { setUser } = useUserQuery();
32
31
  const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
33
32
  const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
@@ -84,7 +83,7 @@ export function useBetterAuth() {
84
83
  throw error;
85
84
  }
86
85
  },
87
- [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting, betterAuthClient],
86
+ [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting],
88
87
  );
89
88
 
90
89
  const signUpWithEmail = useCallback(
@@ -119,7 +118,7 @@ export function useBetterAuth() {
119
118
  throw error;
120
119
  }
121
120
  },
122
- [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting, betterAuthClient],
121
+ [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting],
123
122
  );
124
123
 
125
124
  const signInWithSocial = useCallback(
@@ -146,7 +145,7 @@ export function useBetterAuth() {
146
145
  throw error;
147
146
  }
148
147
  },
149
- [setIsAuthenticating, setHasStartedConnecting, betterAuthClient],
148
+ [setIsAuthenticating, setHasStartedConnecting],
150
149
  );
151
150
 
152
151
  const requestPasswordReset = useCallback(async (email: string, redirectTo?: string) => {
@@ -163,7 +162,7 @@ export function useBetterAuth() {
163
162
 
164
163
  debug("Password reset email sent");
165
164
  return result;
166
- }, [betterAuthClient]);
165
+ }, []);
167
166
 
168
167
  const resetPassword = useCallback(async (newPassword: string, token: string) => {
169
168
  debug("Resetting password");
@@ -179,7 +178,7 @@ export function useBetterAuth() {
179
178
 
180
179
  debug("Password reset successful");
181
180
  return result;
182
- }, [betterAuthClient]);
181
+ }, []);
183
182
 
184
183
  return {
185
184
  signInWithEmail,
@@ -141,6 +141,8 @@ export interface AnySpendModalProps extends BaseModalProps {
141
141
  disableUrlParamManagement?: boolean;
142
142
  /** Staging environment support */
143
143
  isStaging?: boolean;
144
+ /** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
145
+ showFiatOption?: boolean;
144
146
  }
145
147
 
146
148
  /**
@@ -158,6 +160,8 @@ export interface AnySpendNftProps extends BaseModalProps {
158
160
  onSuccess?: (txHash?: string) => void;
159
161
  /** Client-provided reference ID for tracking orders */
160
162
  clientReferenceId?: string;
163
+ /** Whether to show fiat payment option. Defaults to true. */
164
+ showFiatOption?: boolean;
161
165
  }
162
166
 
163
167
  /**
@@ -236,6 +240,8 @@ export interface AnySpendStakeB3Props extends BaseModalProps {
236
240
  stakeAmount?: string;
237
241
  /** Callback function called when the stake is successful */
238
242
  onSuccess?: () => void;
243
+ /** Whether to show fiat payment option. Defaults to true. */
244
+ showFiatOption?: boolean;
239
245
  }
240
246
 
241
247
  /**
@@ -251,6 +257,8 @@ export interface AnySpendStakeB3ExactInProps extends BaseModalProps {
251
257
  stakeAmount?: string;
252
258
  /** Callback function called when the stake is successful */
253
259
  onSuccess?: () => void;
260
+ /** Whether to show fiat payment option. Defaults to true. */
261
+ showFiatOption?: boolean;
254
262
  }
255
263
 
256
264
  /**
@@ -272,6 +280,8 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
272
280
  activeTab?: "crypto" | "fiat";
273
281
  /** Callback function called when the stake is successful */
274
282
  onSuccess?: () => void;
283
+ /** Whether to show fiat payment option. Defaults to true. */
284
+ showFiatOption?: boolean;
275
285
  }
276
286
 
277
287
  /**
@@ -289,6 +299,8 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
289
299
  token: components["schemas"]["Token"];
290
300
  /** Callback function called when the stake is successful */
291
301
  onSuccess?: () => void;
302
+ /** Whether to show fiat payment option. Defaults to true. */
303
+ showFiatOption?: boolean;
292
304
  }
293
305
 
294
306
  /**
@@ -312,6 +324,8 @@ export interface AnySpendDepositUpsideProps extends BaseModalProps {
312
324
  destinationTokenAmount?: string;
313
325
  /** Callback function called when the deposit is successful */
314
326
  onSuccess?: () => void;
327
+ /** Whether to show fiat payment option. Defaults to true. */
328
+ showFiatOption?: boolean;
315
329
  }
316
330
 
317
331
  /**
@@ -331,6 +345,8 @@ export interface AnySpendBuySpinProps extends BaseModalProps {
331
345
  onSuccess?: (txHash?: string) => void;
332
346
  /** Prefill quantity of spins to purchase */
333
347
  prefillQuantity?: string;
348
+ /** Whether to show fiat payment option. Defaults to true. */
349
+ showFiatOption?: boolean;
334
350
  }
335
351
 
336
352
  /**
@@ -346,6 +362,8 @@ export interface AnySpendSignatureMintProps extends BaseModalProps {
346
362
  imageUrl?: string;
347
363
  /** Callback function called when minting is successful */
348
364
  onSuccess?: (txHash?: string) => void;
365
+ /** Whether to show fiat payment option. Defaults to true. */
366
+ showFiatOption?: boolean;
349
367
  }
350
368
 
351
369
  /**
@@ -371,6 +389,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
371
389
  b3Amount?: string;
372
390
  /** Callback function called when purchase is successful */
373
391
  onSuccess?: (txHash?: string) => void;
392
+ /** Whether to show fiat payment option. Defaults to true. */
393
+ showFiatOption?: boolean;
374
394
  }
375
395
 
376
396
  export interface LinkAccountModalProps extends BaseModalProps {
@@ -420,6 +440,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
420
440
  customRecipientLabel?: string;
421
441
  /** Custom label for the return home button (overrides "Return to Home" / "Close") */
422
442
  returnHomeLabel?: string;
443
+ /** Whether to show fiat payment option. Defaults to true. */
444
+ showFiatOption?: boolean;
423
445
  }
424
446
 
425
447
  export interface AvatarEditorModalProps extends BaseModalProps {
@@ -511,6 +533,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
511
533
  isStaging?: boolean;
512
534
  /** Optional discount code to apply to the purchase */
513
535
  discountCode?: string;
536
+ /** Whether to show the "Pay with fiat" tab. Defaults to true. */
537
+ showFiatOption?: boolean;
514
538
  }
515
539
 
516
540
  /**
@@ -569,6 +593,8 @@ export interface AnySpendCheckoutTriggerModalProps extends BaseModalProps {
569
593
  returnUrl?: string;
570
594
  /** Label for the return button */
571
595
  returnLabel?: string;
596
+ /** Whether to show fiat payment options (card + coinbase). Defaults to true. */
597
+ showFiatOption?: boolean;
572
598
  }
573
599
 
574
600
  export interface AnySpendWorkflowTriggerModalProps extends BaseModalProps {
@@ -598,6 +624,8 @@ export interface AnySpendWorkflowTriggerModalProps extends BaseModalProps {
598
624
  actionLabel?: string;
599
625
  /** Custom class names */
600
626
  classes?: AnySpendAllClasses;
627
+ /** Whether to show fiat payment option. Defaults to true. */
628
+ showFiatOption?: boolean;
601
629
  }
602
630
 
603
631
  export interface AnySpendDepositModalProps extends BaseModalProps {
@@ -1,17 +0,0 @@
1
- import { type B3BetterAuthClient } from "../../../better-auth-client";
2
- /**
3
- * Provides a Better Auth client instance to the subtree.
4
- *
5
- * When `apiUrl` is supplied, a custom client targeting that URL is created
6
- * (e.g. `http://localhost:3031` for local development). Otherwise, the
7
- * default singleton (which uses `B3_API_URL` / `NEXT_PUBLIC_B3_API`) is used.
8
- */
9
- export declare function BetterAuthClientProvider({ children, apiUrl, }: {
10
- children: React.ReactNode;
11
- apiUrl?: string;
12
- }): import("react/jsx-runtime").JSX.Element;
13
- /**
14
- * Returns the Better Auth client from the nearest `BetterAuthClientProvider`.
15
- * Falls back to the default singleton if no provider is present.
16
- */
17
- export declare function useBetterAuthClient(): B3BetterAuthClient;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BetterAuthClientProvider = BetterAuthClientProvider;
4
- exports.useBetterAuthClient = useBetterAuthClient;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const better_auth_client_1 = require("../../../better-auth-client");
8
- const BetterAuthClientContext = (0, react_1.createContext)(better_auth_client_1.betterAuthClient);
9
- /**
10
- * Provides a Better Auth client instance to the subtree.
11
- *
12
- * When `apiUrl` is supplied, a custom client targeting that URL is created
13
- * (e.g. `http://localhost:3031` for local development). Otherwise, the
14
- * default singleton (which uses `B3_API_URL` / `NEXT_PUBLIC_B3_API`) is used.
15
- */
16
- function BetterAuthClientProvider({ children, apiUrl, }) {
17
- const client = (0, react_1.useMemo)(() => {
18
- if (apiUrl) {
19
- return (0, better_auth_client_1.createB3BetterAuthClient)(apiUrl);
20
- }
21
- return better_auth_client_1.betterAuthClient;
22
- }, [apiUrl]);
23
- return (0, jsx_runtime_1.jsx)(BetterAuthClientContext.Provider, { value: client, children: children });
24
- }
25
- /**
26
- * Returns the Better Auth client from the nearest `BetterAuthClientProvider`.
27
- * Falls back to the default singleton if no provider is present.
28
- */
29
- function useBetterAuthClient() {
30
- return (0, react_1.useContext)(BetterAuthClientContext);
31
- }
@@ -1,17 +0,0 @@
1
- import { type B3BetterAuthClient } from "../../../better-auth-client";
2
- /**
3
- * Provides a Better Auth client instance to the subtree.
4
- *
5
- * When `apiUrl` is supplied, a custom client targeting that URL is created
6
- * (e.g. `http://localhost:3031` for local development). Otherwise, the
7
- * default singleton (which uses `B3_API_URL` / `NEXT_PUBLIC_B3_API`) is used.
8
- */
9
- export declare function BetterAuthClientProvider({ children, apiUrl, }: {
10
- children: React.ReactNode;
11
- apiUrl?: string;
12
- }): import("react/jsx-runtime").JSX.Element;
13
- /**
14
- * Returns the Better Auth client from the nearest `BetterAuthClientProvider`.
15
- * Falls back to the default singleton if no provider is present.
16
- */
17
- export declare function useBetterAuthClient(): B3BetterAuthClient;
@@ -1,27 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo } from "react";
3
- import { betterAuthClient, createB3BetterAuthClient, } from "../../../better-auth-client.js";
4
- const BetterAuthClientContext = createContext(betterAuthClient);
5
- /**
6
- * Provides a Better Auth client instance to the subtree.
7
- *
8
- * When `apiUrl` is supplied, a custom client targeting that URL is created
9
- * (e.g. `http://localhost:3031` for local development). Otherwise, the
10
- * default singleton (which uses `B3_API_URL` / `NEXT_PUBLIC_B3_API`) is used.
11
- */
12
- export function BetterAuthClientProvider({ children, apiUrl, }) {
13
- const client = useMemo(() => {
14
- if (apiUrl) {
15
- return createB3BetterAuthClient(apiUrl);
16
- }
17
- return betterAuthClient;
18
- }, [apiUrl]);
19
- return _jsx(BetterAuthClientContext.Provider, { value: client, children: children });
20
- }
21
- /**
22
- * Returns the Better Auth client from the nearest `BetterAuthClientProvider`.
23
- * Falls back to the default singleton if no provider is present.
24
- */
25
- export function useBetterAuthClient() {
26
- return useContext(BetterAuthClientContext);
27
- }
@@ -1,17 +0,0 @@
1
- import { type B3BetterAuthClient } from "../../../better-auth-client";
2
- /**
3
- * Provides a Better Auth client instance to the subtree.
4
- *
5
- * When `apiUrl` is supplied, a custom client targeting that URL is created
6
- * (e.g. `http://localhost:3031` for local development). Otherwise, the
7
- * default singleton (which uses `B3_API_URL` / `NEXT_PUBLIC_B3_API`) is used.
8
- */
9
- export declare function BetterAuthClientProvider({ children, apiUrl, }: {
10
- children: React.ReactNode;
11
- apiUrl?: string;
12
- }): import("react/jsx-runtime").JSX.Element;
13
- /**
14
- * Returns the Better Auth client from the nearest `BetterAuthClientProvider`.
15
- * Falls back to the default singleton if no provider is present.
16
- */
17
- export declare function useBetterAuthClient(): B3BetterAuthClient;