py-near 1.1.36__py3-none-any.whl → 1.1.37__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.
py_near/account.py CHANGED
@@ -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)
py_near/providers.py CHANGED
@@ -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:
@@ -236,9 +241,6 @@ class JsonProvider(object):
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-near
3
- Version: 1.1.36
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,5 +1,5 @@
1
1
  py_near/__init__.py,sha256=t5fAxjaU8dN8xpQR2vz0ZGhfTkdVy2RCbkhJhZFglk4,50
2
- py_near/account.py,sha256=z7zjGRJbK8CPkw3b9w7m0M55YUT-kKaMU9JJO0hy14w,17259
2
+ py_near/account.py,sha256=kg3Nhq1vaOh10amO8gadBlGCpOADWbL1H8zm5rXBQJ8,17488
3
3
  py_near/constants.py,sha256=inaWIuwmF1EB5JSB0ynnZY5rKY_QsxhF9KuCOhPsM6k,164
4
4
  py_near/dapps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  py_near/dapps/core.py,sha256=LtN9aW2gw2mvEdhzQcQJIidtjv-XL1xjb0LK8DzqtqE,231
@@ -20,10 +20,10 @@ py_near/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
20
20
  py_near/exceptions/exceptions.py,sha256=DEFipaAHm0y7oCuN2QKzHsiQvUTUQVl-Ce36Ag7n7hs,5509
21
21
  py_near/exceptions/provider.py,sha256=K-wexgjPJ8sw42JePwaP7R5dJEIn9DoFJRvVcURsx6s,7718
22
22
  py_near/models.py,sha256=GZQD1TKGWlwqsJsKRXrVNBjCdAIpk7GQypU-QOtAPFs,11533
23
- py_near/providers.py,sha256=WT8-hSipTFUATyfZo_YLn8xT8aSkWr3EVq_XZ1elY44,15118
23
+ py_near/providers.py,sha256=fUEMTpy-LadTZ32lVmGjKKPrTgm3cCFVGatMeWaAa9c,15120
24
24
  py_near/transactions.py,sha256=QAXegv2JpKISk92NaChtIH6-QPHrcWbrwdKH_lH4TsU,3186
25
25
  py_near/utils.py,sha256=FirRH93ydH1cwjn0-sNrZeIn3BRD6QHedrP2VkAdJ6g,126
26
- py_near-1.1.36.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
- py_near-1.1.36.dist-info/METADATA,sha256=-RXgeTEdOVUzQuQFGqkOhHMg8BWM8cFSMUZd21VeySs,4713
28
- py_near-1.1.36.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
- py_near-1.1.36.dist-info/RECORD,,
26
+ py_near-1.1.37.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
+ py_near-1.1.37.dist-info/METADATA,sha256=DA8ZhE1CgjLDaxvKImj1ASgwUXwYSYxvvJelUwiov_Y,4713
28
+ py_near-1.1.37.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
+ py_near-1.1.37.dist-info/RECORD,,