You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today all our SDKs have methods like connectToMainnet() or connectToTestnet() since the code is in that part made for Hedera. Happily all the SDKs provide a way how any Hiero based network is supported. This way today needs knowledge about technical information of the network (IPs, hosts, ...) and will end in a lot of code that need to be created to connect to a Hedera specific network.
Based on that we need to refactor our SDK to provide an easy way to support the configuration of specific networks (like Hedera Mainnet) in an easy way without being releated to a specific provider. Here I would suggest, that an SDK under Hiero can contain information for any public and open network operated by companies / entities being part of the Hiero project / the LFDT.
Today all our SDKs have methods like
connectToMainnet()
orconnectToTestnet()
since the code is in that part made for Hedera. Happily all the SDKs provide a way how any Hiero based network is supported. This way today needs knowledge about technical information of the network (IPs, hosts, ...) and will end in a lot of code that need to be created to connect to a Hedera specific network.Based on that we need to refactor our SDK to provide an easy way to support the configuration of specific networks (like Hedera Mainnet) in an easy way without being releated to a specific provider. Here I would suggest, that an SDK under Hiero can contain information for any public and open network operated by companies / entities being part of the Hiero project / the LFDT.
A possible solution
I did some tests in Java (see OpenElements/hiero-enterprise-java#148) and a SPI based approach in Java looks like the best solution:
I created an interface that provided all information that is needed by a network
For the Hedera networks (Mainnet, testnet) I now created concrete implementations that are handled as private API:
By using the SPI we can now easy write code like this:
If a NetworkSettings implementation with the given identifier is found on the classpath it will be used.
Even provider of a private network could use that approach by adding a custom NetworkSettings implementation at runtime to the classpath.
Other languages
import()
, Dependency Injection (Inversify)plugin
package), Interface-based factorylibloading
crate, Trait-based factorydlopen/dlsym
orLoadLibrary
, Factory pattern@objc dynamic
)importlib
for dynamic loading,pkg_resources
entry pointsLooks like we can do a silimar solution for all our SDKs
The text was updated successfully, but these errors were encountered: