Skip to content

Commit

Permalink
Merge branch 'develop' into fix-btc-gasrate
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie authored Oct 10, 2023
2 parents 2848fcb + aaefa00 commit 9e69b1b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 63 deletions.
121 changes: 62 additions & 59 deletions rpc/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ import (
ethermint "github.com/evmos/ethermint/types"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
"github.com/zeta-chain/zetacore/rpc/backend"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/debug"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/miner"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/net"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/personal"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/txpool"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/web3"
)

Expand Down Expand Up @@ -105,66 +109,65 @@ func init() {
},
}
},
// Disabled
// NOTE: Public field of API is deprecated and defined only for compatibility.
//PersonalNamespace: func(ctx *server.Context,
// clientCtx client.Context,
// _ *rpcclient.WSClient,
// allowUnprotectedTxs bool,
// indexer ethermint.EVMTxIndexer,
//) []rpc.API {
// evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
// return []rpc.API{
// {
// Namespace: PersonalNamespace,
// Version: apiVersion,
// Service: personal.NewAPI(ctx.Logger, evmBackend),
// Public: false,
// },
// }
//},
//TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API {
// return []rpc.API{
// {
// Namespace: TxPoolNamespace,
// Version: apiVersion,
// Service: txpool.NewPublicAPI(ctx.Logger),
// Public: true,
// },
// }
//},
//DebugNamespace: func(ctx *server.Context,
// clientCtx client.Context,
// _ *rpcclient.WSClient,
// allowUnprotectedTxs bool,
// indexer ethermint.EVMTxIndexer,
//) []rpc.API {
// evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
// return []rpc.API{
// {
// Namespace: DebugNamespace,
// Version: apiVersion,
// Service: debug.NewAPI(ctx, evmBackend),
// Public: true,
// },
// }
//},
//MinerNamespace: func(ctx *server.Context,
// clientCtx client.Context,
// _ *rpcclient.WSClient,
// allowUnprotectedTxs bool,
// indexer ethermint.EVMTxIndexer,
//) []rpc.API {
// evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
// return []rpc.API{
// {
// Namespace: MinerNamespace,
// Version: apiVersion,
// Service: miner.NewPrivateAPI(ctx, evmBackend),
// Public: false,
// },
// }
//},
PersonalNamespace: func(ctx *server.Context,
clientCtx client.Context,
_ *rpcclient.WSClient,
allowUnprotectedTxs bool,
indexer ethermint.EVMTxIndexer,
) []rpc.API {
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
return []rpc.API{
{
Namespace: PersonalNamespace,
Version: apiVersion,
Service: personal.NewAPI(ctx.Logger, evmBackend),
Public: false,
},
}
},
TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API {
return []rpc.API{
{
Namespace: TxPoolNamespace,
Version: apiVersion,
Service: txpool.NewPublicAPI(ctx.Logger),
Public: true,
},
}
},
DebugNamespace: func(ctx *server.Context,
clientCtx client.Context,
_ *rpcclient.WSClient,
allowUnprotectedTxs bool,
indexer ethermint.EVMTxIndexer,
) []rpc.API {
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
return []rpc.API{
{
Namespace: DebugNamespace,
Version: apiVersion,
Service: debug.NewAPI(ctx, evmBackend),
Public: true,
},
}
},
MinerNamespace: func(ctx *server.Context,
clientCtx client.Context,
_ *rpcclient.WSClient,
allowUnprotectedTxs bool,
indexer ethermint.EVMTxIndexer,
) []rpc.API {
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
return []rpc.API{
{
Namespace: MinerNamespace,
Version: apiVersion,
Service: miner.NewPrivateAPI(ctx, evmBackend),
Public: false,
},
}
},
}
}

Expand Down
6 changes: 2 additions & 4 deletions rpc/namespaces/ethereum/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ type EthereumAPI interface {
// eth_submitWork (on Ethereum.org)
// eth_submitHashrate (on Ethereum.org)

// Disabled APIs for security reasons
// Disabled
//SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error)
//Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
//SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error)
Expand Down Expand Up @@ -507,9 +507,7 @@ func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error)
return result, nil
}

///////////////////////////////////////////////////////////////////////////////
/// Disabled ///
///////////////////////////////////////////////////////////////////////////////
// Disabled

//// SendTransaction sends an Ethereum transaction.
//func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) {
Expand Down

0 comments on commit 9e69b1b

Please sign in to comment.