@b3dotfun/sdk 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (115) hide show
  1. package/README.md +328 -230
  2. package/dist/cjs/anyspend/index.native.d.ts +13 -0
  3. package/dist/cjs/anyspend/index.native.js +35 -0
  4. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
  5. package/dist/cjs/anyspend/react/components/AnySpend.js +4 -4
  6. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  7. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +123 -50
  8. package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +5 -1
  9. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
  10. package/dist/cjs/anyspend/utils/chain.js +3 -0
  11. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -2
  12. package/dist/cjs/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +3 -29
  13. package/dist/cjs/global-account/react/components/{B3Provider.js → B3Provider/B3Provider.js} +6 -34
  14. package/dist/cjs/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +2 -25
  15. package/dist/cjs/global-account/react/components/{B3Provider.native.js → B3Provider/B3Provider.native.js} +5 -28
  16. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +25 -0
  17. package/dist/cjs/global-account/react/components/B3Provider/types.js +20 -0
  18. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +5 -0
  19. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +17 -0
  20. package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
  21. package/dist/cjs/global-account/react/components/index.d.ts +8 -6
  22. package/dist/cjs/global-account/react/components/index.js +18 -16
  23. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
  24. package/dist/cjs/global-account/react/hooks/index.js +2 -1
  25. package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +3 -3
  26. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +1 -1
  27. package/dist/cjs/global-account/react/index.native.d.ts +7 -0
  28. package/dist/cjs/global-account/react/index.native.js +21 -0
  29. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  30. package/dist/cjs/global-account/types/chain-networks.d.ts +34 -34
  31. package/dist/cjs/global-account/types/feature-flags.d.ts +5 -5
  32. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +1 -1
  33. package/dist/cjs/shared/constants/chains/supported.d.ts +8 -7
  34. package/dist/cjs/shared/constants/chains/supported.js +8 -1
  35. package/dist/cjs/shared/utils/chains.js +4 -0
  36. package/dist/cjs/shared/utils/number.js +1 -1
  37. package/dist/esm/anyspend/index.native.d.ts +13 -0
  38. package/dist/esm/anyspend/index.native.js +19 -0
  39. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
  40. package/dist/esm/anyspend/react/components/AnySpend.js +4 -4
  41. package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  42. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +123 -50
  43. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +5 -1
  44. package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
  45. package/dist/esm/anyspend/utils/chain.js +3 -0
  46. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  47. package/dist/esm/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +3 -29
  48. package/dist/esm/global-account/react/components/{B3Provider.js → B3Provider/B3Provider.js} +5 -32
  49. package/dist/esm/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +2 -25
  50. package/dist/esm/global-account/react/components/{B3Provider.native.js → B3Provider/B3Provider.native.js} +5 -26
  51. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +25 -0
  52. package/dist/esm/global-account/react/components/B3Provider/types.js +17 -0
  53. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +5 -0
  54. package/dist/esm/global-account/react/components/B3Provider/useB3.js +14 -0
  55. package/dist/esm/global-account/react/components/StyleRoot.js +1 -1
  56. package/dist/esm/global-account/react/components/index.d.ts +8 -6
  57. package/dist/esm/global-account/react/components/index.js +7 -5
  58. package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
  59. package/dist/esm/global-account/react/hooks/index.js +1 -1
  60. package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +3 -3
  61. package/dist/esm/global-account/react/hooks/useTokenBalance.js +1 -1
  62. package/dist/esm/global-account/react/index.native.d.ts +7 -0
  63. package/dist/esm/global-account/react/index.native.js +11 -0
  64. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  65. package/dist/esm/global-account/types/chain-networks.d.ts +34 -34
  66. package/dist/esm/global-account/types/feature-flags.d.ts +5 -5
  67. package/dist/esm/shared/constants/chains/b3Chain.d.ts +1 -1
  68. package/dist/esm/shared/constants/chains/supported.d.ts +8 -7
  69. package/dist/esm/shared/constants/chains/supported.js +7 -0
  70. package/dist/esm/shared/utils/chains.js +4 -0
  71. package/dist/esm/shared/utils/number.js +1 -1
  72. package/dist/styles/index.css +1 -1
  73. package/dist/types/anyspend/index.native.d.ts +13 -0
  74. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
  75. package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  76. package/dist/types/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +2 -28
  77. package/dist/types/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +1 -24
  78. package/dist/types/global-account/react/components/B3Provider/types.d.ts +25 -0
  79. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +5 -0
  80. package/dist/types/global-account/react/components/index.d.ts +8 -6
  81. package/dist/types/global-account/react/hooks/index.d.ts +1 -1
  82. package/dist/types/global-account/react/index.native.d.ts +7 -0
  83. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  84. package/dist/types/global-account/types/chain-networks.d.ts +34 -34
  85. package/dist/types/global-account/types/feature-flags.d.ts +5 -5
  86. package/dist/types/shared/constants/chains/b3Chain.d.ts +1 -1
  87. package/dist/types/shared/constants/chains/supported.d.ts +8 -7
  88. package/package.json +26 -24
  89. package/src/anyspend/index.native.ts +24 -0
  90. package/src/anyspend/react/components/AnySpend.tsx +6 -5
  91. package/src/anyspend/react/components/AnySpendBuySpin.tsx +232 -179
  92. package/src/anyspend/react/components/common/OrderHistoryItem.tsx +5 -1
  93. package/src/anyspend/react/components/common/TokenBalance.tsx +1 -1
  94. package/src/anyspend/utils/chain.ts +3 -0
  95. package/src/global-account/react/components/B3DynamicModal.tsx +1 -1
  96. package/src/global-account/react/components/{B3Provider.native.tsx → B3Provider/B3Provider.native.tsx} +4 -45
  97. package/src/global-account/react/components/{B3Provider.tsx → B3Provider/B3Provider.tsx} +4 -53
  98. package/src/global-account/react/components/B3Provider/types.ts +40 -0
  99. package/src/global-account/react/components/B3Provider/useB3.ts +17 -0
  100. package/src/global-account/react/components/StyleRoot.tsx +1 -1
  101. package/src/global-account/react/components/index.ts +8 -6
  102. package/src/global-account/react/hooks/index.ts +1 -1
  103. package/src/global-account/react/hooks/useBestTransactionPath.tsx +3 -3
  104. package/src/global-account/react/hooks/useTokenBalance.tsx +1 -1
  105. package/src/global-account/react/index.native.ts +14 -0
  106. package/src/global-account/react/stores/useModalStore.ts +2 -0
  107. package/src/shared/constants/chains/supported.ts +12 -4
  108. package/src/shared/utils/chains.ts +4 -1
  109. package/src/shared/utils/number.ts +1 -1
  110. package/dist/cjs/styles/index.d.ts +0 -20
  111. package/dist/cjs/styles/index.js +0 -22
  112. package/dist/esm/styles/index.d.ts +0 -20
  113. package/dist/esm/styles/index.js +0 -20
  114. package/dist/types/styles/index.d.ts +0 -20
  115. package/src/styles/index.ts +0 -24
@@ -6,6 +6,7 @@ import { Account } from "thirdweb/wallets";
6
6
  // import { RelayKitProviderWrapper } from "./RelayKitProviderWrapper";
7
7
 
8
8
  import { User } from "@b3dotfun/sdk/global-account/types/b3-api.types";
9
+ import { B3Context, B3ContextType } from "./types";
9
10
 
10
11
  /**
11
12
  * Default permissions configuration for B3 provider
@@ -17,51 +18,6 @@ const DEFAULT_PERMISSIONS = {
17
18
  endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365) // 1 year from now
18
19
  };
19
20
 
20
- /**
21
- * Context type for B3Provider
22
- */
23
-
24
- export interface B3ContextType {
25
- account?: Account;
26
- user?: User;
27
- setAccount: (account: Account) => void;
28
- setUser: (user?: User) => void;
29
- initialized: boolean;
30
- ready: boolean;
31
- environment?: "development" | "production";
32
- defaultPermissions?: PermissionsConfig;
33
- theme: "light" | "dark";
34
- }
35
-
36
- /**
37
- * Context for B3 provider
38
- */
39
- export const B3Context = createContext<B3ContextType>({
40
- account: undefined,
41
- user: undefined,
42
- setAccount: () => {},
43
- setUser: () => {},
44
- initialized: false,
45
- ready: false,
46
- environment: "development",
47
- theme: "light"
48
- });
49
-
50
- /**
51
- * Hook to access the B3 context
52
- * @throws Error if used outside a B3Provider
53
- */
54
- export function useB3() {
55
- const context = useContext(B3Context);
56
-
57
- if (!context.initialized) {
58
- throw new Error("useB3 must be used within a B3Provider");
59
- }
60
-
61
- // Return a stable reference
62
- return useMemo(() => context, [context]);
63
- }
64
-
65
21
  // Create queryClient instance
66
22
  const queryClient = new QueryClient();
67
23
 
@@ -125,6 +81,9 @@ export function InnerProvider({
125
81
  <B3Context.Provider
126
82
  value={{
127
83
  account: effectiveAccount,
84
+ automaticallySetFirstEoa: false,
85
+ setWallet: () => {},
86
+ wallet: undefined,
128
87
  setAccount,
129
88
  user,
130
89
  setUser,
@@ -2,15 +2,16 @@ import { User } from "@b3dotfun/sdk/global-account/types/b3-api.types";
2
2
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
3
3
  import { supportedChains } from "@b3dotfun/sdk/shared/constants/chains/supported";
4
4
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5
- import { createContext, useContext, useEffect, useMemo, useState } from "react";
5
+ import { useEffect, useState } from "react";
6
6
  import { Toaster } from "sonner";
7
7
  import { ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
8
8
  import { Account, Wallet } from "thirdweb/wallets";
9
9
  import { createConfig, http, WagmiProvider } from "wagmi";
10
- import { RelayKitProviderWrapper } from "./RelayKitProviderWrapper";
11
- import { StyleRoot } from "./StyleRoot";
10
+ import { RelayKitProviderWrapper } from "../RelayKitProviderWrapper";
11
+ import { StyleRoot } from "../StyleRoot";
12
12
 
13
13
  import "@reservoir0x/relay-kit-ui/styles.css";
14
+ import { B3Context, B3ContextType } from "./types";
14
15
 
15
16
  /**
16
17
  * Default permissions configuration for B3 provider
@@ -27,56 +28,6 @@ export const wagmiConfig = createConfig({
27
28
  transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])) as any
28
29
  });
29
30
 
30
- /**
31
- * Context type for B3Provider
32
- */
33
- export interface B3ContextType {
34
- account?: Account;
35
- automaticallySetFirstEoa: boolean;
36
- user?: User;
37
- setAccount: (account: Account) => void;
38
- setWallet: (wallet: Wallet) => void;
39
- wallet?: Wallet;
40
- setUser: (user?: User) => void;
41
- initialized: boolean;
42
- ready: boolean;
43
- environment?: "development" | "production";
44
- defaultPermissions?: PermissionsConfig;
45
- theme: "light" | "dark";
46
- }
47
-
48
- /**
49
- * Context for B3 provider
50
- */
51
- export const B3Context = createContext<B3ContextType>({
52
- account: undefined,
53
- automaticallySetFirstEoa: false,
54
- user: undefined,
55
- setAccount: () => {},
56
- setWallet: () => {},
57
- wallet: undefined,
58
- setUser: () => {},
59
- initialized: false,
60
- ready: false,
61
- environment: "development",
62
- theme: "light"
63
- });
64
-
65
- /**
66
- * Hook to access the B3 context
67
- * @throws Error if used outside a B3Provider
68
- */
69
- export function useB3() {
70
- const context = useContext(B3Context);
71
-
72
- if (!context.initialized) {
73
- throw new Error("useB3 must be used within a B3Provider");
74
- }
75
-
76
- // Return a stable reference
77
- return useMemo(() => context, [context]);
78
- }
79
-
80
31
  // Create queryClient instance
81
32
  const queryClient = new QueryClient();
82
33
 
@@ -0,0 +1,40 @@
1
+ import { Account } from "thirdweb/wallets";
2
+ import { User } from "@b3dotfun/sdk/global-account/types/b3-api.types";
3
+ import { Wallet } from "thirdweb/wallets";
4
+ import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
5
+ import { createContext } from "react";
6
+
7
+ /**
8
+ * Context type for B3Provider
9
+ */
10
+ export interface B3ContextType {
11
+ account?: Account;
12
+ automaticallySetFirstEoa: boolean;
13
+ user?: User;
14
+ setAccount: (account: Account) => void;
15
+ setWallet: (wallet: Wallet) => void;
16
+ wallet?: Wallet;
17
+ setUser: (user?: User) => void;
18
+ initialized: boolean;
19
+ ready: boolean;
20
+ environment?: "development" | "production";
21
+ defaultPermissions?: PermissionsConfig;
22
+ theme: "light" | "dark";
23
+ }
24
+
25
+ /**
26
+ * Context for B3 provider
27
+ */
28
+ export const B3Context = createContext<B3ContextType>({
29
+ account: undefined,
30
+ automaticallySetFirstEoa: false,
31
+ user: undefined,
32
+ setAccount: () => {},
33
+ setWallet: () => {},
34
+ wallet: undefined,
35
+ setUser: () => {},
36
+ initialized: false,
37
+ ready: false,
38
+ environment: "development",
39
+ theme: "light"
40
+ });
@@ -0,0 +1,17 @@
1
+ import { useContext, useMemo } from "react";
2
+ import { B3Context } from "./types";
3
+
4
+ /**
5
+ * Hook to access the B3 context
6
+ * @throws Error if used outside a B3Provider
7
+ */
8
+ export function useB3() {
9
+ const context = useContext(B3Context);
10
+
11
+ if (!context.initialized) {
12
+ throw new Error("useB3 must be used within a B3Provider");
13
+ }
14
+
15
+ // Return a stable reference
16
+ return useMemo(() => context, [context]);
17
+ }
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from "react";
2
- import { useB3 } from "./B3Provider";
2
+ import { useB3 } from "./B3Provider/useB3";
3
3
 
4
4
  export function StyleRoot({ children, id }: PropsWithChildren<{ id?: string }>) {
5
5
  const { theme: b3Theme } = useB3();
@@ -1,18 +1,20 @@
1
1
  // Core Components
2
2
  export { B3DynamicModal } from "./B3DynamicModal";
3
- export { B3Context, B3Provider, InnerProvider, useB3, type B3ContextType } from "./B3Provider";
3
+ export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
4
+ export { useB3 } from "./B3Provider/useB3";
5
+ export { B3Context, type B3ContextType } from "./B3Provider/types";
4
6
  export { RelayKitProviderWrapper } from "./RelayKitProviderWrapper";
5
7
  export { StyleRoot } from "./StyleRoot";
6
8
 
7
9
  // SignInWithB3 Components
10
+ export { AuthButton } from "./SignInWithB3/components/AuthButton";
11
+ export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
12
+ export { WalletRow } from "./SignInWithB3/components/WalletRow";
8
13
  export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
9
14
  export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
10
15
  export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
11
- export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
12
- export { WalletRow } from "./SignInWithB3/components/WalletRow";
13
- export { AuthButton } from "./SignInWithB3/components/AuthButton";
14
16
  export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
15
- export { type AllowedStrategy, getConnectOptionsFromStrategy, isWalletType } from "./SignInWithB3/utils/signInUtils";
17
+ export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
16
18
 
17
19
  // ManageAccount Components
18
20
  export { ManageAccount } from "./ManageAccount/ManageAccount";
@@ -83,13 +85,13 @@ export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
83
85
  export { ScrollArea, ScrollBar } from "./ui/scroll-area";
84
86
  export { ShinyButton } from "./ui/ShinyButton";
85
87
  export { Skeleton } from "./ui/skeleton";
86
- export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem";
87
88
  export {
88
89
  TabsContent as TabsContentPrimitive,
89
90
  TabsList as TabsListPrimitive,
90
91
  Tabs as TabsPrimitive,
91
92
  TabTrigger as TabTriggerPrimitive
92
93
  } from "./ui/Tabs";
94
+ export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem";
93
95
  export { TextLoop } from "./ui/text-loop";
94
96
  export { TextShimmer } from "./ui/text-shimmer";
95
97
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
@@ -16,7 +16,7 @@ export { useHasMounted } from "./useHasMounted";
16
16
  export { useIsMobile } from "./useIsMobile";
17
17
  export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
18
18
  export { useMediaQuery } from "./useMediaQuery";
19
- export { useNativeBalance } from "./useNativeBalance";
19
+ export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance";
20
20
  export { useOnchainName } from "./useOnchainName";
21
21
  export { useOneBalance } from "./useOneBalance";
22
22
  export { useQueryB3 } from "./useQueryB3";
@@ -81,7 +81,7 @@ export function useBestTransactionPath({
81
81
 
82
82
  // Calculate non-native token balance using the same logic as hasNativeBalance
83
83
  const nonNativeTokenBalance = useMemo(() => {
84
- if (isNativeToken(token.address)) return 0n;
84
+ if (isNativeToken(token.address)) return BigInt(0);
85
85
 
86
86
  // For sprinter supported tokens, use aggregated balances
87
87
  if (isSupportedSprinterToken && !oneBalanceLoading && aggregatedBalances) {
@@ -92,7 +92,7 @@ export function useBestTransactionPath({
92
92
  return BigInt(chainBalance.balance);
93
93
  }
94
94
  }
95
- return 0n;
95
+ return BigInt(0);
96
96
  }
97
97
 
98
98
  // For non-sprinter tokens, use token balance from our new hook
@@ -145,7 +145,7 @@ export function useBestTransactionPath({
145
145
 
146
146
  // Determine the best path
147
147
  const path = useMemo(() => {
148
- const availableBalance = (isNativeToken(token.address) ? rawBalance : nonNativeTokenBalance) || 0n;
148
+ const availableBalance = (isNativeToken(token.address) ? rawBalance : nonNativeTokenBalance) || BigInt(0);
149
149
 
150
150
  // Case 1: Native path if available
151
151
  if (hasNativeBalance) {
@@ -77,7 +77,7 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
77
77
  const isActuallyLoading = !ready || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
78
78
 
79
79
  return {
80
- rawBalance: tokenBalance?.raw || 0n,
80
+ rawBalance: tokenBalance?.raw || BigInt(0),
81
81
  formattedBalance: tokenBalance?.formatted || "0",
82
82
  isLoading: isActuallyLoading
83
83
  };
@@ -0,0 +1,14 @@
1
+ // export * from "./components";
2
+ // export * from "./hooks";
3
+ // export * from "./stores";
4
+
5
+ // We only export the components and hooks that are needed for the native app
6
+
7
+ export { B3Provider } from "./components/B3Provider/B3Provider.native";
8
+
9
+ export { useB3 } from "./components/B3Provider/useB3";
10
+ export { B3Context, type B3ContextType } from "./components/B3Provider/types";
11
+ export { useAccountWallet } from "./hooks/useAccountWallet";
12
+ export { useAuthentication } from "./hooks/useAuthentication";
13
+ export { useSiwe } from "./hooks/useSiwe";
14
+ export { useAuthStore } from "./stores/useAuthStore";
@@ -245,6 +245,8 @@ export interface AnySpendBuySpinProps extends BaseModalProps {
245
245
  recipientAddress: string;
246
246
  /** Callback function called when the spin purchase is successful */
247
247
  onSuccess?: (txHash?: string) => void;
248
+ /** Prefill quantity of spins to purchase */
249
+ prefillQuantity?: string;
248
250
  }
249
251
 
250
252
  /**
@@ -4,6 +4,7 @@ import type { Chain as ThirdwebChain } from "thirdweb";
4
4
  // Import the JSON directly
5
5
  // @ts-ignore
6
6
  import chainNetworksJSON from "../../../generated/chain-networks.json" with { type: "json" };
7
+ import invariant from "invariant";
7
8
  const chainNetworks = chainNetworksJSON as ChainNetworks[];
8
9
 
9
10
  // Convert custom chains to Viem format
@@ -26,8 +27,15 @@ export const supportedChainsTW: ThirdwebChain[] = [
26
27
  // Original format from chain-networks.json
27
28
  export const supportedChainNetworks = chainNetworks;
28
29
 
29
- export const b3Mainnet = supportedChains.find(chain => chain.id === 8333);
30
- export const b3Testnet = supportedChains.find(chain => chain.id === 1993);
30
+ export const b3Mainnet = supportedChains.find(chain => chain.id === 8333)!;
31
+ invariant(b3Mainnet, "B3 mainnet chain not found in supported chains");
32
+ export const b3Testnet = supportedChains.find(chain => chain.id === 1993)!;
33
+ invariant(b3Testnet, "B3 testnet chain not found in supported chains");
34
+ export const baseMainnet = supportedChains.find(chain => chain.id === 8453);
35
+ invariant(baseMainnet, "Base mainnet chain not found in supported chains");
31
36
 
32
- export const b3MainnetThirdWeb = supportedChainsTW.find(chain => chain.id === 8333);
33
- export const b3TestnetThirdWeb = supportedChainsTW.find(chain => chain.id === 1993);
37
+ export const b3MainnetThirdWeb = supportedChainsTW.find(chain => chain.id === 8333)!;
38
+ invariant(b3MainnetThirdWeb, "B3 mainnet chain not found in supported chains TW");
39
+
40
+ export const b3TestnetThirdWeb = supportedChainsTW.find(chain => chain.id === 1993)!;
41
+ invariant(b3TestnetThirdWeb, "B3 testnet chain not found in supported chains TW");
@@ -1,5 +1,5 @@
1
1
  import { supportedChains } from "@b3dotfun/sdk/shared/constants/chains/supported";
2
- import { Chain } from "viem/chains";
2
+ import { b3, Chain } from "viem/chains";
3
3
 
4
4
  const baseChainBaseUrl = "https://basescan.org";
5
5
 
@@ -13,6 +13,9 @@ export function chainIdToName(id: number) {
13
13
  }
14
14
 
15
15
  export function getExplorerUrl(chain: Chain, txHash: string): string {
16
+ if (chain.id === b3.id) {
17
+ return "https://explorer.b3.fun/b3/tx/" + txHash;
18
+ }
16
19
  let baseUrl = chain.blockExplorers?.default.url;
17
20
  if (chain.id === 8453) {
18
21
  baseUrl = baseChainBaseUrl;
@@ -25,7 +25,7 @@ export function divideBigIntToString(numerator: bigint, denominator: bigint, dec
25
25
  let decimalStr = "";
26
26
 
27
27
  for (let i = 0; i < decimalPlaces; i++) {
28
- remainder *= 10n;
28
+ remainder *= BigInt(10);
29
29
  const digit = remainder / denominator;
30
30
  decimalStr += digit.toString();
31
31
  remainder %= denominator;
@@ -1,20 +0,0 @@
1
- /**
2
- * @fileoverview CSS Styles Entry Point for @b3dotfun/sdk
3
- *
4
- * This file serves as the TypeScript entry point for importing the SDK's CSS styles.
5
- * It enables consumers to import styles using: `import "../styles"`
6
- *
7
- * @example
8
- * ```typescript
9
- * // In your app's main file:
10
- * import "../styles";
11
- * ```
12
- *
13
- * Technical Notes:
14
- * - This is a side-effect import that loads CSS into the page
15
- * - The TypeScript file is required for proper module resolution in monorepos
16
- * - The actual CSS is processed by the build system (PostCSS) and output to dist/styles/
17
- * - Contains B3 design system variables, fonts, and component styles
18
- */
19
- import "../../dist/styles/index.css";
20
- export {};
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /**
3
- * @fileoverview CSS Styles Entry Point for @b3dotfun/sdk
4
- *
5
- * This file serves as the TypeScript entry point for importing the SDK's CSS styles.
6
- * It enables consumers to import styles using: `import "../styles"`
7
- *
8
- * @example
9
- * ```typescript
10
- * // In your app's main file:
11
- * import "../styles";
12
- * ```
13
- *
14
- * Technical Notes:
15
- * - This is a side-effect import that loads CSS into the page
16
- * - The TypeScript file is required for proper module resolution in monorepos
17
- * - The actual CSS is processed by the build system (PostCSS) and output to dist/styles/
18
- * - Contains B3 design system variables, fonts, and component styles
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- // Side-effect import of the main CSS file
22
- require("../../dist/styles/index.css");
@@ -1,20 +0,0 @@
1
- /**
2
- * @fileoverview CSS Styles Entry Point for @b3dotfun/sdk
3
- *
4
- * This file serves as the TypeScript entry point for importing the SDK's CSS styles.
5
- * It enables consumers to import styles using: `import "../styles"`
6
- *
7
- * @example
8
- * ```typescript
9
- * // In your app's main file:
10
- * import "../styles";
11
- * ```
12
- *
13
- * Technical Notes:
14
- * - This is a side-effect import that loads CSS into the page
15
- * - The TypeScript file is required for proper module resolution in monorepos
16
- * - The actual CSS is processed by the build system (PostCSS) and output to dist/styles/
17
- * - Contains B3 design system variables, fonts, and component styles
18
- */
19
- import "../../dist/styles/index.css";
20
- export {};
@@ -1,20 +0,0 @@
1
- /**
2
- * @fileoverview CSS Styles Entry Point for @b3dotfun/sdk
3
- *
4
- * This file serves as the TypeScript entry point for importing the SDK's CSS styles.
5
- * It enables consumers to import styles using: `import "../styles"`
6
- *
7
- * @example
8
- * ```typescript
9
- * // In your app's main file:
10
- * import "../styles";
11
- * ```
12
- *
13
- * Technical Notes:
14
- * - This is a side-effect import that loads CSS into the page
15
- * - The TypeScript file is required for proper module resolution in monorepos
16
- * - The actual CSS is processed by the build system (PostCSS) and output to dist/styles/
17
- * - Contains B3 design system variables, fonts, and component styles
18
- */
19
- // Side-effect import of the main CSS file
20
- import "../../dist/styles/index.css";
@@ -1,20 +0,0 @@
1
- /**
2
- * @fileoverview CSS Styles Entry Point for @b3dotfun/sdk
3
- *
4
- * This file serves as the TypeScript entry point for importing the SDK's CSS styles.
5
- * It enables consumers to import styles using: `import "@b3dotfun/sdk/styles"`
6
- *
7
- * @example
8
- * ```typescript
9
- * // In your app's main file:
10
- * import "@b3dotfun/sdk/styles";
11
- * ```
12
- *
13
- * Technical Notes:
14
- * - This is a side-effect import that loads CSS into the page
15
- * - The TypeScript file is required for proper module resolution in monorepos
16
- * - The actual CSS is processed by the build system (PostCSS) and output to dist/styles/
17
- * - Contains B3 design system variables, fonts, and component styles
18
- */
19
- import "../../dist/styles/index.css";
20
- export {};
@@ -1,24 +0,0 @@
1
- /**
2
- * @fileoverview CSS Styles Entry Point for @b3dotfun/sdk
3
- *
4
- * This file serves as the TypeScript entry point for importing the SDK's CSS styles.
5
- * It enables consumers to import styles using: `import "@b3dotfun/sdk/styles"`
6
- *
7
- * @example
8
- * ```typescript
9
- * // In your app's main file:
10
- * import "@b3dotfun/sdk/styles";
11
- * ```
12
- *
13
- * Technical Notes:
14
- * - This is a side-effect import that loads CSS into the page
15
- * - The TypeScript file is required for proper module resolution in monorepos
16
- * - The actual CSS is processed by the build system (PostCSS) and output to dist/styles/
17
- * - Contains B3 design system variables, fonts, and component styles
18
- */
19
-
20
- // Side-effect import of the main CSS file
21
- import "../../dist/styles/index.css";
22
-
23
- // Export empty object to make this a valid ES module
24
- export {};