@staticmethod
def recover_typed_message(domain_data: dict, message_types: dict, message_data: dict, signature: HexBytes) -> Optional[SignedMessageData]
# 恢复 EIP-712 结构化数据签名者
domain_data = {
"name": "MyDApp",
"version": "1",
"chainId": 1,
"verifyingContract": "0x..."
}
message_types = {
"Person": [
{"name": "name", "type": "string"},
{"name": "wallet", "type": "address"}
]
}
message_data = {
"name": "Bob",
"wallet": "0x..."
}
signature = HexBytes("0x...") # 65 字节的签名
signed_data = Utils.recover_typed_message(domain_data, message_types, message_data, signature)
if signed_data:
print(f"Signer: {signed_data.signer}")