Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

feat: add api 20230810 #369

Merged
merged 6 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,17 @@ jobs:
- *pull_klaytn_image
- *start_test_network
- *check_test_network
- run:
name: "Check environment"
command: java --version && gradle --version
- run:
name: "Test"
command: ./gradlew clean test --debug
command: ./gradlew clean test --debug --scan
- store_test_results:
path: core/build/test-results/test
- store_artifacts:
path: /home/circleci/circleci-caver-java-major/core/build/reports/tests/test
destination: test-output

build_test:
<<: *machine_ubuntu
Expand Down Expand Up @@ -195,6 +201,9 @@ jobs:
command: ./gradlew connectedDebugAndroidTest --debug --stacktrace
- store_test_results:
path: android_instrumented_test/build/outputs/androidTest-results/connected
- store_artifacts:
path: android_instrumented_test/build/reports/androidTests/connected/flavors/debugAndroidTest
destination: /test-report

build_test_android:
<<: *android_machine_ubuntu
Expand Down
17 changes: 13 additions & 4 deletions core/src/main/java/com/klaytn/caver/JsonRpc2_0Klay.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,24 @@ public Request<?, Quantity> getGasPrice() {
}

@Override
public Request<?, Quantity> getGasPriceAt(DefaultBlockParameter defaultBlockParameter) {
public Request<?, Quantity> getGasPrice(DefaultBlockParameter defaultBlockParameter) {
return new Request<>(
"klay_gasPriceAt",
"klay_gasPrice",
Arrays.asList(defaultBlockParameter),
web3jService,
Quantity.class
);
Quantity.class);
}

// @Override
// public Request<?, Quantity> getGasPriceAt(DefaultBlockParameter defaultBlockParameter) {
// return new Request<>(
// "klay_gasPriceAt",
// Arrays.asList(defaultBlockParameter),
// web3jService,
// Quantity.class
// );
// }

@Override
public Request<?, Boolean> isParallelDBWrite() {
return new Request<>(
Expand Down
13 changes: 12 additions & 1 deletion core/src/main/java/com/klaytn/caver/Klay.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,18 @@ Request<?, KlayTransaction> getTransactionByBlockNumberAndIndex(
* @param defaultBlockParameter Integer block number, or the string "latest", "earliest" or "pending"
* @return Quantity - Integer of the current gas price in peb.
*/
Request<?, Quantity> getGasPriceAt(DefaultBlockParameter defaultBlockParameter);
Request<?, Quantity> getGasPrice(DefaultBlockParameter defaultBlockParameter);


/**
* Returns the unit price of the given block in peb.<br>
* NOTE: This API has different behavior from Ethereum's and returns a gas price of Klaytn instead
* of suggesting a gas price as in Ethereum.
*
* @param defaultBlockParameter Integer block number, or the string "latest", "earliest" or "pending"
* @return Quantity - Integer of the current gas price in peb.
*/
// Request<?, Quantity> getGasPriceAt(DefaultBlockParameter defaultBlockParameter);


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2022 The caver-java Authors
*
* Licensed under the Apache License, Version 2.0 (the “License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an “AS IS” BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.klaytn.caver.methods.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import org.web3j.protocol.core.Response;

public class ForkStatusResult
extends Response<ForkStatusResult.ForkStatusData> {

public static class ForkStatusData {

@JsonProperty("EthTxType")
private Boolean EthTxType;

@JsonProperty("Istanbul")
private Boolean Istanbul;

@JsonProperty("KIP103")
private Boolean KIP103;

@JsonProperty("Kore")
private Boolean Kore;

@JsonProperty("London")
private Boolean London;

@JsonProperty("Magma")
private Boolean Magma;

@JsonProperty("Mantle")
private Boolean Mantle;

public ForkStatusData() {}
public ForkStatusData (
Boolean EthTxType,
Boolean Istanbul,
Boolean KIP103,
Boolean Kore,
Boolean London,
Boolean Magma,
Boolean Mantle
) {
this.EthTxType = EthTxType;
this.Istanbul = Istanbul;
this.KIP103 = KIP103;
this.Kore = Kore;
this.London = London;
this.Magma = Magma;
this.Mantle = Mantle;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright 2020 The caver-java Authors
*
* Licensed under the Apache License, Version 2.0 (the “License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an “AS IS” BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.klaytn.caver.methods.response;

import java.util.Map;

import org.web3j.protocol.core.Response;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

public class RewardsAccumulated extends Response<RewardsAccumulated.RewardsAccumulatedData> {
public static class RewardsAccumulatedData {

@JsonProperty("firstBlockTime")
private String firstBlockTime;

@JsonProperty("lastBlockTime")
private String lastBlockTime;

@JsonProperty("firstBlock")
private String firstBlock;

@JsonProperty("lastBlock")
private String lastBlock;

@JsonProperty("totalMinted")
private String totalMinted;

@JsonProperty("totalTxFee")
private String totalTxFee;

@JsonProperty("totalBurntTxFee")
private String totalBurntTxFee;

@JsonProperty("totalProposerRewards")
private String totalProposerRewards;

@JsonProperty("totalStakingRewards")
private String totalStakingRewards;

@JsonProperty("totalKFFRewards")
private String totalKFFRewards;

@JsonProperty("totalKCFRewards")
private String totalKCFRewards;

/**
* mapping from reward recipient to amounts
*/
@JsonProperty("rewards")
private Map<String, String> rewards;

public RewardsAccumulatedData() {}
public RewardsAccumulatedData(
String firstBlockTime,
String lastBlockTime,
String firstBlock,
String lastBlock,
String totalMinted,
String totalTxFee,
String totalBurntTxFee,
String totalProposerRewards,
String totalStakingRewards,
String totalKFFRewards,
String totalKCFRewards,
Map<String, String> Rewards
) {
this.firstBlockTime = firstBlockTime;
this.lastBlockTime = lastBlockTime;
this.firstBlock = firstBlock;
this.lastBlock = lastBlock;
this.totalMinted = totalMinted;
this.totalTxFee = totalTxFee;
this.totalBurntTxFee = totalBurntTxFee;
this.totalProposerRewards = totalProposerRewards;
this.totalStakingRewards = totalStakingRewards;
this.totalKFFRewards = totalKFFRewards;
this.totalKCFRewards = totalKCFRewards;
this.rewards = rewards;
}
}
}
Loading
Loading