laconicd-deprecated/rpc/namespaces/ethereum/miner/api.go
Daniel Burckhardt e70d8fcb56
chore(rpc): restructure JSON-RPC APIs (#1218)
* move non api methods from eth/api.go to evm_backend: ClientCtx, QueryClient, Ctx, getBlockNumber, getTransactionByBlockAndIndex, doCall

* organize eth/api.go into sections and move backend logic to dedicated files

* remove unnecesary comment

* move resend to the backend

* refractor eth api

* refractor debug namespace

* refactor miner namespace

* refactor personal namespace

* update transactionReceipt from upstream

* update getBlockByNumber from upstream

* update getBalance from upstream

* update getProof from upstream

* update getBalance from upstream

* fix linter

* remove duplicated import

* remove duplicated import

* fix backend tests

* fix lint

* fix duplicated imports

* fix linter

* reorganize blocks

* backend folder refractor

* remove unnecessary file

* remove duplicate import

Co-authored-by: Freddy Caceres <facs95@gmail.com>
2022-08-09 07:52:28 +02:00

37 lines
800 B
Go

package miner
import (
"github.com/cosmos/cosmos-sdk/server"
"github.com/ethereum/go-ethereum/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/evmos/ethermint/rpc/backend"
)
// API is the private miner prefixed set of APIs in the Miner JSON-RPC spec.
type API struct {
ctx *server.Context
logger log.Logger
backend backend.EVMBackend
}
// NewPrivateAPI creates an instance of the Miner API.
func NewPrivateAPI(
ctx *server.Context,
backend backend.EVMBackend,
) *API {
return &API{
ctx: ctx,
logger: ctx.Logger.With("api", "miner"),
backend: backend,
}
}
// SetEtherbase sets the etherbase of the miner
func (api *API) SetEtherbase(etherbase common.Address) bool {
api.logger.Debug("miner_setEtherbase")
return api.backend.SetEtherbase(etherbase)
}