@b3dotfun/sdk 0.0.30-alpha.1 → 0.0.30-alpha.11
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.
- package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.js +2 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +10 -9
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -5
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +5 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +94 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +267 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +9 -51
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +8 -0
- package/dist/cjs/global-account/react/components/TokenIcon.d.ts +11 -0
- package/dist/cjs/global-account/react/components/TokenIcon.js +43 -0
- package/dist/cjs/global-account/react/components/ui/accordion.d.ts +7 -0
- package/dist/cjs/global-account/react/components/ui/accordion.js +53 -0
- package/dist/cjs/global-account/react/components/ui/dialog.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -1
- package/dist/cjs/global-account/react/hooks/useAnalytics.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useAnalytics.js +29 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +24 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +29 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +0 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/cjs/global-account/react/utils/profileDisplay.js +9 -0
- package/dist/cjs/global-account/utils/analytics.d.ts +16 -0
- package/dist/cjs/global-account/utils/analytics.js +55 -0
- package/dist/cjs/shared/generated/chain-networks.json +185 -17
- package/dist/esm/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/ChainTokenIcon.js +2 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +8 -7
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +5 -5
- package/dist/esm/global-account/react/components/B3DynamicModal.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +5 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +88 -0
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +264 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +12 -51
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +5 -0
- package/dist/esm/global-account/react/components/TokenIcon.d.ts +11 -0
- package/dist/esm/global-account/react/components/TokenIcon.js +37 -0
- package/dist/esm/global-account/react/components/ui/accordion.d.ts +7 -0
- package/dist/esm/global-account/react/components/ui/accordion.js +14 -0
- package/dist/esm/global-account/react/components/ui/dialog.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -0
- package/dist/esm/global-account/react/hooks/index.js +2 -0
- package/dist/esm/global-account/react/hooks/useAnalytics.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useAnalytics.js +26 -0
- package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +24 -0
- package/dist/esm/global-account/react/hooks/useSimBalance.js +26 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/esm/global-account/react/utils/profileDisplay.js +9 -0
- package/dist/esm/global-account/utils/analytics.d.ts +16 -0
- package/dist/esm/global-account/utils/analytics.js +50 -0
- package/dist/esm/shared/generated/chain-networks.json +185 -17
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
- package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
- package/dist/types/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
- package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
- package/dist/types/global-account/react/components/TokenIcon.d.ts +11 -0
- package/dist/types/global-account/react/components/ui/accordion.d.ts +7 -0
- package/dist/types/global-account/react/hooks/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/useAnalytics.d.ts +7 -0
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +24 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/types/global-account/utils/analytics.d.ts +16 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/common/ChainTokenIcon.tsx +8 -2
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +10 -14
- package/src/anyspend/react/components/common/OrderDetails.tsx +5 -5
- package/src/global-account/react/components/B3DynamicModal.tsx +8 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +228 -0
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +565 -0
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +86 -341
- package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +46 -0
- package/src/global-account/react/components/TokenIcon.tsx +87 -0
- package/src/global-account/react/components/ui/accordion.tsx +53 -0
- package/src/global-account/react/components/ui/dialog.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +2 -0
- package/src/global-account/react/hooks/useAccountAssets.ts +1 -0
- package/src/global-account/react/hooks/useAnalytics.tsx +30 -0
- package/src/global-account/react/hooks/useSimBalance.ts +56 -0
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +2 -2
- package/src/global-account/react/utils/profileDisplay.ts +9 -0
- package/src/global-account/utils/analytics.ts +64 -0
- package/src/shared/generated/chain-networks.json +185 -17
- package/src/{anyspend/types → types}/window.d.ts +5 -1
- package/dist/cjs/index.d.ts +0 -0
- package/dist/cjs/index.js +0 -2
- package/dist/esm/index.d.ts +0 -0
- package/dist/esm/index.js +0 -2
- package/dist/types/index.d.ts +0 -0
- package/src/index.ts +0 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChainTokenIcon = ChainTokenIcon;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const lucide_react_1 = require("lucide-react");
|
|
5
6
|
function ChainTokenIcon({ chainUrl, tokenUrl, className = "", }) {
|
|
6
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `relative ${className}`, children: [(0, jsx_runtime_1.jsx)("img", { src: tokenUrl, alt: "Token", className: "h-full w-full rounded-full" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-on-surface-1 border-as-stroke absolute bottom-0 right-0 h-[45%] w-[45%] rounded border", children: (0, jsx_runtime_1.jsx)("img", { src: chainUrl, alt: "Chain", className: "h-full w-full rounded" }) })] }));
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `relative ${className}`, children: [tokenUrl ? ((0, jsx_runtime_1.jsx)("img", { src: tokenUrl, alt: "Token", className: "h-full w-full rounded-full" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.HelpCircle, { className: "text-b3-react-foreground h-full w-full" })), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-on-surface-1 border-as-stroke absolute bottom-0 right-0 h-[45%] w-[45%] rounded border", children: (0, jsx_runtime_1.jsx)("img", { src: chainUrl, alt: "Chain", className: "h-full w-full rounded" }) })] }));
|
|
7
8
|
}
|
|
@@ -7,8 +7,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("../../../../global-account/react");
|
|
8
8
|
const cn_1 = require("../../../../shared/utils/cn");
|
|
9
9
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
10
|
+
const react_2 = require("@web3icons/react");
|
|
10
11
|
const lucide_react_1 = require("lucide-react");
|
|
11
|
-
const
|
|
12
|
+
const react_3 = require("react");
|
|
12
13
|
const react_dom_1 = require("react-dom");
|
|
13
14
|
const sonner_1 = require("sonner");
|
|
14
15
|
const wagmi_1 = require("wagmi");
|
|
@@ -24,43 +25,43 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
24
25
|
const { connect, connectors, isPending } = (0, wagmi_1.useConnect)();
|
|
25
26
|
const { disconnect } = (0, wagmi_1.useDisconnect)();
|
|
26
27
|
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
27
|
-
const [showWalletModal, setShowWalletModal] = (0,
|
|
28
|
+
const [showWalletModal, setShowWalletModal] = (0, react_3.useState)(false);
|
|
28
29
|
// Define available wallet connectors
|
|
29
|
-
const availableConnectors = connectors.filter(connector => ["MetaMask", "WalletConnect", "Coinbase Wallet", "Rainbow"].includes(connector.name));
|
|
30
|
+
const availableConnectors = connectors.filter(connector => ["MetaMask", "WalletConnect", "Coinbase Wallet", "Rainbow", "Phantom"].includes(connector.name));
|
|
30
31
|
// Define wallet options with icons and info
|
|
31
32
|
const walletOptions = [
|
|
32
33
|
{
|
|
33
34
|
id: "metamask",
|
|
34
35
|
name: "MetaMask",
|
|
35
|
-
icon:
|
|
36
|
+
icon: (0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { size: 48 }),
|
|
36
37
|
description: "Connect using MetaMask browser extension",
|
|
37
38
|
connector: availableConnectors.find(c => c.name === "MetaMask"),
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
id: "coinbase",
|
|
41
42
|
name: "Coinbase Wallet",
|
|
42
|
-
icon:
|
|
43
|
+
icon: (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { size: 48 }),
|
|
43
44
|
description: "Connect using Coinbase Wallet",
|
|
44
45
|
connector: availableConnectors.find(c => c.name === "Coinbase Wallet"),
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
48
|
id: "rainbow",
|
|
48
49
|
name: "Rainbow",
|
|
49
|
-
icon:
|
|
50
|
+
icon: (0, jsx_runtime_1.jsx)(react_2.WalletRainbow, { size: 48 }),
|
|
50
51
|
description: "Connect using Rainbow wallet",
|
|
51
52
|
connector: availableConnectors.find(c => c.name === "Rainbow"),
|
|
52
53
|
},
|
|
53
54
|
{
|
|
54
55
|
id: "walletconnect",
|
|
55
56
|
name: "WalletConnect",
|
|
56
|
-
icon:
|
|
57
|
+
icon: (0, jsx_runtime_1.jsx)(react_2.WalletWalletConnect, { size: 48 }),
|
|
57
58
|
description: "Connect using WalletConnect protocol",
|
|
58
59
|
connector: availableConnectors.find(c => c.name === "WalletConnect"),
|
|
59
60
|
},
|
|
60
61
|
{
|
|
61
62
|
id: "phantom",
|
|
62
63
|
name: "Phantom",
|
|
63
|
-
icon:
|
|
64
|
+
icon: (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { size: 48 }),
|
|
64
65
|
description: "Connect using Phantom wallet",
|
|
65
66
|
connector: availableConnectors.find(c => c.name === "Phantom"),
|
|
66
67
|
},
|
|
@@ -146,6 +147,6 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
146
147
|
await requestWalletPermissions(walletOption.connector);
|
|
147
148
|
}, disabled: isPending, className: `wallet-option w-full rounded-xl border p-4 text-left transition-all hover:shadow-md disabled:opacity-50 ${isCurrentWallet
|
|
148
149
|
? "wallet-option--active border-blue-500 bg-blue-50 dark:bg-blue-900/20"
|
|
149
|
-
: "border-gray-200 bg-white hover:border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500"}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
150
|
+
: "border-gray-200 bg-white hover:border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500"}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [walletOption.icon, (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "wallet-option-name flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-semibold text-gray-900 dark:text-white", children: walletOption.name }), isCurrentWallet && ((0, jsx_runtime_1.jsx)("span", { className: "rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 dark:bg-blue-800 dark:text-blue-200", children: "Connected" }))] }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: isCurrentWallet ? "Switch account or reconnect" : walletOption.description })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "h-5 w-5 text-gray-400" })] }) }, walletOption.id));
|
|
150
151
|
}) }) })] }) }), typeof window !== "undefined" ? document.getElementById("b3-root") || document.body : document.body)] }));
|
|
151
152
|
}
|
|
@@ -401,7 +401,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
401
401
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
|
|
402
402
|
: null, refundTxs
|
|
403
403
|
? refundTxs.map(rTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: `Refunded ${(0, number_1.formatTokenAmount)(BigInt(rTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: rTx, isProcessing: false }, rTx.txHash)))
|
|
404
|
-
: null] }) })] }) }), order.errorDetails && ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: (0, anyspend_1.getErrorDisplay)(order.errorDetails) }) })), (0, jsx_runtime_1.jsx)("button", { className: "bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
|
|
404
|
+
: null] }) })] }) }), order.errorDetails && ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: (0, anyspend_1.getErrorDisplay)(order.errorDetails) }) })), (0, jsx_runtime_1.jsx)("button", { className: "order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
|
|
405
405
|
}
|
|
406
406
|
if (executeTx) {
|
|
407
407
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
@@ -416,14 +416,14 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
416
416
|
? "Joined Tournament"
|
|
417
417
|
: order.type === "fund_tournament"
|
|
418
418
|
? "Funded Tournament"
|
|
419
|
-
: "Processed Order", chainId: order.dstChain, tx: executeTx, isProcessing: false, delay: 1 })] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-8", children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "link", asChild: true, children: (0, jsx_runtime_1.jsxs)("a", { href: (0, anyspend_1.getExplorerTxUrl)(order.dstChain, executeTx.txHash), target: "_blank", className: "text-as-primary/70 hover:text-as-primary", style: { whiteSpace: "normal" }, children: [getOrderSuccessText({
|
|
419
|
+
: "Processed Order", chainId: order.dstChain, tx: executeTx, isProcessing: false, delay: 1 })] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-8", children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "link", asChild: true, children: (0, jsx_runtime_1.jsxs)("a", { href: (0, anyspend_1.getExplorerTxUrl)(order.dstChain, executeTx.txHash), target: "_blank", className: "order-success-text text-as-primary/70 hover:text-as-primary", style: { whiteSpace: "normal" }, children: [getOrderSuccessText({
|
|
420
420
|
order,
|
|
421
421
|
tournament,
|
|
422
422
|
formattedActualDstAmount: formattedActualDstAmount,
|
|
423
423
|
dstToken,
|
|
424
424
|
recipientName,
|
|
425
425
|
centerTruncate: centerTruncate_1.default,
|
|
426
|
-
}), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && ((0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4", children: "Continue to Tournament" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && ((0, jsx_runtime_1.jsx)("button", { className: "bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
|
|
426
|
+
}), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && ((0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4", children: "Continue to Tournament" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && ((0, jsx_runtime_1.jsx)("button", { className: "order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
|
|
427
427
|
}
|
|
428
428
|
if (relayTx && relayTx.status === "success") {
|
|
429
429
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "more-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "More Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
@@ -446,14 +446,14 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
446
446
|
? "Joining Tournament"
|
|
447
447
|
: order.type === "fund_tournament"
|
|
448
448
|
? "Funding Tournament"
|
|
449
|
-
: "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: executeTx, delay: 1 })] }))] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-8", children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "link", asChild: true, children: (0, jsx_runtime_1.jsxs)("a", { href: (0, anyspend_1.getExplorerTxUrl)(order.dstChain, relayTx.txHash), target: "_blank", className: "text-as-primary/70 hover:text-as-primary", style: { whiteSpace: "normal" }, children: [getOrderSuccessText({
|
|
449
|
+
: "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: executeTx, delay: 1 })] }))] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-8", children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "link", asChild: true, children: (0, jsx_runtime_1.jsxs)("a", { href: (0, anyspend_1.getExplorerTxUrl)(order.dstChain, relayTx.txHash), target: "_blank", className: "order-success-text text-as-primary/70 hover:text-as-primary", style: { whiteSpace: "normal" }, children: [getOrderSuccessText({
|
|
450
450
|
order,
|
|
451
451
|
tournament,
|
|
452
452
|
formattedActualDstAmount,
|
|
453
453
|
dstToken,
|
|
454
454
|
recipientName,
|
|
455
455
|
centerTruncate: centerTruncate_1.default,
|
|
456
|
-
}), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && ((0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4", children: "Continue to Tournament" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && ((0, jsx_runtime_1.jsx)("button", { className: "bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
|
|
456
|
+
}), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && ((0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4", children: "Continue to Tournament" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && ((0, jsx_runtime_1.jsx)("button", { className: "order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
|
|
457
457
|
}
|
|
458
458
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
459
459
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
@@ -20,7 +20,6 @@ function B3DynamicModal() {
|
|
|
20
20
|
const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = (0, react_2.useModalStore)();
|
|
21
21
|
const { theme } = (0, useB3_1.useB3)();
|
|
22
22
|
const isMobile = (0, react_2.useIsMobile)();
|
|
23
|
-
let hideCloseButton = false;
|
|
24
23
|
// Define arrays for different modal type groups
|
|
25
24
|
const fullWidthTypes = [
|
|
26
25
|
"anySpend",
|
|
@@ -46,9 +45,7 @@ function B3DynamicModal() {
|
|
|
46
45
|
];
|
|
47
46
|
// Check if current content type is in freestyle types
|
|
48
47
|
const isFreestyleType = freestyleTypes.includes(contentType?.type);
|
|
49
|
-
|
|
50
|
-
hideCloseButton = true;
|
|
51
|
-
}
|
|
48
|
+
const hideCloseButton = isFreestyleType;
|
|
52
49
|
// Build content class using cn utility
|
|
53
50
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
54
51
|
const contentClass = (0, cn_1.cn)("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6", contentType?.type === "transak" && "transak-modal");
|
|
@@ -98,5 +95,5 @@ function B3DynamicModal() {
|
|
|
98
95
|
const ModalContent = isMobile ? drawer_1.DrawerContent : dialog_1.DialogContent;
|
|
99
96
|
const ModalTitle = isMobile ? drawer_1.DrawerTitle : dialog_1.DialogTitle;
|
|
100
97
|
const ModalDescription = isMobile ? drawer_1.DrawerDescription : dialog_1.DialogDescription;
|
|
101
|
-
return ((0, jsx_runtime_1.jsx)(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: (0, jsx_runtime_1.jsxs)(ModalContent, { className: (0, cn_1.cn)(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800", "mx-auto w-full max-w-md", "sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [(0, jsx_runtime_1.jsx)(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), (0, jsx_runtime_1.jsx)(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), (0, jsx_runtime_1.jsxs)("div", { className: "no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]", children: [history.length > 0 && contentType?.showBackButton && ((0, jsx_runtime_1.jsxs)("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [(0, jsx_runtime_1.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: "Back" })] })), renderContent()] })] }) }));
|
|
98
|
+
return ((0, jsx_runtime_1.jsx)(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: (0, jsx_runtime_1.jsxs)(ModalContent, { className: (0, cn_1.cn)(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800", "mx-auto w-full max-w-md", "sm:max-w-lg sm:rounded-b-none"), hideCloseButton: hideCloseButton, children: [(0, jsx_runtime_1.jsx)(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), (0, jsx_runtime_1.jsx)(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]", contentType?.type === "manageAccount" && "h-[90dvh]"), children: [history.length > 0 && contentType?.showBackButton && ((0, jsx_runtime_1.jsxs)("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [(0, jsx_runtime_1.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: "Back" })] })), renderContent()] })] }) }));
|
|
102
99
|
}
|
|
@@ -5,6 +5,7 @@ exports.B3Provider = B3Provider;
|
|
|
5
5
|
exports.InnerProvider = InnerProvider;
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("../../../../global-account/react");
|
|
8
|
+
const analytics_1 = require("../../../../global-account/utils/analytics");
|
|
8
9
|
const supported_1 = require("../../../../shared/constants/chains/supported");
|
|
9
10
|
const react_query_1 = require("@tanstack/react-query");
|
|
10
11
|
const react_2 = require("react");
|
|
@@ -33,6 +34,10 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
33
34
|
* Main B3Provider component
|
|
34
35
|
*/
|
|
35
36
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, }) {
|
|
37
|
+
// Initialize Google Analytics on mount
|
|
38
|
+
(0, react_2.useEffect)(() => {
|
|
39
|
+
(0, analytics_1.loadGA4Script)();
|
|
40
|
+
}, []);
|
|
36
41
|
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: exports.wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, children: (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" }), (0, jsx_runtime_1.jsx)(sonner_1.Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
@@ -20,6 +20,7 @@ const AUTH_METHODS = [
|
|
|
20
20
|
{ id: "x", label: "X (Twitter)", enabled: true },
|
|
21
21
|
{ id: "discord", label: "Discord", enabled: true },
|
|
22
22
|
{ id: "apple", label: "Apple", enabled: true },
|
|
23
|
+
{ id: "farcaster", label: "Farcaster", enabled: true },
|
|
23
24
|
];
|
|
24
25
|
function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, chain, partnerId, }) {
|
|
25
26
|
const { isLinking, linkingMethod, setLinkingState, navigateBack, setB3ModalContentType } = (0, useModalStore_1.useModalStore)();
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BalanceContent = BalanceContent;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("../../../../global-account/react");
|
|
9
|
+
const BankIcon_1 = require("../../../../global-account/react/components/icons/BankIcon");
|
|
10
|
+
const SignOutIcon_1 = require("../../../../global-account/react/components/icons/SignOutIcon");
|
|
11
|
+
const SwapIcon_1 = require("../../../../global-account/react/components/icons/SwapIcon");
|
|
12
|
+
const utils_1 = require("../../../../shared/utils");
|
|
13
|
+
const lucide_react_1 = require("lucide-react");
|
|
14
|
+
const react_2 = require("react");
|
|
15
|
+
const react_3 = require("thirdweb/react");
|
|
16
|
+
const useFirstEOA_1 = __importDefault(require("../../hooks/useFirstEOA"));
|
|
17
|
+
const TokenIcon_1 = require("../TokenIcon");
|
|
18
|
+
const accordion_1 = require("../ui/accordion");
|
|
19
|
+
const TokenBalanceRow_1 = require("./TokenBalanceRow");
|
|
20
|
+
function centerTruncate(str, length = 4) {
|
|
21
|
+
if (str.length <= length * 2)
|
|
22
|
+
return str;
|
|
23
|
+
return `${str.slice(0, length)}...${str.slice(-length)}`;
|
|
24
|
+
}
|
|
25
|
+
function BalanceContent({ onLogout, partnerId }) {
|
|
26
|
+
const account = (0, react_3.useActiveAccount)();
|
|
27
|
+
const { address: eoaAddress, info: eoaInfo } = (0, useFirstEOA_1.default)();
|
|
28
|
+
const { data: profile } = (0, react_1.useProfile)({
|
|
29
|
+
address: eoaAddress || account?.address,
|
|
30
|
+
fresh: true,
|
|
31
|
+
});
|
|
32
|
+
const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
|
|
33
|
+
const { logout } = (0, react_1.useAuthentication)(partnerId);
|
|
34
|
+
const [logoutLoading, setLogoutLoading] = (0, react_2.useState)(false);
|
|
35
|
+
const [openAccordions, setOpenAccordions] = (0, react_2.useState)([]);
|
|
36
|
+
const hasExpandedRef = (0, react_2.useRef)(false);
|
|
37
|
+
console.log("eoaAddress", eoaAddress);
|
|
38
|
+
console.log("account?.address", account?.address);
|
|
39
|
+
// Balance data fetching
|
|
40
|
+
const { data: eoaNativeBalance, isLoading: eoaNativeLoading } = (0, react_1.useNativeBalance)(eoaAddress);
|
|
41
|
+
const { data: eoaB3Balance, isLoading: eoaB3Loading } = (0, react_1.useB3BalanceFromAddresses)(eoaAddress);
|
|
42
|
+
const { data: b3Balance, isLoading: b3Loading } = (0, react_1.useB3BalanceFromAddresses)(account?.address);
|
|
43
|
+
const { data: nativeBalance, isLoading: nativeLoading } = (0, react_1.useNativeBalance)(account?.address);
|
|
44
|
+
// Calculate total USD values for comparison
|
|
45
|
+
const globalAccountTotalUsd = (b3Balance?.balanceUsd || 0) + (nativeBalance?.totalUsd || 0);
|
|
46
|
+
const eoaTotalUsd = (eoaB3Balance?.balanceUsd || 0) + (eoaNativeBalance?.totalUsd || 0);
|
|
47
|
+
// Check if both data sets are ready (not loading and have data)
|
|
48
|
+
const isGlobalDataReady = !b3Loading && !nativeLoading && b3Balance !== undefined && nativeBalance !== undefined;
|
|
49
|
+
const isEoaDataReady = !eoaAddress || (!eoaB3Loading && !eoaNativeLoading && eoaB3Balance !== undefined && eoaNativeBalance !== undefined);
|
|
50
|
+
const isBothDataReady = isGlobalDataReady && isEoaDataReady;
|
|
51
|
+
// Reset expansion flag when component mounts
|
|
52
|
+
(0, react_2.useEffect)(() => {
|
|
53
|
+
hasExpandedRef.current = false;
|
|
54
|
+
setOpenAccordions([]);
|
|
55
|
+
}, []);
|
|
56
|
+
// Auto-expand the appropriate section when data becomes ready
|
|
57
|
+
(0, react_2.useEffect)(() => {
|
|
58
|
+
if (isBothDataReady && !hasExpandedRef.current && eoaAddress && account?.address) {
|
|
59
|
+
hasExpandedRef.current = true;
|
|
60
|
+
// Determine which section to expand based on higher balance
|
|
61
|
+
if (globalAccountTotalUsd === 0 && eoaTotalUsd === 0) {
|
|
62
|
+
// If both have 0 balance, expand global account by default
|
|
63
|
+
setOpenAccordions(["global-account"]);
|
|
64
|
+
}
|
|
65
|
+
else if (globalAccountTotalUsd >= eoaTotalUsd) {
|
|
66
|
+
setOpenAccordions(["global-account"]);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
setOpenAccordions(["eoa-account"]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, [isBothDataReady, globalAccountTotalUsd, eoaTotalUsd, eoaAddress, account?.address]);
|
|
73
|
+
const onLogoutEnhanced = async () => {
|
|
74
|
+
setLogoutLoading(true);
|
|
75
|
+
await logout();
|
|
76
|
+
onLogout?.();
|
|
77
|
+
setB3ModalOpen(false);
|
|
78
|
+
setLogoutLoading(false);
|
|
79
|
+
};
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [profile?.avatar ? ((0, jsx_runtime_1.jsx)("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 16, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: account?.address || "" })] })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [(0, jsx_runtime_1.jsxs)(react_1.Button, { className: "manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
|
|
81
|
+
setB3ModalOpen(true);
|
|
82
|
+
setB3ModalContentType({
|
|
83
|
+
type: "anySpend",
|
|
84
|
+
defaultActiveTab: "fiat",
|
|
85
|
+
showBackButton: true,
|
|
86
|
+
});
|
|
87
|
+
}, children: [(0, jsx_runtime_1.jsx)(BankIcon_1.BankIcon, { size: 24, className: "text-b3-primary-blue shrink-0" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Deposit" })] }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "manage-account-swap bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
|
|
88
|
+
setB3ModalOpen(true);
|
|
89
|
+
setB3ModalContentType({
|
|
90
|
+
type: "anySpend",
|
|
91
|
+
showBackButton: true,
|
|
92
|
+
});
|
|
93
|
+
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon_1.SwapIcon, { size: 24, className: "text-b3-primary-blue" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), (0, jsx_runtime_1.jsxs)(accordion_1.Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [(0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "global-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsx)("span", { children: "Balance" }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && ((0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "eoa-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: eoaAddress })] })] }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), (0, jsx_runtime_1.jsxs)("button", { className: "border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-4", children: logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
|
|
94
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ContentTokensProps {
|
|
2
|
+
activeTab: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* ContentTokens Component
|
|
6
|
+
*
|
|
7
|
+
* Displays user's token balances with ability to send tokens. Features:
|
|
8
|
+
* - Animated transitions between token list and send form
|
|
9
|
+
* - Smart filtering (shows all tokens when ≤5 valuable tokens or no $1+ tokens)
|
|
10
|
+
* - NumericFormat inputs for proper number handling
|
|
11
|
+
* - Focus preservation during transitions (see render functions pattern below)
|
|
12
|
+
*/
|
|
13
|
+
export declare function ContentTokens({ activeTab }: ContentTokensProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|