@b3dotfun/sdk 0.0.49-alpha.0 → 0.0.49-alpha.2
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.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +8 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +12 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +11 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -2
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +17 -11
- package/dist/cjs/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/common/FeeBreakDown.js +19 -0
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +116 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +36 -21
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -0
- package/dist/cjs/anyspend/types/api.d.ts +119 -176
- package/dist/cjs/global-account/react/components/ui/tooltip.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -4
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +14 -5
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -4
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +19 -13
- package/dist/esm/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
- package/dist/esm/anyspend/react/components/common/FeeBreakDown.js +16 -0
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +113 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -3
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +38 -23
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +2 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -0
- package/dist/esm/anyspend/types/api.d.ts +119 -176
- package/dist/esm/global-account/react/components/ui/tooltip.js +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -0
- package/dist/types/anyspend/types/api.d.ts +119 -176
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +20 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +69 -7
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +24 -0
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +14 -2
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +31 -11
- package/src/anyspend/react/components/common/FeeBreakDown.tsx +105 -0
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +334 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -0
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +13 -0
- package/src/anyspend/react/components/common/PanelOnramp.tsx +58 -27
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +18 -6
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -13
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -0
- package/src/anyspend/types/api.ts +121 -176
- 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)" })
|
|
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)" })
|
|
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 {
|
|
@@ -195,7 +196,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
195
196
|
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
|
|
196
197
|
setOrderId(undefined);
|
|
197
198
|
setActivePanel(PanelView.MAIN);
|
|
198
|
-
}, disableUrlParamManagement: true })) }) }));
|
|
199
|
+
}, disableUrlParamManagement: true, points: oat.data.points || undefined })) }) }));
|
|
199
200
|
// Loading view
|
|
200
201
|
const loadingView = (_jsx("div", { className: "mx-auto flex w-full flex-col items-center gap-4 p-5", children: _jsx("div", { className: "text-as-primary", children: "Loading order details..." }) }));
|
|
201
202
|
// Panel views
|
|
@@ -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,
|
|
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: [
|
|
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,
|
|
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: [
|
|
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
|
|
@@ -22,32 +22,38 @@ export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false,
|
|
|
22
22
|
(() => {
|
|
23
23
|
const calculatePriceImpact = (inputUsd, outputUsd) => {
|
|
24
24
|
if (!inputUsd || !outputUsd) {
|
|
25
|
-
return { percentage: "0.00", isNegative: false };
|
|
25
|
+
return { percentage: "0.00", percentageNum: 0, isNegative: false };
|
|
26
26
|
}
|
|
27
27
|
const input = Number(inputUsd);
|
|
28
28
|
const output = Number(outputUsd);
|
|
29
29
|
// Handle edge cases
|
|
30
30
|
if (input === 0 || isNaN(input) || isNaN(output) || input <= output) {
|
|
31
|
-
return { percentage: "0.00", isNegative: false };
|
|
31
|
+
return { percentage: "0.00", percentageNum: 0, isNegative: false };
|
|
32
32
|
}
|
|
33
33
|
const percentageValue = ((output - input) / input) * 100;
|
|
34
34
|
// Handle the -0.00% case
|
|
35
35
|
if (percentageValue > -0.005 && percentageValue < 0) {
|
|
36
|
-
return { percentage: "0.00", isNegative: false };
|
|
36
|
+
return { percentage: "0.00", percentageNum: 0, isNegative: false };
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
39
|
percentage: Math.abs(percentageValue).toFixed(2),
|
|
40
|
+
percentageNum: Math.abs(percentageValue),
|
|
40
41
|
isNegative: percentageValue < 0,
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
|
-
const { percentage, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
//
|
|
47
|
-
|
|
44
|
+
const { percentage, percentageNum, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
|
|
45
|
+
// Get the fee percentage if available
|
|
46
|
+
const feePercent = anyspendQuote.data.fee?.finalFeeBps ? anyspendQuote.data.fee.finalFeeBps / 100 : 0;
|
|
47
|
+
// Calculate actual slippage (price impact minus fee)
|
|
48
|
+
const actualSlippage = percentageNum - feePercent;
|
|
49
|
+
// Show warning based on actual slippage, not total impact
|
|
50
|
+
const yellowThreshold = 1; // 1% actual slippage
|
|
51
|
+
const redThreshold = 2; // 2% actual slippage
|
|
52
|
+
// Don't show if actual slippage is less than yellow threshold
|
|
53
|
+
if (actualSlippage < yellowThreshold) {
|
|
48
54
|
return null;
|
|
49
55
|
}
|
|
50
56
|
// Using inline style to ensure color displays
|
|
51
|
-
return (_jsxs("span", { className: "ml-2", style: { color:
|
|
57
|
+
return (_jsxs("span", { className: "ml-2", style: { color: actualSlippage >= redThreshold ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
|
|
52
58
|
})()] }), featureFlags.showPoints && anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] })] }));
|
|
53
59
|
}
|
|
@@ -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: ["Credit Card 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 && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["Credit Card Fee (", fee.stripeFeeBps ? `${bpsToPercent(fee.stripeFeeBps)}%` : "0%", " + $", fee.stripeFeeUsd?.toFixed(2) || "0.00", ")"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * (fee.stripeFeeBps || 0)) / 10000 + (fee.stripeFeeUsd || 0)).toFixed(2)] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["AnySpend Fee (", fee.anyspendFeeBps ? `${bpsToPercent(fee.anyspendFeeBps)}%` : "0%", fee.anyspendFeeUsd && fee.anyspendFeeUsd > 0 ? ` + $${fee.anyspendFeeUsd.toFixed(2)}` : "", ")"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * (fee.anyspendFeeBps || 0)) / 10000 + (fee.anyspendFeeUsd || 0)).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 || 0)) / 10000 + (fee.finalFeeUsd || 0)).toFixed(2)] })] }) })] })), !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
|
+
}
|
|
@@ -12,6 +12,7 @@ interface OrderDetailsProps {
|
|
|
12
12
|
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
13
13
|
onBack?: () => void;
|
|
14
14
|
disableUrlParamManagement?: boolean;
|
|
15
|
+
points?: number | undefined;
|
|
15
16
|
}
|
|
16
17
|
export declare const OrderDetails: import("react").NamedExoticComponent<OrderDetailsProps>;
|
|
17
18
|
export declare const OrderDetailsLoadingView: import("react/jsx-runtime").JSX.Element;
|