hashgraph / hedera-nft-auction-demo

Demo NFT auction
Apache License 2.0
24 stars 11 forks source link

Refactor Network client layout #26

Open Nana-EC opened 3 years ago

Nana-EC commented 3 years ago

Is your feature request related to a problem? Please describe. Currently each call to HederaClient.getClient() creates a new SDK client and doesn't close it's connections Additionally the "clients" that interact with the network are classes that offer static methods to run single operations. There may be improvements that could be made to allow for easy referencing and potential performance gains

Describe the solution you'd like

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context

gregscullard commented 3 years ago

Can you explain ?

I've updated the Hedera client and associated uses to ensure it's only created one (except for the admin apis where injecting a client into the Verticle is problematic unless we only have one instance of the admin vertical - which may be acceptable for low throughput admin requests)

I've also created a new constructor for the HederaClient which accepts all parameters as variables such that we can create one without a dependency on .env.

gregscullard commented 3 years ago

Although, seeing the code uses .env, isn't there value in supplying a test .env file in order to test all is well, rather than override and therefore skip those lines of code during testing ?