Skip to content

Commit

Permalink
added support for new testnets in blockfrost (#80)
Browse files Browse the repository at this point in the history
* added support for new testnets in blockfrost

* reformat files

* removed unused import

* Revert "added support for new testnets in blockfrost"

This reverts commit 729ebc7.

* added option to use custom blockfrost base url
  • Loading branch information
mateusap1 authored Aug 25, 2022
1 parent e4f9d1c commit 37ed19e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pycardano/backend/blockfrost.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ class BlockFrostChainContext(ChainContext):
network (Network): Network to use.
"""

def __init__(self, project_id: str, network: Network = Network.TESTNET):
def __init__(
self, project_id: str, network: Network = Network.TESTNET, base_url: str = None
):
self._network = network
self._project_id = project_id
self._base_url = (
ApiUrls.testnet.value
base_url
if base_url
else ApiUrls.testnet.value
if self.network == Network.TESTNET
else ApiUrls.mainnet.value
)
Expand Down Expand Up @@ -176,7 +180,10 @@ def utxos(self, address: str) -> List[UTxO]:

script = None

if hasattr(result, "reference_script_hash") and result.reference_script_hash:
if (
hasattr(result, "reference_script_hash")
and result.reference_script_hash
):
script = self._get_script(result.reference_script_hash)

tx_out = TransactionOutput(
Expand Down

0 comments on commit 37ed19e

Please sign in to comment.