Skip to content

Allow using Pre-Production and Preview Testnets easily #17

@robinboening

Description

@robinboening

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions