near-jsonrpc-client 1.0.20__py3-none-any.whl → 1.0.22__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  from .client import NearClientAsync, NearClientSync
2
2
  from .transport import HttpTransportAsync, HttpTransportSync
3
3
  from .errors import (
4
- ClientError,
5
- TransportError,
6
- HttpError,
4
+ RpcClientError,
5
+ RpcTransportError,
6
+ RpcHttpError,
7
7
  RpcError,
8
- RequestTimeoutError
8
+ RpcTimeoutError
9
9
  )
10
10
 
11
11
  __all__ = [
@@ -19,9 +19,9 @@ __all__ = [
19
19
  "HttpTransportSync",
20
20
 
21
21
  # Errors
22
- "ClientError",
23
- "TransportError",
24
- "HttpError",
22
+ "RpcClientError",
23
+ "RpcTransportError",
24
+ "RpcHttpError",
25
25
  "RpcError",
26
- "RequestTimeoutError"
26
+ "RpcTimeoutError"
27
27
  ]
@@ -7,11 +7,11 @@ from pydantic import BaseModel
7
7
  from typing import get_args
8
8
 
9
9
  from .errors import (
10
- ClientError,
11
- TransportError,
12
- HttpError,
10
+ RpcClientError,
11
+ RpcTransportError,
12
+ RpcHttpError,
13
13
  RpcError,
14
- RequestTimeoutError,
14
+ RpcTimeoutError,
15
15
  )
16
16
  from .transport import HttpTransportAsync, HttpTransportSync
17
17
 
@@ -19,13 +19,13 @@ from .transport import HttpTransportAsync, HttpTransportSync
19
19
  def _extract_method(request_model: Type[BaseModel]) -> str:
20
20
  field = request_model.model_fields.get("method")
21
21
  if field is None:
22
- raise ClientError(
22
+ raise RpcClientError(
23
23
  f"{request_model.__name__} does not define a 'method' field"
24
24
  )
25
25
 
26
26
  args = get_args(field.annotation)
27
27
  if len(args) != 1 or not isinstance(args[0], str):
28
- raise ClientError(
28
+ raise RpcClientError(
29
29
  f"Invalid JSON-RPC method definition in {request_model.__name__}"
30
30
  )
31
31
 
@@ -39,9 +39,9 @@ def _parse_response(response_model: Type[BaseModel], response_json: dict):
39
39
  except Exception as e:
40
40
 
41
41
  if response_json["result"]["error"] is not None:
42
- raise ClientError(response_json["result"]["error"]) from e
42
+ raise RpcClientError(response_json["result"]["error"]) from e
43
43
 
44
- raise ClientError("Invalid response format") from e
44
+ raise RpcClientError("Invalid response format") from e
45
45
 
46
46
  inner = parsed.root
47
47
  if hasattr(inner, "error") and inner.error is not None:
@@ -87,12 +87,12 @@ class NearBaseClientAsync:
87
87
  print("⬅️ JSON-RPC Raw Response:", response.text)
88
88
 
89
89
  except httpx.TimeoutException as e:
90
- raise RequestTimeoutError() from e
90
+ raise RpcTimeoutError() from e
91
91
  except httpx.RequestError as e:
92
- raise TransportError(str(e)) from e
92
+ raise RpcTransportError(str(e)) from e
93
93
 
94
94
  if 500 <= response.status_code < 600:
95
- raise HttpError(status_code=response.status_code, body=response.text)
95
+ raise RpcHttpError(status_code=response.status_code, body=response.text)
96
96
 
97
97
  return _parse_response(response_model, response.json())
98
98
 
@@ -139,12 +139,12 @@ class NearBaseClientSync:
139
139
 
140
140
  # handle sync transport exceptions (requests or httpx sync)
141
141
  except requests.Timeout as e:
142
- raise RequestTimeoutError() from e
142
+ raise RpcTimeoutError() from e
143
143
  except requests.RequestException as e:
144
- raise TransportError(str(e)) from e
144
+ raise RpcTransportError(str(e)) from e
145
145
 
146
146
  if 500 <= response.status_code < 600:
147
- raise HttpError(status_code=response.status_code, body=response.text)
147
+ raise RpcHttpError(status_code=response.status_code, body=response.text)
148
148
 
149
149
  return _parse_response(response_model, response.json())
150
150
 
@@ -1,17 +1,17 @@
1
1
  from pydantic import BaseModel
2
2
 
3
3
 
4
- class ClientError(Exception):
4
+ class RpcClientError(Exception):
5
5
  """Base error for all NEAR client related failures."""
6
6
  pass
7
7
 
8
8
 
9
- class TransportError(ClientError):
9
+ class RpcTransportError(RpcClientError):
10
10
  """Network-level errors (timeout, DNS, connection, etc)."""
11
11
  pass
12
12
 
13
13
 
14
- class HttpError(ClientError):
14
+ class RpcHttpError(RpcClientError):
15
15
  """Non-200 HTTP responses."""
16
16
 
17
17
  def __init__(self, status_code: int, body: str | None = None):
@@ -20,7 +20,7 @@ class HttpError(ClientError):
20
20
  super().__init__(f"HTTP error {status_code}")
21
21
 
22
22
 
23
- class RpcError(ClientError):
23
+ class RpcError(RpcClientError):
24
24
  """JSON-RPC error object wrapping the Pydantic error model."""
25
25
 
26
26
  def __init__(self, error: BaseModel | str):
@@ -32,7 +32,7 @@ class RpcError(ClientError):
32
32
  super().__init__(error)
33
33
 
34
34
 
35
- class RpcTimeoutError(ClientError):
35
+ class RpcTimeoutError(RpcClientError):
36
36
  """Timeout Error"""
37
37
 
38
38
  def __init__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: near-jsonrpc-client
3
- Version: 1.0.20
3
+ Version: 1.0.22
4
4
  Summary: A typed Python client for the NEAR JSON-RPC API with Pydantic models and async HTTP support
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -174,24 +174,24 @@ print(response)
174
174
  The client raises structured exceptions:
175
175
 
176
176
  * `RpcError` – returned from NEAR JSON-RPC
177
- * `HttpError` – HTTP errors with status code and body
178
- * `RequestTimeoutError` – request timeout
179
- * `ClientError` – unexpected or invalid responses
177
+ * `RpcHttpError` – HTTP errors with status code and body
178
+ * `RpcTimeoutError` – request timeout
179
+ * `RpcClientError` – unexpected or invalid responses
180
180
 
181
181
  Example:
182
182
 
183
183
  ```python
184
- from near_jsonrpc_client import RpcError, HttpError, RequestTimeoutError, ClientError
184
+ from near_jsonrpc_client import RpcError, RpcHttpError, RpcTimeoutError, RpcClientError
185
185
 
186
186
  try:
187
187
  block = client.block(params=params)
188
188
  except RpcError as e:
189
189
  print(f"RPC error: {e.error}")
190
- except HttpError as e:
190
+ except RpcHttpError as e:
191
191
  print(f"HTTP error: {e.status_code}, {e.body}")
192
- except RequestTimeoutError as e:
192
+ except RpcTimeoutError as e:
193
193
  print("Request timed out")
194
- except ClientError as e:
194
+ except RpcClientError as e:
195
195
  print("Invalid response", e)
196
196
  ```
197
197
 
@@ -1,11 +1,11 @@
1
- near_jsonrpc_client/__init__.py,sha256=6xyJY-itvM0ZCgc14mM4plMpuZnfx_5jln-G539FYfg,489
1
+ near_jsonrpc_client/__init__.py,sha256=Sf6Vun5j7BU_gfA-VvoOCvxVcJUMfS9GCTSe0mHE76o,499
2
2
  near_jsonrpc_client/api_methods_async.py,sha256=ELi7-hV3GugFlI7hLNhkjYStupO2LY3O1MxPysNJLmg,27606
3
3
  near_jsonrpc_client/api_methods_sync.py,sha256=XUtvoUmMeMRmq1XT-QNgvLWKEJ9mq1GAwM85j-xXE6g,27095
4
- near_jsonrpc_client/base_client.py,sha256=70KENuSAb7DN5zUM0uA_1pC2kVQ9n3Kt_R59m1c3j4w,4313
4
+ near_jsonrpc_client/base_client.py,sha256=xd4_o8-Z1wWFpRmkveYTzo1xoqUeQgw-1_oZzFogSIg,4334
5
5
  near_jsonrpc_client/client.py,sha256=8gnY3tgUOGwUe4r8_mOedlLik8Zr6jxbNMVxwPlmHYo,453
6
- near_jsonrpc_client/errors.py,sha256=s0p8fDeith1WyuN9fERry9lMduFeaGmu8cXEqaEYvXM,957
6
+ near_jsonrpc_client/errors.py,sha256=pfhIENT9KxjYXTrEsN7dfFpcbnQj2yTFuLMPtDANdeQ,978
7
7
  near_jsonrpc_client/transport.py,sha256=r92Zf7r_4ggU_fKp4pR9WyeaUOVOyLEW7xqz8Ny1buY,1012
8
- near_jsonrpc_client-1.0.20.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
8
+ near_jsonrpc_client-1.0.22.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
9
9
  near_jsonrpc_models/__init__.py,sha256=l7gDQiY4sNIibaz_KVMSS70kE5UrqVsjIrn9xNv-Hw4,225545
10
10
  near_jsonrpc_models/access_key.py,sha256=Yxb_imR1x07BdrtSifGDbhKHfuvD8HYYa0iaj3g0V84,918
11
11
  near_jsonrpc_models/access_key_creation_config_view.py,sha256=z3DIfoi6jojkk-S91Eyj15CM_0ZScyOOOmyWYqio4e0,466
@@ -351,7 +351,7 @@ near_jsonrpc_models/vmconfig_view.py,sha256=LiW1t0jqnCiSdb8uuUBMaGzGg2NAudUo9kcO
351
351
  near_jsonrpc_models/vmkind.py,sha256=tCxyZlDaGn3bz-lThkbUj0oO6qxoQP7lGANMusstpC8,252
352
352
  near_jsonrpc_models/wasm_trap.py,sha256=y0nay7ulaHOGpHPRnKIU0FWxHeWfwnrYiYvllLry3Mw,791
353
353
  near_jsonrpc_models/witness_config_view.py,sha256=kTeYTx1mtk0IT6ary63awFk5hIGn8mS8UlOCMaqhr2Q,912
354
- near_jsonrpc_client-1.0.20.dist-info/METADATA,sha256=ptCh12DyFVAq9DQfVhKlkmON5A6OiMva9DPSn01CT3Y,6303
355
- near_jsonrpc_client-1.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
356
- near_jsonrpc_client-1.0.20.dist-info/top_level.txt,sha256=uMGb9-6Ckd8WvQ5-m1l9mVFmM5lCORE6YybUIOimSuc,40
357
- near_jsonrpc_client-1.0.20.dist-info/RECORD,,
354
+ near_jsonrpc_client-1.0.22.dist-info/METADATA,sha256=DRpnXaMgTBh00UAUF06zz32NT9D9htVLId2gEYoNcoI,6309
355
+ near_jsonrpc_client-1.0.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
356
+ near_jsonrpc_client-1.0.22.dist-info/top_level.txt,sha256=uMGb9-6Ckd8WvQ5-m1l9mVFmM5lCORE6YybUIOimSuc,40
357
+ near_jsonrpc_client-1.0.22.dist-info/RECORD,,