Java_BQ
unknown
java
2 years ago
1.6 kB
15
Indexable
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"subscription NotAlwaysWorkingSub {\\n EVM(network: eth, trigger_on: head) {\\n buyside: DEXTrades(\\n orderBy: {descending: Block_Time}\\n where: {Trade: {Sell: {Currency: {SmartContract: {is: \\\"0x423f4e6138E475D85CF7Ea071AC92097Ed631eea\\\"}}}, Dex: {ProtocolName: {is: \\\"uniswap_v3\\\"}, Pair: {SmartContract: {}}}}}\\n ) {\\n Block {\\n Number\\n Time\\n }\\n Transaction {\\n From\\n To\\n Hash\\n }\\n Trade {\\n Buy {\\n Amount\\n Buyer\\n Currency {\\n Name\\n Symbol\\n SmartContract\\n }\\n Seller\\n Price\\n }\\n Sell {\\n Amount\\n Buyer\\n Currency {\\n Name\\n SmartContract\\n Symbol\\n }\\n Seller\\n Price\\n }\\n Dex {\\n ProtocolFamily\\n ProtocolName\\n SmartContract\\n Pair {\\n SmartContract\\n }\\n }\\n }\\n }\\n }\\n}\\n\",\"variables\":\"{}\"}");
Request request = new Request.Builder()
.url("https://streaming.bitquery.io/graphql")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-KEY", "****") // Add API KEY
.build();
Response response = client.newCall(request).execute();Editor is loading...