Skip to content
New issue

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

Fix OffersQuery structure #5

Merged
merged 1 commit into from
Nov 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main/java/bisq/markets/api/GraphQLQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public int compareTo(OpenOffer o) {
"amount: formattedAmount price: formattedPrice " +
"volume: formattedVolume payment_method: paymentMethodId " +
"offer_fee_txid: offerFeeTxId } ";
private static final String offersQuery = "query Offers($market: MarketPair, $direction: Direction)" +
private static final String offersQuery = "query Offers($market: MarketPair!, $direction: Direction)" +
"{ offers(market: $market, direction: $direction) { " +
"buys " + offerFields +
"sells " + offerFields + " } }";
Expand All @@ -128,7 +128,10 @@ public int compareTo(OpenOffer o) {
@Override
public Object translateResponse(String response) {
GraphQLResponse<Map<String,List<OpenOffer>>> offers = gson.fromJson(response,new TypeToken<GraphQLResponse<Map<String,List<OpenOffer>>>>(){}.getType());
return offers.getData();
Map<String,List<OpenOffer>> buysAndSells = offers.getData();
Map<String, Map<String,List<OpenOffer>>> ret = new HashMap<>();
ret.put(variables.get("market"), buysAndSells);
return ret;
}
}

Expand Down