Skip to content

Commit 0a5ac31

Browse files
committed
added sign_and_broadcast()
1 parent 032834c commit 0a5ac31

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tronapi/trx.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,18 @@ def broadcast(self, signed_transaction):
571571
})
572572
return response
573573

574+
def sign_and_broadcast(self, transaction: Any):
575+
"""Sign and send to the network
576+
577+
Args:
578+
transaction (Any): transaction details
579+
"""
580+
if not is_object(transaction):
581+
raise TronError('Invalid transaction provided')
582+
583+
signed_tx = self.sign(transaction)
584+
return self.broadcast(signed_tx)
585+
574586
def verify_message(self, message, signed_message=None, address=None, use_tron: bool = True):
575587
""" Get the address of the account that signed the message with the given hash.
576588
You must specify exactly one of: vrs or signature
@@ -927,7 +939,7 @@ def get_node_info(self):
927939
"""Get info about thre node"""
928940
return self.tron.manager.request('/wallet/getnodeinfo')
929941

930-
def get_token_list_name(self, token_id: str) -> any:
942+
def get_token_list_name(self, token_id: str) -> any:
931943
"""Query token list by name.
932944
933945
Args:

0 commit comments

Comments
 (0)