@b3dotfun/sdk 0.0.65-alpha.1 → 0.0.65-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +38 -7
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
  5. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +14 -251
  6. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +2 -10
  7. package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
  8. package/dist/cjs/anyspend/react/components/index.js +4 -1
  9. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -1
  10. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -14
  11. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  12. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
  13. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +38 -7
  14. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
  15. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +15 -249
  16. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -10
  17. package/dist/esm/anyspend/react/components/index.d.ts +1 -0
  18. package/dist/esm/anyspend/react/components/index.js +1 -0
  19. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -1
  20. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -14
  21. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
  22. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
  23. package/dist/types/anyspend/react/components/index.d.ts +1 -0
  24. package/package.json +1 -1
  25. package/src/anyspend/react/components/AnySpend.tsx +1 -1
  26. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +47 -7
  27. package/src/anyspend/react/components/AnyspendDepositHype.tsx +36 -526
  28. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -13
  29. package/src/anyspend/react/components/index.ts +1 -0
  30. package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -1
  31. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +6 -12
@@ -102,7 +102,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
102
102
  });
103
103
  const [selectedSrcToken, setSelectedSrcToken] = (0, react_4.useState)(srcTokenFromUrl);
104
104
  const { data: srcTokenMetadata } = (0, react_2.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
105
- const [srcAmount, setSrcAmount] = (0, react_4.useState)(searchParams.get("fromAmount") || "0.01");
105
+ const [srcAmount, setSrcAmount] = (0, react_4.useState)(searchParams.get("fromAmount") || "0");
106
106
  // State for onramp amount
107
107
  const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_4.useState)(searchParams.get("fromAmount") || "5");
108
108
  // State for destination chain/token selection
@@ -24,7 +24,9 @@ export interface AnySpendCustomExactInProps {
24
24
  }) => void;
25
25
  customUsdInputValues?: string[];
26
26
  preferEoa?: boolean;
27
- customExactInConfig: CustomExactInConfig;
27
+ customExactInConfig?: CustomExactInConfig;
28
+ orderType?: "hype_duel" | "custom_exact_in";
29
+ minDestinationAmount?: number;
28
30
  header?: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
29
31
  anyspendPrice: GetQuoteResponse | undefined;
30
32
  isLoadingAnyspendPrice: boolean;
@@ -8,6 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const utils_1 = require("../../../anyspend/utils");
9
9
  const react_1 = require("../../../global-account/react");
10
10
  const cn_1 = require("../../../shared/utils/cn");
11
+ const number_1 = require("../../../shared/utils/number");
11
12
  const invariant_1 = __importDefault(require("invariant"));
12
13
  const lucide_react_1 = require("lucide-react");
13
14
  const react_2 = require("motion/react");
@@ -30,8 +31,8 @@ function AnySpendCustomExactIn(props) {
30
31
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
31
32
  return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomExactInInner, { ...props }) }));
32
33
  }
33
- function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, header, }) {
34
- const actionLabel = customExactInConfig.action ?? "Custom Execution";
34
+ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, }) {
35
+ const actionLabel = customExactInConfig?.action ?? "Custom Execution";
35
36
  const DESTINATION_TOKEN_DETAILS = {
36
37
  SYMBOL: destinationToken.symbol ?? "TOKEN",
37
38
  LOGO_URI: destinationToken.metadata?.logoURI ?? "",
@@ -48,7 +49,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
48
49
  destinationTokenChainId: destinationChainId,
49
50
  slippage: SLIPPAGE_PERCENT,
50
51
  disableUrlParamManagement: true,
51
- orderType: "custom_exact_in",
52
+ orderType,
52
53
  });
53
54
  const { connectedEOAWallet } = (0, react_1.useAccountWallet)();
54
55
  const setActiveWallet = (0, react_4.useSetActiveWallet)();
@@ -64,6 +65,13 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
64
65
  const selectedRecipientOrDefault = selectedRecipientAddress ?? recipientAddress;
65
66
  const expectedDstAmountRaw = anyspendQuote?.data?.currencyOut?.amount ?? "0";
66
67
  const buildCustomPayload = (_recipient) => {
68
+ if (!customExactInConfig) {
69
+ // For hype_duel or other simple order types
70
+ return {
71
+ expectedDstAmount: expectedDstAmountRaw,
72
+ };
73
+ }
74
+ // For custom_exact_in with custom config
67
75
  return {
68
76
  amount: expectedDstAmountRaw,
69
77
  expectedDstAmount: expectedDstAmountRaw,
@@ -88,6 +96,24 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
88
96
  return { text: "Select recipient", disable: false, error: false, loading: false };
89
97
  if (!anyspendQuote || !anyspendQuote.success)
90
98
  return { text: "Get quote error", disable: true, error: true, loading: false };
99
+ // Check minimum destination amount if specified
100
+ // Check minimum destination amount if specified
101
+ if (minDestinationAmount &&
102
+ anyspendQuote.data?.currencyOut?.amount &&
103
+ anyspendQuote.data.currencyOut.currency &&
104
+ anyspendQuote.data.currencyOut.currency.decimals != null) {
105
+ const rawAmountInWei = BigInt(anyspendQuote.data.currencyOut.amount);
106
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
107
+ const actualAmount = parseFloat((0, number_1.formatUnits)(rawAmountInWei.toString(), decimals));
108
+ if (actualAmount < minDestinationAmount) {
109
+ return {
110
+ text: `Minimum ${minDestinationAmount} ${DESTINATION_TOKEN_DETAILS.SYMBOL} deposit`,
111
+ disable: true,
112
+ error: true,
113
+ loading: false,
114
+ };
115
+ }
116
+ }
91
117
  if (paymentType === "crypto") {
92
118
  if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
93
119
  return { text: "Choose payment method", disable: false, error: false, loading: false };
@@ -97,7 +123,9 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
97
123
  effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET) {
98
124
  return { text: "Insufficient balance", disable: true, error: true, loading: false };
99
125
  }
100
- return { text: `Execute ${actionLabel}`, disable: false, error: false, loading: false };
126
+ // Use different text based on order type
127
+ const buttonText = orderType === "hype_duel" ? "Continue to deposit" : `Execute ${actionLabel}`;
128
+ return { text: buttonText, disable: false, error: false, loading: false };
101
129
  }
102
130
  if (paymentType === "fiat") {
103
131
  if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
@@ -119,6 +147,9 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
119
147
  hasEnoughBalance,
120
148
  isBalanceLoading,
121
149
  actionLabel,
150
+ minDestinationAmount,
151
+ DESTINATION_TOKEN_DETAILS.SYMBOL,
152
+ orderType,
122
153
  ]);
123
154
  const onMainButtonClick = async () => {
124
155
  if (btnInfo.disable)
@@ -128,7 +159,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
128
159
  return;
129
160
  }
130
161
  if (paymentType === "crypto") {
131
- if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
162
+ if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
132
163
  setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD);
133
164
  return;
134
165
  }
@@ -155,7 +186,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
155
186
  const payload = buildCustomPayload(selectedRecipientOrDefault);
156
187
  createOrder({
157
188
  recipientAddress: selectedRecipientOrDefault,
158
- orderType: "custom_exact_in",
189
+ orderType,
159
190
  srcChain: selectedSrcChainId,
160
191
  dstChain: selectedDstChainId,
161
192
  srcToken: selectedSrcToken,
@@ -203,7 +234,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
203
234
  const payload = buildCustomPayload(selectedRecipientOrDefault);
204
235
  createOnrampOrder({
205
236
  recipientAddress: selectedRecipientOrDefault,
206
- orderType: "custom_exact_in",
237
+ orderType,
207
238
  dstChain: selectedDstChainId,
208
239
  dstToken: selectedDstToken,
209
240
  srcFiatAmount: srcAmount,
@@ -22,4 +22,4 @@ export interface AnySpendDepositHypeProps {
22
22
  customUsdInputValues?: string[];
23
23
  preferEoa?: boolean;
24
24
  }
25
- export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,264 +1,27 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.HYPE_TOKEN_DETAILS = void 0;
7
4
  exports.AnySpendDepositHype = AnySpendDepositHype;
8
5
  const jsx_runtime_1 = require("react/jsx-runtime");
9
6
  const anyspend_1 = require("../../../anyspend");
10
- const react_1 = require("../../../global-account/react");
11
- const cn_1 = require("../../../shared/utils/cn");
12
- const invariant_1 = __importDefault(require("invariant"));
13
- const react_2 = require("motion/react");
14
- const react_3 = require("react");
15
- const sonner_1 = require("sonner");
16
- const react_4 = require("thirdweb/react");
17
7
  const chains_1 = require("viem/chains");
18
- const useAnyspendFlow_1 = require("../hooks/useAnyspendFlow");
19
- const AnySpendFingerprintWrapper_1 = require("./AnySpendFingerprintWrapper");
20
- const CryptoPaySection_1 = require("./common/CryptoPaySection");
21
- const CryptoPaymentMethod_1 = require("./common/CryptoPaymentMethod");
22
- const CryptoReceiveSection_1 = require("./common/CryptoReceiveSection");
23
- const FeeDetailPanel_1 = require("./common/FeeDetailPanel");
24
- const FiatPaymentMethod_1 = require("./common/FiatPaymentMethod");
25
- const OrderDetails_1 = require("./common/OrderDetails");
26
- const PointsDetailPanel_1 = require("./common/PointsDetailPanel");
27
- const RecipientSelection_1 = require("./common/RecipientSelection");
28
- const lucide_react_1 = require("lucide-react");
29
- const PanelOnramp_1 = require("./common/PanelOnramp");
30
- const SLIPPAGE_PERCENT = 3;
8
+ const AnySpendCustomExactIn_1 = require("./AnySpendCustomExactIn");
31
9
  exports.HYPE_TOKEN_DETAILS = {
32
10
  SYMBOL: "HYPE",
33
11
  LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
34
12
  };
35
- function AnySpendDepositHype(props) {
36
- const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
37
- return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendDepositHypeInner, { ...props }) }));
38
- }
39
- function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }) {
40
- // Use shared flow hook
41
- 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, } = (0, useAnyspendFlow_1.useAnyspendFlow)({
42
- paymentType,
43
- recipientAddress,
44
- loadOrder,
45
- isDepositMode: true,
46
- onTransactionSuccess: onSuccess,
47
- sourceTokenAddress,
48
- sourceTokenChainId,
49
- slippage: SLIPPAGE_PERCENT,
50
- disableUrlParamManagement: true,
51
- });
52
- const { connectedEOAWallet: connectedEOAWallet } = (0, react_1.useAccountWallet)();
53
- const setActiveWallet = (0, react_4.useSetActiveWallet)();
54
- const appliedPreferEoa = (0, react_3.useRef)(false);
55
- (0, react_3.useEffect)(() => {
56
- if (preferEoa && !appliedPreferEoa.current) {
57
- if (connectedEOAWallet) {
58
- appliedPreferEoa.current = true;
59
- setActiveWallet(connectedEOAWallet);
60
- }
61
- }
62
- }, [preferEoa, connectedEOAWallet, setActiveWallet]);
63
- // Button state logic
64
- const btnInfo = (0, react_3.useMemo)(() => {
65
- if (activeInputAmountInWei === "0")
66
- return { text: "Enter an amount", disable: true, error: false, loading: false };
67
- if (isLoadingAnyspendQuote)
68
- return { text: "Loading quote...", disable: true, error: false, loading: true };
69
- if (isCreatingOrder || isCreatingOnrampOrder)
70
- return { text: "Creating order...", disable: true, error: false, loading: true };
71
- if (!selectedRecipientAddress)
72
- return { text: "Select recipient", disable: false, error: false, loading: false };
73
- if (!anyspendQuote || !anyspendQuote.success)
74
- return { text: "Get quote error", disable: true, error: true, loading: false };
75
- if (!dstAmount)
76
- return { text: "No quote available", disable: true, error: true, loading: false };
77
- // Check minimum deposit amount (10 HYPE)
78
- // Use the raw amount from the quote instead of the formatted display string
79
- if (anyspendQuote.data?.currencyOut?.amount && anyspendQuote.data.currencyOut.currency?.decimals) {
80
- const rawAmountInWei = anyspendQuote.data.currencyOut.amount;
81
- const decimals = anyspendQuote.data.currencyOut.currency.decimals;
82
- const actualAmount = parseFloat(rawAmountInWei) / Math.pow(10, decimals);
83
- if (actualAmount < 10) {
84
- return { text: "Minimum 10 HYPE deposit", disable: true, error: true, loading: false };
85
- }
86
- }
87
- if (paymentType === "crypto") {
88
- if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
89
- return { text: "Choose payment method", disable: false, error: false, loading: false };
90
- }
91
- return { text: "Continue to deposit", disable: false, error: false, loading: false };
92
- }
93
- if (paymentType === "fiat") {
94
- if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
95
- return { text: "Select payment method", disable: false, error: false, loading: false };
96
- }
97
- return { text: "Buy", disable: false, error: false, loading: false };
98
- }
99
- return { text: "Continue to deposit", disable: false, error: false, loading: false };
100
- }, [
101
- activeInputAmountInWei,
102
- isLoadingAnyspendQuote,
103
- isCreatingOrder,
104
- isCreatingOnrampOrder,
105
- selectedRecipientAddress,
106
- anyspendQuote,
107
- dstAmount,
108
- paymentType,
109
- selectedCryptoPaymentMethod,
110
- selectedFiatPaymentMethod,
111
- ]);
112
- const onMainButtonClick = async () => {
113
- if (btnInfo.disable)
114
- return;
115
- if (!selectedRecipientAddress) {
116
- setActivePanel(useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION);
117
- return;
118
- }
119
- if (paymentType === "crypto") {
120
- if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
121
- setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD);
122
- return;
123
- }
124
- await handleCryptoOrder();
125
- }
126
- else if (paymentType === "fiat") {
127
- if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
128
- setActivePanel(useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD);
129
- return;
130
- }
131
- await handleFiatOrder();
132
- }
133
- };
134
- const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : ((0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, dstTokenSymbol: exports.HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", className: (0, cn_1.cn)("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex items-center justify-center transition-opacity", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && ((0, jsx_runtime_1.jsx)(CryptoReceiveSection_1.CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: selectedRecipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION), setRecipientAddress: setSelectedRecipientAddress, recipientAddressFromProps: recipientAddress, globalAddress: globalAddress, dstAmount: dstAmount, dstToken: anyspend_1.B3_TOKEN, dstTokenSymbol: exports.HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: exports.HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: chains_1.base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
135
- setIsSrcInputDirty(false);
136
- setSrcAmount(value);
137
- }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.FEE_DETAIL), selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }))] }) }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }) }), mainFooter ? mainFooter : null] }));
138
- // Handle crypto order creation
139
- const handleCryptoOrder = async () => {
140
- try {
141
- (0, invariant_1.default)(anyspendQuote, "Relay price is not found");
142
- (0, invariant_1.default)(selectedRecipientAddress, "Recipient address is not found");
143
- const srcAmountBigInt = BigInt(activeInputAmountInWei);
144
- createOrder({
145
- recipientAddress: selectedRecipientAddress,
146
- orderType: "hype_duel",
147
- srcChain: selectedSrcChainId,
148
- dstChain: chains_1.base.id,
149
- srcToken: selectedSrcToken,
150
- dstToken: anyspend_1.B3_TOKEN,
151
- srcAmount: srcAmountBigInt.toString(),
152
- expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
153
- creatorAddress: globalAddress,
154
- });
155
- }
156
- catch (err) {
157
- console.error(err);
158
- sonner_1.toast.error("Failed to create order: " + err.message);
159
- }
160
- };
161
- // Handle fiat order creation
162
- const handleFiatOrder = async () => {
163
- try {
164
- (0, invariant_1.default)(anyspendQuote, "Relay price is not found");
165
- (0, invariant_1.default)(selectedRecipientAddress, "Recipient address is not found");
166
- if (!srcAmount || parseFloat(srcAmount) <= 0) {
167
- sonner_1.toast.error("Please enter a valid amount");
168
- return;
169
- }
170
- // Determine vendor and payment method string
171
- let vendor;
172
- let paymentMethodString = "";
173
- if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY) {
174
- if (coinbaseAvailablePaymentMethods.length === 0) {
175
- sonner_1.toast.error("Coinbase Pay not available");
176
- return;
177
- }
178
- vendor = "coinbase";
179
- paymentMethodString = coinbaseAvailablePaymentMethods[0]?.id || "";
180
- }
181
- else if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
182
- if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
183
- sonner_1.toast.error("Stripe not available");
184
- return;
185
- }
186
- vendor = "stripe-web2";
187
- paymentMethodString = "";
188
- }
189
- else {
190
- sonner_1.toast.error("Please select a payment method");
191
- return;
192
- }
193
- createOnrampOrder({
194
- recipientAddress: selectedRecipientAddress,
195
- orderType: "hype_duel",
196
- dstChain: chains_1.base.id,
197
- dstToken: anyspend_1.B3_TOKEN,
198
- srcFiatAmount: srcAmount,
199
- onramp: {
200
- vendor: vendor,
201
- paymentMethod: paymentMethodString,
202
- country: geoData?.country || "US",
203
- redirectUrl: window.location.origin,
204
- },
205
- expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
206
- creatorAddress: globalAddress,
207
- });
208
- }
209
- catch (err) {
210
- console.error(err);
211
- sonner_1.toast.error("Failed to create order: " + err.message);
212
- }
13
+ function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }) {
14
+ if (!recipientAddress)
15
+ return null;
16
+ const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }));
17
+ // Create a modified B3_TOKEN with HYPE branding
18
+ const hypeToken = {
19
+ ...anyspend_1.B3_TOKEN,
20
+ symbol: exports.HYPE_TOKEN_DETAILS.SYMBOL,
21
+ metadata: {
22
+ ...anyspend_1.B3_TOKEN.metadata,
23
+ logoURI: exports.HYPE_TOKEN_DETAILS.LOGO_URI,
24
+ },
213
25
  };
214
- // Order details view
215
- const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
216
- setOrderId(undefined);
217
- setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
218
- }, disableUrlParamManagement: true, points: oat.data.points || undefined })) }) }));
219
- // Loading view
220
- const loadingView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-full flex-col items-center gap-4 p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: "Loading order details..." }) }));
221
- // Panel views
222
- const recipientSelectionView = ((0, jsx_runtime_1.jsx)(RecipientSelection_1.RecipientSelection, { initialValue: selectedRecipientAddress || "", onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onConfirm: address => {
223
- setSelectedRecipientAddress(address);
224
- setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
225
- } }));
226
- const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { globalAddress: globalAddress, globalWallet: undefined, selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
227
- setSelectedCryptoPaymentMethod(method);
228
- setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
229
- } }));
230
- const fiatPaymentMethodView = ((0, jsx_runtime_1.jsx)(FiatPaymentMethod_1.FiatPaymentMethodComponent, { selectedPaymentMethod: selectedFiatPaymentMethod, setSelectedPaymentMethod: setSelectedFiatPaymentMethod, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
231
- setSelectedFiatPaymentMethod(method);
232
- setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
233
- }, srcAmountOnRamp: srcAmount }));
234
- const pointsDetailView = ((0, jsx_runtime_1.jsx)(PointsDetailPanel_1.PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN) }));
235
- const feeDetailView = anyspendQuote?.data?.fee ? ((0, jsx_runtime_1.jsx)(FeeDetailPanel_1.FeeDetailPanel, { fee: anyspendQuote.data.fee, transactionAmountUsd: paymentType === "fiat"
236
- ? parseFloat(srcAmount)
237
- : anyspendQuote.data.currencyIn?.amountUsd
238
- ? Number(anyspendQuote.data.currencyIn.amountUsd)
239
- : undefined, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN) })) : null;
240
- // If showing token selection, render with panel transitions
241
- return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
242
- "bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsx)(react_1.TransitionPanel, { activeIndex: orderId
243
- ? oat
244
- ? useAnyspendFlow_1.PanelView.ORDER_DETAILS
245
- : useAnyspendFlow_1.PanelView.LOADING
246
- : activePanel === useAnyspendFlow_1.PanelView.ORDER_DETAILS
247
- ? useAnyspendFlow_1.PanelView.MAIN
248
- : activePanel, className: (0, cn_1.cn)("rounded-2xl", {
249
- "mt-0": mode === "modal",
250
- }), variants: {
251
- enter: { x: 300, opacity: 0 },
252
- center: { x: 0, opacity: 1 },
253
- exit: { x: -300, opacity: 0 },
254
- }, transition: { type: "spring", stiffness: 300, damping: 30 }, children: [
255
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: mainView }, "main-view"),
256
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: cryptoPaymentMethodView }, "crypto-payment-method-view"),
257
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
258
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: recipientSelectionView }, "recipient-selection-view"),
259
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: orderDetailsView }, "order-details-view"),
260
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: loadingView }, "loading-view"),
261
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
262
- (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: feeDetailView }, "fee-detail-view"),
263
- ] }) }) }));
26
+ return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: hypeToken, destinationChainId: chains_1.base.id, orderType: "hype_duel", minDestinationAmount: 10, header: header, onSuccess: onSuccess, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa }));
264
27
  }
@@ -17,26 +17,19 @@ const ChainTokenIcon_1 = require("./ChainTokenIcon");
17
17
  function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, walletAddress, }) {
18
18
  // Track previous token to detect changes
19
19
  const prevTokenRef = (0, react_1.useRef)(token.address);
20
- // Track if initial balance has been set
21
- const initialBalanceSetRef = (0, react_1.useRef)(false);
22
20
  // Only get token balance when context is "from" (for setting max amount)
23
21
  const { rawBalance } = (0, react_2.useTokenBalance)({
24
22
  token,
25
23
  address: context === "from" && walletAddress ? walletAddress : undefined,
26
24
  });
27
- // Reset balance ref when token address or chain changes
28
- (0, react_1.useEffect)(() => {
29
- initialBalanceSetRef.current = false;
30
- }, [token.address, token.chainId]);
31
25
  (0, react_1.useEffect)(() => {
32
26
  // Only handle "from" context
33
27
  if (context !== "from")
34
28
  return;
35
29
  // Check if token changed or if this is the initial load with balance
36
30
  const isTokenChanged = prevTokenRef.current !== token.address;
37
- const isInitialLoad = !initialBalanceSetRef.current && rawBalance;
38
- if ((isTokenChanged || isInitialLoad) && rawBalance) {
39
- console.log(`Setting max balance - Token: ${token.address}, Changed: ${isTokenChanged}, Initial: ${isInitialLoad}`);
31
+ if (isTokenChanged && rawBalance) {
32
+ console.log(`Setting max balance - Token: ${token.address}, Changed: ${isTokenChanged}`);
40
33
  // Calculate max amount with gas reserve for native tokens
41
34
  let maxAmount;
42
35
  if ((0, token_1.isNativeToken)(token.address)) {
@@ -52,7 +45,6 @@ function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, addres
52
45
  onChangeInput((0, viem_1.formatUnits)(maxAmount, token.decimals));
53
46
  // Update refs
54
47
  prevTokenRef.current = token.address;
55
- initialBalanceSetRef.current = true;
56
48
  }
57
49
  }, [token.address, token.chainId, token.decimals, chainId, context, onChangeInput, rawBalance]);
58
50
  const handleTokenSelect = (newToken) => {
@@ -3,6 +3,7 @@ export { AnySpendBondKit } from "./AnySpendBondKit";
3
3
  export { AnySpendBuySpin } from "./AnySpendBuySpin";
4
4
  export { AnySpendCustom } from "./AnySpendCustom";
5
5
  export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
6
+ export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
6
7
  export * from "./AnySpendFingerprintWrapper";
7
8
  export { AnySpendNFT } from "./AnySpendNFT";
8
9
  export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.CryptoReceiveSection = exports.CryptoPaySection = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeUpsideExactIn = exports.AnySpendStakeUpside = exports.AnySpendStakeB3ExactIn = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.AnySpendCustomExactIn = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
17
+ exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.CryptoReceiveSection = exports.CryptoPaySection = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeUpsideExactIn = exports.AnySpendStakeUpside = exports.AnySpendStakeB3ExactIn = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.HYPE_TOKEN_DETAILS = exports.AnySpendDepositHype = exports.AnySpendCustomExactIn = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
18
18
  // Components
19
19
  var AnySpend_1 = require("./AnySpend");
20
20
  Object.defineProperty(exports, "AnySpend", { enumerable: true, get: function () { return AnySpend_1.AnySpend; } });
@@ -26,6 +26,9 @@ var AnySpendCustom_1 = require("./AnySpendCustom");
26
26
  Object.defineProperty(exports, "AnySpendCustom", { enumerable: true, get: function () { return AnySpendCustom_1.AnySpendCustom; } });
27
27
  var AnySpendCustomExactIn_1 = require("./AnySpendCustomExactIn");
28
28
  Object.defineProperty(exports, "AnySpendCustomExactIn", { enumerable: true, get: function () { return AnySpendCustomExactIn_1.AnySpendCustomExactIn; } });
29
+ var AnyspendDepositHype_1 = require("./AnyspendDepositHype");
30
+ Object.defineProperty(exports, "AnySpendDepositHype", { enumerable: true, get: function () { return AnyspendDepositHype_1.AnySpendDepositHype; } });
31
+ Object.defineProperty(exports, "HYPE_TOKEN_DETAILS", { enumerable: true, get: function () { return AnyspendDepositHype_1.HYPE_TOKEN_DETAILS; } });
29
32
  __exportStar(require("./AnySpendFingerprintWrapper"), exports);
30
33
  var AnySpendNFT_1 = require("./AnySpendNFT");
31
34
  Object.defineProperty(exports, "AnySpendNFT", { enumerable: true, get: function () { return AnySpendNFT_1.AnySpendNFT; } });
@@ -42,7 +42,7 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
42
42
  const defaultDstToken = anyspend_1.B3_TOKEN; // Default destination token
43
43
  const [selectedSrcToken, setSelectedSrcToken] = (0, react_3.useState)(defaultSrcToken);
44
44
  const [selectedDstToken, setSelectedDstToken] = (0, react_3.useState)(defaultDstToken);
45
- const [srcAmount, setSrcAmount] = (0, react_3.useState)(paymentType === "fiat" ? "5" : "0.1");
45
+ const [srcAmount, setSrcAmount] = (0, react_3.useState)(paymentType === "fiat" ? "5" : "0");
46
46
  const [dstAmount, setDstAmount] = (0, react_3.useState)("");
47
47
  const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_3.useState)(true);
48
48
  // Derive destination chain ID from token or prop (cannot change)
@@ -12,7 +12,6 @@ const invariant_1 = __importDefault(require("invariant"));
12
12
  const react_1 = require("react");
13
13
  const sonner_1 = require("sonner");
14
14
  const thirdweb_2 = require("thirdweb");
15
- const react_2 = require("thirdweb/react");
16
15
  const viem_1 = require("viem");
17
16
  const wagmi_1 = require("wagmi");
18
17
  const components_1 = require("../components");
@@ -25,7 +24,6 @@ const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
25
24
  function useUnifiedChainSwitchAndExecute() {
26
25
  const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
27
26
  const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_1.useState)(false);
28
- const activeWallet = (0, react_2.useActiveWallet)();
29
27
  const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
30
28
  const { account: aaAccount } = (0, components_1.useB3)();
31
29
  // Handle EOA wallet chain switch and execute transaction
@@ -40,18 +38,18 @@ function useUnifiedChainSwitchAndExecute() {
40
38
  sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
41
39
  return;
42
40
  }
43
- const currentChainId = activeWallet?.getChain()?.id;
41
+ const currentChainId = connectedEOAWallet?.getChain()?.id;
44
42
  const onCorrectChain = currentChainId === targetChainId;
45
43
  // Helper function to execute the transaction
46
44
  const executeTransaction = async () => {
47
- const signer = activeWallet?.getAccount();
45
+ const signer = connectedEOAWallet?.getAccount();
48
46
  if (!signer) {
49
47
  throw new Error("No account connected");
50
48
  }
51
49
  // Coinbase Smart Wallet specific chain switching (different behavior from other wallets)
52
50
  const walletChain = connectedEOAWallet.getChain();
53
51
  if (walletChain?.id !== targetChainId) {
54
- activeWallet?.switchChain((0, supported_1.getThirdwebChain)(targetChainId));
52
+ connectedEOAWallet?.switchChain((0, supported_1.getThirdwebChain)(targetChainId));
55
53
  }
56
54
  (0, invariant_1.default)((0, viem_1.isAddress)(params.to), "params.to is not a valid address");
57
55
  const result = await signer.sendTransaction({
@@ -103,7 +101,7 @@ function useUnifiedChainSwitchAndExecute() {
103
101
  finally {
104
102
  setIsSwitchingOrExecuting(false);
105
103
  }
106
- }, [connectedEOAWallet, activeWallet, switchChainAsync]);
104
+ }, [connectedEOAWallet, switchChainAsync]);
107
105
  // Handle AA wallet transaction (no chain switch needed for AA)
108
106
  const handleAASendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
109
107
  if (!aaAccount) {
@@ -159,14 +157,8 @@ function useUnifiedChainSwitchAndExecute() {
159
157
  if (isActiveSmartWallet) {
160
158
  return handleAASendTransaction(targetChainId, params);
161
159
  }
162
- else if (isActiveEOAWallet) {
163
- return handleEOASwitchChainAndSendTransaction(targetChainId, params);
164
- }
165
- else {
166
- sonner_1.toast.error("No wallet connected");
167
- return undefined;
168
- }
169
- }, [isActiveSmartWallet, isActiveEOAWallet, handleAASendTransaction, handleEOASwitchChainAndSendTransaction]);
160
+ return handleEOASwitchChainAndSendTransaction(targetChainId, params);
161
+ }, [isActiveSmartWallet, handleAASendTransaction, handleEOASwitchChainAndSendTransaction]);
170
162
  return {
171
163
  switchChainAndExecute,
172
164
  switchChainAndExecuteWithEOA: handleEOASwitchChainAndSendTransaction,
@@ -95,7 +95,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
95
95
  });
96
96
  const [selectedSrcToken, setSelectedSrcToken] = useState(srcTokenFromUrl);
97
97
  const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
98
- const [srcAmount, setSrcAmount] = useState(searchParams.get("fromAmount") || "0.01");
98
+ const [srcAmount, setSrcAmount] = useState(searchParams.get("fromAmount") || "0");
99
99
  // State for onramp amount
100
100
  const [srcAmountOnRamp, setSrcAmountOnRamp] = useState(searchParams.get("fromAmount") || "5");
101
101
  // State for destination chain/token selection
@@ -24,7 +24,9 @@ export interface AnySpendCustomExactInProps {
24
24
  }) => void;
25
25
  customUsdInputValues?: string[];
26
26
  preferEoa?: boolean;
27
- customExactInConfig: CustomExactInConfig;
27
+ customExactInConfig?: CustomExactInConfig;
28
+ orderType?: "hype_duel" | "custom_exact_in";
29
+ minDestinationAmount?: number;
28
30
  header?: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
29
31
  anyspendPrice: GetQuoteResponse | undefined;
30
32
  isLoadingAnyspendPrice: boolean;