@b3dotfun/sdk 0.0.26-alpha.3 → 0.0.26-alpha.5

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.
@@ -17,7 +17,7 @@ function LoginStepContainer({ children, partnerId }) {
17
17
  },
18
18
  }, !!partnerId);
19
19
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
20
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center", children: [partnerLogo && (0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "mb-6 mt-6 h-12 w-auto object-contain" }), children, (0, jsx_runtime_1.jsxs)("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", (0, jsx_runtime_1.jsx)("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
20
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 mt-6 h-12 w-auto object-contain" })), children, (0, jsx_runtime_1.jsxs)("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", (0, jsx_runtime_1.jsx)("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
21
21
  }
22
22
  function LoginStep({ onSuccess, onError, partnerId, chain }) {
23
23
  const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
@@ -40,9 +40,14 @@ function useUnifiedChainSwitchAndExecute() {
40
40
  if (!signer) {
41
41
  throw new Error("No account connected");
42
42
  }
43
+ // Get the target chain configuration instead of using potentially stale walletClient.chain
44
+ const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
45
+ if (!targetChain) {
46
+ throw new Error(`Chain ${targetChainId} is not supported`);
47
+ }
43
48
  const hash = await walletClient.sendTransaction({
44
49
  account: signer,
45
- chain: walletClient.chain,
50
+ chain: targetChain,
46
51
  to: params.to,
47
52
  data: params.data,
48
53
  value: params.value,
@@ -55,7 +60,7 @@ function useUnifiedChainSwitchAndExecute() {
55
60
  if (onCorrectChain) {
56
61
  return await executeTransaction();
57
62
  }
58
- sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
63
+ const switchingToastId = sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
59
64
  const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
60
65
  if (!targetChain) {
61
66
  sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
@@ -77,6 +82,7 @@ function useUnifiedChainSwitchAndExecute() {
77
82
  },
78
83
  },
79
84
  });
85
+ sonner_1.toast.dismiss(switchingToastId);
80
86
  return await executeTransaction();
81
87
  }
82
88
  catch (e) {
@@ -13,7 +13,7 @@ export function LoginStepContainer({ children, partnerId }) {
13
13
  },
14
14
  }, !!partnerId);
15
15
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
16
- return (_jsxs("div", { className: "flex flex-col items-center justify-center", children: [partnerLogo && _jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "mb-6 mt-6 h-12 w-auto object-contain" }), children, _jsxs("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", _jsx("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
16
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 mt-6 h-12 w-auto object-contain" })), children, _jsxs("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", _jsx("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
17
17
  }
18
18
  export function LoginStep({ onSuccess, onError, partnerId, chain }) {
19
19
  const wallet = ecosystemWallet(ecosystemWalletId, {
@@ -34,9 +34,14 @@ export function useUnifiedChainSwitchAndExecute() {
34
34
  if (!signer) {
35
35
  throw new Error("No account connected");
36
36
  }
37
+ // Get the target chain configuration instead of using potentially stale walletClient.chain
38
+ const targetChain = supportedChains.find(chain => chain.id === targetChainId);
39
+ if (!targetChain) {
40
+ throw new Error(`Chain ${targetChainId} is not supported`);
41
+ }
37
42
  const hash = await walletClient.sendTransaction({
38
43
  account: signer,
39
- chain: walletClient.chain,
44
+ chain: targetChain,
40
45
  to: params.to,
41
46
  data: params.data,
42
47
  value: params.value,
@@ -49,7 +54,7 @@ export function useUnifiedChainSwitchAndExecute() {
49
54
  if (onCorrectChain) {
50
55
  return await executeTransaction();
51
56
  }
52
- toast.info(`Switching to ${getChainName(targetChainId)}…`);
57
+ const switchingToastId = toast.info(`Switching to ${getChainName(targetChainId)}…`);
53
58
  const targetChain = supportedChains.find(chain => chain.id === targetChainId);
54
59
  if (!targetChain) {
55
60
  toast.error(`Chain ${targetChainId} is not supported`);
@@ -71,6 +76,7 @@ export function useUnifiedChainSwitchAndExecute() {
71
76
  },
72
77
  },
73
78
  });
79
+ toast.dismiss(switchingToastId);
74
80
  return await executeTransaction();
75
81
  }
76
82
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.26-alpha.3",
3
+ "version": "0.0.26-alpha.5",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -43,7 +43,9 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
43
43
 
44
44
  return (
45
45
  <div className="flex flex-col items-center justify-center">
46
- {partnerLogo && <img src={partnerLogo} alt="Partner Logo" className="mb-6 mt-6 h-12 w-auto object-contain" />}
46
+ {partnerLogo && (
47
+ <img src={partnerLogo} alt="Partner Logo" className="partner-logo mb-6 mt-6 h-12 w-auto object-contain" />
48
+ )}
47
49
  {children}
48
50
  <h2 className="mt-6 flex items-center gap-2 text-lg font-bold">
49
51
  Powered by
@@ -50,9 +50,15 @@ export function useUnifiedChainSwitchAndExecute() {
50
50
  throw new Error("No account connected");
51
51
  }
52
52
 
53
+ // Get the target chain configuration instead of using potentially stale walletClient.chain
54
+ const targetChain = supportedChains.find(chain => chain.id === targetChainId);
55
+ if (!targetChain) {
56
+ throw new Error(`Chain ${targetChainId} is not supported`);
57
+ }
58
+
53
59
  const hash = await walletClient.sendTransaction({
54
60
  account: signer,
55
- chain: walletClient.chain,
61
+ chain: targetChain,
56
62
  to: params.to,
57
63
  data: params.data as `0x${string}`,
58
64
  value: params.value,
@@ -69,7 +75,7 @@ export function useUnifiedChainSwitchAndExecute() {
69
75
  return await executeTransaction();
70
76
  }
71
77
 
72
- toast.info(`Switching to ${getChainName(targetChainId)}…`);
78
+ const switchingToastId = toast.info(`Switching to ${getChainName(targetChainId)}…`);
73
79
 
74
80
  const targetChain = supportedChains.find(chain => chain.id === targetChainId);
75
81
  if (!targetChain) {
@@ -95,6 +101,7 @@ export function useUnifiedChainSwitchAndExecute() {
95
101
  },
96
102
  });
97
103
 
104
+ toast.dismiss(switchingToastId);
98
105
  return await executeTransaction();
99
106
  } catch (e: any) {
100
107
  if (e?.code === -32603 || e?.message?.includes("f is not a function")) {