@b3dotfun/sdk 0.0.87-alpha.0 → 0.0.87-alpha.2
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 +5 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +77 -73
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
- package/dist/cjs/anyspend/utils/format.js +28 -5
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +77 -73
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
- package/dist/esm/anyspend/react/components/index.d.ts +2 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
- package/dist/esm/anyspend/utils/format.js +28 -5
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/index.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +105 -85
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
- package/src/anyspend/react/components/AnySpendDeposit.tsx +578 -0
- package/src/anyspend/react/components/QRDeposit.tsx +348 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/common/WarningText.tsx +52 -0
- package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/credit-card.svg +5 -0
- package/src/anyspend/react/components/icons/qr-code.svg +5 -0
- package/src/anyspend/react/components/index.ts +2 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
- package/src/anyspend/utils/format.ts +33 -5
- package/src/global-account/react/stores/useModalStore.ts +4 -0
- package/src/styles/index.css +2 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { DepositContractConfig } from "./AnySpendDeposit";
|
|
3
|
+
export interface QRDepositProps {
|
|
4
|
+
/** Display mode */
|
|
5
|
+
mode?: "modal" | "page";
|
|
6
|
+
/** The recipient address (user's wallet) */
|
|
7
|
+
recipientAddress: string;
|
|
8
|
+
/** The source token to deposit (defaults to ETH on Base) */
|
|
9
|
+
sourceToken?: components["schemas"]["Token"];
|
|
10
|
+
/** The source chain ID (defaults to Base) */
|
|
11
|
+
sourceChainId?: number;
|
|
12
|
+
/** The destination token to receive */
|
|
13
|
+
destinationToken: components["schemas"]["Token"];
|
|
14
|
+
/** The destination chain ID */
|
|
15
|
+
destinationChainId: number;
|
|
16
|
+
/** Creator address (optional) */
|
|
17
|
+
creatorAddress?: string;
|
|
18
|
+
/** Contract config for custom execution after deposit */
|
|
19
|
+
depositContractConfig?: DepositContractConfig;
|
|
20
|
+
/** Callback when back button is clicked */
|
|
21
|
+
onBack?: () => void;
|
|
22
|
+
/** Callback when close button is clicked */
|
|
23
|
+
onClose?: () => void;
|
|
24
|
+
/** Callback when order is created successfully */
|
|
25
|
+
onOrderCreated?: (orderId: string) => void;
|
|
26
|
+
/** Callback when deposit is completed */
|
|
27
|
+
onSuccess?: (txHash?: string) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A component for displaying QR code deposit functionality.
|
|
31
|
+
* Creates a deposit_first order on mount and shows a QR code that can be scanned to deposit tokens.
|
|
32
|
+
* Users can change the source token/chain using the TokenSelector.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <QRDeposit
|
|
36
|
+
* recipientAddress={userAddress}
|
|
37
|
+
* destinationToken={usdcArbitrumToken}
|
|
38
|
+
* destinationChainId={42161}
|
|
39
|
+
* onBack={() => setStep("select-chain")}
|
|
40
|
+
* onSuccess={(txHash) => console.log("Deposit complete:", txHash)}
|
|
41
|
+
* />
|
|
42
|
+
*/
|
|
43
|
+
export declare function QRDeposit({ mode, recipientAddress, sourceToken: sourceTokenProp, sourceChainId: sourceChainIdProp, destinationToken, destinationChainId, creatorAddress, depositContractConfig, onBack, onClose, onOrderCreated, onSuccess, }: QRDepositProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ALL_CHAINS, getAvailableChainIds } from "../../../anyspend/index.js";
|
|
3
|
+
import { Button, toast } from "../../../global-account/react/index.js";
|
|
4
|
+
import { cn } from "../../../shared/utils/cn.js";
|
|
5
|
+
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
6
|
+
import { Check, ChevronsUpDown, Copy, Loader2 } from "lucide-react";
|
|
7
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
8
|
+
import { useEffect, useRef, useState } from "react";
|
|
9
|
+
import { useAnyspendOrderAndTransactions } from "../hooks/useAnyspendOrderAndTransactions.js";
|
|
10
|
+
import { useCreateDepositFirstOrder } from "../hooks/useCreateDepositFirstOrder.js";
|
|
11
|
+
import { ChainTokenIcon } from "./common/ChainTokenIcon.js";
|
|
12
|
+
import { OrderDetails } from "./common/OrderDetails.js";
|
|
13
|
+
import { ChainWarningText, WarningText } from "./common/WarningText.js";
|
|
14
|
+
// Default source token: ETH on Base
|
|
15
|
+
const DEFAULT_ETH_ON_BASE = {
|
|
16
|
+
chainId: 8453,
|
|
17
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
18
|
+
symbol: "ETH",
|
|
19
|
+
name: "Ethereum",
|
|
20
|
+
decimals: 18,
|
|
21
|
+
metadata: {
|
|
22
|
+
logoURI: "https://assets.relay.link/icons/1/light.png",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A component for displaying QR code deposit functionality.
|
|
27
|
+
* Creates a deposit_first order on mount and shows a QR code that can be scanned to deposit tokens.
|
|
28
|
+
* Users can change the source token/chain using the TokenSelector.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <QRDeposit
|
|
32
|
+
* recipientAddress={userAddress}
|
|
33
|
+
* destinationToken={usdcArbitrumToken}
|
|
34
|
+
* destinationChainId={42161}
|
|
35
|
+
* onBack={() => setStep("select-chain")}
|
|
36
|
+
* onSuccess={(txHash) => console.log("Deposit complete:", txHash)}
|
|
37
|
+
* />
|
|
38
|
+
*/
|
|
39
|
+
export function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenProp, sourceChainId: sourceChainIdProp, destinationToken, destinationChainId, creatorAddress, depositContractConfig, onBack, onClose, onOrderCreated, onSuccess, }) {
|
|
40
|
+
const [copied, setCopied] = useState(false);
|
|
41
|
+
const [orderId, setOrderId] = useState();
|
|
42
|
+
const [globalAddress, setGlobalAddress] = useState();
|
|
43
|
+
const orderCreatedRef = useRef(false);
|
|
44
|
+
const onSuccessCalled = useRef(false);
|
|
45
|
+
// Source token/chain as state (can be changed by user)
|
|
46
|
+
const [sourceChainId, setSourceChainId] = useState(sourceChainIdProp ?? 8453);
|
|
47
|
+
const [sourceToken, setSourceToken] = useState(sourceTokenProp ?? DEFAULT_ETH_ON_BASE);
|
|
48
|
+
// Handle token selection from TokenSelector
|
|
49
|
+
const handleTokenSelect = (newToken) => {
|
|
50
|
+
const token = {
|
|
51
|
+
address: newToken.address,
|
|
52
|
+
chainId: newToken.chainId,
|
|
53
|
+
decimals: newToken.decimals,
|
|
54
|
+
metadata: { logoURI: newToken.logoURI },
|
|
55
|
+
name: newToken.name,
|
|
56
|
+
symbol: newToken.symbol,
|
|
57
|
+
};
|
|
58
|
+
// Reset order state when token changes
|
|
59
|
+
setOrderId(undefined);
|
|
60
|
+
setGlobalAddress(undefined);
|
|
61
|
+
orderCreatedRef.current = false;
|
|
62
|
+
// Update token and chain
|
|
63
|
+
setSourceChainId(newToken.chainId);
|
|
64
|
+
setSourceToken(token);
|
|
65
|
+
};
|
|
66
|
+
// Create order hook
|
|
67
|
+
const { createOrder, isCreatingOrder } = useCreateDepositFirstOrder({
|
|
68
|
+
onSuccess: data => {
|
|
69
|
+
const newOrderId = data.data.id;
|
|
70
|
+
const newGlobalAddress = data.data.globalAddress;
|
|
71
|
+
setOrderId(newOrderId);
|
|
72
|
+
setGlobalAddress(newGlobalAddress);
|
|
73
|
+
onOrderCreated?.(newOrderId);
|
|
74
|
+
},
|
|
75
|
+
onError: error => {
|
|
76
|
+
console.error("Failed to create deposit order:", error);
|
|
77
|
+
toast.error("Failed to create deposit order: " + error.message);
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
// Fetch order status
|
|
81
|
+
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
|
|
82
|
+
// Create order on mount
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (orderCreatedRef.current)
|
|
85
|
+
return;
|
|
86
|
+
orderCreatedRef.current = true;
|
|
87
|
+
createOrder({
|
|
88
|
+
recipientAddress,
|
|
89
|
+
srcChain: sourceChainId,
|
|
90
|
+
dstChain: destinationChainId,
|
|
91
|
+
srcToken: sourceToken,
|
|
92
|
+
dstToken: destinationToken,
|
|
93
|
+
creatorAddress,
|
|
94
|
+
contractConfig: depositContractConfig,
|
|
95
|
+
});
|
|
96
|
+
}, [
|
|
97
|
+
recipientAddress,
|
|
98
|
+
sourceChainId,
|
|
99
|
+
destinationChainId,
|
|
100
|
+
sourceToken,
|
|
101
|
+
destinationToken,
|
|
102
|
+
creatorAddress,
|
|
103
|
+
depositContractConfig,
|
|
104
|
+
createOrder,
|
|
105
|
+
]);
|
|
106
|
+
// Call onSuccess when order is executed
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
|
|
109
|
+
const txHash = oat?.data?.executeTx?.txHash;
|
|
110
|
+
onSuccess?.(txHash);
|
|
111
|
+
onSuccessCalled.current = true;
|
|
112
|
+
}
|
|
113
|
+
}, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
|
|
114
|
+
// Reset onSuccess flag when orderId changes
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
onSuccessCalled.current = false;
|
|
117
|
+
}, [orderId]);
|
|
118
|
+
const displayAddress = globalAddress || recipientAddress;
|
|
119
|
+
const handleCopyAddress = async () => {
|
|
120
|
+
if (displayAddress) {
|
|
121
|
+
await navigator.clipboard.writeText(displayAddress);
|
|
122
|
+
setCopied(true);
|
|
123
|
+
setTimeout(() => setCopied(false), 2000);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const handleBack = () => {
|
|
127
|
+
setCopied(false);
|
|
128
|
+
onBack?.();
|
|
129
|
+
};
|
|
130
|
+
const handleClose = () => {
|
|
131
|
+
setCopied(false);
|
|
132
|
+
onClose?.();
|
|
133
|
+
};
|
|
134
|
+
// Show order details if order has deposits or is being processed
|
|
135
|
+
if (oat?.data && oat.data.depositTxs && oat.data.depositTxs.length > 0) {
|
|
136
|
+
return (_jsx("div", { className: cn("anyspend-container anyspend-qr-order-details font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx("div", { className: "anyspend-qr-order-details-content relative flex flex-col gap-4", children: _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: handleBack }) }) }));
|
|
137
|
+
}
|
|
138
|
+
// Show loading state while creating order (but not if we already have an orderId)
|
|
139
|
+
if (isCreatingOrder && !orderId) {
|
|
140
|
+
return (_jsx("div", { className: cn("anyspend-container anyspend-qr-loading font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsxs("div", { className: "anyspend-qr-loading-content flex flex-col items-center justify-center gap-4 py-12", children: [_jsx(Loader2, { className: "anyspend-qr-loading-spinner text-as-brand h-8 w-8 animate-spin" }), _jsx("p", { className: "anyspend-qr-loading-text text-as-secondary text-sm", children: "Creating deposit order..." })] }) }));
|
|
141
|
+
}
|
|
142
|
+
return (_jsx("div", { className: cn("anyspend-container anyspend-qr-deposit font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsxs("div", { className: "anyspend-qr-deposit-content flex flex-col gap-4", children: [_jsxs("div", { className: "anyspend-qr-header flex items-center justify-between", children: [_jsx("button", { onClick: handleBack, className: "anyspend-qr-back-button text-as-secondary hover:text-as-primary", children: _jsx("svg", { className: "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("h2", { className: "anyspend-qr-title text-as-primary text-base font-semibold", children: "Deposit" }), onClose ? (_jsx("button", { onClick: handleClose, className: "anyspend-qr-close-button text-as-secondary hover:text-as-primary", children: _jsx("svg", { className: "h-5 w-5", 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: "w-5" }))] }), _jsxs("div", { className: "anyspend-qr-token-selector flex flex-col gap-1.5", children: [_jsx("label", { className: "anyspend-qr-token-label text-as-secondary text-sm", children: "Send" }), _jsx(TokenSelector, { chainIdsFilter: getAvailableChainIds("from"), context: "from", fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds("from"), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, setToken: handleTokenSelect, supportedWalletVMs: ["evm"], token: undefined, trigger: _jsxs(Button, { variant: "outline", role: "combobox", className: "anyspend-qr-token-trigger border-as-stroke bg-as-surface-secondary flex h-auto w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [sourceToken.metadata?.logoURI ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[sourceChainId]?.logoUrl, tokenUrl: sourceToken.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : (_jsx("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), _jsxs("div", { className: "flex flex-col items-start gap-0", children: [_jsx("div", { className: "text-as-primary font-semibold", children: sourceToken.symbol }), _jsx("div", { className: "text-as-primary/70 text-xs", children: ALL_CHAINS[sourceChainId]?.name ?? "Unknown" })] })] }), _jsx(ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) })] }), _jsxs("div", { className: "anyspend-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4", children: [_jsxs("div", { className: "anyspend-qr-code-container flex flex-col items-center gap-2", children: [_jsx("div", { className: "anyspend-qr-code rounded-lg bg-white p-2", children: _jsx(QRCodeSVG, { value: displayAddress, size: 120, level: "M", marginSize: 0 }) }), _jsxs("span", { className: "anyspend-qr-scan-hint text-as-secondary text-xs", children: ["SCAN WITH ", _jsx("span", { className: "inline-block", children: "\uD83E\uDD8A" })] })] }), _jsxs("div", { className: "anyspend-qr-address-container flex flex-1 flex-col gap-1", children: [_jsx("span", { className: "anyspend-qr-address-label text-as-secondary text-sm", children: "Deposit address:" }), _jsxs("div", { className: "anyspend-qr-address-row flex items-start gap-1", children: [_jsx("span", { className: "anyspend-qr-address text-as-primary break-all font-mono text-sm leading-relaxed", children: displayAddress }), _jsx("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0", children: copied ? _jsx(Check, { className: "h-4 w-4" }) : _jsx(Copy, { className: "h-4 w-4" }) })] })] })] }), _jsx(ChainWarningText, { chainId: destinationChainId }), _jsxs(WarningText, { children: ["Only send ", sourceToken.symbol, " on ", ALL_CHAINS[sourceChainId]?.name ?? "the specified chain", ". Other tokens will not be converted."] }), _jsx("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-button flex w-full items-center justify-center gap-2 rounded-xl bg-blue-500 py-3.5 font-medium text-white transition-all hover:bg-blue-600", children: "Copy deposit address" })] }) }));
|
|
143
|
+
}
|
|
@@ -31,6 +31,7 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, form
|
|
|
31
31
|
let actionText = "";
|
|
32
32
|
switch (order.type) {
|
|
33
33
|
case "swap":
|
|
34
|
+
case "deposit_first":
|
|
34
35
|
actionText = `sent ${formattedActualDstAmount || "--"} ${dstToken.symbol}`;
|
|
35
36
|
return `Successfully ${actionText} to ${recipient}`;
|
|
36
37
|
case "mint_nft":
|
|
@@ -152,6 +153,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
152
153
|
const { data: walletClient } = useWalletClient();
|
|
153
154
|
const [txHash, setTxHash] = useState();
|
|
154
155
|
const [showQRCode, setShowQRCode] = useState(false);
|
|
156
|
+
const [orderDetailsOpen, setOrderDetailsOpen] = useState(true);
|
|
155
157
|
const { isLoading: txLoading, isSuccess: txSuccess } = useWaitForTransactionReceipt({ hash: txHash });
|
|
156
158
|
const { switchChainAndExecuteWithEOA, switchChainAndExecute, isSwitchingOrExecuting } = useUnifiedChainSwitchAndExecute();
|
|
157
159
|
// Track if auto-payment was attempted to avoid re-triggering
|
|
@@ -320,7 +322,8 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
320
322
|
const expectedDstAmount = order.type === "mint_nft" ||
|
|
321
323
|
order.type === "join_tournament" ||
|
|
322
324
|
order.type === "fund_tournament" ||
|
|
323
|
-
order.type === "custom"
|
|
325
|
+
order.type === "custom" ||
|
|
326
|
+
order.type === "deposit_first"
|
|
324
327
|
? "0"
|
|
325
328
|
: order.payload.expectedDstAmount.toString();
|
|
326
329
|
const formattedExpectedDstAmount = formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
|
|
@@ -329,7 +332,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
329
332
|
? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals)
|
|
330
333
|
: undefined;
|
|
331
334
|
if (refundTxs.length > 0) {
|
|
332
|
-
return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
335
|
+
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: "refund-details", className: "order-details-refund-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
333
336
|
? depositTxs.map(dTx => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
334
337
|
? `Received payment`
|
|
335
338
|
: `Received ${formatTokenAmount(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
|
|
@@ -338,13 +341,13 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
338
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) }) })), _jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
|
|
339
342
|
}
|
|
340
343
|
if (executeTx) {
|
|
341
|
-
return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
344
|
+
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
|
|
342
345
|
? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
343
346
|
? `Received payment`
|
|
344
347
|
: `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
345
348
|
: null, relayTxs
|
|
346
|
-
? relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed
|
|
347
|
-
: null, _jsx(TransactionDetails, { title: order.type === "swap"
|
|
349
|
+
? relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed Swap", chainId: relayTx.chain, tx: relayTx, delay: 0.5, isProcessing: false }, relayTx.txHash)))
|
|
350
|
+
: null, _jsx(TransactionDetails, { title: order.type === "swap" || order.type === "deposit_first"
|
|
348
351
|
? "Processed Swap"
|
|
349
352
|
: order.type === "mint_nft"
|
|
350
353
|
? "Minted NFT"
|
|
@@ -363,12 +366,14 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
363
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" && (_jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
|
|
364
367
|
}
|
|
365
368
|
if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
|
|
366
|
-
return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "more-details", className: "order-details-more-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
369
|
+
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
|
|
367
370
|
? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
368
371
|
? `Received payment`
|
|
369
372
|
: `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
370
|
-
: null, relayTxs.map(relayTx => (_jsx(TransactionDetails, { title:
|
|
371
|
-
?
|
|
373
|
+
: null, relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: relayTx.chain === order.srcChain
|
|
374
|
+
? `Process swap on ${getChainName(relayTx.chain)}`
|
|
375
|
+
: `Received on ${getChainName(relayTx.chain)}`, chainId: relayTx.chain, isProcessing: false, tx: relayTx, delay: 0.5 }, relayTx.txHash))), order.status === "executing" && (_jsx(TransactionDetails, { title: order.type === "swap" || order.type === "x402_swap" || order.type === "deposit_first"
|
|
376
|
+
? "Processing swap"
|
|
372
377
|
: order.type === "mint_nft"
|
|
373
378
|
? "Minting NFT"
|
|
374
379
|
: order.type === "join_tournament"
|
|
@@ -384,10 +389,10 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
384
389
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
385
390
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
386
391
|
if (depositTxs?.length || waitingForDeposit) {
|
|
387
|
-
return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-6", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
392
|
+
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: "deposit-details", className: "order-details-deposit-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-6", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
388
393
|
? `Received payment`
|
|
389
|
-
: `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? (_jsx(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? (_jsx(TransactionDetails, { title: order.type === "swap"
|
|
390
|
-
? "Processing
|
|
394
|
+
: `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? (_jsx(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? (_jsx(TransactionDetails, { title: order.type === "swap" || order.type === "deposit_first"
|
|
395
|
+
? "Processing swap"
|
|
391
396
|
: order.type === "mint_nft"
|
|
392
397
|
? "Minting NFT"
|
|
393
398
|
: order.type === "join_tournament"
|
|
@@ -411,7 +416,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
411
416
|
? centerTruncate(phantomWalletAddress, 6)
|
|
412
417
|
: centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
413
418
|
// Default case - existing QR code flow
|
|
414
|
-
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), _jsxs("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
419
|
+
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points, isOpen: orderDetailsOpen, onOpenChange: setOrderDetailsOpen })), _jsxs("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
415
420
|
});
|
|
416
421
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
417
422
|
return (_jsxs("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [_jsxs("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [_jsx(motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: _jsx(Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: _jsx(CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), _jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? (_jsx(TextShimmer, { duration: 1, children: title })) : (_jsx("span", { className: "text-as-primary", children: title })) })] }), _jsx("div", { className: "flex flex-col gap-1", children: tx ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: _jsx("a", { href: getExplorerTxUrl(chainId, tx.txHash), target: "_blank", children: _jsx("div", { className: "text-as-primary/30 font-mono text-xs", children: centerTruncate(tx?.txHash, 6) }) }) })) : null })] }));
|
|
@@ -14,6 +14,8 @@ interface OrderDetailsCollapsibleProps {
|
|
|
14
14
|
showTotal?: boolean;
|
|
15
15
|
totalAmount?: string;
|
|
16
16
|
points?: number;
|
|
17
|
+
isOpen?: boolean;
|
|
18
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
17
19
|
}
|
|
18
20
|
export declare const OrderDetailsCollapsible: import("react").NamedExoticComponent<OrderDetailsCollapsibleProps>;
|
|
19
21
|
export {};
|
|
@@ -10,19 +10,26 @@ import { ChevronDown, Copy } from "lucide-react";
|
|
|
10
10
|
import { motion } from "motion/react";
|
|
11
11
|
import { memo, useState } from "react";
|
|
12
12
|
import { b3 } from "viem/chains";
|
|
13
|
-
export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, points, }) {
|
|
14
|
-
const [
|
|
13
|
+
export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, points, isOpen, onOpenChange, }) {
|
|
14
|
+
const [internalOpen, setInternalOpen] = useState(true);
|
|
15
|
+
// Use controlled mode if isOpen is provided, otherwise use internal state
|
|
16
|
+
const showOrderDetails = isOpen !== undefined ? isOpen : internalOpen;
|
|
17
|
+
const setShowOrderDetails = onOpenChange || setInternalOpen;
|
|
15
18
|
// Calculate expected amount if not provided
|
|
16
19
|
const expectedDstAmount = order.type === "mint_nft" ||
|
|
17
20
|
order.type === "join_tournament" ||
|
|
18
21
|
order.type === "fund_tournament" ||
|
|
19
|
-
order.type === "custom"
|
|
22
|
+
order.type === "custom" ||
|
|
23
|
+
order.type === "deposit_first"
|
|
20
24
|
? "0"
|
|
21
25
|
: order.payload.expectedDstAmount.toString();
|
|
22
26
|
const finalFormattedExpectedDstAmount = formattedExpectedDstAmount || formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
|
|
23
27
|
return (_jsx("div", { className: cn("order-details-collapsible bg-as-surface-secondary border-as-border-secondary rounded-xl border px-4 py-2", className), children: showOrderDetails ? (_jsx(motion.div, { className: "order-details-expanded w-full", 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: _jsxs("div", { className: "order-details-content flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm", children: [_jsxs("div", { className: "order-details-recipient-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-recipient-label text-as-tertiarry", children: "Recipient" }), _jsxs("div", { className: "order-details-recipient-info flex flex-col items-end gap-1", children: [recipientName && (_jsx("div", { className: "order-details-recipient-name text-as-primary font-semibold", children: recipientName })), _jsx(CopyToClipboard, { text: order.recipientAddress, onCopy: () => {
|
|
24
28
|
toast.success("Copied recipient address to clipboard");
|
|
25
|
-
}, children: _jsxs("div", { className: "order-details-recipient-address text-as-primary flex items-center gap-2", children: [centerTruncate(order.recipientAddress, 10), _jsx(Copy, { className: "order-details-recipient-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" })] }) })] })] }), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-expected-section flex w-full items-
|
|
29
|
+
}, children: _jsxs("div", { className: "order-details-recipient-address text-as-primary flex items-center gap-2", children: [centerTruncate(order.recipientAddress, 10), _jsx(Copy, { className: "order-details-recipient-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" })] }) })] })] }), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-expected-section flex w-full items-start justify-between gap-2", children: [_jsx("div", { className: "order-details-expected-label text-as-tertiarry shrink-0", children: order.type === "swap" ||
|
|
30
|
+
order.type === "deposit_first" ||
|
|
31
|
+
order.type === "mint_nft" ||
|
|
32
|
+
order.type === "hype_duel"
|
|
26
33
|
? "Expected to receive"
|
|
27
34
|
: order.type === "join_tournament"
|
|
28
35
|
? "Join tournament"
|
|
@@ -32,5 +39,5 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({ o
|
|
|
32
39
|
? order.metadata.action
|
|
33
40
|
? capitalizeFirstLetter(order.metadata.action)
|
|
34
41
|
: "Contract execution"
|
|
35
|
-
: "" }), _jsxs("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? (_jsxs("div", { className: "order-details-nft-info flex items-center gap-2", children: [_jsx("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), _jsx("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? (_jsxs("div", { className: "order-details-tournament-info flex items-center gap-2", children: [_jsx("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), _jsx("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? (_jsx("div", { className: "order-details-hype-info flex items-center gap-2", children: _jsxs("div", { className: "order-details-hype-amount", children: [formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, _jsxs("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [_jsxs("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== b3.id && getChainName(order.dstChain)] }), _jsx("img", { src: ALL_CHAINS[order.dstChain].logoUrl, alt: getChainName(order.dstChain), className: cn("order-details-chain-logo h-3", order.dstChain !== b3.id && "w-3 rounded-full", order.dstChain === b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && (_jsxs(_Fragment, { children: [_jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), _jsxs("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", formatNumber(points), " pts"] })] })] })), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), _jsx("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : (_jsxs("div", { className: "order-details-collapsed flex w-full items-center", children: [_jsx("div", { className: "order-details-collapsed-divider divider w-full" }), _jsx("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), _jsx(ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), _jsx("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
42
|
+
: "" }), _jsxs("div", { className: "order-details-expected-value flex flex-wrap items-center justify-end gap-2", children: [order.type === "swap" || order.type === "deposit_first" ? (_jsx("span", { className: "order-details-amount-text", children: `~${finalFormattedExpectedDstAmount} ${dstToken.symbol}` })) : order.type === "mint_nft" ? (_jsxs("div", { className: "order-details-nft-info flex items-center gap-2", children: [_jsx("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), _jsx("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? (_jsxs("div", { className: "order-details-tournament-info flex items-center gap-2", children: [_jsx("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), _jsx("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? (_jsx("div", { className: "order-details-hype-info flex items-center gap-2", children: _jsxs("div", { className: "order-details-hype-amount", children: [formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, _jsxs("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [_jsxs("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== b3.id && getChainName(order.dstChain)] }), _jsx("img", { src: ALL_CHAINS[order.dstChain].logoUrl, alt: getChainName(order.dstChain), className: cn("order-details-chain-logo h-3", order.dstChain !== b3.id && "w-3 rounded-full", order.dstChain === b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && (_jsxs(_Fragment, { children: [_jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), _jsxs("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", formatNumber(points), " pts"] })] })] })), _jsx("div", { className: "order-details-divider divider w-full" }), _jsxs("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [_jsx("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), _jsx("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : (_jsxs("div", { className: "order-details-collapsed flex w-full items-center", children: [_jsx("div", { className: "order-details-collapsed-divider divider w-full" }), _jsx("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), _jsx(ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), _jsx("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
36
43
|
});
|
|
@@ -5,7 +5,7 @@ import { Check, X } from "lucide-react";
|
|
|
5
5
|
import { memo } from "react";
|
|
6
6
|
import { StepProgress } from "./StepProgress.js";
|
|
7
7
|
export const OrderStatus = memo(function OrderStatus({ order, selectedCryptoPaymentMethod, }) {
|
|
8
|
-
const
|
|
8
|
+
const showCheck = order.status === "executed" || order.status === "quoting_after_deposit";
|
|
9
9
|
const { text, status: displayStatus, description } = getStatusDisplay(order);
|
|
10
10
|
const searchParams = useSearchParams();
|
|
11
11
|
const cryptoPaymentMethod = selectedCryptoPaymentMethod || searchParams.get("cryptoPaymentMethod");
|
|
@@ -35,5 +35,5 @@ export const OrderStatus = memo(function OrderStatus({ order, selectedCryptoPaym
|
|
|
35
35
|
if (selectedCryptoPaymentMethod === "transfer_crypto" && order.status === "scanning_deposit_transaction") {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
return (_jsx("div", { className: "flex items-center justify-center gap-2", children:
|
|
38
|
+
return (_jsx("div", { className: "flex items-center justify-center gap-2", children: showCheck ? (_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: `bg-as-success-secondary relative flex h-10 w-10 items-center justify-center rounded-full`, children: _jsx(Check, { className: "text-as-content-icon-success h-6 w-6" }) }), _jsx("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: text }), _jsx("div", { className: "text-as-tertiarry mt-1 text-center", children: description })] })) : (_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "bg-as-error-secondary flex h-10 w-10 items-center justify-center rounded-full text-base", children: _jsx(X, { className: "text-as-content-icon-error h-5 w-5" }) }), _jsx("div", { className: "font-sf-rounded text-as-content-primary mt-4 text-lg font-semibold", children: text }), _jsx("div", { className: "text-as-tertiarry text-center", style: { whiteSpace: "normal" }, children: description })] })) }));
|
|
39
39
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface WarningTextProps {
|
|
2
|
+
/** The warning message content */
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** Additional CSS classes */
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A generic warning text component with consistent styling.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <WarningText>
|
|
12
|
+
* Custom warning message
|
|
13
|
+
* </WarningText>
|
|
14
|
+
*/
|
|
15
|
+
export declare function WarningText({ children, className }: WarningTextProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ChainWarningTextProps {
|
|
17
|
+
/** The chain ID to display warning for */
|
|
18
|
+
chainId: number;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A chain-aware warning text component that displays chain-specific warnings.
|
|
24
|
+
* Returns null if there's no warning for the given chain.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* <ChainWarningText chainId={destinationChainId} className="mt-4" />
|
|
31
|
+
*/
|
|
32
|
+
export declare function ChainWarningText({ chainId, className }: ChainWarningTextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HYPERLIQUID_CHAIN_ID } from "../../../../anyspend/index.js";
|
|
3
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
|
+
/**
|
|
5
|
+
* A generic warning text component with consistent styling.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <WarningText>
|
|
9
|
+
* Custom warning message
|
|
10
|
+
* </WarningText>
|
|
11
|
+
*/
|
|
12
|
+
export function WarningText({ children, className }) {
|
|
13
|
+
return _jsx("p", { className: cn("anyspend-warning text-center text-xs italic text-red-500", className), children: children });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A chain-aware warning text component that displays chain-specific warnings.
|
|
17
|
+
* Returns null if there's no warning for the given chain.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <ChainWarningText chainId={destinationChainId} className="mt-4" />
|
|
24
|
+
*/
|
|
25
|
+
export function ChainWarningText({ chainId, className }) {
|
|
26
|
+
// Chain-specific warning messages
|
|
27
|
+
if (chainId === HYPERLIQUID_CHAIN_ID) {
|
|
28
|
+
return (_jsxs(WarningText, { className: className, children: ["Minimum deposit amount: ", _jsx("b", { children: "$1" })] }));
|
|
29
|
+
}
|
|
30
|
+
// No warning for this chain
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const CreditCardIcon = ({ className }) => (_jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), _jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), _jsx("path", { d: "M30 18H10M19 22H14M10 16.2L10 23.8C10 24.9201 10 25.4802 10.218 25.908C10.4097 26.2843 10.7157 26.5903 11.092 26.782C11.5198 27 12.0799 27 13.2 27L26.8 27C27.9201 27 28.4802 27 28.908 26.782C29.2843 26.5903 29.5903 26.2843 29.782 25.908C30 25.4802 30 24.9201 30 23.8V16.2C30 15.0799 30 14.5198 29.782 14.092C29.5903 13.7157 29.2843 13.4097 28.908 13.218C28.4802 13 27.9201 13 26.8 13L13.2 13C12.0799 13 11.5198 13 11.092 13.218C10.7157 13.4097 10.4097 13.7157 10.218 14.092C10 14.5198 10 15.0799 10 16.2Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const QrCodeIcon = ({ className }) => (_jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), _jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), _jsx("path", { d: "M15 20H20V25M11.01 20H11M16.01 25H16M20.01 29H20M29.01 20H29M11 25H12.5M23.5 20H25.5M11 29H16M20 10V16M25.6 29H27.4C27.9601 29 28.2401 29 28.454 28.891C28.6422 28.7951 28.7951 28.6422 28.891 28.454C29 28.2401 29 27.9601 29 27.4V25.6C29 25.0399 29 24.7599 28.891 24.546C28.7951 24.3578 28.6422 24.2049 28.454 24.109C28.2401 24 27.9601 24 27.4 24H25.6C25.0399 24 24.7599 24 24.546 24.109C24.3578 24.2049 24.2049 24.3578 24.109 24.546C24 24.7599 24 25.0399 24 25.6V27.4C24 27.9601 24 28.2401 24.109 28.454C24.2049 28.6422 24.3578 28.7951 24.546 28.891C24.7599 29 25.0399 29 25.6 29ZM25.6 16H27.4C27.9601 16 28.2401 16 28.454 15.891C28.6422 15.7951 28.7951 15.6422 28.891 15.454C29 15.2401 29 14.9601 29 14.4V12.6C29 12.0399 29 11.7599 28.891 11.546C28.7951 11.3578 28.6422 11.2049 28.454 11.109C28.2401 11 27.9601 11 27.4 11H25.6C25.0399 11 24.7599 11 24.546 11.109C24.3578 11.2049 24.2049 11.3578 24.109 11.546C24 11.7599 24 12.0399 24 12.6V14.4C24 14.9601 24 15.2401 24.109 15.454C24.2049 15.6422 24.3578 15.7951 24.546 15.891C24.7599 16 25.0399 16 25.6 16ZM12.6 16H14.4C14.9601 16 15.2401 16 15.454 15.891C15.6422 15.7951 15.7951 15.6422 15.891 15.454C16 15.2401 16 14.9601 16 14.4V12.6C16 12.0399 16 11.7599 15.891 11.546C15.7951 11.3578 15.6422 11.2049 15.454 11.109C15.2401 11 14.9601 11 14.4 11H12.6C12.0399 11 11.7599 11 11.546 11.109C11.3578 11.2049 11.2049 11.3578 11.109 11.546C11 11.7599 11 12.0399 11 12.6V14.4C11 14.9601 11 15.2401 11.109 15.454C11.2049 15.6422 11.3578 15.7951 11.546 15.891C11.7599 16 12.0399 16 12.6 16Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
@@ -4,6 +4,8 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
|
4
4
|
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
|
|
5
5
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
6
6
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
7
|
+
export { AnySpendDeposit } from "./AnySpendDeposit";
|
|
8
|
+
export type { AnySpendDepositProps, ChainConfig, DepositContractConfig } from "./AnySpendDeposit";
|
|
7
9
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
|
|
8
10
|
export * from "./AnySpendFingerprintWrapper";
|
|
9
11
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
@@ -5,6 +5,7 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin.js";
|
|
|
5
5
|
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase.js";
|
|
6
6
|
export { AnySpendCustom } from "./AnySpendCustom.js";
|
|
7
7
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn.js";
|
|
8
|
+
export { AnySpendDeposit } from "./AnySpendDeposit.js";
|
|
8
9
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype.js";
|
|
9
10
|
export * from "./AnySpendFingerprintWrapper.js";
|
|
10
11
|
export { AnySpendNFT } from "./AnySpendNFT.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./useAnyspendCreateOnrampOrder";
|
|
2
2
|
export * from "./useAnyspendCreateOrder";
|
|
3
|
+
export * from "./useCreateDepositFirstOrder";
|
|
3
4
|
export * from "./useAnyspendOrderAndTransactions";
|
|
4
5
|
export * from "./useAnyspendOrderHistory";
|
|
5
6
|
export * from "./useAnyspendQuote";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./useAnyspendCreateOnrampOrder.js";
|
|
2
2
|
export * from "./useAnyspendCreateOrder.js";
|
|
3
|
+
export * from "./useCreateDepositFirstOrder.js";
|
|
3
4
|
export * from "./useAnyspendOrderAndTransactions.js";
|
|
4
5
|
export * from "./useAnyspendOrderHistory.js";
|
|
5
6
|
export * from "./useAnyspendQuote.js";
|
|
@@ -24,9 +24,9 @@ interface UseAnyspendFlowProps {
|
|
|
24
24
|
destinationTokenChainId?: number;
|
|
25
25
|
slippage?: number;
|
|
26
26
|
disableUrlParamManagement?: boolean;
|
|
27
|
-
orderType?: "hype_duel" | "custom_exact_in";
|
|
27
|
+
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
28
28
|
}
|
|
29
|
-
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder,
|
|
29
|
+
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
|
|
30
30
|
activePanel: PanelView;
|
|
31
31
|
setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
|
|
32
32
|
orderId: string | undefined;
|