@elizaos/app-core 2.0.0-alpha.346 → 2.0.0-alpha.347

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/app-core",
3
- "version": "2.0.0-alpha.346",
3
+ "version": "2.0.0-alpha.347",
4
4
  "description": "Shared application core for elizaOS white-label agent apps.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -469,7 +469,7 @@
469
469
  "@capacitor/preferences": "^8.0.1",
470
470
  "@capacitor/push-notifications": "^8.0.0",
471
471
  "@clack/prompts": "^1.0.0",
472
- "@elizaos/agent": "^2.0.0-alpha.346",
472
+ "@elizaos/agent": "^2.0.0-alpha.347",
473
473
  "@elizaos/app-companion": "^0.0.0",
474
474
  "@elizaos/app-elizamaker": "^0.0.0",
475
475
  "@elizaos/app-lifeops": "^0.0.0",
@@ -478,11 +478,11 @@
478
478
  "@elizaos/app-task-coordinator": "^0.0.0",
479
479
  "@elizaos/app-training": "^0.0.1",
480
480
  "@elizaos/app-vincent": "^0.0.0",
481
- "@elizaos/core": "^2.0.0-alpha.346",
481
+ "@elizaos/core": "^2.0.0-alpha.347",
482
482
  "@elizaos/plugin-browser-bridge": "^0.1.0",
483
483
  "@elizaos/plugin-wechat": "^0.1.0",
484
- "@elizaos/shared": "^2.0.0-alpha.346",
485
- "@elizaos/ui": "^2.0.0-alpha.346",
484
+ "@elizaos/shared": "^2.0.0-alpha.347",
485
+ "@elizaos/ui": "^2.0.0-alpha.347",
486
486
  "@radix-ui/react-checkbox": "^1.3.3",
487
487
  "@radix-ui/react-dialog": "^1.1.15",
488
488
  "@radix-ui/react-dropdown-menu": "^2.1.16",
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-status.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/chat/widgets/wallet-status.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,SAAS,CAAC;AA8EjB,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,kDAyJvE;AAED,eAAO,MAAM,oBAAoB,EAAE,2BAMlC,CAAC"}
1
+ {"version":3,"file":"wallet-status.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/chat/widgets/wallet-status.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAkIjB,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,kDAwKvE;AAED,eAAO,MAAM,oBAAoB,EAAE,2BAMlC,CAAC"}
@@ -2,9 +2,30 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Check, Copy, Wallet } from "lucide-react";
3
3
  import { useEffect, useMemo, useState } from "react";
4
4
  import { useApp } from "../../../state";
5
+ import { resolveChainKey } from "../../inventory/chainConfig";
5
6
  import { EmptyWidgetState, WidgetSection } from "./shared";
6
7
  const DUST_THRESHOLD_USD = 0.01;
7
8
  const COPY_FEEDBACK_MS = 1200;
9
+ const EVM_CHAIN_ORDER = [
10
+ "ethereum",
11
+ "base",
12
+ "arbitrum",
13
+ "optimism",
14
+ "polygon",
15
+ "bsc",
16
+ "avax",
17
+ ];
18
+ const EVM_CHAIN_KEYS = new Set(EVM_CHAIN_ORDER);
19
+ const CHAIN_BADGE_LABELS = {
20
+ ethereum: "ETH",
21
+ base: "BASE",
22
+ arbitrum: "ARB",
23
+ optimism: "OP",
24
+ polygon: "POL",
25
+ bsc: "BSC",
26
+ avax: "AVAX",
27
+ solana: "SOL",
28
+ };
8
29
  function shortenAddress(value) {
9
30
  if (!value)
10
31
  return null;
@@ -33,6 +54,22 @@ function hasPositiveBalance(value) {
33
54
  const parsed = Number.parseFloat(value);
34
55
  return Number.isFinite(parsed) && parsed > 0;
35
56
  }
57
+ function normalizeEvmChainKeys(chainNames) {
58
+ const seen = new Set();
59
+ for (const chainName of chainNames) {
60
+ const chainKey = resolveChainKey(chainName);
61
+ if (chainKey && EVM_CHAIN_KEYS.has(chainKey)) {
62
+ seen.add(chainKey);
63
+ }
64
+ }
65
+ return EVM_CHAIN_ORDER.filter((chainKey) => seen.has(chainKey));
66
+ }
67
+ function ChainBadge({ chain }) {
68
+ return (_jsx("span", { className: "inline-flex h-4 shrink-0 items-center rounded-full border border-border/35 bg-bg/40 px-1.5 font-mono text-[0.52rem] font-semibold leading-none text-muted", title: chain, children: CHAIN_BADGE_LABELS[chain] }));
69
+ }
70
+ function ChainBadges({ chains }) {
71
+ return (_jsx("span", { className: "flex min-w-0 flex-wrap items-center gap-1", children: chains.map((chain) => (_jsx(ChainBadge, { chain: chain }, chain))) }));
72
+ }
36
73
  function CopyAddressButton({ value, label }) {
37
74
  const [copied, setCopied] = useState(false);
38
75
  useEffect(() => {
@@ -58,18 +95,31 @@ function CopyAddressButton({ value, label }) {
58
95
  return (_jsx("button", { type: "button", onClick: onClick, "aria-label": copied ? `${label} copied` : `Copy ${label}`, title: copied ? "Copied" : "Copy", className: "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-[var(--radius-sm)] bg-transparent text-muted transition-colors hover:text-txt", children: copied ? (_jsx(Check, { className: "h-3 w-3", "aria-hidden": true })) : (_jsx(Copy, { className: "h-3 w-3", "aria-hidden": true })) }));
59
96
  }
60
97
  export function WalletStatusSidebarWidget(_props) {
61
- const { walletEnabled, walletAddresses, walletBalances, loadBalances, setTab, } = useApp();
98
+ const { walletEnabled, walletAddresses, walletConfig, walletBalances, loadWalletConfig, loadBalances, setTab, } = useApp();
62
99
  useEffect(() => {
63
100
  if (walletEnabled === false)
64
101
  return;
102
+ if (walletConfig === null) {
103
+ void loadWalletConfig();
104
+ }
65
105
  if (walletBalances !== null)
66
106
  return;
67
107
  void loadBalances();
68
- }, [walletEnabled, walletBalances, loadBalances]);
108
+ }, [
109
+ walletEnabled,
110
+ walletConfig,
111
+ walletBalances,
112
+ loadWalletConfig,
113
+ loadBalances,
114
+ ]);
69
115
  const evmAddress = walletAddresses?.evmAddress ?? null;
70
116
  const solanaAddress = walletAddresses?.solanaAddress ?? null;
71
117
  const evmShort = shortenAddress(evmAddress);
72
118
  const solanaShort = shortenAddress(solanaAddress);
119
+ const evmChains = normalizeEvmChainKeys([
120
+ ...(walletConfig?.evmChains ?? []),
121
+ ...(walletBalances?.evm?.chains.map((chain) => chain.chain) ?? []),
122
+ ]);
73
123
  const walletSummary = useMemo(() => {
74
124
  let assetCount = 0;
75
125
  let totalUsd = 0;
@@ -114,7 +164,7 @@ export function WalletStatusSidebarWidget(_props) {
114
164
  }
115
165
  const hasAnyAddress = Boolean(evmAddress || solanaAddress);
116
166
  const hasAnyBalanceRow = walletSummary.assetCount > 0;
117
- return (_jsx(WidgetSection, { title: "Wallet", icon: _jsx(Wallet, { className: "h-3.5 w-3.5" }), testId: "chat-widget-wallet-status", onTitleClick: () => setTab("inventory"), children: hasAnyAddress ? (_jsxs("div", { className: "flex flex-col gap-1.5 px-1 pt-0.5", children: [evmAddress ? (_jsxs("div", { className: "flex items-center justify-between gap-2 text-3xs", "data-testid": "chat-widget-wallet-row-evm-address", children: [_jsx("span", { className: "text-muted", children: "EVM" }), _jsxs("div", { className: "flex items-center gap-1 min-w-0", children: [_jsx("span", { className: "truncate font-mono text-txt", title: evmAddress, children: evmShort }), _jsx(CopyAddressButton, { value: evmAddress, label: "EVM address" })] })] })) : null, solanaAddress ? (_jsxs("div", { className: "flex items-center justify-between gap-2 text-3xs", "data-testid": "chat-widget-wallet-row-solana-address", children: [_jsx("span", { className: "text-muted", children: "Solana" }), _jsxs("div", { className: "flex items-center gap-1 min-w-0", children: [_jsx("span", { className: "truncate font-mono text-txt", title: solanaAddress, children: solanaShort }), _jsx(CopyAddressButton, { value: solanaAddress, label: "Solana address" })] })] })) : null, hasAnyBalanceRow ? (_jsxs("div", { className: "mt-1 flex flex-col gap-1 border-t border-border/20 pt-1.5", children: [_jsxs("div", { className: "flex items-center justify-between text-3xs", "data-testid": "chat-widget-wallet-row-assets", children: [_jsx("span", { className: "truncate text-muted", children: "Assets" }), _jsx("span", { className: "shrink-0 text-txt", children: walletSummary.assetCount })] }), _jsxs("div", { className: "flex items-center justify-between text-3xs", "data-testid": "chat-widget-wallet-row-value", children: [_jsx("span", { className: "truncate text-muted", children: "Value" }), _jsx("span", { className: "shrink-0 text-txt", children: formatUsd(walletSummary.totalUsd) })] })] })) : null] })) : (_jsx(EmptyWidgetState, { icon: _jsx(Wallet, { className: "h-5 w-5" }), title: "No wallet addresses yet" })) }));
167
+ return (_jsx(WidgetSection, { title: "Wallet", icon: _jsx(Wallet, { className: "h-3.5 w-3.5" }), testId: "chat-widget-wallet-status", onTitleClick: () => setTab("inventory"), children: hasAnyAddress ? (_jsxs("div", { className: "flex flex-col gap-1.5 px-1 pt-0.5", children: [evmAddress ? (_jsxs("div", { className: "flex items-center justify-between gap-2 text-3xs", "data-testid": "chat-widget-wallet-row-evm-address", children: [_jsx(ChainBadges, { chains: evmChains }), _jsxs("div", { className: "flex items-center gap-1 min-w-0", children: [_jsx("span", { className: "truncate font-mono text-txt", title: evmAddress, children: evmShort }), _jsx(CopyAddressButton, { value: evmAddress, label: "EVM address" })] })] })) : null, solanaAddress ? (_jsxs("div", { className: "flex items-center justify-between gap-2 text-3xs", "data-testid": "chat-widget-wallet-row-solana-address", children: [_jsx(ChainBadge, { chain: "solana" }), _jsxs("div", { className: "flex items-center gap-1 min-w-0", children: [_jsx("span", { className: "truncate font-mono text-txt", title: solanaAddress, children: solanaShort }), _jsx(CopyAddressButton, { value: solanaAddress, label: "Solana address" })] })] })) : null, hasAnyBalanceRow ? (_jsxs("div", { className: "mt-1 flex flex-col gap-1 border-t border-border/20 pt-1.5", children: [_jsxs("div", { className: "flex items-center justify-between text-3xs", "data-testid": "chat-widget-wallet-row-assets", children: [_jsx("span", { className: "truncate text-muted", children: "Assets" }), _jsx("span", { className: "shrink-0 text-txt", children: walletSummary.assetCount })] }), _jsxs("div", { className: "flex items-center justify-between text-3xs", "data-testid": "chat-widget-wallet-row-value", children: [_jsx("span", { className: "truncate text-muted", children: "Value" }), _jsx("span", { className: "shrink-0 text-txt", children: formatUsd(walletSummary.totalUsd) })] })] })) : null] })) : (_jsx(EmptyWidgetState, { icon: _jsx(Wallet, { className: "h-5 w-5" }), title: "No wallet addresses yet" })) }));
118
168
  }
119
169
  export const WALLET_STATUS_WIDGET = {
120
170
  id: "wallet.status",