We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using the HttpService of web3j to call the sendBatch method, if the returned data contains a float type, you may encounter precision loss issues.
Deserializing like HttpService
@Test public void test2() { ObjectMapper mapper = new ObjectMapper(); String json = """ {"balance":209338520.59559551,"received":209338520.59559551,"immature":0.00000000} """; String jsonArray = """ [{"balance":209338520.59559551,"received":209338520.59559551,"immature":0.00000000}] """; try { var tree = mapper.readTree(json); var balance = mapper.treeToValue(tree, OriginalAddressRangeBalance2.class); System.out.println(balance); ArrayNode nodes = (ArrayNode) mapper.readTree(jsonArray); List<OriginalAddressRangeBalance2> balances = new ArrayList<>(); for (int i = 0; i < nodes.size(); i++) { var b = mapper.treeToValue(nodes.get(i), OriginalAddressRangeBalance2.class); balances.add(b); } System.out.println(balances); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } @Data @NoArgsConstructor @AllArgsConstructor public static class OriginalAddressRangeBalance2 { private BigDecimal balance; private BigDecimal received; private BigDecimal immature; } ### Expected behavior Output: UtxoClientTest.OriginalAddressRangeBalance2(balance=209338520.59559551, received=209338520.59559551, immature=0) [UtxoClientTest.OriginalAddressRangeBalance2(balance=209338520.59559551, received=209338520.59559551, immature=0)] ### Actual behavior Output: UtxoClientTest.OriginalAddressRangeBalance2(balance=209338520.5955955, received=209338520.5955955, immature=0.0) [UtxoClientTest.OriginalAddressRangeBalance2(balance=209338520.5955955, received=209338520.5955955, immature=0.0)] ## Environment _Describe the environment in which the issue occurs_ - Web3j version: 4.8.6 - Java version: jdk17, Zulu17.52+17-CA (build 17.0.12+7-LTS) - Operating System: macos 15.0.1 (24A348)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
precision loss
When using the HttpService of web3j to call the sendBatch method, if the returned data contains a float type, you may encounter precision loss issues.
Steps To Reproduce
Deserializing like HttpService
The text was updated successfully, but these errors were encountered: