Open Crypto2099 opened 1 year ago
cc @Ryun1 - also looks related to pending CIP-0030 update https://github.com/cardano-foundation/CIPs/pull/323
Just noticed that and left a comment there as well, thanks!
Yes, there's no optimisation to be had by returning a numeric identifier, why not just be literal and say the currently connected network's name
This seems to be a long standing issue, with both #323 and #209 seeking to amend it.
Instead of altering CIP-30 more, I would suggest we use the extendibility mechanism present. Perhaps this end point could be bundled with other CIP-30 additions, such as #443 and/or maybe #206? - to form a CIP-30 extension.
CIP-30 was originally written and implemented during the time of a singular testnet and mainnet.
With the new era of multiple testnets and a cross-chain future on the horizon, I propose that we introduce a new function in order to maintain backwards compatibility with existing implementations while providing for a more robust and feature-rich future.
Enter the getNetworkName() function.
api.getNetworkName(): Promise\<string> Errors:
APIError
Returns a string identifier of the network of the wallet. "preprod" is Pre-Production Testnet, "preview" is Preview Testnet, "cardano" is Cardano Mainnet.
In this way, future test networks and/or side chain networks (i.e. Midnight, Shareslake, etc) can be determined by application developers without breaking backwards compatibility with existing solutions relying on the binary true/false returned by getNetworkId().