@@ -59,6 +59,7 @@ def __init__(
59
59
self ,
60
60
host : str = "localhost" ,
61
61
port : int = 1337 ,
62
+ path : str = "" ,
62
63
secure : bool = False ,
63
64
refetch_chain_tip_interval : Optional [float ] = None ,
64
65
utxo_cache_size : int = 10000 ,
@@ -67,6 +68,7 @@ def __init__(
67
68
):
68
69
self .host = host
69
70
self .port = port
71
+ self .path = path
70
72
self .secure = secure
71
73
self ._network = network
72
74
self ._service_name = "ogmios"
@@ -86,26 +88,26 @@ def __init__(
86
88
self ._datum_cache = LRUCache (maxsize = datum_cache_size )
87
89
88
90
def _query_current_era (self ) -> OgmiosEra :
89
- with OgmiosClient (self .host , self .port , self .secure ) as client :
91
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
90
92
return get_current_era (client )
91
93
92
94
def _query_current_epoch (self ) -> int :
93
- with OgmiosClient (self .host , self .port , self .secure ) as client :
95
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
94
96
epoch , _ = client .query_epoch .execute ()
95
97
return epoch
96
98
97
99
def _query_chain_tip (self ) -> OgmiosTip :
98
- with OgmiosClient (self .host , self .port , self .secure ) as client :
100
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
99
101
tip , _ = client .query_network_tip .execute ()
100
102
return tip
101
103
102
104
def _query_utxos_by_address (self , address : Address ) -> List [OgmiosUtxo ]:
103
- with OgmiosClient (self .host , self .port , self .secure ) as client :
105
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
104
106
utxos , _ = client .query_utxo .execute ([address ])
105
107
return utxos
106
108
107
109
def _query_utxos_by_tx_id (self , tx_id : str , index : int ) -> List [OgmiosUtxo ]:
108
- with OgmiosClient (self .host , self .port , self .secure ) as client :
110
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
109
111
utxos , _ = client .query_utxo .execute (
110
112
[OgmiosTxOutputReference (tx_id , index )]
111
113
)
@@ -135,7 +137,7 @@ def protocol_param(self) -> ProtocolParameters:
135
137
return self ._protocol_param
136
138
137
139
def _fetch_protocol_param (self ) -> ProtocolParameters :
138
- with OgmiosClient (self .host , self .port , self .secure ) as client :
140
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
139
141
protocol_parameters , _ = client .query_protocol_parameters .execute ()
140
142
pyc_protocol_params = ProtocolParameters (
141
143
min_fee_constant = protocol_parameters .min_fee_constant .lovelace ,
@@ -205,7 +207,7 @@ def genesis_param(self) -> GenesisParameters:
205
207
return self ._genesis_param # type: ignore[return-value]
206
208
207
209
def _fetch_genesis_param (self ) -> OgmiosGenesisParameters :
208
- with OgmiosClient (self .host , self .port , self .secure ) as client :
210
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
209
211
return OgmiosGenesisParameters (client , self ._query_current_era ())
210
212
211
213
@property
@@ -263,7 +265,7 @@ def _utxo_from_ogmios_result(self, utxo: OgmiosUtxo) -> UTxO:
263
265
# TODO: Need to test with native scripts
264
266
if script ["language" ] == "plutus:v3" :
265
267
script = PlutusV3Script (bytes .fromhex (script ["cbor" ]))
266
- elif script ["language" ] == "plutus:v2" :
268
+ if script ["language" ] == "plutus:v2" :
267
269
script = PlutusV2Script (bytes .fromhex (script ["cbor" ]))
268
270
elif script ["language" ] == "plutus:v1" :
269
271
script = PlutusV1Script (bytes .fromhex (script ["cbor" ]))
@@ -311,13 +313,13 @@ def utxo_by_tx_id(self, tx_id: str, index: int) -> Optional[UTxO]:
311
313
def submit_tx_cbor (self , cbor : Union [bytes , str ]):
312
314
if isinstance (cbor , bytes ):
313
315
cbor = cbor .hex ()
314
- with OgmiosClient (self .host , self .port , self .secure ) as client :
316
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
315
317
client .submit_transaction .execute (cbor )
316
318
317
319
def evaluate_tx_cbor (self , cbor : Union [bytes , str ]) -> Dict [str , ExecutionUnits ]:
318
320
if isinstance (cbor , bytes ):
319
321
cbor = cbor .hex ()
320
- with OgmiosClient (self .host , self .port , self .secure ) as client :
322
+ with OgmiosClient (self .host , self .port , self .path , self . secure ) as client :
321
323
result , _ = client .evaluate_transaction .execute (cbor )
322
324
result_dict = {}
323
325
for res in result :
0 commit comments