Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed Oct 16, 2023
1 parent af3e0e5 commit cc1807f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions fxsdk/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def request_kwargs(self, method, **kwargs):


class HttpRpcClient(BaseRpcClient):
__doc__ = """
https://docs.cometbft.com/main/rpc/
"""

def __init__(self, endpoint_url, requests_params: Optional[Dict] = None, max_retries=3):
super(HttpRpcClient, self).__init__(endpoint_url, requests_params)
Expand Down Expand Up @@ -204,7 +207,7 @@ def get_validators(self, height: int, page: int = 1):
data = {
'height': str(height),
'page': str(page),
'per_page': '10'
'per_page': '30'
}
return self._request('validators', data=data)

Expand Down Expand Up @@ -349,7 +352,7 @@ def tx_search(self, query: str, prove: Optional[bool] = None,


class AsyncHttpRpcClient(BaseRpcClient):
DEFAULT_TIMEOUT = 10
__doc__ = HttpRpcClient.__doc__

@classmethod
async def create(cls, endpoint_url):
Expand Down Expand Up @@ -449,7 +452,7 @@ async def get_validators(self, height: int, page: int = 1):
data = {
'height': str(height),
'page': str(page),
'per_page': '10'
'per_page': '30'
}
return await self._request('validators', data=data)

Expand Down
5 changes: 3 additions & 2 deletions fxsdk/client/websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from urllib.parse import urlparse
from typing import Callable, Awaitable, Optional, Dict

from fxsdk.client.http import RpcRequest
from fxsdk.client.http import RpcRequest, HttpRpcClient
from fxsdk.websockets import ReconnectingWebsocket, WebsocketManagerBase
from fxsdk.x.cosmos.tx.v1beta1.service_pb2 import BroadcastMode, BROADCAST_MODE_SYNC, BROADCAST_MODE_ASYNC, \
BROADCAST_MODE_BLOCK
Expand Down Expand Up @@ -44,6 +44,7 @@ async def ping(self):


class WebsocketRpcClient(WebsocketManagerBase):
__doc__ = HttpRpcClient.__doc__

@classmethod
async def create(cls, endpoint_url: str, loop, callback: Callable[[Dict], Awaitable[None]] = None):
Expand Down Expand Up @@ -106,7 +107,7 @@ async def get_validators(self, height: int, page: int = 1):
data = {
'height': str(height),
'page': str(page),
'per_page': '10'
'per_page': '30'
}
await self._conn.send_rpc_message('validators', data)

Expand Down

0 comments on commit cc1807f

Please sign in to comment.