github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/jsonrpc/endpoints_txpool.go (about)

     1  package jsonrpc
     2  
     3  import (
     4  	"github.com/0xPolygon/supernets2-node/jsonrpc/types"
     5  	"github.com/ethereum/go-ethereum/common"
     6  )
     7  
     8  // TxPoolEndpoints is the txpool jsonrpc endpoint
     9  type TxPoolEndpoints struct{}
    10  
    11  type contentResponse struct {
    12  	Pending map[common.Address]map[uint64]*txPoolTransaction `json:"pending"`
    13  	Queued  map[common.Address]map[uint64]*txPoolTransaction `json:"queued"`
    14  }
    15  
    16  type txPoolTransaction struct {
    17  	Nonce       types.ArgUint64 `json:"nonce"`
    18  	GasPrice    types.ArgBig    `json:"gasPrice"`
    19  	Gas         types.ArgUint64 `json:"gas"`
    20  	To          *common.Address `json:"to"`
    21  	Value       types.ArgBig    `json:"value"`
    22  	Input       types.ArgBytes  `json:"input"`
    23  	Hash        common.Hash     `json:"hash"`
    24  	From        common.Address  `json:"from"`
    25  	BlockHash   common.Hash     `json:"blockHash"`
    26  	BlockNumber interface{}     `json:"blockNumber"`
    27  	TxIndex     interface{}     `json:"transactionIndex"`
    28  }
    29  
    30  // Content creates a response for txpool_content request.
    31  // See https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content.
    32  func (e *TxPoolEndpoints) Content() (interface{}, types.Error) {
    33  	resp := contentResponse{
    34  		Pending: make(map[common.Address]map[uint64]*txPoolTransaction),
    35  		Queued:  make(map[common.Address]map[uint64]*txPoolTransaction),
    36  	}
    37  
    38  	return resp, nil
    39  }