-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Anmol Sharma <anmolsharma0234@gmail.com>
- Loading branch information
1 parent
6eff764
commit 03e18eb
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/block-data-providers/base-block-data-provider.abstract.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
); | ||
} | ||
} |