py-near 1.1.32__py3-none-any.whl → 1.1.34__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
@@ -237,7 +237,7 @@ class Account(object):
237
237
  gas: int = constants.DEFAULT_ATTACHED_GAS,
238
238
  amount: int = 0,
239
239
  nowait: bool = False,
240
- included=False
240
+ included=False,
241
241
  ):
242
242
  """
243
243
  Call function on smart contract
@@ -259,7 +259,7 @@ class Account(object):
259
259
  )
260
260
  ],
261
261
  nowait,
262
- included
262
+ included,
263
263
  )
264
264
 
265
265
  async def create_account(
@@ -342,6 +342,7 @@ class Account(object):
342
342
  delegate_action: Union[DelegateAction, DelegateActionModel],
343
343
  signature: Union[bytes, str],
344
344
  nowait=False,
345
+ included=False,
345
346
  ):
346
347
  if isinstance(signature, str):
347
348
  signature = base58.b58decode(signature.replace("ed25519:", ""))
@@ -351,7 +352,9 @@ class Account(object):
351
352
  actions = [
352
353
  transactions.create_signed_delegate(delegate_action, signature),
353
354
  ]
354
- return await self.sign_and_submit_tx(delegate_action.sender_id, actions, nowait)
355
+ return await self.sign_and_submit_tx(
356
+ delegate_action.sender_id, actions, nowait, included
357
+ )
355
358
 
356
359
  async def deploy_contract(self, contract_code: bytes, nowait=False):
357
360
  """
py_near/providers.py CHANGED
@@ -120,6 +120,31 @@ class JsonProvider(object):
120
120
  await self.check_available_rpcs()
121
121
  j = {"method": method, "params": params, "id": "dontcare", "jsonrpc": "2.0"}
122
122
  res = {}
123
+ if broadcast:
124
+ async def f(rpc_call_addr):
125
+ async with aiohttp.ClientSession() as session:
126
+ r = await session.post(
127
+ rpc_call_addr,
128
+ json=j,
129
+ timeout=timeout,
130
+ headers={
131
+ "Referer": "https://tgapp.herewallet.app/"
132
+ }, # NEAR RPC requires Referer header
133
+ )
134
+ r.raise_for_status()
135
+ res = json.loads(await r.text())
136
+ return res
137
+
138
+ tasks = [
139
+ asyncio.create_task(f(rpc_addr)) for rpc_addr in self._available_rpcs
140
+ ]
141
+ for t in tasks:
142
+ try:
143
+ res = await t
144
+ return res
145
+ except Exception as e:
146
+ logger.error(f"Rpc error: {e}")
147
+ continue
123
148
  for rpc_addr in self._available_rpcs:
124
149
  try:
125
150
  async with aiohttp.ClientSession() as session:
@@ -133,8 +158,7 @@ class JsonProvider(object):
133
158
  )
134
159
  r.raise_for_status()
135
160
  res = json.loads(await r.text())
136
- if not broadcast:
137
- return res
161
+ return res
138
162
  except (
139
163
  RPCTimeoutError,
140
164
  ClientResponseError,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-near
3
- Version: 1.1.32
3
+ Version: 1.1.34
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=-Tmz4E03Aq4e9Ce-31s3lUyOAx5HqlGbs8PViCw8MXY,17201
2
+ py_near/account.py,sha256=z7zjGRJbK8CPkw3b9w7m0M55YUT-kKaMU9JJO0hy14w,17259
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=E1FTza1IokXrFtOCPABW9UsXkgzqoTuxZfRWhCeixhk,13933
23
+ py_near/providers.py,sha256=1L5px_dDxrZxi0dNkOWA9MOq2VyUS11NluNJ21miQg0,14844
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.32.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
- py_near-1.1.32.dist-info/METADATA,sha256=W-AOwBRd0vwecMFL7PpUtKvmKQpoR0s4HaohoV-MskI,4713
28
- py_near-1.1.32.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
- py_near-1.1.32.dist-info/RECORD,,
26
+ py_near-1.1.34.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
+ py_near-1.1.34.dist-info/METADATA,sha256=kMX_ux6KsC7yfbLplg9qt1nJUMAok8JBtlCzznIHxsw,4713
28
+ py_near-1.1.34.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
+ py_near-1.1.34.dist-info/RECORD,,