import { AccountID , Transaction } from "../model" ; import { TransactionWithXDRFactory } from "../model/factories" ; import { BaseStorage } from "./base" ; export class TransactionsStorage extends BaseStorage { public forAccount ( accountId ) { this . addTerm ( { source_account_id : accountId } ) ; return this ; } public forLedger ( seq ) { this . addTerm ( { seq } ) ; return this ; } public async findById ( id ) { return this . addTerm ( { id } ) . one ( ) ; } protected get elasticIndexName ( ) { return "tx" ; } protected hitID ( hit ) { return hit . _source . id ; } protected convertRawDoc ( doc ) { return TransactionWithXDRFactory . fromStorage ( doc ) ; } }