Skip to content

Commit 3389f44

Browse files
authored
Merge pull request #14088 from brave/f/wallet/eth_feeHistory
fix(wallet): use hex-encoded blockCount param for eth_feeHistory
2 parents c7d6088 + 63a840c commit 3389f44

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

components/brave_wallet/browser/eth_requests.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ std::string eth_blockNumber() {
7070
return GetJsonRpcNoParams("eth_blockNumber");
7171
}
7272

73-
std::string eth_feeHistory(int num_blocks,
73+
std::string eth_feeHistory(const std::string& num_blocks,
7474
const std::string& head,
7575
const std::vector<double>& reward_percentiles) {
7676
base::Value percentile_values(base::Value::Type::LIST);

components/brave_wallet/browser/eth_requests.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ std::string eth_accounts();
4545
// Returns the number of most recent block.
4646
std::string eth_blockNumber();
4747
// Returns the fee history.
48-
std::string eth_feeHistory(int num_blocks,
48+
std::string eth_feeHistory(const std::string& num_blocks,
4949
const std::string& head,
5050
const std::vector<double>& reward_percentiles);
5151
// Returns the balance of the account of given address.

components/brave_wallet/browser/eth_requests_unittest.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ TEST(EthRequestUnitTest, eth_blockNumber) {
8585

8686
TEST(EthRequestUnitTest, eth_feeHistory) {
8787
ASSERT_EQ(
88-
eth_feeHistory(40, "latest", std::vector<double>{20, 50, 80}),
89-
R"({"id":1,"jsonrpc":"2.0","method":"eth_feeHistory","params":[40,"latest",[20.0,50.0,80.0]]})");
88+
eth_feeHistory("0x28", "latest", std::vector<double>{20, 50, 80}),
89+
R"({"id":1,"jsonrpc":"2.0","method":"eth_feeHistory","params":["0x28","latest",[20.0,50.0,80.0]]})");
9090
}
9191

9292
TEST(EthRequestUnitTest, eth_getBalance) {

components/brave_wallet/browser/json_rpc_service.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,9 @@ void JsonRpcService::GetFeeHistory(GetFeeHistoryCallback callback) {
611611
weak_ptr_factory_.GetWeakPtr(), std::move(callback));
612612

613613
RequestInternal(
614-
eth::eth_feeHistory(40, "latest", std::vector<double>{20, 50, 80}), true,
615-
network_urls_[mojom::CoinType::ETH], std::move(internal_callback));
614+
eth::eth_feeHistory("0x28", // blockCount = 40
615+
"latest", std::vector<double>{20, 50, 80}),
616+
true, network_urls_[mojom::CoinType::ETH], std::move(internal_callback));
616617
}
617618

618619
void JsonRpcService::OnGetFeeHistory(

0 commit comments

Comments
 (0)