Skip to content

Commit

Permalink
feat: add BaseBlockDataProvider
Browse files Browse the repository at this point in the history
Signed-off-by: Anmol Sharma <anmolsharma0234@gmail.com>
  • Loading branch information
theanmolsharma committed Apr 14, 2024
1 parent 6eff764 commit 03e18eb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/block-data-providers/base-block-data-provider.abstract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { CommandBus } from '@nestjs/cqrs';
import {
IndexTransactionCommand,
TransactionInput,
TransactionOutput,
} from '@/commands/index-transaction.command';

export abstract class BaseBlockDataProvider {
protected constructor(private readonly commandBus: CommandBus) {}

async indexTransaction(
txid: string,
vin: TransactionInput[],
vout: TransactionOutput[],
blockHeight: number,
blockHash: string,
): Promise<void> {
await this.commandBus.execute(
new IndexTransactionCommand(
txid,
vin,
vout,
blockHeight,
blockHash,
),
);
}
}

0 comments on commit 03e18eb

Please sign in to comment.