@b3dotfun/sdk 0.1.66-alpha.3 → 0.1.66-alpha.4
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/checkout/CheckoutPaymentPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +3 -1
- package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/checkout/QRCheckoutPanel.js +11 -2
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -0
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +1 -1
- package/dist/esm/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +1 -0
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +2 -1
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +3 -1
- package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +1 -1
- package/dist/esm/anyspend/react/components/checkout/QRCheckoutPanel.js +11 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -0
- package/dist/types/anyspend/react/components/checkout/CoinbaseCheckoutPanel.d.ts +1 -0
- package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/QRCheckoutPanel.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +2 -0
- package/src/anyspend/react/components/checkout/CoinbaseCheckoutPanel.tsx +1 -0
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +4 -0
- package/src/anyspend/react/components/checkout/QRCheckoutPanel.tsx +11 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -0
|
@@ -41,5 +41,5 @@ function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress, desti
|
|
|
41
41
|
}
|
|
42
42
|
const accordionButtonClass = (active) => (0, cn_1.cn)("anyspend-payment-method-btn flex w-full items-center gap-3 px-4 py-4 text-left transition-colors", active ? "bg-white dark:bg-gray-900" : "bg-white hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800", classes?.paymentMethodButton);
|
|
43
43
|
const expandedPanelClass = (0, cn_1.cn)("anyspend-payment-method-panel border-t border-gray-100 bg-white px-4 py-4 dark:border-gray-800 dark:bg-gray-900");
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-gray-700 dark:border-gray-700", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Crypto wallet" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "crypto" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CryptoCheckoutPanel_1.CryptoCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "crypto-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-qr", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("qr"), className: accordionButtonClass(paymentMethod === "qr"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "qr", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.QrCode, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "QR code" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "qr" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(QRCheckoutPanel_1.QRCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "qr-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(VisaLogo, {}), (0, jsx_runtime_1.jsx)(MastercardLogo, {}), (0, jsx_runtime_1.jsx)(AmexLogo, {})] })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "card" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(FiatCheckoutPanel_1.FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, classes: classes }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(CoinbaseLogo, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CoinbaseCheckoutPanel_1.CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [(0, jsx_runtime_1.jsx)("h2", { className: (0, cn_1.cn)("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-gray-700 dark:border-gray-700", classes?.paymentMethodSelector), children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-crypto", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Crypto wallet" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "crypto" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CryptoCheckoutPanel_1.CryptoCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "crypto-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-qr", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("qr"), className: accordionButtonClass(paymentMethod === "qr"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "qr", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(lucide_react_1.QrCode, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "QR code" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "qr" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(QRCheckoutPanel_1.QRCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "qr-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-card", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("card"), className: accordionButtonClass(paymentMethod === "card"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(VisaLogo, {}), (0, jsx_runtime_1.jsx)(MastercardLogo, {}), (0, jsx_runtime_1.jsx)(AmexLogo, {})] })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "card" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(FiatCheckoutPanel_1.FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "card-panel")) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-method-coinbase", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setPaymentMethod("coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [(0, jsx_runtime_1.jsx)(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), (0, jsx_runtime_1.jsx)(CoinbaseLogo, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && ((0, jsx_runtime_1.jsx)(react_1.motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: (0, jsx_runtime_1.jsx)("div", { className: expandedPanelClass, children: (0, jsx_runtime_1.jsx)(CoinbaseCheckoutPanel_1.CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
|
|
45
45
|
}
|
|
@@ -10,6 +10,7 @@ interface CoinbaseCheckoutPanelProps {
|
|
|
10
10
|
orderId?: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
|
+
callbackMetadata?: Record<string, unknown>;
|
|
13
14
|
classes?: AnySpendCheckoutClasses;
|
|
14
15
|
}
|
|
15
16
|
export declare function CoinbaseCheckoutPanel({ destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, }: CoinbaseCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,8 @@ interface FiatCheckoutPanelProps {
|
|
|
10
10
|
orderId?: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
|
+
callbackMetadata?: Record<string, unknown>;
|
|
13
14
|
classes?: AnySpendCheckoutClasses;
|
|
14
15
|
}
|
|
15
|
-
export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, classes, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -12,7 +12,7 @@ const react_stripe_js_1 = require("@stripe/react-stripe-js");
|
|
|
12
12
|
const lucide_react_1 = require("lucide-react");
|
|
13
13
|
const react_3 = require("motion/react");
|
|
14
14
|
const react_4 = require("react");
|
|
15
|
-
function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, classes, }) {
|
|
15
|
+
function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }) {
|
|
16
16
|
const { data: tokenData } = (0, react_2.useTokenData)(destinationTokenChainId, destinationTokenAddress);
|
|
17
17
|
const { theme, stripePublishableKey } = (0, react_2.useB3Config)();
|
|
18
18
|
const formattedAmount = (0, react_4.useMemo)(() => {
|
|
@@ -76,6 +76,7 @@ function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinat
|
|
|
76
76
|
redirectUrl: window.location.origin,
|
|
77
77
|
},
|
|
78
78
|
expectedDstAmount: totalAmount,
|
|
79
|
+
callbackMetadata,
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
}, [
|
|
@@ -91,6 +92,7 @@ function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinat
|
|
|
91
92
|
formattedAmount,
|
|
92
93
|
totalAmount,
|
|
93
94
|
geoData,
|
|
95
|
+
callbackMetadata,
|
|
94
96
|
createOrder,
|
|
95
97
|
]);
|
|
96
98
|
// Loading geo/stripe support check
|
|
@@ -13,5 +13,5 @@ interface QRCheckoutPanelProps {
|
|
|
13
13
|
callbackMetadata?: Record<string, unknown>;
|
|
14
14
|
classes?: AnySpendCheckoutClasses;
|
|
15
15
|
}
|
|
16
|
-
export declare function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata
|
|
16
|
+
export declare function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }: QRCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -29,7 +29,7 @@ const DEFAULT_ETH_ON_BASE = {
|
|
|
29
29
|
decimals: 18,
|
|
30
30
|
metadata: { logoURI: "https://assets.relay.link/icons/1/light.png" },
|
|
31
31
|
};
|
|
32
|
-
function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata
|
|
32
|
+
function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }) {
|
|
33
33
|
const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_2.useState)(8453); // Base
|
|
34
34
|
const [selectedSrcToken, setSelectedSrcToken] = (0, react_2.useState)(DEFAULT_ETH_ON_BASE);
|
|
35
35
|
const [showTokenSelector, setShowTokenSelector] = (0, react_2.useState)(false);
|
|
@@ -100,8 +100,17 @@ function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinatio
|
|
|
100
100
|
dstChain: destinationTokenChainId,
|
|
101
101
|
srcToken: selectedSrcToken,
|
|
102
102
|
dstToken,
|
|
103
|
+
callbackMetadata,
|
|
103
104
|
});
|
|
104
|
-
}, [
|
|
105
|
+
}, [
|
|
106
|
+
recipientAddress,
|
|
107
|
+
selectedSrcChainId,
|
|
108
|
+
destinationTokenChainId,
|
|
109
|
+
selectedSrcToken,
|
|
110
|
+
dstToken,
|
|
111
|
+
callbackMetadata,
|
|
112
|
+
createOrder,
|
|
113
|
+
]);
|
|
105
114
|
// Poll order status
|
|
106
115
|
const { orderAndTransactions: oat } = (0, useAnyspendOrderAndTransactions_1.useAnyspendOrderAndTransactions)(orderId);
|
|
107
116
|
// Call onSuccess when order is executed
|
|
@@ -9,6 +9,7 @@ export type CreateDepositFirstOrderParams = {
|
|
|
9
9
|
creatorAddress?: string;
|
|
10
10
|
/** Optional contract config for custom execution after deposit */
|
|
11
11
|
contractConfig?: DepositContractConfig;
|
|
12
|
+
callbackMetadata?: Record<string, unknown>;
|
|
12
13
|
};
|
|
13
14
|
export type UseCreateDepositFirstOrderProps = {
|
|
14
15
|
onSuccess?: (data: any) => void;
|
|
@@ -63,6 +63,7 @@ function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
|
63
63
|
creatorAddress: creatorAddress ? (0, utils_1.normalizeAddress)(creatorAddress) : undefined,
|
|
64
64
|
partnerId,
|
|
65
65
|
visitorData,
|
|
66
|
+
callbackMetadata: params.callbackMetadata,
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
catch (error) {
|
|
@@ -38,5 +38,5 @@ export function CheckoutPaymentPanel({ recipientAddress, destinationTokenAddress
|
|
|
38
38
|
}
|
|
39
39
|
const accordionButtonClass = (active) => cn("anyspend-payment-method-btn flex w-full items-center gap-3 px-4 py-4 text-left transition-colors", active ? "bg-white dark:bg-gray-900" : "bg-white hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800", classes?.paymentMethodButton);
|
|
40
40
|
const expandedPanelClass = cn("anyspend-payment-method-panel border-t border-gray-100 bg-white px-4 py-4 dark:border-gray-800 dark:bg-gray-900");
|
|
41
|
-
return (_jsxs("div", { className: cn("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [_jsx("h2", { className: cn("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), _jsxs("div", { className: cn("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-gray-700 dark:border-gray-700", classes?.paymentMethodSelector), children: [_jsxs("div", { className: "anyspend-method-crypto", children: [_jsxs("button", { onClick: () => setPaymentMethod("crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [_jsx(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), _jsx(Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Crypto wallet" })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "crypto" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(CryptoCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "crypto-panel")) })] }), _jsxs("div", { className: "anyspend-method-qr", children: [_jsxs("button", { onClick: () => setPaymentMethod("qr"), className: accordionButtonClass(paymentMethod === "qr"), children: [_jsx(RadioCircle, { selected: paymentMethod === "qr", themeColor: themeColor }), _jsx(QrCode, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "QR code" })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "qr" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(QRCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "qr-panel")) })] }), _jsxs("div", { className: "anyspend-method-card", children: [_jsxs("button", { onClick: () => setPaymentMethod("card"), className: accordionButtonClass(paymentMethod === "card"), children: [_jsx(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [_jsx(VisaLogo, {}), _jsx(MastercardLogo, {}), _jsx(AmexLogo, {})] })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "card" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, classes: classes }) }) }, "card-panel")) })] }), _jsxs("div", { className: "anyspend-method-coinbase", children: [_jsxs("button", { onClick: () => setPaymentMethod("coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [_jsx(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), _jsx(CoinbaseLogo, {}), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
|
|
41
|
+
return (_jsxs("div", { className: cn("anyspend-payment-panel flex flex-col gap-5", classes?.paymentPanel), children: [_jsx("h2", { className: cn("anyspend-payment-title text-lg font-semibold text-gray-900 dark:text-gray-100", classes?.paymentTitle), children: "Payment" }), _jsxs("div", { className: cn("anyspend-payment-methods divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 dark:divide-gray-700 dark:border-gray-700", classes?.paymentMethodSelector), children: [_jsxs("div", { className: "anyspend-method-crypto", children: [_jsxs("button", { onClick: () => setPaymentMethod("crypto"), className: accordionButtonClass(paymentMethod === "crypto"), children: [_jsx(RadioCircle, { selected: paymentMethod === "crypto", themeColor: themeColor }), _jsx(Wallet, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Crypto wallet" })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "crypto" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(CryptoCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, buttonText: buttonText, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "crypto-panel")) })] }), _jsxs("div", { className: "anyspend-method-qr", children: [_jsxs("button", { onClick: () => setPaymentMethod("qr"), className: accordionButtonClass(paymentMethod === "qr"), children: [_jsx(RadioCircle, { selected: paymentMethod === "qr", themeColor: themeColor }), _jsx(QrCode, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "QR code" })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "qr" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(QRCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "qr-panel")) })] }), _jsxs("div", { className: "anyspend-method-card", children: [_jsxs("button", { onClick: () => setPaymentMethod("card"), className: accordionButtonClass(paymentMethod === "card"), children: [_jsx(RadioCircle, { selected: paymentMethod === "card", themeColor: themeColor }), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Credit or debit card" }), _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [_jsx(VisaLogo, {}), _jsx(MastercardLogo, {}), _jsx(AmexLogo, {})] })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "card" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(FiatCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "card-panel")) })] }), _jsxs("div", { className: "anyspend-method-coinbase", children: [_jsxs("button", { onClick: () => setPaymentMethod("coinbase"), className: accordionButtonClass(paymentMethod === "coinbase"), children: [_jsx(RadioCircle, { selected: paymentMethod === "coinbase", themeColor: themeColor }), _jsx(CoinbaseLogo, {}), _jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Coinbase Pay" })] }), _jsx(AnimatePresence, { initial: false, children: paymentMethod === "coinbase" && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, style: { overflow: "hidden" }, children: _jsx("div", { className: expandedPanelClass, children: _jsx(CoinbaseCheckoutPanel, { recipientAddress: recipientAddress, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, totalAmount: totalAmount, themeColor: themeColor, onSuccess: handleSuccess, onError: onError, callbackMetadata: callbackMetadata, classes: classes }) }) }, "coinbase-panel")) })] })] })] }));
|
|
42
42
|
}
|
|
@@ -10,6 +10,7 @@ interface CoinbaseCheckoutPanelProps {
|
|
|
10
10
|
orderId?: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
|
+
callbackMetadata?: Record<string, unknown>;
|
|
13
14
|
classes?: AnySpendCheckoutClasses;
|
|
14
15
|
}
|
|
15
16
|
export declare function CoinbaseCheckoutPanel({ destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, }: CoinbaseCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,8 @@ interface FiatCheckoutPanelProps {
|
|
|
10
10
|
orderId?: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
|
+
callbackMetadata?: Record<string, unknown>;
|
|
13
14
|
classes?: AnySpendCheckoutClasses;
|
|
14
15
|
}
|
|
15
|
-
export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, classes, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -9,7 +9,7 @@ import { AddressElement, Elements, PaymentElement, useElements, useStripe } from
|
|
|
9
9
|
import { Loader2, Lock } from "lucide-react";
|
|
10
10
|
import { AnimatePresence, motion } from "motion/react";
|
|
11
11
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
export function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, classes, }) {
|
|
12
|
+
export function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }) {
|
|
13
13
|
const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
14
14
|
const { theme, stripePublishableKey } = useB3Config();
|
|
15
15
|
const formattedAmount = useMemo(() => {
|
|
@@ -73,6 +73,7 @@ export function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, d
|
|
|
73
73
|
redirectUrl: window.location.origin,
|
|
74
74
|
},
|
|
75
75
|
expectedDstAmount: totalAmount,
|
|
76
|
+
callbackMetadata,
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
}, [
|
|
@@ -88,6 +89,7 @@ export function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, d
|
|
|
88
89
|
formattedAmount,
|
|
89
90
|
totalAmount,
|
|
90
91
|
geoData,
|
|
92
|
+
callbackMetadata,
|
|
91
93
|
createOrder,
|
|
92
94
|
]);
|
|
93
95
|
// Loading geo/stripe support check
|
|
@@ -13,5 +13,5 @@ interface QRCheckoutPanelProps {
|
|
|
13
13
|
callbackMetadata?: Record<string, unknown>;
|
|
14
14
|
classes?: AnySpendCheckoutClasses;
|
|
15
15
|
}
|
|
16
|
-
export declare function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata
|
|
16
|
+
export declare function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }: QRCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -26,7 +26,7 @@ const DEFAULT_ETH_ON_BASE = {
|
|
|
26
26
|
decimals: 18,
|
|
27
27
|
metadata: { logoURI: "https://assets.relay.link/icons/1/light.png" },
|
|
28
28
|
};
|
|
29
|
-
export function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata
|
|
29
|
+
export function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }) {
|
|
30
30
|
const [selectedSrcChainId, setSelectedSrcChainId] = useState(8453); // Base
|
|
31
31
|
const [selectedSrcToken, setSelectedSrcToken] = useState(DEFAULT_ETH_ON_BASE);
|
|
32
32
|
const [showTokenSelector, setShowTokenSelector] = useState(false);
|
|
@@ -97,8 +97,17 @@ export function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, des
|
|
|
97
97
|
dstChain: destinationTokenChainId,
|
|
98
98
|
srcToken: selectedSrcToken,
|
|
99
99
|
dstToken,
|
|
100
|
+
callbackMetadata,
|
|
100
101
|
});
|
|
101
|
-
}, [
|
|
102
|
+
}, [
|
|
103
|
+
recipientAddress,
|
|
104
|
+
selectedSrcChainId,
|
|
105
|
+
destinationTokenChainId,
|
|
106
|
+
selectedSrcToken,
|
|
107
|
+
dstToken,
|
|
108
|
+
callbackMetadata,
|
|
109
|
+
createOrder,
|
|
110
|
+
]);
|
|
102
111
|
// Poll order status
|
|
103
112
|
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
|
|
104
113
|
// Call onSuccess when order is executed
|
|
@@ -9,6 +9,7 @@ export type CreateDepositFirstOrderParams = {
|
|
|
9
9
|
creatorAddress?: string;
|
|
10
10
|
/** Optional contract config for custom execution after deposit */
|
|
11
11
|
contractConfig?: DepositContractConfig;
|
|
12
|
+
callbackMetadata?: Record<string, unknown>;
|
|
12
13
|
};
|
|
13
14
|
export type UseCreateDepositFirstOrderProps = {
|
|
14
15
|
onSuccess?: (data: any) => void;
|
|
@@ -60,6 +60,7 @@ export function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
|
60
60
|
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
61
61
|
partnerId,
|
|
62
62
|
visitorData,
|
|
63
|
+
callbackMetadata: params.callbackMetadata,
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
catch (error) {
|
|
@@ -10,6 +10,7 @@ interface CoinbaseCheckoutPanelProps {
|
|
|
10
10
|
orderId?: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
|
+
callbackMetadata?: Record<string, unknown>;
|
|
13
14
|
classes?: AnySpendCheckoutClasses;
|
|
14
15
|
}
|
|
15
16
|
export declare function CoinbaseCheckoutPanel({ destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, }: CoinbaseCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,8 @@ interface FiatCheckoutPanelProps {
|
|
|
10
10
|
orderId?: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
|
+
callbackMetadata?: Record<string, unknown>;
|
|
13
14
|
classes?: AnySpendCheckoutClasses;
|
|
14
15
|
}
|
|
15
|
-
export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, classes, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function FiatCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }: FiatCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -13,5 +13,5 @@ interface QRCheckoutPanelProps {
|
|
|
13
13
|
callbackMetadata?: Record<string, unknown>;
|
|
14
14
|
classes?: AnySpendCheckoutClasses;
|
|
15
15
|
}
|
|
16
|
-
export declare function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata
|
|
16
|
+
export declare function QRCheckoutPanel({ recipientAddress, destinationTokenAddress, destinationTokenChainId, totalAmount, themeColor, onSuccess, onError, callbackMetadata, classes, }: QRCheckoutPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -9,6 +9,7 @@ export type CreateDepositFirstOrderParams = {
|
|
|
9
9
|
creatorAddress?: string;
|
|
10
10
|
/** Optional contract config for custom execution after deposit */
|
|
11
11
|
contractConfig?: DepositContractConfig;
|
|
12
|
+
callbackMetadata?: Record<string, unknown>;
|
|
12
13
|
};
|
|
13
14
|
export type UseCreateDepositFirstOrderProps = {
|
|
14
15
|
onSuccess?: (data: any) => void;
|
package/package.json
CHANGED
|
@@ -270,6 +270,7 @@ export function CheckoutPaymentPanel({
|
|
|
270
270
|
themeColor={themeColor}
|
|
271
271
|
onSuccess={handleSuccess}
|
|
272
272
|
onError={onError}
|
|
273
|
+
callbackMetadata={callbackMetadata}
|
|
273
274
|
classes={classes}
|
|
274
275
|
/>
|
|
275
276
|
</div>
|
|
@@ -307,6 +308,7 @@ export function CheckoutPaymentPanel({
|
|
|
307
308
|
themeColor={themeColor}
|
|
308
309
|
onSuccess={handleSuccess}
|
|
309
310
|
onError={onError}
|
|
311
|
+
callbackMetadata={callbackMetadata}
|
|
310
312
|
classes={classes}
|
|
311
313
|
/>
|
|
312
314
|
</div>
|
|
@@ -17,6 +17,7 @@ interface CoinbaseCheckoutPanelProps {
|
|
|
17
17
|
themeColor?: string;
|
|
18
18
|
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
19
19
|
onError?: (error: Error) => void;
|
|
20
|
+
callbackMetadata?: Record<string, unknown>;
|
|
20
21
|
classes?: AnySpendCheckoutClasses;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -20,6 +20,7 @@ interface FiatCheckoutPanelProps {
|
|
|
20
20
|
themeColor?: string;
|
|
21
21
|
onSuccess?: (result: { txHash?: string; orderId?: string }) => void;
|
|
22
22
|
onError?: (error: Error) => void;
|
|
23
|
+
callbackMetadata?: Record<string, unknown>;
|
|
23
24
|
classes?: AnySpendCheckoutClasses;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -31,6 +32,7 @@ export function FiatCheckoutPanel({
|
|
|
31
32
|
themeColor,
|
|
32
33
|
onSuccess,
|
|
33
34
|
onError,
|
|
35
|
+
callbackMetadata,
|
|
34
36
|
classes,
|
|
35
37
|
}: FiatCheckoutPanelProps) {
|
|
36
38
|
const { data: tokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
@@ -109,6 +111,7 @@ export function FiatCheckoutPanel({
|
|
|
109
111
|
redirectUrl: window.location.origin,
|
|
110
112
|
},
|
|
111
113
|
expectedDstAmount: totalAmount,
|
|
114
|
+
callbackMetadata,
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
117
|
}, [
|
|
@@ -124,6 +127,7 @@ export function FiatCheckoutPanel({
|
|
|
124
127
|
formattedAmount,
|
|
125
128
|
totalAmount,
|
|
126
129
|
geoData,
|
|
130
|
+
callbackMetadata,
|
|
127
131
|
createOrder,
|
|
128
132
|
]);
|
|
129
133
|
|
|
@@ -50,7 +50,7 @@ export function QRCheckoutPanel({
|
|
|
50
50
|
themeColor,
|
|
51
51
|
onSuccess,
|
|
52
52
|
onError,
|
|
53
|
-
callbackMetadata
|
|
53
|
+
callbackMetadata,
|
|
54
54
|
classes,
|
|
55
55
|
}: QRCheckoutPanelProps) {
|
|
56
56
|
const [selectedSrcChainId, setSelectedSrcChainId] = useState(8453); // Base
|
|
@@ -135,8 +135,17 @@ export function QRCheckoutPanel({
|
|
|
135
135
|
dstChain: destinationTokenChainId,
|
|
136
136
|
srcToken: selectedSrcToken,
|
|
137
137
|
dstToken,
|
|
138
|
+
callbackMetadata,
|
|
138
139
|
});
|
|
139
|
-
}, [
|
|
140
|
+
}, [
|
|
141
|
+
recipientAddress,
|
|
142
|
+
selectedSrcChainId,
|
|
143
|
+
destinationTokenChainId,
|
|
144
|
+
selectedSrcToken,
|
|
145
|
+
dstToken,
|
|
146
|
+
callbackMetadata,
|
|
147
|
+
createOrder,
|
|
148
|
+
]);
|
|
140
149
|
|
|
141
150
|
// Poll order status
|
|
142
151
|
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
|
|
@@ -17,6 +17,7 @@ export type CreateDepositFirstOrderParams = {
|
|
|
17
17
|
creatorAddress?: string;
|
|
18
18
|
/** Optional contract config for custom execution after deposit */
|
|
19
19
|
contractConfig?: DepositContractConfig;
|
|
20
|
+
callbackMetadata?: Record<string, unknown>;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export type UseCreateDepositFirstOrderProps = {
|
|
@@ -84,6 +85,7 @@ export function useCreateDepositFirstOrder({ onSuccess, onError }: UseCreateDepo
|
|
|
84
85
|
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
85
86
|
partnerId,
|
|
86
87
|
visitorData,
|
|
88
|
+
callbackMetadata: params.callbackMetadata,
|
|
87
89
|
});
|
|
88
90
|
} catch (error: any) {
|
|
89
91
|
if (error?.data) {
|