File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ const errors = {
51
51
export class TransactionFeeHook extends ProvableTransactionHook < TransactionFeeHookConfig > {
52
52
public constructor (
53
53
// dependency on runtime, since balances are part of runtime logic
54
- @inject ( "Runtime" ) public runtime : Runtime < RuntimeModulesRecord >
54
+ @inject ( "Runtime" ) public runtime : Runtime < RuntimeModulesRecord > ,
55
+ @inject ( "Balances" ) public balances : Balances
55
56
) {
56
57
super ( ) ;
57
58
}
@@ -91,10 +92,6 @@ export class TransactionFeeHook extends ProvableTransactionHook<TransactionFeeHo
91
92
super . config = value ;
92
93
}
93
94
94
- public get balances ( ) {
95
- return this . runtime . dependencyContainer . resolve < Balances > ( "Balances" ) ;
96
- }
97
-
98
95
public get feeAnalyzer ( ) {
99
96
if ( this . persistedFeeAnalyzer === undefined ) {
100
97
throw new Error ( "TransactionFeeHook.start not called by protocol" ) ;
Original file line number Diff line number Diff line change @@ -132,6 +132,15 @@ export class Protocol<
132
132
public create ( childContainerProvider : ChildContainerProvider ) {
133
133
super . create ( childContainerProvider ) ;
134
134
135
+ const runtime : ModuleContainer < any > = this . container . resolve ( "Runtime" ) ;
136
+ runtime . moduleNames . forEach ( ( runtimeModuleName ) => {
137
+ this . container . register ( runtimeModuleName , {
138
+ useFactory : ( dependencyContainer ) => {
139
+ return runtime . resolve ( runtimeModuleName ) ;
140
+ } ,
141
+ } ) ;
142
+ } ) ;
143
+
135
144
// Register the BlockModules seperately since we need to
136
145
// inject them differently later
137
146
const ABSTRACT_MODULE_TYPES = [
You can’t perform that action at this time.
0 commit comments