Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Fix module template to be buildable when generated (#8557)
Browse files Browse the repository at this point in the history
♻️ fix module template to be buildable when generated
  • Loading branch information
shuse2 authored Jun 6, 2023
1 parent 33449a4 commit d87c628
Showing 1 changed file with 40 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/* eslint-disable class-methods-use-this */
/* eslint-disable @typescript-eslint/member-ordering */

import {
BaseModule,
ModuleInitArgs,
InsertAssetContext,
BlockVerifyContext,
TransactionVerifyContext,
VerificationResult,
TransactionExecuteContext,
GenesisBlockExecuteContext,
ModuleMetadata,
BlockExecuteContext,
BlockAfterExecuteContext,
// ModuleInitArgs,
// InsertAssetContext,
// BlockVerifyContext,
// TransactionVerifyContext,
// VerificationResult,
// TransactionExecuteContext,
// GenesisBlockExecuteContext,
// BlockExecuteContext,
// BlockAfterExecuteContext,
// VerifyStatus,
} from 'lisk-sdk';
import { <%= moduleClass %>Endpoint } from './endpoint';
import { <%= moduleClass %>Method } from './method';
Expand All @@ -21,64 +23,57 @@ export class <%= moduleClass %>Module extends BaseModule {
public method = new <%= moduleClass %>Method(this.stores, this.events);
public commands = [];

public constructor() {
super();
// registeration of stores and events
}
// public constructor() {
// super();
// // registeration of stores and events
// }

public metadata(): ModuleMetadata {
return {
name: '',
...this.baseMetadata(),
endpoints: [],
commands: this.commands.map(command => ({
name: command.name,
params: command.schema,
})),
events: this.events.values().map(v => ({
name: v.name,
data: v.schema,
})),
assets: [],
};
}

// Lifecycle hooks
public async init(_args: ModuleInitArgs): Promise<void> {
// initialize this module when starting a node
}
// public async init(_args: ModuleInitArgs): Promise<void> {
// // initialize this module when starting a node
// }

public async insertAssets(_context: InsertAssetContext) {
// initialize block generation, add asset
}
// public async insertAssets(_context: InsertAssetContext) {
// // initialize block generation, add asset
// }

public async verifyAssets(_context: BlockVerifyContext): Promise<void> {
// verify block
}
// public async verifyAssets(_context: BlockVerifyContext): Promise<void> {
// // verify block
// }

// Lifecycle hooks
public async verifyTransaction(_context: TransactionVerifyContext): Promise<VerificationResult> {
// public async verifyTransaction(_context: TransactionVerifyContext): Promise<VerificationResult> {
// verify transaction will be called multiple times in the transaction pool
}
// return { status: VerifyStatus.OK };
// }

public async beforeCommandExecute(_context: TransactionExecuteContext): Promise<void> {
}
// public async beforeCommandExecute(_context: TransactionExecuteContext): Promise<void> {
// }

public async afterCommandExecute(_context: TransactionExecuteContext): Promise<void> {
// public async afterCommandExecute(_context: TransactionExecuteContext): Promise<void> {

}
public async initGenesisState(_context: GenesisBlockExecuteContext): Promise<void> {
// }
// public async initGenesisState(_context: GenesisBlockExecuteContext): Promise<void> {

}
// }

public async finalizeGenesisState(_context: GenesisBlockExecuteContext): Promise<void> {
// public async finalizeGenesisState(_context: GenesisBlockExecuteContext): Promise<void> {

}
// }

public async beforeTransactionsExecute(_context: BlockExecuteContext): Promise<void> {
// public async beforeTransactionsExecute(_context: BlockExecuteContext): Promise<void> {

}
// }

public async afterTransactionsExecute(_context: BlockAfterExecuteContext): Promise<void> {
// public async afterTransactionsExecute(_context: BlockAfterExecuteContext): Promise<void> {

}
// }
}

0 comments on commit d87c628

Please sign in to comment.