@b3dotfun/sdk 0.0.49-alpha.5 → 0.0.49-alpha.6

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.
@@ -467,10 +467,18 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
467
467
  sonner_1.toast.error("Failed to create order: " + error.message);
468
468
  },
469
469
  });
470
+ // Check if it's a same-chain same-token swap
471
+ const isSameChainSameToken = (0, react_4.useMemo)(() => {
472
+ return (activeTab === "crypto" &&
473
+ selectedSrcChainId === selectedDstChainId &&
474
+ selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
475
+ }, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
470
476
  // Determine button state and text
471
477
  const btnInfo = (0, react_4.useMemo)(() => {
472
478
  if (activeInputAmountInWei === "0")
473
479
  return { text: "Enter an amount", disable: true, error: false, loading: false };
480
+ if (isSameChainSameToken)
481
+ return { text: "Select a different token or chain", disable: true, error: false, loading: false };
474
482
  if (isLoadingAnyspendQuote)
475
483
  return { text: "Loading quote...", disable: true, error: false, loading: true };
476
484
  if (!recipientAddress)
@@ -504,6 +512,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
504
512
  return { text: "Buy", disable: false, error: false, loading: false };
505
513
  }, [
506
514
  activeInputAmountInWei,
515
+ isSameChainSameToken,
507
516
  isLoadingAnyspendQuote,
508
517
  recipientAddress,
509
518
  isCreatingOrder,
@@ -720,7 +729,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
720
729
  };
721
730
  }, [activePanel, navigateBack]);
722
731
  const historyView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
723
- const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
732
+ const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
724
733
  setOrderId(undefined);
725
734
  navigateBack();
726
735
  setSelectedCryptoPaymentMethod(CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE); // Reset payment method when going back
@@ -10,6 +10,7 @@ const anyspend_1 = require("../../../../anyspend");
10
10
  const react_1 = require("../../../../global-account/react");
11
11
  const utils_1 = require("../../../../shared/utils");
12
12
  const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
13
+ const formatNumber_1 = require("../../../../shared/utils/formatNumber");
13
14
  const number_1 = require("../../../../shared/utils/number");
14
15
  const lucide_react_1 = require("lucide-react");
15
16
  const react_2 = require("motion/react");
@@ -39,5 +40,5 @@ exports.OrderDetailsCollapsible = (0, react_3.memo)(function OrderDetailsCollaps
39
40
  ? order.metadata.action
40
41
  ? (0, anyspend_1.capitalizeFirstLetter)(order.metadata.action)
41
42
  : "Contract execution"
42
- : "" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-nft-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-tournament-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? ((0, jsx_runtime_1.jsx)("div", { className: "order-details-hype-info flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-hype-amount", children: [(0, number_1.formatTokenAmount)(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] }), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("order-details-chain-logo h-3", order.dstChain !== chains_1.b3.id && "w-3 rounded-full", order.dstChain === chains_1.b3.id && "h-4") })] })] })] }), points && points > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", points, " pts"] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-collapsed flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
43
+ : "" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-nft-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-tournament-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? ((0, jsx_runtime_1.jsx)("div", { className: "order-details-hype-info flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-hype-amount", children: [(0, number_1.formatTokenAmount)(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] }), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("order-details-chain-logo h-3", order.dstChain !== chains_1.b3.id && "w-3 rounded-full", order.dstChain === chains_1.b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", (0, formatNumber_1.formatNumber)(points), " pts"] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-collapsed flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
43
44
  });
@@ -460,10 +460,18 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
460
460
  toast.error("Failed to create order: " + error.message);
461
461
  },
462
462
  });
463
+ // Check if it's a same-chain same-token swap
464
+ const isSameChainSameToken = useMemo(() => {
465
+ return (activeTab === "crypto" &&
466
+ selectedSrcChainId === selectedDstChainId &&
467
+ selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
468
+ }, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
463
469
  // Determine button state and text
464
470
  const btnInfo = useMemo(() => {
465
471
  if (activeInputAmountInWei === "0")
466
472
  return { text: "Enter an amount", disable: true, error: false, loading: false };
473
+ if (isSameChainSameToken)
474
+ return { text: "Select a different token or chain", disable: true, error: false, loading: false };
467
475
  if (isLoadingAnyspendQuote)
468
476
  return { text: "Loading quote...", disable: true, error: false, loading: true };
469
477
  if (!recipientAddress)
@@ -497,6 +505,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
497
505
  return { text: "Buy", disable: false, error: false, loading: false };
498
506
  }, [
499
507
  activeInputAmountInWei,
508
+ isSameChainSameToken,
500
509
  isLoadingAnyspendQuote,
501
510
  recipientAddress,
502
511
  isCreatingOrder,
@@ -713,7 +722,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
713
722
  };
714
723
  }, [activePanel, navigateBack]);
715
724
  const historyView = (_jsx("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: _jsx(OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
716
- const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
725
+ const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
717
726
  setOrderId(undefined);
718
727
  navigateBack();
719
728
  setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
@@ -4,6 +4,7 @@ import { ALL_CHAINS, capitalizeFirstLetter, getChainName } from "../../../../any
4
4
  import { CopyToClipboard } from "../../../../global-account/react/index.js";
5
5
  import { cn } from "../../../../shared/utils/index.js";
6
6
  import centerTruncate from "../../../../shared/utils/centerTruncate.js";
7
+ import { formatNumber } from "../../../../shared/utils/formatNumber.js";
7
8
  import { formatTokenAmount } from "../../../../shared/utils/number.js";
8
9
  import { ChevronDown, Copy } from "lucide-react";
9
10
  import { motion } from "motion/react";
@@ -33,5 +34,5 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ o
33
34
  ? order.metadata.action
34
35
  ? capitalizeFirstLetter(order.metadata.action)
35
36
  : "Contract execution"
36
- : "" }), _jsxs("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? (_jsxs("div", { className: "order-details-nft-info flex items-center gap-2", children: [_jsx("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), _jsx("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? (_jsxs("div", { className: "order-details-tournament-info flex items-center gap-2", children: [_jsx("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), _jsx("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? (_jsx("div", { className: "order-details-hype-info flex items-center gap-2", children: _jsxs("div", { className: "order-details-hype-amount", children: [formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, _jsxs("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [_jsxs("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== b3.id && getChainName(order.dstChain)] }), _jsx("img", { src: ALL_CHAINS[order.dstChain].logoUrl, alt: getChainName(order.dstChain), className: cn("order-details-chain-logo h-3", order.dstChain !== b3.id && "w-3 rounded-full", order.dstChain === b3.id && "h-4") })] })] })] }), points && points > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), _jsxs("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", points, " pts"] })] })] })), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), _jsx("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : (_jsxs("div", { className: "order-details-collapsed flex w-full items-center", children: [_jsx("div", { className: "order-details-collapsed-divider divider w-full" }), _jsx("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), _jsx(ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), _jsx("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
37
+ : "" }), _jsxs("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? (_jsxs("div", { className: "order-details-nft-info flex items-center gap-2", children: [_jsx("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), _jsx("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? (_jsxs("div", { className: "order-details-tournament-info flex items-center gap-2", children: [_jsx("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), _jsx("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? (_jsx("div", { className: "order-details-hype-info flex items-center gap-2", children: _jsxs("div", { className: "order-details-hype-amount", children: [formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, _jsxs("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [_jsxs("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== b3.id && getChainName(order.dstChain)] }), _jsx("img", { src: ALL_CHAINS[order.dstChain].logoUrl, alt: getChainName(order.dstChain), className: cn("order-details-chain-logo h-3", order.dstChain !== b3.id && "w-3 rounded-full", order.dstChain === b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && (_jsxs(_Fragment, { children: [_jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), _jsxs("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", formatNumber(points), " pts"] })] })] })), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), _jsx("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : (_jsxs("div", { className: "order-details-collapsed flex w-full items-center", children: [_jsx("div", { className: "order-details-collapsed-divider divider w-full" }), _jsx("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), _jsx(ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), _jsx("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
37
38
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.49-alpha.5",
3
+ "version": "0.0.49-alpha.6",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -609,9 +609,20 @@ function AnySpendInner({
609
609
  },
610
610
  });
611
611
 
612
+ // Check if it's a same-chain same-token swap
613
+ const isSameChainSameToken = useMemo(() => {
614
+ return (
615
+ activeTab === "crypto" &&
616
+ selectedSrcChainId === selectedDstChainId &&
617
+ selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase()
618
+ );
619
+ }, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
620
+
612
621
  // Determine button state and text
613
622
  const btnInfo: { text: string; disable: boolean; error: boolean; loading: boolean } = useMemo(() => {
614
623
  if (activeInputAmountInWei === "0") return { text: "Enter an amount", disable: true, error: false, loading: false };
624
+ if (isSameChainSameToken)
625
+ return { text: "Select a different token or chain", disable: true, error: false, loading: false };
615
626
  if (isLoadingAnyspendQuote) return { text: "Loading quote...", disable: true, error: false, loading: true };
616
627
  if (!recipientAddress) return { text: "Select recipient", disable: false, error: false, loading: false };
617
628
  if (isCreatingOrder || isCreatingOnrampOrder)
@@ -648,6 +659,7 @@ function AnySpendInner({
648
659
  return { text: "Buy", disable: false, error: false, loading: false };
649
660
  }, [
650
661
  activeInputAmountInWei,
662
+ isSameChainSameToken,
651
663
  isLoadingAnyspendQuote,
652
664
  recipientAddress,
653
665
  isCreatingOrder,
@@ -905,6 +917,7 @@ function AnySpendInner({
905
917
  refundTxs={oat.data.refundTxs}
906
918
  selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
907
919
  onPaymentMethodChange={setSelectedCryptoPaymentMethod}
920
+ points={oat.data.points || undefined}
908
921
  onBack={() => {
909
922
  setOrderId(undefined);
910
923
  navigateBack();
@@ -5,6 +5,7 @@ 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";
7
7
  import centerTruncate from "@b3dotfun/sdk/shared/utils/centerTruncate";
8
+ import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
8
9
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
9
10
  import { ChevronDown, Copy } from "lucide-react";
10
11
  import { motion } from "motion/react";
@@ -152,13 +153,15 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
152
153
  </div>
153
154
  </div>
154
155
 
155
- {points && points > 0 && (
156
+ {points !== undefined && points !== null && (
156
157
  <>
157
158
  <div className="order-details-divider divider w-full" />
158
159
  {/* Points Section */}
159
160
  <div className="order-details-points-section flex w-full justify-between gap-4">
160
161
  <div className="order-details-points-label text-as-tertiarry">Points</div>
161
- <div className="order-details-points-value text-as-brand font-semibold">+{points} pts</div>
162
+ <div className="order-details-points-value text-as-brand font-semibold">
163
+ +{formatNumber(points)} pts
164
+ </div>
162
165
  </div>
163
166
  </>
164
167
  )}