def regist_channel(sender_addr, receiver_addr, asset_type,deposit, open_blockchain): """ This func is to register channel :param sender_addr: String, the sender address :param receiver_addr: String, receiver's address :param asset_type: String, asset type should be symbol name , asset id should be configured in the configure.json :param deposit: String, depoist number in block chain :param open_blockchain: Open block chain number :return: Dictionary, {"channel_name":channel_name, "trad_info":raw_tans} """ channel = Channel(sender_addr,receiver_addr) if channel.find_channel(): return {"error": "channel already exist"} else: raw_tans,state = blockchain.NewTransection(asset_type, sender_addr, Contract_addr, int(deposit)) if state: channel_name = channel.create(sender_deposit=int(deposit),reciever_deposit=0, open_block_number=int(open_blockchain),settle_timeout=10) return {"channel_name": channel_name, "trad_info": raw_tans} else: return {"channel_name":None, "trad_info":raw_tans}
def regist_channel(sender_addr, receiver_addr, asset_type, deposit, open_blockchain): """ :param sender_addr: :param receiver_addr: :param asset_type: :param deposit: :param open_blockchain: :return: """ channel = Channel(sender_addr, receiver_addr) if channel.find_channel(): return {"error": "channel already exist"} else: channel_name = channel.create(sender_deposit=int(deposit), reciever_deposit=0, open_block_number=int(open_blockchain), settle_timeout=10) raw_tans = blockchain.NewTransection(asset_type, sender_addr, Contract_addr, int(deposit)) return {"channel_name": channel_name, "trad_info": raw_tans}