@b3dotfun/sdk 0.0.29-alpha.0 → 0.0.29-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 (51) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +1 -0
  2. package/dist/cjs/anyspend/constants/index.js +2 -1
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +23 -24
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
  7. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
  8. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +9 -8
  9. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +6 -4
  10. package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -0
  11. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  12. package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  13. package/dist/cjs/bondkit/abis/BondkitTokenABI.js +2 -3
  14. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -2
  15. package/dist/esm/anyspend/constants/index.d.ts +1 -0
  16. package/dist/esm/anyspend/constants/index.js +1 -0
  17. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  18. package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  19. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +23 -24
  20. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  21. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
  22. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -10
  23. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +7 -5
  24. package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -0
  25. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  26. package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  27. package/dist/esm/bondkit/abis/BondkitTokenABI.js +2 -3
  28. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -2
  29. package/dist/styles/index.css +1 -1
  30. package/dist/types/anyspend/constants/index.d.ts +1 -0
  31. package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  32. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
  33. package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -0
  34. package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  35. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -2
  36. package/package.json +1 -1
  37. package/src/anyspend/constants/index.ts +2 -0
  38. package/src/anyspend/react/components/AnySpend.tsx +1 -1
  39. package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
  40. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
  41. package/src/anyspend/react/components/AnyspendDepositHype.tsx +131 -129
  42. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +10 -4
  43. package/src/anyspend/react/components/common/OrderStatus.tsx +9 -2
  44. package/src/bondkit/abis/BondkitTokenABI.ts +2 -3
  45. package/src/global-account/react/stores/useModalStore.ts +4 -2
  46. package/dist/cjs/anyspend/abis/bondKit.d.ts +0 -35
  47. package/dist/cjs/anyspend/abis/bondKit.js +0 -29
  48. package/dist/esm/anyspend/abis/bondKit.d.ts +0 -35
  49. package/dist/esm/anyspend/abis/bondKit.js +0 -26
  50. package/dist/types/anyspend/abis/bondKit.d.ts +0 -35
  51. package/src/anyspend/abis/bondKit.ts +0 -26
@@ -1,4 +1,4 @@
1
- export declare function AnySpendDepositHype(props: {
1
+ export interface AnySpendDepositHypeProps {
2
2
  loadOrder?: string;
3
3
  mode?: "modal" | "page";
4
4
  recipientAddress: string;
@@ -7,4 +7,6 @@ export declare function AnySpendDepositHype(props: {
7
7
  sourceTokenChainId?: number;
8
8
  onSuccess?: () => void;
9
9
  depositContractAddress?: string;
10
- }): import("react/jsx-runtime").JSX.Element;
10
+ mainFooter?: React.ReactNode;
11
+ }
12
+ export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,6 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
2
3
  export declare const OrderStatus: import("react").NamedExoticComponent<{
3
4
  order: components["schemas"]["Order"];
5
+ selectedCryptoPaymentMethod?: CryptoPaymentMethodType;
4
6
  }>;
@@ -627,7 +627,7 @@ export declare const BondkitTokenABI: readonly [{
627
627
  }];
628
628
  readonly name: "buy";
629
629
  readonly outputs: readonly [];
630
- readonly stateMutability: "payable";
630
+ readonly stateMutability: "nonpayable";
631
631
  readonly type: "function";
632
632
  }, {
633
633
  readonly inputs: readonly [{
@@ -645,7 +645,7 @@ export declare const BondkitTokenABI: readonly [{
645
645
  }];
646
646
  readonly name: "buyFor";
647
647
  readonly outputs: readonly [];
648
- readonly stateMutability: "payable";
648
+ readonly stateMutability: "nonpayable";
649
649
  readonly type: "function";
650
650
  }, {
651
651
  readonly inputs: readonly [];
@@ -1242,7 +1242,4 @@ export declare const BondkitTokenABI: readonly [{
1242
1242
  }];
1243
1243
  readonly stateMutability: "view";
1244
1244
  readonly type: "function";
1245
- }, {
1246
- readonly stateMutability: "payable";
1247
- readonly type: "receive";
1248
1245
  }];
@@ -273,8 +273,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
273
273
  imageUrl?: string;
274
274
  /** Token name to display */
275
275
  tokenName?: string;
276
- /** Optional pre-filled ETH amount */
277
- ethAmount?: string;
276
+ /** Optional pre-filled B3 amount */
277
+ b3Amount?: string;
278
278
  /** Callback function called when purchase is successful */
279
279
  onSuccess?: (txHash?: string) => void;
280
280
  }
@@ -300,6 +300,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
300
300
  paymentType?: "crypto" | "fiat";
301
301
  /** Deposit contract address */
302
302
  depositContractAddress: string;
303
+ /** Main footer */
304
+ mainFooter?: React.ReactNode;
303
305
  /** Callback function called when the deposit is successful */
304
306
  onSuccess?: () => void;
305
307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.29-alpha.0",
3
+ "version": "0.0.29-alpha.2",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -96,3 +96,5 @@ export const VENDOR_DISPLAY_NAMES = {
96
96
  stripe: "Stripe",
97
97
  unknown: "Unknown Vendor",
98
98
  } as const;
99
+
100
+ export const DEPOSIT_HYPE_ACTION = "deposit_hype";
@@ -804,7 +804,7 @@ function AnySpendInner({
804
804
  <div className="relative flex flex-col gap-4">
805
805
  {oat && (
806
806
  <>
807
- <OrderStatus order={oat.data.order} />
807
+ <OrderStatus order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
808
808
  <OrderDetails
809
809
  mode={mode}
810
810
  order={oat.data.order}
@@ -1,4 +1,3 @@
1
- import { BondkitToken } from "../../../bondkit";
2
1
  import {
3
2
  Button,
4
3
  GlareCardRounded,
@@ -12,7 +11,7 @@ import { baseMainnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
12
11
  import { motion } from "motion/react";
13
12
  import { useEffect, useMemo, useState } from "react";
14
13
  import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
15
- import { ABI_bondKit } from "../../abis/bondKit";
14
+ import { BondkitToken, BondkitTokenABI } from "../../../bondkit";
16
15
  import { AnySpendCustom } from "./AnySpendCustom";
17
16
 
18
17
  // Debounce utility function
@@ -37,13 +36,13 @@ export function AnySpendBondKit({
37
36
  contractAddress,
38
37
  minTokensOut = "0",
39
38
  imageUrl,
40
- ethAmount: initialEthAmount,
39
+ b3Amount: initialB3Amount,
41
40
  onSuccess,
42
41
  }: AnySpendBondKitProps) {
43
42
  const hasMounted = useHasMounted();
44
- const [showAmountPrompt, setShowAmountPrompt] = useState(!initialEthAmount);
45
- const [ethAmount, setEthAmount] = useState(initialEthAmount || "");
46
- const [isAmountValid, setIsAmountValid] = useState(!!initialEthAmount);
43
+ const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
44
+ const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
45
+ const [isAmountValid, setIsAmountValid] = useState(!!initialB3Amount);
47
46
  const [validationError, setValidationError] = useState("");
48
47
  const [tokenName, setTokenName] = useState<string>("");
49
48
  const [tokenSymbol, setTokenSymbol] = useState<string>("");
@@ -76,12 +75,12 @@ export function AnySpendBondKit({
76
75
  const [name, symbol] = await Promise.all([
77
76
  basePublicClient.readContract({
78
77
  address: contractAddress as `0x${string}`,
79
- abi: ABI_bondKit,
78
+ abi: BondkitTokenABI,
80
79
  functionName: "name",
81
80
  }),
82
81
  basePublicClient.readContract({
83
82
  address: contractAddress as `0x${string}`,
84
- abi: ABI_bondKit,
83
+ abi: BondkitTokenABI,
85
84
  functionName: "symbol",
86
85
  }),
87
86
  ]);
@@ -99,12 +98,12 @@ export function AnySpendBondKit({
99
98
  }
100
99
  }, [contractAddress, basePublicClient]);
101
100
 
102
- // Get native token data for the chain
101
+ // Get b3 token data
103
102
  const {
104
103
  data: tokenData,
105
104
  isError: isTokenError,
106
105
  isLoading,
107
- } = useTokenData(baseMainnet.id, "0x0000000000000000000000000000000000000000");
106
+ } = useTokenData(baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
108
107
 
109
108
  // Convert token data to AnySpend Token type
110
109
  const dstToken = useMemo(() => {
@@ -144,17 +143,18 @@ export function AnySpendBondKit({
144
143
  }, 500),
145
144
  [bondkitTokenClient],
146
145
  );
147
- // Fetch initial quote if ethAmount is provided
146
+
147
+ // Fetch initial quote if b3Amount is provided
148
148
  useEffect(() => {
149
- if (initialEthAmount && bondkitTokenClient) {
150
- debouncedGetQuote(initialEthAmount);
149
+ if (initialB3Amount && bondkitTokenClient) {
150
+ debouncedGetQuote(initialB3Amount);
151
151
  }
152
- }, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
152
+ }, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
153
153
 
154
154
  const validateAndSetAmount = (value: string) => {
155
155
  // Allow empty input
156
156
  if (value === "") {
157
- setEthAmount("");
157
+ setB3Amount("");
158
158
  setIsAmountValid(false);
159
159
  setValidationError("");
160
160
  setQuote(null);
@@ -173,7 +173,7 @@ export function AnySpendBondKit({
173
173
  return;
174
174
  }
175
175
 
176
- // Prevent more than 18 decimal places (ETH precision)
176
+ // Prevent more than 18 decimal places (B3 precision)
177
177
  const parts = value.split(".");
178
178
  if (parts[1] && parts[1].length > 18) {
179
179
  return;
@@ -181,7 +181,7 @@ export function AnySpendBondKit({
181
181
 
182
182
  // Clean the input - remove leading zeros if not decimal
183
183
  const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
184
- setEthAmount(cleanedValue);
184
+ setB3Amount(cleanedValue);
185
185
 
186
186
  try {
187
187
  const parsedAmount = parseEther(cleanedValue);
@@ -208,7 +208,7 @@ export function AnySpendBondKit({
208
208
  Buy {tokenName} ({tokenSymbol})
209
209
  </h2>
210
210
  <div className="flex w-full flex-col items-center space-y-2">
211
- <span className="text-[28px] font-bold">{ethAmount} ETH</span>
211
+ <span className="text-[28px] font-bold">{b3Amount} B3</span>
212
212
  {quote && (
213
213
  <span className="text-lg">
214
214
  ≈ {formatNumberWithCommas(parseFloat(quote).toFixed(4))} {tokenSymbol}
@@ -294,7 +294,7 @@ export function AnySpendBondKit({
294
294
  >
295
295
  <div className="space-y-4">
296
296
  <div className="flex items-center justify-between">
297
- <p className="text-as-primary/70 text-sm font-medium">ETH Amount</p>
297
+ <p className="text-as-primary/70 text-sm font-medium">B3 Amount</p>
298
298
  </div>
299
299
 
300
300
  <div className="relative">
@@ -302,19 +302,19 @@ export function AnySpendBondKit({
302
302
  type="text"
303
303
  inputMode="decimal"
304
304
  placeholder="0.1"
305
- value={ethAmount}
305
+ value={b3Amount}
306
306
  onChange={e => validateAndSetAmount(e.target.value)}
307
- className={`h-14 px-4 text-lg ${!isAmountValid && ethAmount ? "border-as-red" : "border-b3-react-border"}`}
307
+ className={`h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}`}
308
308
  />
309
309
  </div>
310
310
 
311
- {!isAmountValid && ethAmount && <p className="text-as-red text-sm">{validationError}</p>}
311
+ {!isAmountValid && b3Amount && <p className="text-as-red text-sm">{validationError}</p>}
312
312
 
313
313
  <div className="bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm">
314
314
  <div className="flex items-center justify-between">
315
315
  <span className="text-as-primary/70 text-sm font-medium">Total Cost:</span>
316
316
  <div className="flex items-center gap-2">
317
- <span className="text-as-primary text-lg font-bold">{ethAmount || "0"} ETH</span>
317
+ <span className="text-as-primary text-lg font-bold">{b3Amount || "0"} B3</span>
318
318
  </div>
319
319
  </div>
320
320
  {isLoadingQuote ? (
@@ -333,11 +333,11 @@ export function AnySpendBondKit({
333
333
 
334
334
  <Button
335
335
  onClick={() => {
336
- if (isAmountValid && ethAmount) {
336
+ if (isAmountValid && b3Amount) {
337
337
  setShowAmountPrompt(false);
338
338
  }
339
339
  }}
340
- disabled={!isAmountValid || !ethAmount || isLoadingQuote}
340
+ disabled={!isAmountValid || !b3Amount || isLoadingQuote}
341
341
  className="bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium"
342
342
  >
343
343
  Continue
@@ -350,9 +350,9 @@ export function AnySpendBondKit({
350
350
  }
351
351
 
352
352
  const encodedData = encodeFunctionData({
353
- abi: ABI_bondKit,
353
+ abi: BondkitTokenABI,
354
354
  functionName: "buyFor",
355
- args: [recipientAddress as `0x${string}`, BigInt(minTokensOut)],
355
+ args: [recipientAddress as `0x${string}`, parseEther(b3Amount), BigInt(minTokensOut)],
356
356
  });
357
357
 
358
358
  return (
@@ -362,7 +362,7 @@ export function AnySpendBondKit({
362
362
  orderType={"custom"}
363
363
  dstChainId={baseMainnet.id}
364
364
  dstToken={dstToken}
365
- dstAmount={parseEther(ethAmount).toString()}
365
+ dstAmount={parseEther(b3Amount).toString()}
366
366
  contractAddress={contractAddress}
367
367
  encodedData={encodedData}
368
368
  metadata={{
@@ -649,7 +649,7 @@ function AnySpendCustomInner({
649
649
  >
650
650
  {oat && (
651
651
  <>
652
- <OrderStatusDisplay order={oat.data.order} />
652
+ <OrderStatusDisplay order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
653
653
  <OrderDetails
654
654
  mode={mode}
655
655
  order={oat.data.order}
@@ -1,4 +1,4 @@
1
- import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
1
+ import { B3_TOKEN, DEPOSIT_HYPE_ACTION } from "@b3dotfun/sdk/anyspend";
2
2
  import { Button, ShinyButton, StyleRoot, TransitionPanel } from "@b3dotfun/sdk/global-account/react";
3
3
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
4
4
  import invariant from "invariant";
@@ -32,7 +32,7 @@ function generateEncodedDataForDepositHype(amount: string, beneficiary: string):
32
32
  return encodedData;
33
33
  }
34
34
 
35
- export function AnySpendDepositHype(props: {
35
+ export interface AnySpendDepositHypeProps {
36
36
  loadOrder?: string;
37
37
  mode?: "modal" | "page";
38
38
  recipientAddress: string;
@@ -41,7 +41,10 @@ export function AnySpendDepositHype(props: {
41
41
  sourceTokenChainId?: number;
42
42
  onSuccess?: () => void;
43
43
  depositContractAddress?: string;
44
- }) {
44
+ mainFooter?: React.ReactNode;
45
+ }
46
+
47
+ export function AnySpendDepositHype(props: AnySpendDepositHypeProps) {
45
48
  const fingerprintConfig = getFingerprintConfig();
46
49
 
47
50
  return (
@@ -60,16 +63,8 @@ function AnySpendDepositHypeInner({
60
63
  sourceTokenChainId,
61
64
  onSuccess,
62
65
  depositContractAddress,
63
- }: {
64
- loadOrder?: string;
65
- mode?: "modal" | "page";
66
- recipientAddress: string;
67
- paymentType?: "crypto" | "fiat";
68
- sourceTokenAddress?: string;
69
- sourceTokenChainId?: number;
70
- onSuccess?: () => void;
71
- depositContractAddress?: string;
72
- }) {
66
+ mainFooter,
67
+ }: AnySpendDepositHypeProps) {
73
68
  // Use shared flow hook
74
69
  const {
75
70
  activePanel,
@@ -185,6 +180,125 @@ function AnySpendDepositHypeInner({
185
180
  }
186
181
  };
187
182
 
183
+ const mainView = (
184
+ <div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-2">
185
+ {/* Header */}
186
+ <div className="mb-4 flex flex-col items-center gap-3 text-center">
187
+ <div>
188
+ <h1 className="text-as-primary text-xl font-bold">
189
+ {paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat"}
190
+ </h1>
191
+ </div>
192
+ </div>
193
+
194
+ <div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
195
+ <div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
196
+ {/* Send section */}
197
+ {paymentType === "crypto" ? (
198
+ <PaySection
199
+ paymentType="crypto"
200
+ selectedSrcChainId={selectedSrcChainId}
201
+ setSelectedSrcChainId={setSelectedSrcChainId}
202
+ selectedSrcToken={selectedSrcToken}
203
+ setSelectedSrcToken={setSelectedSrcToken}
204
+ srcAmount={srcAmount}
205
+ setSrcAmount={setSrcAmount}
206
+ setIsSrcInputDirty={setIsSrcInputDirty}
207
+ selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
208
+ selectedFiatPaymentMethod={selectedFiatPaymentMethod}
209
+ onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
210
+ onSelectFiatPaymentMethod={() => setActivePanel(PanelView.FIAT_PAYMENT_METHOD)}
211
+ anyspendQuote={anyspendQuote}
212
+ />
213
+ ) : (
214
+ <motion.div
215
+ initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
216
+ animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
217
+ transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
218
+ >
219
+ <PanelOnramp
220
+ srcAmountOnRamp={srcAmount}
221
+ setSrcAmountOnRamp={setSrcAmount}
222
+ selectedPaymentMethod={selectedFiatPaymentMethod}
223
+ setActivePanel={setActivePanel}
224
+ _recipientAddress={recipientAddress}
225
+ destinationToken={B3_TOKEN}
226
+ destinationChainId={base.id}
227
+ destinationAmount={dstAmount}
228
+ onDestinationTokenChange={() => {}}
229
+ onDestinationChainChange={() => {}}
230
+ fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
231
+ />
232
+ </motion.div>
233
+ )}
234
+
235
+ {/* Reverse swap direction section */}
236
+ <div
237
+ className={cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden")}
238
+ >
239
+ <Button
240
+ variant="ghost"
241
+ className={cn(
242
+ "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",
243
+ )}
244
+ >
245
+ <div className="relative flex items-center justify-center transition-opacity">
246
+ <ArrowDown className="text-as-primary/50 h-5 w-5" />
247
+ </div>
248
+ </Button>
249
+ </div>
250
+
251
+ {/* Receive section - Hidden when fiat tab is active */}
252
+ {paymentType === "crypto" && (
253
+ <CryptoReceiveSection
254
+ isDepositMode={false}
255
+ isBuyMode={true}
256
+ selectedRecipientAddress={recipientAddress}
257
+ recipientName={recipientName || undefined}
258
+ onSelectRecipient={() => setActivePanel(PanelView.RECIPIENT_SELECTION)}
259
+ dstAmount={dstAmount}
260
+ dstToken={B3_TOKEN}
261
+ selectedDstChainId={base.id}
262
+ setSelectedDstChainId={() => {}}
263
+ setSelectedDstToken={() => {}}
264
+ onChangeDstAmount={value => {
265
+ setIsSrcInputDirty(false);
266
+ setSrcAmount(value);
267
+ }}
268
+ anyspendQuote={anyspendQuote}
269
+ />
270
+ )}
271
+ </div>
272
+ </div>
273
+
274
+ {/* Error message section */}
275
+ <ErrorSection error={getAnyspendQuoteError} />
276
+
277
+ {/* Main button section */}
278
+ <motion.div
279
+ initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
280
+ animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
281
+ transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
282
+ className={cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0")}
283
+ >
284
+ <ShinyButton
285
+ accentColor={"hsl(var(--as-brand))"}
286
+ disabled={btnInfo.disable}
287
+ onClick={onMainButtonClick}
288
+ className={cn(
289
+ "as-main-button relative w-full",
290
+ btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand",
291
+ )}
292
+ textClassName={cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white")}
293
+ >
294
+ {btnInfo.text}
295
+ </ShinyButton>
296
+ </motion.div>
297
+
298
+ {mainFooter ? mainFooter : null}
299
+ </div>
300
+ );
301
+
188
302
  // Handle crypto order creation
189
303
  const handleCryptoOrder = async () => {
190
304
  try {
@@ -209,7 +323,7 @@ function AnySpendDepositHypeInner({
209
323
  amount: depositAmountWei,
210
324
  data: encodedData,
211
325
  to: depositContractAddress,
212
- action: "deposit HYPE",
326
+ action: DEPOSIT_HYPE_ACTION,
213
327
  },
214
328
  });
215
329
  } catch (err: any) {
@@ -274,7 +388,7 @@ function AnySpendDepositHypeInner({
274
388
  amount: depositAmountWei,
275
389
  data: encodedData,
276
390
  to: depositContractAddress,
277
- action: "deposit HYPE",
391
+ action: DEPOSIT_HYPE_ACTION,
278
392
  },
279
393
  });
280
394
  } catch (err: any) {
@@ -289,7 +403,7 @@ function AnySpendDepositHypeInner({
289
403
  <div className="relative flex flex-col gap-4">
290
404
  {oat && (
291
405
  <>
292
- <OrderStatus order={oat.data.order} />
406
+ <OrderStatus order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
293
407
  <OrderDetails
294
408
  mode={mode}
295
409
  order={oat.data.order}
@@ -388,119 +502,7 @@ function AnySpendDepositHypeInner({
388
502
  >
389
503
  {[
390
504
  <div key="main-view" className={cn(mode === "page" && "p-6")}>
391
- <div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-2">
392
- {/* Header */}
393
- <div className="mb-4 flex flex-col items-center gap-3 text-center">
394
- <div>
395
- <h1 className="text-as-primary text-xl font-bold">
396
- {paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat"}
397
- </h1>
398
- </div>
399
- </div>
400
-
401
- <div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
402
- <div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
403
- {/* Send section */}
404
- {paymentType === "crypto" ? (
405
- <PaySection
406
- paymentType="crypto"
407
- selectedSrcChainId={selectedSrcChainId}
408
- setSelectedSrcChainId={setSelectedSrcChainId}
409
- selectedSrcToken={selectedSrcToken}
410
- setSelectedSrcToken={setSelectedSrcToken}
411
- srcAmount={srcAmount}
412
- setSrcAmount={setSrcAmount}
413
- setIsSrcInputDirty={setIsSrcInputDirty}
414
- selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
415
- selectedFiatPaymentMethod={selectedFiatPaymentMethod}
416
- onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
417
- onSelectFiatPaymentMethod={() => setActivePanel(PanelView.FIAT_PAYMENT_METHOD)}
418
- anyspendQuote={anyspendQuote}
419
- />
420
- ) : (
421
- <motion.div
422
- initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
423
- animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
424
- transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
425
- >
426
- <PanelOnramp
427
- srcAmountOnRamp={srcAmount}
428
- setSrcAmountOnRamp={setSrcAmount}
429
- selectedPaymentMethod={selectedFiatPaymentMethod}
430
- setActivePanel={setActivePanel}
431
- _recipientAddress={recipientAddress}
432
- destinationToken={B3_TOKEN}
433
- destinationChainId={base.id}
434
- destinationAmount={dstAmount}
435
- onDestinationTokenChange={() => {}}
436
- onDestinationChainChange={() => {}}
437
- fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
438
- />
439
- </motion.div>
440
- )}
441
-
442
- {/* Reverse swap direction section */}
443
- <Button
444
- variant="ghost"
445
- className={cn(
446
- "swap-direction-button border-as-stroke bg-as-surface-primary absolute left-1/2 top-[calc(50%+56px)] z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl",
447
- paymentType === "fiat" && "hidden",
448
- )}
449
- >
450
- <div className="relative flex items-center justify-center transition-opacity">
451
- <ArrowDown className="text-as-primary/50 h-5 w-5" />
452
- </div>
453
- </Button>
454
-
455
- {/* Receive section - Hidden when fiat tab is active */}
456
- {paymentType === "crypto" && (
457
- <CryptoReceiveSection
458
- isDepositMode={false}
459
- isBuyMode={true}
460
- selectedRecipientAddress={recipientAddress}
461
- recipientName={recipientName || undefined}
462
- onSelectRecipient={() => setActivePanel(PanelView.RECIPIENT_SELECTION)}
463
- dstAmount={dstAmount}
464
- dstToken={B3_TOKEN}
465
- selectedDstChainId={base.id}
466
- setSelectedDstChainId={() => {}}
467
- setSelectedDstToken={() => {}}
468
- onChangeDstAmount={value => {
469
- setIsSrcInputDirty(false);
470
- setSrcAmount(value);
471
- }}
472
- anyspendQuote={anyspendQuote}
473
- />
474
- )}
475
- </div>
476
- </div>
477
-
478
- {/* Error message section */}
479
- <ErrorSection error={getAnyspendQuoteError} />
480
-
481
- {/* Main button section */}
482
- <motion.div
483
- initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
484
- animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
485
- transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
486
- className={cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0")}
487
- >
488
- <ShinyButton
489
- accentColor={"hsl(var(--as-brand))"}
490
- disabled={btnInfo.disable}
491
- onClick={onMainButtonClick}
492
- className={cn(
493
- "as-main-button relative w-full",
494
- btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand",
495
- )}
496
- textClassName={cn(
497
- btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white",
498
- )}
499
- >
500
- {btnInfo.text}
501
- </ShinyButton>
502
- </motion.div>
503
- </div>
505
+ {mainView}
504
506
  </div>,
505
507
  <div key="crypto-payment-method-view" className={cn(mode === "page" && "p-6")}>
506
508
  {cryptoPaymentMethodView}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { ALL_CHAINS, capitalizeFirstLetter, getChainName } from "@b3dotfun/sdk/anyspend";
3
+ import { ALL_CHAINS, capitalizeFirstLetter, DEPOSIT_HYPE_ACTION, getChainName } from "@b3dotfun/sdk/anyspend";
4
4
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
5
5
  import { CopyToClipboard } from "@b3dotfun/sdk/global-account/react";
6
6
  import { cn } from "@b3dotfun/sdk/shared/utils";
@@ -94,9 +94,11 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
94
94
  : order.type === "fund_tournament"
95
95
  ? "Fund tournament"
96
96
  : order.type === "custom"
97
- ? order.metadata.action
98
- ? capitalizeFirstLetter(order.metadata.action)
99
- : "Contract execution"
97
+ ? order.metadata.action === DEPOSIT_HYPE_ACTION
98
+ ? "Deposit HYPE"
99
+ : order.metadata.action
100
+ ? capitalizeFirstLetter(order.metadata.action)
101
+ : "Contract execution"
100
102
  : ""}
101
103
  </div>
102
104
 
@@ -113,6 +115,10 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
113
115
  <img src={tournament?.imageUrl} alt={tournament?.name || "Tournament"} className="h-5 w-5" />
114
116
  <div>{tournament?.name || "Tournament"}</div>
115
117
  </div>
118
+ ) : order.type === "custom" && order.metadata.action === DEPOSIT_HYPE_ACTION ? (
119
+ <div className="flex items-center gap-2">
120
+ <div>{formatTokenAmount(BigInt(order.payload.amount), dstToken.decimals)} HYPE</div>
121
+ </div>
116
122
  ) : null}
117
123
 
118
124
  <div className="text-as-primary/50 flex items-center gap-2">
@@ -3,13 +3,20 @@ import { components } from "@b3dotfun/sdk/anyspend/types/api";
3
3
  import { useSearchParams } from "@b3dotfun/sdk/shared/react";
4
4
  import { Check, X } from "lucide-react";
5
5
  import { memo } from "react";
6
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
6
7
  import { Step, StepProgress } from "./StepProgress";
7
8
 
8
- export const OrderStatus = memo(function OrderStatus({ order }: { order: components["schemas"]["Order"] }) {
9
+ export const OrderStatus = memo(function OrderStatus({
10
+ order,
11
+ selectedCryptoPaymentMethod,
12
+ }: {
13
+ order: components["schemas"]["Order"];
14
+ selectedCryptoPaymentMethod?: CryptoPaymentMethodType;
15
+ }) {
9
16
  const isComplete = order.status === "executed";
10
17
  const { text, status: displayStatus, description } = getStatusDisplay(order);
11
18
  const searchParams = useSearchParams();
12
- const cryptoPaymentMethod = searchParams.get("cryptoPaymentMethod");
19
+ const cryptoPaymentMethod = selectedCryptoPaymentMethod || searchParams.get("cryptoPaymentMethod");
13
20
 
14
21
  console.log("OrderStatus", displayStatus);
15
22
  console.log("OrderStatus", order);