@b3dotfun/sdk 0.0.62 → 0.0.63-test.0-alpha.0

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 (150) 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 +275 -0
  5. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +5 -4
  6. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
  7. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +288 -0
  8. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
  9. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +33 -0
  10. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -4
  11. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +4 -6
  12. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
  13. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
  14. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
  15. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +66 -147
  16. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
  17. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
  18. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +39 -15
  19. package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
  20. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
  21. package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
  22. package/dist/cjs/anyspend/react/components/index.js +11 -3
  23. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
  24. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +42 -19
  25. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  26. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  27. package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
  28. package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +56 -0
  29. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
  30. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +73 -0
  31. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
  32. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +57 -0
  33. package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
  34. package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +211 -0
  35. package/dist/cjs/anyspend/types/api.d.ts +665 -3
  36. package/dist/cjs/anyspend/utils/orderPayload.js +4 -0
  37. package/dist/cjs/global-account/react/components/B3DynamicModal.js +10 -1
  38. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
  39. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  40. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
  41. package/dist/cjs/global-account/react/hooks/index.js +5 -3
  42. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  43. package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -2
  44. package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +1 -1
  45. package/dist/cjs/global-account/react/hooks/useSimBalance.js +6 -5
  46. package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
  47. package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +62 -0
  48. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +4 -3
  49. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +31 -1
  50. package/dist/esm/anyspend/react/components/AnySpend.js +62 -24
  51. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -0
  52. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  53. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +269 -0
  54. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +7 -6
  55. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
  56. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +285 -0
  57. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
  58. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +30 -0
  59. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +4 -4
  60. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +5 -7
  61. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
  62. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
  63. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
  64. package/dist/esm/anyspend/react/components/common/OrderDetails.js +67 -148
  65. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
  66. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
  67. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +40 -16
  68. package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
  69. package/dist/esm/anyspend/react/components/common/TokenBalance.js +2 -2
  70. package/dist/esm/anyspend/react/components/index.d.ts +5 -1
  71. package/dist/esm/anyspend/react/components/index.js +5 -1
  72. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
  73. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +42 -19
  74. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  75. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  76. package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
  77. package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +53 -0
  78. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
  79. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +70 -0
  80. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
  81. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +54 -0
  82. package/dist/esm/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
  83. package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +208 -0
  84. package/dist/esm/anyspend/types/api.d.ts +665 -3
  85. package/dist/esm/anyspend/utils/orderPayload.js +4 -0
  86. package/dist/esm/global-account/react/components/B3DynamicModal.js +11 -2
  87. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
  88. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  89. package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
  90. package/dist/esm/global-account/react/hooks/index.js +2 -1
  91. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  92. package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -2
  93. package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +1 -1
  94. package/dist/esm/global-account/react/hooks/useSimBalance.js +6 -5
  95. package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
  96. package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +59 -0
  97. package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +4 -3
  98. package/dist/esm/global-account/react/stores/useModalStore.d.ts +31 -1
  99. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  100. package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
  101. package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
  102. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
  103. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
  104. package/dist/types/anyspend/react/components/index.d.ts +5 -1
  105. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
  106. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  107. package/dist/types/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
  108. package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
  109. package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
  110. package/dist/types/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
  111. package/dist/types/anyspend/types/api.d.ts +665 -3
  112. package/dist/types/global-account/react/hooks/index.d.ts +2 -1
  113. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  114. package/dist/types/global-account/react/hooks/useSimBalance.d.ts +1 -1
  115. package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
  116. package/dist/types/global-account/react/stores/useModalStore.d.ts +31 -1
  117. package/package.json +3 -2
  118. package/src/anyspend/react/components/AnySpend.tsx +73 -22
  119. package/src/anyspend/react/components/AnySpendCustom.tsx +4 -0
  120. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +595 -0
  121. package/src/anyspend/react/components/AnySpendStakeB3.tsx +8 -11
  122. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +522 -0
  123. package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +73 -0
  124. package/src/anyspend/react/components/AnyspendDepositHype.tsx +7 -3
  125. package/src/anyspend/react/components/common/CryptoPaySection.tsx +5 -7
  126. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +9 -18
  127. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +22 -0
  128. package/src/anyspend/react/components/common/OrderDetails.tsx +76 -190
  129. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -3
  130. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +48 -17
  131. package/src/anyspend/react/components/common/PaySection.tsx +1 -0
  132. package/src/anyspend/react/components/common/TokenBalance.tsx +2 -2
  133. package/src/anyspend/react/components/index.ts +5 -1
  134. package/src/anyspend/react/hooks/useAnyspendFlow.ts +51 -18
  135. package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
  136. package/src/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.ts +72 -0
  137. package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +80 -0
  138. package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +69 -0
  139. package/src/anyspend/react/hooks/usePhantomTransfer.ts +301 -0
  140. package/src/anyspend/types/api.ts +669 -1
  141. package/src/anyspend/utils/orderPayload.ts +5 -1
  142. package/src/global-account/react/components/B3DynamicModal.tsx +11 -1
  143. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +3 -1
  144. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  145. package/src/global-account/react/hooks/index.ts +2 -1
  146. package/src/global-account/react/hooks/useAuthentication.ts +10 -2
  147. package/src/global-account/react/hooks/useSimBalance.ts +6 -5
  148. package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +84 -0
  149. package/src/global-account/react/hooks/useTokenFromUrl.tsx +6 -5
  150. 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":
@@ -19,6 +19,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
19
19
  const { setB3ModalContentType, setB3ModalOpen, isOpen } = useModalStore();
20
20
  const account = useActiveAccount();
21
21
  const isAuthenticating = useAuthStore(state => state.isAuthenticating);
22
+ const isAuthenticated = useAuthStore(state => state.isAuthenticated);
22
23
  const isConnected = useAuthStore(state => state.isConnected);
23
24
  const [refetchCount, setRefetchCount] = useState(0);
24
25
  const [refetchError, setRefetchError] = useState(null);
@@ -61,7 +62,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
61
62
  isOpen,
62
63
  source,
63
64
  });
64
- if (isConnected) {
65
+ if (isConnected && isAuthenticated) {
65
66
  // Check if we already have a signer for this partner
66
67
  const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
67
68
  if (hasExistingSigner) {
@@ -111,6 +112,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
111
112
  signersEnabled,
112
113
  isConnected,
113
114
  isAuthenticating,
115
+ isAuthenticated,
114
116
  isOpen,
115
117
  ]);
116
118
  debug("render", {
@@ -37,8 +37,8 @@ export function LoginStep({ onSuccess, chain }) {
37
37
  }, header: {
38
38
  title: "Sign in with B3",
39
39
  titleIcon: "https://cdn.b3.fun/b3_logo.svg",
40
- }, className: "b3-login-step", onConnect: async (wallet) => {
41
- await onConnect(wallet);
40
+ }, className: "b3-login-step", onConnect: async (wallet, allConnectedWallets) => {
41
+ await onConnect(wallet, allConnectedWallets);
42
42
  const account = wallet.getAccount();
43
43
  if (!account)
44
44
  throw new Error("No account found");
@@ -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";
@@ -8,9 +8,9 @@ export declare function useAuthentication(partnerId: string): {
8
8
  isConnected: boolean;
9
9
  wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
10
10
  preAuthenticate: typeof preAuthenticate;
11
- connect: (wallet: Wallet) => Promise<void>;
11
+ connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
12
12
  isAuthenticating: boolean;
13
- onConnect: (wallet: Wallet) => Promise<void>;
13
+ onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
14
14
  user: {
15
15
  email?: string | undefined;
16
16
  username?: string | undefined;
@@ -136,7 +136,12 @@ export function useAuthentication(partnerId) {
136
136
  return userAuth;
137
137
  }
138
138
  }, [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
139
- const onConnect = useCallback(async (wallet) => {
139
+ const onConnect = useCallback(async (_walleAutoConnectedWith, allConnectedWallets) => {
140
+ debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
141
+ const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
142
+ if (!wallet) {
143
+ throw new Error("No smart wallet found during auto-connect");
144
+ }
140
145
  debug("@@useAuthentication:onConnect", { wallet });
141
146
  try {
142
147
  setHasStartedConnecting(true);
@@ -203,7 +208,7 @@ export function useAuthentication(partnerId) {
203
208
  const { isLoading: useAutoConnectLoading } = useAutoConnect({
204
209
  client,
205
210
  wallets: [wallet],
206
- onConnect: onConnect,
211
+ onConnect,
207
212
  });
208
213
  /**
209
214
  * useAutoConnectLoading starts as false
@@ -21,4 +21,4 @@ export interface SimBalanceResponse {
21
21
  wallet_address: string;
22
22
  balances: SimBalanceItem[];
23
23
  }
24
- export declare function useSimBalance(address?: string): import("@tanstack/react-query").UseQueryResult<SimBalanceResponse, Error>;
24
+ export declare function useSimBalance(address?: string, chainIdsParam?: number[]): import("@tanstack/react-query").UseQueryResult<SimBalanceResponse, Error>;
@@ -1,8 +1,9 @@
1
1
  import { useQuery } from "@tanstack/react-query";
2
- async function fetchSimBalance(address) {
2
+ async function fetchSimBalance(address, chainIdsParam) {
3
3
  if (!address)
4
4
  throw new Error("Address is required");
5
- let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
5
+ const chainIds = chainIdsParam.length === 0 ? "mainnet" : chainIdsParam.join(",");
6
+ let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=${chainIds}`;
6
7
  if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
7
8
  url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
8
9
  }
@@ -13,13 +14,13 @@ async function fetchSimBalance(address) {
13
14
  const balanceData = await response.json();
14
15
  return balanceData;
15
16
  }
16
- export function useSimBalance(address) {
17
+ export function useSimBalance(address, chainIdsParam) {
17
18
  return useQuery({
18
- queryKey: ["simBalance", address],
19
+ queryKey: ["simBalance", address, chainIdsParam],
19
20
  queryFn: () => {
20
21
  if (!address)
21
22
  throw new Error("Address is required");
22
- return fetchSimBalance(address);
23
+ return fetchSimBalance(address, chainIdsParam || []);
23
24
  },
24
25
  enabled: Boolean(address),
25
26
  });
@@ -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?: (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?: string) => void;
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;