inpt = input("Confirm diff data correct? ") print(" ") if str(inpt) != "Yes": inpt = input("Response not recognised. Please type 'Yes' to continue. ") if str(inpt) != "Yes": print("Exit") sys.exit() print("Connecting to Ocean client") print(" ") rpcport = 8332 rpcuser = '******' rpcpassword = '******' url = 'http://' + rpcuser + ':' + rpcpassword + '@localhost:' + str(rpcport) ocean = rpc.RPCHost(url) print("Specify asset redemption data: ") print(" ") inpt = input(" Enter serial number: ") assetRef = str(inpt) inpt = input(" Enter year of manufacture: ") assetYear = str(inpt) inpt = input(" Enter manufacturer: ") assetMan = str(inpt) inpt = input(" Enter fine mass: ") assetMass = float(inpt) print(" ") print(" Ref: " + assetRef) print(" Year: " + assetYear) print(" Man: " + assetMan)
def __init__(self, parent=None): super(TokenDialog, self).__init__(parent) rpcport = 8332 rpcuser = '******' rpcpassword = '******' url = 'http://' + rpcuser + ':' + rpcpassword + '@localhost:' + str( rpcport) ocean = rpc.RPCHost(url) utxorep = ocean.call('getutxoassetinfo') token_ratio, hour = am.token_ratio() s3 = boto3.resource('s3') s3.Bucket('gtsa-mapping').download_file('map.json', 'map.json') self.setWindowTitle("Token Report") self.left = 10 self.top = 10 self.width = 720 self.height = 500 self.setGeometry(self.left, self.top, self.width, self.height) self.tokenReport = QGroupBox("Blockchain token analysis: UTXO scan") self.tokenView = QTreeView() self.tokenView.setRootIsDecorated(False) self.tokenView.setAlternatingRowColors(True) tokenLayout = QHBoxLayout() tokenLayout.addWidget(self.tokenView) self.tokenReport.setLayout(tokenLayout) self.tokenModel = self.createReportModel(self) self.tokenView.setModel(self.tokenModel) self.tokenView.setColumnWidth(0, 200) self.tokenRatio = QLabel("Token ratio: " + str("%.8f" % token_ratio) + " oz/token at hour " + str(hour)) map_obj = am.MapDB(2, 3) map_obj.load_json('map.json') json_obj = map_obj.get_json() for entry in utxorep: asset = entry["asset"] amount = entry["amountspendable"] + entry["amountfrozen"] mass = 0.0 inmap = False for i, j in json_obj["assets"].items(): if j["tokenid"] == asset: mass += j["mass"] inmap = True if inmap and amount < 9.0: exptoken = mass / token_ratio self.addReport(self.tokenModel, asset, mass, exptoken, amount) layout = QVBoxLayout() layout.addWidget(self.tokenReport) layout.addWidget(self.tokenRatio) self.setLayout(layout)