import streamlit as st, hashlib, time from eip712_backend import EIP712Signer st.sidebar.header("EIP-712 On-Chain Anchor") CONTRACT_ADDRESS = st.sidebar.text_input("Ledger Address", "0x1234567890123456789012345678901234567890") CHAIN_ID = st.sidebar.number_input("Chain ID", value=1, step=1) SIGNER_KEY = st.sidebar.text_input("Signer Key", type="password") if st.sidebar.button("Sign EIP-712 Anchor"): if not SIGNER_KEY or not CONTRACT_ADDRESS: st.error("Missing configuration.") else: root = hashlib.sha256(b"hardened_audit_log_data").hexdigest() signer = EIP712Signer(private_key=SIGNER_KEY, contract_address=CONTRACT_ADDRESS, chain_id=CHAIN_ID) payload = signer.sign_audit_receipt("a1b2c3d4-e5f6-47a8-8901-23456789abcd", root, 1024, int(time.time())) st.success("Signed") st.json(payload)