@b3dotfun/sdk 0.0.88-alpha.6 → 0.0.88-alpha.8
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/react/components/AnySpend.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +32 -4
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +14 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +4 -2
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +33 -5
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +14 -2
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -2
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +6 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +16 -0
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +13 -0
- package/src/anyspend/react/components/AnySpendDeposit.tsx +15 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +4 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +5 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +52 -40
- package/src/anyspend/react/components/common/PanelOnramp.tsx +5 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +14 -2
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -2
- package/src/global-account/react/stores/useModalStore.ts +6 -0
|
@@ -83,6 +83,12 @@ export interface AnySpendDepositProps {
|
|
|
83
83
|
topChainsCount?: number;
|
|
84
84
|
/** Callback when close button is clicked */
|
|
85
85
|
onClose?: () => void;
|
|
86
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
87
|
+
returnToHomeUrl?: string;
|
|
88
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
89
|
+
customRecipientLabel?: string;
|
|
90
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
91
|
+
returnHomeLabel?: string;
|
|
86
92
|
}
|
|
87
93
|
/**
|
|
88
94
|
* A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
|
|
@@ -119,4 +125,4 @@ export interface AnySpendDepositProps {
|
|
|
119
125
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
120
126
|
* />
|
|
121
127
|
*/
|
|
122
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
128
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -95,7 +95,7 @@ function ChainIcon({ chainId, className }) {
|
|
|
95
95
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
96
96
|
* />
|
|
97
97
|
*/
|
|
98
|
-
export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, }) {
|
|
98
|
+
export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }) {
|
|
99
99
|
const { connectedEOAWallet } = useAccountWallet();
|
|
100
100
|
const eoaAddress = connectedEOAWallet?.getAccount()?.address;
|
|
101
101
|
// Determine if we should show chain selection
|
|
@@ -183,5 +183,5 @@ export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, p
|
|
|
183
183
|
// Check if destination is Hyperliquid
|
|
184
184
|
const isHyperliquidDeposit = destinationChainId === HYPERLIQUID_CHAIN_ID;
|
|
185
185
|
// Deposit view
|
|
186
|
-
return (_jsxs("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && (_jsxs("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [_jsx("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), _jsx("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && (_jsx("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: _jsx("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), _jsx("div", { className: cn("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? (_jsx(AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true }, selectedChainId)) : (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig }, selectedChainId)) }), _jsx(ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
|
|
186
|
+
return (_jsxs("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && (_jsxs("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [_jsx("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), _jsx("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && (_jsx("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: _jsx("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), _jsx("div", { className: cn("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? (_jsx(AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) : (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) }), _jsx(ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
|
|
187
187
|
}
|
|
@@ -22,5 +22,9 @@ export interface AnySpendDepositHypeProps {
|
|
|
22
22
|
}) => void;
|
|
23
23
|
customUsdInputValues?: string[];
|
|
24
24
|
preferEoa?: boolean;
|
|
25
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
26
|
+
returnToHomeUrl?: string;
|
|
27
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
28
|
+
customRecipientLabel?: string;
|
|
25
29
|
}
|
|
26
30
|
export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,6 +4,8 @@ interface CryptoReceiveSectionProps {
|
|
|
4
4
|
isBuyMode?: boolean;
|
|
5
5
|
effectiveRecipientAddress?: string;
|
|
6
6
|
recipientName?: string;
|
|
7
|
+
/** Custom label for recipient display (overrides recipientName) */
|
|
8
|
+
customRecipientLabel?: string;
|
|
7
9
|
onSelectRecipient: () => void;
|
|
8
10
|
dstAmount: string;
|
|
9
11
|
dstToken: components["schemas"]["Token"];
|
|
@@ -18,5 +20,5 @@ interface CryptoReceiveSectionProps {
|
|
|
18
20
|
onShowPointsDetail?: () => void;
|
|
19
21
|
onShowFeeDetail?: () => void;
|
|
20
22
|
}
|
|
21
|
-
export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, effectiveRecipientAddress, recipientName, customRecipientLabel, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
export {};
|
|
@@ -8,8 +8,9 @@ import { ChevronRight, Info } from "lucide-react";
|
|
|
8
8
|
import { motion } from "motion/react";
|
|
9
9
|
import { OrderTokenAmount } from "./OrderTokenAmount.js";
|
|
10
10
|
import { PointsBadge } from "./PointsBadge.js";
|
|
11
|
-
export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
|
|
12
|
-
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children:
|
|
11
|
+
export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, customRecipientLabel, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
|
|
12
|
+
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: customRecipientLabel ||
|
|
13
|
+
(recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || "")) }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
|
|
13
14
|
// Fixed destination token display for buy mode and deposit mode
|
|
14
15
|
_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsxs("div", { className: "relative", children: [_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" }), ALL_CHAINS[dstToken.chainId]?.logoUrl && (_jsx("img", { src: ALL_CHAINS[dstToken.chainId].logoUrl, alt: "Chain", className: "absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white" }))] })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
|
|
15
16
|
// Token selection for regular swap mode
|
|
@@ -13,6 +13,10 @@ interface OrderDetailsProps {
|
|
|
13
13
|
onBack?: () => void;
|
|
14
14
|
disableUrlParamManagement?: boolean;
|
|
15
15
|
points?: number | undefined;
|
|
16
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
17
|
+
returnToHomeUrl?: string;
|
|
18
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
19
|
+
returnHomeLabel?: string;
|
|
16
20
|
}
|
|
17
21
|
export declare const OrderDetails: import("react").NamedExoticComponent<OrderDetailsProps>;
|
|
18
22
|
export declare const OrderDetailsLoadingView: import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ALL_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useB3Config, useModalStore, useProfile, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { useRouter, useSearchParams } from "../../../../shared/react/hooks/index.js";
|
|
@@ -131,7 +131,7 @@ function roundTokenAmount(amount) {
|
|
|
131
131
|
const roundedDecimalPart = digits.join("");
|
|
132
132
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
133
133
|
}
|
|
134
|
-
export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, selectedCryptoPaymentMethod, onPaymentMethodChange, onBack, disableUrlParamManagement = false, points, }) {
|
|
134
|
+
export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, selectedCryptoPaymentMethod, onPaymentMethodChange, onBack, disableUrlParamManagement = false, points, returnToHomeUrl, returnHomeLabel, }) {
|
|
135
135
|
const router = useRouter();
|
|
136
136
|
const searchParams = useSearchParams();
|
|
137
137
|
// Get theme from B3Provider context
|
|
@@ -265,6 +265,34 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
265
265
|
cleanupUrlParams();
|
|
266
266
|
onBack?.();
|
|
267
267
|
}, [cleanupUrlParams, onBack]);
|
|
268
|
+
// Handle "Return to Home" click - redirects to custom URL if provided
|
|
269
|
+
const handleReturnToHome = useCallback(() => {
|
|
270
|
+
if (returnToHomeUrl) {
|
|
271
|
+
// Validate URL to prevent Open Redirect / XSS attacks
|
|
272
|
+
try {
|
|
273
|
+
const url = new URL(returnToHomeUrl, window.location.origin);
|
|
274
|
+
// Only allow http/https protocols
|
|
275
|
+
if (url.protocol === "http:" || url.protocol === "https:") {
|
|
276
|
+
window.location.href = url.href;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
// If URL parsing fails, check if it's a safe relative URL
|
|
282
|
+
if (returnToHomeUrl.startsWith("/") && !returnToHomeUrl.startsWith("//")) {
|
|
283
|
+
window.location.href = returnToHomeUrl;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
// Fallback to handleBack if URL is not safe
|
|
288
|
+
handleBack();
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
handleBack();
|
|
292
|
+
}
|
|
293
|
+
}, [returnToHomeUrl, handleBack]);
|
|
294
|
+
// Reusable "Return to Home" / "Close" button
|
|
295
|
+
const returnHomeOrCloseButton = (_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: returnToHomeUrl ? handleReturnToHome : mode === "page" ? handleBack : handleCloseModal, children: returnHomeLabel ? (returnHomeLabel) : mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }));
|
|
268
296
|
useEffect(() => {
|
|
269
297
|
if (txSuccess) {
|
|
270
298
|
toast.success("Transaction successful! We are processing your order.", { duration: 10000 });
|
|
@@ -338,7 +366,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
338
366
|
: `Received ${formatTokenAmount(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
|
|
339
367
|
: null, refundTxs
|
|
340
368
|
? refundTxs.map(rTx => (_jsx(TransactionDetails, { title: `Refunded ${formatTokenAmount(BigInt(rTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: rTx, isProcessing: false }, rTx.txHash)))
|
|
341
|
-
: 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) }) })),
|
|
369
|
+
: 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) }) })), returnHomeOrCloseButton] }));
|
|
342
370
|
}
|
|
343
371
|
if (executeTx) {
|
|
344
372
|
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, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen }), _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
|
|
@@ -363,7 +391,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
363
391
|
dstToken,
|
|
364
392
|
recipientName,
|
|
365
393
|
centerTruncate,
|
|
366
|
-
}), _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" &&
|
|
394
|
+
}), _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" && returnHomeOrCloseButton] }));
|
|
367
395
|
}
|
|
368
396
|
if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
|
|
369
397
|
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, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen }), _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
|
|
@@ -384,7 +412,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
384
412
|
? "Depositing Hype Duel"
|
|
385
413
|
: order.type === "custom" || order.type === "custom_exact_in"
|
|
386
414
|
? "Executing Contract"
|
|
387
|
-
: "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: null, delay: 1 }))] }) })] }) }), 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" &&
|
|
415
|
+
: "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: null, delay: 1 }))] }) })] }) }), 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" && returnHomeOrCloseButton] }));
|
|
388
416
|
}
|
|
389
417
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
390
418
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
2
|
import { GetQuoteResponse } from "../../../../anyspend/types/api_req_res";
|
|
3
3
|
import { FiatPaymentMethod } from "./FiatPaymentMethod";
|
|
4
|
-
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues, }: {
|
|
4
|
+
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues, customRecipientLabel, }: {
|
|
5
5
|
srcAmountOnRamp: string;
|
|
6
6
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
7
7
|
selectedPaymentMethod?: FiatPaymentMethod;
|
|
@@ -20,4 +20,6 @@ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selec
|
|
|
20
20
|
onShowPointsDetail?: () => void;
|
|
21
21
|
onShowFeeDetail?: () => void;
|
|
22
22
|
customUsdInputValues?: string[];
|
|
23
|
+
/** Custom label for recipient display (overrides recipientName) */
|
|
24
|
+
customRecipientLabel?: string;
|
|
23
25
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,7 @@ import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod } from "./FiatPaymentMet
|
|
|
10
10
|
import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat.js";
|
|
11
11
|
import { PointsBadge } from "./PointsBadge.js";
|
|
12
12
|
const ONE_CHAR_WIDTH = 30;
|
|
13
|
-
export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues = ["5", "10", "20", "25"], }) {
|
|
13
|
+
export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues = ["5", "10", "20", "25"], customRecipientLabel, }) {
|
|
14
14
|
// Helper function to get fees from anyspend quote
|
|
15
15
|
const getFeeFromApi = (paymentMethod) => {
|
|
16
16
|
// Try to get fee from anyspend quote first (most accurate)
|
|
@@ -87,7 +87,8 @@ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPayme
|
|
|
87
87
|
.filter(v => !isNaN(Number(v)))
|
|
88
88
|
.map(value => (_jsxs("button", { onClick: () => handleQuickAmount(value), className: `bg-as-surface-secondary border-as-border-secondary hover:border-as-border-secondary h-7 w-14 rounded-lg border text-sm font-medium transition-all duration-200 ${srcAmountOnRamp === value
|
|
89
89
|
? "border-as-border-secondary bg-as-surface-secondary"
|
|
90
|
-
: "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children:
|
|
90
|
+
: "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: customRecipientLabel ||
|
|
91
|
+
(recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress)) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex flex-wrap items-center justify-end gap-1", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Total" }), anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) })), anyspendQuote?.data?.pointsAmount && anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod.NONE).toFixed(2)] }), (() => {
|
|
91
92
|
// For fiat payments, show the fee from the payment method
|
|
92
93
|
const fiatFee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod.NONE);
|
|
93
94
|
if (fiatFee !== null && fiatFee > 0) {
|
|
@@ -22,7 +22,7 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
22
22
|
// deprecated since v0.0.87
|
|
23
23
|
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
24
24
|
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
25
|
-
// Initialize config store on mount
|
|
25
|
+
// Initialize config store on mount
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
setConfig({
|
|
28
28
|
accountOverride,
|
|
@@ -36,7 +36,19 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
36
36
|
enableTurnkey,
|
|
37
37
|
defaultPermissions,
|
|
38
38
|
});
|
|
39
|
-
}, [
|
|
39
|
+
}, [
|
|
40
|
+
accountOverride,
|
|
41
|
+
environment,
|
|
42
|
+
automaticallySetFirstEoa,
|
|
43
|
+
theme,
|
|
44
|
+
clientType,
|
|
45
|
+
partnerId,
|
|
46
|
+
stripePublishableKey,
|
|
47
|
+
createClientReferenceId,
|
|
48
|
+
enableTurnkey,
|
|
49
|
+
defaultPermissions,
|
|
50
|
+
setConfig,
|
|
51
|
+
]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
40
52
|
// Initialize Google Analytics on mount
|
|
41
53
|
useEffect(() => {
|
|
42
54
|
loadGA4Script();
|
|
@@ -4,8 +4,8 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
4
4
|
import { viemToThirdwebChain } from "../../../shared/constants/chains/b3Chain.js";
|
|
5
5
|
import { getChainById } from "../../../shared/utils/chains.js";
|
|
6
6
|
import { client } from "../../../shared/utils/thirdweb.js";
|
|
7
|
-
import { getWalletBalance } from "thirdweb/wallets";
|
|
8
7
|
import invariant from "invariant";
|
|
8
|
+
import { getWalletBalance } from "thirdweb/wallets";
|
|
9
9
|
export function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
10
10
|
// Normalize chains to array
|
|
11
11
|
const chainIds = Array.isArray(chainsIds) ? chainsIds : [chainsIds];
|
|
@@ -46,7 +46,9 @@ export function useTokenBalancesByChain({ address, chainsIds, enabled = true, })
|
|
|
46
46
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
47
47
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
48
48
|
retry: 2, // Limit retries on failure
|
|
49
|
-
|
|
49
|
+
// Enable structural sharing to prevent infinite loops
|
|
50
|
+
// This ensures we only get new references when data actually changes
|
|
51
|
+
structuralSharing: true,
|
|
50
52
|
});
|
|
51
53
|
return {
|
|
52
54
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
|
@@ -403,6 +403,12 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
403
403
|
customUsdInputValues?: string[];
|
|
404
404
|
/** prefer eoa wallet */
|
|
405
405
|
preferEoa?: boolean;
|
|
406
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
407
|
+
returnToHomeUrl?: string;
|
|
408
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
409
|
+
customRecipientLabel?: string;
|
|
410
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
411
|
+
returnHomeLabel?: string;
|
|
406
412
|
}
|
|
407
413
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
408
414
|
/** Modal type identifier */
|
|
@@ -39,4 +39,10 @@ export declare function AnySpend(props: {
|
|
|
39
39
|
hideBottomNavigation?: boolean;
|
|
40
40
|
/** When true, disables URL parameter management for swap configuration */
|
|
41
41
|
disableUrlParamManagement?: boolean;
|
|
42
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
43
|
+
returnToHomeUrl?: string;
|
|
44
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
45
|
+
customRecipientLabel?: string;
|
|
46
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
47
|
+
returnHomeLabel?: string;
|
|
42
48
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -32,6 +32,12 @@ export interface AnySpendCustomExactInProps {
|
|
|
32
32
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
33
33
|
isLoadingAnyspendPrice: boolean;
|
|
34
34
|
}) => React.JSX.Element;
|
|
35
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
36
|
+
returnToHomeUrl?: string;
|
|
37
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
38
|
+
customRecipientLabel?: string;
|
|
39
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
40
|
+
returnHomeLabel?: string;
|
|
35
41
|
}
|
|
36
42
|
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
37
43
|
export {};
|
|
@@ -83,6 +83,12 @@ export interface AnySpendDepositProps {
|
|
|
83
83
|
topChainsCount?: number;
|
|
84
84
|
/** Callback when close button is clicked */
|
|
85
85
|
onClose?: () => void;
|
|
86
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
87
|
+
returnToHomeUrl?: string;
|
|
88
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
89
|
+
customRecipientLabel?: string;
|
|
90
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
91
|
+
returnHomeLabel?: string;
|
|
86
92
|
}
|
|
87
93
|
/**
|
|
88
94
|
* A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
|
|
@@ -119,4 +125,4 @@ export interface AnySpendDepositProps {
|
|
|
119
125
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
120
126
|
* />
|
|
121
127
|
*/
|
|
122
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
128
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -22,5 +22,9 @@ export interface AnySpendDepositHypeProps {
|
|
|
22
22
|
}) => void;
|
|
23
23
|
customUsdInputValues?: string[];
|
|
24
24
|
preferEoa?: boolean;
|
|
25
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
26
|
+
returnToHomeUrl?: string;
|
|
27
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
28
|
+
customRecipientLabel?: string;
|
|
25
29
|
}
|
|
26
30
|
export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,6 +4,8 @@ interface CryptoReceiveSectionProps {
|
|
|
4
4
|
isBuyMode?: boolean;
|
|
5
5
|
effectiveRecipientAddress?: string;
|
|
6
6
|
recipientName?: string;
|
|
7
|
+
/** Custom label for recipient display (overrides recipientName) */
|
|
8
|
+
customRecipientLabel?: string;
|
|
7
9
|
onSelectRecipient: () => void;
|
|
8
10
|
dstAmount: string;
|
|
9
11
|
dstToken: components["schemas"]["Token"];
|
|
@@ -18,5 +20,5 @@ interface CryptoReceiveSectionProps {
|
|
|
18
20
|
onShowPointsDetail?: () => void;
|
|
19
21
|
onShowFeeDetail?: () => void;
|
|
20
22
|
}
|
|
21
|
-
export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, effectiveRecipientAddress, recipientName, customRecipientLabel, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
export {};
|
|
@@ -13,6 +13,10 @@ interface OrderDetailsProps {
|
|
|
13
13
|
onBack?: () => void;
|
|
14
14
|
disableUrlParamManagement?: boolean;
|
|
15
15
|
points?: number | undefined;
|
|
16
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
17
|
+
returnToHomeUrl?: string;
|
|
18
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
19
|
+
returnHomeLabel?: string;
|
|
16
20
|
}
|
|
17
21
|
export declare const OrderDetails: import("react").NamedExoticComponent<OrderDetailsProps>;
|
|
18
22
|
export declare const OrderDetailsLoadingView: import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
2
|
import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
3
3
|
import { FiatPaymentMethod } from "./FiatPaymentMethod";
|
|
4
|
-
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues, }: {
|
|
4
|
+
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues, customRecipientLabel, }: {
|
|
5
5
|
srcAmountOnRamp: string;
|
|
6
6
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
7
7
|
selectedPaymentMethod?: FiatPaymentMethod;
|
|
@@ -20,4 +20,6 @@ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selec
|
|
|
20
20
|
onShowPointsDetail?: () => void;
|
|
21
21
|
onShowFeeDetail?: () => void;
|
|
22
22
|
customUsdInputValues?: string[];
|
|
23
|
+
/** Custom label for recipient display (overrides recipientName) */
|
|
24
|
+
customRecipientLabel?: string;
|
|
23
25
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -403,6 +403,12 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
403
403
|
customUsdInputValues?: string[];
|
|
404
404
|
/** prefer eoa wallet */
|
|
405
405
|
preferEoa?: boolean;
|
|
406
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
407
|
+
returnToHomeUrl?: string;
|
|
408
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
409
|
+
customRecipientLabel?: string;
|
|
410
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
411
|
+
returnHomeLabel?: string;
|
|
406
412
|
}
|
|
407
413
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
408
414
|
/** Modal type identifier */
|
package/package.json
CHANGED
|
@@ -107,6 +107,12 @@ export function AnySpend(props: {
|
|
|
107
107
|
hideBottomNavigation?: boolean;
|
|
108
108
|
/** When true, disables URL parameter management for swap configuration */
|
|
109
109
|
disableUrlParamManagement?: boolean;
|
|
110
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
111
|
+
returnToHomeUrl?: string;
|
|
112
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
113
|
+
customRecipientLabel?: string;
|
|
114
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
115
|
+
returnHomeLabel?: string;
|
|
110
116
|
}) {
|
|
111
117
|
const fingerprintConfig = getFingerprintConfig();
|
|
112
118
|
|
|
@@ -132,6 +138,9 @@ function AnySpendInner({
|
|
|
132
138
|
hideHeader,
|
|
133
139
|
hideBottomNavigation = false,
|
|
134
140
|
disableUrlParamManagement = false,
|
|
141
|
+
returnToHomeUrl,
|
|
142
|
+
customRecipientLabel,
|
|
143
|
+
returnHomeLabel,
|
|
135
144
|
}: {
|
|
136
145
|
sourceChainId?: number;
|
|
137
146
|
destinationTokenAddress?: string;
|
|
@@ -147,6 +156,9 @@ function AnySpendInner({
|
|
|
147
156
|
hideHeader?: boolean;
|
|
148
157
|
hideBottomNavigation?: boolean;
|
|
149
158
|
disableUrlParamManagement?: boolean;
|
|
159
|
+
returnToHomeUrl?: string;
|
|
160
|
+
customRecipientLabel?: string;
|
|
161
|
+
returnHomeLabel?: string;
|
|
150
162
|
}) {
|
|
151
163
|
const searchParams = useSearchParamsSSR();
|
|
152
164
|
const router = useRouter();
|
|
@@ -1066,6 +1078,8 @@ function AnySpendInner({
|
|
|
1066
1078
|
// Reset payment methods when going back
|
|
1067
1079
|
resetPaymentMethods();
|
|
1068
1080
|
}}
|
|
1081
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
1082
|
+
returnHomeLabel={returnHomeLabel}
|
|
1069
1083
|
/>
|
|
1070
1084
|
)}
|
|
1071
1085
|
{/* {mode === "page" && <div className="h-12" />} */}
|
|
@@ -1157,6 +1171,7 @@ function AnySpendInner({
|
|
|
1157
1171
|
onShowPointsDetail={() => navigateToPanel(PanelView.POINTS_DETAIL, "forward")}
|
|
1158
1172
|
onShowFeeDetail={() => navigateToPanel(PanelView.FEE_DETAIL, "forward")}
|
|
1159
1173
|
customUsdInputValues={customUsdInputValues}
|
|
1174
|
+
customRecipientLabel={customRecipientLabel}
|
|
1160
1175
|
/>
|
|
1161
1176
|
</motion.div>
|
|
1162
1177
|
)}
|
|
@@ -1209,6 +1224,7 @@ function AnySpendInner({
|
|
|
1209
1224
|
isBuyMode={isBuyMode}
|
|
1210
1225
|
effectiveRecipientAddress={effectiveRecipientAddress}
|
|
1211
1226
|
recipientName={recipientName || undefined}
|
|
1227
|
+
customRecipientLabel={customRecipientLabel}
|
|
1212
1228
|
onSelectRecipient={() => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward")}
|
|
1213
1229
|
dstAmount={dstAmount}
|
|
1214
1230
|
dstToken={selectedDstToken}
|
|
@@ -66,6 +66,12 @@ export interface AnySpendCustomExactInProps {
|
|
|
66
66
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
67
67
|
isLoadingAnyspendPrice: boolean;
|
|
68
68
|
}) => React.JSX.Element;
|
|
69
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
70
|
+
returnToHomeUrl?: string;
|
|
71
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
72
|
+
customRecipientLabel?: string;
|
|
73
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
74
|
+
returnHomeLabel?: string;
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
export function AnySpendCustomExactIn(props: AnySpendCustomExactInProps) {
|
|
@@ -97,6 +103,9 @@ function AnySpendCustomExactInInner({
|
|
|
97
103
|
orderType = "custom_exact_in",
|
|
98
104
|
minDestinationAmount,
|
|
99
105
|
header,
|
|
106
|
+
returnToHomeUrl,
|
|
107
|
+
customRecipientLabel,
|
|
108
|
+
returnHomeLabel,
|
|
100
109
|
}: AnySpendCustomExactInProps) {
|
|
101
110
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
102
111
|
|
|
@@ -358,6 +367,7 @@ function AnySpendCustomExactInInner({
|
|
|
358
367
|
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
359
368
|
onShowFeeDetail={() => setActivePanel(PanelView.FEE_DETAIL)}
|
|
360
369
|
customUsdInputValues={customUsdInputValues}
|
|
370
|
+
customRecipientLabel={customRecipientLabel}
|
|
361
371
|
/>
|
|
362
372
|
</motion.div>
|
|
363
373
|
)}
|
|
@@ -383,6 +393,7 @@ function AnySpendCustomExactInInner({
|
|
|
383
393
|
isBuyMode={true}
|
|
384
394
|
effectiveRecipientAddress={selectedRecipientOrDefault}
|
|
385
395
|
recipientName={recipientName || undefined}
|
|
396
|
+
customRecipientLabel={customRecipientLabel}
|
|
386
397
|
onSelectRecipient={() => setActivePanel(PanelView.RECIPIENT_SELECTION)}
|
|
387
398
|
dstAmount={dstAmount}
|
|
388
399
|
dstToken={selectedDstToken}
|
|
@@ -532,6 +543,8 @@ function AnySpendCustomExactInInner({
|
|
|
532
543
|
}}
|
|
533
544
|
disableUrlParamManagement
|
|
534
545
|
points={oat.data.points || undefined}
|
|
546
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
547
|
+
returnHomeLabel={returnHomeLabel}
|
|
535
548
|
/>
|
|
536
549
|
)}
|
|
537
550
|
</div>
|
|
@@ -106,6 +106,12 @@ export interface AnySpendDepositProps {
|
|
|
106
106
|
topChainsCount?: number;
|
|
107
107
|
/** Callback when close button is clicked */
|
|
108
108
|
onClose?: () => void;
|
|
109
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
110
|
+
returnToHomeUrl?: string;
|
|
111
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
112
|
+
customRecipientLabel?: string;
|
|
113
|
+
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
114
|
+
returnHomeLabel?: string;
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
// Default supported chains
|
|
@@ -224,6 +230,9 @@ export function AnySpendDeposit({
|
|
|
224
230
|
minPoolSize = DEFAULT_MIN_POOL_SIZE,
|
|
225
231
|
topChainsCount = 3,
|
|
226
232
|
onClose,
|
|
233
|
+
returnToHomeUrl,
|
|
234
|
+
customRecipientLabel,
|
|
235
|
+
returnHomeLabel,
|
|
227
236
|
}: AnySpendDepositProps) {
|
|
228
237
|
const { connectedEOAWallet } = useAccountWallet();
|
|
229
238
|
const eoaAddress = connectedEOAWallet?.getAccount()?.address;
|
|
@@ -539,6 +548,9 @@ export function AnySpendDeposit({
|
|
|
539
548
|
hideHeader
|
|
540
549
|
hideBottomNavigation
|
|
541
550
|
disableUrlParamManagement
|
|
551
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
552
|
+
customRecipientLabel={customRecipientLabel}
|
|
553
|
+
returnHomeLabel={returnHomeLabel}
|
|
542
554
|
/>
|
|
543
555
|
) : (
|
|
544
556
|
<AnySpendCustomExactIn
|
|
@@ -561,6 +573,9 @@ export function AnySpendDeposit({
|
|
|
561
573
|
customUsdInputValues={customUsdInputValues}
|
|
562
574
|
preferEoa={preferEoa}
|
|
563
575
|
customExactInConfig={depositContractConfig}
|
|
576
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
577
|
+
customRecipientLabel={customRecipientLabel}
|
|
578
|
+
returnHomeLabel={returnHomeLabel}
|
|
564
579
|
/>
|
|
565
580
|
)}
|
|
566
581
|
</div>
|
|
@@ -25,6 +25,10 @@ export interface AnySpendDepositHypeProps {
|
|
|
25
25
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
26
26
|
customUsdInputValues?: string[];
|
|
27
27
|
preferEoa?: boolean;
|
|
28
|
+
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
29
|
+
returnToHomeUrl?: string;
|
|
30
|
+
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
31
|
+
customRecipientLabel?: string;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
export function AnySpendDepositHype({
|