@ -1,12 +1,13 @@
package proxy
import (
"context"
"github.com/tendermint/tendermint/libs/bytes"
lrpc "github.com/tendermint/tendermint/light/rpc"
rpcclient "github.com/tendermint/tendermint/rpc/client"
"github.com/tendermint/tendermint/rpc/coretypes"
rpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
@ -54,113 +55,113 @@ func RPCRoutes(c *lrpc.Client) map[string]*rpcserver.RPCFunc {
}
}
type rpcHealthFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultHealth , error )
type rpcHealthFunc func ( ctx context . Context ) ( * coretypes . ResultHealth , error )
func makeHealthFunc ( c * lrpc . Client ) rpcHealthFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultHealth , error ) {
return c . Health ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultHealth , error ) {
return c . Health ( ctx )
}
}
type rpcStatusFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultStatus , error )
type rpcStatusFunc func ( ctx context . Context ) ( * coretypes . ResultStatus , error )
// nolint: interfacer
func makeStatusFunc ( c * lrpc . Client ) rpcStatusFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultStatus , error ) {
return c . Status ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultStatus , error ) {
return c . Status ( ctx )
}
}
type rpcNetInfoFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultNetInfo , error )
type rpcNetInfoFunc func ( ctx context . Context ) ( * coretypes . ResultNetInfo , error )
func makeNetInfoFunc ( c * lrpc . Client ) rpcNetInfoFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultNetInfo , error ) {
return c . NetInfo ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultNetInfo , error ) {
return c . NetInfo ( ctx )
}
}
type rpcBlockchainInfoFunc func ( ctx * rpctypes . Context , minHeight , maxHeight int64 ) ( * coretypes . ResultBlockchainInfo , error )
type rpcBlockchainInfoFunc func ( ctx context . Context , minHeight , maxHeight int64 ) ( * coretypes . ResultBlockchainInfo , error )
func makeBlockchainInfoFunc ( c * lrpc . Client ) rpcBlockchainInfoFunc {
return func ( ctx * rpctypes . Context , minHeight , maxHeight int64 ) ( * coretypes . ResultBlockchainInfo , error ) {
return c . BlockchainInfo ( ctx . Context ( ) , minHeight , maxHeight )
return func ( ctx context . Context , minHeight , maxHeight int64 ) ( * coretypes . ResultBlockchainInfo , error ) {
return c . BlockchainInfo ( ctx , minHeight , maxHeight )
}
}
type rpcGenesisFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultGenesis , error )
type rpcGenesisFunc func ( ctx context . Context ) ( * coretypes . ResultGenesis , error )
func makeGenesisFunc ( c * lrpc . Client ) rpcGenesisFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultGenesis , error ) {
return c . Genesis ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultGenesis , error ) {
return c . Genesis ( ctx )
}
}
type rpcGenesisChunkedFunc func ( ctx * rpctypes . Context , chunk uint ) ( * coretypes . ResultGenesisChunk , error )
type rpcGenesisChunkedFunc func ( ctx context . Context , chunk uint ) ( * coretypes . ResultGenesisChunk , error )
func makeGenesisChunkedFunc ( c * lrpc . Client ) rpcGenesisChunkedFunc {
return func ( ctx * rpctypes . Context , chunk uint ) ( * coretypes . ResultGenesisChunk , error ) {
return c . GenesisChunked ( ctx . Context ( ) , chunk )
return func ( ctx context . Context , chunk uint ) ( * coretypes . ResultGenesisChunk , error ) {
return c . GenesisChunked ( ctx , chunk )
}
}
type rpcHeaderFunc func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultHeader , error )
type rpcHeaderFunc func ( ctx context . Context , height * int64 ) ( * coretypes . ResultHeader , error )
func makeHeaderFunc ( c * lrpc . Client ) rpcHeaderFunc {
return func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultHeader , error ) {
return c . Header ( ctx . Context ( ) , height )
return func ( ctx context . Context , height * int64 ) ( * coretypes . ResultHeader , error ) {
return c . Header ( ctx , height )
}
}
type rpcHeaderByHashFunc func ( ctx * rpctypes . Context , hash [ ] byte ) ( * coretypes . ResultHeader , error )
type rpcHeaderByHashFunc func ( ctx context . Context , hash [ ] byte ) ( * coretypes . ResultHeader , error )
func makeHeaderByHashFunc ( c * lrpc . Client ) rpcHeaderByHashFunc {
return func ( ctx * rpctypes . Context , hash [ ] byte ) ( * coretypes . ResultHeader , error ) {
return c . HeaderByHash ( ctx . Context ( ) , hash )
return func ( ctx context . Context , hash [ ] byte ) ( * coretypes . ResultHeader , error ) {
return c . HeaderByHash ( ctx , hash )
}
}
type rpcBlockFunc func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultBlock , error )
type rpcBlockFunc func ( ctx context . Context , height * int64 ) ( * coretypes . ResultBlock , error )
func makeBlockFunc ( c * lrpc . Client ) rpcBlockFunc {
return func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultBlock , error ) {
return c . Block ( ctx . Context ( ) , height )
return func ( ctx context . Context , height * int64 ) ( * coretypes . ResultBlock , error ) {
return c . Block ( ctx , height )
}
}
type rpcBlockByHashFunc func ( ctx * rpctypes . Context , hash [ ] byte ) ( * coretypes . ResultBlock , error )
type rpcBlockByHashFunc func ( ctx context . Context , hash [ ] byte ) ( * coretypes . ResultBlock , error )
func makeBlockByHashFunc ( c * lrpc . Client ) rpcBlockByHashFunc {
return func ( ctx * rpctypes . Context , hash [ ] byte ) ( * coretypes . ResultBlock , error ) {
return c . BlockByHash ( ctx . Context ( ) , hash )
return func ( ctx context . Context , hash [ ] byte ) ( * coretypes . ResultBlock , error ) {
return c . BlockByHash ( ctx , hash )
}
}
type rpcBlockResultsFunc func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultBlockResults , error )
type rpcBlockResultsFunc func ( ctx context . Context , height * int64 ) ( * coretypes . ResultBlockResults , error )
func makeBlockResultsFunc ( c * lrpc . Client ) rpcBlockResultsFunc {
return func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultBlockResults , error ) {
return c . BlockResults ( ctx . Context ( ) , height )
return func ( ctx context . Context , height * int64 ) ( * coretypes . ResultBlockResults , error ) {
return c . BlockResults ( ctx , height )
}
}
type rpcCommitFunc func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultCommit , error )
type rpcCommitFunc func ( ctx context . Context , height * int64 ) ( * coretypes . ResultCommit , error )
func makeCommitFunc ( c * lrpc . Client ) rpcCommitFunc {
return func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultCommit , error ) {
return c . Commit ( ctx . Context ( ) , height )
return func ( ctx context . Context , height * int64 ) ( * coretypes . ResultCommit , error ) {
return c . Commit ( ctx , height )
}
}
type rpcTxFunc func ( ctx * rpctypes . Context , hash [ ] byte , prove bool ) ( * coretypes . ResultTx , error )
type rpcTxFunc func ( ctx context . Context , hash [ ] byte , prove bool ) ( * coretypes . ResultTx , error )
func makeTxFunc ( c * lrpc . Client ) rpcTxFunc {
return func ( ctx * rpctypes . Context , hash [ ] byte , prove bool ) ( * coretypes . ResultTx , error ) {
return c . Tx ( ctx . Context ( ) , hash , prove )
return func ( ctx context . Context , hash [ ] byte , prove bool ) ( * coretypes . ResultTx , error ) {
return c . Tx ( ctx , hash , prove )
}
}
type rpcTxSearchFunc func (
ctx * rpctypes . Context ,
ctx context . Context ,
query string ,
prove bool ,
page , perPage * int ,
@ -169,18 +170,18 @@ type rpcTxSearchFunc func(
func makeTxSearchFunc ( c * lrpc . Client ) rpcTxSearchFunc {
return func (
ctx * rpctypes . Context ,
ctx context . Context ,
query string ,
prove bool ,
page , perPage * int ,
orderBy string ,
) ( * coretypes . ResultTxSearch , error ) {
return c . TxSearch ( ctx . Context ( ) , query , prove , page , perPage , orderBy )
return c . TxSearch ( ctx , query , prove , page , perPage , orderBy )
}
}
type rpcBlockSearchFunc func (
ctx * rpctypes . Context ,
ctx context . Context ,
query string ,
prove bool ,
page , perPage * int ,
@ -189,116 +190,116 @@ type rpcBlockSearchFunc func(
func makeBlockSearchFunc ( c * lrpc . Client ) rpcBlockSearchFunc {
return func (
ctx * rpctypes . Context ,
ctx context . Context ,
query string ,
prove bool ,
page , perPage * int ,
orderBy string ,
) ( * coretypes . ResultBlockSearch , error ) {
return c . BlockSearch ( ctx . Context ( ) , query , page , perPage , orderBy )
return c . BlockSearch ( ctx , query , page , perPage , orderBy )
}
}
type rpcValidatorsFunc func ( ctx * rpctypes . Context , height * int64 ,
type rpcValidatorsFunc func ( ctx context . Context , height * int64 ,
page , perPage * int ) ( * coretypes . ResultValidators , error )
func makeValidatorsFunc ( c * lrpc . Client ) rpcValidatorsFunc {
return func ( ctx * rpctypes . Context , height * int64 , page , perPage * int ) ( * coretypes . ResultValidators , error ) {
return c . Validators ( ctx . Context ( ) , height , page , perPage )
return func ( ctx context . Context , height * int64 , page , perPage * int ) ( * coretypes . ResultValidators , error ) {
return c . Validators ( ctx , height , page , perPage )
}
}
type rpcDumpConsensusStateFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultDumpConsensusState , error )
type rpcDumpConsensusStateFunc func ( ctx context . Context ) ( * coretypes . ResultDumpConsensusState , error )
func makeDumpConsensusStateFunc ( c * lrpc . Client ) rpcDumpConsensusStateFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultDumpConsensusState , error ) {
return c . DumpConsensusState ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultDumpConsensusState , error ) {
return c . DumpConsensusState ( ctx )
}
}
type rpcConsensusStateFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultConsensusState , error )
type rpcConsensusStateFunc func ( ctx context . Context ) ( * coretypes . ResultConsensusState , error )
func makeConsensusStateFunc ( c * lrpc . Client ) rpcConsensusStateFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultConsensusState , error ) {
return c . ConsensusState ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultConsensusState , error ) {
return c . ConsensusState ( ctx )
}
}
type rpcConsensusParamsFunc func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultConsensusParams , error )
type rpcConsensusParamsFunc func ( ctx context . Context , height * int64 ) ( * coretypes . ResultConsensusParams , error )
func makeConsensusParamsFunc ( c * lrpc . Client ) rpcConsensusParamsFunc {
return func ( ctx * rpctypes . Context , height * int64 ) ( * coretypes . ResultConsensusParams , error ) {
return c . ConsensusParams ( ctx . Context ( ) , height )
return func ( ctx context . Context , height * int64 ) ( * coretypes . ResultConsensusParams , error ) {
return c . ConsensusParams ( ctx , height )
}
}
type rpcUnconfirmedTxsFunc func ( ctx * rpctypes . Context , limit * int ) ( * coretypes . ResultUnconfirmedTxs , error )
type rpcUnconfirmedTxsFunc func ( ctx context . Context , limit * int ) ( * coretypes . ResultUnconfirmedTxs , error )
func makeUnconfirmedTxsFunc ( c * lrpc . Client ) rpcUnconfirmedTxsFunc {
return func ( ctx * rpctypes . Context , limit * int ) ( * coretypes . ResultUnconfirmedTxs , error ) {
return c . UnconfirmedTxs ( ctx . Context ( ) , limit )
return func ( ctx context . Context , limit * int ) ( * coretypes . ResultUnconfirmedTxs , error ) {
return c . UnconfirmedTxs ( ctx , limit )
}
}
type rpcNumUnconfirmedTxsFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultUnconfirmedTxs , error )
type rpcNumUnconfirmedTxsFunc func ( ctx context . Context ) ( * coretypes . ResultUnconfirmedTxs , error )
func makeNumUnconfirmedTxsFunc ( c * lrpc . Client ) rpcNumUnconfirmedTxsFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultUnconfirmedTxs , error ) {
return c . NumUnconfirmedTxs ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultUnconfirmedTxs , error ) {
return c . NumUnconfirmedTxs ( ctx )
}
}
type rpcBroadcastTxCommitFunc func ( ctx * rpctypes . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTxCommit , error )
type rpcBroadcastTxCommitFunc func ( ctx context . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTxCommit , error )
func makeBroadcastTxCommitFunc ( c * lrpc . Client ) rpcBroadcastTxCommitFunc {
return func ( ctx * rpctypes . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTxCommit , error ) {
return c . BroadcastTxCommit ( ctx . Context ( ) , tx )
return func ( ctx context . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTxCommit , error ) {
return c . BroadcastTxCommit ( ctx , tx )
}
}
type rpcBroadcastTxSyncFunc func ( ctx * rpctypes . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error )
type rpcBroadcastTxSyncFunc func ( ctx context . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error )
func makeBroadcastTxSyncFunc ( c * lrpc . Client ) rpcBroadcastTxSyncFunc {
return func ( ctx * rpctypes . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error ) {
return c . BroadcastTxSync ( ctx . Context ( ) , tx )
return func ( ctx context . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error ) {
return c . BroadcastTxSync ( ctx , tx )
}
}
type rpcBroadcastTxAsyncFunc func ( ctx * rpctypes . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error )
type rpcBroadcastTxAsyncFunc func ( ctx context . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error )
func makeBroadcastTxAsyncFunc ( c * lrpc . Client ) rpcBroadcastTxAsyncFunc {
return func ( ctx * rpctypes . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error ) {
return c . BroadcastTxAsync ( ctx . Context ( ) , tx )
return func ( ctx context . Context , tx types . Tx ) ( * coretypes . ResultBroadcastTx , error ) {
return c . BroadcastTxAsync ( ctx , tx )
}
}
type rpcABCIQueryFunc func ( ctx * rpctypes . Context , path string ,
type rpcABCIQueryFunc func ( ctx context . Context , path string ,
data bytes . HexBytes , height int64 , prove bool ) ( * coretypes . ResultABCIQuery , error )
func makeABCIQueryFunc ( c * lrpc . Client ) rpcABCIQueryFunc {
return func ( ctx * rpctypes . Context , path string , data bytes . HexBytes ,
return func ( ctx context . Context , path string , data bytes . HexBytes ,
height int64 , prove bool ) ( * coretypes . ResultABCIQuery , error ) {
return c . ABCIQueryWithOptions ( ctx . Context ( ) , path , data , rpcclient . ABCIQueryOptions {
return c . ABCIQueryWithOptions ( ctx , path , data , rpcclient . ABCIQueryOptions {
Height : height ,
Prove : prove ,
} )
}
}
type rpcABCIInfoFunc func ( ctx * rpctypes . Context ) ( * coretypes . ResultABCIInfo , error )
type rpcABCIInfoFunc func ( ctx context . Context ) ( * coretypes . ResultABCIInfo , error )
func makeABCIInfoFunc ( c * lrpc . Client ) rpcABCIInfoFunc {
return func ( ctx * rpctypes . Context ) ( * coretypes . ResultABCIInfo , error ) {
return c . ABCIInfo ( ctx . Context ( ) )
return func ( ctx context . Context ) ( * coretypes . ResultABCIInfo , error ) {
return c . ABCIInfo ( ctx )
}
}
type rpcBroadcastEvidenceFunc func ( ctx * rpctypes . Context , ev types . Evidence ) ( * coretypes . ResultBroadcastEvidence , error )
type rpcBroadcastEvidenceFunc func ( ctx context . Context , ev types . Evidence ) ( * coretypes . ResultBroadcastEvidence , error )
// nolint: interfacer
func makeBroadcastEvidenceFunc ( c * lrpc . Client ) rpcBroadcastEvidenceFunc {
return func ( ctx * rpctypes . Context , ev types . Evidence ) ( * coretypes . ResultBroadcastEvidence , error ) {
return c . BroadcastEvidence ( ctx . Context ( ) , ev )
return func ( ctx context . Context , ev types . Evidence ) ( * coretypes . ResultBroadcastEvidence , error ) {
return c . BroadcastEvidence ( ctx , ev )
}
}