-
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(transaction-pool-api): boot API server from Start handler (#723)
* Set height on start * Start transaction pool API on start * Extract contract * style: resolve style guide violations --------- Co-authored-by: sebastijankuzner <[email protected]>
- Loading branch information
1 parent
d595d5f
commit 464b5d5
Showing
10 changed files
with
42 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from "./identifiers.js"; | ||
export * from "./server.js"; | ||
export * from "./service-provider.js"; |
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
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
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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
import { inject, injectable } from "@mainsail/container"; | ||
import { inject, injectable, tagged } from "@mainsail/container"; | ||
import { Contracts, Identifiers } from "@mainsail/contracts"; | ||
import { Providers } from "@mainsail/kernel"; | ||
|
||
@injectable() | ||
export class StartHandler { | ||
@inject(Identifiers.Application.Instance) | ||
protected readonly app!: Contracts.Kernel.Application; | ||
|
||
@inject(Identifiers.State.Store) | ||
protected readonly store!: Contracts.State.Store; | ||
|
||
@inject(Identifiers.TransactionPool.Service) | ||
private readonly transactionPoolService!: Contracts.TransactionPool.Service; | ||
|
||
public async handle(): Promise<void> { | ||
@inject(Identifiers.ServiceProvider.Configuration) | ||
@tagged("plugin", "api-transaction-pool") | ||
private readonly configuration!: Providers.PluginConfiguration; | ||
|
||
public async handle(height: number): Promise<void> { | ||
this.store.setHeight(height); | ||
await this.transactionPoolService.reAddTransactions(); | ||
|
||
if (this.configuration.get("server.http.enabled")) { | ||
await this.app.get<Contracts.Api.Server>(Identifiers.TransactionPool.API.HTTP).boot(); | ||
} | ||
|
||
if (this.configuration.get("server.https.enabled")) { | ||
await this.app.get<Contracts.Api.Server>(Identifiers.TransactionPool.API.HTTPS).boot(); | ||
} | ||
} | ||
} |
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