@b3dotfun/sdk 0.0.62 → 0.0.63-alpha.1
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.js +61 -23
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +275 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +5 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +288 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +33 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +4 -6
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +66 -147
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +39 -15
- package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/index.js +11 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +42 -19
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
- package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +56 -0
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +73 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +57 -0
- package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
- package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +211 -0
- package/dist/cjs/anyspend/types/api.d.ts +665 -3
- package/dist/cjs/anyspend/utils/orderPayload.js +4 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +17 -4
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +3 -3
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +141 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/cjs/global-account/react/components/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/index.js +7 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/index.js +5 -3
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +6 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +62 -0
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +4 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +37 -1
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +6 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.js +60 -4
- package/dist/esm/anyspend/react/components/AnySpend.js +62 -24
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +269 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +7 -6
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +285 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +30 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +4 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +5 -7
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +67 -148
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +40 -16
- package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +5 -1
- package/dist/esm/anyspend/react/components/index.js +5 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +42 -19
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
- package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +53 -0
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +70 -0
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +54 -0
- package/dist/esm/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
- package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +208 -0
- package/dist/esm/anyspend/types/api.d.ts +665 -3
- package/dist/esm/anyspend/utils/orderPayload.js +4 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +18 -5
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +3 -3
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +6 -0
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +135 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/index.js +3 -0
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/index.js +2 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useSimBalance.js +6 -5
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +59 -0
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +4 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +37 -1
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +6 -0
- package/dist/esm/global-account/react/utils/profileDisplay.js +59 -4
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
- package/dist/types/anyspend/react/components/index.d.ts +5 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
- package/dist/types/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
- package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
- package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
- package/dist/types/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
- package/dist/types/anyspend/types/api.d.ts +665 -3
- package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +6 -0
- package/dist/types/global-account/react/components/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +37 -1
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +6 -0
- package/package.json +4 -3
- package/src/anyspend/react/components/AnySpend.tsx +73 -22
- package/src/anyspend/react/components/AnySpendCustom.tsx +4 -0
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +595 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +8 -11
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +522 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +73 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +7 -3
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +5 -7
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +9 -18
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +22 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +76 -190
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -3
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +48 -17
- package/src/anyspend/react/components/common/PaySection.tsx +1 -0
- package/src/anyspend/react/components/common/TokenBalance.tsx +2 -2
- package/src/anyspend/react/components/index.ts +5 -1
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +51 -18
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.ts +72 -0
- package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +80 -0
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +69 -0
- package/src/anyspend/react/hooks/usePhantomTransfer.ts +301 -0
- package/src/anyspend/types/api.ts +669 -1
- package/src/anyspend/utils/orderPayload.ts +5 -1
- package/src/global-account/react/components/B3DynamicModal.tsx +18 -4
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +4 -4
- package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +265 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +3 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/index.ts +4 -0
- package/src/global-account/react/hooks/index.ts +2 -1
- package/src/global-account/react/hooks/useAuthentication.ts +10 -2
- package/src/global-account/react/hooks/useSimBalance.ts +6 -5
- package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +84 -0
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +6 -5
- package/src/global-account/react/stores/useModalStore.ts +43 -1
- package/src/global-account/react/utils/profileDisplay.ts +67 -4
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
2
|
+
const debug = debugB3React("profileDisplay");
|
|
3
|
+
/**
|
|
4
|
+
* Validates that an image URL uses an allowed schema
|
|
5
|
+
* @param url - The URL to validate
|
|
6
|
+
* @returns The URL if valid, null otherwise
|
|
7
|
+
*/
|
|
8
|
+
export function validateImageUrl(url) {
|
|
9
|
+
if (!url)
|
|
10
|
+
return null;
|
|
11
|
+
try {
|
|
12
|
+
// For blob URLs (from createObjectURL)
|
|
13
|
+
if (url.startsWith("blob:")) {
|
|
14
|
+
return url;
|
|
15
|
+
}
|
|
16
|
+
// For IPFS protocol URLs
|
|
17
|
+
if (url.startsWith("ipfs://")) {
|
|
18
|
+
return url;
|
|
19
|
+
}
|
|
20
|
+
// Parse URL to validate protocol and hostname
|
|
21
|
+
const parsedUrl = new URL(url);
|
|
22
|
+
// Only allow http and https protocols
|
|
23
|
+
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
24
|
+
debug("Rejected unsafe protocol:", parsedUrl.protocol, url);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
// Whitelist of allowed IPFS gateway hostnames
|
|
28
|
+
const allowedIpfsGateways = [
|
|
29
|
+
"ipfs.io",
|
|
30
|
+
"gateway.pinata.cloud",
|
|
31
|
+
"cloudflare-ipfs.com",
|
|
32
|
+
"dweb.link",
|
|
33
|
+
"nftstorage.link",
|
|
34
|
+
"w3s.link",
|
|
35
|
+
];
|
|
36
|
+
// Check if hostname matches allowed IPFS gateways
|
|
37
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
38
|
+
const isAllowedIpfsGateway = allowedIpfsGateways.some(gateway => {
|
|
39
|
+
// Exact match or subdomain of the gateway
|
|
40
|
+
return hostname === gateway || hostname.endsWith(`.${gateway}`);
|
|
41
|
+
});
|
|
42
|
+
if (isAllowedIpfsGateway) {
|
|
43
|
+
return url;
|
|
44
|
+
}
|
|
45
|
+
// For standard HTTP(S) URLs from trusted sources
|
|
46
|
+
// Add additional hostname validation here if needed
|
|
47
|
+
// For now, allow all HTTP(S) URLs (can be restricted further if needed)
|
|
48
|
+
return url;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
// Invalid URL format
|
|
52
|
+
debug("Invalid image URL format:", url, error);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
1
56
|
export function getProfileDisplayInfo(profile) {
|
|
2
57
|
const { type, details } = profile;
|
|
3
58
|
// Default display info
|
|
@@ -14,7 +69,7 @@ export function getProfileDisplayInfo(profile) {
|
|
|
14
69
|
displayInfo = {
|
|
15
70
|
title: details.name || details.username || "Unknown",
|
|
16
71
|
subtitle: details.username ? `@${details.username}` : "X Account",
|
|
17
|
-
imageUrl: details.profileImageUrl
|
|
72
|
+
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
18
73
|
initial: "X",
|
|
19
74
|
type,
|
|
20
75
|
};
|
|
@@ -23,7 +78,7 @@ export function getProfileDisplayInfo(profile) {
|
|
|
23
78
|
displayInfo = {
|
|
24
79
|
title: details.name || details.username || "Unknown",
|
|
25
80
|
subtitle: details.username ? `@${details.username}` : "Farcaster Account",
|
|
26
|
-
imageUrl: details.profileImageUrl
|
|
81
|
+
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
27
82
|
initial: "F",
|
|
28
83
|
type,
|
|
29
84
|
};
|
|
@@ -32,7 +87,7 @@ export function getProfileDisplayInfo(profile) {
|
|
|
32
87
|
displayInfo = {
|
|
33
88
|
title: details.name || details.email || "Unknown",
|
|
34
89
|
subtitle: details.email || "Google Account",
|
|
35
|
-
imageUrl: details.profileImageUrl
|
|
90
|
+
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
36
91
|
initial: "G",
|
|
37
92
|
type,
|
|
38
93
|
};
|
|
@@ -41,7 +96,7 @@ export function getProfileDisplayInfo(profile) {
|
|
|
41
96
|
displayInfo = {
|
|
42
97
|
title: details.username || details.name || "Unknown",
|
|
43
98
|
subtitle: "Discord Account",
|
|
44
|
-
imageUrl: details.profileImageUrl
|
|
99
|
+
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
45
100
|
initial: "D",
|
|
46
101
|
type,
|
|
47
102
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
3
|
+
type CustomExactInConfig = {
|
|
4
|
+
functionAbi: string;
|
|
5
|
+
functionName: string;
|
|
6
|
+
functionArgs: string[];
|
|
7
|
+
to: string;
|
|
8
|
+
spenderAddress?: string;
|
|
9
|
+
action?: string;
|
|
10
|
+
};
|
|
11
|
+
export interface AnySpendCustomExactInProps {
|
|
12
|
+
loadOrder?: string;
|
|
13
|
+
mode?: "modal" | "page";
|
|
14
|
+
recipientAddress: string;
|
|
15
|
+
paymentType?: "crypto" | "fiat";
|
|
16
|
+
sourceTokenAddress?: string;
|
|
17
|
+
sourceTokenChainId?: number;
|
|
18
|
+
destinationToken: components["schemas"]["Token"];
|
|
19
|
+
destinationChainId: number;
|
|
20
|
+
onSuccess?: (amount: string) => void;
|
|
21
|
+
mainFooter?: React.ReactNode;
|
|
22
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
23
|
+
preventDefault: () => void;
|
|
24
|
+
}) => void;
|
|
25
|
+
customUsdInputValues?: string[];
|
|
26
|
+
preferEoa?: boolean;
|
|
27
|
+
customExactInConfig: CustomExactInConfig;
|
|
28
|
+
header?: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
|
|
29
|
+
anyspendPrice: GetQuoteResponse | undefined;
|
|
30
|
+
isLoadingAnyspendPrice: boolean;
|
|
31
|
+
}) => React.JSX.Element;
|
|
32
|
+
}
|
|
33
|
+
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
|
|
2
|
+
loadOrder?: string;
|
|
3
|
+
mode?: "modal" | "page";
|
|
4
|
+
sourceTokenAddress?: string;
|
|
5
|
+
sourceTokenChainId?: number;
|
|
6
|
+
recipientAddress: string;
|
|
7
|
+
stakeAmount?: string;
|
|
8
|
+
onSuccess?: (amount: string) => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
|
|
3
|
+
loadOrder?: string;
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
8
|
+
stakingContractAddress: string;
|
|
9
|
+
token: components["schemas"]["Token"];
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { components } from "../../../types/api";
|
|
2
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
3
|
interface CryptoReceiveSectionProps {
|
|
3
4
|
isDepositMode?: boolean;
|
|
4
5
|
isBuyMode?: boolean;
|
|
5
6
|
selectedRecipientAddress?: string;
|
|
6
7
|
recipientName?: string;
|
|
7
8
|
onSelectRecipient: () => void;
|
|
9
|
+
setRecipientAddress?: (address: string | undefined) => void;
|
|
10
|
+
recipientAddressFromProps?: string;
|
|
11
|
+
globalAddress?: string;
|
|
8
12
|
dstAmount: string;
|
|
9
13
|
dstToken: components["schemas"]["Token"];
|
|
10
14
|
selectedDstChainId?: number;
|
|
@@ -17,6 +21,7 @@ interface CryptoReceiveSectionProps {
|
|
|
17
21
|
dstTokenLogoURI?: string;
|
|
18
22
|
onShowPointsDetail?: () => void;
|
|
19
23
|
onShowFeeDetail?: () => void;
|
|
24
|
+
selectedCryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
20
25
|
}
|
|
21
|
-
export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, selectedRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function CryptoReceiveSection({ isDepositMode, isBuyMode, selectedRecipientAddress, recipientName, onSelectRecipient, setRecipientAddress, recipientAddressFromProps, globalAddress, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, selectedCryptoPaymentMethod, }: CryptoReceiveSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
22
27
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
-
export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }: {
|
|
2
|
+
export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, walletAddress, }: {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
inputValue: string;
|
|
5
5
|
onChangeInput: (value: string) => void;
|
|
@@ -18,4 +18,5 @@ export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput,
|
|
|
18
18
|
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
19
19
|
preventDefault: () => void;
|
|
20
20
|
}) => void;
|
|
21
|
+
walletAddress?: string | undefined;
|
|
21
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,11 +2,15 @@ export { AnySpend } from "./AnySpend";
|
|
|
2
2
|
export { AnySpendBondKit } from "./AnySpendBondKit";
|
|
3
3
|
export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
4
4
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
5
|
+
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
5
6
|
export * from "./AnySpendFingerprintWrapper";
|
|
6
7
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
8
|
+
export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
|
|
7
9
|
export { AnySpendStakeB3 } from "./AnySpendStakeB3";
|
|
10
|
+
export { AnySpendStakeB3ExactIn } from "./AnySpendStakeB3ExactIn";
|
|
11
|
+
export { AnySpendStakeUpside } from "./AnySpendStakeUpside";
|
|
12
|
+
export { AnySpendStakeUpsideExactIn } from "./AnySpendStakeUpsideExactIn";
|
|
8
13
|
export { AnySpendTournament } from "./AnySpendTournament";
|
|
9
|
-
export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
|
|
10
14
|
export { AnySpendNFTButton } from "./common/AnySpendNFTButton";
|
|
11
15
|
export { ChainTokenIcon } from "./common/ChainTokenIcon";
|
|
12
16
|
export { CryptoPaySection } from "./common/CryptoPaySection";
|
|
@@ -17,13 +17,16 @@ interface UseAnyspendFlowProps {
|
|
|
17
17
|
loadOrder?: string;
|
|
18
18
|
isDepositMode?: boolean;
|
|
19
19
|
onOrderSuccess?: (orderId: string) => void;
|
|
20
|
-
onTransactionSuccess?: (amount
|
|
20
|
+
onTransactionSuccess?: (amount: string) => void;
|
|
21
21
|
sourceTokenAddress?: string;
|
|
22
22
|
sourceTokenChainId?: number;
|
|
23
|
+
destinationTokenAddress?: string;
|
|
24
|
+
destinationTokenChainId?: number;
|
|
23
25
|
slippage?: number;
|
|
24
26
|
disableUrlParamManagement?: boolean;
|
|
27
|
+
orderType?: "hype_duel" | "custom_exact_in";
|
|
25
28
|
}
|
|
26
|
-
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, isDepositMode, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, slippage, disableUrlParamManagement, }: UseAnyspendFlowProps): {
|
|
29
|
+
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, isDepositMode, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
|
|
27
30
|
activePanel: PanelView;
|
|
28
31
|
setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
|
|
29
32
|
orderId: string | undefined;
|
|
@@ -44,7 +47,6 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
44
47
|
selectedSrcChainId: number;
|
|
45
48
|
setSelectedSrcChainId: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
46
49
|
selectedDstChainId: number;
|
|
47
|
-
setSelectedDstChainId: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
48
50
|
selectedSrcToken: {
|
|
49
51
|
chainId: number;
|
|
50
52
|
address: string;
|
|
@@ -65,6 +67,26 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
65
67
|
logoURI?: string;
|
|
66
68
|
};
|
|
67
69
|
}>>;
|
|
70
|
+
selectedDstToken: {
|
|
71
|
+
chainId: number;
|
|
72
|
+
address: string;
|
|
73
|
+
symbol: string;
|
|
74
|
+
name: string;
|
|
75
|
+
decimals: number;
|
|
76
|
+
metadata: {
|
|
77
|
+
logoURI?: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
setSelectedDstToken: import("react").Dispatch<import("react").SetStateAction<{
|
|
81
|
+
chainId: number;
|
|
82
|
+
address: string;
|
|
83
|
+
symbol: string;
|
|
84
|
+
name: string;
|
|
85
|
+
decimals: number;
|
|
86
|
+
metadata: {
|
|
87
|
+
logoURI?: string;
|
|
88
|
+
};
|
|
89
|
+
}>>;
|
|
68
90
|
srcAmount: string;
|
|
69
91
|
setSrcAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
70
92
|
dstAmount: string;
|
|
@@ -53,6 +53,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
53
53
|
relay?: Record<string, never>;
|
|
54
54
|
} | null;
|
|
55
55
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
56
|
+
} & {
|
|
57
|
+
type: "x402_swap";
|
|
58
|
+
payload: import("../..").components["schemas"]["X402SwapPayload"];
|
|
59
|
+
metadata: import("../..").components["schemas"]["X402SwapMetadata"];
|
|
60
|
+
}) | ({
|
|
61
|
+
id: string;
|
|
62
|
+
recipientAddress: string;
|
|
63
|
+
globalAddress: string;
|
|
64
|
+
srcChain: number;
|
|
65
|
+
dstChain: number;
|
|
66
|
+
srcTokenAddress: string;
|
|
67
|
+
dstTokenAddress: string;
|
|
68
|
+
srcAmount: string;
|
|
69
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
70
|
+
errorDetails: string | null;
|
|
71
|
+
createdAt: number;
|
|
72
|
+
expiredAt: number;
|
|
73
|
+
filledAt: number | null;
|
|
74
|
+
receivedDepositAt: number | null;
|
|
75
|
+
creatorAddress: string | null;
|
|
76
|
+
partnerId: string | null;
|
|
77
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
78
|
+
oneClickBuyUrl: string | null;
|
|
79
|
+
stripePaymentIntentId: string | null;
|
|
80
|
+
settlement: {
|
|
81
|
+
actualDstAmount?: string;
|
|
82
|
+
relay?: Record<string, never>;
|
|
83
|
+
} | null;
|
|
84
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
56
85
|
} & {
|
|
57
86
|
type: "hype_duel";
|
|
58
87
|
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
@@ -111,6 +140,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
111
140
|
relay?: Record<string, never>;
|
|
112
141
|
} | null;
|
|
113
142
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
143
|
+
} & {
|
|
144
|
+
type: "custom_exact_in";
|
|
145
|
+
payload: import("../..").components["schemas"]["CustomExactInPayload"];
|
|
146
|
+
metadata: import("../..").components["schemas"]["CustomMetadata"];
|
|
147
|
+
}) | ({
|
|
148
|
+
id: string;
|
|
149
|
+
recipientAddress: string;
|
|
150
|
+
globalAddress: string;
|
|
151
|
+
srcChain: number;
|
|
152
|
+
dstChain: number;
|
|
153
|
+
srcTokenAddress: string;
|
|
154
|
+
dstTokenAddress: string;
|
|
155
|
+
srcAmount: string;
|
|
156
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
157
|
+
errorDetails: string | null;
|
|
158
|
+
createdAt: number;
|
|
159
|
+
expiredAt: number;
|
|
160
|
+
filledAt: number | null;
|
|
161
|
+
receivedDepositAt: number | null;
|
|
162
|
+
creatorAddress: string | null;
|
|
163
|
+
partnerId: string | null;
|
|
164
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
165
|
+
oneClickBuyUrl: string | null;
|
|
166
|
+
stripePaymentIntentId: string | null;
|
|
167
|
+
settlement: {
|
|
168
|
+
actualDstAmount?: string;
|
|
169
|
+
relay?: Record<string, never>;
|
|
170
|
+
} | null;
|
|
171
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
114
172
|
} & {
|
|
115
173
|
type: "mint_nft";
|
|
116
174
|
payload: import("../..").components["schemas"]["MintNftPayload"];
|
|
@@ -230,6 +288,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
230
288
|
relay?: Record<string, never>;
|
|
231
289
|
} | null;
|
|
232
290
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
291
|
+
} & {
|
|
292
|
+
type: "x402_swap";
|
|
293
|
+
payload: import("../..").components["schemas"]["X402SwapPayload"];
|
|
294
|
+
metadata: import("../..").components["schemas"]["X402SwapMetadata"];
|
|
295
|
+
}) | ({
|
|
296
|
+
id: string;
|
|
297
|
+
recipientAddress: string;
|
|
298
|
+
globalAddress: string;
|
|
299
|
+
srcChain: number;
|
|
300
|
+
dstChain: number;
|
|
301
|
+
srcTokenAddress: string;
|
|
302
|
+
dstTokenAddress: string;
|
|
303
|
+
srcAmount: string;
|
|
304
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
305
|
+
errorDetails: string | null;
|
|
306
|
+
createdAt: number;
|
|
307
|
+
expiredAt: number;
|
|
308
|
+
filledAt: number | null;
|
|
309
|
+
receivedDepositAt: number | null;
|
|
310
|
+
creatorAddress: string | null;
|
|
311
|
+
partnerId: string | null;
|
|
312
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
313
|
+
oneClickBuyUrl: string | null;
|
|
314
|
+
stripePaymentIntentId: string | null;
|
|
315
|
+
settlement: {
|
|
316
|
+
actualDstAmount?: string;
|
|
317
|
+
relay?: Record<string, never>;
|
|
318
|
+
} | null;
|
|
319
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
233
320
|
} & {
|
|
234
321
|
type: "hype_duel";
|
|
235
322
|
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
@@ -288,6 +375,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
288
375
|
relay?: Record<string, never>;
|
|
289
376
|
} | null;
|
|
290
377
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
378
|
+
} & {
|
|
379
|
+
type: "custom_exact_in";
|
|
380
|
+
payload: import("../..").components["schemas"]["CustomExactInPayload"];
|
|
381
|
+
metadata: import("../..").components["schemas"]["CustomMetadata"];
|
|
382
|
+
}) | ({
|
|
383
|
+
id: string;
|
|
384
|
+
recipientAddress: string;
|
|
385
|
+
globalAddress: string;
|
|
386
|
+
srcChain: number;
|
|
387
|
+
dstChain: number;
|
|
388
|
+
srcTokenAddress: string;
|
|
389
|
+
dstTokenAddress: string;
|
|
390
|
+
srcAmount: string;
|
|
391
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
392
|
+
errorDetails: string | null;
|
|
393
|
+
createdAt: number;
|
|
394
|
+
expiredAt: number;
|
|
395
|
+
filledAt: number | null;
|
|
396
|
+
receivedDepositAt: number | null;
|
|
397
|
+
creatorAddress: string | null;
|
|
398
|
+
partnerId: string | null;
|
|
399
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
400
|
+
oneClickBuyUrl: string | null;
|
|
401
|
+
stripePaymentIntentId: string | null;
|
|
402
|
+
settlement: {
|
|
403
|
+
actualDstAmount?: string;
|
|
404
|
+
relay?: Record<string, never>;
|
|
405
|
+
} | null;
|
|
406
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
291
407
|
} & {
|
|
292
408
|
type: "mint_nft";
|
|
293
409
|
payload: import("../..").components["schemas"]["MintNftPayload"];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
|
|
2
|
+
interface UseAutoSelectCryptoPaymentMethodParams {
|
|
3
|
+
/** Current payment type (crypto or fiat) */
|
|
4
|
+
paymentType?: "crypto" | "fiat";
|
|
5
|
+
/** Currently selected payment method */
|
|
6
|
+
selectedCryptoPaymentMethod: CryptoPaymentMethodType;
|
|
7
|
+
/** Function to update the selected payment method */
|
|
8
|
+
setSelectedCryptoPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
9
|
+
/** Whether user has enough balance to pay */
|
|
10
|
+
hasEnoughBalance: boolean;
|
|
11
|
+
/** Whether balance is still loading */
|
|
12
|
+
isBalanceLoading: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Custom hook to automatically select appropriate crypto payment method
|
|
16
|
+
* based on available wallets and balance.
|
|
17
|
+
*
|
|
18
|
+
* Auto-selection logic:
|
|
19
|
+
* - Only auto-selects when payment method is NONE (doesn't override user choices)
|
|
20
|
+
* - If EOA/Wagmi wallet connected + has balance → CONNECT_WALLET
|
|
21
|
+
* - If EOA/Wagmi wallet connected + insufficient balance → TRANSFER_CRYPTO
|
|
22
|
+
* - If only Global wallet available → GLOBAL_WALLET
|
|
23
|
+
* - If no wallets → remains NONE
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAutoSelectCryptoPaymentMethod({ paymentType, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, hasEnoughBalance, isBalanceLoading, }: UseAutoSelectCryptoPaymentMethodParams): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that automatically sets the active thirdweb wallet when a wagmi wallet connects.
|
|
3
|
+
*
|
|
4
|
+
* This is useful for syncing wagmi wallet connections with thirdweb's wallet system,
|
|
5
|
+
* ensuring that when users connect via wagmi, the active wallet is properly set.
|
|
6
|
+
*
|
|
7
|
+
* Place this hook in components that stay mounted throughout the user flow
|
|
8
|
+
* (not in components that unmount during navigation).
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAutoSetActiveWalletFromWagmi(): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
|
|
2
|
+
interface UseConnectedWalletDisplayResult {
|
|
3
|
+
walletAddress: string | undefined;
|
|
4
|
+
shouldShowConnectedEOA: boolean;
|
|
5
|
+
shouldShowWagmiWallet: boolean;
|
|
6
|
+
isWalletDuplicated: boolean;
|
|
7
|
+
suggestedPaymentMethod: CryptoPaymentMethodType;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Custom hook to determine which wallet to display and its address
|
|
11
|
+
* Handles logic for showing EOA wallet, wagmi wallet, or global wallet based on payment method
|
|
12
|
+
*/
|
|
13
|
+
export declare function useConnectedWalletDisplay(selectedCryptoPaymentMethod?: CryptoPaymentMethodType): UseConnectedWalletDisplayResult;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface UsePhantomTransferParams {
|
|
2
|
+
/** RPC endpoint URL for Solana network */
|
|
3
|
+
rpcEndpoint?: string;
|
|
4
|
+
}
|
|
5
|
+
interface PhantomTransferParams {
|
|
6
|
+
/** Amount in lamports (for SOL) or smallest token unit (for SPL tokens) */
|
|
7
|
+
amountLamports: string;
|
|
8
|
+
/** Token address (use "11111111111111111111111111111111" for native SOL) */
|
|
9
|
+
tokenAddress: string;
|
|
10
|
+
/** Recipient address */
|
|
11
|
+
recipientAddress: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Custom hook for handling Phantom wallet transfers on Solana.
|
|
15
|
+
* Supports both native SOL and SPL token transfers with automatic priority fee calculation.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { initiateTransfer, isPhantomAvailable } = usePhantomTransfer();
|
|
20
|
+
*
|
|
21
|
+
* await initiateTransfer({
|
|
22
|
+
* amountLamports: "1000000000", // 1 SOL
|
|
23
|
+
* tokenAddress: "11111111111111111111111111111111",
|
|
24
|
+
* recipientAddress: "..."
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function usePhantomTransfer({ rpcEndpoint }?: UsePhantomTransferParams): {
|
|
29
|
+
/** Function to initiate a transfer */
|
|
30
|
+
initiateTransfer: ({ amountLamports, tokenAddress, recipientAddress }: PhantomTransferParams) => Promise<void>;
|
|
31
|
+
/** Whether Phantom wallet is available (installed) */
|
|
32
|
+
isPhantomAvailable: any;
|
|
33
|
+
/** Get the currently connected Phantom wallet address */
|
|
34
|
+
getConnectedAddress: () => any;
|
|
35
|
+
};
|
|
36
|
+
export {};
|