@b3dotfun/sdk 0.0.62-alpha.2 → 0.0.62-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.
Files changed (129) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +61 -23
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -0
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +276 -0
  5. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +288 -0
  7. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +9 -0
  8. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +33 -0
  9. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -4
  10. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +4 -6
  11. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
  12. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
  13. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
  14. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +66 -147
  15. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
  16. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
  17. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +39 -15
  18. package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
  19. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
  20. package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
  21. package/dist/cjs/anyspend/react/components/index.js +11 -3
  22. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +24 -2
  23. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +41 -18
  24. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  25. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  26. package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
  27. package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +56 -0
  28. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
  29. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +73 -0
  30. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
  31. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +57 -0
  32. package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
  33. package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +211 -0
  34. package/dist/cjs/anyspend/types/api.d.ts +665 -3
  35. package/dist/cjs/anyspend/utils/orderPayload.js +4 -0
  36. package/dist/cjs/global-account/react/components/B3DynamicModal.js +10 -1
  37. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
  38. package/dist/cjs/global-account/react/hooks/index.js +5 -3
  39. package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
  40. package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +62 -0
  41. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +4 -3
  42. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +31 -1
  43. package/dist/esm/anyspend/react/components/AnySpend.js +62 -24
  44. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -0
  45. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  46. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +270 -0
  47. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -0
  48. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +285 -0
  49. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +9 -0
  50. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +30 -0
  51. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +4 -4
  52. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +5 -7
  53. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
  54. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
  55. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
  56. package/dist/esm/anyspend/react/components/common/OrderDetails.js +67 -148
  57. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
  58. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
  59. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +40 -16
  60. package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
  61. package/dist/esm/anyspend/react/components/common/TokenBalance.js +2 -2
  62. package/dist/esm/anyspend/react/components/index.d.ts +5 -1
  63. package/dist/esm/anyspend/react/components/index.js +5 -1
  64. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +24 -2
  65. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +41 -18
  66. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  67. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  68. package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
  69. package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +53 -0
  70. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
  71. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +70 -0
  72. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
  73. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +54 -0
  74. package/dist/esm/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
  75. package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +208 -0
  76. package/dist/esm/anyspend/types/api.d.ts +665 -3
  77. package/dist/esm/anyspend/utils/orderPayload.js +4 -0
  78. package/dist/esm/global-account/react/components/B3DynamicModal.js +11 -2
  79. package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
  80. package/dist/esm/global-account/react/hooks/index.js +2 -1
  81. package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
  82. package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +59 -0
  83. package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +4 -3
  84. package/dist/esm/global-account/react/stores/useModalStore.d.ts +31 -1
  85. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  86. package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +7 -0
  87. package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +9 -0
  88. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
  89. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
  90. package/dist/types/anyspend/react/components/index.d.ts +5 -1
  91. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +24 -2
  92. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  93. package/dist/types/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
  94. package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
  95. package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
  96. package/dist/types/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
  97. package/dist/types/anyspend/types/api.d.ts +665 -3
  98. package/dist/types/global-account/react/hooks/index.d.ts +2 -1
  99. package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
  100. package/dist/types/global-account/react/stores/useModalStore.d.ts +31 -1
  101. package/package.json +1 -1
  102. package/src/anyspend/react/components/AnySpend.tsx +73 -22
  103. package/src/anyspend/react/components/AnySpendCustom.tsx +4 -0
  104. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +596 -0
  105. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +516 -0
  106. package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +67 -0
  107. package/src/anyspend/react/components/AnyspendDepositHype.tsx +7 -3
  108. package/src/anyspend/react/components/common/CryptoPaySection.tsx +5 -7
  109. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +9 -18
  110. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +22 -0
  111. package/src/anyspend/react/components/common/OrderDetails.tsx +76 -190
  112. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -3
  113. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +48 -17
  114. package/src/anyspend/react/components/common/PaySection.tsx +1 -0
  115. package/src/anyspend/react/components/common/TokenBalance.tsx +2 -2
  116. package/src/anyspend/react/components/index.ts +5 -1
  117. package/src/anyspend/react/hooks/useAnyspendFlow.ts +49 -16
  118. package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
  119. package/src/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.ts +72 -0
  120. package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +80 -0
  121. package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +69 -0
  122. package/src/anyspend/react/hooks/usePhantomTransfer.ts +301 -0
  123. package/src/anyspend/types/api.ts +669 -1
  124. package/src/anyspend/utils/orderPayload.ts +5 -1
  125. package/src/global-account/react/components/B3DynamicModal.tsx +11 -1
  126. package/src/global-account/react/hooks/index.ts +2 -1
  127. package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +84 -0
  128. package/src/global-account/react/hooks/useTokenFromUrl.tsx +6 -5
  129. package/src/global-account/react/stores/useModalStore.ts +34 -0
@@ -38,6 +38,8 @@ export const buildPayload = (orderType, params) => {
38
38
  };
39
39
  case "custom":
40
40
  return { ...payload };
41
+ case "custom_exact_in":
42
+ return { ...payload, expectedDstAmount };
41
43
  case "hype_duel":
42
44
  return {
43
45
  expectedDstAmount,
@@ -62,6 +64,8 @@ export const buildMetadata = (orderType, params) => {
62
64
  return { ...baseMetadata, tournament };
63
65
  case "custom":
64
66
  return { ...baseMetadata, action: payload.action };
67
+ case "custom_exact_in":
68
+ return { ...baseMetadata, action: payload.action };
65
69
  case "hype_duel":
66
70
  return { ...baseMetadata };
67
71
  default:
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AnySpend, AnySpendBondKit, AnySpendBuySpin, AnySpendNFT, AnyspendSignatureMint, AnySpendStakeB3, AnySpendTournament, OrderHistory, } from "../../../anyspend/react/index.js";
2
+ import { AnySpend, AnySpendBondKit, AnySpendBuySpin, AnySpendNFT, AnyspendSignatureMint, AnySpendStakeB3, AnySpendStakeB3ExactIn, AnySpendTournament, OrderHistory, } from "../../../anyspend/react/index.js";
3
3
  import { AnySpendDepositHype } from "../../../anyspend/react/components/AnyspendDepositHype.js";
4
4
  import { AnySpendStakeUpside } from "../../../anyspend/react/components/AnySpendStakeUpside.js";
5
+ import { AnySpendStakeUpsideExactIn } from "../../../anyspend/react/components/AnySpendStakeUpsideExactIn.js";
5
6
  import { useGlobalWalletState } from "../../../anyspend/utils/index.js";
6
7
  import { useIsMobile, useModalStore } from "../../../global-account/react/index.js";
7
8
  import { cn } from "../../../shared/utils/cn.js";
8
9
  import { debugB3React } from "../../../shared/utils/debug.js";
9
10
  import { useEffect, useRef } from "react";
11
+ import { useSetActiveWallet } from "thirdweb/react";
10
12
  import { AvatarEditor } from "./AvatarEditor/AvatarEditor.js";
11
13
  import { useB3 } from "./B3Provider/useB3.js";
12
14
  import { LinkAccount } from "./LinkAccount/LinkAccount.js";
@@ -15,7 +17,6 @@ import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
15
17
  import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
16
18
  import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog.js";
17
19
  import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer.js";
18
- import { useSetActiveWallet } from "thirdweb/react";
19
20
  const debug = debugB3React("B3DynamicModal");
20
21
  export function B3DynamicModal() {
21
22
  const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = useModalStore();
@@ -42,7 +43,9 @@ export function B3DynamicModal() {
42
43
  "anySpendJoinTournament",
43
44
  "anySpendFundTournament",
44
45
  "anySpendStakeB3",
46
+ "anySpendStakeB3ExactIn",
45
47
  "anySpendStakeUpside",
48
+ "anySpendStakeUpsideExactIn",
46
49
  "anySpendBuySpin",
47
50
  "anySpendOrderHistory",
48
51
  "signInWithB3",
@@ -56,7 +59,9 @@ export function B3DynamicModal() {
56
59
  "anySpendJoinTournament",
57
60
  "anySpendFundTournament",
58
61
  "anySpendStakeB3",
62
+ "anySpendStakeB3ExactIn",
59
63
  "anySpendStakeUpside",
64
+ "anySpendStakeUpsideExactIn",
60
65
  "anySpendBuySpin",
61
66
  "anySpendSignatureMint",
62
67
  "anySpendBondKit",
@@ -92,8 +97,12 @@ export function B3DynamicModal() {
92
97
  return _jsx(OrderHistory, { onBack: () => { }, mode: "modal" });
93
98
  case "anySpendStakeB3":
94
99
  return _jsx(AnySpendStakeB3, { ...contentType, mode: "modal" });
100
+ case "anySpendStakeB3ExactIn":
101
+ return _jsx(AnySpendStakeB3ExactIn, { ...contentType, mode: "modal" });
95
102
  case "anySpendStakeUpside":
96
103
  return _jsx(AnySpendStakeUpside, { ...contentType, mode: "modal" });
104
+ case "anySpendStakeUpsideExactIn":
105
+ return _jsx(AnySpendStakeUpsideExactIn, { ...contentType, mode: "modal" });
97
106
  case "anySpendBuySpin":
98
107
  return _jsx(AnySpendBuySpin, { ...contentType, mode: "modal" });
99
108
  case "anySpendSignatureMint":
@@ -32,11 +32,12 @@ export { useSearchParamsSSR } from "./useSearchParamsSSR";
32
32
  export { useSimBalance } from "./useSimBalance";
33
33
  export { useSiwe } from "./useSiwe";
34
34
  export { useTokenBalance } from "./useTokenBalance";
35
+ export { useTokenBalanceDirect } from "./useTokenBalanceDirect";
35
36
  export { useTokenBalancesByChain } from "./useTokenBalancesByChain";
36
37
  export { useTokenData } from "./useTokenData";
37
38
  export { useTokenFromUrl } from "./useTokenFromUrl";
38
39
  export { useTokenPrice } from "./useTokenPrice";
39
40
  export { useTokenPriceWithFallback } from "./useTokenPriceWithFallback";
40
41
  export { useTokensFromAddress } from "./useTokensFromAddress";
41
- export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
42
42
  export { useURLParams } from "./useURLParams";
43
+ export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
@@ -32,11 +32,12 @@ export { useSearchParamsSSR } from "./useSearchParamsSSR.js";
32
32
  export { useSimBalance } from "./useSimBalance.js";
33
33
  export { useSiwe } from "./useSiwe.js";
34
34
  export { useTokenBalance } from "./useTokenBalance.js";
35
+ export { useTokenBalanceDirect } from "./useTokenBalanceDirect.js";
35
36
  export { useTokenBalancesByChain } from "./useTokenBalancesByChain.js";
36
37
  export { useTokenData } from "./useTokenData.js";
37
38
  export { useTokenFromUrl } from "./useTokenFromUrl.js";
38
39
  export { useTokenPrice } from "./useTokenPrice.js";
39
40
  export { useTokenPriceWithFallback } from "./useTokenPriceWithFallback.js";
40
41
  export { useTokensFromAddress } from "./useTokensFromAddress.js";
41
- export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute.js";
42
42
  export { useURLParams } from "./useURLParams.js";
43
+ export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute.js";
@@ -0,0 +1,12 @@
1
+ import { components } from "../../../anyspend/types/api";
2
+ interface UseTokenBalanceProps {
3
+ token: components["schemas"]["Token"];
4
+ address?: string;
5
+ }
6
+ export interface TokenBalanceResult {
7
+ rawBalance: bigint | null;
8
+ formattedBalance: string;
9
+ isLoading: boolean;
10
+ }
11
+ export declare function useTokenBalanceDirect({ token, address }: UseTokenBalanceProps): TokenBalanceResult;
12
+ export {};
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { isNativeToken } from "../../../anyspend/index.js";
3
+ import { useAccountWallet } from "../../../global-account/react/index.js";
4
+ import { formatTokenAmount } from "../../../shared/utils/number.js";
5
+ import { getERC20Balances, getNativeTokenBalance } from "../../../shared/utils/thirdweb-insights.js";
6
+ import { useQuery } from "@tanstack/react-query";
7
+ import { useEffect } from "react";
8
+ export function useTokenBalanceDirect({ token, address }) {
9
+ const account = useAccountWallet();
10
+ const effectiveAddress = address || account?.address;
11
+ const { data: tokenBalance, isLoading, isFetching, refetch, } = useQuery({
12
+ queryKey: ["tokenBalance", effectiveAddress, token.chainId, token.address],
13
+ queryFn: async () => {
14
+ if (!effectiveAddress)
15
+ return { formatted: "0", raw: null };
16
+ if (isNativeToken(token.address)) {
17
+ const nativeToken = await getNativeTokenBalance(effectiveAddress, token.chainId);
18
+ if (nativeToken && nativeToken.balance) {
19
+ const rawBalance = nativeToken.balance;
20
+ return {
21
+ formatted: formatTokenAmount(BigInt(rawBalance), Number(nativeToken.decimals || 18)),
22
+ raw: BigInt(rawBalance),
23
+ };
24
+ }
25
+ return { formatted: "0", raw: null };
26
+ }
27
+ const response = await getERC20Balances(effectiveAddress, {
28
+ chainIds: [token.chainId],
29
+ includeSpam: false,
30
+ });
31
+ const tokenBalance = response.data?.find(t => t.token_address === token.address);
32
+ if (tokenBalance?.balance) {
33
+ return {
34
+ formatted: formatTokenAmount(BigInt(tokenBalance.balance), Number(tokenBalance.decimals || 18)),
35
+ raw: BigInt(tokenBalance.balance),
36
+ };
37
+ }
38
+ return { formatted: "0", raw: null };
39
+ },
40
+ enabled: !!effectiveAddress,
41
+ staleTime: 30000,
42
+ gcTime: 5 * 60 * 1000,
43
+ retry: 2,
44
+ structuralSharing: false,
45
+ });
46
+ // Force a refetch when the wallet or token changes
47
+ useEffect(() => {
48
+ if (effectiveAddress) {
49
+ refetch();
50
+ }
51
+ }, [effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
52
+ // Determine if we're actually loading
53
+ const isActuallyLoading = !effectiveAddress || isLoading || (isFetching && !tokenBalance);
54
+ return {
55
+ rawBalance: tokenBalance?.raw || BigInt(0),
56
+ formattedBalance: tokenBalance?.formatted || "0",
57
+ isLoading: isActuallyLoading,
58
+ };
59
+ }
@@ -28,10 +28,11 @@ export function useTokenFromUrl({ defaultToken, prefix }) {
28
28
  // Get parameters from URL
29
29
  const currencyParam = searchParams.get(`${prefix}Currency`);
30
30
  const chainIdParam = searchParams.get(`${prefix}ChainId`);
31
- // Determine if we should fetch token info
32
- const shouldFetchToken = Boolean(currencyParam && chainIdParam && currencyParam.toLowerCase() !== defaultToken.address.toLowerCase());
33
31
  // Determine network based on chainId
34
- const network = chainIdParam ? getCoingeckoChainInfo(Number(chainIdParam)).coingecko_id : "";
32
+ const chainInfo = chainIdParam ? getCoingeckoChainInfo(Number(chainIdParam)) : null;
33
+ const network = chainInfo?.coingecko_id || "";
34
+ // Determine if we should fetch token info
35
+ const shouldFetchToken = Boolean(currencyParam && chainIdParam && chainInfo && currencyParam.toLowerCase() !== defaultToken.address.toLowerCase());
35
36
  const { data: tokenInfo, isError } = useQuery({
36
37
  queryKey: ["tokenInfo", network, currencyParam],
37
38
  queryFn: () => fetchTokenInfo(network, currencyParam || ""),
@@ -210,6 +210,20 @@ export interface AnySpendStakeB3Props extends BaseModalProps {
210
210
  /** Callback function called when the stake is successful */
211
211
  onSuccess?: () => void;
212
212
  }
213
+ /**
214
+ * Props for the AnySpend Stake B3 (Custom Exact In) modal
215
+ * Handles B3 token staking operations using the custom exact in flow
216
+ */
217
+ export interface AnySpendStakeB3ExactInProps extends BaseModalProps {
218
+ /** Modal type identifier */
219
+ type: "anySpendStakeB3ExactIn";
220
+ /** Recipient address to stake B3 for */
221
+ recipientAddress: string;
222
+ /** Stake amount */
223
+ stakeAmount?: string;
224
+ /** Callback function called when the stake is successful */
225
+ onSuccess?: () => void;
226
+ }
213
227
  /**
214
228
  * Props for the AnySpend Stake Contract modal
215
229
  * Handles token staking operations to a given contract
@@ -230,6 +244,22 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
230
244
  /** Callback function called when the stake is successful */
231
245
  onSuccess?: () => void;
232
246
  }
247
+ /**
248
+ * Props for the AnySpend Stake Upside (Exact In) modal
249
+ * Handles token staking operations using the custom exact in flow
250
+ */
251
+ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
252
+ /** Modal type identifier */
253
+ type: "anySpendStakeUpsideExactIn";
254
+ /** Recipient address to stake tokens for */
255
+ recipientAddress: string;
256
+ /** Staking contract address */
257
+ stakingContractAddress: string;
258
+ /** Token to stake */
259
+ token: components["schemas"]["Token"];
260
+ /** Callback function called when the stake is successful */
261
+ onSuccess?: () => void;
262
+ }
233
263
  /**
234
264
  * Props for the AnySpend Buy Spin modal
235
265
  * Handles spin wheel entry purchases
@@ -324,7 +354,7 @@ export interface AvatarEditorModalProps extends BaseModalProps {
324
354
  /**
325
355
  * Union type of all possible modal content types
326
356
  */
327
- export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps;
357
+ export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps;
328
358
  /**
329
359
  * State interface for the modal store
330
360
  */
@@ -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?: () => 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,7 @@
1
+ export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
2
+ loadOrder?: string;
3
+ mode?: "modal" | "page";
4
+ recipientAddress: string;
5
+ stakeAmount?: string;
6
+ onSuccess?: () => void;
7
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, stakingContractAddress, token, onSuccess, }: {
3
+ loadOrder?: string;
4
+ mode?: "modal" | "page";
5
+ recipientAddress: string;
6
+ stakingContractAddress: string;
7
+ token: components["schemas"]["Token"];
8
+ onSuccess?: () => void;
9
+ }): 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";
@@ -20,10 +20,13 @@ interface UseAnyspendFlowProps {
20
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 {};