-
Notifications
You must be signed in to change notification settings - Fork 0
/
operations.py
36 lines (36 loc) · 1.35 KB
/
operations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# from main import bot
#
# ONE_TRON = 1000000
# from tronpy import Tron
# from tronpy.keys import PrivateKey
#
# PRIVATE_KEY = "009faab68456edf92132cc74a580316d159bdc10a544bda7f82a52175968a323"
# MY_ADDRESS = "TSPZcEraokyNAuFR4Shgyn5D4ycsWjJhrL"
# # connect to the Tron blockchain
# client = Tron()
#
#
# def is_valid(address):
# is_address = client.is_address(str(address))
# return is_address
#
#
# def withdraw(update, context, address, value):
# priv_key = PrivateKey(bytes.fromhex(PRIVATE_KEY))
#
# # create transaction and broadcast it
# # people = mydb['people']
# # people.find_one({'_id':update.message.chat_id},{"$d"})
# txn = (
# client.trx.transfer(MY_ADDRESS, str(address), int(value * ONE_TRON))
# .memo("Transaction Description")
# .build()
# .inspect()
# .sign(priv_key)
# .broadcast()
# )
# # wait until the transaction is sent through and then return the details
# result = txn.wait()
# bot.sendMessage(chat_id=update.message.chat_id, text=f"Transaction successful!\n\n"
# f"Transaction hash(TXID) : <code>{result['id']}</code>\n\n"
# f"Tron scan: https://tronscan.org/#/transaction/{result['id']}")