@b3dotfun/sdk 0.0.65-alpha.1 → 0.0.65-alpha.3

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 (31) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +38 -7
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
  5. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +14 -251
  6. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +2 -10
  7. package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
  8. package/dist/cjs/anyspend/react/components/index.js +4 -1
  9. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -1
  10. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -14
  11. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  12. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
  13. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +38 -7
  14. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
  15. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +15 -249
  16. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -10
  17. package/dist/esm/anyspend/react/components/index.d.ts +1 -0
  18. package/dist/esm/anyspend/react/components/index.js +1 -0
  19. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -1
  20. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -14
  21. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -1
  22. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -1
  23. package/dist/types/anyspend/react/components/index.d.ts +1 -0
  24. package/package.json +1 -1
  25. package/src/anyspend/react/components/AnySpend.tsx +1 -1
  26. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +47 -7
  27. package/src/anyspend/react/components/AnyspendDepositHype.tsx +36 -526
  28. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -13
  29. package/src/anyspend/react/components/index.ts +1 -0
  30. package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -1
  31. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +6 -12
@@ -6,7 +6,6 @@ import invariant from "invariant";
6
6
  import { useCallback, useState } from "react";
7
7
  import { toast } from "sonner";
8
8
  import { prepareTransaction, sendTransaction as twSendTransaction } from "thirdweb";
9
- import { useActiveWallet } from "thirdweb/react";
10
9
  import { isAddress } from "viem";
11
10
  import { useSwitchChain } from "wagmi";
12
11
  import { useB3 } from "../components";
@@ -29,7 +28,6 @@ invariant(partnerId, "Partner ID is required");
29
28
  export function useUnifiedChainSwitchAndExecute() {
30
29
  const { switchChainAsync } = useSwitchChain();
31
30
  const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = useState(false);
32
- const activeWallet = useActiveWallet();
33
31
 
34
32
  const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = useAccountWallet();
35
33
  const { account: aaAccount } = useB3();
@@ -49,12 +47,12 @@ export function useUnifiedChainSwitchAndExecute() {
49
47
  return;
50
48
  }
51
49
 
52
- const currentChainId = activeWallet?.getChain()?.id;
50
+ const currentChainId = connectedEOAWallet?.getChain()?.id;
53
51
  const onCorrectChain = currentChainId === targetChainId;
54
52
 
55
53
  // Helper function to execute the transaction
56
54
  const executeTransaction = async (): Promise<string> => {
57
- const signer = activeWallet?.getAccount();
55
+ const signer = connectedEOAWallet?.getAccount();
58
56
  if (!signer) {
59
57
  throw new Error("No account connected");
60
58
  }
@@ -62,7 +60,7 @@ export function useUnifiedChainSwitchAndExecute() {
62
60
  // Coinbase Smart Wallet specific chain switching (different behavior from other wallets)
63
61
  const walletChain = connectedEOAWallet.getChain();
64
62
  if (walletChain?.id !== targetChainId) {
65
- activeWallet?.switchChain(getThirdwebChain(targetChainId));
63
+ connectedEOAWallet?.switchChain(getThirdwebChain(targetChainId));
66
64
  }
67
65
 
68
66
  invariant(isAddress(params.to), "params.to is not a valid address");
@@ -121,7 +119,7 @@ export function useUnifiedChainSwitchAndExecute() {
121
119
  setIsSwitchingOrExecuting(false);
122
120
  }
123
121
  },
124
- [connectedEOAWallet, activeWallet, switchChainAsync],
122
+ [connectedEOAWallet, switchChainAsync],
125
123
  );
126
124
 
127
125
  // Handle AA wallet transaction (no chain switch needed for AA)
@@ -186,14 +184,10 @@ export function useUnifiedChainSwitchAndExecute() {
186
184
  // Check which wallet type is active
187
185
  if (isActiveSmartWallet) {
188
186
  return handleAASendTransaction(targetChainId, params);
189
- } else if (isActiveEOAWallet) {
190
- return handleEOASwitchChainAndSendTransaction(targetChainId, params);
191
- } else {
192
- toast.error("No wallet connected");
193
- return undefined;
194
187
  }
188
+ return handleEOASwitchChainAndSendTransaction(targetChainId, params);
195
189
  },
196
- [isActiveSmartWallet, isActiveEOAWallet, handleAASendTransaction, handleEOASwitchChainAndSendTransaction],
190
+ [isActiveSmartWallet, handleAASendTransaction, handleEOASwitchChainAndSendTransaction],
197
191
  );
198
192
 
199
193
  return {