@b3dotfun/sdk 0.0.87-alpha.1 → 0.0.87

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 +0 -5
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +49 -59
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +2 -1
  5. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +12 -17
  6. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
  7. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +5 -12
  8. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  9. package/dist/cjs/anyspend/react/components/index.d.ts +0 -2
  10. package/dist/cjs/anyspend/react/components/index.js +1 -3
  11. package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
  12. package/dist/cjs/anyspend/react/hooks/index.js +0 -1
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  14. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +11 -35
  15. package/dist/cjs/anyspend/utils/format.js +5 -28
  16. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -4
  17. package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -5
  18. package/dist/esm/anyspend/react/components/AnySpend.js +49 -59
  19. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  20. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +2 -1
  21. package/dist/esm/anyspend/react/components/common/OrderDetails.js +12 -17
  22. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
  23. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +5 -12
  24. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  25. package/dist/esm/anyspend/react/components/index.d.ts +0 -2
  26. package/dist/esm/anyspend/react/components/index.js +0 -1
  27. package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
  28. package/dist/esm/anyspend/react/hooks/index.js +0 -1
  29. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  30. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +11 -35
  31. package/dist/esm/anyspend/utils/format.js +5 -28
  32. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -4
  33. package/dist/styles/index.css +1 -1
  34. package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -5
  35. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  36. package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
  37. package/dist/types/anyspend/react/components/index.d.ts +0 -2
  38. package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
  39. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  40. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -4
  41. package/package.json +1 -1
  42. package/src/anyspend/react/components/AnySpend.tsx +45 -68
  43. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +3 -2
  44. package/src/anyspend/react/components/common/OrderDetails.tsx +8 -26
  45. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +8 -20
  46. package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
  47. package/src/anyspend/react/components/index.ts +0 -2
  48. package/src/anyspend/react/hooks/index.ts +0 -1
  49. package/src/anyspend/react/hooks/useAnyspendFlow.ts +12 -37
  50. package/src/anyspend/utils/format.ts +5 -33
  51. package/src/global-account/react/stores/useModalStore.ts +0 -4
  52. package/src/styles/index.css +0 -2
  53. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
  54. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +0 -190
  55. package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +0 -43
  56. package/dist/cjs/anyspend/react/components/QRDeposit.js +0 -146
  57. package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +0 -32
  58. package/dist/cjs/anyspend/react/components/common/WarningText.js +0 -36
  59. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
  60. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +0 -6
  61. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
  62. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +0 -6
  63. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
  64. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +0 -86
  65. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
  66. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +0 -187
  67. package/dist/esm/anyspend/react/components/QRDeposit.d.ts +0 -43
  68. package/dist/esm/anyspend/react/components/QRDeposit.js +0 -143
  69. package/dist/esm/anyspend/react/components/common/WarningText.d.ts +0 -32
  70. package/dist/esm/anyspend/react/components/common/WarningText.js +0 -32
  71. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
  72. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +0 -2
  73. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
  74. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +0 -2
  75. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
  76. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +0 -83
  77. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
  78. package/dist/types/anyspend/react/components/QRDeposit.d.ts +0 -43
  79. package/dist/types/anyspend/react/components/common/WarningText.d.ts +0 -32
  80. package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
  81. package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
  82. package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
  83. package/src/anyspend/react/components/AnySpendDeposit.tsx +0 -578
  84. package/src/anyspend/react/components/QRDeposit.tsx +0 -348
  85. package/src/anyspend/react/components/common/WarningText.tsx +0 -52
  86. package/src/anyspend/react/components/icons/CreditCardIcon.tsx +0 -25
  87. package/src/anyspend/react/components/icons/QrCodeIcon.tsx +0 -25
  88. package/src/anyspend/react/components/icons/credit-card.svg +0 -5
  89. package/src/anyspend/react/components/icons/qr-code.svg +0 -5
  90. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +0 -110
@@ -152,7 +152,6 @@
152
152
  --red-100: #fde6d7;
153
153
  --green-100: #dff9e8;
154
154
  --border-brand: #2a9fff;
155
- --border-primary: #d1d1d6;
156
155
  --yellow-100: #fee6c7;
157
156
  --purple-100: #f5edfa;
158
157
  --purple-300: #ddc3ef;
@@ -250,7 +249,6 @@ html[data-theme="dark"] .b3-root,
250
249
  --red-100: #6a5550;
251
250
  --green-100: rgba(68, 90, 76, 0.57);
252
251
  --border-brand: #2a9fff;
253
- --border-primary: #d1d1d6;
254
252
  --yellow-100: #957a6c;
255
253
  --purple-100: rgba(113, 88, 126, 0.38);
256
254
  --purple-300: #a375c3;
@@ -1,122 +0,0 @@
1
- import { components } from "../../../anyspend/types/api";
2
- import { GetQuoteResponse } from "../../../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;
@@ -1,190 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AnySpendDeposit = AnySpendDeposit;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const anyspend_1 = require("../../../anyspend");
6
- const react_1 = require("../../../global-account/react");
7
- const cn_1 = require("../../../shared/utils/cn");
8
- const react_2 = require("@web3icons/react");
9
- const lucide_react_1 = require("lucide-react");
10
- const react_3 = require("react");
11
- const AnySpend_1 = require("./AnySpend");
12
- const AnySpendCustomExactIn_1 = require("./AnySpendCustomExactIn");
13
- const WarningText_1 = require("./common/WarningText");
14
- const CreditCardIcon_1 = require("./icons/CreditCardIcon");
15
- const QrCodeIcon_1 = require("./icons/QrCodeIcon");
16
- const QRDeposit_1 = require("./QRDeposit");
17
- // Default supported chains
18
- const DEFAULT_SUPPORTED_CHAINS = [
19
- { id: 8453, name: "Base" },
20
- { id: 1, name: "Ethereum" },
21
- { id: 42161, name: "Arbitrum" },
22
- { id: 10, name: "Optimism" },
23
- { id: 137, name: "Polygon" },
24
- { id: 56, name: "BNB Chain" },
25
- ];
26
- // Minimum pool size to filter out low liquidity tokens
27
- const DEFAULT_MIN_POOL_SIZE = 1000000;
28
- function formatUsd(value) {
29
- return new Intl.NumberFormat("en-US", {
30
- style: "currency",
31
- currency: "USD",
32
- minimumFractionDigits: 0,
33
- maximumFractionDigits: value >= 100 ? 0 : 2,
34
- }).format(value);
35
- }
36
- function formatDecimal(value) {
37
- return new Intl.NumberFormat("en-US", {
38
- style: "decimal",
39
- minimumFractionDigits: 0,
40
- maximumFractionDigits: value >= 100 ? 0 : 2,
41
- }).format(value);
42
- }
43
- // Chain icon component
44
- function ChainIcon({ chainId, className }) {
45
- const iconProps = {
46
- variant: "branded",
47
- className: (0, cn_1.cn)("anyspend-deposit-chain-icon", className),
48
- };
49
- switch (chainId) {
50
- case 1:
51
- return (0, jsx_runtime_1.jsx)(react_2.NetworkEthereum, { ...iconProps });
52
- case 8453:
53
- return (0, jsx_runtime_1.jsx)(react_2.NetworkBase, { ...iconProps });
54
- case 137:
55
- return (0, jsx_runtime_1.jsx)(react_2.NetworkPolygonPos, { ...iconProps });
56
- case 42161:
57
- return (0, jsx_runtime_1.jsx)(react_2.NetworkArbitrumOne, { ...iconProps });
58
- case 10:
59
- return (0, jsx_runtime_1.jsx)(react_2.NetworkOptimism, { ...iconProps });
60
- case 56:
61
- return (0, jsx_runtime_1.jsx)(react_2.NetworkBinanceSmartChain, { ...iconProps });
62
- default:
63
- return null;
64
- }
65
- }
66
- /**
67
- * A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
68
- *
69
- * @example
70
- * // Simple deposit with chain selection
71
- * <AnySpendDeposit
72
- * recipientAddress={userAddress}
73
- * destinationToken={myToken}
74
- * destinationChainId={base.id}
75
- * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
76
- * />
77
- *
78
- * @example
79
- * // Skip chain selection by providing sourceTokenChainId
80
- * <AnySpendDeposit
81
- * recipientAddress={userAddress}
82
- * destinationToken={myToken}
83
- * destinationChainId={base.id}
84
- * sourceTokenChainId={base.id}
85
- * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
86
- * />
87
- *
88
- * @example
89
- * // Deposit with custom contract
90
- * <AnySpendDeposit
91
- * recipientAddress={userAddress}
92
- * destinationToken={myToken}
93
- * destinationChainId={base.id}
94
- * depositContractConfig={{
95
- * contractAddress: "0x...",
96
- * functionName: "depositFor",
97
- * }}
98
- * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
99
- * />
100
- */
101
- function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, }) {
102
- const { connectedEOAWallet } = (0, react_1.useAccountWallet)();
103
- const eoaAddress = connectedEOAWallet?.getAccount()?.address;
104
- // Determine if we should show chain selection
105
- const shouldShowChainSelection = showChainSelection ?? (!initialSourceChainId && !initialPaymentType);
106
- const [step, setStep] = (0, react_3.useState)(shouldShowChainSelection ? "select-chain" : "deposit");
107
- const [selectedChainId, setSelectedChainId] = (0, react_3.useState)(initialSourceChainId);
108
- const [paymentType, setPaymentType] = (0, react_3.useState)(initialPaymentType ?? "crypto");
109
- // Fetch balances for EOA wallet
110
- const { data: balanceData, isLoading: isBalanceLoading } = (0, react_1.useSimBalance)(shouldShowChainSelection ? eoaAddress : undefined, supportedChains.map(c => c.id));
111
- // Group balances by chain and calculate total USD value per chain
112
- const chainBalances = (0, react_3.useMemo)(() => {
113
- if (!balanceData?.balances)
114
- return {};
115
- const filteredBalances = balanceData.balances.filter(token => token.address === "native" || (token.pool_size && token.pool_size > minPoolSize));
116
- return filteredBalances.reduce((acc, token) => {
117
- const chainId = token.chain_id;
118
- if (!acc[chainId]) {
119
- acc[chainId] = {
120
- chainId,
121
- chainName: token.chain,
122
- totalUsdValue: 0,
123
- tokenCount: 0,
124
- };
125
- }
126
- acc[chainId].totalUsdValue += token.value_usd || 0;
127
- acc[chainId].tokenCount += 1;
128
- return acc;
129
- }, {});
130
- }, [balanceData, minPoolSize]);
131
- // Sort chains by USD value (highest first)
132
- const sortedChains = (0, react_3.useMemo)(() => {
133
- return supportedChains
134
- .map(chain => ({
135
- ...chain,
136
- balance: chainBalances[chain.id]?.totalUsdValue || 0,
137
- tokenCount: chainBalances[chain.id]?.tokenCount || 0,
138
- }))
139
- .sort((a, b) => b.balance - a.balance);
140
- }, [supportedChains, chainBalances]);
141
- // Get top chains with balance
142
- const topChainsWithBalance = (0, react_3.useMemo)(() => {
143
- return sortedChains.filter(chain => chain.balance > 0).slice(0, topChainsCount);
144
- }, [sortedChains, topChainsCount]);
145
- // Calculate total balance across all chains
146
- const totalBalance = (0, react_3.useMemo)(() => {
147
- return Object.values(chainBalances).reduce((sum, chain) => sum + chain.totalUsdValue, 0);
148
- }, [chainBalances]);
149
- if (!recipientAddress)
150
- return null;
151
- const tokenSymbol = destinationToken.symbol ?? "TOKEN";
152
- // Determine order type based on config
153
- const effectiveOrderType = orderType ?? (depositContractConfig ? "custom_exact_in" : "swap");
154
- // Default header if not provided
155
- const defaultHeader = () => ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-header 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: "anyspend-deposit-title text-as-primary text-xl font-bold", children: paymentType === "crypto" ? `Deposit ${tokenSymbol}` : "Fund with Fiat" }) }) }));
156
- const handleSelectChain = (chainId) => {
157
- setSelectedChainId(chainId);
158
- setPaymentType("crypto");
159
- setStep("deposit");
160
- };
161
- const handleSelectCrypto = () => {
162
- setPaymentType("crypto");
163
- setSelectedChainId(undefined);
164
- setStep("deposit");
165
- };
166
- const handleSelectFiat = () => {
167
- setPaymentType("fiat");
168
- setSelectedChainId(undefined);
169
- setStep("deposit");
170
- };
171
- const handleBack = () => {
172
- setStep("select-chain");
173
- setSelectedChainId(undefined);
174
- };
175
- const handleSelectQrDeposit = () => {
176
- setStep("qr-deposit");
177
- };
178
- // Chain selection view
179
- if (step === "select-chain") {
180
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance-header border-secondary border-b p-5", children: [!isBalanceLoading && totalBalance > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance", children: [(0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: "USD" })] })] })), isBalanceLoading && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance-skeleton", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-2 h-4 w-24" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-8 w-32" })] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [...Array(topChainsCount)].map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-32" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-3 w-20" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chain-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-chain-info", children: [(0, jsx_runtime_1.jsxs)("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, (0, jsx_runtime_1.jsx)(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "mt-2" })] })] }));
181
- }
182
- // QR Deposit view
183
- if (step === "qr-deposit") {
184
- return ((0, jsx_runtime_1.jsx)(QRDeposit_1.QRDeposit, { mode: mode, recipientAddress: recipientAddress, destinationToken: destinationToken, destinationChainId: destinationChainId, depositContractConfig: depositContractConfig, onBack: handleBack, onClose: onClose ?? handleBack }));
185
- }
186
- // Check if destination is Hyperliquid
187
- const isHyperliquidDeposit = destinationChainId === anyspend_1.HYPERLIQUID_CHAIN_ID;
188
- // Deposit view
189
- return ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true })) : ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig })) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
190
- }
@@ -1,43 +0,0 @@
1
- import { components } from "../../../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;
@@ -1,146 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QRDeposit = QRDeposit;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const anyspend_1 = require("../../../anyspend");
6
- const react_1 = require("../../../global-account/react");
7
- const cn_1 = require("../../../shared/utils/cn");
8
- const relay_kit_ui_1 = require("@relayprotocol/relay-kit-ui");
9
- const lucide_react_1 = require("lucide-react");
10
- const qrcode_react_1 = require("qrcode.react");
11
- const react_2 = require("react");
12
- const useAnyspendOrderAndTransactions_1 = require("../hooks/useAnyspendOrderAndTransactions");
13
- const useCreateDepositFirstOrder_1 = require("../hooks/useCreateDepositFirstOrder");
14
- const ChainTokenIcon_1 = require("./common/ChainTokenIcon");
15
- const OrderDetails_1 = require("./common/OrderDetails");
16
- const WarningText_1 = require("./common/WarningText");
17
- // Default source token: ETH on Base
18
- const DEFAULT_ETH_ON_BASE = {
19
- chainId: 8453,
20
- address: "0x0000000000000000000000000000000000000000",
21
- symbol: "ETH",
22
- name: "Ethereum",
23
- decimals: 18,
24
- metadata: {
25
- logoURI: "https://assets.relay.link/icons/1/light.png",
26
- },
27
- };
28
- /**
29
- * A component for displaying QR code deposit functionality.
30
- * Creates a deposit_first order on mount and shows a QR code that can be scanned to deposit tokens.
31
- * Users can change the source token/chain using the TokenSelector.
32
- *
33
- * @example
34
- * <QRDeposit
35
- * recipientAddress={userAddress}
36
- * destinationToken={usdcArbitrumToken}
37
- * destinationChainId={42161}
38
- * onBack={() => setStep("select-chain")}
39
- * onSuccess={(txHash) => console.log("Deposit complete:", txHash)}
40
- * />
41
- */
42
- function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenProp, sourceChainId: sourceChainIdProp, destinationToken, destinationChainId, creatorAddress, depositContractConfig, onBack, onClose, onOrderCreated, onSuccess, }) {
43
- const [copied, setCopied] = (0, react_2.useState)(false);
44
- const [orderId, setOrderId] = (0, react_2.useState)();
45
- const [globalAddress, setGlobalAddress] = (0, react_2.useState)();
46
- const orderCreatedRef = (0, react_2.useRef)(false);
47
- const onSuccessCalled = (0, react_2.useRef)(false);
48
- // Source token/chain as state (can be changed by user)
49
- const [sourceChainId, setSourceChainId] = (0, react_2.useState)(sourceChainIdProp ?? 8453);
50
- const [sourceToken, setSourceToken] = (0, react_2.useState)(sourceTokenProp ?? DEFAULT_ETH_ON_BASE);
51
- // Handle token selection from TokenSelector
52
- const handleTokenSelect = (newToken) => {
53
- const token = {
54
- address: newToken.address,
55
- chainId: newToken.chainId,
56
- decimals: newToken.decimals,
57
- metadata: { logoURI: newToken.logoURI },
58
- name: newToken.name,
59
- symbol: newToken.symbol,
60
- };
61
- // Reset order state when token changes
62
- setOrderId(undefined);
63
- setGlobalAddress(undefined);
64
- orderCreatedRef.current = false;
65
- // Update token and chain
66
- setSourceChainId(newToken.chainId);
67
- setSourceToken(token);
68
- };
69
- // Create order hook
70
- const { createOrder, isCreatingOrder } = (0, useCreateDepositFirstOrder_1.useCreateDepositFirstOrder)({
71
- onSuccess: data => {
72
- const newOrderId = data.data.id;
73
- const newGlobalAddress = data.data.globalAddress;
74
- setOrderId(newOrderId);
75
- setGlobalAddress(newGlobalAddress);
76
- onOrderCreated?.(newOrderId);
77
- },
78
- onError: error => {
79
- console.error("Failed to create deposit order:", error);
80
- react_1.toast.error("Failed to create deposit order: " + error.message);
81
- },
82
- });
83
- // Fetch order status
84
- const { orderAndTransactions: oat } = (0, useAnyspendOrderAndTransactions_1.useAnyspendOrderAndTransactions)(orderId);
85
- // Create order on mount
86
- (0, react_2.useEffect)(() => {
87
- if (orderCreatedRef.current)
88
- return;
89
- orderCreatedRef.current = true;
90
- createOrder({
91
- recipientAddress,
92
- srcChain: sourceChainId,
93
- dstChain: destinationChainId,
94
- srcToken: sourceToken,
95
- dstToken: destinationToken,
96
- creatorAddress,
97
- contractConfig: depositContractConfig,
98
- });
99
- }, [
100
- recipientAddress,
101
- sourceChainId,
102
- destinationChainId,
103
- sourceToken,
104
- destinationToken,
105
- creatorAddress,
106
- depositContractConfig,
107
- createOrder,
108
- ]);
109
- // Call onSuccess when order is executed
110
- (0, react_2.useEffect)(() => {
111
- if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
112
- const txHash = oat?.data?.executeTx?.txHash;
113
- onSuccess?.(txHash);
114
- onSuccessCalled.current = true;
115
- }
116
- }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
117
- // Reset onSuccess flag when orderId changes
118
- (0, react_2.useEffect)(() => {
119
- onSuccessCalled.current = false;
120
- }, [orderId]);
121
- const displayAddress = globalAddress || recipientAddress;
122
- const handleCopyAddress = async () => {
123
- if (displayAddress) {
124
- await navigator.clipboard.writeText(displayAddress);
125
- setCopied(true);
126
- setTimeout(() => setCopied(false), 2000);
127
- }
128
- };
129
- const handleBack = () => {
130
- setCopied(false);
131
- onBack?.();
132
- };
133
- const handleClose = () => {
134
- setCopied(false);
135
- onClose?.();
136
- };
137
- // Show order details if order has deposits or is being processed
138
- if (oat?.data && oat.data.depositTxs && oat.data.depositTxs.length > 0) {
139
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-order-details font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsx)("div", { className: "anyspend-qr-order-details-content relative flex flex-col gap-4", children: (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, onBack: handleBack }) }) }));
140
- }
141
- // Show loading state while creating order (but not if we already have an orderId)
142
- if (isCreatingOrder && !orderId) {
143
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-loading font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-loading-content flex flex-col items-center justify-center gap-4 py-12", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "anyspend-qr-loading-spinner text-as-brand h-8 w-8 animate-spin" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-qr-loading-text text-as-secondary text-sm", children: "Creating deposit order..." })] }) }));
144
- }
145
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-deposit font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-deposit-content flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleBack, className: "anyspend-qr-back-button text-as-secondary hover:text-as-primary", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "anyspend-qr-title text-as-primary text-base font-semibold", children: "Deposit" }), onClose ? ((0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "anyspend-qr-close-button text-as-secondary hover:text-as-primary", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-5" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-token-selector flex flex-col gap-1.5", children: [(0, jsx_runtime_1.jsx)("label", { className: "anyspend-qr-token-label text-as-secondary text-sm", children: "Send" }), (0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { chainIdsFilter: (0, anyspend_1.getAvailableChainIds)("from"), context: "from", fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)("from"), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, setToken: handleTokenSelect, supportedWalletVMs: ["evm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "outline", role: "combobox", className: "anyspend-qr-token-trigger border-as-stroke bg-as-surface-secondary flex h-auto w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [sourceToken.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[sourceChainId]?.logoUrl, tokenUrl: sourceToken.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: sourceToken.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/70 text-xs", children: anyspend_1.ALL_CHAINS[sourceChainId]?.name ?? "Unknown" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-code-container flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-qr-code rounded-lg bg-white p-2", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: displayAddress, size: 120, level: "M", marginSize: 0 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "anyspend-qr-scan-hint text-as-secondary text-xs", children: ["SCAN WITH ", (0, jsx_runtime_1.jsx)("span", { className: "inline-block", children: "\uD83E\uDD8A" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-address-container flex flex-1 flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-qr-address-label text-as-secondary text-sm", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-address-row flex items-start gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-qr-address text-as-primary break-all font-mono text-sm leading-relaxed", children: displayAddress }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0", children: copied ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" }) })] })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId }), (0, jsx_runtime_1.jsxs)(WarningText_1.WarningText, { children: ["Only send ", sourceToken.symbol, " on ", anyspend_1.ALL_CHAINS[sourceChainId]?.name ?? "the specified chain", ". Other tokens will not be converted."] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-button flex w-full items-center justify-center gap-2 rounded-xl bg-blue-500 py-3.5 font-medium text-white transition-all hover:bg-blue-600", children: "Copy deposit address" })] }) }));
146
- }
@@ -1,32 +0,0 @@
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;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WarningText = WarningText;
4
- exports.ChainWarningText = ChainWarningText;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const anyspend_1 = require("../../../../anyspend");
7
- const cn_1 = require("../../../../shared/utils/cn");
8
- /**
9
- * A generic warning text component with consistent styling.
10
- *
11
- * @example
12
- * <WarningText>
13
- * Custom warning message
14
- * </WarningText>
15
- */
16
- function WarningText({ children, className }) {
17
- return (0, jsx_runtime_1.jsx)("p", { className: (0, cn_1.cn)("anyspend-warning text-center text-xs italic text-red-500", className), children: children });
18
- }
19
- /**
20
- * A chain-aware warning text component that displays chain-specific warnings.
21
- * Returns null if there's no warning for the given chain.
22
- *
23
- * @example
24
- * <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
25
- *
26
- * @example
27
- * <ChainWarningText chainId={destinationChainId} className="mt-4" />
28
- */
29
- function ChainWarningText({ chainId, className }) {
30
- // Chain-specific warning messages
31
- if (chainId === anyspend_1.HYPERLIQUID_CHAIN_ID) {
32
- return ((0, jsx_runtime_1.jsxs)(WarningText, { className: className, children: ["Minimum deposit amount: ", (0, jsx_runtime_1.jsx)("b", { children: "$1" })] }));
33
- }
34
- // No warning for this chain
35
- return null;
36
- }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface CreditCardIconProps {
3
- className?: string;
4
- }
5
- export declare const CreditCardIcon: React.FC<CreditCardIconProps>;
6
- export {};
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreditCardIcon = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const CreditCardIcon = ({ className }) => ((0, jsx_runtime_1.jsxs)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), (0, jsx_runtime_1.jsx)("path", { d: "M30 18H10M19 22H14M10 16.2L10 23.8C10 24.9201 10 25.4802 10.218 25.908C10.4097 26.2843 10.7157 26.5903 11.092 26.782C11.5198 27 12.0799 27 13.2 27L26.8 27C27.9201 27 28.4802 27 28.908 26.782C29.2843 26.5903 29.5903 26.2843 29.782 25.908C30 25.4802 30 24.9201 30 23.8V16.2C30 15.0799 30 14.5198 29.782 14.092C29.5903 13.7157 29.2843 13.4097 28.908 13.218C28.4802 13 27.9201 13 26.8 13L13.2 13C12.0799 13 11.5198 13 11.092 13.218C10.7157 13.4097 10.4097 13.7157 10.218 14.092C10 14.5198 10 15.0799 10 16.2Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
6
- exports.CreditCardIcon = CreditCardIcon;
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface QrCodeIconProps {
3
- className?: string;
4
- }
5
- export declare const QrCodeIcon: React.FC<QrCodeIconProps>;
6
- export {};