(String primaryType, Map<String, Object> data, Map<String, List<Map<String, String>>> types)
| 2493 | } |
| 2494 | |
| 2495 | private static byte[] hashStruct(String primaryType, Map<String, Object> data, Map<String, List<Map<String, String>>> types) { |
| 2496 | String typeString = encodeType(primaryType, types); |
| 2497 | byte[] typeHash = keccak256(typeString.getBytes(java.nio.charset.StandardCharsets.UTF_8)); |
| 2498 | byte[] encodedData = encodeData(primaryType, data, types); |
| 2499 | byte[] buf = new byte[typeHash.length + encodedData.length]; |
| 2500 | System.arraycopy(typeHash, 0, buf, 0, typeHash.length); |
| 2501 | System.arraycopy(encodedData, 0, buf, typeHash.length, encodedData.length); |
| 2502 | return keccak256(buf); |
| 2503 | } |
| 2504 | |
| 2505 | // encodeType per EIP-712: primaryType followed by sorted dependent struct types. |
| 2506 | private static String encodeType(String primaryType, Map<String, List<Map<String, String>>> types) { |
no test coverage detected