vite.ViteSubscribeRpc Maven / Gradle / Ivy
The newest version!
package vite;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.java_websocket.WebSocket;
import vite.api.service.RpcViteService;
import vite.api.service.ViteWebSocket;
import vite.api.service.ViteWebSocketDemo;
import vite.api.utils.Generator;
import vite.api.vo.RequestJson;
import vite.api.vo.SnapshotBlockSubscriptions;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
public class ViteSubscribeRpc {
private RpcViteService rpcViteService;
public ViteSubscribeRpc(String baseUrl) {
rpcViteService = Generator.createService(RpcViteService.class, baseUrl);
}
public String subscribeSnapshotBlock() {
RequestJson requestJson = new RequestJson();
requestJson.setJsonrpc("2.0");
requestJson.setMethod("subscribe_newSnapshotBlocksFilter");
JSONObject jsonObject = Generator.executeSync(rpcViteService.postRequest(requestJson));
if (jsonObject.getString("result") != null) {
return jsonObject.getString("result");
}
return null;
}
public SnapshotBlockSubscriptions getSnapshotBlockFilterChanges(String filterId) {
RequestJson requestJson = new RequestJson();
requestJson.setMethod("subscribe_getFilterChanges");
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy