import sys, time, subprocess, os from ckcc.client import ColdcardDevice from ckcc.protocol import CCProtocolPacker sock, wallet = sys.argv[1], sys.argv[2] ckcc = os.path.expanduser('~/ccsim-venv/bin/ckcc') up = subprocess.run([ckcc, '-c', sock, 'upload', '-m', wallet], capture_output=True, text=True) print('UPLOAD:', (up.stdout + up.stderr).strip()[:200]) time.sleep(1.5) dev = ColdcardDevice(sn=sock) def E(cmd): r = dev.send_recv(b'EXEC' + cmd.encode(), encrypt=False) return r.decode() if isinstance(r, (bytes, bytearray)) else r def V(cmd): r = dev.send_recv(b'EVAL' + cmd.encode()) return r.decode() if isinstance(r, (bytes, bytearray)) else r def K(k): dev.send_recv(CCProtocolPacker.sim_keypress(k.encode('ascii'))) print('STORY0:', E("RV.write(repr(sim_display.story))")[:400]) for i in range(8): c = V("len(settings.get('multisig', []))").strip() print('iter %d: ms_count=%r' % (i, c)) if c not in ('0', ''): break K('y'); time.sleep(1.0) print('FINAL ms_count:', V("len(settings.get('multisig', []))").strip()) print('STORYZ:', E("RV.write(repr(sim_display.story))")[:200])