@b3dotfun/sdk 0.0.13 → 0.0.14-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/AnySpendFingerprintWrapper.d.ts +17 -0
- package/dist/cjs/anyspend/react/components/AnySpendFingerprintWrapper.js +40 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +9 -4
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +6 -9
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +15 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +6 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +14 -2
- package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.js +4 -4
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +10 -3
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +4 -4
- package/dist/cjs/anyspend/react/providers/StripeRedirectHandler.js +0 -3
- package/dist/cjs/anyspend/services/anyspend.d.ts +6 -4
- package/dist/cjs/anyspend/services/anyspend.js +14 -4
- package/dist/cjs/anyspend/types/fingerprint.d.ts +14 -0
- package/dist/cjs/anyspend/types/fingerprint.js +6 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +17 -0
- package/dist/esm/anyspend/react/components/AnySpendFingerprintWrapper.js +36 -0
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +9 -4
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +6 -9
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +1 -1
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +6 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +14 -2
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.js +4 -4
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +10 -3
- package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useStripeSupport.js +4 -4
- package/dist/esm/anyspend/react/providers/StripeRedirectHandler.js +0 -3
- package/dist/esm/anyspend/services/anyspend.d.ts +6 -4
- package/dist/esm/anyspend/services/anyspend.js +14 -4
- package/dist/esm/anyspend/types/fingerprint.d.ts +14 -0
- package/dist/esm/anyspend/types/fingerprint.js +5 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +0 -1
- package/dist/types/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +17 -0
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +1 -1
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +2 -1
- package/dist/types/anyspend/services/anyspend.d.ts +6 -4
- package/dist/types/anyspend/types/fingerprint.d.ts +14 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/package.json +26 -25
- package/src/anyspend/react/components/AnySpendFingerprintWrapper.tsx +60 -0
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +38 -24
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +13 -16
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +11 -1
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +18 -3
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +16 -3
- package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +10 -4
- package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +15 -4
- package/src/anyspend/react/hooks/useStripeSupport.ts +11 -4
- package/src/anyspend/react/providers/StripeRedirectHandler.tsx +0 -4
- package/src/anyspend/services/anyspend.ts +21 -2
- package/src/anyspend/types/fingerprint.ts +15 -0
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FingerprintJSPro, FpjsProvider } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
3
|
+
/**
|
|
4
|
+
* Internal wrapper that only initializes FingerprintJS when AnySpend components are actually used.
|
|
5
|
+
* This prevents unnecessary fingerprinting of users who don't interact with AnySpend.
|
|
6
|
+
*/
|
|
7
|
+
export function AnySpendFingerprintWrapper({ children, fingerprint }) {
|
|
8
|
+
// If no fingerprint config is provided, render children without fingerprinting
|
|
9
|
+
if (!fingerprint?.apiKey) {
|
|
10
|
+
console.warn("No Fingerprint API key provided. Fingerprinting will be disabled.");
|
|
11
|
+
return _jsx(_Fragment, { children: children });
|
|
12
|
+
}
|
|
13
|
+
// Ensure endpoint has https:// prefix
|
|
14
|
+
const endpoint = fingerprint.endpoint && !fingerprint.endpoint.startsWith("http")
|
|
15
|
+
? `https://${fingerprint.endpoint}`
|
|
16
|
+
: fingerprint.endpoint;
|
|
17
|
+
return (_jsx(FpjsProvider, { loadOptions: {
|
|
18
|
+
apiKey: fingerprint.apiKey,
|
|
19
|
+
endpoint: endpoint ? [endpoint, FingerprintJSPro.defaultEndpoint] : undefined,
|
|
20
|
+
scriptUrlPattern: fingerprint.scriptUrlPattern
|
|
21
|
+
? [fingerprint.scriptUrlPattern, FingerprintJSPro.defaultScriptUrlPattern]
|
|
22
|
+
: undefined,
|
|
23
|
+
}, children: children }));
|
|
24
|
+
}
|
|
25
|
+
// Helper function to get fingerprint config from environment variables
|
|
26
|
+
export function getFingerprintConfig() {
|
|
27
|
+
const apiKey = process.env.NEXT_PUBLIC_FINGERPRINT_API_KEY;
|
|
28
|
+
if (!apiKey) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
apiKey,
|
|
33
|
+
endpoint: process.env.NEXT_PUBLIC_FINGERPRINT_ENDPOINT,
|
|
34
|
+
scriptUrlPattern: process.env.NEXT_PUBLIC_FINGERPRINT_SCRIPT_URL,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -26,5 +26,5 @@ interface PanelOnrampPaymentProps {
|
|
|
26
26
|
recipientEnsName?: string;
|
|
27
27
|
recipientImageUrl?: string;
|
|
28
28
|
}
|
|
29
|
-
export declare function PanelOnrampPayment(
|
|
29
|
+
export declare function PanelOnrampPayment(props: PanelOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
export {};
|
|
@@ -7,9 +7,13 @@ import invariant from "invariant";
|
|
|
7
7
|
import { ChevronLeft, ChevronRight, Landmark, Loader2 } from "lucide-react";
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { toast } from "sonner";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper.js";
|
|
11
|
+
export function PanelOnrampPayment(props) {
|
|
12
|
+
const fingerprintConfig = getFingerprintConfig();
|
|
13
|
+
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(PanelOnrampPaymentInner, { ...props }) }));
|
|
14
|
+
}
|
|
15
|
+
function PanelOnrampPaymentInner(props) {
|
|
16
|
+
const { srcAmountOnRamp, recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, } = props;
|
|
13
17
|
// Use a stable amount for geo onramp options to prevent unnecessary refetches
|
|
14
18
|
const [stableAmountForGeo, setStableAmountForGeo] = useState(srcAmountOnRamp);
|
|
15
19
|
const hasInitialized = useRef(false);
|
|
@@ -21,6 +25,7 @@ recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationToke
|
|
|
21
25
|
}
|
|
22
26
|
}, [srcAmountOnRamp]);
|
|
23
27
|
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods, isStripeOnrampSupported, isStripeWeb2Supported, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(isMainnet, stableAmountForGeo);
|
|
28
|
+
const isLoading = isLoadingGeoOnramp;
|
|
24
29
|
const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
|
|
25
30
|
onSuccess: data => {
|
|
26
31
|
const orderId = data.data.id;
|
|
@@ -104,7 +109,7 @@ recipientAddress, isMainnet, isBuyMode, destinationTokenChainId, destinationToke
|
|
|
104
109
|
? "Receive NFT at"
|
|
105
110
|
: orderType === "join_tournament"
|
|
106
111
|
? "Join for"
|
|
107
|
-
: "Recipient" }), _jsxs("div", { className: "flex items-center gap-2", children: [recipientImageUrl && (_jsx("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), _jsxs("div", { className: "flex flex-col items-end gap-1", children: [recipientEnsName && _jsxs("span", { className: "text-b3-react-foreground/80", children: ["@", recipientEnsName] }), _jsx("span", { className: "text-b3-react-foreground/80", children: centerTruncate(recipientAddress) })] })] })] })), _jsx("div", { className: "border-b3-react-border border-t pt-3", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-b3-react-foreground font-semibold", children: "Amount" }), _jsxs("p", { className: "text-b3-react-foreground hover:text-b3-react-foreground/80 cursor-pointer text-xl font-semibold transition-colors", onClick: onBack, children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] }) })] })] }), isCreatingOrder ? (_jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { className: "text-as-primary/70", children: "Creating onramp order..." })] })) :
|
|
112
|
+
: "Recipient" }), _jsxs("div", { className: "flex items-center gap-2", children: [recipientImageUrl && (_jsx("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), _jsxs("div", { className: "flex flex-col items-end gap-1", children: [recipientEnsName && _jsxs("span", { className: "text-b3-react-foreground/80", children: ["@", recipientEnsName] }), _jsx("span", { className: "text-b3-react-foreground/80", children: centerTruncate(recipientAddress) })] })] })] })), _jsx("div", { className: "border-b3-react-border border-t pt-3", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-b3-react-foreground font-semibold", children: "Amount" }), _jsxs("p", { className: "text-b3-react-foreground hover:text-b3-react-foreground/80 cursor-pointer text-xl font-semibold transition-colors", onClick: onBack, children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] }) })] })] }), isCreatingOrder ? (_jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { className: "text-as-primary/70", children: "Creating onramp order..." })] })) : isLoading ? (_jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { className: "text-as-primary/70", children: "Loading payment options..." })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-3 flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-semibold", children: "Payment method" }), _jsx("div", { className: "flex items-center gap-1", children: coinbaseAvailablePaymentMethods.length > 0 &&
|
|
108
113
|
(() => {
|
|
109
114
|
const hasCard = coinbaseAvailablePaymentMethods.some(m => m.id === "CARD");
|
|
110
115
|
const hasApplePay = coinbaseAvailablePaymentMethods.some(m => m.id === "APPLE_PAY");
|
|
@@ -8,11 +8,13 @@ import { AddressElement, Elements, PaymentElement, useElements, useStripe } from
|
|
|
8
8
|
import { loadStripe } from "@stripe/stripe-js";
|
|
9
9
|
import { HelpCircle, Info, X } from "lucide-react";
|
|
10
10
|
import { useEffect, useState } from "react";
|
|
11
|
+
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper.js";
|
|
11
12
|
import HowItWorks from "./HowItWorks.js";
|
|
12
13
|
import PaymentMethodIcons from "./PaymentMethodIcons.js";
|
|
13
14
|
const stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
|
|
14
15
|
export default function PaymentStripeWeb2({ isMainnet, order, onPaymentSuccess }) {
|
|
15
16
|
const { theme } = useB3();
|
|
17
|
+
const fingerprintConfig = getFingerprintConfig();
|
|
16
18
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(isMainnet, order.stripePaymentIntentId);
|
|
17
19
|
if (isLoadingStripeClientSecret) {
|
|
18
20
|
return _jsx(StripeLoadingState, {});
|
|
@@ -20,10 +22,10 @@ export default function PaymentStripeWeb2({ isMainnet, order, onPaymentSuccess }
|
|
|
20
22
|
if (stripeClientSecretError) {
|
|
21
23
|
return _jsx(StripeErrorState, { error: stripeClientSecretError.message });
|
|
22
24
|
}
|
|
23
|
-
return (_jsx(Elements, { stripe: stripePromise, options: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(Elements, { stripe: stripePromise, options: {
|
|
26
|
+
clientSecret: clientSecret || undefined,
|
|
27
|
+
appearance: { theme: theme === "light" ? "stripe" : "night" },
|
|
28
|
+
}, children: _jsx(StripePaymentForm, { order: order, clientSecret: clientSecret, onPaymentSuccess: onPaymentSuccess }) }) }));
|
|
27
29
|
}
|
|
28
30
|
function StripeLoadingState() {
|
|
29
31
|
return (_jsx("div", { className: "relative my-8 flex w-full flex-1 flex-col items-center justify-center", children: _jsxs("div", { className: "bg-as-on-surface-1 flex w-full flex-col items-center justify-center gap-4 rounded-2xl p-8", children: [_jsx("div", { className: "bg-as-brand/20 flex h-16 w-16 items-center justify-center rounded-full", children: _jsx("div", { className: "text-as-brand h-8 w-8 animate-spin rounded-full border-2 border-current border-t-transparent" }) }), _jsxs("div", { className: "text-as-primary/70 text-center", children: [_jsx("div", { className: "text-lg font-medium", children: "Initializing payment" }), _jsx("div", { className: "text-as-primary/50 mt-2 text-sm", children: "Setting up secure payment form..." })] })] }) }));
|
|
@@ -44,7 +46,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
44
46
|
useEffect(() => {
|
|
45
47
|
if (stripe && elements) {
|
|
46
48
|
setStripeReady(true);
|
|
47
|
-
console.log("@@stripe-web2-payment:initialized:", JSON.stringify({ orderId: order.id }, null, 2));
|
|
48
49
|
}
|
|
49
50
|
}, [stripe, elements, order.id]);
|
|
50
51
|
useEffect(() => {
|
|
@@ -67,7 +68,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
67
68
|
// Handle payment element changes
|
|
68
69
|
const handlePaymentElementChange = (event) => {
|
|
69
70
|
// Show address element only for card payments
|
|
70
|
-
console.log("@@stripe-web2-payment:payment-element-change:", JSON.stringify(event, null, 2));
|
|
71
71
|
setShowAddressElement(event.value.type === "card");
|
|
72
72
|
};
|
|
73
73
|
const handleSubmit = async (e) => {
|
|
@@ -79,7 +79,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
79
79
|
setLoading(true);
|
|
80
80
|
setMessage(null);
|
|
81
81
|
try {
|
|
82
|
-
console.log("@@stripe-web2-payment:confirming-payment:", JSON.stringify({ orderId: order.id }, null, 2));
|
|
83
82
|
const result = (await stripe.confirmPayment({
|
|
84
83
|
elements,
|
|
85
84
|
confirmParams: {
|
|
@@ -118,8 +117,6 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
118
117
|
const url = new URL(window.location.href);
|
|
119
118
|
const fromStripe = url.searchParams.get("fromStripe");
|
|
120
119
|
const paymentIntent = url.searchParams.get("payment_intent");
|
|
121
|
-
console.log("@@stripe-web2-payment:fromStripe:", fromStripe);
|
|
122
|
-
console.log("@@stripe-web2-payment:paymentIntent:", paymentIntent);
|
|
123
120
|
if (fromStripe && paymentIntent) {
|
|
124
121
|
// Close the modal as we're returning from 3DS
|
|
125
122
|
setB3ModalOpen(true);
|
|
@@ -2,6 +2,7 @@ export { AnySpend } from "./AnySpend";
|
|
|
2
2
|
export { AnySpendBondKit } from "./AnySpendBondKit";
|
|
3
3
|
export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
4
4
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
5
|
+
export * from "./AnySpendFingerprintWrapper";
|
|
5
6
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
6
7
|
export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
|
|
7
8
|
export { AnySpendStakeB3 } from "./AnySpendStakeB3";
|
|
@@ -3,6 +3,7 @@ export { AnySpend } from "./AnySpend.js";
|
|
|
3
3
|
export { AnySpendBondKit } from "./AnySpendBondKit.js";
|
|
4
4
|
export { AnySpendBuySpin } from "./AnySpendBuySpin.js";
|
|
5
5
|
export { AnySpendCustom } from "./AnySpendCustom.js";
|
|
6
|
+
export * from "./AnySpendFingerprintWrapper.js";
|
|
6
7
|
export { AnySpendNFT } from "./AnySpendNFT.js";
|
|
7
8
|
export { AnyspendSignatureMint } from "./AnyspendSignatureMint.js";
|
|
8
9
|
export { AnySpendStakeB3 } from "./AnySpendStakeB3.js";
|
|
@@ -9,5 +9,5 @@ interface WebviewOnrampPaymentProps {
|
|
|
9
9
|
onPaymentSuccess: (orderId: string) => void;
|
|
10
10
|
userId?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function WebviewOnrampPayment(
|
|
12
|
+
export declare function WebviewOnrampPayment(props: WebviewOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -9,7 +9,12 @@ import { Loader2 } from "lucide-react";
|
|
|
9
9
|
import { useEffect, useRef, useState } from "react";
|
|
10
10
|
import { toast } from "sonner";
|
|
11
11
|
import { formatUnits } from "viem";
|
|
12
|
+
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper.js";
|
|
12
13
|
const stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
|
|
14
|
+
export function WebviewOnrampPayment(props) {
|
|
15
|
+
const fingerprintConfig = getFingerprintConfig();
|
|
16
|
+
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(WebviewOnrampPaymentInner, { ...props }) }));
|
|
17
|
+
}
|
|
13
18
|
// Stripe Payment Form Component
|
|
14
19
|
function StripePaymentForm({ order, onPaymentSuccess, }) {
|
|
15
20
|
const stripe = useStripe();
|
|
@@ -79,7 +84,7 @@ function StripePaymentForm({ order, onPaymentSuccess, }) {
|
|
|
79
84
|
},
|
|
80
85
|
} }) })), error && (_jsx("div", { className: "mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error })), _jsx("button", { type: "submit", disabled: !stripe || isProcessing, className: "mt-6 w-full rounded-xl bg-blue-600 px-4 py-3 font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50", children: isProcessing ? (_jsxs("div", { className: "flex items-center justify-center gap-2", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: "Processing..." })] })) : (_jsx("span", { children: "Complete Payment" })) })] }) }) }));
|
|
81
86
|
}
|
|
82
|
-
|
|
87
|
+
function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId, }) {
|
|
83
88
|
const [stableAmountForGeo, setStableAmountForGeo] = useState(srcAmountOnRamp);
|
|
84
89
|
const hasInitialized = useRef(false);
|
|
85
90
|
const [createdOrder, setCreatedOrder] = useState(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
2
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
3
3
|
export type OnrampOptions = {
|
|
4
4
|
vendor: components["schemas"]["OnrampMetadata"]["vendor"];
|
|
5
5
|
paymentMethod: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { USDC_BASE } from "../../../anyspend/constants/index.js";
|
|
2
2
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
3
3
|
import { buildMetadata, buildPayload, normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
4
|
+
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
4
5
|
import { useMutation } from "@tanstack/react-query";
|
|
5
6
|
import { useMemo } from "react";
|
|
6
7
|
import { parseUnits } from "viem";
|
|
@@ -10,6 +11,12 @@ import { base } from "viem/chains";
|
|
|
10
11
|
* Specifically handles orders that involve fiat-to-crypto onramp functionality
|
|
11
12
|
*/
|
|
12
13
|
export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
14
|
+
// Get fingerprint data
|
|
15
|
+
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
16
|
+
const visitorData = fpData && {
|
|
17
|
+
requestId: fpData.requestId,
|
|
18
|
+
visitorId: fpData.visitorId,
|
|
19
|
+
};
|
|
13
20
|
const { mutate: createOrder, isPending } = useMutation({
|
|
14
21
|
mutationFn: async (params) => {
|
|
15
22
|
const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId, } = params;
|
|
@@ -42,7 +49,9 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
|
42
49
|
expectedDstAmount,
|
|
43
50
|
nft,
|
|
44
51
|
tournament,
|
|
45
|
-
payload
|
|
52
|
+
payload: {
|
|
53
|
+
...payload,
|
|
54
|
+
},
|
|
46
55
|
}),
|
|
47
56
|
onramp,
|
|
48
57
|
metadata: buildMetadata(orderType, {
|
|
@@ -52,10 +61,13 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
|
52
61
|
expectedDstAmount,
|
|
53
62
|
nft,
|
|
54
63
|
tournament,
|
|
55
|
-
payload
|
|
64
|
+
payload: {
|
|
65
|
+
...payload,
|
|
66
|
+
},
|
|
56
67
|
}),
|
|
57
68
|
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
58
69
|
partnerId,
|
|
70
|
+
visitorData,
|
|
59
71
|
});
|
|
60
72
|
}
|
|
61
73
|
catch (error) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { buildMetadata, buildPayload, normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
3
|
+
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
3
4
|
import { useMutation } from "@tanstack/react-query";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
/**
|
|
@@ -8,6 +9,12 @@ import { useMemo } from "react";
|
|
|
8
9
|
* For onramp orders, use useAnyspendCreateOnrampOrder instead.
|
|
9
10
|
*/
|
|
10
11
|
export function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
|
|
12
|
+
// Get fingerprint data
|
|
13
|
+
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
14
|
+
const visitorData = fpData && {
|
|
15
|
+
requestId: fpData.requestId,
|
|
16
|
+
visitorId: fpData.visitorId,
|
|
17
|
+
};
|
|
11
18
|
const { mutate: createOrder, isPending } = useMutation({
|
|
12
19
|
mutationFn: async (params) => {
|
|
13
20
|
const { isMainnet, recipientAddress, orderType, srcChain, dstChain, srcToken, dstToken, srcAmount, creatorAddress, } = params;
|
|
@@ -28,7 +35,9 @@ export function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
|
|
|
28
35
|
expectedDstAmount: params.expectedDstAmount,
|
|
29
36
|
nft: params.nft,
|
|
30
37
|
tournament: params.tournament,
|
|
31
|
-
payload:
|
|
38
|
+
payload: {
|
|
39
|
+
...params.payload,
|
|
40
|
+
},
|
|
32
41
|
}),
|
|
33
42
|
metadata: buildMetadata(orderType, {
|
|
34
43
|
orderType,
|
|
@@ -37,9 +46,12 @@ export function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
|
|
|
37
46
|
expectedDstAmount: params.expectedDstAmount,
|
|
38
47
|
nft: params.nft,
|
|
39
48
|
tournament: params.tournament,
|
|
40
|
-
payload:
|
|
49
|
+
payload: {
|
|
50
|
+
...params.payload,
|
|
51
|
+
},
|
|
41
52
|
}),
|
|
42
53
|
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
54
|
+
visitorData,
|
|
43
55
|
});
|
|
44
56
|
}
|
|
45
57
|
catch (error) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VisitorData } from "../../../anyspend/types/fingerprint";
|
|
2
|
+
export declare function useCoinbaseOnrampOptions(isMainnet: boolean, country?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
2
3
|
coinbaseOnrampOptions: {
|
|
3
4
|
paymentCurrencies: {
|
|
4
5
|
id?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useCoinbaseOnrampOptions(isMainnet, country) {
|
|
4
|
+
export function useCoinbaseOnrampOptions(isMainnet, country, visitorData, isLoadingVisitorData) {
|
|
5
5
|
const { data, isLoading, error, refetch } = useQuery({
|
|
6
|
-
queryKey: ["getCoinbaseOnrampOptions", isMainnet, country],
|
|
7
|
-
queryFn: () => anyspendService.getCoinbaseOnrampOptions(isMainnet, country),
|
|
8
|
-
enabled: Boolean(country),
|
|
6
|
+
queryKey: ["getCoinbaseOnrampOptions", isMainnet, country, visitorData],
|
|
7
|
+
queryFn: () => anyspendService.getCoinbaseOnrampOptions(isMainnet, country, visitorData),
|
|
8
|
+
enabled: Boolean(country) && !isLoadingVisitorData,
|
|
9
9
|
});
|
|
10
10
|
return useMemo(() => ({
|
|
11
11
|
coinbaseOnrampOptions: data?.data,
|
|
@@ -33,7 +33,7 @@ export declare function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: s
|
|
|
33
33
|
isStripeOnrampSupported: boolean;
|
|
34
34
|
isStripeWeb2Supported: boolean;
|
|
35
35
|
isOnrampSupported: boolean;
|
|
36
|
-
isLoading: boolean;
|
|
36
|
+
isLoading: boolean | undefined;
|
|
37
37
|
isLoadingGeo: boolean;
|
|
38
38
|
isLoadingCoinbaseOnrampOptions: boolean;
|
|
39
39
|
isLoadingStripeSupport: boolean;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
1
2
|
import { useMemo } from "react";
|
|
2
3
|
import { useCoinbaseOnrampOptions } from "./useCoinbaseOnrampOptions.js";
|
|
3
4
|
import { useGetGeo } from "./useGetGeo.js";
|
|
4
5
|
import { useStripeSupport } from "./useStripeSupport.js";
|
|
5
6
|
export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
7
|
+
// Get fingerprint data
|
|
8
|
+
const { data: fpData, isLoading: isLoadingVisitorData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
9
|
+
const visitorData = fpData && {
|
|
10
|
+
requestId: fpData.requestId,
|
|
11
|
+
visitorId: fpData.visitorId,
|
|
12
|
+
};
|
|
6
13
|
// Use existing hooks
|
|
7
14
|
const { geoData, loading: isLoadingGeo, error: geoError } = useGetGeo();
|
|
8
|
-
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = useCoinbaseOnrampOptions(isMainnet, geoData?.country);
|
|
9
|
-
const { isStripeOnrampSupported, isStripeWeb2Supported, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(isMainnet, geoData?.ip || "", srcFiatAmount);
|
|
15
|
+
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = useCoinbaseOnrampOptions(isMainnet, geoData?.country, visitorData);
|
|
16
|
+
const { isStripeOnrampSupported, isStripeWeb2Supported, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(isMainnet, geoData?.ip || "", srcFiatAmount, visitorData);
|
|
10
17
|
// Calculate available payment methods based on the amount
|
|
11
18
|
const coinbaseAvailablePaymentMethods = useMemo(() => {
|
|
12
19
|
if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
|
|
@@ -27,7 +34,7 @@ export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
27
34
|
isStripeOnrampSupported,
|
|
28
35
|
isStripeWeb2Supported,
|
|
29
36
|
isOnrampSupported: coinbaseAvailablePaymentMethods.length > 0 || isStripeOnrampSupported || isStripeWeb2Supported,
|
|
30
|
-
isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport,
|
|
37
|
+
isLoading: isLoadingGeo || isLoadingCoinbaseOnrampOptions || isLoadingStripeSupport || isLoadingVisitorData,
|
|
31
38
|
isLoadingGeo,
|
|
32
39
|
isLoadingCoinbaseOnrampOptions,
|
|
33
40
|
isLoadingStripeSupport,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VisitorData } from "../../../anyspend/types/fingerprint";
|
|
2
|
+
export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
2
3
|
isStripeOnrampSupported: boolean;
|
|
3
4
|
isStripeWeb2Supported: boolean;
|
|
4
5
|
isLoadingStripeSupport: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useStripeSupport(isMainnet, ipAddress, usdAmount) {
|
|
4
|
+
export function useStripeSupport(isMainnet, ipAddress, usdAmount, visitorData, isLoadingVisitorData) {
|
|
5
5
|
const { data, isLoading, error, refetch } = useQuery({
|
|
6
|
-
queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount],
|
|
7
|
-
queryFn: () => anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount),
|
|
8
|
-
enabled: !!ipAddress,
|
|
6
|
+
queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount, visitorData?.requestId, visitorData?.visitorId],
|
|
7
|
+
queryFn: () => anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount, visitorData),
|
|
8
|
+
enabled: !!ipAddress && !isLoadingVisitorData,
|
|
9
9
|
});
|
|
10
10
|
return useMemo(() => ({
|
|
11
11
|
isStripeOnrampSupported: data?.stripeOnramp || false,
|
|
@@ -16,9 +16,6 @@ export function StripeRedirectHandler() {
|
|
|
16
16
|
const fromStripe = url.searchParams.get("fromStripe");
|
|
17
17
|
const paymentIntent = url.searchParams.get("payment_intent");
|
|
18
18
|
const orderId = url.searchParams.get("orderId");
|
|
19
|
-
console.log("@@stripe-web2-payment:fromStripe:", fromStripe);
|
|
20
|
-
console.log("@@stripe-web2-payment:paymentIntent:", paymentIntent);
|
|
21
|
-
console.log("@@stripe-web2-payment:orderId:", orderId);
|
|
22
19
|
if (fromStripe && paymentIntent && orderId) {
|
|
23
20
|
// Re-open the modal with the order details
|
|
24
21
|
setB3ModalOpen(true);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OnrampOptions } from "../../anyspend/react";
|
|
2
|
-
import { GetCoinbaseOnrampOptionsResponse, GetOrderAndTxsResponse, GetOrderHistoryResponse, GetQuoteRequest, GetQuoteResponse } from "../types/api_req_res";
|
|
3
2
|
import { components } from "../types/api";
|
|
3
|
+
import { GetCoinbaseOnrampOptionsResponse, GetOrderAndTxsResponse, GetOrderHistoryResponse, GetQuoteRequest, GetQuoteResponse } from "../types/api_req_res";
|
|
4
|
+
import { VisitorData } from "../types/fingerprint";
|
|
4
5
|
export declare const anyspendService: {
|
|
5
6
|
getTokenList: (isMainnet: boolean, chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
|
|
6
7
|
getToken: (isMainnet: boolean, chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
|
|
7
8
|
getQuote: (isMainnet: boolean, req: GetQuoteRequest) => Promise<GetQuoteResponse>;
|
|
8
|
-
createOrder: ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, }: {
|
|
9
|
+
createOrder: ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, visitorData, }: {
|
|
9
10
|
isMainnet: boolean;
|
|
10
11
|
recipientAddress: string;
|
|
11
12
|
type: string;
|
|
@@ -19,6 +20,7 @@ export declare const anyspendService: {
|
|
|
19
20
|
metadata: Record<string, any>;
|
|
20
21
|
creatorAddress?: string;
|
|
21
22
|
partnerId?: string;
|
|
23
|
+
visitorData?: VisitorData;
|
|
22
24
|
}) => Promise<{
|
|
23
25
|
success: boolean;
|
|
24
26
|
message: string;
|
|
@@ -27,8 +29,8 @@ export declare const anyspendService: {
|
|
|
27
29
|
}>;
|
|
28
30
|
getOrderAndTransactions: (isMainnet: boolean, orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
|
|
29
31
|
getOrderHistory: (isMainnet: boolean, creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
|
|
30
|
-
getCoinbaseOnrampOptions: (isMainnet: boolean, country: string) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
31
|
-
checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string) => Promise<{
|
|
32
|
+
getCoinbaseOnrampOptions: (isMainnet: boolean, country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
33
|
+
checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData) => Promise<{
|
|
32
34
|
stripeOnramp: boolean;
|
|
33
35
|
stripeWeb2: boolean;
|
|
34
36
|
}>;
|
|
@@ -35,11 +35,13 @@ export const anyspendService = {
|
|
|
35
35
|
return data;
|
|
36
36
|
},
|
|
37
37
|
// Order related
|
|
38
|
-
createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, }) => {
|
|
38
|
+
createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, visitorData, }) => {
|
|
39
39
|
const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/orders`, {
|
|
40
40
|
method: "POST",
|
|
41
41
|
headers: {
|
|
42
42
|
"Content-Type": "application/json",
|
|
43
|
+
...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
|
|
44
|
+
...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
|
|
43
45
|
},
|
|
44
46
|
body: JSON.stringify({
|
|
45
47
|
recipientAddress,
|
|
@@ -77,20 +79,28 @@ export const anyspendService = {
|
|
|
77
79
|
const data = await response.json();
|
|
78
80
|
return data;
|
|
79
81
|
},
|
|
80
|
-
getCoinbaseOnrampOptions: async (isMainnet, country) => {
|
|
82
|
+
getCoinbaseOnrampOptions: async (isMainnet, country, visitorData) => {
|
|
81
83
|
const params = new URLSearchParams({
|
|
82
84
|
country,
|
|
85
|
+
// include fingerprintId and requestId in the query params
|
|
86
|
+
...(visitorData?.requestId && { requestId: visitorData.requestId }),
|
|
87
|
+
...(visitorData?.visitorId && { fingerprintId: visitorData.visitorId }),
|
|
83
88
|
});
|
|
84
89
|
const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/onramp/coinbase/options?${params.toString()}`);
|
|
85
90
|
const data = await response.json();
|
|
86
91
|
return data;
|
|
87
92
|
},
|
|
88
|
-
checkStripeSupport: async (isMainnet, ipAddress, usdAmount) => {
|
|
93
|
+
checkStripeSupport: async (isMainnet, ipAddress, usdAmount, visitorData) => {
|
|
89
94
|
const params = new URLSearchParams({
|
|
90
95
|
ipAddress,
|
|
91
96
|
usdAmount: usdAmount || "",
|
|
92
97
|
});
|
|
93
|
-
const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/onramp/stripe/supported?${params.toString()}
|
|
98
|
+
const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/onramp/stripe/supported?${params.toString()}`, {
|
|
99
|
+
headers: {
|
|
100
|
+
...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
|
|
101
|
+
...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
|
|
102
|
+
},
|
|
103
|
+
});
|
|
94
104
|
const data = await response.json();
|
|
95
105
|
invariant(response.status === 200, "Failed to check Stripe support");
|
|
96
106
|
return data.data;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types related to FingerprintJS integration
|
|
3
|
+
* We only need requestId and visitorId from the full FingerprintJS visitor data
|
|
4
|
+
*/
|
|
5
|
+
export interface VisitorData {
|
|
6
|
+
/**
|
|
7
|
+
* @description The unique identifier of the request to get visitor data
|
|
8
|
+
*/
|
|
9
|
+
requestId: string;
|
|
10
|
+
/**
|
|
11
|
+
* @description The unique identifier of the visitor
|
|
12
|
+
*/
|
|
13
|
+
visitorId: string;
|
|
14
|
+
}
|
|
@@ -4,7 +4,7 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
|
|
|
4
4
|
isAuthenticating: boolean;
|
|
5
5
|
isAuthenticated: boolean;
|
|
6
6
|
isReady: boolean;
|
|
7
|
-
wallet: import("thirdweb/wallets").
|
|
7
|
+
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
8
8
|
preAuthenticate: typeof preAuthenticate;
|
|
9
9
|
connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
|
|
10
10
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface FingerprintConfig {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
endpoint?: string;
|
|
5
|
+
scriptUrlPattern?: string;
|
|
6
|
+
}
|
|
7
|
+
interface AnySpendFingerprintWrapperProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
fingerprint?: FingerprintConfig;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Internal wrapper that only initializes FingerprintJS when AnySpend components are actually used.
|
|
13
|
+
* This prevents unnecessary fingerprinting of users who don't interact with AnySpend.
|
|
14
|
+
*/
|
|
15
|
+
export declare function AnySpendFingerprintWrapper({ children, fingerprint }: AnySpendFingerprintWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function getFingerprintConfig(): FingerprintConfig | undefined;
|
|
17
|
+
export {};
|
|
@@ -26,5 +26,5 @@ interface PanelOnrampPaymentProps {
|
|
|
26
26
|
recipientEnsName?: string;
|
|
27
27
|
recipientImageUrl?: string;
|
|
28
28
|
}
|
|
29
|
-
export declare function PanelOnrampPayment(
|
|
29
|
+
export declare function PanelOnrampPayment(props: PanelOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
export {};
|
|
@@ -2,6 +2,7 @@ export { AnySpend } from "./AnySpend";
|
|
|
2
2
|
export { AnySpendBondKit } from "./AnySpendBondKit";
|
|
3
3
|
export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
4
4
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
5
|
+
export * from "./AnySpendFingerprintWrapper";
|
|
5
6
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
6
7
|
export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
|
|
7
8
|
export { AnySpendStakeB3 } from "./AnySpendStakeB3";
|
|
@@ -9,5 +9,5 @@ interface WebviewOnrampPaymentProps {
|
|
|
9
9
|
onPaymentSuccess: (orderId: string) => void;
|
|
10
10
|
userId?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function WebviewOnrampPayment(
|
|
12
|
+
export declare function WebviewOnrampPayment(props: WebviewOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
2
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
3
3
|
export type OnrampOptions = {
|
|
4
4
|
vendor: components["schemas"]["OnrampMetadata"]["vendor"];
|
|
5
5
|
paymentMethod: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
2
|
+
export declare function useCoinbaseOnrampOptions(isMainnet: boolean, country?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
2
3
|
coinbaseOnrampOptions: {
|
|
3
4
|
paymentCurrencies: {
|
|
4
5
|
id?: string;
|
|
@@ -33,7 +33,7 @@ export declare function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: s
|
|
|
33
33
|
isStripeOnrampSupported: boolean;
|
|
34
34
|
isStripeWeb2Supported: boolean;
|
|
35
35
|
isOnrampSupported: boolean;
|
|
36
|
-
isLoading: boolean;
|
|
36
|
+
isLoading: boolean | undefined;
|
|
37
37
|
isLoadingGeo: boolean;
|
|
38
38
|
isLoadingCoinbaseOnrampOptions: boolean;
|
|
39
39
|
isLoadingStripeSupport: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
2
|
+
export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
2
3
|
isStripeOnrampSupported: boolean;
|
|
3
4
|
isStripeWeb2Supported: boolean;
|
|
4
5
|
isLoadingStripeSupport: boolean;
|