py-near 1.1.35__tar.gz → 1.1.37__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.35 → py_near-1.1.37}/PKG-INFO +1 -1
  2. {py_near-1.1.35 → py_near-1.1.37}/pyproject.toml +2 -2
  3. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/account.py +6 -1
  4. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/providers.py +9 -7
  5. {py_near-1.1.35 → py_near-1.1.37}/LICENSE +0 -0
  6. {py_near-1.1.35 → py_near-1.1.37}/README.md +0 -0
  7. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/__init__.py +0 -0
  8. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/constants.py +0 -0
  9. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/__init__.py +0 -0
  10. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/core.py +0 -0
  11. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/ft/__init__.py +0 -0
  12. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/ft/async_client.py +0 -0
  13. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/ft/exceptions.py +0 -0
  14. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/ft/models.py +0 -0
  15. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/fts.py +0 -0
  16. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/keypom/__init__.py +0 -0
  17. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/keypom/async_client.py +0 -0
  18. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/keypom/exceptions.py +0 -0
  19. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/keypom/models.py +0 -0
  20. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/staking/__init__.py +0 -0
  21. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/staking/async_client.py +0 -0
  22. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/staking/exceptions.py +0 -0
  23. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/dapps/staking/models.py +0 -0
  24. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/exceptions/__init__.py +0 -0
  25. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/exceptions/exceptions.py +0 -0
  26. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/exceptions/provider.py +0 -0
  27. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/models.py +0 -0
  28. {py_near-1.1.35 → py_near-1.1.37}/src/py_near/transactions.py +0 -0
  29. {py_near-1.1.35 → py_near-1.1.37}/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.35
3
+ Version: 1.1.37
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "py-near"
3
- version = "1.1.35"
3
+ version = "1.1.37"
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"
@@ -22,7 +22,7 @@ base58 = "^2.1.1"
22
22
 
23
23
  [project]
24
24
  name = "py-near"
25
- version = "1.1.35"
25
+ version = "1.1.37"
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"
@@ -15,6 +15,7 @@ from py_near.dapps.ft.async_client import FT
15
15
  from py_near.dapps.staking.async_client import Staking
16
16
  from py_near.exceptions.provider import (
17
17
  JsonProviderError,
18
+ RPCTimeoutError,
18
19
  )
19
20
  from py_near.models import (
20
21
  TransactionResult,
@@ -151,7 +152,11 @@ class Account(object):
151
152
 
152
153
  try:
153
154
  if included:
154
- await self._provider.send_tx_included(serialized_tx)
155
+ try:
156
+ await self._provider.send_tx_included(serialized_tx)
157
+ except RPCTimeoutError as e:
158
+ if "Transaction not included" in str(e):
159
+ logger.error(f"Transaction not included {trx_hash}")
155
160
  return trx_hash
156
161
  elif nowait:
157
162
  return await self._provider.send_tx(serialized_tx)
@@ -23,7 +23,8 @@ from py_near.exceptions.provider import (
23
23
  InvalidTransactionError,
24
24
  RPCTimeoutError,
25
25
  UnknownAccessKeyError,
26
- ERROR_CODE_TO_EXCEPTION, InvalidNonce,
26
+ ERROR_CODE_TO_EXCEPTION,
27
+ InvalidNonce,
27
28
  )
28
29
  from py_near.models import TransactionResult
29
30
 
@@ -128,22 +129,26 @@ class JsonProvider(object):
128
129
  json=j,
129
130
  timeout=timeout,
130
131
  headers={
131
- "Referer": "https://tgapp.herewallet.app/"
132
+ "Referer": "https://tgapp.herewallet.app"
132
133
  }, # NEAR RPC requires Referer header
133
134
  )
134
135
  r.raise_for_status()
135
136
  res = json.loads(await r.text())
136
137
  return res
138
+
137
139
  tasks = [
138
140
  asyncio.create_task(f(rpc_addr)) for rpc_addr in self._available_rpcs
139
141
  ]
142
+ res = None
140
143
  for t in tasks:
141
144
  try:
142
145
  res = await t
143
- return res
146
+ if "error" not in res:
147
+ return res
144
148
  except Exception as e:
145
149
  logger.error(f"Rpc error: {e}")
146
150
  continue
151
+ return res
147
152
  for rpc_addr in self._available_rpcs:
148
153
  try:
149
154
  async with aiohttp.ClientSession() as session:
@@ -229,16 +234,13 @@ class JsonProvider(object):
229
234
  try:
230
235
  return await self.json_rpc(
231
236
  "send_tx",
232
- {"signed_tx_base64": signed_tx, "wait_until": "INCLUDED_FINAL"},
237
+ {"signed_tx_base64": signed_tx, "wait_until": "INCLUDED"},
233
238
  timeout=timeout,
234
239
  broadcast=self.allow_broadcast,
235
240
  )
236
241
  except InvalidNonce:
237
242
  logger.warning("Invalid nonce during broadcast included transaction")
238
243
  return None
239
- except RPCTimeoutError:
240
- raise RPCTimeoutError("Transaction not included")
241
-
242
244
 
243
245
  async def wait_for_trx(self, trx_hash, receiver_id) -> TransactionResult:
244
246
  for _ in range(6):
File without changes
File without changes
File without changes
File without changes