@Test public void testEIP712TransactionConversion() { try { String eip1077Hash = new EIP712(TypedDataInput).toEIP712TransactionHash(); assertEquals(MSG_HASH, eip1077Hash); } catch (Exception e) { e.printStackTrace(); } }
public String toEIP712TransactionHash() throws Exception { this.validate(); String domainSeparator = this.hashData("EIP712Domain", this.domain); String message = this.hashData(this.primaryType, this.message); return new SoliditySha3().soliditySha3( new JSONObject(String.format("{ t: 'bytes', v: '"+ INITIAL_BYTE + "' }")), new JSONObject(String.format("{ t: 'bytes', v: '"+ VERSION + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + domainSeparator + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + message + "' }")) ); }
EIP712 { public String toEIP712TransactionHash() throws Exception { this.validate(); String domainSeparator = this.hashData("EIP712Domain", this.domain); String message = this.hashData(this.primaryType, this.message); return new SoliditySha3().soliditySha3( new JSONObject(String.format("{ t: 'bytes', v: '"+ INITIAL_BYTE + "' }")), new JSONObject(String.format("{ t: 'bytes', v: '"+ VERSION + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + domainSeparator + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + message + "' }")) ); } }
EIP712 { public String toEIP712TransactionHash() throws Exception { this.validate(); String domainSeparator = this.hashData("EIP712Domain", this.domain); String message = this.hashData(this.primaryType, this.message); return new SoliditySha3().soliditySha3( new JSONObject(String.format("{ t: 'bytes', v: '"+ INITIAL_BYTE + "' }")), new JSONObject(String.format("{ t: 'bytes', v: '"+ VERSION + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + domainSeparator + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + message + "' }")) ); } EIP712(JSONObject txnObject); }
EIP712 { public String toEIP712TransactionHash() throws Exception { this.validate(); String domainSeparator = this.hashData("EIP712Domain", this.domain); String message = this.hashData(this.primaryType, this.message); return new SoliditySha3().soliditySha3( new JSONObject(String.format("{ t: 'bytes', v: '"+ INITIAL_BYTE + "' }")), new JSONObject(String.format("{ t: 'bytes', v: '"+ VERSION + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + domainSeparator + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + message + "' }")) ); } EIP712(JSONObject txnObject); String encodeDataType(String dataType); String hashDataType(String dataType); String encodeData(String dataType, JSONObject data); String toEIP712TransactionHash(); static boolean validateData(JSONObject data); }
EIP712 { public String toEIP712TransactionHash() throws Exception { this.validate(); String domainSeparator = this.hashData("EIP712Domain", this.domain); String message = this.hashData(this.primaryType, this.message); return new SoliditySha3().soliditySha3( new JSONObject(String.format("{ t: 'bytes', v: '"+ INITIAL_BYTE + "' }")), new JSONObject(String.format("{ t: 'bytes', v: '"+ VERSION + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + domainSeparator + "' }")), new JSONObject(String.format("{ t: 'bytes32', v: '" + message + "' }")) ); } EIP712(JSONObject txnObject); String encodeDataType(String dataType); String hashDataType(String dataType); String encodeData(String dataType, JSONObject data); String toEIP712TransactionHash(); static boolean validateData(JSONObject data);  }