2020-07-25 17:18:18 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/commands"
|
2020-08-11 21:09:30 +00:00
|
|
|
"github.com/ledgerwatch/turbo-geth/core"
|
2020-08-12 13:47:59 +00:00
|
|
|
"github.com/ledgerwatch/turbo-geth/eth"
|
2020-07-25 17:18:18 +00:00
|
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/node"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/rpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RPCDaemonService is used in js console and console tests
|
|
|
|
type RPCDaemonService struct {
|
2020-08-12 13:47:59 +00:00
|
|
|
api []rpc.API
|
|
|
|
db *ethdb.ObjectDatabase
|
|
|
|
ethBackend *eth.Ethereum
|
2020-07-25 17:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-15 19:55:09 +00:00
|
|
|
func New(db *ethdb.ObjectDatabase, ethBackend *eth.Ethereum, stack *node.Node) *RPCDaemonService {
|
|
|
|
service := &RPCDaemonService{[]rpc.API{}, db, ethBackend}
|
|
|
|
apis := commands.GetAPI(db.KV(), core.NewEthBackend(ethBackend), []string{"eth", "debug"})
|
2020-08-15 17:32:05 +00:00
|
|
|
|
|
|
|
stack.RegisterAPIs(apis)
|
2020-07-25 17:18:18 +00:00
|
|
|
|
2020-08-15 17:32:05 +00:00
|
|
|
return service
|
2020-07-25 17:18:18 +00:00
|
|
|
}
|