@aiaiaichain/agent 0.1.5 → 0.1.6

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/cli.js CHANGED
@@ -23,7 +23,7 @@ import { SessionManager } from "./session/SessionManager.js";
23
23
  import { makeTheme } from "./tui/theme.js";
24
24
  import { AgentDir } from "./core/AgentDir.js";
25
25
  import { priceFeed } from "./tools/PriceFeed.js";
26
- import { agentWallet, DEPOSIT_WALLET, ACTION_WALLET, SIGNER } from "./wallet/AgentWallet.js";
26
+ import { agentWallet, DEPOSIT_WALLET, ACTION_WALLET, HOT_WALLET } from "./wallet/AgentWallet.js";
27
27
  import { PROVIDERS, getConfigured, getUnconfigured } from "./providers/ProviderRegistry.js";
28
28
  import { env } from "./core/EnvLoader.js";
29
29
  import { gmgnHelp, gmgnStatus, saveGmgnApiKey } from "./tools/GmgnIntegration.js";
@@ -200,17 +200,18 @@ if (subcmd === "burn") {
200
200
  console.log(T.muted(" The agent detects deposits and automatically"));
201
201
  console.log(T.muted(" sends funds to the action wallet to burn tokens."));
202
202
  console.log("");
203
- console.log(T.muted(" Action wallet:"));
203
+ console.log(T.muted(" Action wallet (executes trades):"));
204
204
  console.log(` ${ACTION_WALLET}`);
205
205
  console.log("");
206
- console.log(T.muted(" Signer:"));
207
- console.log(` ${SIGNER}`);
206
+ console.log(T.muted(" Hot wallet (temporary swap):"));
207
+ console.log(` ${HOT_WALLET}`);
208
208
  console.log("");
209
209
  process.exit(0);
210
210
  }
211
211
  if (subcmd === "actions" || subcmd === "activity") {
212
212
  (async () => {
213
213
  const { actionFeed } = await import("./wallet/ActionFeed.js");
214
+ await actionFeed.refresh();
214
215
  const result = await actionFeed.getActionsTool("", { limit: 20 });
215
216
  console.log(result.content[0].text);
216
217
  process.exit(0);
@@ -220,6 +221,7 @@ if (subcmd === "actions" || subcmd === "activity") {
220
221
  if (subcmd === "fees") {
221
222
  (async () => {
222
223
  const { actionFeed } = await import("./wallet/ActionFeed.js");
224
+ await actionFeed.refresh();
223
225
  const result = await actionFeed.getFeesTool();
224
226
  console.log(result.content[0].text);
225
227
  process.exit(0);
package/dist/tui/App.js CHANGED
@@ -223,9 +223,9 @@ export function App({ registry, systemPrompt, chain: initialChain = "solana", mo
223
223
  });
224
224
  // Initial wallet fetches
225
225
  agentWallet.getAll().then(w => {
226
- setColdBalance({ sol: w.cold.sol, aiaiai: w.cold.aiaiai, usdc: w.cold.usdc });
227
226
  setActionBalance({ sol: w.action.sol, aiaiai: w.action.aiaiai, usdc: w.action.usdc });
228
227
  setDepositBalance({ sol: w.deposit.sol, aiaiai: w.deposit.aiaiai, usdc: w.deposit.usdc });
228
+ setColdBalance({ sol: w.cold.sol, aiaiai: w.cold.aiaiai, usdc: w.cold.usdc });
229
229
  }).catch(() => { });
230
230
  // Initial actions
231
231
  actionFeed.refresh().then(() => {
@@ -274,9 +274,9 @@ export function App({ registry, systemPrompt, chain: initialChain = "solana", mo
274
274
  // Wallet + actions interval (60s)
275
275
  const walletInterval = setInterval(() => {
276
276
  agentWallet.getAll().then(w => {
277
- setColdBalance({ sol: w.cold.sol, aiaiai: w.cold.aiaiai, usdc: w.cold.usdc });
278
277
  setActionBalance({ sol: w.action.sol, aiaiai: w.action.aiaiai, usdc: w.action.usdc });
279
278
  setDepositBalance({ sol: w.deposit.sol, aiaiai: w.deposit.aiaiai, usdc: w.deposit.usdc });
279
+ setColdBalance({ sol: w.cold.sol, aiaiai: w.cold.aiaiai, usdc: w.cold.usdc });
280
280
  }).catch(() => { });
281
281
  actionFeed.refresh().then(() => {
282
282
  setRecentActions(actionFeed.getRecentActions(8).map(a => ({ type: a.type, amount: a.amount, usdValue: a.usdValue, timestamp: a.timestamp })));
@@ -842,7 +842,7 @@ export function App({ registry, systemPrompt, chain: initialChain = "solana", mo
842
842
  const changeColor = (pct) => pct > 0 ? AIAIAI_COLORS.success : pct < 0 ? AIAIAI_COLORS.error : AIAIAI_COLORS.muted;
843
843
  const actionIcon = (type) => type === "buy" ? "↗" : type === "burn" ? "🔥" : "→";
844
844
  // Single StatusBar wrapper — shared across both views to prevent duplication
845
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(StatusBar, { model: modelName, chain: chain, price: priceBadge, toolRunning: toolRunning, connected: true, statusLine: statusLine, cpu: cpu, ram: ram, uptime: uptime, apiCalls: apiCalls }), showModelSelector ? (_jsx(ModelSelector, { models: modelList, currentModelId: process.env.DEFAULT_MODEL ?? "", onSelect: handleModelSelect, onCancel: handleModelCancel, initialQuery: modelSelectorInitialQuery })) : (_jsxs(Box, { flexDirection: "row", flexGrow: 1, overflow: "hidden", children: [_jsxs(Box, { flexDirection: "column", width: SIDEBAR_W, minWidth: SIDEBAR_MIN, flexShrink: 0, overflow: "hidden", children: [_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.accent, paddingX: 1, children: [_jsx(Text, { bold: true, color: AIAIAI_COLORS.accent, children: "\uD83E\uDD16 $AIAIAI" }), aiaiPrice ? (_jsxs(_Fragment, { children: [_jsxs(Text, { color: changeColor(aiaiPrice.change), children: [aiaiPrice.priceUsd ? `$${parseFloat(aiaiPrice.priceUsd).toFixed(8)}` : "N/A", " ", aiaiPrice.change > 0 ? "▲" : aiaiPrice.change < 0 ? "▼" : "─", Math.abs(aiaiPrice.change).toFixed(1), "%"] }), _jsx(Sparkline, { data: priceHistoryRef.current.getData(), width: 38, color: changeColor(aiaiPrice.change), label: "" }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["MCap: ", aiaiPrice.mcap ? `$${(aiaiPrice.mcap / 1000).toFixed(1)}k` : "N/A"] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["Liq: $", (aiaiPrice.liq / 1000).toFixed(1), "k"] })] })) : _jsx(Text, { color: AIAIAI_COLORS.muted, children: "Loading\u2026" })] }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.dim, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, children: "\uD83D\uDCBC Wallets" }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["Cold: ", coldBalance.sol.toFixed(2), " SOL"] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: [" AIAIAI: ", coldBalance.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 0 })] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["Action: ", actionBalance.sol.toFixed(2), " SOL"] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: [" AIAIAI: ", actionBalance.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 0 })] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["Deposit: ", depositBalance.usdc.toFixed(2), " USDC"] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: [" SOL: ", depositBalance.sol.toFixed(2)] })] }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.dim, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, children: "\u26A1 Actions" }), recentActions.length > 0 ? recentActions.map((a, i) => {
845
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(StatusBar, { model: modelName, chain: chain, price: priceBadge, toolRunning: toolRunning, connected: true, statusLine: statusLine, cpu: cpu, ram: ram, uptime: uptime, apiCalls: apiCalls }), showModelSelector ? (_jsx(ModelSelector, { models: modelList, currentModelId: process.env.DEFAULT_MODEL ?? "", onSelect: handleModelSelect, onCancel: handleModelCancel, initialQuery: modelSelectorInitialQuery })) : (_jsxs(Box, { flexDirection: "row", flexGrow: 1, overflow: "hidden", children: [_jsxs(Box, { flexDirection: "column", width: SIDEBAR_W, minWidth: SIDEBAR_MIN, flexShrink: 0, overflow: "hidden", children: [_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.accent, paddingX: 1, children: [_jsx(Text, { bold: true, color: AIAIAI_COLORS.accent, children: "\uD83E\uDD16 $AIAIAI" }), aiaiPrice ? (_jsxs(_Fragment, { children: [_jsxs(Text, { color: changeColor(aiaiPrice.change), children: [aiaiPrice.priceUsd ? `$${parseFloat(aiaiPrice.priceUsd).toFixed(8)}` : "N/A", " ", aiaiPrice.change > 0 ? "▲" : aiaiPrice.change < 0 ? "▼" : "─", Math.abs(aiaiPrice.change).toFixed(1), "%"] }), _jsx(Sparkline, { data: priceHistoryRef.current.getData(), width: 38, color: changeColor(aiaiPrice.change), label: "" }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["MCap: ", aiaiPrice.mcap ? `$${(aiaiPrice.mcap / 1000).toFixed(1)}k` : "N/A"] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["Liq: $", (aiaiPrice.liq / 1000).toFixed(1), "k"] })] })) : _jsx(Text, { color: AIAIAI_COLORS.muted, children: "Loading\u2026" })] }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.dim, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, children: "\uD83D\uDCBC Action" }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["SOL: ", actionBalance.sol.toFixed(2)] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["AIAIAI: ", actionBalance.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 0 })] })] }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.dim, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, children: "\uD83D\uDCB0 Deposit" }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["USDC: ", depositBalance.usdc.toFixed(2)] }), _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["SOL: ", depositBalance.sol.toFixed(2)] })] }), _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AIAIAI_COLORS.dim, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, children: "\u26A1 Actions" }), recentActions.length > 0 ? recentActions.map((a, i) => {
846
846
  const col = a.type === "buy" ? AIAIAI_COLORS.success : a.type === "burn" ? AIAIAI_COLORS.error : AIAIAI_COLORS.muted;
847
847
  const time = new Date(a.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
848
848
  return _jsxs(Text, { color: col, children: [actionIcon(a.type), " ", time, " ", a.type, " ", a.amount.toLocaleString()] }, i);
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * ActionFeed — reads agent wallet activity via public RPC.
3
- * Only tracks AIAIAI token transfers. Classifies as buy or burn.
4
- * Fees are calculated as a percentage of each action.
3
+ * Parses Pump.fun Buy + BurnChecked events from inner instructions.
4
+ * Checks the ACTION wallet (GmFrDZT...) for transaction signatures.
5
+ * Fees are calculated as 0.5% of each action's USD value.
5
6
  */
6
7
  import type { ToolResult } from "../api/ExtensionAPI.js";
7
8
  export type ActionType = "buy" | "burn";
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * ActionFeed — reads agent wallet activity via public RPC.
3
- * Only tracks AIAIAI token transfers. Classifies as buy or burn.
4
- * Fees are calculated as a percentage of each action.
3
+ * Parses Pump.fun Buy + BurnChecked events from inner instructions.
4
+ * Checks the ACTION wallet (GmFrDZT...) for transaction signatures.
5
+ * Fees are calculated as 0.5% of each action's USD value.
5
6
  */
6
7
  import { Type } from "@sinclair/typebox";
7
8
  import { ACTION_WALLET, AIAIAI_MINT } from "./AgentWallet.js";
@@ -62,49 +63,74 @@ export class ActionFeed {
62
63
  ]);
63
64
  if (!tx || !tx.meta)
64
65
  return;
65
- const preBalances = tx.meta.preTokenBalances ?? [];
66
- const postBalances = tx.meta.postTokenBalances ?? [];
67
- // Find AIAIAI balance changes for the action wallet
68
- for (const post of postBalances) {
69
- if (post.mint !== AIAIAI_MINT)
70
- continue;
71
- if (post.owner !== ACTION_WALLET)
72
- continue;
73
- const pre = preBalances.find((p) => p.accountIndex === post.accountIndex && p.mint === AIAIAI_MINT);
74
- const preAmt = pre ? parseFloat(pre.uiTokenAmount?.uiAmount ?? "0") : 0;
75
- const postAmt = parseFloat(post.uiTokenAmount?.uiAmount ?? "0");
76
- const diff = postAmt - preAmt;
77
- // Skip negligible changes
78
- if (Math.abs(diff) < 0.000001)
79
- continue;
80
- // Positive diff = tokens came IN = BUY
81
- // Negative diff = tokens went OUT = BURN
82
- const type = diff > 0 ? "buy" : "burn";
83
- const amount = Math.abs(diff);
84
- const usdValue = amount * this._price;
85
- // Fee: 0.5% of action value
86
- const fee = usdValue * 0.005;
87
- if (type === "buy") {
88
- this.fees.buyFees += fee;
66
+ // Parse inner instructions for Pump.fun Buy + BurnChecked on AIAIAI
67
+ const innerInstructions = tx.meta.innerInstructions ?? [];
68
+ let buyAmount = 0;
69
+ let burnAmount = 0;
70
+ for (const inner of innerInstructions) {
71
+ for (const ix of (inner.instructions ?? [])) {
72
+ // Pump.fun Buy: transferChecked of AIAIAI from pool to hot wallet
73
+ if (ix.parsed?.type === "transferChecked" &&
74
+ ix.parsed.info?.mint === AIAIAI_MINT) {
75
+ const amt = parseFloat(ix.parsed.info?.tokenAmount?.uiAmount ?? "0");
76
+ if (amt > 1)
77
+ buyAmount += amt;
78
+ }
79
+ // Burn: burnChecked of AIAIAI
80
+ if (ix.parsed?.type === "burnChecked" &&
81
+ ix.parsed.info?.mint === AIAIAI_MINT) {
82
+ const amt = parseFloat(ix.parsed.info?.tokenAmount?.uiAmount ?? "0");
83
+ if (amt > 0)
84
+ burnAmount += amt;
85
+ }
89
86
  }
90
- else {
91
- this.fees.burnFees += fee;
87
+ }
88
+ // Fallback: scan token balance changes for any AIAIAI account
89
+ if (buyAmount === 0 && burnAmount === 0) {
90
+ const preBalances = tx.meta.preTokenBalances ?? [];
91
+ const postBalances = tx.meta.postTokenBalances ?? [];
92
+ for (const post of postBalances) {
93
+ if (post.mint !== AIAIAI_MINT)
94
+ continue;
95
+ const pre = preBalances.find((p) => p.accountIndex === post.accountIndex && p.mint === AIAIAI_MINT);
96
+ const preAmt = pre ? parseFloat(pre.uiTokenAmount?.uiAmount ?? "0") : 0;
97
+ const postAmt = parseFloat(post.uiTokenAmount?.uiAmount ?? "0");
98
+ const diff = postAmt - preAmt;
99
+ if (Math.abs(diff) < 0.000001)
100
+ continue;
101
+ if (diff > 0)
102
+ buyAmount += diff;
103
+ else
104
+ burnAmount += Math.abs(diff);
92
105
  }
106
+ }
107
+ // Record
108
+ if (buyAmount > 0) {
109
+ const usdValue = buyAmount * this._price;
110
+ const fee = usdValue * 0.005;
111
+ this.fees.buyFees += fee;
112
+ this.fees.total = this.fees.buyFees + this.fees.burnFees;
113
+ this.actions.unshift({
114
+ id: signature.slice(0, 10),
115
+ type: "buy", amount: buyAmount, token: "AIAIAI", usdValue,
116
+ timestamp: (tx.blockTime ?? Math.floor(Date.now() / 1000)) * 1000,
117
+ signature,
118
+ });
119
+ }
120
+ if (burnAmount > 0) {
121
+ const usdValue = burnAmount * this._price;
122
+ const fee = usdValue * 0.005;
123
+ this.fees.burnFees += fee;
93
124
  this.fees.total = this.fees.buyFees + this.fees.burnFees;
94
- const action = {
95
- id: signature.slice(0, 8),
96
- type,
97
- amount,
98
- token: "AIAIAI",
99
- usdValue,
125
+ this.actions.unshift({
126
+ id: signature.slice(0, 10) + "-b",
127
+ type: "burn", amount: burnAmount, token: "AIAIAI", usdValue,
100
128
  timestamp: (tx.blockTime ?? Math.floor(Date.now() / 1000)) * 1000,
101
129
  signature,
102
- };
103
- this.actions.unshift(action);
130
+ });
104
131
  }
105
- // Keep only last 50
106
- if (this.actions.length > 50)
107
- this.actions = this.actions.slice(0, 50);
132
+ if (this.actions.length > 100)
133
+ this.actions = this.actions.slice(0, 100);
108
134
  }
109
135
  catch (error) {
110
136
  logger.debug('ActionFeed', 'Failed to parse tx', { error: error.message });
@@ -114,21 +140,14 @@ export class ActionFeed {
114
140
  if (p > 0)
115
141
  this._price = p;
116
142
  }
117
- getActions() {
118
- return [...this.actions];
119
- }
120
- getRecentActions(limit = 10) {
121
- return this.actions.slice(0, limit);
122
- }
123
- getFees() {
124
- return { ...this.fees };
125
- }
143
+ getActions() { return [...this.actions]; }
144
+ getRecentActions(limit = 10) { return this.actions.slice(0, limit); }
145
+ getFees() { return { ...this.fees }; }
126
146
  getActionSummary() {
127
147
  const buys = this.actions.filter(a => a.type === "buy");
128
148
  const burns = this.actions.filter(a => a.type === "burn");
129
149
  return {
130
- buys: buys.length,
131
- burns: burns.length,
150
+ buys: buys.length, burns: burns.length,
132
151
  totalBought: buys.reduce((s, a) => s + a.amount, 0),
133
152
  totalBurned: burns.reduce((s, a) => s + a.amount, 0),
134
153
  };
@@ -146,32 +165,26 @@ export class ActionFeed {
146
165
  content: [{
147
166
  type: "text",
148
167
  text: [
149
- "No agent buy/burn actions detected yet.",
150
- "",
151
- `Action wallet: ${ACTION_WALLET}`,
152
- "The agent buys and burns $AIAIAI. Actions appear here when detected on-chain.",
168
+ "No buy/burn actions detected yet.",
169
+ `Action wallet: ${ACTION_WALLET.slice(0, 8)}…${ACTION_WALLET.slice(-6)}`,
170
+ "Actions appear when the agent buys and burns $AIAIAI via Pump.fun.",
153
171
  ].join("\n"),
154
172
  }],
155
173
  };
156
174
  }
157
- const lines = actions.map(a => {
158
- const icon = a.type === "buy" ? "↗" : "🔥";
159
- const time = new Date(a.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
160
- return ` ${icon} ${time} ${a.type.toUpperCase().padEnd(6)} ${a.amount.toLocaleString()} $AIAIAI ($${a.usdValue.toFixed(2)})`;
161
- });
162
175
  const summary = this.getActionSummary();
163
- return {
164
- content: [{
165
- type: "text",
166
- text: [
167
- `Agent Actions (last ${actions.length})`,
168
- ` Buys: ${summary.buys} (${summary.totalBought.toLocaleString()} $AIAIAI)`,
169
- ` Burns: ${summary.burns} (${summary.totalBurned.toLocaleString()} $AIAIAI)`,
170
- ``,
171
- ...lines,
172
- ].join("\n"),
173
- }],
174
- };
176
+ const lines = [
177
+ `🔄 Recent Actions (${actions.length})`,
178
+ ` Buys: ${summary.buys} (${summary.totalBought.toLocaleString()} $AIAIAI)`,
179
+ ` Burns: ${summary.burns} (${summary.totalBurned.toLocaleString()} $AIAIAI)`,
180
+ "",
181
+ ...actions.map(a => {
182
+ const icon = a.type === "buy" ? "↗" : "🔥";
183
+ const time = new Date(a.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
184
+ return ` ${icon} ${time} ${a.type.toUpperCase().padEnd(4)} ${a.amount.toLocaleString()} $AIAIAI ($${a.usdValue.toFixed(2)})`;
185
+ }),
186
+ ];
187
+ return { content: [{ type: "text", text: lines.join("\n") }] };
175
188
  }
176
189
  async getFeesTool() {
177
190
  const f = this.getFees();
@@ -179,7 +192,7 @@ export class ActionFeed {
179
192
  content: [{
180
193
  type: "text",
181
194
  text: [
182
- `Agent Fees (0.5% per action)`,
195
+ `💵 Agent Fees (0.5% per action)`,
183
196
  ` Buy fees: $${f.buyFees.toFixed(4)}`,
184
197
  ` Burn fees: $${f.burnFees.toFixed(4)}`,
185
198
  ` ─────────────────────`,
@@ -8,9 +8,10 @@
8
8
  * Signer: GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG (authority)
9
9
  */
10
10
  import type { ToolResult } from "../api/ExtensionAPI.js";
11
- export declare const COLD_WALLET = "A11iZoqEt6hU7HyggqC67ee4AtYmaJjwKCvJLerJRV2J";
12
- export declare const ACTION_WALLET = "BygDYM1ZXLQNC1HXLhnd1rHZ7E5XjioqT3vPjJFfjnU2";
11
+ export declare const ACTION_WALLET = "GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG";
12
+ export declare const HOT_WALLET = "BygDYM1ZXLQNC1HXLhnd1rHZ7E5XjioqT3vPjJFfjnU2";
13
13
  export declare const DEPOSIT_WALLET = "FBMDYpG9WXKy4SgxuATQdB2sCyzHsJWPrEr45z3TgL2e";
14
+ export declare const COLD_WALLET = "A11iZoqEt6hU7HyggqC67ee4AtYmaJjwKCvJLerJRV2J";
14
15
  export declare const SIGNER = "GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG";
15
16
  export declare const AIAIAI_MINT = "AVPJS61gZmWKtaEpb7qYPKo8Fk2xQUsayYQxPiPMpump";
16
17
  export declare const AIAIAI_TOKEN = "AVPJS61gZmWKtaEpb7qYPKo8Fk2xQUsayYQxPiPMpump";
@@ -23,6 +24,7 @@ export interface WalletBalance {
23
24
  export interface AgentWallets {
24
25
  cold: WalletBalance;
25
26
  action: WalletBalance;
27
+ hot: WalletBalance;
26
28
  deposit: WalletBalance;
27
29
  }
28
30
  export declare class AgentWallet {
@@ -34,6 +36,7 @@ export declare class AgentWallet {
34
36
  getActionWallet(): Promise<WalletBalance>;
35
37
  getDepositWallet(): Promise<WalletBalance>;
36
38
  getSolPrice(): Promise<number>;
39
+ getHotWallet(): Promise<WalletBalance>;
37
40
  getAgentBalanceParams: import("@sinclair/typebox").TObject<{}>;
38
41
  getDepositBalanceParams: import("@sinclair/typebox").TObject<{}>;
39
42
  getAgentBalanceTool(): Promise<ToolResult>;
@@ -10,10 +10,16 @@
10
10
  import { Type } from "@sinclair/typebox";
11
11
  import { resilientFetch } from "../util/resilientFetch.js";
12
12
  import { logger } from "../util/logger.js";
13
- export const COLD_WALLET = "A11iZoqEt6hU7HyggqC67ee4AtYmaJjwKCvJLerJRV2J";
14
- export const ACTION_WALLET = "BygDYM1ZXLQNC1HXLhnd1rHZ7E5XjioqT3vPjJFfjnU2";
13
+ // Wallet architecture (verified on-chain):
14
+ // ACTION: GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG (executes buys + burns)
15
+ // HOT: BygDYM1ZXLQNC1HXLhnd1rHZ7E5XjioqT3vPjJFfjnU2 (temporary swap + burn)
16
+ // DEPOSIT: FBMDYpG9WXKy4SgxuATQdB2sCyzHsJWPrEr45z3TgL2e (user deposits)
17
+ // COLD: A11iZoqEt6hU7HyggqC67ee4AtYmaJjwKCvJLerJRV2J (reserve — /wallet only)
18
+ export const ACTION_WALLET = "GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG";
19
+ export const HOT_WALLET = "BygDYM1ZXLQNC1HXLhnd1rHZ7E5XjioqT3vPjJFfjnU2";
15
20
  export const DEPOSIT_WALLET = "FBMDYpG9WXKy4SgxuATQdB2sCyzHsJWPrEr45z3TgL2e";
16
- export const SIGNER = "GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG";
21
+ export const COLD_WALLET = "A11iZoqEt6hU7HyggqC67ee4AtYmaJjwKCvJLerJRV2J";
22
+ export const SIGNER = ACTION_WALLET;
17
23
  export const AIAIAI_MINT = "AVPJS61gZmWKtaEpb7qYPKo8Fk2xQUsayYQxPiPMpump";
18
24
  export const AIAIAI_TOKEN = AIAIAI_MINT;
19
25
  const USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
@@ -73,23 +79,17 @@ export class AgentWallet {
73
79
  if (this.cachedWallets && Date.now() - this.lastFetch < this.cacheDuration) {
74
80
  return this.cachedWallets;
75
81
  }
76
- // Parallel: 3 SOL balances + 6 token balances (9 concurrent queries)
77
- const wallets = [COLD_WALLET, ACTION_WALLET, DEPOSIT_WALLET];
78
- const mints = [AIAIAI_MINT, USDC_MINT];
79
- const [coldSol, coldAiai, coldUsdc, actionSol, actionAiai, actionUsdc, depSol, depAiai, depUsdc] = await Promise.all([
80
- getBalance(COLD_WALLET),
81
- getTokenBalance(COLD_WALLET, AIAIAI_MINT),
82
- getTokenBalance(COLD_WALLET, USDC_MINT),
83
- getBalance(ACTION_WALLET),
84
- getTokenBalance(ACTION_WALLET, AIAIAI_MINT),
85
- getTokenBalance(ACTION_WALLET, USDC_MINT),
86
- getBalance(DEPOSIT_WALLET),
87
- getTokenBalance(DEPOSIT_WALLET, AIAIAI_MINT),
88
- getTokenBalance(DEPOSIT_WALLET, USDC_MINT),
82
+ // 4 wallets × 3 tokens = 12 parallel queries
83
+ const [coldSol, coldAiai, coldUsdc, actionSol, actionAiai, actionUsdc, hotSol, hotAiai, hotUsdc, depSol, depAiai, depUsdc] = await Promise.all([
84
+ getBalance(COLD_WALLET), getTokenBalance(COLD_WALLET, AIAIAI_MINT), getTokenBalance(COLD_WALLET, USDC_MINT),
85
+ getBalance(ACTION_WALLET), getTokenBalance(ACTION_WALLET, AIAIAI_MINT), getTokenBalance(ACTION_WALLET, USDC_MINT),
86
+ getBalance(HOT_WALLET), getTokenBalance(HOT_WALLET, AIAIAI_MINT), getTokenBalance(HOT_WALLET, USDC_MINT),
87
+ getBalance(DEPOSIT_WALLET), getTokenBalance(DEPOSIT_WALLET, AIAIAI_MINT), getTokenBalance(DEPOSIT_WALLET, USDC_MINT),
89
88
  ]);
90
89
  this.cachedWallets = {
91
90
  cold: { address: COLD_WALLET, sol: coldSol, aiaiai: coldAiai, usdc: coldUsdc },
92
91
  action: { address: ACTION_WALLET, sol: actionSol, aiaiai: actionAiai, usdc: actionUsdc },
92
+ hot: { address: HOT_WALLET, sol: hotSol, aiaiai: hotAiai, usdc: hotUsdc },
93
93
  deposit: { address: DEPOSIT_WALLET, sol: depSol, aiaiai: depAiai, usdc: depUsdc },
94
94
  };
95
95
  this.lastFetch = Date.now();
@@ -116,22 +116,29 @@ export class AgentWallet {
116
116
  }
117
117
  }
118
118
  // ── Tools ───────────────────────────────────────────────────────────────
119
+ async getHotWallet() {
120
+ return (await this.getAll()).hot;
121
+ }
119
122
  getAgentBalanceParams = Type.Object({});
120
123
  getDepositBalanceParams = Type.Object({});
121
124
  async getAgentBalanceTool() {
122
125
  const w = await this.getAll();
123
126
  const lines = [
124
- `Agent Cold Wallet`,
125
- ` Address: ${COLD_WALLET.slice(0, 8)}…${COLD_WALLET.slice(-6)}`,
126
- ` SOL: ${w.cold.sol.toFixed(4)}`,
127
- ` $AIAIAI: ${w.cold.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 2 })}`,
128
- ` USDC: ${w.cold.usdc.toFixed(2)}`,
129
- ``,
130
- `Agent Action Wallet`,
131
- ` Address: ${ACTION_WALLET.slice(0, 8)}…${ACTION_WALLET.slice(-6)}`,
127
+ `🤖 Action Wallet`,
128
+ ` ${ACTION_WALLET.slice(0, 8)}…${ACTION_WALLET.slice(-6)}`,
132
129
  ` SOL: ${w.action.sol.toFixed(4)}`,
133
- ` $AIAIAI: ${w.action.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 2 })}`,
130
+ ` $AIAIAI: ${w.action.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 2 })}`,
134
131
  ` USDC: ${w.action.usdc.toFixed(2)}`,
132
+ ``,
133
+ `⚡ Hot Wallet`,
134
+ ` ${HOT_WALLET.slice(0, 8)}…${HOT_WALLET.slice(-6)}`,
135
+ ` SOL: ${w.hot.sol.toFixed(4)}`,
136
+ ` $AIAIAI: ${w.hot.aiaiai.toLocaleString(undefined, { maximumFractionDigits: 2 })}`,
137
+ ` USDC: ${w.hot.usdc.toFixed(2)}`,
138
+ ``,
139
+ `❄️ Cold (reserve)`,
140
+ ` ${COLD_WALLET.slice(0, 8)}…${COLD_WALLET.slice(-6)}`,
141
+ ` SOL: ${w.cold.sol.toFixed(4)}`,
135
142
  ];
136
143
  return { content: [{ type: "text", text: lines.join("\n") }] };
137
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiaiaichain/agent",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "AIAIAI Chain Agent — Solana-native AI agent for decentralized AI governance. Ticker: $AIAIAI",
5
5
  "author": "AIAIAI Foundation",
6
6
  "license": "MIT",
@@ -64,4 +64,4 @@
64
64
  "docs",
65
65
  "!dist/**/*.map"
66
66
  ]
67
- }
67
+ }