@b3dotfun/sdk 0.0.49-alpha.1 → 0.0.49-alpha.10

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 (85) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +1 -0
  2. package/dist/cjs/anyspend/constants/index.js +12 -2
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +10 -1
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +1 -1
  5. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +15 -9
  6. package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +2 -2
  7. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +1 -0
  8. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -6
  9. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
  10. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -2
  11. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
  13. package/dist/cjs/anyspend/types/api.d.ts +14 -2
  14. package/dist/cjs/anyspend/utils/chain.js +4 -4
  15. package/dist/cjs/bondkit/bondkitToken.d.ts +3 -1
  16. package/dist/cjs/bondkit/bondkitToken.js +19 -0
  17. package/dist/cjs/bondkit/components/TradingView.d.ts +1 -1
  18. package/dist/cjs/bondkit/components/TradingView.js +14 -3
  19. package/dist/cjs/bondkit/components/index.d.ts +1 -1
  20. package/dist/cjs/bondkit/components/index.js +1 -1
  21. package/dist/cjs/bondkit/components/types.d.ts +1 -0
  22. package/dist/cjs/bondkit/config.d.ts +1 -0
  23. package/dist/cjs/bondkit/config.js +1 -0
  24. package/dist/cjs/bondkit/index.d.ts +1 -1
  25. package/dist/cjs/bondkit/index.js +2 -6
  26. package/dist/cjs/bondkit/types.d.ts +15 -0
  27. package/dist/cjs/shared/generated/chain-networks.json +40 -7
  28. package/dist/esm/anyspend/constants/index.d.ts +1 -0
  29. package/dist/esm/anyspend/constants/index.js +11 -1
  30. package/dist/esm/anyspend/react/components/AnySpend.js +10 -1
  31. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +1 -1
  32. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +15 -9
  33. package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +2 -2
  34. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +1 -0
  35. package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
  36. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
  37. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -3
  38. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
  39. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
  40. package/dist/esm/anyspend/types/api.d.ts +14 -2
  41. package/dist/esm/anyspend/utils/chain.js +4 -4
  42. package/dist/esm/bondkit/bondkitToken.d.ts +3 -1
  43. package/dist/esm/bondkit/bondkitToken.js +19 -0
  44. package/dist/esm/bondkit/components/TradingView.d.ts +1 -1
  45. package/dist/esm/bondkit/components/TradingView.js +14 -3
  46. package/dist/esm/bondkit/components/index.d.ts +1 -1
  47. package/dist/esm/bondkit/components/index.js +1 -1
  48. package/dist/esm/bondkit/components/types.d.ts +1 -0
  49. package/dist/esm/bondkit/config.d.ts +1 -0
  50. package/dist/esm/bondkit/config.js +1 -0
  51. package/dist/esm/bondkit/index.d.ts +1 -1
  52. package/dist/esm/bondkit/index.js +1 -1
  53. package/dist/esm/bondkit/types.d.ts +15 -0
  54. package/dist/esm/shared/generated/chain-networks.json +40 -7
  55. package/dist/types/anyspend/constants/index.d.ts +1 -0
  56. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +1 -0
  57. package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
  58. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
  59. package/dist/types/anyspend/types/api.d.ts +14 -2
  60. package/dist/types/bondkit/bondkitToken.d.ts +3 -1
  61. package/dist/types/bondkit/components/TradingView.d.ts +1 -1
  62. package/dist/types/bondkit/components/index.d.ts +1 -1
  63. package/dist/types/bondkit/components/types.d.ts +1 -0
  64. package/dist/types/bondkit/config.d.ts +1 -0
  65. package/dist/types/bondkit/index.d.ts +1 -1
  66. package/dist/types/bondkit/types.d.ts +15 -0
  67. package/package.json +1 -1
  68. package/src/anyspend/constants/index.ts +12 -1
  69. package/src/anyspend/react/components/AnySpend.tsx +13 -0
  70. package/src/anyspend/react/components/AnyspendDepositHype.tsx +1 -0
  71. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +17 -9
  72. package/src/anyspend/react/components/common/FeeDetailPanel.tsx +33 -6
  73. package/src/anyspend/react/components/common/OrderDetails.tsx +7 -0
  74. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +16 -0
  75. package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +2 -2
  76. package/src/anyspend/types/api.ts +14 -2
  77. package/src/anyspend/utils/chain.ts +4 -4
  78. package/src/bondkit/bondkitToken.ts +24 -0
  79. package/src/bondkit/components/TradingView.tsx +15 -3
  80. package/src/bondkit/components/index.ts +1 -1
  81. package/src/bondkit/components/types.ts +1 -0
  82. package/src/bondkit/config.ts +2 -0
  83. package/src/bondkit/index.ts +1 -1
  84. package/src/bondkit/types.ts +19 -0
  85. package/src/shared/generated/chain-networks.json +40 -7
@@ -4,17 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const lucide_react_1 = require("lucide-react");
6
6
  const react_1 = require("react");
7
+ const config_1 = require("../config");
7
8
  const cdn_loader_1 = require("./utils/cdn-loader");
8
9
  const format_1 = require("./utils/format");
9
10
  // TradingView will be available on window after loading from CDN
10
11
  // Datafeed will be implemented inline
11
12
  // Mock loading overlay - replace with your actual loading component
12
13
  const GifLoadingOverlay = ({ className }) => ((0, jsx_runtime_1.jsx)("div", { className: `absolute inset-0 flex items-center justify-center bg-white/50 backdrop-blur-sm ${className || ""}`, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-secondary-grey h-8 w-8 animate-spin" }) }));
13
- const TradingView = ({ className, tokenAddress, tokenSymbol }) => {
14
+ const TradingView = ({ className, tokenAddress, tokenSymbol, chainId = 8453 }) => {
14
15
  // Use token info for the current trade
15
16
  const currentTrade = {
16
17
  product_id: tokenAddress && tokenSymbol ? `${tokenSymbol}-${tokenAddress}` : "BONDKIT",
17
18
  };
19
+ // Get chart API endpoint from config
20
+ const config = (0, config_1.getConfig)(chainId);
21
+ const chartApiUrl = `${config.chartApiEndpoint}/udf`;
18
22
  const [tradingViewDefaultInterval, setTradingViewDefaultInterval] = (0, react_1.useState)("60");
19
23
  const [tradingViewTimezone, setTradingViewTimezone] = (0, react_1.useState)("");
20
24
  const chartContainerRef = (0, react_1.useRef)(null);
@@ -126,7 +130,7 @@ const TradingView = ({ className, tokenAddress, tokenSymbol }) => {
126
130
  unsubscribeBars: () => { },
127
131
  };
128
132
  };
129
- const datafeed = createUDFDatafeed("https://b3-udf-worker.sean-430.workers.dev/bondkit/udf");
133
+ const datafeed = createUDFDatafeed(chartApiUrl);
130
134
  // Calculate timeframe for last 2 days
131
135
  const currentTime = Math.floor(Date.now() / 1000);
132
136
  const twoDaysAgo = currentTime - 2 * 24 * 60 * 60; // 2 days in seconds
@@ -246,7 +250,14 @@ const TradingView = ({ className, tokenAddress, tokenSymbol }) => {
246
250
  tvWidgetRef.current = null;
247
251
  }
248
252
  };
249
- }, [librariesLoaded, currentTrade?.product_id, tradingViewDefaultInterval, tradingViewTimezone]);
253
+ }, [
254
+ librariesLoaded,
255
+ currentTrade?.product_id,
256
+ tradingViewDefaultInterval,
257
+ tradingViewTimezone,
258
+ chartApiUrl,
259
+ chainId,
260
+ ]);
250
261
  (0, react_1.useEffect)(() => {
251
262
  if (chartLoaded &&
252
263
  currentTrade?.product_id &&
@@ -1,5 +1,5 @@
1
+ export * from "./config/cdn";
1
2
  export { default as TradingView } from "./TradingView";
2
3
  export type { TradingViewProps } from "./types";
3
4
  export * from "./utils/cdn-loader";
4
5
  export * from "./utils/format";
5
- export * from "./config/cdn";
@@ -18,8 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.TradingView = void 0;
21
+ __exportStar(require("./config/cdn"), exports);
21
22
  var TradingView_1 = require("./TradingView");
22
23
  Object.defineProperty(exports, "TradingView", { enumerable: true, get: function () { return __importDefault(TradingView_1).default; } });
23
24
  __exportStar(require("./utils/cdn-loader"), exports);
24
25
  __exportStar(require("./utils/format"), exports);
25
- __exportStar(require("./config/cdn"), exports);
@@ -5,4 +5,5 @@ export interface TradingViewProps {
5
5
  className?: string;
6
6
  tokenAddress?: string;
7
7
  tokenSymbol?: string;
8
+ chainId?: number;
8
9
  }
@@ -5,6 +5,7 @@ export interface Config {
5
5
  rpcUrl: string;
6
6
  factoryAddress: Address;
7
7
  apiEndpoint: string;
8
+ chartApiEndpoint: string;
8
9
  }
9
10
  export type SupportedChainId = typeof base.id;
10
11
  export declare const getConfig: (chainId: number, rpcUrl?: string) => Config;
@@ -8,6 +8,7 @@ const baseMainnetConfig = {
8
8
  rpcUrl: constants_1.BaseMainnetRpcUrl,
9
9
  factoryAddress: constants_1.BaseBondkitTokenFactoryContractAddress,
10
10
  apiEndpoint: "https://api.b3.fun/bondkit-tokens",
11
+ chartApiEndpoint: "https://bondkit-chart-api.b3.fun",
11
12
  };
12
13
  const getConfig = (chainId, rpcUrl) => {
13
14
  if (chainId === chains_1.base.id) {
@@ -5,4 +5,4 @@ export * from "./constants";
5
5
  export * from "./types";
6
6
  export * from "./abis";
7
7
  export { BondkitSwapService } from "./swapService";
8
- export { default as TradingView } from "./components/TradingView";
8
+ export * from "./components";
@@ -13,11 +13,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.TradingView = exports.BondkitSwapService = void 0;
17
+ exports.BondkitSwapService = void 0;
21
18
  // Core exports
22
19
  __exportStar(require("./bondkitToken"), exports);
23
20
  __exportStar(require("./bondkitTokenFactory"), exports);
@@ -32,5 +29,4 @@ __exportStar(require("./abis"), exports);
32
29
  var swapService_1 = require("./swapService");
33
30
  Object.defineProperty(exports, "BondkitSwapService", { enumerable: true, get: function () { return swapService_1.BondkitSwapService; } });
34
31
  // Components
35
- var TradingView_1 = require("./components/TradingView");
36
- Object.defineProperty(exports, "TradingView", { enumerable: true, get: function () { return __importDefault(TradingView_1).default; } });
32
+ __exportStar(require("./components"), exports);
@@ -86,3 +86,18 @@ export interface SwapQuote {
86
86
  executionPrice: string;
87
87
  fee: string;
88
88
  }
89
+ export interface MarketCapDataPoint {
90
+ time: string;
91
+ value: string;
92
+ }
93
+ export interface TokenInfo {
94
+ contractAddress: string;
95
+ chainId: number;
96
+ name: string;
97
+ symbol: string;
98
+ found: boolean;
99
+ }
100
+ export interface MarketCapChartResponse {
101
+ tokenInfo: TokenInfo;
102
+ data: MarketCapDataPoint[];
103
+ }
@@ -65,7 +65,7 @@
65
65
  {
66
66
  "_id": "66f2044afe5a3ac32a1de9ff",
67
67
  "id": 8453,
68
- "name": "Base Mainnet",
68
+ "name": "Base",
69
69
  "rpcUrls": {
70
70
  "default": {
71
71
  "http": "https://base-rpc.publicnode.com",
@@ -524,7 +524,7 @@
524
524
  "testnet": true,
525
525
  "badge": "https://cdn.b3.fun/b4-logo.png",
526
526
  "color": "#3368ef",
527
- "enabledFeatures": ["explorer"]
527
+ "enabledFeatures": ["explorer", "basement"]
528
528
  },
529
529
  {
530
530
  "_id": "684afdec4a478ffb44a4f83f",
@@ -620,7 +620,7 @@
620
620
  "enabledFeatures": ["explorer"]
621
621
  },
622
622
  {
623
- "_id": "68a351c603e65c07b7645581",
623
+ "_id": "68aefec4130155af4cf50711",
624
624
  "id": 1448000,
625
625
  "name": "XRPLT",
626
626
  "rpcUrls": {
@@ -631,21 +631,54 @@
631
631
  "backups": []
632
632
  },
633
633
  "icon": {
634
- "url": "https://cdn.b3.fun/xrpl_logo.svg",
634
+ "url": "https://cdn.b3.fun/xrpl-black.svg",
635
635
  "width": 32,
636
636
  "height": 32,
637
637
  "format": "svg"
638
638
  },
639
639
  "blockExplorers": {
640
- "default": "https://xrplt.explorer.caldera.xyz/",
640
+ "default": "https://xrplt.explorer.caldera.xyz",
641
641
  "explorerTitle": "XRPLT Explorer"
642
642
  },
643
643
  "nativeCurrency": {
644
644
  "name": "XRP",
645
645
  "symbol": "XRP",
646
- "decimals": 18
646
+ "decimals": 6
647
647
  },
648
648
  "testnet": true,
649
- "enabledFeatures": ["xcade", "explorer"]
649
+ "badge": "https://cdn.b3.fun/xrpl-black.svg",
650
+ "color": "#000000",
651
+ "enabledFeatures": ["basement", "explorer"]
652
+ },
653
+ {
654
+ "_id": "68eabd8a234b8958b152d6e0",
655
+ "id": 2741,
656
+ "name": "Abstract",
657
+ "rpcUrls": {
658
+ "default": {
659
+ "http": "https://cosmopolitan-nameless-mountain.abstract-mainnet.quiknode.pro/863853304b986b582bdacf625ce3350397c560f8/",
660
+ "ws": "wss://cosmopolitan-nameless-mountain.abstract-mainnet.quiknode.pro/863853304b986b582bdacf625ce3350397c560f8/"
661
+ },
662
+ "backups": []
663
+ },
664
+ "icon": {
665
+ "url": "https://assets.relay.link/icons/square/2741/light.png",
666
+ "width": 261,
667
+ "height": 261,
668
+ "format": "png"
669
+ },
670
+ "blockExplorers": {
671
+ "default": "https://abscan.org",
672
+ "explorerTitle": "Abscan"
673
+ },
674
+ "nativeCurrency": {
675
+ "name": "ETH",
676
+ "symbol": "ETH",
677
+ "decimals": 18
678
+ },
679
+ "testnet": false,
680
+ "badge": "https://assets.relay.link/icons/square/2741/light.png",
681
+ "color": "#6eb998",
682
+ "enabledFeatures": ["basement"]
650
683
  }
651
684
  ]
@@ -6,6 +6,7 @@ export declare const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
6
6
  export declare const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
7
7
  export declare const SOLANA_TOKEN_2022_PROGRAM_ID = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
8
8
  export declare const B3_TOKEN: components["schemas"]["Token"];
9
+ export declare const ANYSPEND_TOKEN: components["schemas"]["Token"];
9
10
  export declare const USDC_BASE: components["schemas"]["Token"];
10
11
  export declare const ETH_BASE: components["schemas"]["Token"];
11
12
  export declare const NFT_CONTRACTS: components["schemas"]["NftContract"][];
@@ -6,7 +6,7 @@ export const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
6
6
  export const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
7
7
  export const SOLANA_TOKEN_2022_PROGRAM_ID = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
8
8
  export const B3_TOKEN = {
9
- chainId: 8453,
9
+ chainId: base.id,
10
10
  address: "0xb3b32f9f8827d4634fe7d973fa1034ec9fddb3b3",
11
11
  decimals: 18,
12
12
  name: "B3",
@@ -15,6 +15,16 @@ export const B3_TOKEN = {
15
15
  logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/35690.png",
16
16
  },
17
17
  };
18
+ export const ANYSPEND_TOKEN = {
19
+ chainId: base.id,
20
+ address: "0xc17dda248e2d50fc006d8febb5a406dd31972712",
21
+ decimals: 18,
22
+ name: "Anyspend",
23
+ symbol: "ANY",
24
+ metadata: {
25
+ logoURI: "https://cdn.b3.fun/anyspend_64x64.png",
26
+ },
27
+ };
18
28
  export const USDC_BASE = {
19
29
  symbol: "USDC",
20
30
  chainId: base.id,
@@ -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
@@ -196,7 +196,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
196
196
  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, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
197
197
  setOrderId(undefined);
198
198
  setActivePanel(PanelView.MAIN);
199
- }, disableUrlParamManagement: true })) }) }));
199
+ }, disableUrlParamManagement: true, points: oat.data.points || undefined })) }) }));
200
200
  // Loading view
201
201
  const loadingView = (_jsx("div", { className: "mx-auto flex w-full flex-col items-center gap-4 p-5", children: _jsx("div", { className: "text-as-primary", children: "Loading order details..." }) }));
202
202
  // Panel views
@@ -22,32 +22,38 @@ export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false,
22
22
  (() => {
23
23
  const calculatePriceImpact = (inputUsd, outputUsd) => {
24
24
  if (!inputUsd || !outputUsd) {
25
- return { percentage: "0.00", isNegative: false };
25
+ return { percentage: "0.00", percentageNum: 0, isNegative: false };
26
26
  }
27
27
  const input = Number(inputUsd);
28
28
  const output = Number(outputUsd);
29
29
  // Handle edge cases
30
30
  if (input === 0 || isNaN(input) || isNaN(output) || input <= output) {
31
- return { percentage: "0.00", isNegative: false };
31
+ return { percentage: "0.00", percentageNum: 0, isNegative: false };
32
32
  }
33
33
  const percentageValue = ((output - input) / input) * 100;
34
34
  // Handle the -0.00% case
35
35
  if (percentageValue > -0.005 && percentageValue < 0) {
36
- return { percentage: "0.00", isNegative: false };
36
+ return { percentage: "0.00", percentageNum: 0, isNegative: false };
37
37
  }
38
38
  return {
39
39
  percentage: Math.abs(percentageValue).toFixed(2),
40
+ percentageNum: Math.abs(percentageValue),
40
41
  isNegative: percentageValue < 0,
41
42
  };
42
43
  };
43
- const { percentage, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
44
- // Parse the percentage as a number for comparison
45
- const percentageNum = parseFloat(percentage);
46
- // Don't show if less than 1%
47
- if (percentageNum < 1) {
44
+ const { percentage, percentageNum, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
45
+ // Get the fee percentage if available
46
+ const feePercent = anyspendQuote.data.fee?.finalFeeBps ? anyspendQuote.data.fee.finalFeeBps / 100 : 0;
47
+ // Calculate actual slippage (price impact minus fee)
48
+ const actualSlippage = percentageNum - feePercent;
49
+ // Show warning based on actual slippage, not total impact
50
+ const yellowThreshold = 1; // 1% actual slippage
51
+ const redThreshold = 2; // 2% actual slippage
52
+ // Don't show if actual slippage is less than yellow threshold
53
+ if (actualSlippage < yellowThreshold) {
48
54
  return null;
49
55
  }
50
56
  // Using inline style to ensure color displays
51
- return (_jsxs("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
57
+ return (_jsxs("span", { className: "ml-2", style: { color: actualSlippage >= redThreshold ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
52
58
  })()] }), featureFlags.showPoints && anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] })] }));
53
59
  }
@@ -67,7 +67,7 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
67
67
  if (!showAllFeeTiers && currentTierIndex !== -1 && idx > currentTierIndex) {
68
68
  return null;
69
69
  }
70
- return (_jsxs("div", { className: cn("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-as-brand/10 text-as-brand font-semibold" : "text-as-primary/60"), children: [_jsx("span", { children: tier.label }), _jsxs("span", { children: ["CC Fee + ", tier.fee] })] }, idx));
70
+ return (_jsxs("div", { className: cn("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-as-brand/10 text-as-brand font-semibold" : "text-as-primary/60"), children: [_jsx("span", { children: tier.label }), _jsxs("span", { children: ["Credit Card Fee + ", tier.fee] })] }, idx));
71
71
  })
72
72
  : CRYPTO_FEE_TIERS.map((tier, idx) => {
73
73
  const isCurrentTier = currentCryptoTier?.label === tier.label;
@@ -109,5 +109,5 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
109
109
  return (_jsxs("button", { onClick: () => setShowAllDiscountTiers(!showAllDiscountTiers), className: "text-as-primary/60 hover:text-as-primary mt-2 flex w-full items-center justify-center gap-1 text-xs transition-colors", children: [_jsx("span", { children: showAllDiscountTiers ? "Show less" : "Show all tiers" }), _jsx(ChevronDown, { className: cn("h-3.5 w-3.5 transition-transform", showAllDiscountTiers && "rotate-180") })] }));
110
110
  }
111
111
  return null;
112
- })()] })) })] })), transactionAmountUsd && (_jsx("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: _jsxs("div", { className: "space-y-2 text-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-secondary", children: "Transaction" }), _jsxs("span", { className: "text-as-primary font-semibold", children: ["$", transactionAmountUsd.toFixed(2)] })] }), isStripeFee && currentFiatTier && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-secondary", children: currentFiatTier.label }), _jsxs("span", { className: "text-as-primary", children: ["CC Fee + ", currentFiatTier.fee] })] })), !isStripeFee && currentCryptoTier && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["Base Fee (", bpsToPercent(currentCryptoTier.bps), "%)"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * currentCryptoTier.bps) / 10000).toFixed(2)] })] }), hasWhaleDiscount && currentWhaleTier && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-green-600", children: ["Discount (", currentWhaleTier.discountPercent, "% off)"] }), _jsxs("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * currentWhaleTier.discountPercent) / 100 / 10000).toFixed(2)] })] })), hasPartnerDiscount && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-green-600", children: ["Partner Discount (", partnerDiscountPercent, "% off)"] }), _jsxs("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * partnerDiscountPercent) / 100 / 10000).toFixed(2)] })] })), _jsx("div", { className: "border-as-border-secondary border-t pt-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Total Fee" }), _jsxs("span", { className: "text-as-brand font-semibold", children: ["$", ((transactionAmountUsd * fee.finalFeeBps) / 10000).toFixed(2)] })] }) })] }))] }) })), _jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: ["Back to ", isStripeFee ? "Payment" : "Swap"] })] }) }));
112
+ })()] })) })] })), transactionAmountUsd && (_jsx("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: _jsxs("div", { className: "space-y-2 text-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-secondary", children: "Transaction" }), _jsxs("span", { className: "text-as-primary font-semibold", children: ["$", transactionAmountUsd.toFixed(2)] })] }), isStripeFee && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["Credit Card Fee (", fee.stripeFeeBps ? `${bpsToPercent(fee.stripeFeeBps)}%` : "0%", " + $", fee.stripeFeeUsd?.toFixed(2) || "0.00", ")"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * (fee.stripeFeeBps || 0)) / 10000 + (fee.stripeFeeUsd || 0)).toFixed(2)] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["AnySpend Fee (", fee.anyspendFeeBps ? `${bpsToPercent(fee.anyspendFeeBps)}%` : "0%", fee.anyspendFeeUsd && fee.anyspendFeeUsd > 0 ? ` + $${fee.anyspendFeeUsd.toFixed(2)}` : "", ")"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * (fee.anyspendFeeBps || 0)) / 10000 + (fee.anyspendFeeUsd || 0)).toFixed(2)] })] }), _jsx("div", { className: "border-as-border-secondary border-t pt-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Total Fee" }), _jsxs("span", { className: "text-as-brand font-semibold", children: ["$", ((transactionAmountUsd * (fee.finalFeeBps || 0)) / 10000 + (fee.finalFeeUsd || 0)).toFixed(2)] })] }) })] })), !isStripeFee && currentCryptoTier && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-as-secondary", children: ["Base Fee (", bpsToPercent(currentCryptoTier.bps), "%)"] }), _jsxs("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * currentCryptoTier.bps) / 10000).toFixed(2)] })] }), hasWhaleDiscount && currentWhaleTier && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-green-600", children: ["Discount (", currentWhaleTier.discountPercent, "% off)"] }), _jsxs("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * currentWhaleTier.discountPercent) / 100 / 10000).toFixed(2)] })] })), hasPartnerDiscount && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-green-600", children: ["Partner Discount (", partnerDiscountPercent, "% off)"] }), _jsxs("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * partnerDiscountPercent) / 100 / 10000).toFixed(2)] })] })), _jsx("div", { className: "border-as-border-secondary border-t pt-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Total Fee" }), _jsxs("span", { className: "text-as-brand font-semibold", children: ["$", ((transactionAmountUsd * fee.finalFeeBps) / 10000).toFixed(2)] })] }) })] }))] }) })), _jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: ["Back to ", isStripeFee ? "Payment" : "Swap"] })] }) }));
113
113
  }
@@ -12,6 +12,7 @@ interface OrderDetailsProps {
12
12
  onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
13
13
  onBack?: () => void;
14
14
  disableUrlParamManagement?: boolean;
15
+ points?: number | undefined;
15
16
  }
16
17
  export declare const OrderDetails: import("react").NamedExoticComponent<OrderDetailsProps>;
17
18
  export declare const OrderDetailsLoadingView: import("react/jsx-runtime").JSX.Element;
@@ -125,7 +125,7 @@ function roundTokenAmount(amount) {
125
125
  const roundedDecimalPart = digits.join("");
126
126
  return `${wholePart}.${roundedDecimalPart}`;
127
127
  }
128
- export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, selectedCryptoPaymentMethod, onPaymentMethodChange, onBack, disableUrlParamManagement = false, }) {
128
+ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, selectedCryptoPaymentMethod, onPaymentMethodChange, onBack, disableUrlParamManagement = false, points, }) {
129
129
  const router = useRouter();
130
130
  const searchParams = useSearchParams();
131
131
  // Get theme from B3Provider context
@@ -411,7 +411,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
411
411
  }
412
412
  };
413
413
  if (refundTxs.length > 0) {
414
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
414
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
415
415
  ? depositTxs.map(dTx => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
416
416
  ? `Received payment`
417
417
  : `Received ${formatTokenAmount(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
@@ -420,7 +420,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
420
420
  : null] }) })] }) }), order.errorDetails && (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: getErrorDisplay(order.errorDetails) }) })), _jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
421
421
  }
422
422
  if (executeTx) {
423
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
423
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
424
424
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
425
425
  ? `Received payment`
426
426
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
@@ -445,7 +445,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
445
445
  }), _jsx(ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && (_jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [_jsx("span", { className: "pl-4", children: "Continue to Tournament" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && (_jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
446
446
  }
447
447
  if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
448
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "more-details", className: "order-details-more-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
448
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "more-details", className: "order-details-more-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
449
449
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
450
450
  ? `Received payment`
451
451
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
@@ -464,7 +464,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
464
464
  // This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
465
465
  const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
466
466
  if (depositTxs?.length || waitingForDeposit) {
467
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-6", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
467
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-6", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
468
468
  ? `Received payment`
469
469
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? (_jsx(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? (_jsx(TransactionDetails, { title: order.type === "swap"
470
470
  ? "Processing Swap"
@@ -491,7 +491,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
491
491
  ? centerTruncate(phantomWalletAddress, 6)
492
492
  : centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
493
493
  // Default case - existing QR code flow
494
- _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), _jsxs("button", { className: "order-details-cancel-btn flex w-full items-center justify-center gap-2", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
494
+ _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), _jsxs("button", { className: "order-details-cancel-btn flex w-full items-center justify-center gap-2", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
495
495
  });
496
496
  function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
497
497
  return (_jsxs("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [_jsxs("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [_jsx(motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: _jsx(Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: _jsx(CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), _jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? (_jsx(TextShimmer, { duration: 1, children: title })) : (_jsx("span", { className: "text-as-primary", children: title })) })] }), _jsx("div", { className: "flex flex-col gap-1", children: tx ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: _jsx("a", { href: getExplorerTxUrl(chainId, tx.txHash), target: "_blank", children: _jsx("div", { className: "text-as-primary/30 font-mono text-xs", children: centerTruncate(tx?.txHash, 6) }) }) })) : null })] }));
@@ -13,6 +13,7 @@ interface OrderDetailsCollapsibleProps {
13
13
  className?: string;
14
14
  showTotal?: boolean;
15
15
  totalAmount?: string;
16
+ points?: number;
16
17
  }
17
18
  export declare const OrderDetailsCollapsible: import("react").NamedExoticComponent<OrderDetailsCollapsibleProps>;
18
19
  export {};
@@ -1,16 +1,17 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { ALL_CHAINS, capitalizeFirstLetter, getChainName } from "../../../../anyspend/index.js";
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";
10
11
  import { memo, useState } from "react";
11
12
  import { toast } from "sonner";
12
13
  import { b3 } from "viem/chains";
13
- export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, }) {
14
+ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, points, }) {
14
15
  const [showOrderDetails, setShowOrderDetails] = useState(true);
15
16
  // Calculate expected amount if not provided
16
17
  const expectedDstAmount = order.type === "mint_nft" ||
@@ -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") })] })] })] }), _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
  });
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { createContext, useContext } from "react";
4
4
  const FeatureFlagsContext = createContext(undefined);
5
5
  const defaultFeatureFlags = {
6
- showPoints: false,
6
+ showPoints: true,
7
7
  };
8
8
  export function FeatureFlagsProvider({ children, featureFlags = defaultFeatureFlags }) {
9
9
  return _jsx(FeatureFlagsContext.Provider, { value: { featureFlags }, children: children });