@b3dotfun/sdk 0.0.46 → 0.0.47-alpha.1

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 (89) hide show
  1. package/README.md +3 -222
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +13 -14
  3. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +5 -3
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +14 -15
  5. package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -2
  6. package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +6 -3
  7. package/dist/cjs/anyspend/types/api.d.ts +176 -0
  8. package/dist/cjs/anyspend/utils/chain.js +1 -1
  9. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.js +245 -0
  10. package/dist/cjs/shared/utils/index.d.ts +0 -1
  11. package/dist/cjs/shared/utils/index.js +0 -1
  12. package/dist/esm/anyspend/react/components/AnySpend.js +14 -15
  13. package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -3
  14. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +15 -16
  15. package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -2
  16. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +8 -5
  17. package/dist/esm/anyspend/types/api.d.ts +176 -0
  18. package/dist/esm/anyspend/utils/chain.js +1 -1
  19. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  20. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.js +243 -0
  21. package/dist/esm/shared/utils/index.d.ts +0 -1
  22. package/dist/esm/shared/utils/index.js +0 -1
  23. package/dist/styles/index.css +1 -1
  24. package/dist/types/anyspend/types/api.d.ts +176 -0
  25. package/dist/types/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  26. package/dist/types/shared/utils/index.d.ts +0 -1
  27. package/package.json +2 -21
  28. package/src/anyspend/react/components/AnySpend.tsx +21 -19
  29. package/src/anyspend/react/components/AnySpendCustom.tsx +5 -3
  30. package/src/anyspend/react/components/AnyspendDepositHype.tsx +21 -21
  31. package/src/anyspend/react/components/common/OrderHistory.tsx +11 -11
  32. package/src/anyspend/react/components/common/OrderHistoryItem.tsx +124 -129
  33. package/src/anyspend/types/api.ts +176 -0
  34. package/src/anyspend/utils/chain.ts +1 -4
  35. package/src/shared/utils/index.ts +0 -1
  36. package/dist/cjs/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  37. package/dist/cjs/anyspend/react/components/common/ErrorSection.js +0 -12
  38. package/dist/cjs/notifications/index.d.ts +0 -3
  39. package/dist/cjs/notifications/index.js +0 -25
  40. package/dist/cjs/notifications/react/hooks/index.d.ts +0 -1
  41. package/dist/cjs/notifications/react/hooks/index.js +0 -17
  42. package/dist/cjs/notifications/react/hooks/useNotifications.d.ts +0 -42
  43. package/dist/cjs/notifications/react/hooks/useNotifications.js +0 -148
  44. package/dist/cjs/notifications/react/index.d.ts +0 -1
  45. package/dist/cjs/notifications/react/index.js +0 -17
  46. package/dist/cjs/notifications/services/api.d.ts +0 -67
  47. package/dist/cjs/notifications/services/api.js +0 -184
  48. package/dist/cjs/notifications/services/index.d.ts +0 -1
  49. package/dist/cjs/notifications/services/index.js +0 -17
  50. package/dist/cjs/notifications/types/index.d.ts +0 -51
  51. package/dist/cjs/notifications/types/index.js +0 -2
  52. package/dist/cjs/shared/utils/auth-token.d.ts +0 -7
  53. package/dist/cjs/shared/utils/auth-token.js +0 -17
  54. package/dist/esm/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  55. package/dist/esm/anyspend/react/components/common/ErrorSection.js +0 -9
  56. package/dist/esm/notifications/index.d.ts +0 -3
  57. package/dist/esm/notifications/index.js +0 -7
  58. package/dist/esm/notifications/react/hooks/index.d.ts +0 -1
  59. package/dist/esm/notifications/react/hooks/index.js +0 -1
  60. package/dist/esm/notifications/react/hooks/useNotifications.d.ts +0 -42
  61. package/dist/esm/notifications/react/hooks/useNotifications.js +0 -145
  62. package/dist/esm/notifications/react/index.d.ts +0 -1
  63. package/dist/esm/notifications/react/index.js +0 -1
  64. package/dist/esm/notifications/services/api.d.ts +0 -67
  65. package/dist/esm/notifications/services/api.js +0 -179
  66. package/dist/esm/notifications/services/index.d.ts +0 -1
  67. package/dist/esm/notifications/services/index.js +0 -1
  68. package/dist/esm/notifications/types/index.d.ts +0 -51
  69. package/dist/esm/shared/utils/auth-token.d.ts +0 -7
  70. package/dist/esm/shared/utils/auth-token.js +0 -11
  71. package/dist/types/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  72. package/dist/types/notifications/index.d.ts +0 -3
  73. package/dist/types/notifications/react/hooks/index.d.ts +0 -1
  74. package/dist/types/notifications/react/hooks/useNotifications.d.ts +0 -42
  75. package/dist/types/notifications/react/index.d.ts +0 -1
  76. package/dist/types/notifications/services/api.d.ts +0 -67
  77. package/dist/types/notifications/services/index.d.ts +0 -1
  78. package/dist/types/notifications/types/index.d.ts +0 -51
  79. package/dist/types/shared/utils/auth-token.d.ts +0 -7
  80. package/src/anyspend/react/components/common/ErrorSection.tsx +0 -21
  81. package/src/notifications/index.ts +0 -9
  82. package/src/notifications/react/hooks/index.ts +0 -1
  83. package/src/notifications/react/hooks/useNotifications.ts +0 -153
  84. package/src/notifications/react/index.ts +0 -1
  85. package/src/notifications/services/api.ts +0 -217
  86. package/src/notifications/services/index.ts +0 -1
  87. package/src/notifications/types/index.ts +0 -58
  88. package/src/shared/utils/auth-token.ts +0 -13
  89. /package/dist/{esm/notifications/types/index.js → cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts} +0 -0
package/README.md CHANGED
@@ -8,7 +8,6 @@ The SDK is organized into focused modules:
8
8
 
9
9
  - **`anyspend/`** - Cross-chain execution engine functionality
10
10
  - **`global-account/`** - B3 Global Accounts authentication and user management
11
- - **`notifications/`** - Multi-channel notification management
12
11
  - **`shared/`** - Common utilities, types, and components
13
12
  - **`others/`** - Additional features and utilities
14
13
 
@@ -26,7 +25,6 @@ Each module contains:
26
25
  | ----------------- | --------- | ------------ |
27
26
  | AnySpend | ✅ | ❌ |
28
27
  | Global Accounts | ✅ | ✅ |
29
- | Notifications | ✅ | ✅ |
30
28
  | Headless Services | ✅ | ✅ |
31
29
 
32
30
  ## Installation
@@ -157,7 +155,9 @@ const order = await anyspendService.createOrder({
157
155
  import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
158
156
 
159
157
  // Get order details and transactions
160
- const orderDetails = await anyspendService.getOrderAndTransactions("order-id");
158
+ const orderDetails = await anyspendService.getOrderAndTransactions(
159
+ "order-id",
160
+ );
161
161
 
162
162
  // Get order history for an address
163
163
  const history = await anyspendService.getOrderHistory(
@@ -323,206 +323,6 @@ import { serverFunction } from "@b3dotfun/sdk/global-account/server";
323
323
  // (Implementation depends on your specific needs)
324
324
  ```
325
325
 
326
- # Notifications
327
-
328
- B3 Notifications provides multi-channel notification management for your users with support for email, Telegram, Discord, SMS, WhatsApp, and in-app notifications.
329
-
330
- ## Features
331
-
332
- - ✅ **Zero Config** - Automatically uses authenticated user's ID from JWT
333
- - 🎯 **Type Safe** - Full TypeScript support
334
- - ⚡ **React Hooks** - Easy integration with `useNotifications()` hook
335
- - 🔐 **Secure** - JWT-based authentication
336
- - 📱 **Multi-Channel** - Email, Telegram, Discord, SMS, WhatsApp, In-app
337
- - 🚀 **Lightweight** - Minimal dependencies
338
-
339
- ## React Hook
340
-
341
- ### Basic Usage
342
-
343
- ```tsx
344
- import { useNotifications } from "@b3dotfun/sdk/notifications/react";
345
-
346
- function NotificationSettings() {
347
- const { user, loading, connectEmail, connectTelegram, isEmailConnected } = useNotifications();
348
-
349
- if (loading) return <div>Loading...</div>;
350
-
351
- return (
352
- <div>
353
- {!isEmailConnected && <button onClick={() => connectEmail("user@example.com")}>Connect Email</button>}
354
-
355
- <button onClick={connectTelegram}>Connect Telegram</button>
356
- </div>
357
- );
358
- }
359
- ```
360
-
361
- ### Full Hook API
362
-
363
- ```tsx
364
- const {
365
- user, // User data with channels and settings
366
- loading, // Loading state
367
- error, // Error if any
368
- refresh, // Manually refresh user data
369
- connectEmail, // Connect email channel
370
- connectTelegram, // Connect Telegram channel
371
- updateChannel, // Update a channel
372
- deleteChannel, // Delete a channel
373
- // Convenience helpers
374
- isEmailConnected,
375
- isTelegramConnected,
376
- isDiscordConnected,
377
- } = useNotifications();
378
- ```
379
-
380
- ## Headless API Client
381
-
382
- ### Authentication
383
-
384
- The notifications API automatically uses the B3 auth token from cookies. The token is managed by the B3 Global Account authentication system - you don't need to set it manually.
385
-
386
- ```typescript
387
- import { getAuthToken, notificationsAPI } from "@b3dotfun/sdk/notifications";
388
- // Or import from shared utils
389
- // import { getAuthToken } from "@b3dotfun/sdk/shared/utils";
390
-
391
- // Get the current auth token (from b3-auth cookie)
392
- const token = getAuthToken();
393
-
394
- // API calls automatically use the auth token
395
- const userData = await notificationsAPI.getUser();
396
- ```
397
-
398
- ### User Management
399
-
400
- ```typescript
401
- import { notificationsAPI } from "@b3dotfun/sdk/notifications";
402
-
403
- // Register current user
404
- await notificationsAPI.registerUser();
405
-
406
- // Get current user's profile
407
- const userData = await notificationsAPI.getUser();
408
-
409
- // Get notification history
410
- const history = await notificationsAPI.getHistory("my-app-id", 50);
411
- ```
412
-
413
- ### Channel Management
414
-
415
- ```typescript
416
- // Add any channel
417
- await notificationsAPI.addChannel("email", "user@example.com");
418
-
419
- // Connect email (shorthand)
420
- await notificationsAPI.connectEmail("user@example.com");
421
-
422
- // Update channel
423
- await notificationsAPI.updateChannel("channel-id", {
424
- enabled: true,
425
- });
426
-
427
- // Delete channel
428
- await notificationsAPI.deleteChannel("channel-id");
429
- ```
430
-
431
- ### Telegram Integration
432
-
433
- ```typescript
434
- // Get Telegram deep link
435
- const { deepLink, verificationCode, botUsername } = await notificationsAPI.getTelegramLink();
436
- window.open(deepLink, "_blank");
437
-
438
- // Check connection status
439
- const { connected, chatId } = await notificationsAPI.checkTelegramStatus();
440
- ```
441
-
442
- ### App Preferences
443
-
444
- ```typescript
445
- // Save notification preferences for an app (enabled by default)
446
- await notificationsAPI.savePreferences("my-app", {
447
- notificationType: "transaction",
448
- channels: ["email", "telegram", "in_app"],
449
- });
450
-
451
- // Save disabled preferences
452
- await notificationsAPI.savePreferences("my-app", {
453
- notificationType: "transaction",
454
- channels: ["email", "telegram"],
455
- enabled: false,
456
- });
457
-
458
- // Get app settings
459
- const settings = await notificationsAPI.getAppSettings("my-app");
460
- ```
461
-
462
- ### In-App Notifications
463
-
464
- ```typescript
465
- // Get in-app notifications
466
- const { notifications } = await notificationsAPI.getInAppNotifications();
467
-
468
- // Mark notification as read
469
- await notificationsAPI.markNotificationAsRead("notification-id");
470
- ```
471
-
472
- ### Send Notifications
473
-
474
- ```typescript
475
- // Send a notification
476
- await notificationsAPI.sendNotification({
477
- userId: "user-123",
478
- appId: "my-app",
479
- notificationType: "transaction",
480
- message: "Your transaction was successful!",
481
- title: "Transaction Complete",
482
- data: { transactionId: "tx-123" },
483
- });
484
- ```
485
-
486
- ## Next.js Example
487
-
488
- ```tsx
489
- "use client";
490
-
491
- import { useNotifications } from "@b3dotfun/sdk/notifications/react";
492
-
493
- export default function NotificationsPage() {
494
- const { user, loading, connectEmail, connectTelegram, isEmailConnected, isTelegramConnected } = useNotifications();
495
-
496
- if (loading) {
497
- return <div>Loading notification settings...</div>;
498
- }
499
-
500
- return (
501
- <div className="space-y-4">
502
- <h1>Notification Settings</h1>
503
-
504
- <div className="rounded-lg border p-4">
505
- <h2>Email</h2>
506
- {isEmailConnected ? (
507
- <p className="text-green-600">✓ Connected</p>
508
- ) : (
509
- <button onClick={() => connectEmail("user@example.com")}>Connect Email</button>
510
- )}
511
- </div>
512
-
513
- <div className="rounded-lg border p-4">
514
- <h2>Telegram</h2>
515
- {isTelegramConnected ? (
516
- <p className="text-green-600">✓ Connected</p>
517
- ) : (
518
- <button onClick={connectTelegram}>Connect Telegram</button>
519
- )}
520
- </div>
521
- </div>
522
- );
523
- }
524
- ```
525
-
526
326
  # Shared Utilities
527
327
 
528
328
  ## Chain Management
@@ -538,25 +338,6 @@ console.log(supportedChains);
538
338
  console.log(b3Chain);
539
339
  ```
540
340
 
541
- ## Authentication Token Management
542
-
543
- Read-only access to the B3 authentication token. The token is managed by the B3 Global Account authentication system.
544
-
545
- ```typescript
546
- import { getAuthToken } from "@b3dotfun/sdk/shared/utils";
547
-
548
- // Get the current auth token from the b3-auth cookie
549
- const token = getAuthToken();
550
-
551
- if (token) {
552
- console.log("User is authenticated");
553
- } else {
554
- console.log("User is not authenticated");
555
- }
556
- ```
557
-
558
- The auth token is automatically set by the B3 Global Account authentication system (see the Global Accounts section above). All SDK modules that require authentication will automatically use this token.
559
-
560
341
  ## Utility Functions
561
342
 
562
343
  ```typescript
@@ -23,7 +23,6 @@ const AnySpendFingerprintWrapper_1 = require("./AnySpendFingerprintWrapper");
23
23
  const CryptoPaymentMethod_1 = require("./common/CryptoPaymentMethod");
24
24
  const CryptoPaySection_1 = require("./common/CryptoPaySection");
25
25
  const CryptoReceiveSection_1 = require("./common/CryptoReceiveSection");
26
- const ErrorSection_1 = require("./common/ErrorSection");
27
26
  const FiatPaymentMethod_1 = require("./common/FiatPaymentMethod");
28
27
  const OrderDetails_1 = require("./common/OrderDetails");
29
28
  const OrderHistory_1 = require("./common/OrderHistory");
@@ -339,7 +338,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
339
338
  ? (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString()
340
339
  : (0, viem_1.parseUnits)(dstAmount.replace(/,/g, ""), selectedDstToken.decimals).toString();
341
340
  const srcAmountOnrampInWei = (0, viem_1.parseUnits)(srcAmountOnRamp.replace(/,/g, ""), anyspend_1.USDC_BASE.decimals).toString();
342
- const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)(activeTab === "crypto"
341
+ const { anyspendQuote, isLoadingAnyspendQuote } = (0, react_1.useAnyspendQuote)(activeTab === "crypto"
343
342
  ? {
344
343
  srcChain: selectedSrcChainId,
345
344
  dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
@@ -469,38 +468,38 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
469
468
  // Determine button state and text
470
469
  const btnInfo = (0, react_4.useMemo)(() => {
471
470
  if (activeInputAmountInWei === "0")
472
- return { text: "Enter an amount", disable: true, error: false };
471
+ return { text: "Enter an amount", disable: true, error: false, loading: false };
473
472
  if (isLoadingAnyspendQuote)
474
- return { text: "Loading...", disable: true, error: false };
473
+ return { text: "Loading quote...", disable: true, error: false, loading: true };
475
474
  if (!recipientAddress)
476
- return { text: "Select recipient", disable: false, error: false };
475
+ return { text: "Select recipient", disable: false, error: false, loading: false };
477
476
  if (isCreatingOrder || isCreatingOnrampOrder)
478
- return { text: "Creating order...", disable: true, error: false };
477
+ return { text: "Creating order...", disable: true, error: false, loading: true };
479
478
  if (!anyspendQuote || !anyspendQuote.success)
480
- return { text: "Get rate error", disable: true, error: true };
479
+ return { text: "No quote found", disable: true, error: false, loading: false };
481
480
  if (activeTab === "crypto") {
482
481
  // If no payment method selected, show "Choose payment method"
483
482
  if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
484
- return { text: "Choose payment method", disable: false, error: false };
483
+ return { text: "Choose payment method", disable: false, error: false, loading: false };
485
484
  }
486
485
  // If payment method selected, show appropriate action
487
486
  if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ||
488
487
  selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET) {
489
- return { text: "Swap", disable: false, error: false };
488
+ return { text: "Swap", disable: false, error: false, loading: false };
490
489
  }
491
490
  if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO) {
492
- return { text: "Continue to payment", disable: false, error: false };
491
+ return { text: "Continue to payment", disable: false, error: false, loading: false };
493
492
  }
494
493
  }
495
494
  if (activeTab === "fiat") {
496
495
  // If no fiat payment method selected, show "Select payment method"
497
496
  if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
498
- return { text: "Select payment method", disable: false, error: false };
497
+ return { text: "Select payment method", disable: false, error: false, loading: false };
499
498
  }
500
499
  // If payment method is selected, show "Buy"
501
- return { text: "Buy", disable: false, error: false };
500
+ return { text: "Buy", disable: false, error: false, loading: false };
502
501
  }
503
- return { text: "Buy", disable: false, error: false };
502
+ return { text: "Buy", disable: false, error: false, loading: false };
504
503
  }, [
505
504
  activeInputAmountInWei,
506
505
  isLoadingAnyspendQuote,
@@ -755,7 +754,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
755
754
  }, children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex items-center justify-center transition-opacity", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && ((0, jsx_runtime_1.jsx)(CryptoReceiveSection_1.CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, onChangeDstAmount: value => {
756
755
  setIsSrcInputDirty(false);
757
756
  setDstAmount(value);
758
- }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward") }))] }), (0, jsx_runtime_1.jsx)(ErrorSection_1.ErrorSection, { error: getAnyspendQuoteError }), (0, jsx_runtime_1.jsxs)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [(0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? ((0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.HistoryIcon, { className: "h-4 w-4" }), " ", (0, jsx_runtime_1.jsx)("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
757
+ }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward") }))] }), (0, jsx_runtime_1.jsxs)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [(0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? ((0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.HistoryIcon, { className: "h-4 w-4" }), " ", (0, jsx_runtime_1.jsx)("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
759
758
  const onrampPaymentView = ((0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: recipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
760
759
  setOrderId(orderId);
761
760
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
@@ -273,11 +273,13 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
273
273
  (0, react_4.useEffect)(() => {
274
274
  if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
275
275
  console.log("Calling onSuccess");
276
- const txHash = oat?.data?.executeTx?.txHash;
276
+ const relayTxs = oat?.data?.relayTxs;
277
+ const lastRelayTxHash = relayTxs?.[relayTxs.length - 1]?.txHash;
278
+ const txHash = oat?.data?.executeTx?.txHash || lastRelayTxHash;
277
279
  onSuccess?.(txHash);
278
280
  onSuccessCalled.current = true;
279
281
  }
280
- }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
282
+ }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, oat?.data?.relayTxs, onSuccess]);
281
283
  // Reset flag when orderId changes
282
284
  (0, react_4.useEffect)(() => {
283
285
  onSuccessCalled.current = false;
@@ -467,7 +469,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
467
469
  const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
468
470
  setActivePanel(PanelView.HISTORY);
469
471
  }, onSelectOrder: onSelectOrder }) }));
470
- const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
472
+ const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
471
473
  setOrderId(undefined);
472
474
  setActivePanel(PanelView.CONFIRM_ORDER);
473
475
  // Remove orderId from URL when canceling
@@ -19,7 +19,6 @@ const AnySpendFingerprintWrapper_1 = require("./AnySpendFingerprintWrapper");
19
19
  const CryptoPaySection_1 = require("./common/CryptoPaySection");
20
20
  const CryptoPaymentMethod_1 = require("./common/CryptoPaymentMethod");
21
21
  const CryptoReceiveSection_1 = require("./common/CryptoReceiveSection");
22
- const ErrorSection_1 = require("./common/ErrorSection");
23
22
  const FiatPaymentMethod_1 = require("./common/FiatPaymentMethod");
24
23
  const OrderDetails_1 = require("./common/OrderDetails");
25
24
  const PointsDetailPanel_1 = require("./common/PointsDetailPanel");
@@ -37,7 +36,7 @@ function AnySpendDepositHype(props) {
37
36
  }
38
37
  function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, }) {
39
38
  // Use shared flow hook
40
- const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = (0, useAnyspendFlow_1.useAnyspendFlow)({
39
+ const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = (0, useAnyspendFlow_1.useAnyspendFlow)({
41
40
  paymentType,
42
41
  recipientAddress,
43
42
  loadOrder,
@@ -51,17 +50,17 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
51
50
  // Button state logic
52
51
  const btnInfo = (0, react_3.useMemo)(() => {
53
52
  if (activeInputAmountInWei === "0")
54
- return { text: "Enter an amount", disable: true, error: false };
53
+ return { text: "Enter an amount", disable: true, error: false, loading: false };
55
54
  if (isLoadingAnyspendQuote)
56
- return { text: "Loading quote...", disable: true, error: false };
55
+ return { text: "Loading quote...", disable: true, error: false, loading: true };
57
56
  if (isCreatingOrder || isCreatingOnrampOrder)
58
- return { text: "Creating order...", disable: true, error: false };
57
+ return { text: "Creating order...", disable: true, error: false, loading: true };
59
58
  if (!selectedRecipientAddress)
60
- return { text: "Select recipient", disable: false, error: false };
59
+ return { text: "Select recipient", disable: false, error: false, loading: false };
61
60
  if (!anyspendQuote || !anyspendQuote.success)
62
- return { text: "Get quote error", disable: true, error: true };
61
+ return { text: "Get quote error", disable: true, error: true, loading: false };
63
62
  if (!dstAmount)
64
- return { text: "No quote available", disable: true, error: true };
63
+ return { text: "No quote available", disable: true, error: true, loading: false };
65
64
  // Check minimum deposit amount (10 HYPE)
66
65
  // Use the raw amount from the quote instead of the formatted display string
67
66
  if (anyspendQuote.data?.currencyOut?.amount && anyspendQuote.data.currencyOut.currency?.decimals) {
@@ -69,22 +68,22 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
69
68
  const decimals = anyspendQuote.data.currencyOut.currency.decimals;
70
69
  const actualAmount = parseFloat(rawAmountInWei) / Math.pow(10, decimals);
71
70
  if (actualAmount < 10) {
72
- return { text: "Minimum 10 HYPE deposit", disable: true, error: true };
71
+ return { text: "Minimum 10 HYPE deposit", disable: true, error: true, loading: false };
73
72
  }
74
73
  }
75
74
  if (paymentType === "crypto") {
76
75
  if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
77
- return { text: "Choose payment method", disable: false, error: false };
76
+ return { text: "Choose payment method", disable: false, error: false, loading: false };
78
77
  }
79
- return { text: "Continue to deposit", disable: false, error: false };
78
+ return { text: "Continue to deposit", disable: false, error: false, loading: false };
80
79
  }
81
80
  if (paymentType === "fiat") {
82
81
  if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
83
- return { text: "Select payment method", disable: false, error: false };
82
+ return { text: "Select payment method", disable: false, error: false, loading: false };
84
83
  }
85
- return { text: "Buy", disable: false, error: false };
84
+ return { text: "Buy", disable: false, error: false, loading: false };
86
85
  }
87
- return { text: "Continue to deposit", disable: false, error: false };
86
+ return { text: "Continue to deposit", disable: false, error: false, loading: false };
88
87
  }, [
89
88
  activeInputAmountInWei,
90
89
  isLoadingAnyspendQuote,
@@ -122,7 +121,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
122
121
  const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : ((0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, dstTokenSymbol: exports.HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL), customUsdInputValues: customUsdInputValues }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", className: (0, cn_1.cn)("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex items-center justify-center transition-opacity", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && ((0, jsx_runtime_1.jsx)(CryptoReceiveSection_1.CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: anyspend_1.B3_TOKEN, dstTokenSymbol: exports.HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: exports.HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: chains_1.base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
123
122
  setIsSrcInputDirty(false);
124
123
  setSrcAmount(value);
125
- }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL) }))] }) }), (0, jsx_runtime_1.jsx)(ErrorSection_1.ErrorSection, { error: getAnyspendQuoteError }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) }), mainFooter ? mainFooter : null] }));
124
+ }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL) }))] }) }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }) }), mainFooter ? mainFooter : null] }));
126
125
  // Handle crypto order creation
127
126
  const handleCryptoOrder = async () => {
128
127
  try {
@@ -10,9 +10,9 @@ const OrderHistoryItem_1 = require("./OrderHistoryItem");
10
10
  function OrderHistory({ mode, onBack, onSelectOrder }) {
11
11
  const { address } = (0, react_2.useAccountWallet)();
12
12
  const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = (0, react_1.useAnyspendOrderHistory)(address);
13
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-6 flex w-full items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_2.Button, { onClick: onBack, variant: "ghost", size: "icon", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-xl font-semibold", children: "Order History" }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/30 text-sm", children: "View your past transactions" })] }), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", size: "icon", onClick: () => {
13
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-8 flex w-full items-center gap-3", children: [(0, jsx_runtime_1.jsx)(react_2.Button, { onClick: onBack, variant: "ghost", size: "icon", className: "hover:bg-as-surface-secondary", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1", children: (0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary text-2xl font-bold", children: "Order History" }) }), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", size: "icon", className: "hover:bg-as-surface-secondary", onClick: () => {
14
14
  refetchOrderHistory();
15
- }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "text-as-primary/30 hover:text-as-primary h-4 w-4 cursor-pointer transition-all hover:rotate-180" }) })] }), isLoadingOrderHistory ? ((0, jsx_runtime_1.jsx)("div", { className: "w-full space-y-4", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-[160px] w-full rounded-lg" }, i))) })) : !orderHistory?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-light-brand w-full rounded-lg border p-8 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground", children: "No order history found" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-12 w-full space-y-4", children: [...orderHistory]
15
+ }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "text-as-secondary hover:text-as-primary h-5 w-5 cursor-pointer transition-all hover:rotate-180" }) })] }), isLoadingOrderHistory ? ((0, jsx_runtime_1.jsx)("div", { className: "w-full space-y-3", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-[180px] w-full rounded-2xl" }, i))) })) : !orderHistory?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary w-full rounded-2xl p-12 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-secondary text-sm", children: "No order history found" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-12 w-full space-y-3", children: [...orderHistory]
16
16
  .sort((a, b) => b.createdAt - a.createdAt)
17
17
  .map(order => ((0, jsx_runtime_1.jsx)(OrderHistoryItem_1.OrderHistoryItem, { order: order, onSelectOrder: onSelectOrder, mode: mode }, order.id))) }))] }));
18
18
  }
@@ -9,9 +9,9 @@ const anyspend_1 = require("../../../../anyspend");
9
9
  const react_1 = require("../../../../global-account/react");
10
10
  const utils_1 = require("../../../../shared/utils");
11
11
  const number_1 = require("../../../../shared/utils/number");
12
+ const payment_utils_1 = require("../../../../shared/utils/payment.utils");
12
13
  const lucide_react_1 = require("lucide-react");
13
14
  const react_timeago_1 = __importDefault(require("react-timeago"));
14
- const chains_1 = require("viem/chains");
15
15
  function OrderHistoryItem({ order, onSelectOrder, mode }) {
16
16
  const nft = order.type === "mint_nft" ? order.metadata.nft : undefined;
17
17
  const tournament = order.type === "join_tournament" || order.type === "fund_tournament" ? order.metadata.tournament : undefined;
@@ -25,9 +25,12 @@ function OrderHistoryItem({ order, onSelectOrder, mode }) {
25
25
  : order.payload.expectedDstAmount;
26
26
  const { text: orderStatusText, status: orderDisplayStatus } = (0, anyspend_1.getStatusDisplay)(order);
27
27
  const isSmallView = (0, react_1.useIsMobile)() || mode === "modal";
28
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("bg-as-light-brand/20 rounded-lg border p-4", onSelectOrder && "hover:bg-as-light-brand/30 hover:border-as-brand cursor-pointer transition-colors"), onClick: () => onSelectOrder?.(order.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)(react_1.Badge, { className: (0, utils_1.cn)("px-3 py-1 text-xs", orderDisplayStatus === "processing" && "bg-yellow-500/10 text-yellow-500", orderDisplayStatus === "success" && "bg-green-500/10 text-green-500", orderDisplayStatus === "failure" && "bg-red-500/10 text-red-500"), children: orderStatusText }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-nano label-style text-as-primary/30", children: (0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.createdAt) }) }) })] }), order.oneClickBuyUrl ? ((0, jsx_runtime_1.jsx)("div", { className: "mb-3 mt-4 flex items-center gap-1", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex flex-1 flex-col gap-1 rounded-lg border p-4 px-5", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-as-primary/50 flex items-center gap-2 text-xl font-semibold", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Buy ", (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary", children: ["$", (0, number_1.formatTokenAmount)(BigInt(order.srcAmount), order.metadata.srcToken.decimals)] }), ` of`] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary flex items-center gap-2", children: [nft ? ((0, jsx_runtime_1.jsx)("img", { src: nft.imageUrl, alt: nft.name, className: "h-6 w-6" })) : tournament ? ((0, jsx_runtime_1.jsx)("img", { src: tournament.imageUrl, alt: tournament.name, className: "h-6 w-6" })) : ((0, jsx_runtime_1.jsx)("img", { src: dstToken.metadata.logoURI, alt: dstToken.symbol, className: "h-6 w-6" })), nft ? nft.name : tournament ? tournament.name : dstToken.symbol] }), (0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-2", children: [` on `, (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: "h-4" }), order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] })] })] }), (0, jsx_runtime_1.jsxs)("p", { className: "label-style text-as-primary/30 mt-1 flex items-center gap-2 text-xs", children: ["Paying via", " ", (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/coinbase-wordmark-blue.svg", alt: "Coinbase", className: "-mt-1 h-3" })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-3 mt-4 flex items-center gap-1", isSmallView && "flex-col"), children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-1 flex-col gap-1 overflow-hidden rounded-lg border p-4 px-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: order.metadata.srcToken.metadata.logoURI, alt: order.metadata.srcToken.symbol, className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary flex items-center gap-2 overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold", children: [(0, number_1.formatTokenAmount)(BigInt(order.srcAmount), order.metadata.srcToken.decimals), " ", order.metadata.srcToken.symbol] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "label-style text-as-primary/50 flex items-center gap-2 text-sm", children: ["from", (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("h-4", order.srcChain !== chains_1.b3.id && "w-4 rounded-full", order.srcChain === chains_1.b3.id && "h-3") }), (0, anyspend_1.getChainName)(order.srcChain)] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("h-8 w-8 shrink-0 -rotate-90 opacity-30", isSmallView && "rotate-0"), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "h-8 w-8" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-1 flex-col gap-1 overflow-hidden rounded-lg border p-4 px-5", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: nft ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: nft.imageUrl, alt: nft.name, className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold", children: nft.name })] })) : tournament ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: tournament.imageUrl, alt: tournament.name, className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold", children: tournament.name })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: dstToken.metadata.logoURI, alt: dstToken.symbol, className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold", children: [(0, number_1.formatTokenAmount)(actualDstAmount
28
+ // Check if this is a one-click payment order
29
+ const isOneClickPayment = !!order.oneClickBuyUrl;
30
+ const vendorName = order.onrampMetadata?.vendor ? (0, payment_utils_1.getVendorDisplayName)(order.onrampMetadata.vendor) : null;
31
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("bg-as-surface-secondary hover:bg-as-surface-tertiary rounded-xl p-4 transition-all", onSelectOrder && "cursor-pointer"), onClick: () => onSelectOrder?.(order.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-3 flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-xs font-semibold", orderDisplayStatus === "processing" && "text-yellow-600", orderDisplayStatus === "success" && "text-green-600", orderDisplayStatus === "failure" && "text-red-600"), children: orderStatusText }), isOneClickPayment && vendorName && ((0, jsx_runtime_1.jsx)(react_1.Badge, { variant: "outline", className: "text-as-secondary px-2 py-0.5 text-[10px]", children: vendorName }))] }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-secondary text-[10px] font-medium uppercase tracking-wide", children: (0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.createdAt) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center", isSmallView ? "gap-2" : "gap-4"), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex min-w-0 flex-1 items-center", isSmallView ? "gap-1.5" : "gap-2"), children: [(0, jsx_runtime_1.jsx)("img", { src: order.metadata.srcToken.metadata.logoURI, alt: order.metadata.srcToken.symbol, className: (0, utils_1.cn)("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8") }), (0, jsx_runtime_1.jsxs)("div", { className: "min-w-0 flex-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm"), children: [(0, number_1.formatTokenAmount)(BigInt(order.srcAmount), order.metadata.srcToken.decimals), " ", order.metadata.srcToken.symbol] }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs"), children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: "h-3 w-3" }), (0, jsx_runtime_1.jsx)("span", { className: "truncate", children: (0, anyspend_1.getChainName)(order.srcChain) })] })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRight, { className: (0, utils_1.cn)("text-as-secondary shrink-0 opacity-30", isSmallView ? "h-4 w-4" : "h-5 w-5") }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex min-w-0 flex-1 items-center", isSmallView ? "gap-1.5" : "gap-2"), children: nft ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: nft.imageUrl, alt: nft.name, className: (0, utils_1.cn)("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8") }), (0, jsx_runtime_1.jsxs)("div", { className: "min-w-0 flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm"), children: nft.name }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs"), children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: "h-3 w-3" }), (0, jsx_runtime_1.jsx)("span", { className: "truncate", children: (0, anyspend_1.getChainName)(order.dstChain) })] })] })] })) : tournament ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: tournament.imageUrl, alt: tournament.name, className: (0, utils_1.cn)("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8") }), (0, jsx_runtime_1.jsxs)("div", { className: "min-w-0 flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm"), children: tournament.name }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs"), children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: "h-3 w-3" }), (0, jsx_runtime_1.jsx)("span", { className: "truncate", children: (0, anyspend_1.getChainName)(order.dstChain) })] })] })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: dstToken.metadata.logoURI, alt: dstToken.symbol, className: (0, utils_1.cn)("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8") }), (0, jsx_runtime_1.jsxs)("div", { className: "min-w-0 flex-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm"), children: [(0, number_1.formatTokenAmount)(actualDstAmount
29
32
  ? BigInt(actualDstAmount)
30
33
  : expectedDstAmount
31
34
  ? BigInt(expectedDstAmount)
32
- : BigInt(0), dstToken.decimals), " ", dstToken.symbol] })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: "label-style text-as-primary/50 flex items-center gap-2 text-sm", children: ["to", (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("h-4", order.dstChain !== chains_1.b3.id && "w-4 rounded-full", order.dstChain === chains_1.b3.id && "h-3") }), (0, anyspend_1.getChainName)(order.dstChain)] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-end", children: (0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "link", size: "sm", className: "h-auto", onClick: () => onSelectOrder?.(order.id), children: [orderDisplayStatus === "processing" ? "Proceed with payment" : "Details", " ", (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRight, { className: "ml-2 h-3 w-3" })] }) })] }, `anyspend-${order.id}`));
35
+ : BigInt(0), dstToken.decimals), " ", dstToken.symbol] }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs"), children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain]?.logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: "h-3 w-3" }), (0, jsx_runtime_1.jsx)("span", { className: "truncate", children: (0, anyspend_1.getChainName)(order.dstChain) })] })] })] })) })] })] }, `anyspend-${order.id}`));
33
36
  }