@b3dotfun/sdk 0.0.87-alpha.0 → 0.0.87-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.
Files changed (90) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -0
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +77 -73
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
  5. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
  7. package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
  8. package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
  9. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
  10. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
  11. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
  12. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  13. package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
  14. package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
  15. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
  16. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
  17. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
  18. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
  19. package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
  20. package/dist/cjs/anyspend/react/components/index.js +3 -1
  21. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  22. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  23. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  24. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
  25. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
  26. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
  27. package/dist/cjs/anyspend/utils/format.js +28 -5
  28. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  29. package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
  30. package/dist/esm/anyspend/react/components/AnySpend.js +77 -73
  31. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  32. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
  33. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
  34. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
  35. package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
  36. package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
  37. package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
  38. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
  39. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
  40. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  41. package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
  42. package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
  43. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
  44. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
  45. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
  46. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
  47. package/dist/esm/anyspend/react/components/index.d.ts +2 -0
  48. package/dist/esm/anyspend/react/components/index.js +1 -0
  49. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  50. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  51. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  52. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
  53. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
  54. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
  55. package/dist/esm/anyspend/utils/format.js +28 -5
  56. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  57. package/dist/styles/index.css +1 -1
  58. package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
  59. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  60. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
  61. package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
  62. package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
  63. package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
  64. package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
  65. package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
  66. package/dist/types/anyspend/react/components/index.d.ts +2 -0
  67. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  68. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  69. package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
  70. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  71. package/package.json +1 -1
  72. package/src/anyspend/react/components/AnySpend.tsx +105 -85
  73. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
  74. package/src/anyspend/react/components/AnySpendDeposit.tsx +578 -0
  75. package/src/anyspend/react/components/QRDeposit.tsx +348 -0
  76. package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
  77. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
  78. package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
  79. package/src/anyspend/react/components/common/WarningText.tsx +52 -0
  80. package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
  81. package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
  82. package/src/anyspend/react/components/icons/credit-card.svg +5 -0
  83. package/src/anyspend/react/components/icons/qr-code.svg +5 -0
  84. package/src/anyspend/react/components/index.ts +2 -0
  85. package/src/anyspend/react/hooks/index.ts +1 -0
  86. package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
  87. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
  88. package/src/anyspend/utils/format.ts +33 -5
  89. package/src/global-account/react/stores/useModalStore.ts +4 -0
  90. package/src/styles/index.css +2 -0
@@ -0,0 +1,122 @@
1
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
3
+ export interface DepositContractConfig {
4
+ /** Custom function ABI JSON string */
5
+ functionAbi: string;
6
+ /** The function name to call */
7
+ functionName: string;
8
+ /** Custom function arguments. Use "{{amount_out}}" for the deposit amount placeholder */
9
+ functionArgs: string[];
10
+ /** The contract address to deposit to */
11
+ to: string;
12
+ /** Optional spender address if different from contract address */
13
+ spenderAddress?: string;
14
+ /** Custom action label */
15
+ action?: string;
16
+ }
17
+ export interface ChainConfig {
18
+ /** Chain ID */
19
+ id: number;
20
+ /** Display name */
21
+ name: string;
22
+ /** Optional icon URL */
23
+ iconUrl?: string;
24
+ }
25
+ export interface AnySpendDepositProps {
26
+ /** Order ID to load an existing order */
27
+ loadOrder?: string;
28
+ /** Display mode */
29
+ mode?: "modal" | "page";
30
+ /** The recipient address for the deposit */
31
+ recipientAddress: string;
32
+ /** Payment type - crypto or fiat. If not set, shows chain selection first */
33
+ paymentType?: "crypto" | "fiat";
34
+ /** Source token address to pre-select */
35
+ sourceTokenAddress?: string;
36
+ /** Source chain ID to pre-select. If not provided, shows chain selection */
37
+ sourceTokenChainId?: number;
38
+ /** The destination token to receive */
39
+ destinationToken: components["schemas"]["Token"];
40
+ /** The destination chain ID */
41
+ destinationChainId: number;
42
+ /** Callback when deposit succeeds */
43
+ onSuccess?: (amount: string) => void;
44
+ /** Callback for opening a custom modal (e.g., for special token handling) */
45
+ onOpenCustomModal?: () => void;
46
+ /** Custom footer content */
47
+ mainFooter?: React.ReactNode;
48
+ /** Called when a token is selected. Call event.preventDefault() to prevent default behavior */
49
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
50
+ preventDefault: () => void;
51
+ }) => void;
52
+ /** Custom USD input value presets for fiat payment */
53
+ customUsdInputValues?: string[];
54
+ /** Whether to prefer using connected EOA wallet */
55
+ preferEoa?: boolean;
56
+ /** Minimum destination amount required */
57
+ minDestinationAmount?: number;
58
+ /** Custom header component */
59
+ header?: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
60
+ anyspendPrice: GetQuoteResponse | undefined;
61
+ isLoadingAnyspendPrice: boolean;
62
+ }) => React.JSX.Element;
63
+ /** Order type for the deposit */
64
+ orderType?: "hype_duel" | "custom_exact_in" | "swap";
65
+ /** Custom action label displayed on buttons */
66
+ actionLabel?: string;
67
+ /** Configuration for depositing to a custom contract.
68
+ * If provided, creates a custom_exact_in order that calls the contract.
69
+ * If not provided, creates a simple hype_duel order for direct deposits.
70
+ */
71
+ depositContractConfig?: DepositContractConfig;
72
+ /** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
73
+ showChainSelection?: boolean;
74
+ /** Custom list of supported chains. If not provided, uses default chains */
75
+ supportedChains?: ChainConfig[];
76
+ /** Minimum pool size for filtering tokens (default: 1,000,000) */
77
+ minPoolSize?: number;
78
+ /** Custom title for chain selection step */
79
+ chainSelectionTitle?: string;
80
+ /** Custom description for chain selection step */
81
+ chainSelectionDescription?: string;
82
+ /** Number of top chains to show (default: 3) */
83
+ topChainsCount?: number;
84
+ /** Callback when close button is clicked */
85
+ onClose?: () => void;
86
+ }
87
+ /**
88
+ * A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
89
+ *
90
+ * @example
91
+ * // Simple deposit with chain selection
92
+ * <AnySpendDeposit
93
+ * recipientAddress={userAddress}
94
+ * destinationToken={myToken}
95
+ * destinationChainId={base.id}
96
+ * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
97
+ * />
98
+ *
99
+ * @example
100
+ * // Skip chain selection by providing sourceTokenChainId
101
+ * <AnySpendDeposit
102
+ * recipientAddress={userAddress}
103
+ * destinationToken={myToken}
104
+ * destinationChainId={base.id}
105
+ * sourceTokenChainId={base.id}
106
+ * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
107
+ * />
108
+ *
109
+ * @example
110
+ * // Deposit with custom contract
111
+ * <AnySpendDeposit
112
+ * recipientAddress={userAddress}
113
+ * destinationToken={myToken}
114
+ * destinationChainId={base.id}
115
+ * depositContractConfig={{
116
+ * contractAddress: "0x...",
117
+ * functionName: "depositFor",
118
+ * }}
119
+ * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
120
+ * />
121
+ */
122
+ export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,43 @@
1
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { DepositContractConfig } from "./AnySpendDeposit";
3
+ export interface QRDepositProps {
4
+ /** Display mode */
5
+ mode?: "modal" | "page";
6
+ /** The recipient address (user's wallet) */
7
+ recipientAddress: string;
8
+ /** The source token to deposit (defaults to ETH on Base) */
9
+ sourceToken?: components["schemas"]["Token"];
10
+ /** The source chain ID (defaults to Base) */
11
+ sourceChainId?: number;
12
+ /** The destination token to receive */
13
+ destinationToken: components["schemas"]["Token"];
14
+ /** The destination chain ID */
15
+ destinationChainId: number;
16
+ /** Creator address (optional) */
17
+ creatorAddress?: string;
18
+ /** Contract config for custom execution after deposit */
19
+ depositContractConfig?: DepositContractConfig;
20
+ /** Callback when back button is clicked */
21
+ onBack?: () => void;
22
+ /** Callback when close button is clicked */
23
+ onClose?: () => void;
24
+ /** Callback when order is created successfully */
25
+ onOrderCreated?: (orderId: string) => void;
26
+ /** Callback when deposit is completed */
27
+ onSuccess?: (txHash?: string) => void;
28
+ }
29
+ /**
30
+ * A component for displaying QR code deposit functionality.
31
+ * Creates a deposit_first order on mount and shows a QR code that can be scanned to deposit tokens.
32
+ * Users can change the source token/chain using the TokenSelector.
33
+ *
34
+ * @example
35
+ * <QRDeposit
36
+ * recipientAddress={userAddress}
37
+ * destinationToken={usdcArbitrumToken}
38
+ * destinationChainId={42161}
39
+ * onBack={() => setStep("select-chain")}
40
+ * onSuccess={(txHash) => console.log("Deposit complete:", txHash)}
41
+ * />
42
+ */
43
+ export declare function QRDeposit({ mode, recipientAddress, sourceToken: sourceTokenProp, sourceChainId: sourceChainIdProp, destinationToken, destinationChainId, creatorAddress, depositContractConfig, onBack, onClose, onOrderCreated, onSuccess, }: QRDepositProps): import("react/jsx-runtime").JSX.Element;
@@ -14,6 +14,8 @@ interface OrderDetailsCollapsibleProps {
14
14
  showTotal?: boolean;
15
15
  totalAmount?: string;
16
16
  points?: number;
17
+ isOpen?: boolean;
18
+ onOpenChange?: (isOpen: boolean) => void;
17
19
  }
18
20
  export declare const OrderDetailsCollapsible: import("react").NamedExoticComponent<OrderDetailsCollapsibleProps>;
19
21
  export {};
@@ -0,0 +1,32 @@
1
+ export interface WarningTextProps {
2
+ /** The warning message content */
3
+ children: React.ReactNode;
4
+ /** Additional CSS classes */
5
+ className?: string;
6
+ }
7
+ /**
8
+ * A generic warning text component with consistent styling.
9
+ *
10
+ * @example
11
+ * <WarningText>
12
+ * Custom warning message
13
+ * </WarningText>
14
+ */
15
+ export declare function WarningText({ children, className }: WarningTextProps): import("react/jsx-runtime").JSX.Element;
16
+ export interface ChainWarningTextProps {
17
+ /** The chain ID to display warning for */
18
+ chainId: number;
19
+ /** Additional CSS classes */
20
+ className?: string;
21
+ }
22
+ /**
23
+ * A chain-aware warning text component that displays chain-specific warnings.
24
+ * Returns null if there's no warning for the given chain.
25
+ *
26
+ * @example
27
+ * <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
28
+ *
29
+ * @example
30
+ * <ChainWarningText chainId={destinationChainId} className="mt-4" />
31
+ */
32
+ export declare function ChainWarningText({ chainId, className }: ChainWarningTextProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface CreditCardIconProps {
3
+ className?: string;
4
+ }
5
+ export declare const CreditCardIcon: React.FC<CreditCardIconProps>;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface QrCodeIconProps {
3
+ className?: string;
4
+ }
5
+ export declare const QrCodeIcon: React.FC<QrCodeIconProps>;
6
+ export {};
@@ -4,6 +4,8 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin";
4
4
  export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
5
5
  export { AnySpendCustom } from "./AnySpendCustom";
6
6
  export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
7
+ export { AnySpendDeposit } from "./AnySpendDeposit";
8
+ export type { AnySpendDepositProps, ChainConfig, DepositContractConfig } from "./AnySpendDeposit";
7
9
  export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
8
10
  export * from "./AnySpendFingerprintWrapper";
9
11
  export { AnySpendNFT } from "./AnySpendNFT";
@@ -1,5 +1,6 @@
1
1
  export * from "./useAnyspendCreateOnrampOrder";
2
2
  export * from "./useAnyspendCreateOrder";
3
+ export * from "./useCreateDepositFirstOrder";
3
4
  export * from "./useAnyspendOrderAndTransactions";
4
5
  export * from "./useAnyspendOrderHistory";
5
6
  export * from "./useAnyspendQuote";
@@ -24,9 +24,9 @@ interface UseAnyspendFlowProps {
24
24
  destinationTokenChainId?: number;
25
25
  slippage?: number;
26
26
  disableUrlParamManagement?: boolean;
27
- orderType?: "hype_duel" | "custom_exact_in";
27
+ orderType?: "hype_duel" | "custom_exact_in" | "swap";
28
28
  }
29
- export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, isDepositMode, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
29
+ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
30
30
  activePanel: PanelView;
31
31
  setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
32
32
  orderId: string | undefined;
@@ -0,0 +1,24 @@
1
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { DepositContractConfig } from "../components/AnySpendDeposit";
3
+ export type CreateDepositFirstOrderParams = {
4
+ recipientAddress: string;
5
+ srcChain: number;
6
+ dstChain: number;
7
+ srcToken: components["schemas"]["Token"];
8
+ dstToken: components["schemas"]["Token"];
9
+ creatorAddress?: string;
10
+ /** Optional contract config for custom execution after deposit */
11
+ contractConfig?: DepositContractConfig;
12
+ };
13
+ export type UseCreateDepositFirstOrderProps = {
14
+ onSuccess?: (data: any) => void;
15
+ onError?: (error: Error) => void;
16
+ };
17
+ /**
18
+ * Hook for creating deposit_first orders in the Anyspend protocol.
19
+ * This order type doesn't require srcAmount - the user deposits tokens after the order is created.
20
+ */
21
+ export declare function useCreateDepositFirstOrder({ onSuccess, onError }?: UseCreateDepositFirstOrderProps): {
22
+ createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, CreateDepositFirstOrderParams, unknown>;
23
+ isCreatingOrder: boolean;
24
+ };
@@ -144,6 +144,10 @@ export interface AnySpendModalProps extends BaseModalProps {
144
144
  customUsdInputValues?: string[];
145
145
  /** Client-provided reference ID for tracking orders */
146
146
  clientReferenceId?: string;
147
+ /** Whether to hide the header */
148
+ hideHeader?: boolean;
149
+ /** When true, disables URL parameter management for swap configuration */
150
+ disableUrlParamManagement?: boolean;
147
151
  }
148
152
  /**
149
153
  * Props for the AnySpend NFT modal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.87-alpha.0",
3
+ "version": "0.0.87-alpha.2",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -90,6 +90,7 @@ const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
90
90
  export function AnySpend(props: {
91
91
  mode?: "page" | "modal";
92
92
  defaultActiveTab?: "crypto" | "fiat";
93
+ sourceChainId?: number;
93
94
  destinationTokenAddress?: string;
94
95
  destinationTokenChainId?: number;
95
96
  recipientAddress?: string;
@@ -102,6 +103,10 @@ export function AnySpend(props: {
102
103
  onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
103
104
  onSuccess?: (txHash?: string) => void;
104
105
  customUsdInputValues?: string[];
106
+ hideHeader?: boolean;
107
+ hideBottomNavigation?: boolean;
108
+ /** When true, disables URL parameter management for swap configuration */
109
+ disableUrlParamManagement?: boolean;
105
110
  }) {
106
111
  const fingerprintConfig = getFingerprintConfig();
107
112
 
@@ -113,6 +118,7 @@ export function AnySpend(props: {
113
118
  }
114
119
 
115
120
  function AnySpendInner({
121
+ sourceChainId,
116
122
  destinationTokenAddress,
117
123
  destinationTokenChainId,
118
124
  mode = "modal",
@@ -123,7 +129,11 @@ function AnySpendInner({
123
129
  onTokenSelect,
124
130
  onSuccess,
125
131
  customUsdInputValues,
132
+ hideHeader,
133
+ hideBottomNavigation = false,
134
+ disableUrlParamManagement = false,
126
135
  }: {
136
+ sourceChainId?: number;
127
137
  destinationTokenAddress?: string;
128
138
  destinationTokenChainId?: number;
129
139
  mode?: "page" | "modal";
@@ -134,6 +144,9 @@ function AnySpendInner({
134
144
  onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
135
145
  onSuccess?: (txHash?: string) => void;
136
146
  customUsdInputValues?: string[];
147
+ hideHeader?: boolean;
148
+ hideBottomNavigation?: boolean;
149
+ disableUrlParamManagement?: boolean;
137
150
  }) {
138
151
  const searchParams = useSearchParamsSSR();
139
152
  const router = useRouter();
@@ -211,7 +224,7 @@ function AnySpendInner({
211
224
  // const recipientInputRef = useRef<HTMLInputElement>(null);
212
225
 
213
226
  // Get initial chain IDs from URL or defaults
214
- const initialSrcChainId = parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
227
+ const initialSrcChainId = sourceChainId || parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
215
228
  const initialDstChainId =
216
229
  parseInt(searchParams.get("toChainId") || "0") || (isBuyMode ? destinationTokenChainId : base.id);
217
230
 
@@ -323,8 +336,8 @@ function AnySpendInner({
323
336
 
324
337
  // Load swap configuration from URL on initial render
325
338
  useEffect(() => {
326
- // Skip if we've already processed the URL or if we have an order to load
327
- if (initialUrlProcessed.current || loadOrder) return;
339
+ // Skip if we've already processed the URL, if we have an order to load, or if URL param management is disabled
340
+ if (initialUrlProcessed.current || loadOrder || disableUrlParamManagement) return;
328
341
 
329
342
  try {
330
343
  const tabParam = searchParams.get("tab");
@@ -357,7 +370,7 @@ function AnySpendInner({
357
370
 
358
371
  // Mark that we've processed the initial URL
359
372
  initialUrlProcessed.current = true;
360
- }, [searchParams, loadOrder]);
373
+ }, [searchParams, loadOrder, disableUrlParamManagement]);
361
374
 
362
375
  // Update URL when swap configuration changes - but not on initial load
363
376
  const updateSwapParamsInURL = useCallback(() => {
@@ -370,7 +383,8 @@ function AnySpendInner({
370
383
  activePanel !== PanelView.MAIN ||
371
384
  !initialUrlProcessed.current ||
372
385
  searchParams.has("orderId") ||
373
- mode === "modal"
386
+ mode === "modal" ||
387
+ disableUrlParamManagement
374
388
  )
375
389
  return;
376
390
 
@@ -441,6 +455,7 @@ function AnySpendInner({
441
455
  dstAmount,
442
456
  router,
443
457
  srcAmountOnRamp,
458
+ disableUrlParamManagement,
444
459
  ]);
445
460
 
446
461
  // Update URL when relevant state changes - but only after initial render
@@ -650,20 +665,20 @@ function AnySpendInner({
650
665
  // setNewRecipientAddress("");
651
666
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
652
667
 
653
- // Debug: Check payment method before setting URL
654
- console.log("Creating order - selectedCryptoPaymentMethod:", selectedCryptoPaymentMethod);
668
+ if (!disableUrlParamManagement) {
669
+ // Debug: Check payment method before setting URL
670
+ console.log("Creating order - selectedCryptoPaymentMethod:", selectedCryptoPaymentMethod);
655
671
 
656
- // Add orderId and payment method to URL for persistence
657
- const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
658
- params.set("orderId", orderId);
659
- if (effectiveCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
660
- console.log("Setting cryptoPaymentMethod in URL:", effectiveCryptoPaymentMethod);
661
- params.set("cryptoPaymentMethod", effectiveCryptoPaymentMethod);
662
- } else {
663
- console.log("Payment method is NONE, not setting in URL");
672
+ // Add orderId and payment method to URL for persistence
673
+ const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
674
+ params.set("orderId", orderId);
675
+ if (effectiveCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
676
+ params.set("cryptoPaymentMethod", effectiveCryptoPaymentMethod);
677
+ } else {
678
+ console.log("Payment method is NONE, not setting in URL");
679
+ }
680
+ router.push(`${window.location.pathname}?${params.toString()}`);
664
681
  }
665
- console.log("Final URL params:", params.toString());
666
- router.push(`${window.location.pathname}?${params.toString()}`);
667
682
  },
668
683
  onError: error => {
669
684
  console.error(error);
@@ -678,11 +693,13 @@ function AnySpendInner({
678
693
  setOrderId(orderId);
679
694
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
680
695
 
681
- // Add orderId and payment method to URL for persistence
682
- const params = new URLSearchParams(searchParams.toString());
683
- params.set("orderId", orderId);
684
- params.set("paymentMethod", "fiat");
685
- router.push(`${window.location.pathname}?${params.toString()}`);
696
+ if (!disableUrlParamManagement) {
697
+ // Add orderId and payment method to URL for persistence
698
+ const params = new URLSearchParams(searchParams.toString());
699
+ params.set("orderId", orderId);
700
+ params.set("paymentMethod", "fiat");
701
+ router.push(`${window.location.pathname}?${params.toString()}`);
702
+ }
686
703
  },
687
704
  onError: error => {
688
705
  console.error(error);
@@ -831,11 +848,13 @@ function AnySpendInner({
831
848
  type: "anySpendOrderHistory",
832
849
  showBackButton: false,
833
850
  });
834
- // Remove orderId and paymentMethod from URL when going back to history
835
- const params = new URLSearchParams(searchParams.toString());
836
- params.delete("orderId");
837
- params.delete("paymentMethod");
838
- router.push(`${window.location.pathname}?${params.toString()}`);
851
+ if (!disableUrlParamManagement) {
852
+ // Remove orderId and paymentMethod from URL when going back to history
853
+ const params = new URLSearchParams(searchParams.toString());
854
+ params.delete("orderId");
855
+ params.delete("paymentMethod");
856
+ router.push(`${window.location.pathname}?${params.toString()}`);
857
+ }
839
858
  };
840
859
 
841
860
  // Handle crypto swap creation
@@ -952,23 +971,25 @@ function AnySpendInner({
952
971
 
953
972
  // Update useEffect for URL parameter to not override loadOrder
954
973
  useEffect(() => {
955
- if (loadOrder) return; // Skip if we have a loadOrder
974
+ if (loadOrder || disableUrlParamManagement) return; // Skip if we have a loadOrder or URL param management is disabled
956
975
 
957
976
  const orderIdParam = searchParams.get("orderId");
958
977
  if (orderIdParam) {
959
978
  setOrderId(orderIdParam);
960
979
  setActivePanel(PanelView.ORDER_DETAILS);
961
980
  }
962
- }, [searchParams, loadOrder]);
981
+ }, [searchParams, loadOrder, disableUrlParamManagement]);
963
982
 
964
983
  const onSelectOrder = (selectedOrderId: string) => {
965
984
  setOrderId(selectedOrderId);
966
985
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
967
- // Update URL with the new orderId and preserve existing parameters
968
- const params = new URLSearchParams(searchParams.toString());
969
- params.set("orderId", selectedOrderId);
970
- // Keep existing paymentMethod if present
971
- router.push(`${window.location.pathname}?${params.toString()}`);
986
+ if (!disableUrlParamManagement) {
987
+ // Update URL with the new orderId and preserve existing parameters
988
+ const params = new URLSearchParams(searchParams.toString());
989
+ params.set("orderId", selectedOrderId);
990
+ // Keep existing paymentMethod if present
991
+ router.push(`${window.location.pathname}?${params.toString()}`);
992
+ }
972
993
  };
973
994
 
974
995
  // Save custom recipients to local storage when they change
@@ -1056,7 +1077,7 @@ function AnySpendInner({
1056
1077
  <div className={"mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5"}>
1057
1078
  <div className={"flex w-full max-w-full flex-col items-center gap-2 px-5"}>
1058
1079
  {/* Token Header - Show when in buy mode */}
1059
- {isBuyMode && (
1080
+ {isBuyMode && !hideHeader && (
1060
1081
  <div className="mb-4 flex flex-col items-center gap-3 text-center">
1061
1082
  {selectedDstToken.metadata?.logoURI && (
1062
1083
  <div className="relative">
@@ -1141,47 +1162,44 @@ function AnySpendInner({
1141
1162
  )}
1142
1163
 
1143
1164
  {/* Reverse swap direction section */}
1144
- <Button
1145
- variant="ghost"
1146
- className={cn(
1147
- "border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl",
1148
- isBuyMode && "top-[calc(50%+56px)] cursor-default",
1149
- activeTab === "fiat" && "hidden",
1150
- selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50",
1151
- )}
1152
- onClick={() => {
1153
- if (activeTab === "fiat" || isBuyMode) {
1154
- return;
1155
- }
1156
-
1157
- // Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
1158
- if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
1159
- return;
1160
- }
1161
-
1162
- // Swap chain selections
1163
- const tempSrcChainId = selectedSrcChainId;
1164
- const tempDstChainId = selectedDstChainId;
1165
- setSelectedSrcChainId(tempDstChainId);
1166
- setSelectedDstChainId(tempSrcChainId);
1167
-
1168
- // Swap token selections
1169
- const tempSrcToken = selectedSrcToken;
1170
- const tempDstToken = selectedDstToken;
1171
- setSelectedSrcToken(tempDstToken);
1172
- setSelectedDstToken(tempSrcToken);
1173
-
1174
- // Swap amounts
1175
- const tempSrcAmount = srcAmount;
1176
- const tempDstAmount = dstAmount;
1177
- setSrcAmount(tempDstAmount);
1178
- setDstAmount(tempSrcAmount);
1179
- }}
1180
- >
1181
- <div className="relative flex items-center justify-center transition-opacity">
1182
- <ArrowDown className="text-as-primary/50 h-5 w-5" />
1165
+ {activeTab === "crypto" && (
1166
+ <div className="z-10 -my-6 flex justify-center">
1167
+ <Button
1168
+ variant="ghost"
1169
+ className={cn(
1170
+ "border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl",
1171
+ isBuyMode && "cursor-default",
1172
+ selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50",
1173
+ )}
1174
+ onClick={() => {
1175
+ if (isBuyMode) {
1176
+ return;
1177
+ }
1178
+
1179
+ // Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
1180
+ if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
1181
+ return;
1182
+ }
1183
+
1184
+ // Swap chain selections
1185
+ setSelectedSrcChainId(selectedDstChainId);
1186
+ setSelectedDstChainId(selectedSrcChainId);
1187
+
1188
+ // Swap token selections
1189
+ setSelectedSrcToken(selectedDstToken);
1190
+ setSelectedDstToken(selectedSrcToken);
1191
+
1192
+ // Swap amounts
1193
+ setSrcAmount(dstAmount);
1194
+ setDstAmount(srcAmount);
1195
+ }}
1196
+ >
1197
+ <div className="relative flex items-center justify-center transition-opacity">
1198
+ <ArrowDown className="text-as-primary/50 h-5 w-5" />
1199
+ </div>
1200
+ </Button>
1183
1201
  </div>
1184
- </Button>
1202
+ )}
1185
1203
 
1186
1204
  {/* Receive section - Hidden when fiat tab is active */}
1187
1205
  {/* Receive section - Hidden when fiat tab is active */}
@@ -1262,7 +1280,7 @@ function AnySpendInner({
1262
1280
  }
1263
1281
  }}
1264
1282
  >
1265
- {mode !== "page" && <BottomNavigation />}
1283
+ {mode !== "page" && !hideBottomNavigation && <BottomNavigation />}
1266
1284
  </TabsPrimitive>
1267
1285
  </div>
1268
1286
  </div>
@@ -1284,16 +1302,18 @@ function AnySpendInner({
1284
1302
  onOrderCreated={orderId => {
1285
1303
  setOrderId(orderId);
1286
1304
  navigateToPanel(PanelView.ORDER_DETAILS, "forward");
1287
- // Add orderId and payment method to URL for persistence
1288
- const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
1289
- params.set("orderId", orderId);
1290
- // For fiat payments, the payment method is always fiat (but we use the active tab context)
1291
- if (activeTab === "fiat") {
1292
- params.set("paymentMethod", "fiat");
1293
- } else if (selectedCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
1294
- params.set("paymentMethod", selectedCryptoPaymentMethod);
1305
+ if (!disableUrlParamManagement) {
1306
+ // Add orderId and payment method to URL for persistence
1307
+ const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
1308
+ params.set("orderId", orderId);
1309
+ // For fiat payments, the payment method is always fiat (but we use the active tab context)
1310
+ if (activeTab === "fiat") {
1311
+ params.set("paymentMethod", "fiat");
1312
+ } else if (selectedCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
1313
+ params.set("paymentMethod", selectedCryptoPaymentMethod);
1314
+ }
1315
+ router.push(`${window.location.pathname}?${params.toString()}`);
1295
1316
  }
1296
- router.push(`${window.location.pathname}?${params.toString()}`);
1297
1317
  }}
1298
1318
  onBack={navigateBack}
1299
1319
  recipientEnsName={globalWallet?.ensName}
@@ -57,7 +57,7 @@ export interface AnySpendCustomExactInProps {
57
57
  customUsdInputValues?: string[];
58
58
  preferEoa?: boolean;
59
59
  customExactInConfig?: CustomExactInConfig;
60
- orderType?: "hype_duel" | "custom_exact_in";
60
+ orderType?: "hype_duel" | "custom_exact_in" | "swap";
61
61
  minDestinationAmount?: number;
62
62
  header?: ({
63
63
  anyspendPrice,
@@ -147,7 +147,6 @@ function AnySpendCustomExactInInner({
147
147
  paymentType,
148
148
  recipientAddress,
149
149
  loadOrder,
150
- isDepositMode: true,
151
150
  onTransactionSuccess: onSuccess,
152
151
  sourceTokenAddress,
153
152
  sourceTokenChainId,
@@ -314,7 +313,7 @@ function AnySpendCustomExactInInner({
314
313
  );
315
314
 
316
315
  const mainView = (
317
- <div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-2">
316
+ <div className="anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2">
318
317
  {headerContent}
319
318
 
320
319
  <div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">