@b3dotfun/sdk 0.0.14-alpha.2 → 0.0.14-alpha.3

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 (64) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +38 -38
  2. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +18 -18
  3. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +22 -22
  4. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +22 -22
  5. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +7 -7
  6. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +21 -21
  7. package/dist/cjs/anyspend/react/components/AnySpendTournament.js +2 -2
  8. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +24 -24
  9. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -4
  10. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +6 -6
  11. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +12 -12
  12. package/dist/cjs/global-account/react/components/ProfileAvatar.js +1 -1
  13. package/dist/cjs/global-account/react/components/custom/StaggeredFadeLoader.js +2 -2
  14. package/dist/cjs/global-account/react/components/magicui/AnimatedLottie.js +12 -12
  15. package/dist/cjs/global-account/react/components/ui/TabSystem.js +11 -11
  16. package/dist/cjs/global-account/react/components/ui/text-loop.d.ts +1 -1
  17. package/dist/cjs/global-account/react/components/ui/text-loop.js +6 -6
  18. package/dist/cjs/global-account/react/components/ui/text-shimmer.js +4 -4
  19. package/dist/cjs/global-account/react/components/ui/transition-panel.d.ts +1 -1
  20. package/dist/cjs/global-account/react/components/ui/transition-panel.js +2 -2
  21. package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.js +6 -6
  22. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  23. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +1 -1
  24. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +1 -1
  25. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  26. package/dist/esm/anyspend/react/components/AnySpendNFT.js +1 -1
  27. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +1 -1
  28. package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -1
  29. package/dist/esm/anyspend/react/components/common/OrderDetails.js +1 -1
  30. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +1 -1
  31. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
  32. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -1
  33. package/dist/esm/global-account/react/components/ProfileAvatar.js +1 -1
  34. package/dist/esm/global-account/react/components/custom/StaggeredFadeLoader.js +1 -1
  35. package/dist/esm/global-account/react/components/magicui/AnimatedLottie.js +1 -1
  36. package/dist/esm/global-account/react/components/ui/TabSystem.js +1 -1
  37. package/dist/esm/global-account/react/components/ui/text-loop.d.ts +1 -1
  38. package/dist/esm/global-account/react/components/ui/text-loop.js +1 -1
  39. package/dist/esm/global-account/react/components/ui/text-shimmer.js +1 -1
  40. package/dist/esm/global-account/react/components/ui/transition-panel.d.ts +1 -1
  41. package/dist/esm/global-account/react/components/ui/transition-panel.js +1 -1
  42. package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +1 -1
  43. package/dist/types/global-account/react/components/ui/text-loop.d.ts +1 -1
  44. package/dist/types/global-account/react/components/ui/transition-panel.d.ts +1 -1
  45. package/package.json +3 -4
  46. package/src/anyspend/react/components/AnySpend.tsx +1 -1
  47. package/src/anyspend/react/components/AnySpendBondKit.tsx +1 -1
  48. package/src/anyspend/react/components/AnySpendBuySpin.tsx +1 -1
  49. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
  50. package/src/anyspend/react/components/AnySpendNFT.tsx +1 -1
  51. package/src/anyspend/react/components/AnySpendStakeB3.tsx +1 -1
  52. package/src/anyspend/react/components/AnySpendTournament.tsx +3 -3
  53. package/src/anyspend/react/components/common/OrderDetails.tsx +1 -1
  54. package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -1
  55. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -1
  56. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +1 -1
  57. package/src/global-account/react/components/ProfileAvatar.tsx +1 -1
  58. package/src/global-account/react/components/custom/StaggeredFadeLoader.tsx +1 -1
  59. package/src/global-account/react/components/magicui/AnimatedLottie.tsx +1 -1
  60. package/src/global-account/react/components/ui/TabSystem.tsx +1 -1
  61. package/src/global-account/react/components/ui/text-loop.tsx +1 -1
  62. package/src/global-account/react/components/ui/text-shimmer.tsx +1 -1
  63. package/src/global-account/react/components/ui/transition-panel.tsx +1 -1
  64. package/src/global-account/react/hooks/useChainSwitchWithAction.ts +1 -1
@@ -13,10 +13,10 @@ const react_2 = require("../../../global-account/react");
13
13
  const cn_1 = require("../../../shared/utils/cn");
14
14
  const formatAddress_1 = require("../../../shared/utils/formatAddress");
15
15
  const number_1 = require("../../../shared/utils/number");
16
- const framer_motion_1 = require("framer-motion");
17
16
  const invariant_1 = __importDefault(require("invariant"));
18
17
  const lucide_react_1 = require("lucide-react");
19
- const react_3 = require("react");
18
+ const react_3 = require("motion/react");
19
+ const react_4 = require("react");
20
20
  const sonner_1 = require("sonner");
21
21
  const viem_1 = require("viem");
22
22
  const chains_1 = require("viem/chains");
@@ -43,14 +43,14 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
43
43
  // Determine if we're in "buy mode" based on whether destination token props are provided
44
44
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
45
45
  // Add refs to track URL state
46
- const initialUrlProcessed = (0, react_3.useRef)(false);
47
- const lastUrlUpdate = (0, react_3.useRef)(null);
48
- const [activeTab, setActiveTab] = (0, react_3.useState)(defaultActiveTab);
49
- const [orderId, setOrderId] = (0, react_3.useState)(loadOrder);
46
+ const initialUrlProcessed = (0, react_4.useRef)(false);
47
+ const lastUrlUpdate = (0, react_4.useRef)(null);
48
+ const [activeTab, setActiveTab] = (0, react_4.useState)(defaultActiveTab);
49
+ const [orderId, setOrderId] = (0, react_4.useState)(loadOrder);
50
50
  const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, react_1.useAnyspendOrderAndTransactions)(isMainnet, orderId);
51
51
  !!getOrderAndTransactionsError && console.log("getOrderAndTransactionsError", getOrderAndTransactionsError);
52
- const [activePanel, setActivePanel] = (0, react_3.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
53
- const [customRecipients, setCustomRecipients] = (0, react_3.useState)([]);
52
+ const [activePanel, setActivePanel] = (0, react_4.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
53
+ const [customRecipients, setCustomRecipients] = (0, react_4.useState)([]);
54
54
  // const [newRecipientAddress, setNewRecipientAddress] = useState("");
55
55
  // const recipientInputRef = useRef<HTMLInputElement>(null);
56
56
  // Get initial chain IDs from URL or defaults
@@ -58,19 +58,19 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
58
58
  const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") ||
59
59
  (isBuyMode ? destinationTokenChainId : isMainnet ? chains_1.base.id : chains_1.b3Sepolia.id);
60
60
  // State for source chain/token selection
61
- const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_3.useState)(initialSrcChainId);
61
+ const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_4.useState)(initialSrcChainId);
62
62
  const defaultSrcToken = (0, anyspend_1.getDefaultToken)(selectedSrcChainId);
63
63
  const srcTokenFromUrl = (0, react_2.useTokenFromUrl)({
64
64
  defaultToken: defaultSrcToken,
65
65
  prefix: "from",
66
66
  });
67
- const [selectedSrcToken, setSelectedSrcToken] = (0, react_3.useState)(srcTokenFromUrl);
67
+ const [selectedSrcToken, setSelectedSrcToken] = (0, react_4.useState)(srcTokenFromUrl);
68
68
  const { data: srcTokenMetadata } = (0, react_2.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
69
- const [srcAmount, setSrcAmount] = (0, react_3.useState)(searchParams.get("fromAmount") || "0.01");
69
+ const [srcAmount, setSrcAmount] = (0, react_4.useState)(searchParams.get("fromAmount") || "0.01");
70
70
  // State for onramp amount
71
- const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_3.useState)(searchParams.get("fromAmount") || "5");
71
+ const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_4.useState)(searchParams.get("fromAmount") || "5");
72
72
  // State for destination chain/token selection
73
- const [selectedDstChainId, setSelectedDstChainId] = (0, react_3.useState)(initialDstChainId);
73
+ const [selectedDstChainId, setSelectedDstChainId] = (0, react_4.useState)(initialDstChainId);
74
74
  const defaultDstToken = isBuyMode
75
75
  ? {
76
76
  symbol: "",
@@ -85,15 +85,15 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
85
85
  defaultToken: defaultDstToken,
86
86
  prefix: "to",
87
87
  });
88
- const [selectedDstToken, setSelectedDstToken] = (0, react_3.useState)(isBuyMode ? defaultDstToken : dstTokenFromUrl);
88
+ const [selectedDstToken, setSelectedDstToken] = (0, react_4.useState)(isBuyMode ? defaultDstToken : dstTokenFromUrl);
89
89
  const { data: dstTokenMetadata } = (0, react_2.useTokenData)(selectedDstToken?.chainId, selectedDstToken?.address);
90
- const [dstAmount, setDstAmount] = (0, react_3.useState)(searchParams.get("toAmount") || "");
91
- const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_3.useState)(true);
90
+ const [dstAmount, setDstAmount] = (0, react_4.useState)(searchParams.get("toAmount") || "");
91
+ const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_4.useState)(true);
92
92
  // Add refs to track if we've applied metadata
93
- const appliedSrcMetadataRef = (0, react_3.useRef)(false);
94
- const appliedDstMetadataRef = (0, react_3.useRef)(false);
93
+ const appliedSrcMetadataRef = (0, react_4.useRef)(false);
94
+ const appliedDstMetadataRef = (0, react_4.useRef)(false);
95
95
  // Update source token with metadata
96
- (0, react_3.useEffect)(() => {
96
+ (0, react_4.useEffect)(() => {
97
97
  if (selectedSrcToken && srcTokenMetadata && !appliedSrcMetadataRef.current) {
98
98
  // Mark as applied
99
99
  appliedSrcMetadataRef.current = true;
@@ -111,11 +111,11 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
111
111
  }
112
112
  }, [srcTokenMetadata, selectedSrcToken]);
113
113
  // Reset source token ref when address/chain changes
114
- (0, react_3.useEffect)(() => {
114
+ (0, react_4.useEffect)(() => {
115
115
  appliedSrcMetadataRef.current = false;
116
116
  }, [selectedSrcToken.address, selectedSrcToken.chainId]);
117
117
  // Update destination token with metadata
118
- (0, react_3.useEffect)(() => {
118
+ (0, react_4.useEffect)(() => {
119
119
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
120
120
  // Mark as applied
121
121
  appliedDstMetadataRef.current = true;
@@ -133,11 +133,11 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
133
133
  }
134
134
  }, [dstTokenMetadata, selectedDstToken]);
135
135
  // Reset destination token ref when address/chain changes
136
- (0, react_3.useEffect)(() => {
136
+ (0, react_4.useEffect)(() => {
137
137
  appliedDstMetadataRef.current = false;
138
138
  }, [selectedDstToken.address, selectedDstToken.chainId]);
139
139
  // Load swap configuration from URL on initial render
140
- (0, react_3.useEffect)(() => {
140
+ (0, react_4.useEffect)(() => {
141
141
  // Skip if we've already processed the URL or if we have an order to load
142
142
  if (initialUrlProcessed.current || loadOrder)
143
143
  return;
@@ -174,7 +174,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
174
174
  initialUrlProcessed.current = true;
175
175
  }, [searchParams, loadOrder]);
176
176
  // Update URL when swap configuration changes - but not on initial load
177
- const updateSwapParamsInURL = (0, react_3.useCallback)(() => {
177
+ const updateSwapParamsInURL = (0, react_4.useCallback)(() => {
178
178
  // Skip if:
179
179
  // 1. There's an active order or orderId in the URL
180
180
  // 2. We're not on the main panel
@@ -245,7 +245,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
245
245
  srcAmountOnRamp,
246
246
  ]);
247
247
  // Update URL when relevant state changes - but only after initial render
248
- (0, react_3.useEffect)(() => {
248
+ (0, react_4.useEffect)(() => {
249
249
  // Skip the URL update on first render
250
250
  if (initialUrlProcessed.current) {
251
251
  updateSwapParamsInURL();
@@ -276,10 +276,10 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
276
276
  // [selectedDstChainId, newRecipientAddress, resolvedAddress]
277
277
  // );
278
278
  // State for recipient selection
279
- const [recipientAddress, setRecipientAddress] = (0, react_3.useState)();
279
+ const [recipientAddress, setRecipientAddress] = (0, react_4.useState)();
280
280
  const { address: globalAddress, wallet: globalWallet } = (0, react_2.useAccountWallet)();
281
281
  // Set default recipient address when wallet changes
282
- (0, react_3.useEffect)(() => {
282
+ (0, react_4.useEffect)(() => {
283
283
  setRecipientAddress(recipientAddressFromProps || globalAddress);
284
284
  }, [recipientAddressFromProps, globalAddress]);
285
285
  // Get anyspend price
@@ -309,7 +309,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
309
309
  const recipientProfile = (0, react_2.useProfile)({ address: recipientAddress });
310
310
  const recipientName = recipientProfile.data?.name?.replace(/\.b3\.fun/g, "");
311
311
  // Load custom recipients from local storage on mount
312
- (0, react_3.useEffect)(() => {
312
+ (0, react_4.useEffect)(() => {
313
313
  try {
314
314
  const savedRecipients = localStorage.getItem(ANYSPEND_RECIPIENTS_KEY);
315
315
  if (savedRecipients) {
@@ -440,7 +440,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
440
440
  // }
441
441
  // };
442
442
  // Update dependent amount when relay price changes
443
- (0, react_3.useEffect)(() => {
443
+ (0, react_4.useEffect)(() => {
444
444
  if (anyspendQuote?.data &&
445
445
  anyspendQuote.data.currencyIn?.amount &&
446
446
  anyspendQuote.data.currencyIn?.currency?.decimals &&
@@ -483,7 +483,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
483
483
  },
484
484
  });
485
485
  // Determine button state and text
486
- const btnInfo = (0, react_3.useMemo)(() => {
486
+ const btnInfo = (0, react_4.useMemo)(() => {
487
487
  if (activeInputAmountInWei === "0")
488
488
  return { text: "Enter an amount", disable: true, error: false };
489
489
  if (isLoadingAnyspendQuote)
@@ -555,7 +555,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
555
555
  // const setIsDynamicModalOpen = useModalStore(state => state.setB3ModalOpen);
556
556
  // const setDynamicModalContentType = useModalStore(state => state.setB3ModalContentType);
557
557
  // Update useEffect for URL parameter to not override loadOrder
558
- (0, react_3.useEffect)(() => {
558
+ (0, react_4.useEffect)(() => {
559
559
  if (loadOrder)
560
560
  return; // Skip if we have a loadOrder
561
561
  const orderIdParam = searchParams.get("orderId");
@@ -573,7 +573,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
573
573
  router.push(`${window.location.pathname}?${params.toString()}`);
574
574
  };
575
575
  // Save custom recipients to local storage when they change
576
- (0, react_3.useEffect)(() => {
576
+ (0, react_4.useEffect)(() => {
577
577
  try {
578
578
  localStorage.setItem(ANYSPEND_RECIPIENTS_KEY, JSON.stringify(customRecipients));
579
579
  }
@@ -582,10 +582,10 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
582
582
  }
583
583
  }, [customRecipients]);
584
584
  // Scroll to top when panel changes
585
- (0, react_3.useEffect)(() => {
585
+ (0, react_4.useEffect)(() => {
586
586
  window.scrollTo({ top: 0, behavior: "smooth" });
587
587
  }, [activePanel]);
588
- const [isOpenPasteRecipientAddressModal, setIsOpenPasteRecipientAddressModal] = (0, react_3.useState)(false);
588
+ const [isOpenPasteRecipientAddressModal, setIsOpenPasteRecipientAddressModal] = (0, react_4.useState)(false);
589
589
  const calculatePriceImpact = (inputUsd, outputUsd) => {
590
590
  if (!inputUsd || !outputUsd) {
591
591
  return { percentage: "0.00", isNegative: false };
@@ -613,13 +613,13 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
613
613
  setOrderId(undefined);
614
614
  setActivePanel(PanelView.MAIN);
615
615
  } })] })), mode === "page" && (0, jsx_runtime_1.jsx)("div", { className: "h-12" })] }) }));
616
- const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 relative mx-auto mb-4 grid h-10 w-fit min-w-[180px] grid-cols-2 rounded-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), (0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("relative z-10 h-full w-full rounded-xl px-6 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => setActiveTab("crypto"), children: "Crypto" }), (0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("relative z-10 h-full w-full rounded-xl px-6 text-sm font-medium transition-colors duration-100", activeTab === "fiat" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => setActiveTab("fiat"), children: "Fiat" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsxs)(framer_motion_1.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" }, className: "bg-as-on-surface-1 relative flex w-full flex-col gap-2 rounded-2xl p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Send" }), (0, jsx_runtime_1.jsx)(TokenBalance_1.TokenBalance, { token: selectedSrcToken, walletAddress: globalAddress, onChangeInput: value => {
616
+ const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 relative mx-auto mb-4 grid h-10 w-fit min-w-[180px] grid-cols-2 rounded-xl", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), (0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("relative z-10 h-full w-full rounded-xl px-6 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => setActiveTab("crypto"), children: "Crypto" }), (0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("relative z-10 h-full w-full rounded-xl px-6 text-sm font-medium transition-colors duration-100", activeTab === "fiat" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => setActiveTab("fiat"), children: "Fiat" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((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, ease: "easeInOut" }, className: "bg-as-on-surface-1 relative flex w-full flex-col gap-2 rounded-2xl p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Send" }), (0, jsx_runtime_1.jsx)(TokenBalance_1.TokenBalance, { token: selectedSrcToken, walletAddress: globalAddress, onChangeInput: value => {
617
617
  setIsSrcInputDirty(true);
618
618
  setSrcAmount(value);
619
619
  } })] }), (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: globalAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
620
620
  setIsSrcInputDirty(true);
621
621
  setSrcAmount(value);
622
- }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, { style: "currency", fallback: "" }) })] })) : ((0, jsx_runtime_1.jsx)(framer_motion_1.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: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp }) })), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: (0, cn_1.cn)("bg-as-n-8 border-as-stroke absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-2xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", (activeTab === "fiat" || isBuyMode) && "top-[calc(50%+56px)] cursor-default"), onClick: () => {
622
+ }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, { style: "currency", fallback: "" }) })] })) : ((0, jsx_runtime_1.jsx)(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, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp }) })), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: (0, cn_1.cn)("bg-as-n-8 border-as-stroke absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-2xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", (activeTab === "fiat" || isBuyMode) && "top-[calc(50%+56px)] cursor-default"), onClick: () => {
623
623
  if (activeTab === "fiat" || isBuyMode) {
624
624
  return;
625
625
  }
@@ -638,7 +638,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
638
638
  const tempDstAmount = dstAmount;
639
639
  setSrcAmount(tempDstAmount);
640
640
  setDstAmount(tempSrcAmount);
641
- }, 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" }) }) }), (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "bg-as-on-surface-1 relative flex w-full flex-col gap-2 rounded-2xl p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Receive" }), recipientAddress ? ((0, jsx_runtime_1.jsxs)("button", { className: (0, cn_1.cn)("text-as-primary/50 flex h-7 items-center gap-1 rounded-lg px-2", globalAddress && recipientAddress === globalAddress
641
+ }, 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" }) }) }), (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.1, ease: "easeInOut" }, className: "bg-as-on-surface-1 relative flex w-full flex-col gap-2 rounded-2xl p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Receive" }), recipientAddress ? ((0, jsx_runtime_1.jsxs)("button", { className: (0, cn_1.cn)("text-as-primary/50 flex h-7 items-center gap-1 rounded-lg px-2", globalAddress && recipientAddress === globalAddress
642
642
  ? "bg-as-on-surface-2 hover:bg-as-on-surface-3"
643
643
  : "bg-as-yellow/70 hover:bg-as-yellow text-as-primary"), onClick: () => setIsOpenPasteRecipientAddressModal(true), children: [globalAddress && recipientAddress === globalAddress && globalWallet?.meta?.icon ? ((0, jsx_runtime_1.jsx)("img", { src: globalWallet?.meta?.icon, alt: "Current wallet", className: "bg-as-primary h-4 w-4 rounded-full" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ClipboardIcon, { className: "h-4 w-4" })), (0, jsx_runtime_1.jsx)("div", { className: "text-sm", children: recipientName ? recipientName : (0, formatAddress_1.shortenAddress)(recipientAddress) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-3 w-3" })] })) : ((0, jsx_runtime_1.jsxs)("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setIsOpenPasteRecipientAddressModal(true), children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: "Select recipient" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-3 w-3" })] }))] }), isBuyMode ? (
644
644
  // Fixed destination token display in buy mode
@@ -657,7 +657,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
657
657
  }
658
658
  // Using inline style to ensure color displays
659
659
  return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
660
- })()] })] })] }), getAnyspendQuoteError && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl p-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CircleAlert, { className: "bg-as-red h-4 min-h-4 w-4 min-w-4 rounded-full p-0 text-sm font-medium text-white" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), (0, jsx_runtime_1.jsxs)(framer_motion_1.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: "flex w-full max-w-[460px] flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("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, !btnInfo.disable && !btnInfo.error && ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" }))] }), !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" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-full" }))] })] }));
660
+ })()] })] })] }), getAnyspendQuoteError && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl p-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CircleAlert, { className: "bg-as-red h-4 min-h-4 w-4 min-w-4 rounded-full p-0 text-sm font-medium text-white" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), (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: "flex w-full max-w-[460px] flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("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, !btnInfo.disable && !btnInfo.error && ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" }))] }), !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" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-full" }))] })] }));
661
661
  const onrampPaymentView = ((0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
662
662
  setOrderId(orderId);
663
663
  setActivePanel(PanelView.ORDER_DETAILS);
@@ -5,8 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const bondkit_1 = require("@b3dotfun/bondkit");
6
6
  const react_1 = require("../../../global-account/react");
7
7
  const supported_1 = require("../../../shared/constants/chains/supported");
8
- const framer_motion_1 = require("framer-motion");
9
- const react_2 = require("react");
8
+ const react_2 = require("motion/react");
9
+ const react_3 = require("react");
10
10
  const viem_1 = require("viem");
11
11
  const bondKit_1 = require("../../abis/bondKit");
12
12
  const AnySpendCustom_1 = require("./AnySpendCustom");
@@ -26,16 +26,16 @@ function formatNumberWithCommas(x) {
26
26
  }
27
27
  function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, ethAmount: initialEthAmount, onSuccess, }) {
28
28
  const hasMounted = (0, react_1.useHasMounted)();
29
- const [showAmountPrompt, setShowAmountPrompt] = (0, react_2.useState)(!initialEthAmount);
30
- const [ethAmount, setEthAmount] = (0, react_2.useState)(initialEthAmount || "");
31
- const [isAmountValid, setIsAmountValid] = (0, react_2.useState)(!!initialEthAmount);
32
- const [validationError, setValidationError] = (0, react_2.useState)("");
33
- const [tokenName, setTokenName] = (0, react_2.useState)("");
34
- const [tokenSymbol, setTokenSymbol] = (0, react_2.useState)("");
35
- const [quote, setQuote] = (0, react_2.useState)(null);
36
- const [isLoadingQuote, setIsLoadingQuote] = (0, react_2.useState)(false);
29
+ const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!initialEthAmount);
30
+ const [ethAmount, setEthAmount] = (0, react_3.useState)(initialEthAmount || "");
31
+ const [isAmountValid, setIsAmountValid] = (0, react_3.useState)(!!initialEthAmount);
32
+ const [validationError, setValidationError] = (0, react_3.useState)("");
33
+ const [tokenName, setTokenName] = (0, react_3.useState)("");
34
+ const [tokenSymbol, setTokenSymbol] = (0, react_3.useState)("");
35
+ const [quote, setQuote] = (0, react_3.useState)(null);
36
+ const [isLoadingQuote, setIsLoadingQuote] = (0, react_3.useState)(false);
37
37
  // Create BondKit client
38
- const bondkitTokenClient = (0, react_2.useMemo)(() => {
38
+ const bondkitTokenClient = (0, react_3.useMemo)(() => {
39
39
  if (!contractAddress)
40
40
  return null;
41
41
  try {
@@ -54,7 +54,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
54
54
  transport: (0, viem_1.http)(),
55
55
  });
56
56
  // Fetch token name from contract
57
- (0, react_2.useEffect)(() => {
57
+ (0, react_3.useEffect)(() => {
58
58
  async function fetchTokenName() {
59
59
  try {
60
60
  const [name, symbol] = await Promise.all([
@@ -85,7 +85,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
85
85
  // Get native token data for the chain
86
86
  const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "0x0000000000000000000000000000000000000000");
87
87
  // Convert token data to AnySpend Token type
88
- const dstToken = (0, react_2.useMemo)(() => {
88
+ const dstToken = (0, react_3.useMemo)(() => {
89
89
  if (!tokenData)
90
90
  return null;
91
91
  return {
@@ -100,7 +100,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
100
100
  };
101
101
  }, [tokenData]);
102
102
  // Debounced quote fetching
103
- const debouncedGetQuote = (0, react_2.useMemo)(() => debounce(async (val) => {
103
+ const debouncedGetQuote = (0, react_3.useMemo)(() => debounce(async (val) => {
104
104
  if (!val || Number(val) <= 0 || !bondkitTokenClient) {
105
105
  setQuote(null);
106
106
  return;
@@ -120,7 +120,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
120
120
  }
121
121
  }, 500), [bondkitTokenClient]);
122
122
  // Fetch initial quote if ethAmount is provided
123
- (0, react_2.useEffect)(() => {
123
+ (0, react_3.useEffect)(() => {
124
124
  if (initialEthAmount && bondkitTokenClient) {
125
125
  debouncedGetQuote(initialEthAmount);
126
126
  }
@@ -179,15 +179,15 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
179
179
  return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-red text-center text-sm", children: ["Failed to fetch native token information for chain ", supported_1.baseMainnet.id, ". Please try again."] }) }) }));
180
180
  }
181
181
  if (showAmountPrompt) {
182
- return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full px-4 pb-2 pt-4", children: [(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
182
+ return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full px-4 pb-2 pt-4", children: [(0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: false, animate: {
183
183
  opacity: hasMounted ? 1 : 0,
184
184
  y: hasMounted ? 0 : 20,
185
185
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
186
- }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "mb-4 flex justify-center", children: imageUrl && ((0, jsx_runtime_1.jsxs)("div", { className: "relative size-16", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-blue-500/20 to-purple-600/20 blur-xl" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCardRounded, { className: "overflow-hidden rounded-full border-none bg-gradient-to-br from-blue-500/10 to-purple-600/10 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsx)("img", { alt: "token preview", className: "size-full rounded-lg object-cover", src: imageUrl }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-[50%] border border-white/20" })] })] })) }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
186
+ }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "mb-4 flex justify-center", children: imageUrl && ((0, jsx_runtime_1.jsxs)("div", { className: "relative size-16", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-blue-500/20 to-purple-600/20 blur-xl" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCardRounded, { className: "overflow-hidden rounded-full border-none bg-gradient-to-br from-blue-500/10 to-purple-600/10 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsx)("img", { alt: "token preview", className: "size-full rounded-lg object-cover", src: imageUrl }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-[50%] border border-white/20" })] })] })) }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: false, animate: {
187
187
  opacity: hasMounted ? 1 : 0,
188
188
  y: hasMounted ? 0 : 20,
189
189
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
190
- }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: (0, jsx_runtime_1.jsxs)("h2", { className: "font-sf-rounded text-as-primary mb-4 text-2xl font-bold", children: ["Buy ", tokenName] }) })] }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
190
+ }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: (0, jsx_runtime_1.jsxs)("h2", { className: "font-sf-rounded text-as-primary mb-4 text-2xl font-bold", children: ["Buy ", tokenName] }) })] }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: false, animate: {
191
191
  opacity: hasMounted ? 1 : 0,
192
192
  y: hasMounted ? 0 : 20,
193
193
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -8,10 +8,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const anyspend_1 = require("../../../anyspend");
9
9
  const react_1 = require("../../../global-account/react");
10
10
  const supported_1 = require("../../../shared/constants/chains/supported");
11
- const framer_motion_1 = require("framer-motion");
12
11
  const invariant_1 = __importDefault(require("invariant"));
13
12
  const lucide_react_1 = require("lucide-react");
14
- const react_2 = require("react");
13
+ const react_2 = require("motion/react");
14
+ const react_3 = require("react");
15
15
  const sonner_1 = require("sonner");
16
16
  const viem_1 = require("viem");
17
17
  const wagmi_1 = require("wagmi");
@@ -94,10 +94,10 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
94
94
  const hasMounted = (0, react_1.useHasMounted)();
95
95
  const { setB3ModalOpen } = (0, react_1.useModalStore)();
96
96
  // Payment config state
97
- const [paymentConfig, setPaymentConfig] = (0, react_2.useState)(null);
98
- const [isLoadingConfig, setIsLoadingConfig] = (0, react_2.useState)(true);
99
- const [configError, setConfigError] = (0, react_2.useState)("");
100
- const [wheelInfo, setWheelInfo] = (0, react_2.useState)(null);
97
+ const [paymentConfig, setPaymentConfig] = (0, react_3.useState)(null);
98
+ const [isLoadingConfig, setIsLoadingConfig] = (0, react_3.useState)(true);
99
+ const [configError, setConfigError] = (0, react_3.useState)("");
100
+ const [wheelInfo, setWheelInfo] = (0, react_3.useState)(null);
101
101
  // Fetch B3 token balance
102
102
  const { formattedBalance: b3Balance, isLoading: isBalanceLoading, rawBalance: b3RawBalance, } = (0, react_1.useTokenBalance)({
103
103
  token: anyspend_1.B3_TOKEN,
@@ -107,8 +107,8 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
107
107
  const { writeContractAsync } = (0, wagmi_1.useWriteContract)();
108
108
  const { switchChainAndExecute } = (0, react_1.useChainSwitchWithAction)();
109
109
  // State for direct buying flow (when user has B3 tokens)
110
- const [isBuying, setIsBuying] = (0, react_2.useState)(false);
111
- const [buyingTxHash, setBuyingTxHash] = (0, react_2.useState)("");
110
+ const [isBuying, setIsBuying] = (0, react_3.useState)(false);
111
+ const [buyingTxHash, setBuyingTxHash] = (0, react_3.useState)("");
112
112
  const { isLoading: isTxPending, isSuccess: isTxSuccess, isError: isTxError, error: txError, } = (0, wagmi_1.useWaitForTransactionReceipt)({
113
113
  hash: buyingTxHash,
114
114
  query: {
@@ -116,7 +116,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
116
116
  },
117
117
  });
118
118
  // Handle transaction status
119
- (0, react_2.useEffect)(() => {
119
+ (0, react_3.useEffect)(() => {
120
120
  if (!buyingTxHash)
121
121
  return;
122
122
  if (isTxSuccess) {
@@ -133,13 +133,13 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
133
133
  }
134
134
  }, [isTxSuccess, isTxError, buyingTxHash, onSuccess, setB3ModalOpen, txError]);
135
135
  // Spin quantity state
136
- const [userSpinQuantity, setUserSpinQuantity] = (0, react_2.useState)("");
137
- const [showAmountPrompt, setShowAmountPrompt] = (0, react_2.useState)(true);
138
- const [isQuantityValid, setIsQuantityValid] = (0, react_2.useState)(false);
139
- const [validationError, setValidationError] = (0, react_2.useState)("");
140
- const [displayQuantity, setDisplayQuantity] = (0, react_2.useState)("");
141
- const [debouncedQuantity, setDebouncedQuantity] = (0, react_2.useState)("");
142
- (0, react_2.useEffect)(() => {
136
+ const [userSpinQuantity, setUserSpinQuantity] = (0, react_3.useState)("");
137
+ const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(true);
138
+ const [isQuantityValid, setIsQuantityValid] = (0, react_3.useState)(false);
139
+ const [validationError, setValidationError] = (0, react_3.useState)("");
140
+ const [displayQuantity, setDisplayQuantity] = (0, react_3.useState)("");
141
+ const [debouncedQuantity, setDebouncedQuantity] = (0, react_3.useState)("");
142
+ (0, react_3.useEffect)(() => {
143
143
  if (prefillQuantity && wheelInfo) {
144
144
  const remainingSpins = wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_;
145
145
  const adjustedQuantity = BigInt(prefillQuantity) > remainingSpins ? remainingSpins.toString() : prefillQuantity;
@@ -149,7 +149,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
149
149
  // Calculate total cost
150
150
  const totalCost = paymentConfig && userSpinQuantity ? paymentConfig.pricePerEntry * BigInt(userSpinQuantity) : BigInt(0);
151
151
  // Fetch payment configuration and wheel info
152
- const fetchPaymentConfig = (0, react_2.useCallback)(async () => {
152
+ const fetchPaymentConfig = (0, react_3.useCallback)(async () => {
153
153
  if (!basePublicClient || !spinwheelContractAddress)
154
154
  return;
155
155
  try {
@@ -199,11 +199,11 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
199
199
  }
200
200
  }, [spinwheelContractAddress]);
201
201
  // Fetch config on mount and when dependencies change
202
- (0, react_2.useEffect)(() => {
202
+ (0, react_3.useEffect)(() => {
203
203
  fetchPaymentConfig();
204
204
  }, [fetchPaymentConfig]);
205
205
  // Debounce the quantity for balance checks
206
- (0, react_2.useEffect)(() => {
206
+ (0, react_3.useEffect)(() => {
207
207
  const timer = setTimeout(() => {
208
208
  setDebouncedQuantity(displayQuantity);
209
209
  }, 500);
@@ -363,18 +363,18 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
363
363
  }
364
364
  };
365
365
  const statusInfo = getStatusMessage();
366
- return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full px-4 pb-2 pt-4", children: [(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
366
+ return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full px-4 pb-2 pt-4", children: [(0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: false, animate: {
367
367
  opacity: hasMounted ? 1 : 0,
368
368
  y: hasMounted ? 0 : 20,
369
369
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
370
- }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: `flex justify-center ${isActive ? "mb-4" : ""}`, children: (0, jsx_runtime_1.jsx)("img", { alt: "B3 Token", loading: "lazy", width: "64", height: "64", decoding: "async", className: "rounded-full", src: "https://cdn.b3.fun/b3-coin-3d.png" }) }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
370
+ }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: `flex justify-center ${isActive ? "mb-4" : ""}`, children: (0, jsx_runtime_1.jsx)("img", { alt: "B3 Token", loading: "lazy", width: "64", height: "64", decoding: "async", className: "rounded-full", src: "https://cdn.b3.fun/b3-coin-3d.png" }) }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: false, animate: {
371
371
  opacity: hasMounted ? 1 : 0,
372
372
  y: hasMounted ? 0 : 20,
373
373
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
374
374
  }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: isActive ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "font-sf-rounded text-as-primary mb-4 text-2xl font-bold", children: (() => {
375
375
  const hasEnoughBalance = b3RawBalance && totalCost <= b3RawBalance;
376
376
  return hasEnoughBalance || !debouncedQuantity ? "Buy Spins" : `Swap & Buy Spins`;
377
- })() }), wheelInfo && ((0, jsx_runtime_1.jsxs)("div", { className: "inline-flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 border-as-brand/10 inline-flex items-center rounded-full border px-3 py-1", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-brand text-sm font-medium", children: [pricePerEntry, " $B3 per spin"] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 border-as-brand/10 inline-flex items-center rounded-full border px-3 py-1", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-brand text-sm font-medium", children: [remainingEntries.toString(), " remaining"] }) })] }))] })) : (statusInfo && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary text-lg font-semibold", children: statusInfo.title }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 mt-2 text-sm", children: statusInfo.message })] }))) })] }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
377
+ })() }), wheelInfo && ((0, jsx_runtime_1.jsxs)("div", { className: "inline-flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 border-as-brand/10 inline-flex items-center rounded-full border px-3 py-1", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-brand text-sm font-medium", children: [pricePerEntry, " $B3 per spin"] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 border-as-brand/10 inline-flex items-center rounded-full border px-3 py-1", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-brand text-sm font-medium", children: [remainingEntries.toString(), " remaining"] }) })] }))] })) : (statusInfo && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary text-lg font-semibold", children: statusInfo.title }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 mt-2 text-sm", children: statusInfo.message })] }))) })] }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: false, animate: {
378
378
  opacity: hasMounted ? 1 : 0,
379
379
  y: hasMounted ? 0 : 20,
380
380
  filter: hasMounted ? "blur(0px)" : "blur(10px)",