@b3dotfun/sdk 0.0.49 → 0.0.50-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.
- package/dist/cjs/anyspend/constants/index.d.ts +1 -0
- package/dist/cjs/anyspend/constants/index.js +12 -2
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +18 -5
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +12 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +11 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -2
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +17 -11
- package/dist/cjs/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/common/FeeBreakDown.js +19 -0
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +116 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderToken.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +36 -21
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -2
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +48 -12
- package/dist/cjs/anyspend/types/api.d.ts +133 -178
- package/dist/cjs/anyspend/utils/chain.js +4 -4
- package/dist/cjs/bondkit/bondkitToken.d.ts +3 -1
- package/dist/cjs/bondkit/bondkitToken.js +21 -2
- package/dist/cjs/bondkit/components/TradingView.d.ts +1 -1
- package/dist/cjs/bondkit/components/TradingView.js +14 -3
- package/dist/cjs/bondkit/components/index.d.ts +1 -1
- package/dist/cjs/bondkit/components/index.js +1 -1
- package/dist/cjs/bondkit/components/types.d.ts +1 -0
- package/dist/cjs/bondkit/config.d.ts +1 -0
- package/dist/cjs/bondkit/config.js +1 -0
- package/dist/cjs/bondkit/index.d.ts +1 -1
- package/dist/cjs/bondkit/index.js +2 -6
- package/dist/cjs/bondkit/types.d.ts +15 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +2 -2
- package/dist/cjs/global-account/react/components/ui/tooltip.js +1 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +11 -0
- package/dist/cjs/shared/generated/chain-networks.json +40 -7
- package/dist/esm/anyspend/constants/index.d.ts +1 -0
- package/dist/esm/anyspend/constants/index.js +11 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +18 -5
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +14 -5
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -4
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +19 -13
- package/dist/esm/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
- package/dist/esm/anyspend/react/components/common/FeeBreakDown.js +16 -0
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +113 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -3
- package/dist/esm/anyspend/react/components/common/OrderToken.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +38 -23
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +2 -3
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +48 -12
- package/dist/esm/anyspend/types/api.d.ts +133 -178
- package/dist/esm/anyspend/utils/chain.js +4 -4
- package/dist/esm/bondkit/bondkitToken.d.ts +3 -1
- package/dist/esm/bondkit/bondkitToken.js +21 -2
- package/dist/esm/bondkit/components/TradingView.d.ts +1 -1
- package/dist/esm/bondkit/components/TradingView.js +14 -3
- package/dist/esm/bondkit/components/index.d.ts +1 -1
- package/dist/esm/bondkit/components/index.js +1 -1
- package/dist/esm/bondkit/components/types.d.ts +1 -0
- package/dist/esm/bondkit/config.d.ts +1 -0
- package/dist/esm/bondkit/config.js +1 -0
- package/dist/esm/bondkit/index.d.ts +1 -1
- package/dist/esm/bondkit/index.js +1 -1
- package/dist/esm/bondkit/types.d.ts +15 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +2 -2
- package/dist/esm/global-account/react/components/ui/tooltip.js +1 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +11 -0
- package/dist/esm/shared/generated/chain-networks.json +40 -7
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeBreakDown.d.ts +12 -0
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -1
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +48 -12
- package/dist/types/anyspend/types/api.d.ts +133 -178
- package/dist/types/bondkit/bondkitToken.d.ts +3 -1
- package/dist/types/bondkit/components/TradingView.d.ts +1 -1
- package/dist/types/bondkit/components/index.d.ts +1 -1
- package/dist/types/bondkit/components/types.d.ts +1 -0
- package/dist/types/bondkit/config.d.ts +1 -0
- package/dist/types/bondkit/index.d.ts +1 -1
- package/dist/types/bondkit/types.d.ts +15 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/package.json +3 -3
- package/src/anyspend/constants/index.ts +12 -1
- package/src/anyspend/react/components/AnySpend.tsx +33 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +69 -7
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +24 -0
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +14 -2
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +31 -11
- package/src/anyspend/react/components/common/FeeBreakDown.tsx +105 -0
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +334 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -0
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +16 -0
- package/src/anyspend/react/components/common/OrderToken.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +1 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +58 -27
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +18 -6
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -13
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -0
- package/src/anyspend/types/api.ts +135 -178
- package/src/anyspend/utils/chain.ts +4 -4
- package/src/bondkit/bondkitToken.ts +26 -2
- package/src/bondkit/components/TradingView.tsx +15 -3
- package/src/bondkit/components/index.ts +1 -1
- package/src/bondkit/components/types.ts +1 -0
- package/src/bondkit/config.ts +2 -0
- package/src/bondkit/index.ts +1 -1
- package/src/bondkit/types.ts +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -1
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +2 -2
- package/src/global-account/react/components/ui/tooltip.tsx +11 -9
- package/src/global-account/react/hooks/useAuthentication.ts +13 -1
- 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(
|
|
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
|
-
}, [
|
|
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 &&
|
|
@@ -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);
|
|
@@ -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) {
|
|
@@ -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.
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
2
|
-
import "@
|
|
2
|
+
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
3
3
|
import { Account } from "thirdweb/wallets";
|
|
4
4
|
import { ClientType } from "../../../client-manager";
|
|
5
5
|
import { B3ContextType } from "./types";
|
|
@@ -7,7 +7,7 @@ const react_1 = require("../../../../global-account/react");
|
|
|
7
7
|
const useWagmiConfig_1 = require("../../../../global-account/react/hooks/useWagmiConfig");
|
|
8
8
|
const analytics_1 = require("../../../../global-account/utils/analytics");
|
|
9
9
|
const debug_1 = require("../../../../shared/utils/debug");
|
|
10
|
-
require("@
|
|
10
|
+
require("@relayprotocol/relay-kit-ui/styles.css");
|
|
11
11
|
const react_query_1 = require("@tanstack/react-query");
|
|
12
12
|
const react_2 = require("react");
|
|
13
13
|
const sonner_1 = require("sonner");
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RelayKitProviderWrapper = RelayKitProviderWrapper;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const relay_kit_ui_1 = require("@
|
|
6
|
-
const relay_sdk_1 = require("@
|
|
5
|
+
const relay_kit_ui_1 = require("@relayprotocol/relay-kit-ui");
|
|
6
|
+
const relay_sdk_1 = require("@relayprotocol/relay-sdk");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
|
|
9
9
|
const [relayChains, setRelayChains] = (0, react_1.useState)([]);
|
|
@@ -45,6 +45,6 @@ const Tooltip = TooltipPrimitive.Root;
|
|
|
45
45
|
exports.Tooltip = Tooltip;
|
|
46
46
|
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
47
47
|
exports.TooltipTrigger = TooltipTrigger;
|
|
48
|
-
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => ((0, jsx_runtime_1.jsx)(TooltipPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: (0, cn_1.cn)("bg-b3-react-popover text-b3-react-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-
|
|
48
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => ((0, jsx_runtime_1.jsx)(TooltipPrimitive.Portal, { children: (0, jsx_runtime_1.jsx)(TooltipPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: (0, cn_1.cn)("bg-b3-react-popover text-b3-react-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[9999] overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md", className), ...props }) })));
|
|
49
49
|
exports.TooltipContent = TooltipContent;
|
|
50
50
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
@@ -41,6 +41,17 @@ function useAuthentication(partnerId) {
|
|
|
41
41
|
const activeWagmiAccount = (0, wagmi_1.useAccount)();
|
|
42
42
|
const { switchAccount } = (0, wagmi_1.useSwitchAccount)();
|
|
43
43
|
debug("@@activeWagmiAccount", activeWagmiAccount);
|
|
44
|
+
// Check localStorage version and clear if not found or mismatched
|
|
45
|
+
(0, react_2.useEffect)(() => {
|
|
46
|
+
if (typeof localStorage !== "undefined") {
|
|
47
|
+
const version = localStorage.getItem("version");
|
|
48
|
+
if (version !== "1") {
|
|
49
|
+
debug("@@localStorage:clearing due to version mismatch", { version });
|
|
50
|
+
localStorage.clear();
|
|
51
|
+
localStorage.setItem("version", "1");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, []);
|
|
44
55
|
const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
|
|
45
56
|
partnerId: partnerId,
|
|
46
57
|
});
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
{
|
|
66
66
|
"_id": "66f2044afe5a3ac32a1de9ff",
|
|
67
67
|
"id": 8453,
|
|
68
|
-
"name": "Base
|
|
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": "
|
|
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/
|
|
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":
|
|
646
|
+
"decimals": 6
|
|
647
647
|
},
|
|
648
648
|
"testnet": true,
|
|
649
|
-
"
|
|
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:
|
|
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,
|
|
@@ -22,6 +22,7 @@ import { OrderHistory } from "./common/OrderHistory.js";
|
|
|
22
22
|
import { PanelOnramp } from "./common/PanelOnramp.js";
|
|
23
23
|
import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
|
|
24
24
|
import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
|
|
25
|
+
import { FeeDetailPanel } from "./common/FeeDetailPanel.js";
|
|
25
26
|
import { RecipientSelection } from "./common/RecipientSelection.js";
|
|
26
27
|
import { TabSection } from "./common/TabSection.js";
|
|
27
28
|
export var PanelView;
|
|
@@ -35,6 +36,7 @@ export var PanelView;
|
|
|
35
36
|
PanelView[PanelView["CRYPTO_PAYMENT_METHOD"] = 6] = "CRYPTO_PAYMENT_METHOD";
|
|
36
37
|
PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 7] = "FIAT_PAYMENT_METHOD";
|
|
37
38
|
PanelView[PanelView["POINTS_DETAIL"] = 8] = "POINTS_DETAIL";
|
|
39
|
+
PanelView[PanelView["FEE_DETAIL"] = 9] = "FEE_DETAIL";
|
|
38
40
|
})(PanelView || (PanelView = {}));
|
|
39
41
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
40
42
|
export function AnySpend(props) {
|
|
@@ -458,10 +460,18 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
458
460
|
toast.error("Failed to create order: " + error.message);
|
|
459
461
|
},
|
|
460
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]);
|
|
461
469
|
// Determine button state and text
|
|
462
470
|
const btnInfo = useMemo(() => {
|
|
463
471
|
if (activeInputAmountInWei === "0")
|
|
464
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 };
|
|
465
475
|
if (isLoadingAnyspendQuote)
|
|
466
476
|
return { text: "Loading quote...", disable: true, error: false, loading: true };
|
|
467
477
|
if (!recipientAddress)
|
|
@@ -495,6 +505,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
495
505
|
return { text: "Buy", disable: false, error: false, loading: false };
|
|
496
506
|
}, [
|
|
497
507
|
activeInputAmountInWei,
|
|
508
|
+
isSameChainSameToken,
|
|
498
509
|
isLoadingAnyspendQuote,
|
|
499
510
|
recipientAddress,
|
|
500
511
|
isCreatingOrder,
|
|
@@ -711,12 +722,12 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
711
722
|
};
|
|
712
723
|
}, [activePanel, navigateBack]);
|
|
713
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 }) }));
|
|
714
|
-
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: () => {
|
|
715
726
|
setOrderId(undefined);
|
|
716
727
|
navigateBack();
|
|
717
728
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
718
729
|
} })) }) }));
|
|
719
|
-
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(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_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: (panelIndex) => {
|
|
730
|
+
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(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_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: (panelIndex) => {
|
|
720
731
|
// Map panel index to navigation with direction
|
|
721
732
|
const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
|
|
722
733
|
if (panelsWithForwardNav.includes(panelIndex)) {
|
|
@@ -725,7 +736,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
725
736
|
else {
|
|
726
737
|
setActivePanel(panelIndex);
|
|
727
738
|
}
|
|
728
|
-
}, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _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: () => {
|
|
739
|
+
}, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _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: () => {
|
|
729
740
|
if (activeTab === "fiat" || isBuyMode) {
|
|
730
741
|
return;
|
|
731
742
|
}
|
|
@@ -744,10 +755,10 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
744
755
|
const tempDstAmount = dstAmount;
|
|
745
756
|
setSrcAmount(tempDstAmount);
|
|
746
757
|
setDstAmount(tempSrcAmount);
|
|
747
|
-
}, 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: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, onChangeDstAmount: value => {
|
|
758
|
+
}, 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: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
748
759
|
setIsSrcInputDirty(false);
|
|
749
760
|
setDstAmount(value);
|
|
750
|
-
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward") }))] }), _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"), 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: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), 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] })] }));
|
|
761
|
+
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), _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"), 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: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), 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] })] }));
|
|
751
762
|
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 => {
|
|
752
763
|
setOrderId(orderId);
|
|
753
764
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
@@ -776,6 +787,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
776
787
|
navigateBack(); // Go back to main panel to show updated pricing
|
|
777
788
|
}, srcAmountOnRamp: srcAmountOnRamp }));
|
|
778
789
|
const pointsDetailView = (_jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: navigateBack }));
|
|
790
|
+
const feeDetailView = anyspendQuote?.data?.fee ? (_jsx(FeeDetailPanel, { fee: anyspendQuote.data.fee, transactionAmountUsd: activeTab === "crypto" ? Number(anyspendQuote.data.currencyIn?.amountUsd) : parseFloat(srcAmountOnRamp), onBack: navigateBack })) : null;
|
|
779
791
|
// Add tabs to the main component when no order is loaded
|
|
780
792
|
return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
|
|
781
793
|
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
|
|
@@ -806,5 +818,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
806
818
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: cryptoPaymentMethodView }, "crypto-payment-method-view"),
|
|
807
819
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
|
|
808
820
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
|
|
821
|
+
_jsx("div", { className: cn(mode === "page" && "p-6"), children: feeDetailView }, "fee-detail-view"),
|
|
809
822
|
] }) }) }));
|
|
810
823
|
}
|
|
@@ -2,13 +2,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
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";
|
|
5
|
-
import { Badge, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TextShimmer, Tooltip, TooltipContent, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
|
|
5
|
+
import { Badge, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TextShimmer, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
|
|
6
6
|
import { cn, formatUsername } from "../../../shared/utils/index.js";
|
|
7
7
|
import { shortenAddress } from "../../../shared/utils/formatAddress.js";
|
|
8
8
|
import { formatTokenAmount, formatUnits } from "../../../shared/utils/number.js";
|
|
9
9
|
import { simpleHashChainToChainName } from "../../../shared/utils/simplehash.js";
|
|
10
10
|
import invariant from "invariant";
|
|
11
|
-
import { ChevronRight, ChevronRightCircle, Loader2 } from "lucide-react";
|
|
11
|
+
import { ChevronRight, ChevronRightCircle, Info, Loader2 } from "lucide-react";
|
|
12
12
|
import { motion } from "motion/react";
|
|
13
13
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
14
14
|
import { toast } from "sonner";
|
|
@@ -16,6 +16,7 @@ import { base } from "viem/chains";
|
|
|
16
16
|
import { useFeatureFlags } from "../contexts/FeatureFlagsContext.js";
|
|
17
17
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
18
18
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
|
|
19
|
+
import { FeeBreakDown } from "./common/FeeBreakDown.js";
|
|
19
20
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
|
|
20
21
|
import { OrderDetails } from "./common/OrderDetails.js";
|
|
21
22
|
import { OrderHistory } from "./common/OrderHistory.js";
|
|
@@ -34,7 +35,7 @@ var PanelView;
|
|
|
34
35
|
PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 6] = "FIAT_PAYMENT_METHOD";
|
|
35
36
|
PanelView[PanelView["POINTS_DETAIL"] = 7] = "POINTS_DETAIL";
|
|
36
37
|
})(PanelView || (PanelView = {}));
|
|
37
|
-
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, recipientAddress, dstAmount, contractAddress, tokenId, contractType, encodedData, spenderAddress, }) {
|
|
38
|
+
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, recipientAddress, dstAmount, contractAddress, tokenId, contractType, encodedData, spenderAddress, onrampVendor, }) {
|
|
38
39
|
switch (orderType) {
|
|
39
40
|
case "mint_nft": {
|
|
40
41
|
invariant(contractType, "Contract type is required");
|
|
@@ -49,6 +50,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
49
50
|
contractAddress: contractAddress,
|
|
50
51
|
tokenId: tokenId,
|
|
51
52
|
contractType: contractType,
|
|
53
|
+
onrampVendor,
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
case "join_tournament": {
|
|
@@ -61,6 +63,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
61
63
|
recipientAddress,
|
|
62
64
|
price: dstAmount,
|
|
63
65
|
contractAddress: contractAddress,
|
|
66
|
+
onrampVendor,
|
|
64
67
|
};
|
|
65
68
|
}
|
|
66
69
|
case "fund_tournament": {
|
|
@@ -73,6 +76,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
73
76
|
recipientAddress,
|
|
74
77
|
fundAmount: dstAmount,
|
|
75
78
|
contractAddress: contractAddress,
|
|
79
|
+
onrampVendor,
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
case "custom": {
|
|
@@ -89,6 +93,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
89
93
|
to: contractAddress,
|
|
90
94
|
spenderAddress: spenderAddress,
|
|
91
95
|
},
|
|
96
|
+
onrampVendor,
|
|
92
97
|
};
|
|
93
98
|
}
|
|
94
99
|
default: {
|
|
@@ -186,6 +191,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
186
191
|
contractType: orderType === "mint_nft" ? metadata?.nftContract?.type : undefined,
|
|
187
192
|
encodedData: encodedData,
|
|
188
193
|
spenderAddress: spenderAddress,
|
|
194
|
+
onrampVendor: selectedFiatPaymentMethod === FiatPaymentMethod.STRIPE ? "stripe-web2" : undefined,
|
|
189
195
|
});
|
|
190
196
|
}, [
|
|
191
197
|
activeTab,
|
|
@@ -201,6 +207,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
201
207
|
spenderAddress,
|
|
202
208
|
srcChainId,
|
|
203
209
|
srcToken,
|
|
210
|
+
selectedFiatPaymentMethod,
|
|
204
211
|
]);
|
|
205
212
|
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote(getRelayQuoteRequest);
|
|
206
213
|
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
|
|
@@ -473,7 +480,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
473
480
|
opacity: hasMounted ? 1 : 0,
|
|
474
481
|
y: hasMounted ? 0 : 20,
|
|
475
482
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
476
|
-
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(with fee)" })
|
|
483
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry flex items-center gap-1.5 text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(with fee)" }), anyspendQuote?.data?.fee && (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { side: "top", children: _jsx(FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), renderPointsBadge()] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [formattedSrcAmount || "--", " ", srcToken.symbol] }), anyspendQuote?.data?.fee?.type === "standard_fee" && anyspendQuote.data.currencyIn?.amountUsd && (_jsxs("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.currencyIn.amountUsd) * anyspendQuote.data.fee.finalFeeBps) /
|
|
484
|
+
10000).toFixed(2), " ", "fee"] }))] })] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
|
|
477
485
|
opacity: hasMounted ? 1 : 0,
|
|
478
486
|
y: hasMounted ? 0 : 20,
|
|
479
487
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -485,7 +493,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
485
493
|
opacity: hasMounted ? 1 : 0,
|
|
486
494
|
y: hasMounted ? 0 : 20,
|
|
487
495
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
488
|
-
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(USD)" })
|
|
496
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry flex items-center gap-1.5 text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(USD)" }), anyspendQuote?.data?.fee && (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { side: "top", children: _jsx(FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), renderPointsBadge()] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] }), anyspendQuote?.data?.fee?.type === "stripeweb2_fee" && anyspendQuote.data.fee.originalAmount && (_jsxs("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.fee.originalAmount) - Number(anyspendQuote.data.fee.finalAmount)) /
|
|
497
|
+
1e6).toFixed(2), " ", "fee"] }))] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
|
|
489
498
|
opacity: hasMounted ? 1 : 0,
|
|
490
499
|
y: hasMounted ? 0 : 20,
|
|
491
500
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|