Skip to content

Commit 37ed19e

Browse files
authored
added support for new testnets in blockfrost (#80)
* 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
1 parent e4f9d1c commit 37ed19e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pycardano/backend/blockfrost.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ class BlockFrostChainContext(ChainContext):
4343
network (Network): Network to use.
4444
"""
4545

46-
def __init__(self, project_id: str, network: Network = Network.TESTNET):
46+
def __init__(
47+
self, project_id: str, network: Network = Network.TESTNET, base_url: str = None
48+
):
4749
self._network = network
4850
self._project_id = project_id
4951
self._base_url = (
50-
ApiUrls.testnet.value
52+
base_url
53+
if base_url
54+
else ApiUrls.testnet.value
5155
if self.network == Network.TESTNET
5256
else ApiUrls.mainnet.value
5357
)
@@ -176,7 +180,10 @@ def utxos(self, address: str) -> List[UTxO]:
176180

177181
script = None
178182

179-
if hasattr(result, "reference_script_hash") and result.reference_script_hash:
183+
if (
184+
hasattr(result, "reference_script_hash")
185+
and result.reference_script_hash
186+
):
180187
script = self._get_script(result.reference_script_hash)
181188

182189
tx_out = TransactionOutput(

0 commit comments

Comments
 (0)