@b3dotfun/sdk 0.0.87-alpha.1 → 0.0.87

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 (90) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -5
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +49 -59
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +2 -1
  5. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +12 -17
  6. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
  7. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +5 -12
  8. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  9. package/dist/cjs/anyspend/react/components/index.d.ts +0 -2
  10. package/dist/cjs/anyspend/react/components/index.js +1 -3
  11. package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
  12. package/dist/cjs/anyspend/react/hooks/index.js +0 -1
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  14. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +11 -35
  15. package/dist/cjs/anyspend/utils/format.js +5 -28
  16. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -4
  17. package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -5
  18. package/dist/esm/anyspend/react/components/AnySpend.js +49 -59
  19. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  20. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +2 -1
  21. package/dist/esm/anyspend/react/components/common/OrderDetails.js +12 -17
  22. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
  23. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +5 -12
  24. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  25. package/dist/esm/anyspend/react/components/index.d.ts +0 -2
  26. package/dist/esm/anyspend/react/components/index.js +0 -1
  27. package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
  28. package/dist/esm/anyspend/react/hooks/index.js +0 -1
  29. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  30. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +11 -35
  31. package/dist/esm/anyspend/utils/format.js +5 -28
  32. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -4
  33. package/dist/styles/index.css +1 -1
  34. package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -5
  35. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  36. package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
  37. package/dist/types/anyspend/react/components/index.d.ts +0 -2
  38. package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
  39. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  40. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -4
  41. package/package.json +1 -1
  42. package/src/anyspend/react/components/AnySpend.tsx +45 -68
  43. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +3 -2
  44. package/src/anyspend/react/components/common/OrderDetails.tsx +8 -26
  45. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +8 -20
  46. package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
  47. package/src/anyspend/react/components/index.ts +0 -2
  48. package/src/anyspend/react/hooks/index.ts +0 -1
  49. package/src/anyspend/react/hooks/useAnyspendFlow.ts +12 -37
  50. package/src/anyspend/utils/format.ts +5 -33
  51. package/src/global-account/react/stores/useModalStore.ts +0 -4
  52. package/src/styles/index.css +0 -2
  53. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
  54. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +0 -190
  55. package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +0 -43
  56. package/dist/cjs/anyspend/react/components/QRDeposit.js +0 -146
  57. package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +0 -32
  58. package/dist/cjs/anyspend/react/components/common/WarningText.js +0 -36
  59. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
  60. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +0 -6
  61. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
  62. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +0 -6
  63. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
  64. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +0 -86
  65. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
  66. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +0 -187
  67. package/dist/esm/anyspend/react/components/QRDeposit.d.ts +0 -43
  68. package/dist/esm/anyspend/react/components/QRDeposit.js +0 -143
  69. package/dist/esm/anyspend/react/components/common/WarningText.d.ts +0 -32
  70. package/dist/esm/anyspend/react/components/common/WarningText.js +0 -32
  71. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
  72. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +0 -2
  73. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
  74. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +0 -2
  75. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
  76. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +0 -83
  77. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
  78. package/dist/types/anyspend/react/components/QRDeposit.d.ts +0 -43
  79. package/dist/types/anyspend/react/components/common/WarningText.d.ts +0 -32
  80. package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
  81. package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
  82. package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
  83. package/src/anyspend/react/components/AnySpendDeposit.tsx +0 -578
  84. package/src/anyspend/react/components/QRDeposit.tsx +0 -348
  85. package/src/anyspend/react/components/common/WarningText.tsx +0 -52
  86. package/src/anyspend/react/components/icons/CreditCardIcon.tsx +0 -25
  87. package/src/anyspend/react/components/icons/QrCodeIcon.tsx +0 -25
  88. package/src/anyspend/react/components/icons/credit-card.svg +0 -5
  89. package/src/anyspend/react/components/icons/qr-code.svg +0 -5
  90. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +0 -110
@@ -28,7 +28,7 @@ var PanelView;
28
28
  PanelView[PanelView["FEE_DETAIL"] = 7] = "FEE_DETAIL";
29
29
  })(PanelView || (exports.PanelView = PanelView = {}));
30
30
  // This hook serves for order hype_duel and custom_exact_in
31
- function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage = 0, disableUrlParamManagement = false, orderType = "hype_duel", }) {
31
+ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, isDepositMode = false, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage = 0, disableUrlParamManagement = false, orderType = "hype_duel", }) {
32
32
  const searchParams = (0, react_2.useSearchParamsSSR)();
33
33
  const router = (0, react_2.useRouter)();
34
34
  // Panel and order state
@@ -135,40 +135,16 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
135
135
  // For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
136
136
  const effectiveDecimals = paymentType === "fiat" ? anyspend_1.USDC_BASE.decimals : selectedSrcToken.decimals;
137
137
  const activeInputAmountInWei = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
138
- // Build quote request based on order type
139
- const quoteRequest = (() => {
140
- const baseParams = {
141
- srcChain: paymentType === "fiat" ? chains_1.base.id : selectedSrcChainId,
142
- dstChain: selectedDstChainId ?? chains_1.base.id,
143
- srcTokenAddress: paymentType === "fiat" ? anyspend_1.USDC_BASE.address : selectedSrcToken.address,
144
- dstTokenAddress: selectedDstToken.address,
145
- recipientAddress: effectiveRecipientAddress,
146
- onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
147
- };
148
- if (orderType === "swap") {
149
- return {
150
- ...baseParams,
151
- type: "swap",
152
- tradeType: "EXACT_INPUT",
153
- amount: activeInputAmountInWei,
154
- };
155
- }
156
- else if (orderType === "hype_duel") {
157
- return {
158
- ...baseParams,
159
- type: "hype_duel",
160
- amount: activeInputAmountInWei,
161
- };
162
- }
163
- else {
164
- return {
165
- ...baseParams,
166
- type: "custom_exact_in",
167
- amount: activeInputAmountInWei,
168
- };
169
- }
170
- })();
171
- const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)(quoteRequest);
138
+ const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)({
139
+ srcChain: paymentType === "fiat" ? chains_1.base.id : selectedSrcChainId,
140
+ dstChain: isDepositMode ? chains_1.base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
141
+ srcTokenAddress: paymentType === "fiat" ? anyspend_1.USDC_BASE.address : selectedSrcToken.address,
142
+ dstTokenAddress: selectedDstToken.address,
143
+ type: orderType,
144
+ amount: activeInputAmountInWei,
145
+ recipientAddress: effectiveRecipientAddress,
146
+ onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
147
+ });
172
148
  // Get geo options for fiat
173
149
  const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(paymentType === "fiat" ? (0, number_1.formatUnits)(activeInputAmountInWei, anyspend_1.USDC_BASE.decimals) : "0");
174
150
  // Update destination amount when quote changes
@@ -1,25 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getErrorDisplay = exports.getStatusDisplay = void 0;
4
- const number_1 = require("../../shared/utils/number");
5
4
  const getStatusDisplay = (order) => {
6
- const srcToken = order.metadata?.srcToken;
7
- const dstToken = order.metadata?.dstToken;
8
- const formattedSrcAmount = srcToken ? (0, number_1.formatTokenAmount)(BigInt(order.srcAmount), srcToken.decimals) : undefined;
9
- const actualDstAmount = order.settlement?.actualDstAmount;
10
- const formattedActualDstAmount = actualDstAmount && dstToken ? (0, number_1.formatTokenAmount)(BigInt(actualDstAmount), dstToken.decimals) : undefined;
11
5
  switch (order.status) {
12
- case "scanning_deposit_transaction": {
13
- const depositText = formattedSrcAmount && srcToken
14
- ? `Awaiting ${formattedSrcAmount} ${srcToken.symbol}`
15
- : order.onrampMetadata
16
- ? "Awaiting Payment"
17
- : "Awaiting Deposit";
6
+ case "scanning_deposit_transaction":
18
7
  return {
19
- text: depositText,
8
+ text: order.onrampMetadata ? "Awaiting Payment" : "Awaiting Deposit",
20
9
  status: "processing",
21
10
  };
22
- }
23
11
  case "waiting_stripe_payment":
24
12
  return {
25
13
  text: "Awaiting Payment",
@@ -42,16 +30,15 @@ const getStatusDisplay = (order) => {
42
30
  description: "It will take approximately one minute to complete.",
43
31
  };
44
32
  case "executed": {
45
- const receivedText = formattedActualDstAmount && dstToken ? `Received ${formattedActualDstAmount} ${dstToken.symbol}` : undefined;
46
33
  const { text, description } = order.type === "swap"
47
- ? { text: receivedText || "Swap Complete", description: "Your swap has been completed successfully." }
34
+ ? { text: "Swap Complete", description: "Your swap has been completed successfully." }
48
35
  : order.type === "mint_nft"
49
36
  ? { text: "NFT Minted", description: "Your NFT has been minted" }
50
37
  : order.type === "join_tournament"
51
38
  ? { text: "Tournament Joined", description: "You have joined the tournament" }
52
39
  : order.type === "fund_tournament"
53
40
  ? { text: "Tournament Funded", description: "You have funded the tournament" }
54
- : { text: receivedText || "Order Complete", description: "Your order has been completed" };
41
+ : { text: "Order Complete", description: "Your order has been completed" };
55
42
  return { text, status: "success", description };
56
43
  }
57
44
  case "refunding":
@@ -64,18 +51,8 @@ const getStatusDisplay = (order) => {
64
51
  status: "failure",
65
52
  description: "This order has failed. Please try again or contact support.",
66
53
  };
67
- case "quoting_after_deposit": {
68
- return {
69
- text: "Quoting After Deposit",
70
- status: "processing",
71
- description: "Getting quote for the order",
72
- };
73
- }
74
54
  default:
75
- return {
76
- text: order.status,
77
- status: "processing",
78
- };
55
+ throw new Error("Invalid order status");
79
56
  }
80
57
  };
81
58
  exports.getStatusDisplay = getStatusDisplay;
@@ -144,10 +144,6 @@ export interface AnySpendModalProps extends BaseModalProps {
144
144
  customUsdInputValues?: string[];
145
145
  /** Client-provided reference ID for tracking orders */
146
146
  clientReferenceId?: string;
147
- /** Whether to hide the header */
148
- hideHeader?: boolean;
149
- /** When true, disables URL parameter management for swap configuration */
150
- disableUrlParamManagement?: boolean;
151
147
  }
152
148
  /**
153
149
  * Props for the AnySpend NFT modal
@@ -20,7 +20,6 @@ export declare enum PanelView {
20
20
  export declare function AnySpend(props: {
21
21
  mode?: "page" | "modal";
22
22
  defaultActiveTab?: "crypto" | "fiat";
23
- sourceChainId?: number;
24
23
  destinationTokenAddress?: string;
25
24
  destinationTokenChainId?: number;
26
25
  recipientAddress?: string;
@@ -35,8 +34,4 @@ export declare function AnySpend(props: {
35
34
  }) => void;
36
35
  onSuccess?: (txHash?: string) => void;
37
36
  customUsdInputValues?: string[];
38
- hideHeader?: boolean;
39
- hideBottomNavigation?: boolean;
40
- /** When true, disables URL parameter management for swap configuration */
41
- disableUrlParamManagement?: boolean;
42
37
  }): import("react/jsx-runtime").JSX.Element;
@@ -50,7 +50,7 @@ export function AnySpend(props) {
50
50
  const fingerprintConfig = getFingerprintConfig();
51
51
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
52
52
  }
53
- function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, }) {
53
+ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
54
54
  const searchParams = useSearchParamsSSR();
55
55
  const router = useRouter();
56
56
  const { partnerId } = useB3();
@@ -90,7 +90,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
90
90
  // const [newRecipientAddress, setNewRecipientAddress] = useState("");
91
91
  // const recipientInputRef = useRef<HTMLInputElement>(null);
92
92
  // Get initial chain IDs from URL or defaults
93
- const initialSrcChainId = sourceChainId || parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
93
+ const initialSrcChainId = parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
94
94
  const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") || (isBuyMode ? destinationTokenChainId : base.id);
95
95
  // State for source chain/token selection
96
96
  const [selectedSrcChainId, setSelectedSrcChainId] = useState(initialSrcChainId);
@@ -183,8 +183,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
183
183
  }, [selectedDstToken.address, selectedDstToken.chainId]);
184
184
  // Load swap configuration from URL on initial render
185
185
  useEffect(() => {
186
- // Skip if we've already processed the URL, if we have an order to load, or if URL param management is disabled
187
- if (initialUrlProcessed.current || loadOrder || disableUrlParamManagement)
186
+ // Skip if we've already processed the URL or if we have an order to load
187
+ if (initialUrlProcessed.current || loadOrder)
188
188
  return;
189
189
  try {
190
190
  const tabParam = searchParams.get("tab");
@@ -217,7 +217,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
217
217
  }
218
218
  // Mark that we've processed the initial URL
219
219
  initialUrlProcessed.current = true;
220
- }, [searchParams, loadOrder, disableUrlParamManagement]);
220
+ }, [searchParams, loadOrder]);
221
221
  // Update URL when swap configuration changes - but not on initial load
222
222
  const updateSwapParamsInURL = useCallback(() => {
223
223
  // Skip if:
@@ -228,8 +228,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
228
228
  activePanel !== PanelView.MAIN ||
229
229
  !initialUrlProcessed.current ||
230
230
  searchParams.has("orderId") ||
231
- mode === "modal" ||
232
- disableUrlParamManagement)
231
+ mode === "modal")
233
232
  return;
234
233
  // Create a representation of the current state
235
234
  const currentState = {
@@ -289,7 +288,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
289
288
  dstAmount,
290
289
  router,
291
290
  srcAmountOnRamp,
292
- disableUrlParamManagement,
293
291
  ]);
294
292
  // Update URL when relevant state changes - but only after initial render
295
293
  useEffect(() => {
@@ -475,20 +473,20 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
475
473
  setOrderId(orderId);
476
474
  // setNewRecipientAddress("");
477
475
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
478
- if (!disableUrlParamManagement) {
479
- // Debug: Check payment method before setting URL
480
- console.log("Creating order - selectedCryptoPaymentMethod:", selectedCryptoPaymentMethod);
481
- // Add orderId and payment method to URL for persistence
482
- const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
483
- params.set("orderId", orderId);
484
- if (effectiveCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
485
- params.set("cryptoPaymentMethod", effectiveCryptoPaymentMethod);
486
- }
487
- else {
488
- console.log("Payment method is NONE, not setting in URL");
489
- }
490
- router.push(`${window.location.pathname}?${params.toString()}`);
476
+ // Debug: Check payment method before setting URL
477
+ console.log("Creating order - selectedCryptoPaymentMethod:", selectedCryptoPaymentMethod);
478
+ // Add orderId and payment method to URL for persistence
479
+ const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
480
+ params.set("orderId", orderId);
481
+ if (effectiveCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
482
+ console.log("Setting cryptoPaymentMethod in URL:", effectiveCryptoPaymentMethod);
483
+ params.set("cryptoPaymentMethod", effectiveCryptoPaymentMethod);
484
+ }
485
+ else {
486
+ console.log("Payment method is NONE, not setting in URL");
491
487
  }
488
+ console.log("Final URL params:", params.toString());
489
+ router.push(`${window.location.pathname}?${params.toString()}`);
492
490
  },
493
491
  onError: error => {
494
492
  console.error(error);
@@ -501,13 +499,11 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
501
499
  const orderId = data.data.id;
502
500
  setOrderId(orderId);
503
501
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
504
- if (!disableUrlParamManagement) {
505
- // Add orderId and payment method to URL for persistence
506
- const params = new URLSearchParams(searchParams.toString());
507
- params.set("orderId", orderId);
508
- params.set("paymentMethod", "fiat");
509
- router.push(`${window.location.pathname}?${params.toString()}`);
510
- }
502
+ // Add orderId and payment method to URL for persistence
503
+ const params = new URLSearchParams(searchParams.toString());
504
+ params.set("orderId", orderId);
505
+ params.set("paymentMethod", "fiat");
506
+ router.push(`${window.location.pathname}?${params.toString()}`);
511
507
  },
512
508
  onError: error => {
513
509
  console.error(error);
@@ -635,13 +631,11 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
635
631
  type: "anySpendOrderHistory",
636
632
  showBackButton: false,
637
633
  });
638
- if (!disableUrlParamManagement) {
639
- // Remove orderId and paymentMethod from URL when going back to history
640
- const params = new URLSearchParams(searchParams.toString());
641
- params.delete("orderId");
642
- params.delete("paymentMethod");
643
- router.push(`${window.location.pathname}?${params.toString()}`);
644
- }
634
+ // Remove orderId and paymentMethod from URL when going back to history
635
+ const params = new URLSearchParams(searchParams.toString());
636
+ params.delete("orderId");
637
+ params.delete("paymentMethod");
638
+ router.push(`${window.location.pathname}?${params.toString()}`);
645
639
  };
646
640
  // Handle crypto swap creation
647
641
  const handleCryptoSwap = async (method) => {
@@ -750,24 +744,22 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
750
744
  // const setDynamicModalContentType = useModalStore(state => state.setB3ModalContentType);
751
745
  // Update useEffect for URL parameter to not override loadOrder
752
746
  useEffect(() => {
753
- if (loadOrder || disableUrlParamManagement)
754
- return; // Skip if we have a loadOrder or URL param management is disabled
747
+ if (loadOrder)
748
+ return; // Skip if we have a loadOrder
755
749
  const orderIdParam = searchParams.get("orderId");
756
750
  if (orderIdParam) {
757
751
  setOrderId(orderIdParam);
758
752
  setActivePanel(PanelView.ORDER_DETAILS);
759
753
  }
760
- }, [searchParams, loadOrder, disableUrlParamManagement]);
754
+ }, [searchParams, loadOrder]);
761
755
  const onSelectOrder = (selectedOrderId) => {
762
756
  setOrderId(selectedOrderId);
763
757
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
764
- if (!disableUrlParamManagement) {
765
- // Update URL with the new orderId and preserve existing parameters
766
- const params = new URLSearchParams(searchParams.toString());
767
- params.set("orderId", selectedOrderId);
768
- // Keep existing paymentMethod if present
769
- router.push(`${window.location.pathname}?${params.toString()}`);
770
- }
758
+ // Update URL with the new orderId and preserve existing parameters
759
+ const params = new URLSearchParams(searchParams.toString());
760
+ params.set("orderId", selectedOrderId);
761
+ // Keep existing paymentMethod if present
762
+ router.push(`${window.location.pathname}?${params.toString()}`);
771
763
  };
772
764
  // Save custom recipients to local storage when they change
773
765
  useEffect(() => {
@@ -819,7 +811,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
819
811
  // Reset payment methods when going back
820
812
  resetPaymentMethods();
821
813
  } })) }) }));
822
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
814
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
823
815
  setActiveTab(tab);
824
816
  // Reset payment methods when switching tabs
825
817
  resetPaymentMethods();
@@ -874,23 +866,21 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
874
866
  type: "anySpend",
875
867
  });
876
868
  }
877
- }, children: mode !== "page" && !hideBottomNavigation && _jsx(BottomNavigation, {}) }) })] }));
869
+ }, children: mode !== "page" && _jsx(BottomNavigation, {}) }) })] }));
878
870
  const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: effectiveRecipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
879
871
  setOrderId(orderId);
880
872
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
881
- if (!disableUrlParamManagement) {
882
- // Add orderId and payment method to URL for persistence
883
- const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
884
- params.set("orderId", orderId);
885
- // For fiat payments, the payment method is always fiat (but we use the active tab context)
886
- if (activeTab === "fiat") {
887
- params.set("paymentMethod", "fiat");
888
- }
889
- else if (selectedCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
890
- params.set("paymentMethod", selectedCryptoPaymentMethod);
891
- }
892
- router.push(`${window.location.pathname}?${params.toString()}`);
873
+ // Add orderId and payment method to URL for persistence
874
+ const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
875
+ params.set("orderId", orderId);
876
+ // For fiat payments, the payment method is always fiat (but we use the active tab context)
877
+ if (activeTab === "fiat") {
878
+ params.set("paymentMethod", "fiat");
879
+ }
880
+ else if (selectedCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
881
+ params.set("paymentMethod", selectedCryptoPaymentMethod);
893
882
  }
883
+ router.push(`${window.location.pathname}?${params.toString()}`);
894
884
  }, onBack: navigateBack, recipientEnsName: globalWallet?.ensName, recipientImageUrl: globalWalletImage }));
895
885
  const recipientSelectionView = (_jsx(RecipientSelection, { initialValue: effectiveRecipientAddress || "", onBack: navigateBack, onConfirm: address => {
896
886
  // User manually selected a recipient
@@ -26,7 +26,7 @@ export interface AnySpendCustomExactInProps {
26
26
  customUsdInputValues?: string[];
27
27
  preferEoa?: boolean;
28
28
  customExactInConfig?: CustomExactInConfig;
29
- orderType?: "hype_duel" | "custom_exact_in" | "swap";
29
+ orderType?: "hype_duel" | "custom_exact_in";
30
30
  minDestinationAmount?: number;
31
31
  header?: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
32
32
  anyspendPrice: GetQuoteResponse | undefined;
@@ -35,6 +35,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
35
35
  paymentType,
36
36
  recipientAddress,
37
37
  loadOrder,
38
+ isDepositMode: true,
38
39
  onTransactionSuccess: onSuccess,
39
40
  sourceTokenAddress,
40
41
  sourceTokenChainId,
@@ -175,7 +176,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
175
176
  }
176
177
  };
177
178
  const headerContent = header ? (header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote })) : (_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsxs("div", { children: [_jsx("h1", { className: "text-as-primary text-xl font-bold", children: actionLabel }), _jsx("p", { className: "text-as-secondary text-sm", children: "Pay from any token to execute a custom exact-in transaction." })] }) }));
178
- const mainView = (_jsxs("div", { className: "anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [headerContent, _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(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: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: selectedRecipientOrDefault, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: 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: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, effectiveRecipientAddress: selectedRecipientOrDefault, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: selectedDstToken, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: DESTINATION_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
179
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [headerContent, _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(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: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: selectedRecipientOrDefault, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: 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: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, effectiveRecipientAddress: selectedRecipientOrDefault, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: selectedDstToken, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: DESTINATION_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
179
180
  setIsSrcInputDirty(false);
180
181
  setSrcAmount(value);
181
182
  }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(PanelView.FEE_DETAIL) }))] }) }), _jsx(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: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }) }), mainFooter ? mainFooter : null] }));
@@ -31,7 +31,6 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, form
31
31
  let actionText = "";
32
32
  switch (order.type) {
33
33
  case "swap":
34
- case "deposit_first":
35
34
  actionText = `sent ${formattedActualDstAmount || "--"} ${dstToken.symbol}`;
36
35
  return `Successfully ${actionText} to ${recipient}`;
37
36
  case "mint_nft":
@@ -153,7 +152,6 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
153
152
  const { data: walletClient } = useWalletClient();
154
153
  const [txHash, setTxHash] = useState();
155
154
  const [showQRCode, setShowQRCode] = useState(false);
156
- const [orderDetailsOpen, setOrderDetailsOpen] = useState(true);
157
155
  const { isLoading: txLoading, isSuccess: txSuccess } = useWaitForTransactionReceipt({ hash: txHash });
158
156
  const { switchChainAndExecuteWithEOA, switchChainAndExecute, isSwitchingOrExecuting } = useUnifiedChainSwitchAndExecute();
159
157
  // Track if auto-payment was attempted to avoid re-triggering
@@ -322,8 +320,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
322
320
  const expectedDstAmount = order.type === "mint_nft" ||
323
321
  order.type === "join_tournament" ||
324
322
  order.type === "fund_tournament" ||
325
- order.type === "custom" ||
326
- order.type === "deposit_first"
323
+ order.type === "custom"
327
324
  ? "0"
328
325
  : order.payload.expectedDstAmount.toString();
329
326
  const formattedExpectedDstAmount = formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
@@ -332,7 +329,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
332
329
  ? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals)
333
330
  : undefined;
334
331
  if (refundTxs.length > 0) {
335
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
332
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
336
333
  ? depositTxs.map(dTx => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
337
334
  ? `Received payment`
338
335
  : `Received ${formatTokenAmount(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
@@ -341,13 +338,13 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
341
338
  : null] }) })] }) }), order.errorDetails && (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: getErrorDisplay(order.errorDetails) }) })), _jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
342
339
  }
343
340
  if (executeTx) {
344
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
341
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
345
342
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
346
343
  ? `Received payment`
347
344
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
348
345
  : null, relayTxs
349
- ? relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed Swap", chainId: relayTx.chain, tx: relayTx, delay: 0.5, isProcessing: false }, relayTx.txHash)))
350
- : null, _jsx(TransactionDetails, { title: order.type === "swap" || order.type === "deposit_first"
346
+ ? relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed Transaction", chainId: relayTx.chain, tx: relayTx, delay: 0.5, isProcessing: false }, relayTx.txHash)))
347
+ : null, _jsx(TransactionDetails, { title: order.type === "swap"
351
348
  ? "Processed Swap"
352
349
  : order.type === "mint_nft"
353
350
  ? "Minted NFT"
@@ -366,14 +363,12 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
366
363
  }), _jsx(ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && (_jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [_jsx("span", { className: "pl-4", children: "Continue to Tournament" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && (_jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
367
364
  }
368
365
  if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
369
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "more-details", className: "order-details-more-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
366
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "more-details", className: "order-details-more-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
370
367
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
371
368
  ? `Received payment`
372
369
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
373
- : null, relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: relayTx.chain === order.srcChain
374
- ? `Process swap on ${getChainName(relayTx.chain)}`
375
- : `Received on ${getChainName(relayTx.chain)}`, chainId: relayTx.chain, isProcessing: false, tx: relayTx, delay: 0.5 }, relayTx.txHash))), order.status === "executing" && (_jsx(TransactionDetails, { title: order.type === "swap" || order.type === "x402_swap" || order.type === "deposit_first"
376
- ? "Processing swap"
370
+ : null, relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed Transaction", chainId: relayTx.chain, isProcessing: false, tx: relayTx, delay: 0.5 }))), order.status === "executing" && (_jsx(TransactionDetails, { title: order.type === "swap" || order.type === "x402_swap"
371
+ ? "Processing Swap"
377
372
  : order.type === "mint_nft"
378
373
  ? "Minting NFT"
379
374
  : order.type === "join_tournament"
@@ -389,10 +384,10 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
389
384
  // This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
390
385
  const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
391
386
  if (depositTxs?.length || waitingForDeposit) {
392
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-6", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
387
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-6", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
393
388
  ? `Received payment`
394
- : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? (_jsx(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? (_jsx(TransactionDetails, { title: order.type === "swap" || order.type === "deposit_first"
395
- ? "Processing swap"
389
+ : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? (_jsx(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? (_jsx(TransactionDetails, { title: order.type === "swap"
390
+ ? "Processing Swap"
396
391
  : order.type === "mint_nft"
397
392
  ? "Minting NFT"
398
393
  : order.type === "join_tournament"
@@ -416,7 +411,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
416
411
  ? centerTruncate(phantomWalletAddress, 6)
417
412
  : centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
418
413
  // Default case - existing QR code flow
419
- _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen })), _jsxs("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
414
+ _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), _jsxs("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
420
415
  });
421
416
  function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
422
417
  return (_jsxs("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [_jsxs("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [_jsx(motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: _jsx(Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: _jsx(CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), _jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? (_jsx(TextShimmer, { duration: 1, children: title })) : (_jsx("span", { className: "text-as-primary", children: title })) })] }), _jsx("div", { className: "flex flex-col gap-1", children: tx ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: _jsx("a", { href: getExplorerTxUrl(chainId, tx.txHash), target: "_blank", children: _jsx("div", { className: "text-as-primary/30 font-mono text-xs", children: centerTruncate(tx?.txHash, 6) }) }) })) : null })] }));
@@ -14,8 +14,6 @@ interface OrderDetailsCollapsibleProps {
14
14
  showTotal?: boolean;
15
15
  totalAmount?: string;
16
16
  points?: number;
17
- isOpen?: boolean;
18
- onOpenChange?: (isOpen: boolean) => void;
19
17
  }
20
18
  export declare const OrderDetailsCollapsible: import("react").NamedExoticComponent<OrderDetailsCollapsibleProps>;
21
19
  export {};