Explorar o código

added feature to show all updates for a contract

justtheboss97 %!s(int64=4) %!d(string=hai) anos
pai
achega
824d350b7d
Modificáronse 2 ficheiros con 23 adicións e 1 borrados
  1. 0 0
      data/block.json
  2. 23 1
      gui/data.py

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
data/block.json


+ 23 - 1
gui/data.py

@@ -99,6 +99,27 @@ def find_transaction():
             print('No contract found')
         else:
             transactions = decrypt_transactions(transactions, str(key.get()))
+            print('Current contract state')
+            pprint.pprint(current_contract_state(transactions, iden=iden))
+
+        conn.close()
+        newWindow.destroy()
+
+    def findall():
+        conn = rpyc.connect(host='localhost', port=42069, keepalive=True)
+        iden = get_plain_key(str(key.get()))
+        transactions = conn.root.find_transactions(iden)
+        if len(transactions) == 0:
+            print('No contract found')
+        else:
+            transactions = decrypt_transactions(transactions, str(key.get()))
+            print('All updates')
+            for item in transactions:
+                if item['type'] != 'init':
+                    pprint.pprint(item)
+                    print('\n')
+
+            print('Current contract state')
             pprint.pprint(current_contract_state(transactions, iden=iden))
 
         conn.close()
@@ -112,7 +133,8 @@ def find_transaction():
     key.grid(row=0, column=1, columnspan=3, padx=10, pady=10)
     key.insert(0, 'test')
 
-    Button(newWindow, text='find contracts', command=find).grid(row=1, column=1)
+    Button(newWindow, text='find contracts', command=find).grid(row=2, column=0)
+    Button(newWindow, text='find contracts and updates', command=findall).grid(row=2, column=1)
 
 
 def add_term():

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio