/*
 * Created by Michael Carrara <michael.carrara@breadwallet.com> on 5/31/18.
 * Copyright (c) 2018 Breadwinner AG.  All right reserved.
 *
 * See the LICENSE file at the project root for license information.
 * See the CONTRIBUTORS file at the project root for a list of contributors.
 */
package com.breadwallet.crypto.blockchaindb.apis.brd;

import com.breadwallet.crypto.blockchaindb.errors.QueryError;
import com.breadwallet.crypto.utility.CompletionHandler;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import org.json.JSONObject;

public class EthGasApi {

    private final BrdApiClient client;

    public EthGasApi(BrdApiClient client) {
        this.client = client;
    }

    public void getGasPriceAsEth(String networkName, int rid, CompletionHandler<String, QueryError> handler) {
        JSONObject json = new JSONObject(ImmutableMap.of(
                "jsonrpc", "2.0",
                "method", "eth_gasPrice",
                "params", ImmutableList.of(),
                "id", rid
        ));

        client.sendJsonRequest(networkName, json, handler);
    }

    public void getGasEstimateAsEth(String networkName, String from, String to, String amount, String data, int rid,
                                    CompletionHandler<String, QueryError> handler) {
        JSONObject json = new JSONObject(ImmutableMap.of(
                "jsonrpc", "2.0",
                "method", "eth_estimateGas",
                "params", ImmutableList.of(ImmutableMap.of("from", from, "to", to, "amount", amount, "data", data)),
                "id", rid
        ));

        client.sendJsonRequest(networkName, json, handler);
    }
}

@@ -1321,32 +1321,337 @@
 ror%3E handler) %7B%0A
+        ImmutableMap.Builder%3CString, String%3E paramsBuilder = new ImmutableMap.Builder%3C%3E();%0A        paramsBuilder.put(%22from%22, from);%0A        paramsBuilder.put(%22to%22, to);%0A        if (!amount.equals(%220x%22)) paramsBuilder.put(%22value%22, amount);%0A        if (!data.equals(%220x%22)) paramsBuilder.put(%22data%22, data);%0A%0A
         JSONObje
@@ -1818,78 +1818,28 @@
 .of(
-ImmutableMap.of(%22from%22, from, %22to%22, to, %22amount%22, amount, %22data%22, data
+paramsBuilder.build(
 )),%0A

Update eth_estimateGas request builder in Java