Skip to content

Commit cdae2a5

Browse files
committed
lint passing
1 parent 92d86fc commit cdae2a5

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

examples/cointoss/src/commands.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export async function handleCommand(
1414
content: string,
1515
userId: string,
1616
gameManager: GameManager,
17-
agent: any,
18-
agentConfig: any,
17+
agent: ReturnType<typeof createReactAgent>,
18+
agentConfig: { configurable: { thread_id: string } },
1919
): Promise<string> {
2020
const commandParts = content.split(" ");
2121
const firstWord = commandParts[0].toLowerCase();

examples/cointoss/src/game.ts

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ interface Transfer {
1616
export class GameManager {
1717
private lastGameId: number = 0;
1818
private walletService: WalletService;
19-
private promptParserAgent: any = null;
2019

2120
constructor(
2221
private storage: StorageProvider,

examples/cointoss/src/index.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import * as path from "path";
2+
import type { createReactAgent } from "@langchain/langgraph/prebuilt";
23
import type { Conversation, DecodedMessage } from "@xmtp/node-sdk";
34
import * as dotenv from "dotenv";
45
import { initializeAgent } from "./cdp";
56
import { handleCommand as processCommand } from "./commands";
67
import { GameManager } from "./game";
78
import { initializeStorage } from "./storage";
9+
import type { StorageProvider } from "./types";
810
import { initializeXmtpClient, startMessageListener } from "./xmtp";
911

1012
// Initialize environment variables - make sure this is at the top of the file before any other code
@@ -18,9 +20,9 @@ if (result.error) {
1820
}
1921

2022
// Global CDP agent instance - we'll initialize this at startup for better performance
21-
let cdpAgent: any = null;
22-
let cdpAgentConfig: any = null;
23-
let storage: any = null;
23+
let cdpAgent: ReturnType<typeof createReactAgent> | null = null;
24+
let cdpAgentConfig: { configurable: { thread_id: string } } | null = null;
25+
let storage: StorageProvider | null = null;
2426

2527
/**
2628
* Validates that required environment variables are set
@@ -86,16 +88,16 @@ async function handleMessage(
8688
// TODO: Fix this
8789
const address = message.senderInboxId;
8890
// Initialize game manager for this request
89-
const gameManager = new GameManager(storage, address);
91+
const gameManager = new GameManager(storage as StorageProvider, address);
9092

9193
// Extract command content and process it
9294
const commandContent = command.replace(/^@toss\s+/i, "").trim();
9395
const response = await processCommand(
9496
commandContent,
9597
address,
9698
gameManager,
97-
cdpAgent,
98-
cdpAgentConfig,
99+
cdpAgent as ReturnType<typeof createReactAgent>,
100+
cdpAgentConfig as { configurable: { thread_id: string } },
99101
);
100102

101103
await conversation.send(response);

examples/cointoss/src/storage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class RedisStorageProvider implements StorageProvider {
179179
this.client = createClient({
180180
url: process.env.REDIS_URL,
181181
});
182-
this.client.connect();
182+
void this.client.connect();
183183
}
184184

185185
async saveGame(game: CoinTossGame): Promise<void> {
@@ -188,7 +188,7 @@ export class RedisStorageProvider implements StorageProvider {
188188

189189
async getGame(gameId: string): Promise<CoinTossGame | null> {
190190
const data = await this.client.get(this.gamePrefix + gameId);
191-
return data ? JSON.parse(data) : null;
191+
return data ? (JSON.parse(data) as CoinTossGame) : null;
192192
}
193193

194194
async listActiveGames(): Promise<CoinTossGame[]> {

0 commit comments

Comments
 (0)