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