-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add index transaction command and template for it's handler
Signed-off-by: Anmol Sharma <anmolsharma0234@gmail.com>
- Loading branch information
1 parent
0ab45ce
commit b981e18
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,18 @@ | ||
export type TransactionInput = { | ||
scriptSig: string; // unlocking script | ||
witness?: string[]; // witness data | ||
prevOutScript: string; // previous output script | ||
}; | ||
|
||
export type TransactionOutput = { | ||
scriptPubKey: string; | ||
value: number; | ||
}; | ||
|
||
export class IndexTransactionCommand { | ||
constructor( | ||
public readonly txid: string, | ||
public readonly vin: TransactionInput[], | ||
public readonly vout: TransactionOutput[], | ||
) {} | ||
} |
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,11 @@ | ||
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'; | ||
import { IndexTransactionCommand } from '@/commands/index-transaction.command'; | ||
|
||
@CommandHandler(IndexTransactionCommand) | ||
export class IndexTransactionHandler | ||
implements ICommandHandler<IndexTransactionCommand> | ||
{ | ||
async execute(command: IndexTransactionCommand) { | ||
throw new Error(`Method not implemented. Command: ${command}`); | ||
} | ||
} |