Add real Solana wallet observation and raw transaction persistence
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user