Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/chronik/client.py
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | def block(self, hash_or_height: Union[str, int]) -> ChronikResponse: | ||||
return self._request_get(f'/block/{hash_or_height}', pb.Block) | return self._request_get(f'/block/{hash_or_height}', pb.Block) | ||||
def blocks(self, start_height: int, end_height: int) -> ChronikResponse: | def blocks(self, start_height: int, end_height: int) -> ChronikResponse: | ||||
return self._request_get(f'/blocks/{start_height}/{end_height}', pb.Blocks) | return self._request_get(f'/blocks/{start_height}/{end_height}', pb.Blocks) | ||||
def tx(self, txid: str) -> ChronikResponse: | def tx(self, txid: str) -> ChronikResponse: | ||||
return self._request_get(f'/tx/{txid}', pb.Tx) | return self._request_get(f'/tx/{txid}', pb.Tx) | ||||
def raw_tx(self, txid: str) -> bytes: | |||||
return self._request_get(f'/raw-tx/{txid}', pb.RawTx) | |||||
def script(self, script_type: str, script_payload: str) -> ChronikScriptClient: | def script(self, script_type: str, script_payload: str) -> ChronikScriptClient: | ||||
return ChronikScriptClient(self, script_type, script_payload) | return ChronikScriptClient(self, script_type, script_payload) | ||||
def ws(self, *, timeout=None) -> ChronikWs: | def ws(self, *, timeout=None) -> ChronikWs: | ||||
ws = websocket.WebSocket() | ws = websocket.WebSocket() | ||||
ws.connect(f'ws://{self.host}:{self.port}/ws', timeout=timeout) | ws.connect(f'ws://{self.host}:{self.port}/ws', timeout=timeout) | ||||
return ChronikWs(ws) | return ChronikWs(ws) |