@@ -20,6 +20,28 @@ def vote_offer(self, args):
2020 self .ton .VoteOffer (offerHash )
2121 color_print ("VoteOffer - {green}OK{endc}" )
2222
23+ def vote_offer_btc_teleport (self , args ):
24+ if len (args ) == 0 :
25+ color_print ("{red}Bad args. Usage:{endc} vote_offer_btc_teleport <offer-hash> [offer-hash-2 offer-hash-3 ...]" )
26+ return
27+ from modules .btc_teleport import BtcTeleportModule
28+ coordinator_addr = BtcTeleportModule .CONFIGURATOR_ADDRESS
29+ wallet = self .ton .GetValidatorWallet (mode = "vote" )
30+ validator_key = self .ton .GetValidatorKey ()
31+ validator_pubkey_b64 = self .ton .GetPubKeyBase64 (validator_key )
32+ validator_index = self .ton .GetValidatorIndex ()
33+ for offer_hash in args :
34+ # offer = self.GetOffer(offerHash)
35+ # if validatorIndex in offer.get("votedValidators"):
36+ # self.local.add_log("Proposal already has been voted", "debug")
37+ # return
38+ request_hash = self .ton .CreateConfigProposalRequest (offer_hash , validator_index )
39+ validator_signature = self .ton .GetValidatorSignature (validator_key , request_hash )
40+ path = self .ton .SignProposalVoteRequestWithValidator (offer_hash , validator_index , validator_pubkey_b64 ,
41+ validator_signature )
42+ path = self .ton .SignBocWithWallet (wallet , path , coordinator_addr , 1.5 )
43+ self .ton .SendFile (path , wallet )
44+
2345 def vote_election_entry (self , args ):
2446 from mytoncore .functions import Elections
2547 Elections (self .ton .local , self .ton )
@@ -104,6 +126,7 @@ def get_my_complaint(self):
104126
105127 def add_console_commands (self , console ):
106128 console .AddItem ("vo" , self .vote_offer , self .local .translate ("vo_cmd" ))
129+ console .AddItem ("vote_offer_btc_teleport" , self .vote_offer_btc_teleport , self .local .translate ("vote_offer_btc_teleport_cmd" ))
107130 console .AddItem ("ve" , self .vote_election_entry , self .local .translate ("ve_cmd" ))
108131 console .AddItem ("vc" , self .vote_complaint , self .local .translate ("vc_cmd" ))
109132 console .AddItem ("check_ef" , self .check_efficiency , self .local .translate ("check_ef_cmd" ))
0 commit comments