laconicd-deprecated/ethereum/rpc/apis.go
crypto-facs b4d3659547
feat: add txpool namespace RPC methods (#146)
* rpc: add txpool namespace and txpool_content endpoint

* fix PublicTxPoolAPI naming typo

* Update ethereum/rpc/txpool_api.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update ethereum/rpc/txpool_api.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* rpc: add txpool_inspect method

* rpc: add txpool_status method

* docs: Update Changelog with TxPool methods

* docs: Add txpool namespace methods documentation

* fix: removed txpool functions from backend.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-06-21 10:06:30 -04:00

69 lines
1.5 KiB
Go

// Package rpc contains RPC handler methods and utilities to start
// Ethermint's Web3-compatibly JSON-RPC server.
package rpc
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/ethermint/ethereum/rpc/types"
"github.com/ethereum/go-ethereum/rpc"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
)
// RPC namespaces and API version
const (
Web3Namespace = "web3"
EthNamespace = "eth"
PersonalNamespace = "personal"
NetNamespace = "net"
TxPoolNamespace = "txpool"
apiVersion = "1.0"
)
// GetRPCAPIs returns the list of all APIs
func GetRPCAPIs(clientCtx client.Context, tmWSClient *rpcclient.WSClient) []rpc.API {
nonceLock := new(types.AddrLocker)
backend := NewEVMBackend(clientCtx)
ethAPI := NewPublicEthAPI(clientCtx, backend, nonceLock)
return []rpc.API{
{
Namespace: Web3Namespace,
Version: apiVersion,
Service: NewPublicWeb3API(),
Public: true,
},
{
Namespace: EthNamespace,
Version: apiVersion,
Service: ethAPI,
Public: true,
},
{
Namespace: EthNamespace,
Version: apiVersion,
Service: NewPublicFilterAPI(tmWSClient, backend),
Public: true,
},
{
Namespace: NetNamespace,
Version: apiVersion,
Service: NewPublicNetAPI(clientCtx),
Public: true,
},
{
Namespace: PersonalNamespace,
Version: apiVersion,
Service: NewPersonalAPI(ethAPI),
Public: true,
},
{
Namespace: TxPoolNamespace,
Version: apiVersion,
Service: NewPublicTxPoolAPI(),
Public: true,
},
}
}