def channel_open_tui(): acname = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) destpubkey = input("Input channel destination pubkey: ") paymentsnumber = input( "Input maximum number of payments in this channel: ") paymentdenomination = input("Input payment denomination (in sathoshis): ") file = open("channels_list", "a") try: channel_open_hex = channel_open(acname, destpubkey, paymentsnumber, paymentdenomination) except subprocess.CalledProcessError as e: print("Something went wrong...") print(e) input("Press [Enter] to continue...") else: try: channel_open_txid = tx_broadcaster(acname, channel_open_hex["hex"]) except KeyError as e: print("No hex for broadcasting.") print(channel_open_hex) input("Press [Enter] to continue...") else: print( colorize( "Channel opening transaction succesfully broadcasted: " + channel_open_txid, "green")) file.writelines(channel_open_txid + "\n") file.close() print(colorize("Entry added to channels_list file!\n", "blue")) input("Press [Enter] to continue...")
def channel_refund_tui(): acname = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) #print list of opentxid and closetxid opentxid = input("Input txid of channel opening: ") closetxid = input("Input txid of channel closing: ") try: channel_refund_hex = channel_refund(acname, opentxid, closetxid) except subprocess.CalledProcessError as e: print("Something went wrong...") print(e) input("Press [Enter] to continue...") else: try: channel_refund_txid = tx_broadcaster(acname, channel_refund_hex["hex"]) except KeyError as e: print("No hex for broadcasting.") print(channel_refund_hex) input("Press [Enter] to continue...") else: print( colorize( "Channel refund transaction succesfully broadcasted: " + channel_refund_txid, "green")) input("Press [Enter] to continue...")
def gateways_deposit_gw(): autodeposit_choice = input( "Do you want to proceed to gateway deposit of yours transaction? (y/n): " ) if autodeposit_choice == 'y': ac_name = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) bindtxid = input("Input your gateway bind txid: ") coin = input("Input your external coin ticker (e.g. KMD): ") # have to hold till it have at least one confirmation cointxid = input("Input your deposit txid: ") destpub = input("Input pubkey which claim deposit: ") amount = input("Input amount of your deposit: ") deposit_raw = gateways_deposit(ac_name, bindtxid, coin, cointxid, destpub, amount) try: deposit_txid = tx_broadcaster(ac_name, bind_raw["hex"]) except KeyError: print("Hex error! Result of gatewaysbind call:") print(bind_hex) input("Press [Enter] to continue...") else: print(colorize("Deposit is successful! Deposit request txid: " + deposit_txid \ + " After gatewaysclaim node confirmation you will get the tokens", "green")) #have to save it to file elif autodeposit_choice == 'n': pass else: print("Input y or n") input("Press [Enter] to continue...")
def tokens_converter_gw(): # to give user helpful info print("List of tokens created by this tool on this instance: ") file00 = open("tokens_list", "r") for line in file00: print(line) file00.close() ac_name = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) token_id = input("Input id of token which you want to convert: ") pubkey = input( "Input pubkey to which you want to convert (for initial convertion use\ 03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40): ") supply = input( "Input supply which you want to convert (for initial convertion set all token supply): " ) convertion_hex = tokens_converter(ac_name, "241", token_id, pubkey, supply) try: convertion_txid = tx_broadcaster(ac_name, convertion_hex["hex"]) except KeyError: print("Hex error! Result of tokencovert call:") print(convertion_hex) input("Press [Enter] to continue...") else: print("Convertion transaction succesfully broadcasted: " + str(convertion_txid)) input("Press [Enter] to continue...")
def gateway_bind_gw(): # to give user helpful info print("List of tokens created by this tool on this instance: ") file00 = open("tokens_list", "r") for line in file00: print(line) file00.close() print("\n") print("List of oracles created by this tool on this instance: ") file01 = open("oracles_list", "r") for line in file01: print(line) file01.close() ac_name = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) token_id = input("Input id of converted token which you want to bind: ") oracle_id = input( "Input id of Ihh data type oracle which you want to bind: ") coinname = input( "Input external coinname (should match with token and oracle names): ") # have to add automaticall tokensupply grab to not give user to mistake here tokensupply = input("Input supply of token which you want to bind: ") # have to add possiblity to choose option for auto-grab user pubkey pubkey = input( "Input trusted pubkey for associating with gateway (e.g. yours): ") file = open("gateways_list", "a") bind_hex = gateways_bind(ac_name, token_id, oracle_id, coinname, tokensupply, pubkey) try: bind_txid = tx_broadcaster(ac_name, bind_hex["hex"]) except KeyError: print("Hex error! Result of gatewaysbind call:") print(bind_hex) input("Press [Enter] to continue...") else: print( colorize("Bind transaction succesfully broadcasted: " + bind_txid, "green")) file.writelines(bind_txid + "\n") file.close() print(colorize("Entry added to gateways_list file!\n", "green")) input("Press [Enter] to continue...")
def gateways_claim_gw(): ac_name = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) gateway = input("Input gateway bindtxid you want to work with: ") coin = input("Input coin ticker you working with: ") gatewayspending = check_output([ "komodo-cli", "-ac_name=" + ac_name, "gatewayspending", gateway, coin ]) print("Pending deposits availiable for selected gateway: ") print(gatewayspending) print("Input the details for transaction claiming now") bindtxid = input("Input your gateway bind txid: ") coin = input("Input your external coin ticker (e.g. KMD): ") deposittxid = input("Input yours gatewaysdeposit txid: ") destpub = input("Input pubkey you want to tokens appear to: ") amount = input("Input amount of yours claiming: ") claim_tx_hex = gateways_claim(ac_name, bindtxid, coin, deposittxid, destpub, amount) claim_tx_txid = tx_broadcaster(ac_name, claim_tx_hex["hex"]) print("Transaction succesfully claimed: " + claim_tx_txid) input("Press [Enter] to continue...")
def channel_payment_tui(): acname = str( input("Input AC name with which you want to work (exmp: ORCL1): ")) print("\nList of channels created by this tool on this instance: ") try: file00 = open("channels_list", "r") for line in file00: print(line) file00.close() except IOError as e: print(e) print("\nLooks like you not created any channels yet\n") pass opentxid = input("Input txid of channel opening: ") paymentamount = input("Input amount of yours payment: ") try: channel_payment_hex = channel_payment(acname, opentxid, paymentamount) except subprocess.CalledProcessError as e: print("Something went wrong...") print(e) input("Press [Enter] to continue...") else: try: channel_payment_txid = tx_broadcaster(acname, channel_payment_hex["hex"]) except KeyError as e: print("No hex for broadcasting.") print(channel_payment_hex) input("Press [Enter] to continue...") else: print( colorize( "Channel payment transaction succesfully broadcasted: " + channel_payment_txid, "green")) input("Press [Enter] to continue...")