From c381a845db122fc635974d1193d7e2058074fe5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Terje=20S=C3=B8rensen?= Date: Tue, 7 May 2024 18:21:34 +0200 Subject: [PATCH] Fixed mapping --- .../java/no/jansoren/defillama/BaseDefiLlamaClient.java | 3 --- src/main/java/no/jansoren/defillama/ProtocolsClient.java | 9 +++++---- .../jansoren/defillama/model/protocols/ProtocolItem.java | 7 ++++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/no/jansoren/defillama/BaseDefiLlamaClient.java b/src/main/java/no/jansoren/defillama/BaseDefiLlamaClient.java index 25ac523..3e5604a 100644 --- a/src/main/java/no/jansoren/defillama/BaseDefiLlamaClient.java +++ b/src/main/java/no/jansoren/defillama/BaseDefiLlamaClient.java @@ -37,9 +37,6 @@ protected T get(String uri, Class clz) { throw new RuntimeException(e); } } - protected T get(String uri) { - return get(uri, new TypeReference<>(){}); - } protected T get(String uri, TypeReference valueTypeRef) { try { diff --git a/src/main/java/no/jansoren/defillama/ProtocolsClient.java b/src/main/java/no/jansoren/defillama/ProtocolsClient.java index 802e387..64cf560 100644 --- a/src/main/java/no/jansoren/defillama/ProtocolsClient.java +++ b/src/main/java/no/jansoren/defillama/ProtocolsClient.java @@ -1,5 +1,6 @@ package no.jansoren.defillama; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import no.jansoren.defillama.model.protocols.Protocol; import no.jansoren.defillama.model.protocols.ProtocolItem; @@ -17,7 +18,7 @@ public ProtocolsClient(HttpClient httpClient, ObjectMapper objectMapper) { } public List getProtocols() { - return get(HOSTNAME_API+"/protocols"); + return get(HOSTNAME_API+"/protocols", new TypeReference<>(){}); } public Protocol getProtocol(String protocol) { @@ -25,11 +26,11 @@ public Protocol getProtocol(String protocol) { } public List getTvlForAllChains() { - return get(HOSTNAME_API+"/v2/historicalChainTvl"); + return get(HOSTNAME_API+"/v2/historicalChainTvl", new TypeReference<>(){}); } public List getTvlForChain(String chain) { - return get(HOSTNAME_API+"/v2/historicalChainTvl/"+chain); + return get(HOSTNAME_API+"/v2/historicalChainTvl/"+chain, new TypeReference<>(){}); } public BigDecimal getTvlOfProtocol(String protocol) { @@ -37,6 +38,6 @@ public BigDecimal getTvlOfProtocol(String protocol) { } public List getTvlForChains() { - return get(HOSTNAME_API+"/v2/chains"); + return get(HOSTNAME_API+"/v2/chains", new TypeReference<>(){}); } } diff --git a/src/main/java/no/jansoren/defillama/model/protocols/ProtocolItem.java b/src/main/java/no/jansoren/defillama/model/protocols/ProtocolItem.java index 9aaa17f..728afed 100644 --- a/src/main/java/no/jansoren/defillama/model/protocols/ProtocolItem.java +++ b/src/main/java/no/jansoren/defillama/model/protocols/ProtocolItem.java @@ -1,6 +1,7 @@ package no.jansoren.defillama.model.protocols; import java.math.BigDecimal; +import java.time.ZonedDateTime; import java.util.List; import java.util.Map; @@ -60,7 +61,7 @@ public record ProtocolItem( BigDecimal tvl, @JsonProperty("listedAt") - int listedAt, + ZonedDateTime listedAt, @JsonProperty("url") String url, @@ -93,7 +94,7 @@ public record ProtocolItem( List oracles, @JsonProperty("hallmarks") - List> hallmarks, + List> hallmarks, @JsonProperty("parentProtocol") String parentProtocol, @@ -129,7 +130,7 @@ public record ProtocolItem( List governanceID, @JsonProperty("deadFrom") - int deadFrom, + String deadFrom, @JsonProperty("wrongLiquidity") boolean wrongLiquidity,