forked from okx/xlayer-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints_txpool.go
38 lines (32 loc) · 1.21 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
package jsonrpc
import (
"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 argUint64 `json:"nonce"`
GasPrice argBig `json:"gasPrice"`
Gas argUint64 `json:"gas"`
To *common.Address `json:"to"`
Value argBig `json:"value"`
Input 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{}, rpcError) {
resp := contentResponse{
Pending: make(map[common.Address]map[uint64]*txPoolTransaction),
Queued: make(map[common.Address]map[uint64]*txPoolTransaction),
}
return resp, nil
}