SON for Ethereum #713

Merged
serkixenos merged 70 commits from feature/son-for-ethereum into develop 2022-09-19 19:23:40 +00:00
Showing only changes of commit fbe263e2cb - Show all commits

View file

@ -67,7 +67,8 @@ std::string ethereum_rpc_client::get_network_id() {
std::string ethereum_rpc_client::get_nonce(const std::string &address) {
std::string reply_str = eth_get_transaction_count("[\"" + address + "\", \"latest\"]");
return retrieve_value_from_reply(reply_str, "");
const auto nonce_val = ethereum::from_hex<boost::multiprecision::uint256_t>(retrieve_value_from_reply(reply_str, ""));
return nonce_val == 0 ? ethereum::add_0x("0") : ethereum::add_0x(ethereum::to_hex(nonce_val));
}
std::string ethereum_rpc_client::get_gas_price() {
@ -639,7 +640,7 @@ std::string sidechain_net_handler_ethereum::sign_transaction(const sidechain_tra
#ifdef SEND_RAW_TRANSACTION
ethereum::raw_transaction raw_tr;
raw_tr.nonce = ethereum::add_0x(ethereum::to_hex(ethereum::from_hex<boost::multiprecision::uint256_t>(rpc_client->get_nonce(ethereum::add_0x(public_key)))));
raw_tr.nonce = rpc_client->get_nonce(ethereum::add_0x(public_key));
raw_tr.gas_price = rpc_client->get_gas_price();
raw_tr.gas_limit = rpc_client->get_gas_limit();
raw_tr.to = wallet_contract_address;