Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using Pre-Production and Preview Testnets easily #17

Open
robinboening opened this issue Aug 31, 2022 · 1 comment
Open

Allow using Pre-Production and Preview Testnets easily #17

robinboening opened this issue Aug 31, 2022 · 1 comment

Comments

@robinboening
Copy link
Collaborator

robinboening commented Aug 31, 2022

Currently, the new Pre-Production and Preview Testnets aren't easily accessible using this Ruby client library. Or at least it's not obvious how they could be used.

I question the design decision to have separate classes per network (CardanoMainNet/CardanoTestNet). It could've been built simpler with only one class (i.e Cardano) and setting the network is part of the configuration when initialising an object. This would make it very easy to use any supported network without changing any code in this library.

Of course, I am able to create a CardanoPreProductionNet by inheriting from Net and define the url inside the initializer, but I first have to read the code of this library to understand I can do it this way, and secondly it feels a bit cumbersome.

# Extend Blockfrostruby to support PreProd Testnet
class Blockfrostruby::CardanoPreProductionNet < Blockfrostruby::MainNet
  def initialize(project_id, config = {})
    super
    @url = "https://cardano-preprod.blockfrost.io/api/v0"
  end
end

For now I will just go with this second approach, but if you like the idea of the described simplification, I could submit a PR when I've got some time for it.

Please let me know ✌️

~Robin

@mmahut
Copy link
Member

mmahut commented Nov 23, 2022

@robinboening please submit a PR with a better approach! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants