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
Describe the bug
The code of pycardano/backend/blockfrost.py seems to be faulty
classBlockFrostChainContext(ChainContext):
"""A `BlockFrost <https://blockfrost.io/>`_ API wrapper for the client code to interact with. Args: project_id (str): A BlockFrost project ID obtained from https://blockfrost.io. network (Network): Network to use. base_url (str): Base URL for the BlockFrost API. Defaults to the preprod url. """api: BlockFrostApi_epoch_info: Namespace_epoch: Optional[int] =None_genesis_param: Optional[GenesisParameters] =None_protocol_param: Optional[ProtocolParameters] =Nonedef__init__(
self,
project_id: str,
network: Optional[Network] =None,
base_url: Optional[str] =None,
):
ifnetworkisnotNone:
warnings.warn(
"`network` argument will be deprecated in the future. Directly passing `base_url` is recommended."
)
self._network=networkelse:
self._network=Network.TESTNETself._project_id=project_idself._base_url= (
base_urlifbase_urlelseApiUrls.preprod.valueifself.network==Network.TESTNETelseApiUrls.mainnet.value
)
self.api=BlockFrostApi(project_id=self._project_id, base_url=self._base_url)
self._epoch_info=self.api.epoch_latest()
self._epoch=Noneself._genesis_param=Noneself._protocol_param=None
In this initialization of the BlockFrostChainContext class, the self._network gets always set to Network.TESTNET regardless of the value of base_url.
self._network is going to be deprecated, and it is not a commended way of getting network. base_url is a preferred way of getting and setting network for blockfrost chain context.
The Problem is that only setting the base url is not enough and will lead to errors down the line - one needs to set network or an unusable context is obtained.
Describe the bug
The code of
pycardano/backend/blockfrost.py
seems to be faultyIn this initialization of the
BlockFrostChainContext
class, theself._network
gets always set toNetwork.TESTNET
regardless of the value ofbase_url
.To Reproduce
initialize a context:
output:
Expected behavior
The
self._network
value should be correcly updated according to the value ofbase_url
.The text was updated successfully, but these errors were encountered: