The purpose of this ticket is to refactor thor-client.ts (so the ThorClient class) and remove its circular dependencies.
This is one example when instantiating the class, we use this to instantiate our own attributes:
constructor(
readonly httpClient: IHttpClient,
options?: BlocksModuleOptions
) {
this.accounts = new AccountsModule(this);
this.nodes = new NodesModule(this);
this.blocks = new BlocksModule(this, options);
this.logs = new LogsModule(this);
this.transactions = new TransactionsModule(this);
this.contracts = new ContractsModule(this);
this.gas = new GasModule(this);
this.debug = new DebugModule(this);
}
The idea is to keep the current functionality as much as possible and get a better idea about to how to perform the next steps with regards to refactor the network package and remove the other circular dependencies + a bigger picture on how to perform that refactor.
Basic Example
In the networkpackage.json, remove the condition that counts the number of circular dependencies so we can check the ThorClient ones. There is no need as part of this ticket to fix all of them since it would imply a bigger refactor, so the condition should be put back once we have addressed the circular dependencies for ThorClient (maybe rather than being 11, should be less):
Summary
The purpose of this ticket is to refactor
thor-client.ts
(so theThorClient
class) and remove its circular dependencies.This is one example when instantiating the class, we use
this
to instantiate our own attributes:The idea is to keep the current functionality as much as possible and get a better idea about to how to perform the next steps with regards to refactor the
network
package and remove the other circular dependencies + a bigger picture on how to perform that refactor.Basic Example
In the
network
package.json
, remove the condition that counts the number of circular dependencies so we can check theThorClient
ones. There is no need as part of this ticket to fix all of them since it would imply a bigger refactor, so the condition should be put back once we have addressed the circular dependencies forThorClient
(maybe rather than being 11, should be less):