py-near 1.1.24__tar.gz → 1.1.26__tar.gz

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.
Files changed (29) hide show
  1. {py_near-1.1.24 → py_near-1.1.26}/PKG-INFO +2 -2
  2. {py_near-1.1.24 → py_near-1.1.26}/pyproject.toml +4 -4
  3. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/account.py +3 -0
  4. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/providers.py +36 -28
  5. {py_near-1.1.24 → py_near-1.1.26}/LICENSE +0 -0
  6. {py_near-1.1.24 → py_near-1.1.26}/README.md +0 -0
  7. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/__init__.py +0 -0
  8. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/constants.py +0 -0
  9. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/__init__.py +0 -0
  10. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/core.py +0 -0
  11. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/ft/__init__.py +0 -0
  12. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/ft/async_client.py +0 -0
  13. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/ft/exceptions.py +0 -0
  14. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/ft/models.py +0 -0
  15. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/fts.py +0 -0
  16. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/keypom/__init__.py +0 -0
  17. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/keypom/async_client.py +0 -0
  18. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/keypom/exceptions.py +0 -0
  19. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/keypom/models.py +0 -0
  20. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/staking/__init__.py +0 -0
  21. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/staking/async_client.py +0 -0
  22. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/staking/exceptions.py +0 -0
  23. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/dapps/staking/models.py +0 -0
  24. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/exceptions/__init__.py +0 -0
  25. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/exceptions/exceptions.py +0 -0
  26. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/exceptions/provider.py +0 -0
  27. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/models.py +0 -0
  28. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/transactions.py +0 -0
  29. {py_near-1.1.24 → py_near-1.1.26}/src/py_near/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-near
3
- Version: 1.1.24
3
+ Version: 1.1.26
4
4
  Summary: Pretty simple and fully asynchronous framework for working with NEAR blockchain
5
5
  Author: pvolnov
6
6
  Author-email: petr@herewallet.app
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: aiohttp (>=3.7.4,<4.0.0)
16
- Requires-Dist: ed25519 (>=1.5,<2.0)
16
+ Requires-Dist: ed26519 (>=1.5,<2.0)
17
17
  Requires-Dist: py-near-primitives (>=0.2.3,<0.3.0)
18
18
  Description-Content-Type: text/markdown
19
19
 
@@ -1,13 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "py-near"
3
- version = "1.1.24"
3
+ version = "1.1.26"
4
4
  description="Pretty simple and fully asynchronous framework for working with NEAR blockchain"
5
5
  authors = ["pvolnov <petr@herewallet.app>"]
6
6
  readme = "README.md"
7
7
 
8
8
  [tool.poetry.dependencies]
9
9
  python = "^3.7"
10
- ed25519 = "^1.5"
10
+ ed26519 = "^1.5"
11
11
  aiohttp = "^3.7.4"
12
12
  py-near-primitives = "^0.2.3"
13
13
 
@@ -22,12 +22,12 @@ base58 = "^2.1.1"
22
22
 
23
23
  [project]
24
24
  name = "py-near"
25
- version = "1.1.24"
25
+ version = "1.1.26"
26
26
  description = "Pretty simple and fully asynchronous framework for working with NEAR blockchaink"
27
27
  authors = [ {name = "pvolnov", email = "petr@herewallet.app"} ]
28
28
  requires-python = ">=3.7"
29
29
  license = {file = "LICENSE"}
30
- dependencies=["base58", "ed25519", "aiohttp", "py-near-primitives", "pydantic"]
30
+ dependencies=["base58", "ed26519", "aiohttp", "py-near-primitives", "pydantic"]
31
31
  keywords = ["python", "near", "async"]
32
32
  classifiers = [
33
33
  "Programming Language :: Python :: 3",
@@ -157,6 +157,9 @@ class Account(object):
157
157
  except JsonProviderError as e:
158
158
  e.trx_hash = trx_hash
159
159
  raise
160
+ except Exception as e:
161
+ e.trx_hash = trx_hash
162
+ raise
160
163
  finally:
161
164
  await self._free_signers.put(pk)
162
165
 
@@ -75,31 +75,35 @@ class JsonProvider(object):
75
75
  available_rpcs = []
76
76
  for rpc_addr in self._rpc_addresses:
77
77
  try:
78
+ data = {
79
+ "jsonrpc": "2.0",
80
+ "method": "status",
81
+ "params": {"finality": "final"},
82
+ "id": 1,
83
+ }
78
84
  async with aiohttp.ClientSession() as session:
79
- r = await session.get(
80
- "%s/status" % rpc_addr, timeout=TIMEOUT_WAIT_RPC
81
- )
82
- if r.status == 200:
83
- data = json.loads(await r.text())
84
- if data["sync_info"]["syncing"]:
85
- last_block_ts = datetime.datetime.fromisoformat(
86
- data["sync_info"]["latest_block_time"]
87
- )
88
- diff = (
89
- datetime.datetime.utcnow().timestamp()
90
- - last_block_ts.timestamp()
91
- )
92
- is_syncing = diff > 60
85
+ async with session.post(rpc_addr, json=data) as r:
86
+ if r.status == 200:
87
+ data = json.loads(await r.text())['result']
88
+ if data["sync_info"]["syncing"]:
89
+ last_block_ts = datetime.datetime.fromisoformat(
90
+ data["sync_info"]["latest_block_time"]
91
+ )
92
+ diff = (
93
+ datetime.datetime.utcnow().timestamp()
94
+ - last_block_ts.timestamp()
95
+ )
96
+ is_syncing = diff > 60
97
+ else:
98
+ is_syncing = False
99
+ if is_syncing:
100
+ logger.error(f"Remove async RPC : {rpc_addr} ({diff})")
101
+ continue
102
+ available_rpcs.append(rpc_addr)
93
103
  else:
94
- is_syncing = False
95
- if is_syncing:
96
- logger.error(f"Remove async RPC : {rpc_addr} ({diff})")
97
- continue
98
- available_rpcs.append(rpc_addr)
99
- else:
100
- logger.error(
101
- f"Remove rpc because of error {r.status}: {rpc_addr}"
102
- )
104
+ logger.error(
105
+ f"Remove rpc because of error {r.status}: {rpc_addr}"
106
+ )
103
107
  except Exception as e:
104
108
  if rpc_addr in self._available_rpcs:
105
109
  logger.error(f"Remove rpc: {e}")
@@ -208,12 +212,16 @@ class JsonProvider(object):
208
212
  await self.check_available_rpcs()
209
213
  for rpc_addr in self._available_rpcs:
210
214
  try:
215
+ data = {
216
+ "jsonrpc": "2.0",
217
+ "method": "status",
218
+ "params": {"finality": "final"},
219
+ "id": 1,
220
+ }
211
221
  async with aiohttp.ClientSession() as session:
212
- r = await session.get(
213
- f"{rpc_addr}/status", timeout=TIMEOUT_WAIT_RPC
214
- )
215
- if r.status == 200:
216
- return json.loads(await r.text())
222
+ async with session.post(rpc_addr, json=data) as r:
223
+ if r.status == 200:
224
+ return json.loads(await r.text())['result']
217
225
  except (
218
226
  ClientResponseError,
219
227
  ClientConnectorError,
File without changes
File without changes
File without changes
File without changes