rpc: geth v1.10.9 changes (#624)

* rpc: geth v1.10.9 changes

* updates

* suggestGasTipCap

* update gRPC

* resend

* fixes

* rm unused func

* address TODO
This commit is contained in:
Federico Kunze Küllmer
2021-10-06 11:22:32 +00:00
committed by GitHub
parent 202bc5f1cd
commit bcdb982886
17 changed files with 427 additions and 221 deletions
+18 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/hex"
"encoding/json"
"math/big"
"net/http"
"strings"
@@ -15,6 +16,7 @@ import (
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
rpctypes "github.com/tharsis/ethermint/rpc/ethereum/types"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
"github.com/ethereum/go-ethereum/common"
)
@@ -79,6 +81,17 @@ func getEthTransactionByHash(clientCtx client.Context, hashHex string) ([]byte,
return nil, err
}
client := feemarkettypes.NewQueryClient(clientCtx)
res, err := client.BaseFee(context.Background(), &feemarkettypes.QueryBaseFeeRequest{})
if err != nil {
return nil, err
}
var baseFee *big.Int
if res.BaseFee != nil {
baseFee = res.BaseFee.BigInt()
}
blockHash := common.BytesToHash(block.Block.Header.Hash())
ethTx, err := rpctypes.RawTxToEthTx(clientCtx, tx.Tx)
@@ -87,7 +100,11 @@ func getEthTransactionByHash(clientCtx client.Context, hashHex string) ([]byte,
}
height := uint64(tx.Height)
rpcTx := rpctypes.NewTransaction(ethTx.AsTransaction(), blockHash, height, uint64(tx.Index))
rpcTx, err := rpctypes.NewRPCTransaction(ethTx.AsTransaction(), blockHash, height, uint64(tx.Index), baseFee)
if err != nil {
return nil, err
}
return json.Marshal(rpcTx)
}