String jsonMessageString = Files.readString(Paths.get("src/main/resources/data.json").toAbsolutePath()); JSONObject jsonObject = new JSONObject(jsonMessageString); jsonObject.getJSONObject("message").put("from", credentials.getAddress()); jsonObject.getJSONObject("message").put("nonce", nonce); jsonObject.getJSONObject("message").put("data", encodedFunction); String modifiedJsonString = jsonObject.toString(); Sign.SignatureData signature = Sign.signTypedData(modifiedJsonString, credentials.getEcKeyPair());
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter