Add address parsing and initiate newtrade from cli

This commit is contained in:
Jay Graber 2017-07-24 07:41:03 -07:00
parent f9e40d7355
commit 0df6fcd04c
4 changed files with 10 additions and 5 deletions

3
cli.py
View File

@ -81,4 +81,5 @@ if __name__ == '__main__':
erase_trade()
role = 'seller'
htlcTrade = Trade()
print("Creating new XCAT transaction...")
print("Creating new XCAT trade...")
seller_initiate(htlcTrade)

View File

@ -7,7 +7,8 @@ db = plyvel.DB('/tmp/testdb', create_if_missing=True)
trade = get_trade()
## txid we retrieve by
txid = trade['sell']['fund_tx']
if trade and 'sell' in trade:
txid = trade['sell']['fund_tx']
def create(hexstr):
trade = hex2dict(hexstr)

View File

@ -1,7 +1,6 @@
from utils import *
def get_trade_amounts():
print("in user input")
amounts = {}
sell_currency = input("Which currency would you like to trade out of (bitcoin or zcash)? ")
if sell_currency == '':

View File

@ -66,8 +66,12 @@ def get_secret():
return line.strip('\n')
def save_secret(secret):
with open('secret.json', 'w') as outfile:
outfile.write(secret)
try:
with open('secret.json', 'w') as outfile:
outfile.write(secret)
except IOError:
with open('secret.json', 'w+') as outfile:
outfile.write(secret)
def save(trade):
print("Saving trade")