@b3dotfun/sdk 0.0.87-alpha.1 → 0.0.87
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 +0 -5
- package/dist/cjs/anyspend/react/components/AnySpend.js +49 -59
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +2 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +12 -17
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +5 -12
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/index.d.ts +0 -2
- package/dist/cjs/anyspend/react/components/index.js +1 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/index.js +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +11 -35
- package/dist/cjs/anyspend/utils/format.js +5 -28
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -4
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -5
- package/dist/esm/anyspend/react/components/AnySpend.js +49 -59
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +2 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +12 -17
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +5 -12
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +0 -2
- package/dist/esm/anyspend/react/components/index.js +0 -1
- package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/index.js +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +11 -35
- package/dist/esm/anyspend/utils/format.js +5 -28
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -4
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -5
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +0 -2
- package/dist/types/anyspend/react/components/index.d.ts +0 -2
- package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -4
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +45 -68
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +3 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +8 -26
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +8 -20
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/index.ts +0 -2
- package/src/anyspend/react/hooks/index.ts +0 -1
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +12 -37
- package/src/anyspend/utils/format.ts +5 -33
- package/src/global-account/react/stores/useModalStore.ts +0 -4
- package/src/styles/index.css +0 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +0 -190
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +0 -43
- package/dist/cjs/anyspend/react/components/QRDeposit.js +0 -146
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +0 -32
- package/dist/cjs/anyspend/react/components/common/WarningText.js +0 -36
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +0 -6
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +0 -6
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +0 -86
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +0 -187
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +0 -43
- package/dist/esm/anyspend/react/components/QRDeposit.js +0 -143
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +0 -32
- package/dist/esm/anyspend/react/components/common/WarningText.js +0 -32
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +0 -2
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +0 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +0 -83
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +0 -122
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +0 -43
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +0 -32
- package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +0 -6
- package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +0 -6
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +0 -24
- package/src/anyspend/react/components/AnySpendDeposit.tsx +0 -578
- package/src/anyspend/react/components/QRDeposit.tsx +0 -348
- package/src/anyspend/react/components/common/WarningText.tsx +0 -52
- package/src/anyspend/react/components/icons/CreditCardIcon.tsx +0 -25
- package/src/anyspend/react/components/icons/QrCodeIcon.tsx +0 -25
- package/src/anyspend/react/components/icons/credit-card.svg +0 -5
- package/src/anyspend/react/components/icons/qr-code.svg +0 -5
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +0 -110
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
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" })] }));
|
|
@@ -1,2 +0,0 @@
|
|
|
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" })] }));
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
import { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
3
|
-
export type CreateDepositFirstOrderParams = {
|
|
4
|
-
recipientAddress: string;
|
|
5
|
-
srcChain: number;
|
|
6
|
-
dstChain: number;
|
|
7
|
-
srcToken: components["schemas"]["Token"];
|
|
8
|
-
dstToken: components["schemas"]["Token"];
|
|
9
|
-
creatorAddress?: string;
|
|
10
|
-
/** Optional contract config for custom execution after deposit */
|
|
11
|
-
contractConfig?: DepositContractConfig;
|
|
12
|
-
};
|
|
13
|
-
export type UseCreateDepositFirstOrderProps = {
|
|
14
|
-
onSuccess?: (data: any) => void;
|
|
15
|
-
onError?: (error: Error) => void;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
19
|
-
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
20
|
-
*/
|
|
21
|
-
export declare function useCreateDepositFirstOrder({ onSuccess, onError }?: UseCreateDepositFirstOrderProps): {
|
|
22
|
-
createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, CreateDepositFirstOrderParams, unknown>;
|
|
23
|
-
isCreatingOrder: boolean;
|
|
24
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
|
-
import { normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
3
|
-
import { useB3 } from "../../../global-account/react/index.js";
|
|
4
|
-
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
5
|
-
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useMemo } from "react";
|
|
7
|
-
/**
|
|
8
|
-
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
9
|
-
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
10
|
-
*/
|
|
11
|
-
export function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
12
|
-
const { partnerId } = useB3();
|
|
13
|
-
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
14
|
-
const visitorData = fpData && {
|
|
15
|
-
requestId: fpData.requestId,
|
|
16
|
-
visitorId: fpData.visitorId,
|
|
17
|
-
};
|
|
18
|
-
const { mutate: createOrder, isPending } = useMutation({
|
|
19
|
-
mutationFn: async (params) => {
|
|
20
|
-
const { recipientAddress, srcChain, dstChain, srcToken, dstToken, creatorAddress, contractConfig } = params;
|
|
21
|
-
// Build payload based on whether we have a contract config
|
|
22
|
-
const payload = contractConfig
|
|
23
|
-
? {
|
|
24
|
-
functionAbi: contractConfig.functionAbi,
|
|
25
|
-
functionName: contractConfig.functionName,
|
|
26
|
-
functionArgs: contractConfig.functionArgs,
|
|
27
|
-
to: normalizeAddress(contractConfig.to),
|
|
28
|
-
spenderAddress: contractConfig.spenderAddress ? normalizeAddress(contractConfig.spenderAddress) : undefined,
|
|
29
|
-
action: contractConfig.action,
|
|
30
|
-
}
|
|
31
|
-
: {};
|
|
32
|
-
try {
|
|
33
|
-
return await anyspendService.createOrder({
|
|
34
|
-
recipientAddress: normalizeAddress(recipientAddress),
|
|
35
|
-
type: "deposit_first",
|
|
36
|
-
srcChain,
|
|
37
|
-
dstChain,
|
|
38
|
-
srcTokenAddress: normalizeAddress(srcToken.address),
|
|
39
|
-
dstTokenAddress: normalizeAddress(dstToken.address),
|
|
40
|
-
srcAmount: "", // Not required for deposit_first
|
|
41
|
-
payload,
|
|
42
|
-
metadata: {
|
|
43
|
-
srcToken: {
|
|
44
|
-
chainId: srcToken.chainId,
|
|
45
|
-
address: srcToken.address,
|
|
46
|
-
symbol: srcToken.symbol,
|
|
47
|
-
name: srcToken.name,
|
|
48
|
-
decimals: srcToken.decimals,
|
|
49
|
-
metadata: srcToken.metadata || {},
|
|
50
|
-
},
|
|
51
|
-
dstToken: {
|
|
52
|
-
chainId: dstToken.chainId,
|
|
53
|
-
address: dstToken.address,
|
|
54
|
-
symbol: dstToken.symbol,
|
|
55
|
-
name: dstToken.name,
|
|
56
|
-
decimals: dstToken.decimals,
|
|
57
|
-
metadata: dstToken.metadata || {},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
61
|
-
partnerId,
|
|
62
|
-
visitorData,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
if (error?.data) {
|
|
67
|
-
throw error.data;
|
|
68
|
-
}
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
onSuccess: (data) => {
|
|
73
|
-
onSuccess?.(data);
|
|
74
|
-
},
|
|
75
|
-
onError: (error) => {
|
|
76
|
-
onError?.(error);
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
return useMemo(() => ({
|
|
80
|
-
createOrder,
|
|
81
|
-
isCreatingOrder: isPending,
|
|
82
|
-
}), [createOrder, isPending]);
|
|
83
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
-
import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
3
|
-
export interface DepositContractConfig {
|
|
4
|
-
/** Custom function ABI JSON string */
|
|
5
|
-
functionAbi: string;
|
|
6
|
-
/** The function name to call */
|
|
7
|
-
functionName: string;
|
|
8
|
-
/** Custom function arguments. Use "{{amount_out}}" for the deposit amount placeholder */
|
|
9
|
-
functionArgs: string[];
|
|
10
|
-
/** The contract address to deposit to */
|
|
11
|
-
to: string;
|
|
12
|
-
/** Optional spender address if different from contract address */
|
|
13
|
-
spenderAddress?: string;
|
|
14
|
-
/** Custom action label */
|
|
15
|
-
action?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface ChainConfig {
|
|
18
|
-
/** Chain ID */
|
|
19
|
-
id: number;
|
|
20
|
-
/** Display name */
|
|
21
|
-
name: string;
|
|
22
|
-
/** Optional icon URL */
|
|
23
|
-
iconUrl?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface AnySpendDepositProps {
|
|
26
|
-
/** Order ID to load an existing order */
|
|
27
|
-
loadOrder?: string;
|
|
28
|
-
/** Display mode */
|
|
29
|
-
mode?: "modal" | "page";
|
|
30
|
-
/** The recipient address for the deposit */
|
|
31
|
-
recipientAddress: string;
|
|
32
|
-
/** Payment type - crypto or fiat. If not set, shows chain selection first */
|
|
33
|
-
paymentType?: "crypto" | "fiat";
|
|
34
|
-
/** Source token address to pre-select */
|
|
35
|
-
sourceTokenAddress?: string;
|
|
36
|
-
/** Source chain ID to pre-select. If not provided, shows chain selection */
|
|
37
|
-
sourceTokenChainId?: number;
|
|
38
|
-
/** The destination token to receive */
|
|
39
|
-
destinationToken: components["schemas"]["Token"];
|
|
40
|
-
/** The destination chain ID */
|
|
41
|
-
destinationChainId: number;
|
|
42
|
-
/** Callback when deposit succeeds */
|
|
43
|
-
onSuccess?: (amount: string) => void;
|
|
44
|
-
/** Callback for opening a custom modal (e.g., for special token handling) */
|
|
45
|
-
onOpenCustomModal?: () => void;
|
|
46
|
-
/** Custom footer content */
|
|
47
|
-
mainFooter?: React.ReactNode;
|
|
48
|
-
/** Called when a token is selected. Call event.preventDefault() to prevent default behavior */
|
|
49
|
-
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
50
|
-
preventDefault: () => void;
|
|
51
|
-
}) => void;
|
|
52
|
-
/** Custom USD input value presets for fiat payment */
|
|
53
|
-
customUsdInputValues?: string[];
|
|
54
|
-
/** Whether to prefer using connected EOA wallet */
|
|
55
|
-
preferEoa?: boolean;
|
|
56
|
-
/** Minimum destination amount required */
|
|
57
|
-
minDestinationAmount?: number;
|
|
58
|
-
/** Custom header component */
|
|
59
|
-
header?: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
|
|
60
|
-
anyspendPrice: GetQuoteResponse | undefined;
|
|
61
|
-
isLoadingAnyspendPrice: boolean;
|
|
62
|
-
}) => React.JSX.Element;
|
|
63
|
-
/** Order type for the deposit */
|
|
64
|
-
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
65
|
-
/** Custom action label displayed on buttons */
|
|
66
|
-
actionLabel?: string;
|
|
67
|
-
/** Configuration for depositing to a custom contract.
|
|
68
|
-
* If provided, creates a custom_exact_in order that calls the contract.
|
|
69
|
-
* If not provided, creates a simple hype_duel order for direct deposits.
|
|
70
|
-
*/
|
|
71
|
-
depositContractConfig?: DepositContractConfig;
|
|
72
|
-
/** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
|
|
73
|
-
showChainSelection?: boolean;
|
|
74
|
-
/** Custom list of supported chains. If not provided, uses default chains */
|
|
75
|
-
supportedChains?: ChainConfig[];
|
|
76
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
77
|
-
minPoolSize?: number;
|
|
78
|
-
/** Custom title for chain selection step */
|
|
79
|
-
chainSelectionTitle?: string;
|
|
80
|
-
/** Custom description for chain selection step */
|
|
81
|
-
chainSelectionDescription?: string;
|
|
82
|
-
/** Number of top chains to show (default: 3) */
|
|
83
|
-
topChainsCount?: number;
|
|
84
|
-
/** Callback when close button is clicked */
|
|
85
|
-
onClose?: () => void;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* // Simple deposit with chain selection
|
|
92
|
-
* <AnySpendDeposit
|
|
93
|
-
* recipientAddress={userAddress}
|
|
94
|
-
* destinationToken={myToken}
|
|
95
|
-
* destinationChainId={base.id}
|
|
96
|
-
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
97
|
-
* />
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* // Skip chain selection by providing sourceTokenChainId
|
|
101
|
-
* <AnySpendDeposit
|
|
102
|
-
* recipientAddress={userAddress}
|
|
103
|
-
* destinationToken={myToken}
|
|
104
|
-
* destinationChainId={base.id}
|
|
105
|
-
* sourceTokenChainId={base.id}
|
|
106
|
-
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
107
|
-
* />
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* // Deposit with custom contract
|
|
111
|
-
* <AnySpendDeposit
|
|
112
|
-
* recipientAddress={userAddress}
|
|
113
|
-
* destinationToken={myToken}
|
|
114
|
-
* destinationChainId={base.id}
|
|
115
|
-
* depositContractConfig={{
|
|
116
|
-
* contractAddress: "0x...",
|
|
117
|
-
* functionName: "depositFor",
|
|
118
|
-
* }}
|
|
119
|
-
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
120
|
-
* />
|
|
121
|
-
*/
|
|
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;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { components } from "@b3dotfun/sdk/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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
-
import { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
3
|
-
export type CreateDepositFirstOrderParams = {
|
|
4
|
-
recipientAddress: string;
|
|
5
|
-
srcChain: number;
|
|
6
|
-
dstChain: number;
|
|
7
|
-
srcToken: components["schemas"]["Token"];
|
|
8
|
-
dstToken: components["schemas"]["Token"];
|
|
9
|
-
creatorAddress?: string;
|
|
10
|
-
/** Optional contract config for custom execution after deposit */
|
|
11
|
-
contractConfig?: DepositContractConfig;
|
|
12
|
-
};
|
|
13
|
-
export type UseCreateDepositFirstOrderProps = {
|
|
14
|
-
onSuccess?: (data: any) => void;
|
|
15
|
-
onError?: (error: Error) => void;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
19
|
-
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
20
|
-
*/
|
|
21
|
-
export declare function useCreateDepositFirstOrder({ onSuccess, onError }?: UseCreateDepositFirstOrderProps): {
|
|
22
|
-
createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, CreateDepositFirstOrderParams, unknown>;
|
|
23
|
-
isCreatingOrder: boolean;
|
|
24
|
-
};
|