diff --git a/api/api.go b/api/api.go index 0838582d..d40c03ed 100644 --- a/api/api.go +++ b/api/api.go @@ -41,6 +41,9 @@ func SupportedAPIs(blockChainAPI *BlockChainAPI, streamAPI *StreamAPI, pullAPI * }, { Namespace: "net", Service: &NetAPI{}, + }, { + Namespace: "txpool", + Service: NewTxPoolAPI(), }} } diff --git a/api/pool.go b/api/pool.go new file mode 100644 index 00000000..4d1a5430 --- /dev/null +++ b/api/pool.go @@ -0,0 +1,43 @@ +package api + +import ( + "github.com/onflow/go-ethereum/common" + "github.com/onflow/go-ethereum/common/hexutil" +) + +type TxPool struct{} + +func NewTxPoolAPI() *TxPool { + return &TxPool{} +} + +type content struct { + Pending any + Queued any +} + +func emptyPool() content { + return content{ + Pending: struct{}{}, + Queued: struct{}{}, + } +} + +func (s *TxPool) Content() content { + return emptyPool() +} + +func (s *TxPool) ContentFrom(addr common.Address) content { + return emptyPool() +} + +func (s *TxPool) Status() map[string]hexutil.Uint { + return map[string]hexutil.Uint{ + "pending": hexutil.Uint(0), + "queued": hexutil.Uint(0), + } +} + +func (s *TxPool) Inspect() content { + return emptyPool() +} diff --git a/api/server.go b/api/server.go index 3b418a22..cd7bc18d 100644 --- a/api/server.go +++ b/api/server.go @@ -419,10 +419,17 @@ func (w *loggingResponseWriter) Write(data []byte) (int, error) { _ = json.Unmarshal(data, &body) delete(body, "jsonrpc") - w.logger. - Debug(). - Fields(body). - Msg("API response") + if body["error"] != nil { + w.logger. + Error(). + Fields(body). + Msg("API response") + } else { + w.logger. + Debug(). + Fields(body). + Msg("API response") + } return w.ResponseWriter.Write(data) }