Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pandas;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- public class Minted {
- public static void main(String[] args) {
- while (true) {
- try {
- String command = "curl https://api.mainnet-beta.solana.com -X POST -H \"Content-Type: application/json\" -d {\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":\\\"1\\\",\\\"method\\\":\\\"getTokenAccountBalance\\\",\\\"params\\\":[\\\"CheWJgRCqpEXiEGVdh4HHiQdprtrzrVjgXazuCfCFM1P\\\"]}";
- Process process = Runtime.getRuntime().exec(command);
- String result = "";
- try (BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
- String line = null;
- while ((line = input.readLine()) != null) {
- result += line;
- }
- }
- JsonParser jsonParser = new JsonParser();
- JsonObject root = (JsonObject) jsonParser.parse(result);
- int minted = root.get("result").getAsJsonObject().get("value").getAsJsonObject().get("amount").getAsInt();
- System.out.println(new java.util.Date(System.currentTimeMillis()) + " > " + minted);
- Thread.sleep(500);
- } catch (Exception e) {
- // e.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement