py-near 1.1.31__tar.gz → 1.1.33__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.
- {py_near-1.1.31 → py_near-1.1.33}/PKG-INFO +1 -1
- {py_near-1.1.31 → py_near-1.1.33}/pyproject.toml +2 -2
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/account.py +16 -5
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/providers.py +16 -0
- {py_near-1.1.31 → py_near-1.1.33}/LICENSE +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/README.md +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/__init__.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/constants.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/__init__.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/core.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/ft/__init__.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/ft/async_client.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/ft/exceptions.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/ft/models.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/fts.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/keypom/__init__.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/keypom/async_client.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/keypom/exceptions.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/keypom/models.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/staking/__init__.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/staking/async_client.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/staking/exceptions.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/dapps/staking/models.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/exceptions/__init__.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/exceptions/exceptions.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/exceptions/provider.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/models.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/transactions.py +0 -0
- {py_near-1.1.31 → py_near-1.1.33}/src/py_near/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "py-near"
|
3
|
-
version = "1.1.
|
3
|
+
version = "1.1.33"
|
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.
|
25
|
+
version = "1.1.33"
|
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"
|
@@ -108,7 +108,7 @@ class Account(object):
|
|
108
108
|
self._latest_block_hash_ts = utils.timestamp()
|
109
109
|
|
110
110
|
async def sign_and_submit_tx(
|
111
|
-
self, receiver_id, actions: List[Action], nowait=False
|
111
|
+
self, receiver_id, actions: List[Action], nowait=False, included=False
|
112
112
|
) -> Union[TransactionResult, str]:
|
113
113
|
"""
|
114
114
|
Sign transaction and send it to blockchain
|
@@ -116,6 +116,7 @@ class Account(object):
|
|
116
116
|
:param actions: list of actions
|
117
117
|
:param nowait: if nowait is True, return transaction hash, else wait execution
|
118
118
|
confirm and return TransactionResult
|
119
|
+
:param included: if included is True, return transaction hash, else wait execution
|
119
120
|
:return: transaction hash or TransactionResult
|
120
121
|
"""
|
121
122
|
if not self._signers:
|
@@ -149,7 +150,10 @@ class Account(object):
|
|
149
150
|
)
|
150
151
|
|
151
152
|
try:
|
152
|
-
if
|
153
|
+
if included:
|
154
|
+
await self._provider.send_tx_included(serialized_tx)
|
155
|
+
return trx_hash
|
156
|
+
elif nowait:
|
153
157
|
return await self._provider.send_tx(serialized_tx)
|
154
158
|
return await self._provider.send_tx_and_wait(
|
155
159
|
serialized_tx, trx_hash=trx_hash, receiver_id=receiver_id
|
@@ -211,17 +215,18 @@ class Account(object):
|
|
211
215
|
return await self._provider.get_account(self.account_id)
|
212
216
|
|
213
217
|
async def send_money(
|
214
|
-
self, account_id: str, amount: int, nowait: bool = False
|
218
|
+
self, account_id: str, amount: int, nowait: bool = False, included=False
|
215
219
|
) -> TransactionResult:
|
216
220
|
"""
|
217
221
|
Send money to account_id
|
218
222
|
:param account_id: receiver account id
|
219
223
|
:param amount: amount in yoctoNEAR
|
220
224
|
:param nowait: if nowait is True, return transaction hash, else wait execution
|
225
|
+
:param included: if included is True, return transaction hash, else wait execution
|
221
226
|
:return: transaction hash or TransactionResult
|
222
227
|
"""
|
223
228
|
return await self.sign_and_submit_tx(
|
224
|
-
account_id, [transactions.create_transfer_action(amount)], nowait
|
229
|
+
account_id, [transactions.create_transfer_action(amount)], nowait, included
|
225
230
|
)
|
226
231
|
|
227
232
|
async def function_call(
|
@@ -232,6 +237,7 @@ class Account(object):
|
|
232
237
|
gas: int = constants.DEFAULT_ATTACHED_GAS,
|
233
238
|
amount: int = 0,
|
234
239
|
nowait: bool = False,
|
240
|
+
included=False,
|
235
241
|
):
|
236
242
|
"""
|
237
243
|
Call function on smart contract
|
@@ -241,6 +247,7 @@ class Account(object):
|
|
241
247
|
:param gas: amount of attachment gas. Default is 200000000000000
|
242
248
|
:param amount: amount of attachment NEAR, Default is 0
|
243
249
|
:param nowait: if nowait is True, return transaction hash, else wait execution
|
250
|
+
:param included: if included is True, return transaction hash, else wait execution
|
244
251
|
:return: transaction hash or TransactionResult
|
245
252
|
"""
|
246
253
|
ser_args = json.dumps(args).encode("utf8")
|
@@ -252,6 +259,7 @@ class Account(object):
|
|
252
259
|
)
|
253
260
|
],
|
254
261
|
nowait,
|
262
|
+
included,
|
255
263
|
)
|
256
264
|
|
257
265
|
async def create_account(
|
@@ -334,6 +342,7 @@ class Account(object):
|
|
334
342
|
delegate_action: Union[DelegateAction, DelegateActionModel],
|
335
343
|
signature: Union[bytes, str],
|
336
344
|
nowait=False,
|
345
|
+
included=False,
|
337
346
|
):
|
338
347
|
if isinstance(signature, str):
|
339
348
|
signature = base58.b58decode(signature.replace("ed25519:", ""))
|
@@ -343,7 +352,9 @@ class Account(object):
|
|
343
352
|
actions = [
|
344
353
|
transactions.create_signed_delegate(delegate_action, signature),
|
345
354
|
]
|
346
|
-
return await self.sign_and_submit_tx(
|
355
|
+
return await self.sign_and_submit_tx(
|
356
|
+
delegate_action.sender_id, actions, nowait, included
|
357
|
+
)
|
347
358
|
|
348
359
|
async def deploy_contract(self, contract_code: bytes, nowait=False):
|
349
360
|
"""
|
@@ -194,6 +194,22 @@ class JsonProvider(object):
|
|
194
194
|
broadcast=self.allow_broadcast,
|
195
195
|
)
|
196
196
|
|
197
|
+
async def send_tx_included(
|
198
|
+
self, signed_tx: str, timeout: int = constants.TIMEOUT_WAIT_RPC
|
199
|
+
):
|
200
|
+
"""
|
201
|
+
Send a signed transaction to the network and return the hash of the transaction
|
202
|
+
:param signed_tx: base64 encoded signed transaction, str.
|
203
|
+
:param timeout: rpc request timeout
|
204
|
+
:return:
|
205
|
+
"""
|
206
|
+
return await self.json_rpc(
|
207
|
+
"send_tx",
|
208
|
+
{"signed_tx_base64": signed_tx, "wait_until": "INCLUDED_FINAL"},
|
209
|
+
timeout=timeout,
|
210
|
+
broadcast=self.allow_broadcast,
|
211
|
+
)
|
212
|
+
|
197
213
|
async def wait_for_trx(self, trx_hash, receiver_id) -> TransactionResult:
|
198
214
|
for _ in range(6):
|
199
215
|
await asyncio.sleep(5)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|