Add real Solana wallet observation and raw transaction persistence

This commit is contained in:
2026-08-16 09:41:29 +00:00
parent dc23412c3f
commit 37ee805b96
7 changed files with 575 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ import {
ITradeRepository,
ISimulationExecutionRepository,
IEventJournalRepository,
IRawWalletTransactionRepository,
} from '../../src/domain/interfaces.js';
import {
WatchedWallet,
@@ -11,6 +12,7 @@ import {
Trade,
SimulatedExecution,
EventJournalEntry,
RawWalletTransaction,
} from '../../src/domain/models.js';
export class InMemoryWalletRepository implements IWalletRepository {
@@ -132,3 +134,18 @@ export class InMemoryStrategyRunsRepository {
this.runs.push(run);
}
}
export class InMemoryRawWalletTransactionRepository implements IRawWalletTransactionRepository {
public transactions: RawWalletTransaction[] = [];
async saveTransaction(tx: RawWalletTransaction): Promise<void> {
const existing = this.transactions.find((t) => t.transactionSignature === tx.transactionSignature);
if (!existing) {
this.transactions.push(tx);
}
}
async getTransactionBySignature(signature: string): Promise<RawWalletTransaction | null> {
return this.transactions.find((t) => t.transactionSignature === signature) || null;
}
}