Skip to content

Commit

Permalink
Fixed mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jansoren committed May 7, 2024
1 parent f2799f1 commit c381a84
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/main/java/no/jansoren/defillama/BaseDefiLlamaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ protected <T> T get(String uri, Class<T> clz) {
throw new RuntimeException(e);
}
}
protected <T> T get(String uri) {
return get(uri, new TypeReference<>(){});
}

protected <T> T get(String uri, TypeReference<T> valueTypeRef) {
try {
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/no/jansoren/defillama/ProtocolsClient.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,26 +18,26 @@ public ProtocolsClient(HttpClient httpClient, ObjectMapper objectMapper) {
}

public List<ProtocolItem> getProtocols() {
return get(HOSTNAME_API+"/protocols");
return get(HOSTNAME_API+"/protocols", new TypeReference<>(){});
}

public Protocol getProtocol(String protocol) {
return get(HOSTNAME_API+"/protocol/"+protocol, Protocol.class);
}

public List<Tvl> getTvlForAllChains() {
return get(HOSTNAME_API+"/v2/historicalChainTvl");
return get(HOSTNAME_API+"/v2/historicalChainTvl", new TypeReference<>(){});
}

public List<Tvl> getTvlForChain(String chain) {
return get(HOSTNAME_API+"/v2/historicalChainTvl/"+chain);
return get(HOSTNAME_API+"/v2/historicalChainTvl/"+chain, new TypeReference<>(){});
}

public BigDecimal getTvlOfProtocol(String protocol) {
return get(HOSTNAME_API+"/tvl/"+protocol, BigDecimal.class);
}

public List<TvlItem> getTvlForChains() {
return get(HOSTNAME_API+"/v2/chains");
return get(HOSTNAME_API+"/v2/chains", new TypeReference<>(){});
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -60,7 +61,7 @@ public record ProtocolItem(
BigDecimal tvl,

@JsonProperty("listedAt")
int listedAt,
ZonedDateTime listedAt,

@JsonProperty("url")
String url,
Expand Down Expand Up @@ -93,7 +94,7 @@ public record ProtocolItem(
List<Object> oracles,

@JsonProperty("hallmarks")
List<List<Integer>> hallmarks,
List<List<String>> hallmarks,

@JsonProperty("parentProtocol")
String parentProtocol,
Expand Down Expand Up @@ -129,7 +130,7 @@ public record ProtocolItem(
List<String> governanceID,

@JsonProperty("deadFrom")
int deadFrom,
String deadFrom,

@JsonProperty("wrongLiquidity")
boolean wrongLiquidity,
Expand Down

0 comments on commit c381a84

Please sign in to comment.