return netInfo;
}
+ /**
+ * Call gas-rate api
+ *
+ * @param client
+ * @return
+ * @throws BytomException
+ */
+ public static Integer getGasRate(Client client) throws BytomException {
+ Integer gas = client.requestGet("gas-rate", null, "gas_rate", Integer.class);
+
+ logger.info("gas-rate:");
+ logger.info(gas);
+
+ return gas;
+ }
+
public static class NetInfo {
/**
* listening, whether the node is listening.
+++ /dev/null
-package io.bytom.api;
-
-import com.google.gson.annotations.SerializedName;
-import io.bytom.common.Utils;
-import io.bytom.exception.BytomException;
-import io.bytom.http.Client;
-import org.apache.log4j.Logger;
-
-/**
- * <h1>Gas Class</h1>
- */
-public class Gas {
-
- @SerializedName("gas_rate")
- public Integer gasRate;
-
- private static Logger logger = Logger.getLogger(Gas.class);
-
- public String toJson() {
- return Utils.serializer.toJson(this);
- }
-
-
- /**
- * Call gas-rate api
- *
- * @param client
- * @return
- * @throws BytomException
- */
- public static Gas gasRate(Client client) throws BytomException {
- Gas gas = client.request("gas-rate", null, Gas.class);
-
- logger.info("gas-rate:");
- logger.info(gas.toJson());
-
- return gas;
- }
-}
static CoreConfig.NetInfo netInfo;
+ static Integer gasRate;
+
@Test
public void testNetInfo() throws Exception {
netInfo = CoreConfig.getNetInfo(client);
Assert.assertNotNull(netInfo);
}
+ @Test
+ public void testGasRate() throws Exception {
+ gasRate = CoreConfig.getGasRate(client);
+ Assert.assertNotNull(gasRate);
+ }
+
}
+++ /dev/null
-package io.bytom.integration;
-
-import io.bytom.TestUtils;
-import io.bytom.api.Gas;
-import io.bytom.api.Wallet;
-import io.bytom.exception.BytomException;
-import io.bytom.http.Client;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class GasTest {
-
- static Client client;
-
- static {
- try {
- client = TestUtils.generateClient();
- } catch (BytomException e) {
- e.printStackTrace();
- }
- }
-
- static Gas gas;
-
- @Test
- public void testWalletBackUp() throws Exception {
- gas = Gas.gasRate(client);
- Assert.assertNotNull(gas);
- }
-
-}