@b3dotfun/sdk 0.0.28 → 0.0.29-alpha.1

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 (111) hide show
  1. package/dist/cjs/anyspend/abis/escrow.d.ts +987 -0
  2. package/dist/cjs/anyspend/abis/escrow.js +1275 -0
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +10 -168
  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 +2 -2
  7. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +10 -0
  8. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +263 -0
  9. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +17 -0
  10. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +53 -0
  11. package/dist/cjs/anyspend/react/components/common/ErrorSection.d.ts +6 -0
  12. package/dist/cjs/anyspend/react/components/common/ErrorSection.js +12 -0
  13. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  14. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
  15. package/dist/cjs/anyspend/react/components/common/PaySection.d.ts +20 -0
  16. package/dist/cjs/anyspend/react/components/common/PaySection.js +58 -0
  17. package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +10 -0
  18. package/dist/cjs/anyspend/react/components/common/TabSection.js +18 -0
  19. package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
  20. package/dist/cjs/anyspend/react/components/index.js +5 -1
  21. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +165 -0
  22. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +184 -0
  23. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +2 -2
  24. package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  25. package/dist/cjs/bondkit/abis/BondkitTokenABI.js +2 -3
  26. package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -0
  27. package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
  28. package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
  29. package/dist/cjs/global-account/react/components/ui/command.d.ts +2 -2
  30. package/dist/cjs/global-account/react/hooks/useSiwe.native.d.ts +4 -0
  31. package/dist/cjs/global-account/react/hooks/useSiwe.native.js +40 -0
  32. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +19 -3
  33. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +1 -1
  34. package/dist/cjs/shared/constants/chains/supported.d.ts +3 -3
  35. package/dist/esm/anyspend/abis/escrow.d.ts +987 -0
  36. package/dist/esm/anyspend/abis/escrow.js +1272 -0
  37. package/dist/esm/anyspend/react/components/AnySpend.js +12 -170
  38. package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  39. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +23 -24
  40. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
  41. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +10 -0
  42. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +257 -0
  43. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +17 -0
  44. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +50 -0
  45. package/dist/esm/anyspend/react/components/common/ErrorSection.d.ts +6 -0
  46. package/dist/esm/anyspend/react/components/common/ErrorSection.js +9 -0
  47. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  48. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
  49. package/dist/esm/anyspend/react/components/common/PaySection.d.ts +20 -0
  50. package/dist/esm/anyspend/react/components/common/PaySection.js +55 -0
  51. package/dist/esm/anyspend/react/components/common/TabSection.d.ts +10 -0
  52. package/dist/esm/anyspend/react/components/common/TabSection.js +15 -0
  53. package/dist/esm/anyspend/react/components/index.d.ts +2 -0
  54. package/dist/esm/anyspend/react/components/index.js +2 -0
  55. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +165 -0
  56. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +180 -0
  57. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +2 -2
  58. package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  59. package/dist/esm/bondkit/abis/BondkitTokenABI.js +2 -3
  60. package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -0
  61. package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
  62. package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
  63. package/dist/esm/global-account/react/components/ui/command.d.ts +2 -2
  64. package/dist/esm/global-account/react/hooks/useSiwe.native.d.ts +4 -0
  65. package/dist/esm/global-account/react/hooks/useSiwe.native.js +34 -0
  66. package/dist/esm/global-account/react/stores/useModalStore.d.ts +19 -3
  67. package/dist/esm/shared/constants/chains/b3Chain.d.ts +1 -1
  68. package/dist/esm/shared/constants/chains/supported.d.ts +3 -3
  69. package/dist/styles/index.css +1 -1
  70. package/dist/types/anyspend/abis/escrow.d.ts +987 -0
  71. package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  72. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +10 -0
  73. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +17 -0
  74. package/dist/types/anyspend/react/components/common/ErrorSection.d.ts +6 -0
  75. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  76. package/dist/types/anyspend/react/components/common/PaySection.d.ts +20 -0
  77. package/dist/types/anyspend/react/components/common/TabSection.d.ts +10 -0
  78. package/dist/types/anyspend/react/components/index.d.ts +2 -0
  79. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +165 -0
  80. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +2 -2
  81. package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  82. package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
  83. package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
  84. package/dist/types/global-account/react/components/ui/command.d.ts +2 -2
  85. package/dist/types/global-account/react/hooks/useSiwe.native.d.ts +4 -0
  86. package/dist/types/global-account/react/stores/useModalStore.d.ts +19 -3
  87. package/dist/types/shared/constants/chains/b3Chain.d.ts +1 -1
  88. package/dist/types/shared/constants/chains/supported.d.ts +3 -3
  89. package/package.json +13 -1
  90. package/src/anyspend/abis/escrow.ts +1272 -0
  91. package/src/anyspend/react/components/AnySpend.tsx +48 -389
  92. package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
  93. package/src/anyspend/react/components/AnySpendCustom.tsx +2 -10
  94. package/src/anyspend/react/components/AnyspendDepositHype.tsx +525 -0
  95. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +152 -0
  96. package/src/anyspend/react/components/common/ErrorSection.tsx +21 -0
  97. package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -2
  98. package/src/anyspend/react/components/common/PaySection.tsx +222 -0
  99. package/src/anyspend/react/components/common/TabSection.tsx +58 -0
  100. package/src/anyspend/react/components/index.ts +2 -0
  101. package/src/anyspend/react/hooks/useAnyspendFlow.ts +226 -0
  102. package/src/bondkit/abis/BondkitTokenABI.ts +2 -3
  103. package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
  104. package/src/global-account/react/hooks/useSiwe.native.tsx +40 -0
  105. package/src/global-account/react/stores/useModalStore.ts +21 -3
  106. package/dist/cjs/anyspend/abis/bondKit.d.ts +0 -35
  107. package/dist/cjs/anyspend/abis/bondKit.js +0 -29
  108. package/dist/esm/anyspend/abis/bondKit.d.ts +0 -35
  109. package/dist/esm/anyspend/abis/bondKit.js +0 -26
  110. package/dist/types/anyspend/abis/bondKit.d.ts +0 -35
  111. package/src/anyspend/abis/bondKit.ts +0 -26
@@ -3,12 +3,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
5
5
  import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useProfile, useRouter, useSearchParamsSSR, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
6
- import { formatUsername } from "../../../shared/utils/index.js";
7
6
  import { cn } from "../../../shared/utils/cn.js";
8
- import { shortenAddress } from "../../../shared/utils/formatAddress.js";
9
- import { formatDisplayNumber, formatTokenAmount } from "../../../shared/utils/number.js";
7
+ import { formatTokenAmount } from "../../../shared/utils/number.js";
10
8
  import invariant from "invariant";
11
- import { ArrowDown, ChevronRight, CircleAlert, HistoryIcon } from "lucide-react";
9
+ import { ArrowDown, HistoryIcon } from "lucide-react";
12
10
  import { motion } from "motion/react";
13
11
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
14
12
  import { toast } from "sonner";
@@ -16,15 +14,17 @@ import { parseUnits } from "viem";
16
14
  import { base, mainnet } from "viem/chains";
17
15
  import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
18
16
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
17
+ import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
18
+ import { ErrorSection } from "./common/ErrorSection.js";
19
19
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
20
20
  import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails.js";
21
21
  import { OrderHistory } from "./common/OrderHistory.js";
22
22
  import { OrderStatus } from "./common/OrderStatus.js";
23
- import { OrderTokenAmount } from "./common/OrderTokenAmount.js";
24
23
  import { PanelOnramp } from "./common/PanelOnramp.js";
25
24
  import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
25
+ import { PaySection } from "./common/PaySection.js";
26
26
  import { RecipientSelection } from "./common/RecipientSelection.js";
27
- import { TokenBalance } from "./common/TokenBalance.js";
27
+ import { TabSection } from "./common/TabSection.js";
28
28
  export var PanelView;
29
29
  (function (PanelView) {
30
30
  PanelView[PanelView["MAIN"] = 0] = "MAIN";
@@ -284,8 +284,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
284
284
  // );
285
285
  // State for recipient selection
286
286
  const [recipientAddress, setRecipientAddress] = useState();
287
- const { address: globalAddress, wallet: globalWallet, ensName: connectedName } = useAccountWallet();
288
- const connectedAddress = globalWallet?.address;
287
+ const { address: globalAddress, wallet: globalWallet } = useAccountWallet();
289
288
  const recipientProfile = useProfile({ address: recipientAddress, fresh: true });
290
289
  const recipientName = recipientProfile.data?.name;
291
290
  // Set default recipient address when wallet changes
@@ -357,113 +356,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
357
356
  }
358
357
  // Only run this effect once on mount
359
358
  }, [globalAddress, recipientAddress, customRecipients.length]);
360
- // Available recipient options
361
- // const recipientOptions = useMemo<RecipientOption[]>(() => {
362
- // const options: RecipientOption[] = [];
363
- // // Add current wallet if connected
364
- // if (globalAddress) {
365
- // options.push({
366
- // address: globalAddress,
367
- // icon: "https://gradvatar.com/" + globalAddress,
368
- // label: "Current Wallet",
369
- // ensName: walletName
370
- // });
371
- // }
372
- // // Add custom recipients with their onchain names
373
- // customRecipients.forEach((recipient, index) => {
374
- // options.push({
375
- // ...recipient,
376
- // ensName: customRecipientNames[index] || undefined
377
- // });
378
- // });
379
- // // Add current recipientAddress if it exists and isn't already in options
380
- // if (
381
- // recipientAddress &&
382
- // !options.some(opt => normalizeAddress(opt.address) === normalizeAddress(recipientAddress))
383
- // ) {
384
- // options.push({
385
- // address: recipientAddress,
386
- // label: `Custom (${centerTruncate(recipientAddress, 6)})`,
387
- // ensName: recipientName
388
- // });
389
- // }
390
- // return options;
391
- // }, [globalAddress, customRecipients, recipientAddress, recipientName, walletName, customRecipientNames]);
392
- // const handleCreateOrder = async (recipientAddress: string) => {
393
- // try {
394
- // invariant(anyspendPrice, "Relay price is not found");
395
- // const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
396
- // createOrder({
397
- // recipientAddress,
398
- // orderType: "swap",
399
- // srcChain: selectedSrcChainId,
400
- // dstChain: selectedDstChainId,
401
- // srcToken: selectedSrcToken,
402
- // dstToken: selectedDstToken,
403
- // srcAmount: srcAmountBigInt.toString(),
404
- // expectedDstAmount: anyspendPrice?.data?.currencyOut?.amount || "0"
405
- // });
406
- // } catch (err) {
407
- // console.error(err);
408
- // toast.error((err as Error).message);
409
- // throw err; // Re-throw to handle in the calling function
410
- // }
411
- // };
412
- // const handleSaveRecipient = async () => {
413
- // if (!newRecipientAddress) {
414
- // toast.error("Please enter an address");
415
- // recipientInputRef.current?.focus();
416
- // return;
417
- // }
418
- // let normalizedAddress: string;
419
- // try {
420
- // // Handle ENS name
421
- // if (
422
- // newRecipientAddress.toLowerCase().endsWith(".eth") ||
423
- // newRecipientAddress.startsWith("@") ||
424
- // newRecipientAddress.includes(".b3")
425
- // ) {
426
- // if (!resolvedAddress) {
427
- // toast.error("Could not resolve ENS name");
428
- // return;
429
- // }
430
- // normalizedAddress = getAddress(resolvedAddress);
431
- // }
432
- // // Handle regular address
433
- // else {
434
- // if (!isEvmOrSolanaAddress(newRecipientAddress)) {
435
- // toast.error("Please enter a valid address or ENS name");
436
- // recipientInputRef.current?.focus();
437
- // return;
438
- // }
439
- // normalizedAddress = normalizeAddress(newRecipientAddress);
440
- // }
441
- // // Check for duplicate address
442
- // if (!customRecipients.some(r => normalizeAddress(r.address) === normalizedAddress)) {
443
- // // Add to custom recipients
444
- // const newRecipient = {
445
- // address: normalizedAddress,
446
- // label:
447
- // newRecipientAddress.toLowerCase().endsWith(".eth") ||
448
- // newRecipientAddress.startsWith("@") ||
449
- // newRecipientAddress.includes(".b3")
450
- // ? newRecipientAddress // Keep ENS name as label
451
- // : `Custom (${centerTruncate(normalizedAddress, 6)})`
452
- // };
453
- // setCustomRecipients(prev => [...prev, newRecipient]);
454
- // }
455
- // setRecipientAddress(normalizedAddress);
456
- // // Handle based on login state
457
- // if (!globalAddress) {
458
- // await handleCreateOrder(normalizedAddress);
459
- // } else {
460
- // setActivePanel(PanelView.MAIN);
461
- // }
462
- // } catch (err) {
463
- // // Error handling is done in handleCreateOrder
464
- // console.error("Error in handleSaveRecipient:", err);
465
- // }
466
- // };
467
359
  // Update dependent amount when relay price changes
468
360
  useEffect(() => {
469
361
  if (anyspendQuote?.data &&
@@ -757,49 +649,13 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
757
649
  useEffect(() => {
758
650
  window.scrollTo({ top: 0, behavior: "smooth" });
759
651
  }, [activePanel]);
760
- const calculatePriceImpact = (inputUsd, outputUsd) => {
761
- if (!inputUsd || !outputUsd) {
762
- return { percentage: "0.00", isNegative: false };
763
- }
764
- const input = Number(inputUsd);
765
- const output = Number(outputUsd);
766
- // Handle edge cases
767
- if (input === 0 || isNaN(input) || isNaN(output) || input <= output) {
768
- return { percentage: "0.00", isNegative: false };
769
- }
770
- const percentageValue = ((output - input) / input) * 100;
771
- // Handle the -0.00% case
772
- if (percentageValue > -0.005 && percentageValue < 0) {
773
- return { percentage: "0.00", isNegative: false };
774
- }
775
- return {
776
- percentage: Math.abs(percentageValue).toFixed(2),
777
- isNegative: percentageValue < 0,
778
- };
779
- };
780
- // Add state for rate details toggle
781
- // const [showRateDetails, setShowRateDetails] = useState(false);
782
652
  const historyView = (_jsx("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: _jsx(OrderHistory, { mode: mode, onBack: () => setActivePanel(PanelView.MAIN), onSelectOrder: onSelectOrder }) }));
783
653
  const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: oat.data.order }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: () => {
784
654
  setOrderId(undefined);
785
655
  setActivePanel(PanelView.MAIN);
786
656
  setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
787
657
  } })] })) }) }));
788
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx("div", { className: "w-full", children: _jsxs("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [_jsx("div", { className: cn("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => {
789
- setActiveTab("crypto");
790
- setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when switching to crypto
791
- setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE); // Reset fiat payment method when switching to crypto
792
- }, children: "Pay with crypto" }), _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", activeTab === "fiat" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => {
793
- setActiveTab("fiat");
794
- setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset crypto payment method when switching to fiat
795
- setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE); // Reset fiat payment method when switching to fiat
796
- }, children: "Pay with Fiat" })] }) }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors", onClick: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [connectedAddress ? (_jsx(_Fragment, { children: _jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress || "") }) })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: globalAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
797
- setIsSrcInputDirty(true);
798
- setSrcAmount(value);
799
- }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, { style: "currency", fallback: "" }) }), _jsx(TokenBalance, { token: selectedSrcToken, walletAddress: globalAddress, onChangeInput: value => {
800
- setIsSrcInputDirty(true);
801
- setSrcAmount(value);
802
- } })] })] })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId }) })), _jsx(Button, { variant: "ghost", className: cn("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", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
658
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(PaySection, { paymentType: "crypto", selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, selectedFiatPaymentMethod: selectedFiatPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), onSelectFiatPaymentMethod: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD }) })), _jsx(Button, { variant: "ghost", className: cn("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", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
803
659
  if (activeTab === "fiat" || isBuyMode) {
804
660
  return;
805
661
  }
@@ -818,24 +674,10 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
818
674
  const tempDstAmount = dstAmount;
819
675
  setSrcAmount(tempDstAmount);
820
676
  setDstAmount(tempSrcAmount);
821
- }, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab !== "fiat" && (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Receive" }), recipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsxs(_Fragment, { children: [recipientAddress ? (_jsx(_Fragment, { children: _jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? formatUsername(recipientName) : shortenAddress(recipientAddress || "") }) })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode ? (
822
- // Fixed destination token display in buy mode
823
- _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [selectedDstToken.metadata?.logoURI && (_jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "h-8 w-8 rounded-full" })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: selectedDstToken.symbol })] })] })) : (_jsx(OrderTokenAmount, { address: recipientAddress, context: "to", inputValue: dstAmount, onChangeInput: value => {
824
- setIsSrcInputDirty(false);
825
- setDstAmount(value);
826
- }, chainId: selectedDstChainId, setChainId: setSelectedDstChainId, token: selectedDstToken, setToken: setSelectedDstToken })), _jsxs("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: [formatDisplayNumber(anyspendQuote?.data?.currencyOut?.amountUsd, { style: "currency", fallback: "" }), anyspendQuote?.data?.currencyIn?.amountUsd &&
827
- anyspendQuote?.data?.currencyOut?.amountUsd &&
828
- (() => {
829
- const { percentage, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
830
- // Parse the percentage as a number for comparison
831
- const percentageNum = parseFloat(percentage);
832
- // Don't show if less than 1%
833
- if (percentageNum < 1) {
834
- return null;
835
- }
836
- // Using inline style to ensure color displays
837
- return (_jsxs("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
838
- })()] })] }))] }), getAnyspendQuoteError && (_jsxs("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl px-4 py-2", children: [_jsx(CircleAlert, { className: "bg-as-red h-4 min-h-4 w-4 min-w-4 rounded-full p-0 text-sm font-medium text-white" }), _jsx("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
677
+ }, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, onChangeDstAmount: value => {
678
+ setIsSrcInputDirty(false);
679
+ setDstAmount(value);
680
+ }, anyspendQuote: anyspendQuote }))] }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
839
681
  const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: recipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
840
682
  setOrderId(orderId);
841
683
  setActivePanel(PanelView.ORDER_DETAILS);
@@ -1,2 +1,2 @@
1
1
  import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
2
- export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, ethAmount: initialEthAmount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,10 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { BondkitToken } from "../../../bondkit/index.js";
3
2
  import { Button, GlareCardRounded, Input, StyleRoot, useHasMounted, useTokenData, } from "../../../global-account/react/index.js";
4
3
  import { baseMainnet } from "../../../shared/constants/chains/supported.js";
5
4
  import { motion } from "motion/react";
6
5
  import { useEffect, useMemo, useState } from "react";
7
6
  import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
8
- import { ABI_bondKit } from "../../abis/bondKit.js";
7
+ import { BondkitToken, BondkitTokenABI } from "../../../bondkit/index.js";
9
8
  import { AnySpendCustom } from "./AnySpendCustom.js";
10
9
  // Debounce utility function
11
10
  function debounce(func, wait) {
@@ -21,11 +20,11 @@ function formatNumberWithCommas(x) {
21
20
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
22
21
  return parts.join(".");
23
22
  }
24
- export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, ethAmount: initialEthAmount, onSuccess, }) {
23
+ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
25
24
  const hasMounted = useHasMounted();
26
- const [showAmountPrompt, setShowAmountPrompt] = useState(!initialEthAmount);
27
- const [ethAmount, setEthAmount] = useState(initialEthAmount || "");
28
- const [isAmountValid, setIsAmountValid] = useState(!!initialEthAmount);
25
+ const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
26
+ const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
27
+ const [isAmountValid, setIsAmountValid] = useState(!!initialB3Amount);
29
28
  const [validationError, setValidationError] = useState("");
30
29
  const [tokenName, setTokenName] = useState("");
31
30
  const [tokenSymbol, setTokenSymbol] = useState("");
@@ -57,12 +56,12 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
57
56
  const [name, symbol] = await Promise.all([
58
57
  basePublicClient.readContract({
59
58
  address: contractAddress,
60
- abi: ABI_bondKit,
59
+ abi: BondkitTokenABI,
61
60
  functionName: "name",
62
61
  }),
63
62
  basePublicClient.readContract({
64
63
  address: contractAddress,
65
- abi: ABI_bondKit,
64
+ abi: BondkitTokenABI,
66
65
  functionName: "symbol",
67
66
  }),
68
67
  ]);
@@ -79,8 +78,8 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
79
78
  fetchTokenName();
80
79
  }
81
80
  }, [contractAddress, basePublicClient]);
82
- // Get native token data for the chain
83
- const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "0x0000000000000000000000000000000000000000");
81
+ // Get b3 token data
82
+ const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
84
83
  // Convert token data to AnySpend Token type
85
84
  const dstToken = useMemo(() => {
86
85
  if (!tokenData)
@@ -116,16 +115,16 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
116
115
  setIsLoadingQuote(false);
117
116
  }
118
117
  }, 500), [bondkitTokenClient]);
119
- // Fetch initial quote if ethAmount is provided
118
+ // Fetch initial quote if b3Amount is provided
120
119
  useEffect(() => {
121
- if (initialEthAmount && bondkitTokenClient) {
122
- debouncedGetQuote(initialEthAmount);
120
+ if (initialB3Amount && bondkitTokenClient) {
121
+ debouncedGetQuote(initialB3Amount);
123
122
  }
124
- }, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
123
+ }, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
125
124
  const validateAndSetAmount = (value) => {
126
125
  // Allow empty input
127
126
  if (value === "") {
128
- setEthAmount("");
127
+ setB3Amount("");
129
128
  setIsAmountValid(false);
130
129
  setValidationError("");
131
130
  setQuote(null);
@@ -141,14 +140,14 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
141
140
  if ((value.match(/\./g) || []).length > 1) {
142
141
  return;
143
142
  }
144
- // Prevent more than 18 decimal places (ETH precision)
143
+ // Prevent more than 18 decimal places (B3 precision)
145
144
  const parts = value.split(".");
146
145
  if (parts[1] && parts[1].length > 18) {
147
146
  return;
148
147
  }
149
148
  // Clean the input - remove leading zeros if not decimal
150
149
  const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
151
- setEthAmount(cleanedValue);
150
+ setB3Amount(cleanedValue);
152
151
  try {
153
152
  const parsedAmount = parseEther(cleanedValue);
154
153
  if (parsedAmount <= BigInt(0)) {
@@ -166,7 +165,7 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
166
165
  setValidationError("Please enter a valid amount");
167
166
  }
168
167
  };
169
- const header = () => (_jsx("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: _jsxs("div", { className: "flex w-full flex-col items-center space-y-6", children: [_jsxs("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), _jsxs("div", { className: "flex w-full flex-col items-center space-y-2", children: [_jsxs("span", { className: "text-[28px] font-bold", children: [ethAmount, " ETH"] }), quote && (_jsxs("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
168
+ const header = () => (_jsx("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: _jsxs("div", { className: "flex w-full flex-col items-center space-y-6", children: [_jsxs("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), _jsxs("div", { className: "flex w-full flex-col items-center space-y-2", children: [_jsxs("span", { className: "text-[28px] font-bold", children: [b3Amount, " B3"] }), quote && (_jsxs("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
170
169
  // Show loading state while fetching token data
171
170
  if (isLoading) {
172
171
  return (_jsx(StyleRoot, { children: _jsx("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: _jsx("p", { className: "text-as-primary/70 text-center text-sm", children: "Loading payment information..." }) }) }));
@@ -188,18 +187,18 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
188
187
  opacity: hasMounted ? 1 : 0,
189
188
  y: hasMounted ? 0 : 20,
190
189
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
191
- }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-as-primary/70 text-sm font-medium", children: "ETH Amount" }) }), _jsx("div", { className: "relative", children: _jsx(Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: ethAmount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && ethAmount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && ethAmount && _jsx("p", { className: "text-as-red text-sm", children: validationError }), _jsxs("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs("span", { className: "text-as-primary text-lg font-bold", children: [ethAmount || "0", " ETH"] }) })] }), isLoadingQuote ? (_jsx("div", { className: "mt-2 text-center", children: _jsx("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? (_jsxs("div", { className: "mt-2 flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), _jsxs("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), _jsx(Button, { onClick: () => {
192
- if (isAmountValid && ethAmount) {
190
+ }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-as-primary/70 text-sm font-medium", children: "B3 Amount" }) }), _jsx("div", { className: "relative", children: _jsx(Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: b3Amount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && b3Amount && _jsx("p", { className: "text-as-red text-sm", children: validationError }), _jsxs("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs("span", { className: "text-as-primary text-lg font-bold", children: [b3Amount || "0", " B3"] }) })] }), isLoadingQuote ? (_jsx("div", { className: "mt-2 text-center", children: _jsx("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? (_jsxs("div", { className: "mt-2 flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), _jsxs("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), _jsx(Button, { onClick: () => {
191
+ if (isAmountValid && b3Amount) {
193
192
  setShowAmountPrompt(false);
194
193
  }
195
- }, disabled: !isAmountValid || !ethAmount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
194
+ }, disabled: !isAmountValid || !b3Amount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
196
195
  }
197
196
  const encodedData = encodeFunctionData({
198
- abi: ABI_bondKit,
197
+ abi: BondkitTokenABI,
199
198
  functionName: "buyFor",
200
- args: [recipientAddress, BigInt(minTokensOut)],
199
+ args: [recipientAddress, parseEther(b3Amount), BigInt(minTokensOut)],
201
200
  });
202
- return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(ethAmount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
201
+ return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
203
202
  type: "custom",
204
203
  action: "BondKit Buy",
205
204
  }, header: header, onSuccess: onSuccess, showRecipient: true }));
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { eqci, getDefaultToken, roundUpUSDCBaseAmountToNearest } from "../../../anyspend/index.js";
3
3
  import { RELAY_ETH_ADDRESS, USDC_BASE } from "../../../anyspend/constants/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useConnectedUserProfile, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
@@ -409,11 +409,11 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
409
409
  ? "Receive NFT at"
410
410
  : orderType === "join_tournament"
411
411
  ? "Join for"
412
- : "Recipient" }), _jsxs("div", { className: "flex items-center gap-2", children: [recipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsxs(_Fragment, { children: [recipientProfile && (_jsx("img", { src: recipientProfile.data?.avatar || "", alt: recipientProfile.data?.name || "", className: "bg-b3-react-foreground size-6 rounded-full object-cover opacity-100" })), _jsxs("div", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: [recipientName && _jsx("span", { children: formatUsername(recipientName) }), _jsx("span", { children: shortenAddress(recipientAddress) })] })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) })), _jsx(ChevronRight, { className: "h-4 w-4" })] })] }, recipientAddress)) : null;
412
+ : "Recipient" }), _jsxs("div", { className: "flex items-center gap-2", children: [recipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx(_Fragment, { children: _jsx("div", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: _jsx("span", { children: recipientName ? formatUsername(recipientName) : shortenAddress(recipientAddress) }) }) }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) })), _jsx(ChevronRight, { className: "h-4 w-4" })] })] }, recipientAddress)) : null;
413
413
  const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
414
414
  setActivePanel(PanelView.HISTORY);
415
415
  }, onSelectOrder: onSelectOrder }) }));
416
- const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatusDisplay, { order: oat.data.order }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
416
+ const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatusDisplay, { order: oat.data.order }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
417
417
  setOrderId(undefined);
418
418
  setActivePanel(PanelView.CONFIRM_ORDER);
419
419
  // Remove orderId from URL when canceling
@@ -0,0 +1,10 @@
1
+ export declare function AnySpendDepositHype(props: {
2
+ loadOrder?: string;
3
+ mode?: "modal" | "page";
4
+ recipientAddress: string;
5
+ paymentType?: "crypto" | "fiat";
6
+ sourceTokenAddress?: string;
7
+ sourceTokenChainId?: number;
8
+ onSuccess?: () => void;
9
+ depositContractAddress?: string;
10
+ }): import("react/jsx-runtime").JSX.Element;