use of org.aion.api.server.types.NumericalValue in project aion by aionnetwork.
the class ApiWeb3Aion method syncInfoToJson.
private JSONObject syncInfoToJson(SyncInfo syncInfo) {
JSONObject syncInfoAsJson = new JSONObject();
syncInfoAsJson.put("startingBlock", new NumericalValue(syncInfo.chainStartingBlkNumber).toHexString());
syncInfoAsJson.put("currentBlock", new NumericalValue(syncInfo.chainBestBlkNumber).toHexString());
syncInfoAsJson.put("highestBlock", new NumericalValue(syncInfo.networkBestBlkNumber).toHexString());
return syncInfoAsJson;
}
use of org.aion.api.server.types.NumericalValue in project aion by aionnetwork.
the class ApiWeb3Aion method eth_estimateGas.
public RpcMsg eth_estimateGas(Object _params) {
JSONObject _tx;
if (_params instanceof JSONArray) {
_tx = ((JSONArray) _params).getJSONObject(0);
} else if (_params instanceof JSONObject) {
_tx = ((JSONObject) _params).getJSONObject("transaction");
} else {
return new RpcMsg(null, RpcError.INVALID_PARAMS, "Invalid parameters");
}
ArgTxCall txParams = ArgTxCall.fromJSONforCall(_tx, getRecommendedNrgPrice());
NumericalValue estimate = new NumericalValue(estimateNrg(txParams));
return new RpcMsg(estimate.toHexString());
}
Aggregations