@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,11 @@
1
+ import React from "react";
2
+ interface TokenIconProps {
3
+ src: string;
4
+ alt: string;
5
+ className?: string;
6
+ size?: number;
7
+ }
8
+ export declare const TokenIcon: React.FC<TokenIconProps>;
9
+ export declare const B3TokenIcon: React.FC<Omit<TokenIconProps, "src" | "alt">>;
10
+ export declare const EthereumTokenIcon: React.FC<Omit<TokenIconProps, "src" | "alt">>;
11
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EthereumTokenIcon = exports.B3TokenIcon = exports.TokenIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const utils_1 = require("../../../shared/utils");
6
+ const react_1 = require("react");
7
+ // Create a global image cache to prevent re-loading
8
+ const imageCache = new Map();
9
+ const TokenIcon = ({ src, alt, className, size = 40 }) => {
10
+ const [isLoaded, setIsLoaded] = (0, react_1.useState)(() => imageCache.get(src) || false);
11
+ const [hasError, setHasError] = (0, react_1.useState)(false);
12
+ const handleLoad = (0, react_1.useCallback)(() => {
13
+ imageCache.set(src, true);
14
+ setIsLoaded(true);
15
+ }, [src]);
16
+ const handleError = (0, react_1.useCallback)(() => {
17
+ setHasError(true);
18
+ }, []);
19
+ // Memoize the image element to prevent unnecessary re-renders
20
+ const imageElement = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)("img", { src: src, alt: alt, className: (0, utils_1.cn)("transition-opacity duration-200", className, {
21
+ "opacity-100": isLoaded && !hasError,
22
+ "opacity-0": !isLoaded || hasError,
23
+ }), onLoad: handleLoad, onError: handleError, loading: "eager" // Load immediately since these are critical UI elements
24
+ , decoding: "async", style: {
25
+ width: size,
26
+ height: size,
27
+ } })), [src, alt, className, isLoaded, hasError, handleLoad, handleError, size]);
28
+ // Show a placeholder while loading or if there's an error
29
+ const placeholder = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-b3-primary-wash flex items-center justify-center rounded-full transition-opacity duration-200", {
30
+ "opacity-0": isLoaded && !hasError,
31
+ "opacity-100": !isLoaded || hasError,
32
+ }), style: {
33
+ width: size,
34
+ height: size,
35
+ }, children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-xs", children: alt.charAt(0).toUpperCase() }) })), [alt, isLoaded, hasError, size]);
36
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "relative inline-block", style: { width: size, height: size }, children: [placeholder, (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0", children: imageElement })] }));
37
+ };
38
+ exports.TokenIcon = TokenIcon;
39
+ // Pre-defined token icons for common tokens
40
+ const B3TokenIcon = props => ((0, jsx_runtime_1.jsx)(exports.TokenIcon, { src: "https://cdn.b3.fun/b3-coin-3d.png", alt: "B3", ...props }));
41
+ exports.B3TokenIcon = B3TokenIcon;
42
+ const EthereumTokenIcon = props => ((0, jsx_runtime_1.jsx)(exports.TokenIcon, { src: "https://cdn.b3.fun/ethereum.svg", alt: "ETH", ...props }));
43
+ exports.EthereumTokenIcon = EthereumTokenIcon;
@@ -0,0 +1,7 @@
1
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
2
+ import * as React from "react";
3
+ declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
4
+ declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AccordionTrigger = exports.AccordionItem = exports.AccordionContent = exports.Accordion = void 0;
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ const AccordionPrimitive = __importStar(require("@radix-ui/react-accordion"));
40
+ const lucide_react_1 = require("lucide-react");
41
+ const React = __importStar(require("react"));
42
+ const utils_1 = require("../../../../shared/utils");
43
+ const Accordion = AccordionPrimitive.Root;
44
+ exports.Accordion = Accordion;
45
+ const AccordionItem = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Item, { ref: ref, className: (0, utils_1.cn)("border-b3-line border-b", className), ...props })));
46
+ exports.AccordionItem = AccordionItem;
47
+ AccordionItem.displayName = "AccordionItem";
48
+ const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Header, { className: "flex", children: (0, jsx_runtime_1.jsxs)(AccordionPrimitive.Trigger, { ref: ref, className: (0, utils_1.cn)("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180", className), ...props, children: [children, (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200" })] }) })));
49
+ exports.AccordionTrigger = AccordionTrigger;
50
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
51
+ const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Content, { ref: ref, className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all", ...props, children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("pb-4 pt-0", className), children: children }) })));
52
+ exports.AccordionContent = AccordionContent;
53
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
@@ -53,7 +53,7 @@ exports.DialogOverlay = DialogOverlay;
53
53
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
54
54
  const DialogContent = React.forwardRef(({ className, children, hideCloseButton = false, closeBtnClassName, ...props }, ref) => {
55
55
  const container = typeof window !== "undefined" ? document.getElementById("b3-root") : null;
56
- return ((0, jsx_runtime_1.jsxs)(DialogPortal, { container: container, children: [(0, jsx_runtime_1.jsx)(DialogOverlay, {}), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)("bg-b3-react-background fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border p-6 shadow-lg !outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", "[perspective:1200px] [transform-style:preserve-3d] sm:rounded-xl", "transition-all ease-out", className), ...props, children: [children, !hideCloseButton && ((0, jsx_runtime_1.jsxs)(DialogPrimitive.Close, { className: (0, utils_1.cn)("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", closeBtnClassName), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-5 w-5" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] }))] })] }));
56
+ return ((0, jsx_runtime_1.jsxs)(DialogPortal, { container: container, children: [(0, jsx_runtime_1.jsx)(DialogOverlay, {}), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)("bg-b3-react-background fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border p-6 shadow-lg !outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", "[perspective:1200px] [transform-style:preserve-3d] sm:rounded-xl", "transition-all ease-out", className), ...props, children: [children, !hideCloseButton && ((0, jsx_runtime_1.jsxs)(DialogPrimitive.Close, { className: (0, utils_1.cn)("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", closeBtnClassName), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-5 w-5" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] }))] })] }));
57
57
  });
58
58
  exports.DialogContent = DialogContent;
59
59
  DialogContent.displayName = DialogPrimitive.Content.displayName;
@@ -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";
@@ -24,6 +25,7 @@ export { useQueryBSMNT } from "./useQueryBSMNT";
24
25
  export { useRemoveSessionKey } from "./useRemoveSessionKey";
25
26
  export { useRouter } from "./useRouter";
26
27
  export { useSearchParamsSSR } from "./useSearchParamsSSR";
28
+ export { useSimBalance } from "./useSimBalance";
27
29
  export { useSiwe } from "./useSiwe";
28
30
  export { useTokenBalance } from "./useTokenBalance";
29
31
  export { useTokenBalancesByChain } from "./useTokenBalancesByChain";
@@ -14,13 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useChainSwitchWithAction = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
17
+ exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useChainSwitchWithAction = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
18
18
  var useAccountAssets_1 = require("./useAccountAssets");
19
19
  Object.defineProperty(exports, "useAccountAssets", { enumerable: true, get: function () { return useAccountAssets_1.useAccountAssets; } });
20
20
  var useAccountWallet_1 = require("./useAccountWallet");
21
21
  Object.defineProperty(exports, "useAccountWallet", { enumerable: true, get: function () { return useAccountWallet_1.useAccountWallet; } });
22
22
  var useAddTWSessionKey_1 = require("./useAddTWSessionKey");
23
23
  Object.defineProperty(exports, "useAddTWSessionKey", { enumerable: true, get: function () { return useAddTWSessionKey_1.useAddTWSessionKey; } });
24
+ var useAnalytics_1 = require("./useAnalytics");
25
+ Object.defineProperty(exports, "useAnalytics", { enumerable: true, get: function () { return useAnalytics_1.useAnalytics; } });
24
26
  var useAuthentication_1 = require("./useAuthentication");
25
27
  Object.defineProperty(exports, "useAuthentication", { enumerable: true, get: function () { return useAuthentication_1.useAuthentication; } });
26
28
  var useB3BalanceFromAddresses_1 = require("./useB3BalanceFromAddresses");
@@ -68,6 +70,8 @@ var useRouter_1 = require("./useRouter");
68
70
  Object.defineProperty(exports, "useRouter", { enumerable: true, get: function () { return useRouter_1.useRouter; } });
69
71
  var useSearchParamsSSR_1 = require("./useSearchParamsSSR");
70
72
  Object.defineProperty(exports, "useSearchParamsSSR", { enumerable: true, get: function () { return useSearchParamsSSR_1.useSearchParamsSSR; } });
73
+ var useSimBalance_1 = require("./useSimBalance");
74
+ Object.defineProperty(exports, "useSimBalance", { enumerable: true, get: function () { return useSimBalance_1.useSimBalance; } });
71
75
  var useSiwe_1 = require("./useSiwe");
72
76
  Object.defineProperty(exports, "useSiwe", { enumerable: true, get: function () { return useSiwe_1.useSiwe; } });
73
77
  var useTokenBalance_1 = require("./useTokenBalance");
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Analytics hook that provides sendAnalyticsEvent function
3
+ * Automatically includes user address from useAccountWallet
4
+ */
5
+ export declare function useAnalytics(): {
6
+ sendAnalyticsEvent: (eventName: string, parameters?: Record<string, any>) => void;
7
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAnalytics = useAnalytics;
4
+ const analytics_1 = require("../../../global-account/utils/analytics");
5
+ const useAccountWallet_1 = require("./useAccountWallet");
6
+ /**
7
+ * Analytics hook that provides sendAnalyticsEvent function
8
+ * Automatically includes user address from useAccountWallet
9
+ */
10
+ function useAnalytics() {
11
+ const { address } = (0, useAccountWallet_1.useAccountWallet)();
12
+ /**
13
+ * Sends an analytics event to Google Analytics 4
14
+ * @param eventName - The name of the event to track
15
+ * @param parameters - Additional parameters to include with the event
16
+ */
17
+ const sendAnalyticsEvent = (eventName, parameters) => {
18
+ // Merge user address with custom parameters
19
+ const eventData = {
20
+ user_address: address,
21
+ ...parameters,
22
+ };
23
+ // Send event to GA4 using utility function
24
+ (0, analytics_1.sendGA4Event)(eventName, eventData);
25
+ };
26
+ return {
27
+ sendAnalyticsEvent,
28
+ };
29
+ }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useB3BalanceFromAddresses = useB3BalanceFromAddresses;
4
4
  const anyspend_1 = require("../../../anyspend");
5
+ const constants_1 = require("../../../shared/constants");
5
6
  const formatNumber_1 = require("../../../shared/utils/formatNumber");
6
7
  const react_query_1 = require("@tanstack/react-query");
7
8
  const viem_1 = require("viem");
@@ -20,7 +21,7 @@ const abi = [
20
21
  // Create a public client for Base
21
22
  const client = (0, viem_1.createPublicClient)({
22
23
  chain: chains_1.base,
23
- transport: (0, viem_1.http)(),
24
+ transport: (0, viem_1.http)(constants_1.PUBLIC_BASE_RPC_URL),
24
25
  });
25
26
  async function fetchB3Balances(addresses) {
26
27
  try {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useNativeBalance = useNativeBalance;
4
4
  exports.useNativeBalanceFromRPC = useNativeBalanceFromRPC;
5
+ const constants_1 = require("../../../shared/constants");
5
6
  const supported_1 = require("../../../shared/constants/chains/supported");
6
7
  const formatNumber_1 = require("../../../shared/utils/formatNumber");
7
8
  const react_query_1 = require("@tanstack/react-query");
@@ -90,7 +91,7 @@ function useNativeBalanceFromRPC(address, chainId) {
90
91
  try {
91
92
  const publicClient = (0, viem_1.createPublicClient)({
92
93
  chain: chainId === 8333 ? supported_1.b3Mainnet : supported_1.b3Testnet,
93
- transport: (0, viem_1.http)(),
94
+ transport: (0, viem_1.http)(chainId === 8333 ? constants_1.PUBLIC_BASE_RPC_URL : undefined),
94
95
  });
95
96
  const balance = await publicClient.getBalance({
96
97
  address: address,
@@ -0,0 +1,24 @@
1
+ export interface SimTokenMetadata {
2
+ logo?: string;
3
+ }
4
+ export interface SimBalanceItem {
5
+ chain: string;
6
+ chain_id: number;
7
+ address: string;
8
+ amount: string;
9
+ symbol: string;
10
+ decimals: number;
11
+ price_usd?: number;
12
+ value_usd?: number;
13
+ name?: string;
14
+ token_metadata?: SimTokenMetadata;
15
+ pool_size?: number;
16
+ low_liquidity?: boolean;
17
+ }
18
+ export interface SimBalanceResponse {
19
+ request_time: string;
20
+ response_time: string;
21
+ wallet_address: string;
22
+ balances: SimBalanceItem[];
23
+ }
24
+ export declare function useSimBalance(address?: string): import("@tanstack/react-query").UseQueryResult<SimBalanceResponse, Error>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSimBalance = useSimBalance;
4
+ const react_query_1 = require("@tanstack/react-query");
5
+ async function fetchSimBalance(address) {
6
+ if (!address)
7
+ throw new Error("Address is required");
8
+ let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
9
+ if (process.env.PUBLIC_LOCAL_KEY) {
10
+ url += `&localkey=${process.env.PUBLIC_LOCAL_KEY}`;
11
+ }
12
+ const response = await fetch(url);
13
+ if (!response.ok) {
14
+ throw new Error(`Failed to fetch balance: ${response.statusText}`);
15
+ }
16
+ const balanceData = await response.json();
17
+ return balanceData;
18
+ }
19
+ function useSimBalance(address) {
20
+ return (0, react_query_1.useQuery)({
21
+ queryKey: ["simBalance", address],
22
+ queryFn: () => {
23
+ if (!address)
24
+ throw new Error("Address is required");
25
+ return fetchSimBalance(address);
26
+ },
27
+ enabled: Boolean(address),
28
+ });
29
+ }
@@ -15,6 +15,7 @@ const thirdweb_2 = require("thirdweb");
15
15
  const wagmi_1 = require("wagmi");
16
16
  const components_1 = require("../components");
17
17
  const useAccountWallet_1 = require("./useAccountWallet");
18
+ const viem_1 = require("viem");
18
19
  const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
19
20
  process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
20
21
  process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
@@ -45,6 +46,7 @@ function useUnifiedChainSwitchAndExecute() {
45
46
  if (!targetChain) {
46
47
  throw new Error(`Chain ${targetChainId} is not supported`);
47
48
  }
49
+ (0, invariant_1.default)((0, viem_1.isAddress)(params.to), "params.to is not a valid address");
48
50
  const hash = await walletClient.sendTransaction({
49
51
  account: signer,
50
52
  chain: targetChain,
@@ -110,7 +112,6 @@ function useUnifiedChainSwitchAndExecute() {
110
112
  try {
111
113
  setIsSwitchingOrExecuting(true);
112
114
  const chain = (0, supported_1.getThirdwebChain)(targetChainId);
113
- sonner_1.toast.info("Preparing transaction…");
114
115
  const transaction = (0, thirdweb_2.prepareTransaction)({
115
116
  client: thirdweb_1.client,
116
117
  chain,
@@ -79,9 +79,9 @@ export interface ManageAccountModalProps extends BaseModalProps {
79
79
  /** Partner ID */
80
80
  partnerId: string;
81
81
  /** Active Tab */
82
- activeTab?: "balance" | "assets" | "apps" | "settings";
82
+ activeTab?: "overview" | "tokens" | "nfts" | "apps" | "settings";
83
83
  /** Function to set the active tab */
84
- setActiveTab?: (tab: "balance" | "assets" | "apps" | "settings") => void;
84
+ setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
85
85
  }
86
86
  /**
87
87
  * Props for the AnySpend modal
@@ -22,6 +22,15 @@ function getProfileDisplayInfo(profile) {
22
22
  type,
23
23
  };
24
24
  break;
25
+ case "farcaster":
26
+ displayInfo = {
27
+ title: details.name || details.username || "Unknown",
28
+ subtitle: details.username ? `@${details.username}` : "Farcaster Account",
29
+ imageUrl: details.profileImageUrl || null,
30
+ initial: "F",
31
+ type,
32
+ };
33
+ break;
25
34
  case "google":
26
35
  displayInfo = {
27
36
  title: details.name || details.email || "Unknown",
@@ -0,0 +1,16 @@
1
+ declare global {
2
+ interface Window {
3
+ gtag: (...args: any[]) => void;
4
+ dataLayer: any[];
5
+ }
6
+ }
7
+ /**
8
+ * Load Google Analytics 4 script and initialize
9
+ */
10
+ export declare const loadGA4Script: () => void;
11
+ /**
12
+ * Send 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
+ export declare const sendGA4Event: (eventName: string, parameters?: Record<string, any>) => void;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ // Global window interface augmentations for B3 SDK
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.sendGA4Event = exports.loadGA4Script = void 0;
5
+ const GA4_MEASUREMENT_ID = "G-VER9DKJH87";
6
+ /**
7
+ * Initialize Google Analytics 4
8
+ */
9
+ const initializeGA4 = () => {
10
+ // Only initialize in browser environment
11
+ if (typeof window === "undefined")
12
+ return;
13
+ // Create gtag function if it doesn't exist
14
+ if (!window.gtag) {
15
+ window.dataLayer = window.dataLayer || [];
16
+ window.gtag = function gtag() {
17
+ window.dataLayer.push(arguments);
18
+ };
19
+ }
20
+ // Configure GA4
21
+ window.gtag("js", new Date());
22
+ window.gtag("config", GA4_MEASUREMENT_ID, {
23
+ page_location: window.location.href,
24
+ page_hostname: window.location.hostname,
25
+ });
26
+ };
27
+ /**
28
+ * Load Google Analytics 4 script and initialize
29
+ */
30
+ const loadGA4Script = () => {
31
+ if (typeof window === "undefined")
32
+ return;
33
+ // Check if script is already loaded
34
+ if (document.querySelector(`script[src*="${GA4_MEASUREMENT_ID}"]`))
35
+ return;
36
+ const script = document.createElement("script");
37
+ script.async = true;
38
+ script.src = `https://www.googletagmanager.com/gtag/js?id=${GA4_MEASUREMENT_ID}`;
39
+ document.head.appendChild(script);
40
+ script.onload = initializeGA4;
41
+ };
42
+ exports.loadGA4Script = loadGA4Script;
43
+ /**
44
+ * Send an analytics event to Google Analytics 4
45
+ * @param eventName - The name of the event to track
46
+ * @param parameters - Additional parameters to include with the event
47
+ */
48
+ const sendGA4Event = (eventName, parameters) => {
49
+ // Only send events in browser environment
50
+ if (typeof window === "undefined" || !window.gtag)
51
+ return;
52
+ // Send event to GA4
53
+ window.gtag("event", eventName, parameters || {});
54
+ };
55
+ exports.sendGA4Event = sendGA4Event;
@@ -14,3 +14,4 @@ export declare const THIRDWEB_CLIENT_ID: string;
14
14
  export declare const CLIENT_APP_BUNDLE_ID: string;
15
15
  export declare const B3_AUTH_COOKIE_NAME = "b3-auth";
16
16
  export declare const ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
17
+ export declare const PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENS_GATEWAY_URL = exports.B3_AUTH_COOKIE_NAME = exports.CLIENT_APP_BUNDLE_ID = exports.THIRDWEB_CLIENT_ID = exports.THIRDWEB_SECRET_KEY = exports.tokenIcons = exports.ecosystemWalletId = exports.b3CoinIcon = exports.siteURL = void 0;
3
+ exports.PUBLIC_BASE_RPC_URL = exports.ENS_GATEWAY_URL = exports.B3_AUTH_COOKIE_NAME = exports.CLIENT_APP_BUNDLE_ID = exports.THIRDWEB_CLIENT_ID = exports.THIRDWEB_SECRET_KEY = exports.tokenIcons = exports.ecosystemWalletId = exports.b3CoinIcon = exports.siteURL = void 0;
4
4
  exports.siteURL = "https://basement.fun";
5
5
  exports.b3CoinIcon = "https://cdn.b3.fun/b3-coin-3d.png";
6
6
  exports.ecosystemWalletId = (process.env.NEXT_PUBLIC_THIRDWEB_ECOSYSTEM_ID ||
@@ -22,3 +22,4 @@ exports.THIRDWEB_CLIENT_ID = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID ||
22
22
  exports.CLIENT_APP_BUNDLE_ID = process.env.EXPO_PUBLIC_B3_BUNDLE_ID || "";
23
23
  exports.B3_AUTH_COOKIE_NAME = "b3-auth";
24
24
  exports.ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
25
+ exports.PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";