-
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(api-transaction-pool): add configuration route and remove transa…
…ctionPool on `node/configuration` from public api (#750) * Remove dynamic fees * Add configuration endpoint * Remove transaction pool from node/configuration * Add version * Add height * Fix integration tests
- Loading branch information
1 parent
ce343c5
commit c1d539a
Showing
5 changed files
with
50 additions
and
17 deletions.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
packages/api-transaction-pool/source/controllers/configuration.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,33 @@ | ||
import Hapi from "@hapi/hapi"; | ||
import { AbstractController } from "@mainsail/api-common"; | ||
import { inject, injectable, tagged } from "@mainsail/container"; | ||
import { Contracts, Identifiers } from "@mainsail/contracts"; | ||
import { Providers } from "@mainsail/kernel"; | ||
|
||
@injectable() | ||
export class ConfigurationController extends AbstractController { | ||
@inject(Identifiers.ServiceProvider.Configuration) | ||
@tagged("plugin", "transaction-pool-service") | ||
private readonly pluginConfiguration!: Providers.PluginConfiguration; | ||
|
||
@inject(Identifiers.State.Store) | ||
private readonly stateStore!: Contracts.State.Store; | ||
|
||
public async configuration(request: Hapi.Request) { | ||
return { | ||
data: { | ||
core: { | ||
version: this.app.version(), | ||
}, | ||
height: this.stateStore.getHeight(), | ||
transactionPool: { | ||
maxTransactionAge: this.pluginConfiguration.get("maxTransactionAge"), | ||
maxTransactionBytes: this.pluginConfiguration.get("maxTransactionBytes"), | ||
maxTransactionsInPool: this.pluginConfiguration.get("maxTransactionsInPool"), | ||
maxTransactionsPerRequest: this.pluginConfiguration.get("maxTransactionsPerRequest"), | ||
maxTransactionsPerSender: this.pluginConfiguration.get("maxTransactionsPerSender"), | ||
}, | ||
}, | ||
}; | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
packages/api-transaction-pool/source/routes/configuration.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,15 @@ | ||
import Hapi from "@hapi/hapi"; | ||
import { Contracts } from "@mainsail/contracts"; | ||
|
||
import { ConfigurationController } from "../controllers/configuration.js"; | ||
|
||
export const register = (server: Contracts.Api.ApiServer): void => { | ||
const controller = server.app.app.resolve(ConfigurationController); | ||
server.bind(controller); | ||
|
||
server.route({ | ||
handler: (request: Hapi.Request) => controller.configuration(request), | ||
method: "GET", | ||
path: "/configuration", | ||
}); | ||
}; |