@b3dotfun/sdk 0.0.49-alpha.0 → 0.0.49-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +8 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +12 -3
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +10 -3
  5. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
  6. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -2
  7. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  8. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
  9. package/dist/cjs/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
  10. package/dist/cjs/anyspend/react/components/common/FeeBreakDown.js +19 -0
  11. package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
  12. package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +116 -0
  13. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  14. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +36 -21
  15. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
  16. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -2
  17. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
  18. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -0
  19. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -0
  20. package/dist/cjs/anyspend/types/api.d.ts +119 -176
  21. package/dist/cjs/global-account/react/components/ui/tooltip.js +1 -1
  22. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
  23. package/dist/esm/anyspend/react/components/AnySpend.js +8 -4
  24. package/dist/esm/anyspend/react/components/AnySpendCustom.js +14 -5
  25. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +10 -3
  26. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
  27. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -4
  28. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  29. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +4 -4
  30. package/dist/esm/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
  31. package/dist/esm/anyspend/react/components/common/FeeBreakDown.js +16 -0
  32. package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
  33. package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +113 -0
  34. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  35. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +38 -23
  36. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
  37. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +2 -3
  38. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
  39. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -0
  40. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -0
  41. package/dist/esm/anyspend/types/api.d.ts +119 -176
  42. package/dist/esm/global-account/react/components/ui/tooltip.js +1 -1
  43. package/dist/styles/index.css +1 -1
  44. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
  45. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
  46. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  47. package/dist/types/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
  48. package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
  49. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  50. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
  51. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -0
  52. package/dist/types/anyspend/types/api.d.ts +119 -176
  53. package/package.json +1 -1
  54. package/src/anyspend/react/components/AnySpend.tsx +20 -0
  55. package/src/anyspend/react/components/AnySpendCustom.tsx +69 -7
  56. package/src/anyspend/react/components/AnyspendDepositHype.tsx +23 -0
  57. package/src/anyspend/react/components/common/CryptoPaySection.tsx +14 -2
  58. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +14 -2
  59. package/src/anyspend/react/components/common/FeeBreakDown.tsx +105 -0
  60. package/src/anyspend/react/components/common/FeeDetailPanel.tsx +307 -0
  61. package/src/anyspend/react/components/common/PanelOnramp.tsx +58 -27
  62. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +18 -6
  63. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -13
  64. package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -0
  65. package/src/anyspend/types/api.ts +121 -176
  66. package/src/global-account/react/components/ui/tooltip.tsx +11 -9
@@ -2,13 +2,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { eqci, getDefaultToken, roundUpUSDCBaseAmountToNearest } from "../../../anyspend/index.js";
3
3
  import { RELAY_ETH_ADDRESS, USDC_BASE } from "../../../anyspend/constants/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useConnectedUserProfile, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
5
- import { Badge, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TextShimmer, Tooltip, TooltipContent, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
5
+ import { Badge, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TextShimmer, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
6
6
  import { cn, formatUsername } from "../../../shared/utils/index.js";
7
7
  import { shortenAddress } from "../../../shared/utils/formatAddress.js";
8
8
  import { formatTokenAmount, formatUnits } from "../../../shared/utils/number.js";
9
9
  import { simpleHashChainToChainName } from "../../../shared/utils/simplehash.js";
10
10
  import invariant from "invariant";
11
- import { ChevronRight, ChevronRightCircle, Loader2 } from "lucide-react";
11
+ import { ChevronRight, ChevronRightCircle, Info, Loader2 } from "lucide-react";
12
12
  import { motion } from "motion/react";
13
13
  import React, { useCallback, useEffect, useMemo, useState } from "react";
14
14
  import { toast } from "sonner";
@@ -16,6 +16,7 @@ import { base } from "viem/chains";
16
16
  import { useFeatureFlags } from "../contexts/FeatureFlagsContext.js";
17
17
  import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
18
18
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
19
+ import { FeeBreakDown } from "./common/FeeBreakDown.js";
19
20
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
20
21
  import { OrderDetails } from "./common/OrderDetails.js";
21
22
  import { OrderHistory } from "./common/OrderHistory.js";
@@ -34,7 +35,7 @@ var PanelView;
34
35
  PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 6] = "FIAT_PAYMENT_METHOD";
35
36
  PanelView[PanelView["POINTS_DETAIL"] = 7] = "POINTS_DETAIL";
36
37
  })(PanelView || (PanelView = {}));
37
- function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, recipientAddress, dstAmount, contractAddress, tokenId, contractType, encodedData, spenderAddress, }) {
38
+ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, recipientAddress, dstAmount, contractAddress, tokenId, contractType, encodedData, spenderAddress, onrampVendor, }) {
38
39
  switch (orderType) {
39
40
  case "mint_nft": {
40
41
  invariant(contractType, "Contract type is required");
@@ -49,6 +50,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
49
50
  contractAddress: contractAddress,
50
51
  tokenId: tokenId,
51
52
  contractType: contractType,
53
+ onrampVendor,
52
54
  };
53
55
  }
54
56
  case "join_tournament": {
@@ -61,6 +63,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
61
63
  recipientAddress,
62
64
  price: dstAmount,
63
65
  contractAddress: contractAddress,
66
+ onrampVendor,
64
67
  };
65
68
  }
66
69
  case "fund_tournament": {
@@ -73,6 +76,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
73
76
  recipientAddress,
74
77
  fundAmount: dstAmount,
75
78
  contractAddress: contractAddress,
79
+ onrampVendor,
76
80
  };
77
81
  }
78
82
  case "custom": {
@@ -89,6 +93,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
89
93
  to: contractAddress,
90
94
  spenderAddress: spenderAddress,
91
95
  },
96
+ onrampVendor,
92
97
  };
93
98
  }
94
99
  default: {
@@ -186,6 +191,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
186
191
  contractType: orderType === "mint_nft" ? metadata?.nftContract?.type : undefined,
187
192
  encodedData: encodedData,
188
193
  spenderAddress: spenderAddress,
194
+ onrampVendor: selectedFiatPaymentMethod === FiatPaymentMethod.STRIPE ? "stripe-web2" : undefined,
189
195
  });
190
196
  }, [
191
197
  activeTab,
@@ -201,6 +207,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
201
207
  spenderAddress,
202
208
  srcChainId,
203
209
  srcToken,
210
+ selectedFiatPaymentMethod,
204
211
  ]);
205
212
  const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote(getRelayQuoteRequest);
206
213
  const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
@@ -473,7 +480,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
473
480
  opacity: hasMounted ? 1 : 0,
474
481
  y: hasMounted ? 0 : 20,
475
482
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
476
- }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(with fee)" })] }), renderPointsBadge()] }), _jsxs("span", { className: "text-as-primary font-semibold", children: [formattedSrcAmount || "--", " ", srcToken.symbol] })] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
483
+ }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry flex items-center gap-1.5 text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(with fee)" }), anyspendQuote?.data?.fee && (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { side: "top", children: _jsx(FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), renderPointsBadge()] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [formattedSrcAmount || "--", " ", srcToken.symbol] }), anyspendQuote?.data?.fee?.type === "standard_fee" && anyspendQuote.data.currencyIn?.amountUsd && (_jsxs("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.currencyIn.amountUsd) * anyspendQuote.data.fee.finalFeeBps) /
484
+ 10000).toFixed(2), " ", "fee"] }))] })] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
477
485
  opacity: hasMounted ? 1 : 0,
478
486
  y: hasMounted ? 0 : 20,
479
487
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -485,7 +493,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
485
493
  opacity: hasMounted ? 1 : 0,
486
494
  y: hasMounted ? 0 : 20,
487
495
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
488
- }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(USD)" })] }), renderPointsBadge()] }), _jsxs("span", { className: "text-as-primary text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
496
+ }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry flex items-center gap-1.5 text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(USD)" }), anyspendQuote?.data?.fee && (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { side: "top", children: _jsx(FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), renderPointsBadge()] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] }), anyspendQuote?.data?.fee?.type === "stripeweb2_fee" && anyspendQuote.data.fee.originalAmount && (_jsxs("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.fee.originalAmount) - Number(anyspendQuote.data.fee.finalAmount)) /
497
+ 1e6).toFixed(2), " ", "fee"] }))] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
489
498
  opacity: hasMounted ? 1 : 0,
490
499
  y: hasMounted ? 0 : 20,
491
500
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -12,6 +12,7 @@ import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFing
12
12
  import { CryptoPaySection } from "./common/CryptoPaySection.js";
13
13
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
14
14
  import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
15
+ import { FeeDetailPanel } from "./common/FeeDetailPanel.js";
15
16
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
16
17
  import { OrderDetails } from "./common/OrderDetails.js";
17
18
  import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
@@ -29,7 +30,7 @@ export function AnySpendDepositHype(props) {
29
30
  }
30
31
  function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, }) {
31
32
  // Use shared flow hook
32
- const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = useAnyspendFlow({
33
+ const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = useAnyspendFlow({
33
34
  paymentType,
34
35
  recipientAddress,
35
36
  loadOrder,
@@ -111,10 +112,10 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
111
112
  await handleFiatOrder();
112
113
  }
113
114
  };
114
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _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, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, 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: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_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), 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, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
115
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _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: selectedCryptoPaymentMethod, 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: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_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, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
115
116
  setIsSrcInputDirty(false);
116
117
  setSrcAmount(value);
117
- }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_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] }));
118
+ }, 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] }));
118
119
  // Handle crypto order creation
119
120
  const handleCryptoOrder = async () => {
120
121
  try {
@@ -212,6 +213,11 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
212
213
  setActivePanel(PanelView.MAIN);
213
214
  }, srcAmountOnRamp: srcAmount }));
214
215
  const pointsDetailView = (_jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(PanelView.MAIN) }));
216
+ const feeDetailView = anyspendQuote?.data?.fee ? (_jsx(FeeDetailPanel, { fee: anyspendQuote.data.fee, transactionAmountUsd: paymentType === "fiat"
217
+ ? parseFloat(srcAmount)
218
+ : anyspendQuote.data.currencyIn?.amountUsd
219
+ ? Number(anyspendQuote.data.currencyIn.amountUsd)
220
+ : undefined, onBack: () => setActivePanel(PanelView.MAIN) })) : null;
215
221
  // If showing token selection, render with panel transitions
216
222
  return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
217
223
  "bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
@@ -234,5 +240,6 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
234
240
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: orderDetailsView }, "order-details-view"),
235
241
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: loadingView }, "loading-view"),
236
242
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
243
+ _jsx("div", { className: cn(mode === "page" && "p-6"), children: feeDetailView }, "fee-detail-view"),
237
244
  ] }) }) }));
238
245
  }
@@ -7,6 +7,7 @@ interface CryptoPaySectionProps {
7
7
  setSelectedSrcToken: (token: components["schemas"]["Token"]) => void;
8
8
  srcAmount: string;
9
9
  setSrcAmount: (amount: string) => void;
10
+ isSrcInputDirty: boolean;
10
11
  setIsSrcInputDirty: (dirty: boolean) => void;
11
12
  selectedCryptoPaymentMethod: CryptoPaymentMethodType;
12
13
  onSelectCryptoPaymentMethod: () => void;
@@ -14,6 +15,7 @@ interface CryptoPaySectionProps {
14
15
  onTokenSelect?: (token: components["schemas"]["Token"], event: {
15
16
  preventDefault: () => void;
16
17
  }) => void;
18
+ onShowFeeDetail?: () => void;
17
19
  }
18
- export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
19
21
  export {};
@@ -1,15 +1,15 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useAccountWallet, useProfile, useTokenData } from "../../../../global-account/react/index.js";
3
3
  import { formatUsername } from "../../../../shared/utils/index.js";
4
4
  import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
5
5
  import { formatDisplayNumber } from "../../../../shared/utils/number.js";
6
- import { ChevronRight } from "lucide-react";
6
+ import { ChevronRight, Info } from "lucide-react";
7
7
  import { motion } from "motion/react";
8
8
  import { useEffect, useRef } from "react";
9
9
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
10
10
  import { OrderTokenAmount } from "./OrderTokenAmount.js";
11
11
  import { TokenBalance } from "./TokenBalance.js";
12
- export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, }) {
12
+ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, }) {
13
13
  const { connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
14
14
  const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
15
15
  // Determine which address to use based on payment method
@@ -42,7 +42,7 @@ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, se
42
42
  useEffect(() => {
43
43
  appliedSrcMetadataRef.current = false;
44
44
  }, [selectedSrcToken.address, selectedSrcToken.chainId]);
45
- return (_jsxs(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: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [walletAddress ? (_jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "") })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (_jsxs(_Fragment, { children: ["Global Account", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
45
+ return (_jsxs(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: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: ["Pay", !isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [walletAddress ? (_jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "") })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (_jsxs(_Fragment, { children: ["Global Account", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
46
46
  setIsSrcInputDirty(true);
47
47
  setSrcAmount(value);
48
48
  }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken, onTokenSelect: onTokenSelect }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
@@ -10,11 +10,13 @@ interface CryptoReceiveSectionProps {
10
10
  selectedDstChainId?: number;
11
11
  setSelectedDstChainId?: (chainId: number) => void;
12
12
  setSelectedDstToken?: (token: components["schemas"]["Token"]) => void;
13
+ isSrcInputDirty: boolean;
13
14
  onChangeDstAmount?: (value: string) => void;
14
15
  anyspendQuote?: any;
15
16
  dstTokenSymbol?: string;
16
17
  dstTokenLogoURI?: string;
17
18
  onShowPointsDetail?: () => void;
19
+ onShowFeeDetail?: () => void;
18
20
  }
19
- export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
20
22
  export {};
@@ -1,16 +1,16 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { formatUsername } from "../../../../shared/utils/index.js";
3
3
  import { cn } from "../../../../shared/utils/cn.js";
4
4
  import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
5
5
  import { formatDisplayNumber } from "../../../../shared/utils/number.js";
6
- import { ChevronRight } from "lucide-react";
6
+ import { ChevronRight, Info } from "lucide-react";
7
7
  import { motion } from "motion/react";
8
8
  import { useFeatureFlags } from "../../contexts/FeatureFlagsContext.js";
9
9
  import { OrderTokenAmount } from "./OrderTokenAmount.js";
10
10
  import { PointsBadge } from "./PointsBadge.js";
11
- export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, }) {
11
+ export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
12
12
  const featureFlags = useFeatureFlags();
13
- return (_jsxs(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: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: isDepositMode ? "Deposit" : "Receive" }), selectedRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? formatUsername(recipientName) : shortenAddress(selectedRecipientAddress || "") }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
13
+ return (_jsxs(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: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), selectedRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? formatUsername(recipientName) : shortenAddress(selectedRecipientAddress || "") }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
14
14
  // Fixed destination token display for buy mode and deposit mode
15
15
  _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
16
16
  // Token selection for regular swap mode
@@ -0,0 +1,12 @@
1
+ import { components } from "../../../types/api";
2
+ interface FeeBreakDownProps {
3
+ fee: components["schemas"]["Fee"];
4
+ /** Number of decimals for amount display (default: 6 for USDC) */
5
+ decimals?: number;
6
+ /** Show currency symbol for amounts (default: true) */
7
+ showCurrency?: boolean;
8
+ /** Custom className for the container */
9
+ className?: string;
10
+ }
11
+ export declare function FeeBreakDown({ fee, decimals, showCurrency, className }: FeeBreakDownProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ export function FeeBreakDown({ fee, decimals = 6, showCurrency = true, className = "" }) {
3
+ const isStripeFee = fee.type === "stripeweb2_fee";
4
+ // Convert basis points to percentage
5
+ const bpsToPercent = (bps) => (bps / 100).toFixed(2);
6
+ // Format amount with optional currency
7
+ const formatAmount = (amount) => {
8
+ const divisor = Math.pow(10, decimals);
9
+ const formatted = (Number(amount) / divisor).toFixed(2);
10
+ return showCurrency ? `$${formatted}` : formatted;
11
+ };
12
+ // Check if discount is active
13
+ const hasWhaleDiscount = fee.anyspendWhaleDiscountBps > 0;
14
+ const hasPartnerDiscount = fee.anyspendPartnerDiscountBps > 0;
15
+ return (_jsxs("div", { className: `min-w-[240px] ${className}`, children: [_jsxs("div", { className: "mb-4", children: [_jsx("h3", { className: "text-as-primary mb-2 text-sm font-semibold", children: "Fee Breakdown" }), _jsx("table", { className: "w-full", children: _jsxs("tbody", { className: "text-as-secondary text-xs", children: [isStripeFee && (_jsxs("tr", { children: [_jsx("td", { className: "py-1", children: "Stripe Fee" }), _jsxs("td", { className: "py-1 text-right", children: [bpsToPercent(fee.stripeFeeBps), "% + $", fee.stripeFeeUsd.toFixed(2)] })] })), _jsxs("tr", { children: [_jsx("td", { className: "py-1", children: "AnySpend Fee" }), _jsxs("td", { className: "py-1 text-right", children: [bpsToPercent(fee.anyspendFeeBps), "%", isStripeFee && fee.anyspendFeeUsd > 0 && ` + $${fee.anyspendFeeUsd.toFixed(2)}`] })] }), hasWhaleDiscount && (_jsxs("tr", { className: "text-green-600", children: [_jsx("td", { className: "py-1", children: "Whale Discount" }), _jsxs("td", { className: "py-1 text-right", children: ["-", bpsToPercent(fee.anyspendWhaleDiscountBps), "%"] })] })), hasPartnerDiscount && (_jsxs("tr", { className: "text-green-600", children: [_jsx("td", { className: "py-1", children: "Partner Discount" }), _jsxs("td", { className: "py-1 text-right", children: ["-", bpsToPercent(fee.anyspendPartnerDiscountBps), "%"] })] })), _jsxs("tr", { className: "border-as-border-secondary border-t", children: [_jsx("td", { className: "text-as-primary py-1.5 pt-2 font-semibold", children: "Total Fee" }), _jsxs("td", { className: "text-as-primary py-1.5 pt-2 text-right font-semibold", children: [bpsToPercent(fee.finalFeeBps), "%", isStripeFee && ` + $${fee.finalFeeUsd.toFixed(2)}`] })] })] }) })] }), isStripeFee && (_jsxs(_Fragment, { children: [_jsx("div", { className: "border-as-border-secondary my-3 border-t" }), _jsxs("div", { children: [_jsx("h3", { className: "text-as-primary mb-2 text-sm font-semibold", children: "Amount Calculation" }), _jsx("table", { className: "w-full", children: _jsxs("tbody", { className: "text-as-secondary text-xs", children: [_jsxs("tr", { children: [_jsx("td", { className: "py-1", children: "Original Amount" }), _jsx("td", { className: "py-1 text-right font-medium", children: formatAmount(fee.originalAmount) })] }), _jsxs("tr", { children: [_jsx("td", { className: "py-1", children: "Total Fee" }), _jsxs("td", { className: "py-1 text-right text-red-600", children: ["-", formatAmount((Number(fee.originalAmount) - Number(fee.finalAmount)).toString())] })] }), _jsxs("tr", { className: "border-as-border-secondary border-t", children: [_jsx("td", { className: "text-as-primary py-1.5 pt-2 font-semibold", children: "You Receive" }), _jsx("td", { className: "text-as-primary py-1.5 pt-2 text-right font-semibold", children: formatAmount(fee.finalAmount) })] })] }) })] })] }))] }));
16
+ }
@@ -0,0 +1,8 @@
1
+ import { components } from "../../../types/api";
2
+ interface FeeDetailPanelProps {
3
+ fee: components["schemas"]["Fee"];
4
+ transactionAmountUsd?: number;
5
+ onBack: () => void;
6
+ }
7
+ export declare function FeeDetailPanel({ fee, transactionAmountUsd, onBack }: FeeDetailPanelProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ShinyButton } from "../../../../global-account/react/index.js";
3
+ import { cn } from "../../../../shared/utils/cn.js";
4
+ import { ChevronDown } from "lucide-react";
5
+ import { useState } from "react";
6
+ // Fee tier definitions
7
+ const CRYPTO_FEE_TIERS = [
8
+ { min: 0, max: 10, bps: 120, label: "$0 – $10" },
9
+ { min: 10, max: 500, bps: 80, label: "$10 – $500" },
10
+ { min: 500, max: 5000, bps: 60, label: "$500 – $5,000" },
11
+ { min: 5000, max: 50000, bps: 40, label: "$5,000 – $50,000" },
12
+ { min: 50000, max: Infinity, bps: 28, label: "$50,000+" },
13
+ ];
14
+ const FIAT_FEE_TIERS = [
15
+ { min: 0.01, max: 25, fee: "$1", label: "$0.01 – $25" },
16
+ { min: 25.01, max: 250, fee: "2%", label: "$25.01 – $250" },
17
+ { min: 251, max: Infinity, fee: "3%", label: "$251+" },
18
+ ];
19
+ // Whale discount tiers based on $ANY holdings
20
+ const WHALE_DISCOUNT_TIERS = [
21
+ { minAny: 100000, discountPercent: 50, label: "Tier 1: 100k $ANY" },
22
+ { minAny: 500000, discountPercent: 75, label: "Tier 2: 500k $ANY" },
23
+ { minAny: 1000000, discountPercent: 100, label: "Tier 3: 1M+ $ANY" },
24
+ ];
25
+ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
26
+ // Detect if this is a fiat onramp order (Stripe) vs regular crypto swap
27
+ // stripeweb2_fee = Stripe/fiat onramp (uses FIAT_FEE_TIERS)
28
+ // standard_fee = Regular crypto swap (uses CRYPTO_FEE_TIERS)
29
+ const isStripeFee = fee.type === "stripeweb2_fee";
30
+ // Convert basis points to percentage
31
+ const bpsToPercent = (bps) => (bps / 100).toFixed(2);
32
+ // Check if discount is active
33
+ const hasWhaleDiscount = fee.anyspendWhaleDiscountBps > 0;
34
+ const hasPartnerDiscount = fee.anyspendPartnerDiscountBps > 0;
35
+ // Find current tier based on transaction amount
36
+ const getCurrentCryptoTier = (amount) => {
37
+ if (!amount)
38
+ return null;
39
+ return CRYPTO_FEE_TIERS.find(tier => amount >= tier.min && amount < tier.max);
40
+ };
41
+ const getCurrentFiatTier = (amount) => {
42
+ if (!amount)
43
+ return null;
44
+ return FIAT_FEE_TIERS.find(tier => amount >= tier.min && amount < tier.max);
45
+ };
46
+ const currentCryptoTier = getCurrentCryptoTier(transactionAmountUsd);
47
+ const currentFiatTier = getCurrentFiatTier(transactionAmountUsd);
48
+ // The whale discount is a percentage discount on the base fee itself
49
+ // Example: 50% discount on 80 bps fee = 40 bps discount, final fee = 40 bps
50
+ // So: finalFee = baseFee - (baseFee * discountPercent / 100)
51
+ // Which means: discountPercent = ((baseFee - finalFee) / baseFee) * 100
52
+ const baseFee = fee.type === "standard_fee" ? fee.anyspendFeeBps : 0;
53
+ // The whale discount percentage (50%, 75%, or 100%)
54
+ const whaleDiscountPercent = baseFee > 0 && hasWhaleDiscount ? Math.round(((baseFee - fee.finalFeeBps) / baseFee) * 100) : 0;
55
+ // Determine which whale tier based on the discount percentage
56
+ const currentWhaleTier = WHALE_DISCOUNT_TIERS.find(tier => Math.abs(whaleDiscountPercent - tier.discountPercent) <= 5);
57
+ // Calculate partner discount percentage
58
+ const partnerDiscountPercent = baseFee > 0 && hasPartnerDiscount ? Math.round((fee.anyspendPartnerDiscountBps / baseFee) * 100) : 0;
59
+ // State for expanding tier lists
60
+ const [showAllFeeTiers, setShowAllFeeTiers] = useState(false);
61
+ const [showAllDiscountTiers, setShowAllDiscountTiers] = useState(false);
62
+ return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-3", children: _jsxs("div", { className: "flex w-full flex-col gap-3", children: [_jsx("div", { className: "text-center", children: _jsx("h3", { className: "text-as-primary text-lg font-bold", children: "Fee Breakdown" }) }), _jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: [_jsx("h4", { className: "text-as-primary mb-3 text-sm font-semibold", children: isStripeFee ? "Fiat Fee Schedule" : "Base Fee Schedule" }), _jsx("div", { className: "space-y-1.5", children: isStripeFee
63
+ ? FIAT_FEE_TIERS.map((tier, idx) => {
64
+ const isCurrentTier = currentFiatTier?.label === tier.label;
65
+ const currentTierIndex = FIAT_FEE_TIERS.findIndex(t => t.label === currentFiatTier?.label);
66
+ // Show all tiers if expanded, otherwise show up to current tier
67
+ if (!showAllFeeTiers && currentTierIndex !== -1 && idx > currentTierIndex) {
68
+ return null;
69
+ }
70
+ return (_jsxs("div", { className: cn("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-as-brand/10 text-as-brand font-semibold" : "text-as-primary/60"), children: [_jsx("span", { children: tier.label }), _jsxs("span", { children: ["CC Fee + ", tier.fee] })] }, idx));
71
+ })
72
+ : CRYPTO_FEE_TIERS.map((tier, idx) => {
73
+ const isCurrentTier = currentCryptoTier?.label === tier.label;
74
+ const currentTierIndex = CRYPTO_FEE_TIERS.findIndex(t => t.label === currentCryptoTier?.label);
75
+ // Show all tiers if expanded, otherwise show up to current tier
76
+ if (!showAllFeeTiers && currentTierIndex !== -1 && idx > currentTierIndex) {
77
+ return null;
78
+ }
79
+ return (_jsxs("div", { className: cn("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-as-brand/10 text-as-brand font-semibold" : "text-as-primary/60"), children: [_jsx("span", { children: tier.label }), _jsxs("span", { children: [bpsToPercent(tier.bps), "%"] })] }, idx));
80
+ }) }), (() => {
81
+ const currentTierIndex = isStripeFee
82
+ ? FIAT_FEE_TIERS.findIndex(t => t.label === currentFiatTier?.label)
83
+ : CRYPTO_FEE_TIERS.findIndex(t => t.label === currentCryptoTier?.label);
84
+ const totalTiers = isStripeFee ? FIAT_FEE_TIERS.length : CRYPTO_FEE_TIERS.length;
85
+ const hasMoreTiers = currentTierIndex !== -1 && currentTierIndex < totalTiers - 1;
86
+ if (hasMoreTiers) {
87
+ return (_jsxs("button", { onClick: () => setShowAllFeeTiers(!showAllFeeTiers), className: "text-as-primary/60 hover:text-as-primary mt-2 flex w-full items-center justify-center gap-1 text-xs transition-colors", children: [_jsx("span", { children: showAllFeeTiers ? "Show less" : "Show higher tiers" }), _jsx(ChevronDown, { className: cn("h-3.5 w-3.5 transition-transform", showAllFeeTiers && "rotate-180") })] }));
88
+ }
89
+ return null;
90
+ })()] }), !isStripeFee && (_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: [_jsx("h4", { className: "text-as-primary mb-3 text-sm font-semibold", children: hasWhaleDiscount ? "Whale Discount Tiers" : hasPartnerDiscount ? "Partner Discount" : "Discount Tiers" }), _jsx("div", { className: "space-y-1.5", children: hasPartnerDiscount && !hasWhaleDiscount ? (_jsxs("div", { className: "flex items-center justify-between rounded-lg bg-green-500/10 px-3 py-2.5 text-sm font-semibold text-green-600", children: [_jsx("span", { children: "Partner Discount" }), _jsxs("span", { children: [partnerDiscountPercent, "% discount"] })] })) : (_jsxs(_Fragment, { children: [WHALE_DISCOUNT_TIERS.map((tier, idx) => {
91
+ const isCurrentTier = currentWhaleTier?.label === tier.label;
92
+ const currentTierIndex = WHALE_DISCOUNT_TIERS.findIndex(t => t.label === currentWhaleTier?.label);
93
+ // If no whale discount, show only first tier; otherwise show up to current tier
94
+ if (!showAllDiscountTiers) {
95
+ if (!hasWhaleDiscount && idx > 0) {
96
+ return null;
97
+ }
98
+ if (hasWhaleDiscount && currentTierIndex !== -1 && idx > currentTierIndex) {
99
+ return null;
100
+ }
101
+ }
102
+ return (_jsxs("div", { className: cn("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-green-500/10 font-semibold text-green-600" : "text-as-primary/60"), children: [_jsx("span", { children: tier.label }), _jsxs("span", { children: [tier.discountPercent, "% discount"] })] }, idx));
103
+ }), (() => {
104
+ const currentTierIndex = WHALE_DISCOUNT_TIERS.findIndex(t => t.label === currentWhaleTier?.label);
105
+ const hasMoreTiers = hasWhaleDiscount
106
+ ? currentTierIndex !== -1 && currentTierIndex < WHALE_DISCOUNT_TIERS.length - 1
107
+ : WHALE_DISCOUNT_TIERS.length > 1;
108
+ if (hasMoreTiers) {
109
+ return (_jsxs("button", { onClick: () => setShowAllDiscountTiers(!showAllDiscountTiers), className: "text-as-primary/60 hover:text-as-primary mt-2 flex w-full items-center justify-center gap-1 text-xs transition-colors", children: [_jsx("span", { children: showAllDiscountTiers ? "Show less" : "Show all tiers" }), _jsx(ChevronDown, { className: cn("h-3.5 w-3.5 transition-transform", showAllDiscountTiers && "rotate-180") })] }));
110
+ }
111
+ return null;
112
+ })()] })) })] })), transactionAmountUsd && (_jsx("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: _jsxs("div", { className: "space-y-2 text-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-secondary", children: "Transaction" }), _jsxs("span", { className: "text-as-primary font-semibold", children: ["$", transactionAmountUsd.toFixed(2)] })] }), isStripeFee && currentFiatTier && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-secondary", children: currentFiatTier.label }), _jsxs("span", { className: "text-as-primary", children: ["CC Fee + ", currentFiatTier.fee] })] })), !isStripeFee && currentCryptoTier && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["Base Fee (", bpsToPercent(currentCryptoTier.bps), "%)"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * currentCryptoTier.bps) / 10000).toFixed(2)] })] }), hasWhaleDiscount && currentWhaleTier && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-green-600", children: ["Discount (", currentWhaleTier.discountPercent, "% off)"] }), _jsxs("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * currentWhaleTier.discountPercent) / 100 / 10000).toFixed(2)] })] })), hasPartnerDiscount && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-green-600", children: ["Partner Discount (", partnerDiscountPercent, "% off)"] }), _jsxs("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * partnerDiscountPercent) / 100 / 10000).toFixed(2)] })] })), _jsx("div", { className: "border-as-border-secondary border-t pt-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Total Fee" }), _jsxs("span", { className: "text-as-brand font-semibold", children: ["$", ((transactionAmountUsd * fee.finalFeeBps) / 10000).toFixed(2)] })] }) })] }))] }) })), _jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: ["Back to ", isStripeFee ? "Payment" : "Swap"] })] }) }));
113
+ }
@@ -1,7 +1,7 @@
1
1
  import { components } from "../../../../anyspend/types/api";
2
2
  import { GetQuoteResponse } from "../../../../anyspend/types/api_req_res";
3
3
  import { FiatPaymentMethod } from "./FiatPaymentMethod";
4
- export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, customUsdInputValues, }: {
4
+ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues, }: {
5
5
  srcAmountOnRamp: string;
6
6
  setSrcAmountOnRamp: (amount: string) => void;
7
7
  selectedPaymentMethod?: FiatPaymentMethod;
@@ -18,5 +18,6 @@ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selec
18
18
  hideDstToken?: boolean;
19
19
  anyspendQuote?: GetQuoteResponse;
20
20
  onShowPointsDetail?: () => void;
21
+ onShowFeeDetail?: () => void;
21
22
  customUsdInputValues?: string[];
22
23
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,44 +1,48 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useCoinbaseOnrampOptions, useGeoOnrampOptions } from "../../../../anyspend/react/index.js";
2
+ import { useCoinbaseOnrampOptions } from "../../../../anyspend/react/index.js";
3
3
  import { ALL_CHAINS } from "../../../../anyspend/utils/chain.js";
4
4
  import { Input, useGetGeo, useProfile } from "../../../../global-account/react/index.js";
5
5
  import { cn, formatUsername } from "../../../../shared/utils/index.js";
6
6
  import { formatAddress } from "../../../../shared/utils/formatAddress.js";
7
- import { ChevronRight, Wallet } from "lucide-react";
7
+ import { ChevronRight, Info, Wallet } from "lucide-react";
8
8
  import { useRef } from "react";
9
9
  import { toast } from "sonner";
10
10
  import { useFeatureFlags } from "../../contexts/FeatureFlagsContext.js";
11
11
  import { FiatPaymentMethod } from "./FiatPaymentMethod.js";
12
12
  import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat.js";
13
13
  import { PointsBadge } from "./PointsBadge.js";
14
- export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, customUsdInputValues = ["5", "10", "20", "25"], }) {
14
+ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues = ["5", "10", "20", "25"], }) {
15
15
  const featureFlags = useFeatureFlags();
16
- // Get geo-based onramp options to access fee information
17
- const { stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
18
- // Helper function to get fees from API data
16
+ // Helper function to get fees from anyspend quote
19
17
  const getFeeFromApi = (paymentMethod) => {
18
+ // Try to get fee from anyspend quote first (most accurate)
19
+ if (anyspendQuote?.data?.fee) {
20
+ const fee = anyspendQuote.data.fee;
21
+ if (fee.type === "stripeweb2_fee") {
22
+ // Calculate total fee in USD from originalAmount - finalAmount
23
+ const originalAmount = Number(fee.originalAmount) / 1e6; // Convert from wei to USD
24
+ const finalAmount = Number(fee.finalAmount) / 1e6;
25
+ return originalAmount - finalAmount;
26
+ }
27
+ }
28
+ // Fallback to payment method defaults
20
29
  switch (paymentMethod) {
21
30
  case FiatPaymentMethod.COINBASE_PAY:
22
- // Coinbase doesn't provide fee info in API, return 0
23
- return 0;
31
+ return 0; // Coinbase has no additional fees
24
32
  case FiatPaymentMethod.STRIPE:
25
- // Get fee from Stripe API response
26
- if (stripeWeb2Support && "formattedFeeUsd" in stripeWeb2Support) {
27
- return parseFloat(stripeWeb2Support.formattedFeeUsd) || 0;
28
- }
29
- return null;
33
+ return null; // No quote available yet
30
34
  default:
31
- return null; // No fee when no payment method selected
35
+ return null;
32
36
  }
33
37
  };
34
38
  // Helper function to get total amount from API (for Stripe) or calculate it (for others)
35
39
  const getTotalAmount = (paymentMethod) => {
36
40
  const baseAmount = parseFloat(srcAmountOnRamp) || 5;
37
- const fee = getFeeFromApi(paymentMethod);
38
- if (paymentMethod === FiatPaymentMethod.STRIPE && stripeWeb2Support && "formattedTotalUsd" in stripeWeb2Support) {
39
- // Use the total from Stripe API if available
40
- return parseFloat(stripeWeb2Support.formattedTotalUsd) || baseAmount;
41
+ // Try to get from anyspend quote first (most accurate)
42
+ if (anyspendQuote?.data?.fee?.type === "stripeweb2_fee") {
43
+ return Number(anyspendQuote.data.fee.originalAmount) / 1e6; // Convert from wei to USD
41
44
  }
45
+ const fee = getFeeFromApi(paymentMethod);
42
46
  // For Coinbase or when fee is available, calculate manually
43
47
  if (fee !== null) {
44
48
  return baseAmount + fee;
@@ -75,10 +79,21 @@ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPayme
75
79
  .filter(v => !isNaN(Number(v)))
76
80
  .map(value => (_jsxs("button", { onClick: () => handleQuickAmount(value), className: `bg-as-surface-secondary border-as-border-secondary hover:border-as-border-secondary h-7 w-14 rounded-lg border text-sm font-medium transition-all duration-200 ${srcAmountOnRamp === value
77
81
  ? "border-as-border-secondary bg-as-surface-secondary"
78
- : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: (() => {
79
- const fee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod.NONE);
80
- return fee !== null ? `Total (included $${fee.toFixed(2)} fee)` : "Total";
81
- })() }), featureFlags.showPoints &&
82
+ : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Total" }), anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) })), featureFlags.showPoints &&
82
83
  anyspendQuote?.data?.pointsAmount &&
83
- anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), _jsxs("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod.NONE).toFixed(2)] })] }) })] })] }));
84
+ anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod.NONE).toFixed(2)] }), (() => {
85
+ // For fiat payments, show the fee from the payment method
86
+ const fiatFee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod.NONE);
87
+ if (fiatFee !== null && fiatFee > 0) {
88
+ return _jsxs("span", { className: "text-as-secondary text-xs", children: ["incl. $", fiatFee.toFixed(2), " fee"] });
89
+ }
90
+ // For crypto payments (standard_fee), calculate from the quote
91
+ if (anyspendQuote?.data?.fee?.type === "standard_fee" && anyspendQuote.data.currencyIn?.amountUsd) {
92
+ const cryptoFee = (Number(anyspendQuote.data.currencyIn.amountUsd) * anyspendQuote.data.fee.finalFeeBps) / 10000;
93
+ if (cryptoFee > 0) {
94
+ return _jsxs("span", { className: "text-as-secondary text-xs", children: ["incl. $", cryptoFee.toFixed(2), " fee"] });
95
+ }
96
+ }
97
+ return null;
98
+ })()] })] }) })] })] }));
84
99
  }