22import { Container , Service } from 'typedi'
33import { EvmBasedRpcSuite , JsonRpcCall , JsonRpcResponse } from '../../../dto'
44import { Utils } from '../../../util'
5+ // Need to import like this to keep browser working
56import { LoadBalancer } from '../generic/LoadBalancer'
67import { AbstractEvmRpc } from './AbstractEvmRpc'
78import { EvmUtils } from './EvmUtils'
@@ -13,33 +14,33 @@ import { EvmUtils } from './EvmUtils'
1314 transient : true ,
1415} )
1516export class EvmArchiveLoadBalancerRpc extends AbstractEvmRpc implements EvmBasedRpcSuite {
16- protected readonly loadBalancerRpc : LoadBalancer
17+ protected readonly loadBalancer : LoadBalancer
1718
1819 constructor ( id : string ) {
1920 super ( )
20- this . loadBalancerRpc = Container . of ( id ) . get ( LoadBalancer )
21+ this . loadBalancer = Container . of ( id ) . get ( LoadBalancer )
2122 }
2223
2324 protected async rpcCall < T > ( method : string , params ?: unknown [ ] ) : Promise < T > {
2425 const preparedCall = Utils . prepareRpcCall ( method , params )
2526 const isArchive = EvmUtils . isArchiveMethod ( preparedCall )
26- return ( await this . loadBalancerRpc . rawRpcCall ( preparedCall , isArchive ) ) as T
27+ return ( await this . loadBalancer . rawRpcCall ( preparedCall , isArchive ) ) as T
2728 }
2829
2930 async rawRpcCall ( body : JsonRpcCall ) : Promise < JsonRpcResponse < any > > {
3031 const isArchive = EvmUtils . isArchiveMethod ( body )
31- return this . loadBalancerRpc . rawRpcCall ( body , isArchive )
32+ return this . loadBalancer . rawRpcCall ( body , isArchive )
3233 }
3334
3435 rawBatchRpcCall ( body : JsonRpcCall [ ] ) : Promise < JsonRpcResponse < any > [ ] | JsonRpcResponse < any > > {
35- return this . loadBalancerRpc . rawBatchRpcCall ( body )
36+ return this . loadBalancer . rawBatchRpcCall ( body )
3637 }
3738
3839 public destroy ( ) {
39- this . loadBalancerRpc . destroy ( )
40+ this . loadBalancer . destroy ( )
4041 }
4142
4243 public getRpcNodeUrl ( ) : string {
43- return this . loadBalancerRpc . getActiveArchiveUrlWithFallback ( ) . url
44+ return this . loadBalancer . getActiveArchiveUrlWithFallback ( ) . url
4445 }
4546}
0 commit comments