@b3dotfun/sdk 0.0.30 → 0.0.31-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 +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -1
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  5. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -1
  6. package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
  7. package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.js +2 -1
  8. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +23 -28
  9. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  10. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
  11. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -5
  12. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  13. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  14. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -3
  15. package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
  16. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -5
  17. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +5 -0
  18. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
  19. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
  20. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +94 -0
  21. package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
  22. package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +272 -0
  23. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +9 -51
  24. package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
  25. package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +8 -0
  26. package/dist/cjs/global-account/react/components/TokenIcon.d.ts +11 -0
  27. package/dist/cjs/global-account/react/components/TokenIcon.js +43 -0
  28. package/dist/cjs/global-account/react/components/ui/accordion.d.ts +7 -0
  29. package/dist/cjs/global-account/react/components/ui/accordion.js +53 -0
  30. package/dist/cjs/global-account/react/components/ui/dialog.js +1 -1
  31. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -0
  32. package/dist/cjs/global-account/react/hooks/index.js +5 -1
  33. package/dist/cjs/global-account/react/hooks/useAnalytics.d.ts +7 -0
  34. package/dist/cjs/global-account/react/hooks/useAnalytics.js +29 -0
  35. package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
  36. package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -1
  37. package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +24 -0
  38. package/dist/cjs/global-account/react/hooks/useSimBalance.js +29 -0
  39. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -1
  40. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -2
  41. package/dist/cjs/global-account/react/utils/profileDisplay.js +9 -0
  42. package/dist/cjs/global-account/utils/analytics.d.ts +16 -0
  43. package/dist/cjs/global-account/utils/analytics.js +55 -0
  44. package/dist/cjs/shared/constants/index.d.ts +1 -0
  45. package/dist/cjs/shared/constants/index.js +2 -1
  46. package/dist/cjs/shared/generated/chain-networks.json +185 -17
  47. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  48. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -1
  49. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -1
  50. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  51. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +5 -1
  52. package/dist/esm/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
  53. package/dist/esm/anyspend/react/components/common/ChainTokenIcon.js +2 -1
  54. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +22 -27
  55. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  56. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
  57. package/dist/esm/anyspend/react/components/common/OrderDetails.js +5 -5
  58. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  59. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  60. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
  61. package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
  62. package/dist/esm/global-account/react/components/B3DynamicModal.js +2 -5
  63. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +5 -0
  64. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
  65. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
  66. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +88 -0
  67. package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
  68. package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +266 -0
  69. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +12 -51
  70. package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
  71. package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +5 -0
  72. package/dist/esm/global-account/react/components/TokenIcon.d.ts +11 -0
  73. package/dist/esm/global-account/react/components/TokenIcon.js +37 -0
  74. package/dist/esm/global-account/react/components/ui/accordion.d.ts +7 -0
  75. package/dist/esm/global-account/react/components/ui/accordion.js +14 -0
  76. package/dist/esm/global-account/react/components/ui/dialog.js +1 -1
  77. package/dist/esm/global-account/react/hooks/index.d.ts +2 -0
  78. package/dist/esm/global-account/react/hooks/index.js +2 -0
  79. package/dist/esm/global-account/react/hooks/useAnalytics.d.ts +7 -0
  80. package/dist/esm/global-account/react/hooks/useAnalytics.js +26 -0
  81. package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
  82. package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -1
  83. package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +24 -0
  84. package/dist/esm/global-account/react/hooks/useSimBalance.js +26 -0
  85. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -1
  86. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -2
  87. package/dist/esm/global-account/react/utils/profileDisplay.js +9 -0
  88. package/dist/esm/global-account/utils/analytics.d.ts +16 -0
  89. package/dist/esm/global-account/utils/analytics.js +50 -0
  90. package/dist/esm/shared/constants/index.d.ts +1 -0
  91. package/dist/esm/shared/constants/index.js +1 -0
  92. package/dist/esm/shared/generated/chain-networks.json +185 -17
  93. package/dist/styles/index.css +1 -1
  94. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  95. package/dist/types/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
  96. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  97. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  98. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
  99. package/dist/types/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
  100. package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
  101. package/dist/types/global-account/react/components/TokenIcon.d.ts +11 -0
  102. package/dist/types/global-account/react/components/ui/accordion.d.ts +7 -0
  103. package/dist/types/global-account/react/hooks/index.d.ts +2 -0
  104. package/dist/types/global-account/react/hooks/useAnalytics.d.ts +7 -0
  105. package/dist/types/global-account/react/hooks/useSimBalance.d.ts +24 -0
  106. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -2
  107. package/dist/types/global-account/utils/analytics.d.ts +16 -0
  108. package/dist/types/shared/constants/index.d.ts +1 -0
  109. package/package.json +10 -18
  110. package/src/anyspend/react/components/AnySpend.tsx +1 -0
  111. package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
  112. package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -2
  113. package/src/anyspend/react/components/AnyspendDepositHype.tsx +10 -0
  114. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +4 -4
  115. package/src/anyspend/react/components/common/ChainTokenIcon.tsx +8 -2
  116. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +56 -107
  117. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +12 -3
  118. package/src/anyspend/react/components/common/OrderDetails.tsx +5 -5
  119. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -2
  120. package/src/anyspend/react/components/common/PanelOnramp.tsx +11 -5
  121. package/src/anyspend/react/components/common/PaySection.tsx +1 -1
  122. package/src/global-account/react/components/B3DynamicModal.tsx +8 -7
  123. package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
  124. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -1
  125. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +228 -0
  126. package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +568 -0
  127. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +86 -341
  128. package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +46 -0
  129. package/src/global-account/react/components/TokenIcon.tsx +87 -0
  130. package/src/global-account/react/components/ui/accordion.tsx +53 -0
  131. package/src/global-account/react/components/ui/dialog.tsx +1 -1
  132. package/src/global-account/react/hooks/index.ts +2 -0
  133. package/src/global-account/react/hooks/useAccountAssets.ts +1 -0
  134. package/src/global-account/react/hooks/useAnalytics.tsx +30 -0
  135. package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +3 -2
  136. package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
  137. package/src/global-account/react/hooks/useSimBalance.ts +56 -0
  138. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +3 -1
  139. package/src/global-account/react/stores/useModalStore.ts +2 -2
  140. package/src/global-account/react/utils/profileDisplay.ts +9 -0
  141. package/src/global-account/utils/analytics.ts +64 -0
  142. package/src/shared/constants/index.ts +2 -0
  143. package/src/shared/generated/chain-networks.json +185 -17
  144. package/src/{anyspend/types → types}/window.d.ts +5 -1
  145. package/dist/cjs/index.d.ts +0 -0
  146. package/dist/cjs/index.js +0 -2
  147. package/dist/esm/index.d.ts +0 -0
  148. package/dist/esm/index.js +0 -2
  149. package/dist/types/index.d.ts +0 -0
  150. package/src/index.ts +0 -1
@@ -0,0 +1,53 @@
1
+ "use client";
2
+
3
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
4
+ import { ChevronDown } from "lucide-react";
5
+ import * as React from "react";
6
+
7
+ import { cn } from "@b3dotfun/sdk/shared/utils";
8
+
9
+ const Accordion = AccordionPrimitive.Root;
10
+
11
+ const AccordionItem = React.forwardRef<
12
+ React.ElementRef<typeof AccordionPrimitive.Item>,
13
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
14
+ >(({ className, ...props }, ref) => (
15
+ <AccordionPrimitive.Item ref={ref} className={cn("border-b3-line border-b", className)} {...props} />
16
+ ));
17
+ AccordionItem.displayName = "AccordionItem";
18
+
19
+ const AccordionTrigger = React.forwardRef<
20
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
21
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
22
+ >(({ className, children, ...props }, ref) => (
23
+ <AccordionPrimitive.Header className="flex">
24
+ <AccordionPrimitive.Trigger
25
+ ref={ref}
26
+ className={cn(
27
+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
28
+ className,
29
+ )}
30
+ {...props}
31
+ >
32
+ {children}
33
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
34
+ </AccordionPrimitive.Trigger>
35
+ </AccordionPrimitive.Header>
36
+ ));
37
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
38
+
39
+ const AccordionContent = React.forwardRef<
40
+ React.ElementRef<typeof AccordionPrimitive.Content>,
41
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
42
+ >(({ className, children, ...props }, ref) => (
43
+ <AccordionPrimitive.Content
44
+ ref={ref}
45
+ className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all"
46
+ {...props}
47
+ >
48
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
49
+ </AccordionPrimitive.Content>
50
+ ));
51
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
52
+
53
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -64,7 +64,7 @@ const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.
64
64
  {!hideCloseButton && (
65
65
  <DialogPrimitive.Close
66
66
  className={cn(
67
- "data-[state=open]:bg-b3-react-background data-[state=open]:text-b3-react-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none dark:data-[state=open]:bg-gray-800 dark:data-[state=open]:text-gray-400",
67
+ "modal-close-button data-[state=open]:bg-b3-react-background data-[state=open]:text-b3-react-muted-foreground absolute right-2 top-2 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none dark:data-[state=open]:bg-gray-800 dark:data-[state=open]:text-gray-400",
68
68
  closeBtnClassName,
69
69
  )}
70
70
  >
@@ -1,6 +1,7 @@
1
1
  export { useAccountAssets } from "./useAccountAssets";
2
2
  export { useAccountWallet } from "./useAccountWallet";
3
3
  export { useAddTWSessionKey } from "./useAddTWSessionKey";
4
+ export { useAnalytics } from "./useAnalytics";
4
5
  export { useAuthentication } from "./useAuthentication";
5
6
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
6
7
  export { useB3EnsName } from "./useB3EnsName";
@@ -30,6 +31,7 @@ export { useQueryBSMNT } from "./useQueryBSMNT";
30
31
  export { useRemoveSessionKey } from "./useRemoveSessionKey";
31
32
  export { useRouter } from "./useRouter";
32
33
  export { useSearchParamsSSR } from "./useSearchParamsSSR";
34
+ export { useSimBalance } from "./useSimBalance";
33
35
  export { useSiwe } from "./useSiwe";
34
36
  export { useTokenBalance } from "./useTokenBalance";
35
37
  export { useTokenBalancesByChain } from "./useTokenBalancesByChain";
@@ -1,5 +1,6 @@
1
1
  import { fetchSimpleHashData } from "@b3dotfun/sdk/shared/utils/simplehash";
2
2
  import { useQuery } from "@tanstack/react-query";
3
+
3
4
  async function fetchAccountAssets(address: string) {
4
5
  if (!address) throw new Error("Address is required");
5
6
 
@@ -0,0 +1,30 @@
1
+ import { sendGA4Event } from "@b3dotfun/sdk/global-account/utils/analytics";
2
+ import { useAccountWallet } from "./useAccountWallet";
3
+
4
+ /**
5
+ * Analytics hook that provides sendAnalyticsEvent function
6
+ * Automatically includes user address from useAccountWallet
7
+ */
8
+ export function useAnalytics() {
9
+ const { address } = useAccountWallet();
10
+
11
+ /**
12
+ * Sends an analytics event to Google Analytics 4
13
+ * @param eventName - The name of the event to track
14
+ * @param parameters - Additional parameters to include with the event
15
+ */
16
+ const sendAnalyticsEvent = (eventName: string, parameters?: Record<string, any>) => {
17
+ // Merge user address with custom parameters
18
+ const eventData = {
19
+ user_address: address,
20
+ ...parameters,
21
+ };
22
+
23
+ // Send event to GA4 using utility function
24
+ sendGA4Event(eventName, eventData);
25
+ };
26
+
27
+ return {
28
+ sendAnalyticsEvent,
29
+ };
30
+ }
@@ -1,4 +1,5 @@
1
1
  import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
2
+ import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
2
3
  import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
3
4
  import { useQuery } from "@tanstack/react-query";
4
5
  import { createPublicClient, formatUnits, http } from "viem";
@@ -19,7 +20,7 @@ const abi = [
19
20
  // Create a public client for Base
20
21
  const client = createPublicClient({
21
22
  chain: base,
22
- transport: http(),
23
+ transport: http(PUBLIC_BASE_RPC_URL),
23
24
  });
24
25
 
25
26
  async function fetchB3Balances(addresses: string[]): Promise<{
@@ -45,7 +46,7 @@ async function fetchB3Balances(addresses: string[]): Promise<{
45
46
  const balances = await Promise.all(
46
47
  addresses.map(async address => {
47
48
  const balance = await client.readContract({
48
- address: B3_TOKEN.address,
49
+ address: B3_TOKEN.address as `0x${string}`,
49
50
  abi,
50
51
  functionName: "balanceOf",
51
52
  args: [address as `0x${string}`],
@@ -1,3 +1,4 @@
1
+ import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
1
2
  import { b3Mainnet, b3Testnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
2
3
  import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
3
4
  import { useQuery } from "@tanstack/react-query";
@@ -114,7 +115,7 @@ export function useNativeBalanceFromRPC(address: string, chainId: number) {
114
115
  try {
115
116
  const publicClient = createPublicClient({
116
117
  chain: chainId === 8333 ? b3Mainnet : b3Testnet,
117
- transport: http(),
118
+ transport: http(chainId === 8333 ? PUBLIC_BASE_RPC_URL : undefined),
118
119
  });
119
120
 
120
121
  const balance = await publicClient.getBalance({
@@ -0,0 +1,56 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+
3
+ export interface SimTokenMetadata {
4
+ logo?: string;
5
+ }
6
+
7
+ export interface SimBalanceItem {
8
+ chain: string;
9
+ chain_id: number;
10
+ address: string;
11
+ amount: string;
12
+ symbol: string;
13
+ decimals: number;
14
+ price_usd?: number;
15
+ value_usd?: number;
16
+ name?: string;
17
+ token_metadata?: SimTokenMetadata;
18
+ pool_size?: number;
19
+ low_liquidity?: boolean;
20
+ }
21
+
22
+ export interface SimBalanceResponse {
23
+ request_time: string;
24
+ response_time: string;
25
+ wallet_address: string;
26
+ balances: SimBalanceItem[];
27
+ }
28
+
29
+ async function fetchSimBalance(address: string): Promise<SimBalanceResponse> {
30
+ if (!address) throw new Error("Address is required");
31
+
32
+ let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
33
+ if (process.env.PUBLIC_LOCAL_KEY) {
34
+ url += `&localkey=${process.env.PUBLIC_LOCAL_KEY}`;
35
+ }
36
+
37
+ const response = await fetch(url);
38
+
39
+ if (!response.ok) {
40
+ throw new Error(`Failed to fetch balance: ${response.statusText}`);
41
+ }
42
+
43
+ const balanceData: SimBalanceResponse = await response.json();
44
+ return balanceData;
45
+ }
46
+
47
+ export function useSimBalance(address?: string) {
48
+ return useQuery({
49
+ queryKey: ["simBalance", address],
50
+ queryFn: () => {
51
+ if (!address) throw new Error("Address is required");
52
+ return fetchSimBalance(address);
53
+ },
54
+ enabled: Boolean(address),
55
+ });
56
+ }
@@ -9,6 +9,7 @@ import { prepareTransaction, sendTransaction as twSendTransaction } from "thirdw
9
9
  import { useSwitchChain, useWalletClient } from "wagmi";
10
10
  import { useB3 } from "../components";
11
11
  import { useAccountWallet } from "./useAccountWallet";
12
+ import { isAddress } from "viem";
12
13
 
13
14
  export interface UnifiedTransactionParams {
14
15
  to: string;
@@ -56,6 +57,8 @@ export function useUnifiedChainSwitchAndExecute() {
56
57
  throw new Error(`Chain ${targetChainId} is not supported`);
57
58
  }
58
59
 
60
+ invariant(isAddress(params.to), "params.to is not a valid address");
61
+
59
62
  const hash = await walletClient.sendTransaction({
60
63
  account: signer,
61
64
  chain: targetChain,
@@ -133,7 +136,6 @@ export function useUnifiedChainSwitchAndExecute() {
133
136
 
134
137
  const chain = getThirdwebChain(targetChainId);
135
138
 
136
- toast.info("Preparing transaction…");
137
139
  const transaction = prepareTransaction({
138
140
  client,
139
141
  chain,
@@ -84,9 +84,9 @@ export interface ManageAccountModalProps extends BaseModalProps {
84
84
  /** Partner ID */
85
85
  partnerId: string;
86
86
  /** Active Tab */
87
- activeTab?: "balance" | "assets" | "apps" | "settings";
87
+ activeTab?: "overview" | "tokens" | "nfts" | "apps" | "settings";
88
88
  /** Function to set the active tab */
89
- setActiveTab?: (tab: "balance" | "assets" | "apps" | "settings") => void;
89
+ setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
90
90
  }
91
91
 
92
92
  /**
@@ -45,6 +45,15 @@ export function getProfileDisplayInfo(profile: ExtendedProfile): ProfileDisplayI
45
45
  type,
46
46
  };
47
47
  break;
48
+ case "farcaster":
49
+ displayInfo = {
50
+ title: details.name || details.username || "Unknown",
51
+ subtitle: details.username ? `@${details.username}` : "Farcaster Account",
52
+ imageUrl: details.profileImageUrl || null,
53
+ initial: "F",
54
+ type,
55
+ };
56
+ break;
48
57
  case "google":
49
58
  displayInfo = {
50
59
  title: details.name || details.email || "Unknown",
@@ -0,0 +1,64 @@
1
+ // Global window interface augmentations for B3 SDK
2
+
3
+ declare global {
4
+ interface Window {
5
+ // Google Analytics 4
6
+ gtag: (...args: any[]) => void;
7
+ dataLayer: any[];
8
+ }
9
+ }
10
+
11
+ const GA4_MEASUREMENT_ID = "G-VER9DKJH87";
12
+
13
+ /**
14
+ * Initialize Google Analytics 4
15
+ */
16
+ const initializeGA4 = () => {
17
+ // Only initialize in browser environment
18
+ if (typeof window === "undefined") return;
19
+
20
+ // Create gtag function if it doesn't exist
21
+ if (!window.gtag) {
22
+ window.dataLayer = window.dataLayer || [];
23
+ window.gtag = function gtag() {
24
+ window.dataLayer.push(arguments);
25
+ };
26
+ }
27
+
28
+ // Configure GA4
29
+ window.gtag("js", new Date());
30
+ window.gtag("config", GA4_MEASUREMENT_ID, {
31
+ page_location: window.location.href,
32
+ page_hostname: window.location.hostname,
33
+ });
34
+ };
35
+
36
+ /**
37
+ * Load Google Analytics 4 script and initialize
38
+ */
39
+ export const loadGA4Script = () => {
40
+ if (typeof window === "undefined") return;
41
+
42
+ // Check if script is already loaded
43
+ if (document.querySelector(`script[src*="${GA4_MEASUREMENT_ID}"]`)) return;
44
+
45
+ const script = document.createElement("script");
46
+ script.async = true;
47
+ script.src = `https://www.googletagmanager.com/gtag/js?id=${GA4_MEASUREMENT_ID}`;
48
+ document.head.appendChild(script);
49
+
50
+ script.onload = initializeGA4;
51
+ };
52
+
53
+ /**
54
+ * Send an analytics event to Google Analytics 4
55
+ * @param eventName - The name of the event to track
56
+ * @param parameters - Additional parameters to include with the event
57
+ */
58
+ export const sendGA4Event = (eventName: string, parameters?: Record<string, any>) => {
59
+ // Only send events in browser environment
60
+ if (typeof window === "undefined" || !window.gtag) return;
61
+
62
+ // Send event to GA4
63
+ window.gtag("event", eventName, parameters || {});
64
+ };
@@ -28,3 +28,5 @@ export const CLIENT_APP_BUNDLE_ID = process.env.EXPO_PUBLIC_B3_BUNDLE_ID || "";
28
28
  export const B3_AUTH_COOKIE_NAME = "b3-auth";
29
29
 
30
30
  export const ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
31
+
32
+ export const PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";
@@ -29,7 +29,7 @@
29
29
  "testnetConfigID": "66b380b0fae0f6d8266798d0",
30
30
  "badge": "https://cdn.b3.fun/b3_logo.svg",
31
31
  "color": "#3368ef",
32
- "enabledFeatures": ["explorer.all", "basement.all"]
32
+ "enabledFeatures": ["basement", "explorer"]
33
33
  },
34
34
  {
35
35
  "_id": "66b380b0fae0f6d8266798d0",
@@ -49,7 +49,7 @@
49
49
  "format": "svg"
50
50
  },
51
51
  "blockExplorers": {
52
- "default": "https://sepolia-explorer.b3.fun",
52
+ "default": "https://sepolia.explorer.b3.fun",
53
53
  "explorerTitle": "B3 Sepolia Explorer"
54
54
  },
55
55
  "nativeCurrency": {
@@ -59,7 +59,8 @@
59
59
  },
60
60
  "testnet": true,
61
61
  "badge": "https://cdn.b3.fun/b3_logo.svg",
62
- "color": "#3368ef"
62
+ "color": "#3368ef",
63
+ "enabledFeatures": ["basement", "explorer"]
63
64
  },
64
65
  {
65
66
  "_id": "66f2044afe5a3ac32a1de9ff",
@@ -89,7 +90,8 @@
89
90
  },
90
91
  "testnet": false,
91
92
  "badge": "https://cdn.b3.fun/base-badge.svg",
92
- "color": "#004ae7"
93
+ "color": "#004ae7",
94
+ "enabledFeatures": ["basement", "explorer"]
93
95
  },
94
96
  {
95
97
  "_id": "66f3221afe5a3ac32a1dea00",
@@ -119,7 +121,8 @@
119
121
  },
120
122
  "testnet": false,
121
123
  "badge": "https://cdn.b3.fun/base-badge.svg",
122
- "color": "#004ae7"
124
+ "color": "#004ae7",
125
+ "enabledFeatures": ["basement"]
123
126
  },
124
127
  {
125
128
  "_id": "6706b240d442b7a2f8cb9efa",
@@ -149,7 +152,8 @@
149
152
  },
150
153
  "testnet": true,
151
154
  "badge": "https://cdn.b3.fun/eth-badge.svg",
152
- "color": "#B38DF0"
155
+ "color": "#B38DF0",
156
+ "enabledFeatures": ["basement"]
153
157
  },
154
158
  {
155
159
  "_id": "671945d9d442b7a2f8cb9efe",
@@ -178,7 +182,8 @@
178
182
  },
179
183
  "testnet": true,
180
184
  "badge": "https://cdn.b3.fun/eth-badge.svg",
181
- "color": "#B38DF0"
185
+ "color": "#B38DF0",
186
+ "enabledFeatures": ["basement"]
182
187
  },
183
188
  {
184
189
  "_id": "679a4a91703428bb5bb2f1ba",
@@ -208,7 +213,8 @@
208
213
  },
209
214
  "testnet": false,
210
215
  "badge": "https://cdn.b3.fun/avalanche-badge.svg",
211
- "color": "#c33738"
216
+ "color": "#c33738",
217
+ "enabledFeatures": ["basement"]
212
218
  },
213
219
  {
214
220
  "_id": "679be46ca0f78fd619f6954b",
@@ -238,7 +244,8 @@
238
244
  },
239
245
  "testnet": false,
240
246
  "badge": "https://cdn.b3.fun/geist-logo.svg",
241
- "color": "#808080"
247
+ "color": "#808080",
248
+ "enabledFeatures": ["basement"]
242
249
  },
243
250
  {
244
251
  "_id": "679be960a0f78fd619f6954d",
@@ -268,7 +275,8 @@
268
275
  },
269
276
  "testnet": false,
270
277
  "badge": "https://cdn.b3.fun/arbitrum-badge.svg",
271
- "color": "#4a5c7e"
278
+ "color": "#4a5c7e",
279
+ "enabledFeatures": ["basement"]
272
280
  },
273
281
  {
274
282
  "_id": "679be9eba0f78fd619f6954f",
@@ -298,7 +306,8 @@
298
306
  },
299
307
  "testnet": false,
300
308
  "badge": "https://cdn.b3.fun/ronin-logo.svg",
301
- "color": "#004de5"
309
+ "color": "#004de5",
310
+ "enabledFeatures": ["basement"]
302
311
  },
303
312
  {
304
313
  "_id": "679beabca0f78fd619f69551",
@@ -328,7 +337,8 @@
328
337
  },
329
338
  "testnet": false,
330
339
  "badge": "https://cdn.b3.fun/solana-logo.png",
331
- "color": "#9945FF"
340
+ "color": "#9945FF",
341
+ "enabledFeatures": ["basement"]
332
342
  },
333
343
  {
334
344
  "_id": "67a452dda0f78fd619f69558",
@@ -358,7 +368,8 @@
358
368
  },
359
369
  "testnet": true,
360
370
  "badge": "https://cdn.b3.fun/gunz-logo.svg",
361
- "color": "#c8edfa"
371
+ "color": "#c8edfa",
372
+ "enabledFeatures": ["basement"]
362
373
  },
363
374
  {
364
375
  "_id": "67aede9db3ba503f51eeaff7",
@@ -388,7 +399,8 @@
388
399
  },
389
400
  "testnet": false,
390
401
  "badge": "https://cdn.b3.fun/ton-logo.svg",
391
- "color": "#0088cc"
402
+ "color": "#0088cc",
403
+ "enabledFeatures": ["basement"]
392
404
  },
393
405
  {
394
406
  "_id": "67b7895fb3ba503f51eeaffc",
@@ -418,7 +430,8 @@
418
430
  },
419
431
  "testnet": false,
420
432
  "badge": "https://cdn.b3.fun/optimism-badge.svg",
421
- "color": "#d6031b"
433
+ "color": "#d6031b",
434
+ "enabledFeatures": ["basement"]
422
435
  },
423
436
  {
424
437
  "_id": "67bcbdb782f62aa6dc1efa60",
@@ -448,7 +461,8 @@
448
461
  },
449
462
  "testnet": false,
450
463
  "badge": "https://cdn.b3.fun/polygon-badge.svg",
451
- "color": "#7540cf"
464
+ "color": "#7540cf",
465
+ "enabledFeatures": ["basement"]
452
466
  },
453
467
  {
454
468
  "_id": "6837258b25c59b8e08f806bf",
@@ -478,6 +492,160 @@
478
492
  },
479
493
  "testnet": false,
480
494
  "badge": "https://avatars.githubusercontent.com/u/45615063?s=280&v=4",
481
- "color": "#F3BA2F"
495
+ "color": "#F3BA2F",
496
+ "enabledFeatures": ["basement"]
497
+ },
498
+ {
499
+ "_id": "684afd314a478ffb44a4f83e",
500
+ "id": 19934,
501
+ "name": "B4 Testnet",
502
+ "rpcUrls": {
503
+ "default": {
504
+ "http": "https://b4-testnet.rpc.caldera.xyz/http",
505
+ "ws": "wss://b4-testnet.rpc.caldera.xyz/ws"
506
+ },
507
+ "backups": []
508
+ },
509
+ "icon": {
510
+ "url": "https://cdn.b3.fun/b4-logo.png",
511
+ "width": 32,
512
+ "height": 32,
513
+ "format": "svg"
514
+ },
515
+ "blockExplorers": {
516
+ "default": "https://b4-testnet.explorer.caldera.xyz",
517
+ "explorerTitle": "B4 Testnet Explorer"
518
+ },
519
+ "nativeCurrency": {
520
+ "name": "Ether",
521
+ "symbol": "ETH",
522
+ "decimals": 18
523
+ },
524
+ "testnet": true,
525
+ "badge": "https://cdn.b3.fun/b4-logo.png",
526
+ "color": "#3368ef",
527
+ "enabledFeatures": ["explorer"]
528
+ },
529
+ {
530
+ "_id": "684afdec4a478ffb44a4f83f",
531
+ "id": 243,
532
+ "name": "Reach Testnet",
533
+ "rpcUrls": {
534
+ "default": {
535
+ "http": "https://reach-testnet.rpc.caldera.xyz/http",
536
+ "ws": "wss://reach-testnet.rpc.caldera.xyz/ws"
537
+ },
538
+ "backups": []
539
+ },
540
+ "icon": {
541
+ "url": "https://cdn.b3.fun/reach-logo.png",
542
+ "width": 32,
543
+ "height": 32,
544
+ "format": "png"
545
+ },
546
+ "blockExplorers": {
547
+ "default": "https://reach-testnet.explorer.caldera.xyz",
548
+ "explorerTitle": "Reach Testnet Explorer"
549
+ },
550
+ "nativeCurrency": {
551
+ "name": "Ether",
552
+ "symbol": "ETH",
553
+ "decimals": 18
554
+ },
555
+ "testnet": true,
556
+ "badge": "https://cdn.b3.fun/reach-logo.png",
557
+ "color": "#3368ef",
558
+ "enabledFeatures": ["explorer"]
559
+ },
560
+ {
561
+ "_id": "684afed04a478ffb44a4f840",
562
+ "id": 10211403,
563
+ "name": "GLHF Testnet",
564
+ "rpcUrls": {
565
+ "default": {
566
+ "http": "https://glhf-testnet.rpc.caldera.xyz/http",
567
+ "ws": "wss://glhf-testnet.rpc.caldera.xyz/ws"
568
+ },
569
+ "backups": []
570
+ },
571
+ "icon": {
572
+ "url": "https://cdn.b3.fun/supergaming-logo.png",
573
+ "width": 62,
574
+ "height": 48,
575
+ "format": "png"
576
+ },
577
+ "blockExplorers": {
578
+ "default": "https://glhf-testnet.explorer.caldera.xyz",
579
+ "explorerTitle": "SuperGaming Testnet Explorer"
580
+ },
581
+ "nativeCurrency": {
582
+ "name": "Ether",
583
+ "symbol": "ETH",
584
+ "decimals": 18
585
+ },
586
+ "testnet": true,
587
+ "badge": "https://cdn.b3.fun/supergaming-logo.png",
588
+ "color": "#000000",
589
+ "enabledFeatures": ["explorer"]
590
+ },
591
+ {
592
+ "_id": "685341f5ac22b8c3faae86ae",
593
+ "id": 4224,
594
+ "name": "Arpa Testnet",
595
+ "rpcUrls": {
596
+ "default": {
597
+ "http": "https://arpachain.calderachain.xyz/http",
598
+ "ws": "wss://arpachain.calderachain.xyz/ws"
599
+ },
600
+ "backups": []
601
+ },
602
+ "icon": {
603
+ "url": "https://cdn.b3.fun/arpa-logo.png",
604
+ "width": 175,
605
+ "height": 158,
606
+ "format": "png"
607
+ },
608
+ "blockExplorers": {
609
+ "default": "https://arpachain.calderaexplorer.xyz/",
610
+ "explorerTitle": "ArpaChain Testnet Explorer"
611
+ },
612
+ "nativeCurrency": {
613
+ "name": "Ether",
614
+ "symbol": "ETH",
615
+ "decimals": 18
616
+ },
617
+ "testnet": true,
618
+ "badge": "https://cdn.b3.fun/arpa-logo.png",
619
+ "color": "#3368ef",
620
+ "enabledFeatures": ["explorer"]
621
+ },
622
+ {
623
+ "_id": "68a351c603e65c07b7645581",
624
+ "id": 1448000,
625
+ "name": "XRPLT",
626
+ "rpcUrls": {
627
+ "default": {
628
+ "http": "https://xrplt.rpc.caldera.xyz/http",
629
+ "ws": "wss://xrplt.rpc.caldera.xyz/ws"
630
+ },
631
+ "backups": []
632
+ },
633
+ "icon": {
634
+ "url": "https://cdn.b3.fun/xrpl_logo.svg",
635
+ "width": 32,
636
+ "height": 32,
637
+ "format": "svg"
638
+ },
639
+ "blockExplorers": {
640
+ "default": "https://xrplt.explorer.caldera.xyz/",
641
+ "explorerTitle": "XRPLT Explorer"
642
+ },
643
+ "nativeCurrency": {
644
+ "name": "XRP",
645
+ "symbol": "XRP",
646
+ "decimals": 18
647
+ },
648
+ "testnet": true,
649
+ "enabledFeatures": ["xcade", "explorer"]
482
650
  }
483
651
  ]
@@ -1,7 +1,8 @@
1
- // Global window interface augmentations for AnySpend wallet providers
1
+ // Global window interface augmentations for B3 SDK
2
2
 
3
3
  declare global {
4
4
  interface Window {
5
+ // AnySpend wallet providers
5
6
  phantom?: {
6
7
  solana?: {
7
8
  isPhantom?: boolean;
@@ -9,6 +10,9 @@ declare global {
9
10
  signAndSendTransaction: (transaction: any) => Promise<{ signature: string }>;
10
11
  };
11
12
  };
13
+ // Google Analytics 4
14
+ gtag: (...args: any[]) => void;
15
+ dataLayer: any[];
12
16
  }
13
17
  }
14
18
 
File without changes
package/dist/cjs/index.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //