v1

package
v2.12.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const ParamCustom = "custom"

Variables

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGov        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGov          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ParamStoreKeyCustomParams = []byte("customparams")
	CertVotesKeyPrefix        = []byte("certvote")
)

parameter store keys

View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)

Functions

func CertVotesKey

func CertVotesKey(proposalID uint64) []byte

CertVotesKey gets the first part of the cert votes key based on the proposalID

func GetProposalIDBytes added in v2.12.0

func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte)

GetProposalIDBytes returns the byte representation of the proposalID

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable is the key declaration for parameters.

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func ValidateGenesis

func ValidateGenesis(data *GenesisState) error

ValidateGenesis validates gov genesis data.

Types

type CustomParams

type CustomParams struct {
	CertifierUpdateSecurityVoteTally *v1.TallyParams `` /* 163-byte string literal not displayed */
	CertifierUpdateStakeVoteTally    *v1.TallyParams `` /* 154-byte string literal not displayed */
}

func (*CustomParams) Descriptor

func (*CustomParams) Descriptor() ([]byte, []int)

func (*CustomParams) GetCertifierUpdateSecurityVoteTally

func (m *CustomParams) GetCertifierUpdateSecurityVoteTally() *v1.TallyParams

func (*CustomParams) GetCertifierUpdateStakeVoteTally

func (m *CustomParams) GetCertifierUpdateStakeVoteTally() *v1.TallyParams

func (*CustomParams) Marshal

func (m *CustomParams) Marshal() (dAtA []byte, err error)

func (*CustomParams) MarshalTo

func (m *CustomParams) MarshalTo(dAtA []byte) (int, error)

func (*CustomParams) MarshalToSizedBuffer

func (m *CustomParams) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CustomParams) ProtoMessage

func (*CustomParams) ProtoMessage()

func (*CustomParams) Reset

func (m *CustomParams) Reset()

func (*CustomParams) Size

func (m *CustomParams) Size() (n int)

func (*CustomParams) String

func (m *CustomParams) String() string

func (*CustomParams) Unmarshal

func (m *CustomParams) Unmarshal(dAtA []byte) error

func (*CustomParams) XXX_DiscardUnknown

func (m *CustomParams) XXX_DiscardUnknown()

func (*CustomParams) XXX_Marshal

func (m *CustomParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CustomParams) XXX_Merge

func (m *CustomParams) XXX_Merge(src proto.Message)

func (*CustomParams) XXX_Size

func (m *CustomParams) XXX_Size() int

func (*CustomParams) XXX_Unmarshal

func (m *CustomParams) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	// starting_proposal_id is the ID of the starting proposal.
	StartingProposalId uint64 `protobuf:"varint,1,opt,name=starting_proposal_id,json=startingProposalId,proto3" json:"starting_proposal_id,omitempty"`
	// deposits defines all the deposits present at genesis.
	Deposits []*v1.Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits,omitempty"`
	// votes defines all the votes present at genesis.
	Votes []*v1.Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"`
	// proposals defines all the proposals present at genesis.
	Proposals []*v1.Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"`
	// params defines all the parameters of related to deposit.
	DepositParams *v1.DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"`
	// params defines all the parameters of related to voting.
	VotingParams *v1.VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"`
	// params defines all the parameters of related to tally.
	TallyParams *v1.TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"`
	// params defines all the paramaters of x/gov module.
	//
	// Since: cosmos-sdk 0.47
	Params *v1.Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params,omitempty"`
	// The constitution allows builders to lay a foundation and define purpose.
	// This is an immutable string set in genesis.
	// There are no amendments, to go outside of scope, just fork.
	// constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals.
	//
	// Since: cosmos-sdk 0.50
	Constitution string `protobuf:"bytes,9,opt,name=constitution,proto3" json:"constitution,omitempty"`
	// params defines all the parameters of related to custom.
	CustomParams *CustomParams `protobuf:"bytes,10,opt,name=custom_params,json=customParams,proto3" json:"custom_params,omitempty"`
	// proposals that require and have passed cert votes.
	CertVotedProposalIds []uint64 `` /* 134-byte string literal not displayed */
}

GenesisState defines the gov module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState creates a default GenesisState object.

func NewGenesisState added in v2.11.1

func NewGenesisState(startingProposalID uint64, params govtypesv1.Params, customParams CustomParams) *GenesisState

NewGenesisState creates a new genesis state for the governance module

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetCertVotedProposalIds

func (m *GenesisState) GetCertVotedProposalIds() []uint64

func (*GenesisState) GetConstitution added in v2.12.0

func (m *GenesisState) GetConstitution() string

func (*GenesisState) GetCustomParams

func (m *GenesisState) GetCustomParams() *CustomParams

func (*GenesisState) GetDepositParams

func (m *GenesisState) GetDepositParams() *v1.DepositParams

func (*GenesisState) GetDeposits

func (m *GenesisState) GetDeposits() []*v1.Deposit

func (*GenesisState) GetParams added in v2.11.0

func (m *GenesisState) GetParams() *v1.Params

func (*GenesisState) GetProposals

func (m *GenesisState) GetProposals() []*v1.Proposal

func (*GenesisState) GetStartingProposalId

func (m *GenesisState) GetStartingProposalId() uint64

func (*GenesisState) GetTallyParams

func (m *GenesisState) GetTallyParams() *v1.TallyParams

func (*GenesisState) GetVotes

func (m *GenesisState) GetVotes() []*v1.Vote

func (*GenesisState) GetVotingParams

func (m *GenesisState) GetVotingParams() *v1.VotingParams

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) UnpackInterfaces

func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	VotingParams  govtypesv1.VotingParams  `json:"voting_params" yaml:"voting_params"`
	TallyParams   govtypesv1.TallyParams   `json:"tally_params" yaml:"tally_params"`
	DepositParams govtypesv1.DepositParams `json:"deposit_params" yaml:"deposit_parmas"`
	CustomParams  CustomParams             `json:"custom_params" yaml:"custom_params"`
}

Params returns all the governance params

func NewParams

NewParams returns a Params structs including voting, deposit and tally params

func (Params) String

func (gp Params) String() string

type QueryCertVotedRequest

type QueryCertVotedRequest struct {
	// proposal_id defines the unique id of the proposal.
	ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
}

func (*QueryCertVotedRequest) Descriptor

func (*QueryCertVotedRequest) Descriptor() ([]byte, []int)

func (*QueryCertVotedRequest) GetProposalId

func (m *QueryCertVotedRequest) GetProposalId() uint64

func (*QueryCertVotedRequest) Marshal

func (m *QueryCertVotedRequest) Marshal() (dAtA []byte, err error)

func (*QueryCertVotedRequest) MarshalTo

func (m *QueryCertVotedRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryCertVotedRequest) MarshalToSizedBuffer

func (m *QueryCertVotedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryCertVotedRequest) ProtoMessage

func (*QueryCertVotedRequest) ProtoMessage()

func (*QueryCertVotedRequest) Reset

func (m *QueryCertVotedRequest) Reset()

func (*QueryCertVotedRequest) Size

func (m *QueryCertVotedRequest) Size() (n int)

func (*QueryCertVotedRequest) String

func (m *QueryCertVotedRequest) String() string

func (*QueryCertVotedRequest) Unmarshal

func (m *QueryCertVotedRequest) Unmarshal(dAtA []byte) error

func (*QueryCertVotedRequest) XXX_DiscardUnknown

func (m *QueryCertVotedRequest) XXX_DiscardUnknown()

func (*QueryCertVotedRequest) XXX_Marshal

func (m *QueryCertVotedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryCertVotedRequest) XXX_Merge

func (m *QueryCertVotedRequest) XXX_Merge(src proto.Message)

func (*QueryCertVotedRequest) XXX_Size

func (m *QueryCertVotedRequest) XXX_Size() int

func (*QueryCertVotedRequest) XXX_Unmarshal

func (m *QueryCertVotedRequest) XXX_Unmarshal(b []byte) error

type QueryCertVotedResponse

type QueryCertVotedResponse struct {
	CertVoted bool `protobuf:"varint,1,opt,name=cert_voted,json=certVoted,proto3" json:"cert_voted,omitempty"`
}

QueryProposalResponse is the response type for the Query/Proposal RPC method.

func (*QueryCertVotedResponse) Descriptor

func (*QueryCertVotedResponse) Descriptor() ([]byte, []int)

func (*QueryCertVotedResponse) GetCertVoted

func (m *QueryCertVotedResponse) GetCertVoted() bool

func (*QueryCertVotedResponse) Marshal

func (m *QueryCertVotedResponse) Marshal() (dAtA []byte, err error)

func (*QueryCertVotedResponse) MarshalTo

func (m *QueryCertVotedResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryCertVotedResponse) MarshalToSizedBuffer

func (m *QueryCertVotedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryCertVotedResponse) ProtoMessage

func (*QueryCertVotedResponse) ProtoMessage()

func (*QueryCertVotedResponse) Reset

func (m *QueryCertVotedResponse) Reset()

func (*QueryCertVotedResponse) Size

func (m *QueryCertVotedResponse) Size() (n int)

func (*QueryCertVotedResponse) String

func (m *QueryCertVotedResponse) String() string

func (*QueryCertVotedResponse) Unmarshal

func (m *QueryCertVotedResponse) Unmarshal(dAtA []byte) error

func (*QueryCertVotedResponse) XXX_DiscardUnknown

func (m *QueryCertVotedResponse) XXX_DiscardUnknown()

func (*QueryCertVotedResponse) XXX_Marshal

func (m *QueryCertVotedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryCertVotedResponse) XXX_Merge

func (m *QueryCertVotedResponse) XXX_Merge(src proto.Message)

func (*QueryCertVotedResponse) XXX_Size

func (m *QueryCertVotedResponse) XXX_Size() int

func (*QueryCertVotedResponse) XXX_Unmarshal

func (m *QueryCertVotedResponse) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// Constitution queries the chain's constitution.
	Constitution(ctx context.Context, in *v1.QueryConstitutionRequest, opts ...grpc.CallOption) (*v1.QueryConstitutionResponse, error)
	// Proposal queries proposal details based on ProposalID.
	Proposal(ctx context.Context, in *v1.QueryProposalRequest, opts ...grpc.CallOption) (*v1.QueryProposalResponse, error)
	// Proposals queries all proposals based on given status.
	Proposals(ctx context.Context, in *v1.QueryProposalsRequest, opts ...grpc.CallOption) (*v1.QueryProposalsResponse, error)
	// Vote queries voted information based on proposalID, voterAddr.
	Vote(ctx context.Context, in *v1.QueryVoteRequest, opts ...grpc.CallOption) (*v1.QueryVoteResponse, error)
	// Votes queries votes of a given proposal.
	Votes(ctx context.Context, in *v1.QueryVotesRequest, opts ...grpc.CallOption) (*v1.QueryVotesResponse, error)
	// Params queries all parameters of the gov module.
	Params(ctx context.Context, in *v1.QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// Deposit queries single deposit information based proposalID, depositAddr.
	Deposit(ctx context.Context, in *v1.QueryDepositRequest, opts ...grpc.CallOption) (*v1.QueryDepositResponse, error)
	// Deposits queries all deposits of a single proposal.
	Deposits(ctx context.Context, in *v1.QueryDepositsRequest, opts ...grpc.CallOption) (*v1.QueryDepositsResponse, error)
	// TallyResult queries the tally of a proposal vote.
	TallyResult(ctx context.Context, in *v1.QueryTallyResultRequest, opts ...grpc.CallOption) (*v1.QueryTallyResultResponse, error)
	// Proposal queries proposal details based on ProposalID.
	CertVoted(ctx context.Context, in *QueryCertVotedRequest, opts ...grpc.CallOption) (*QueryCertVotedResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryParamsResponse

type QueryParamsResponse struct {
	// voting_params defines the parameters related to voting.
	VotingParams *v1.VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"`
	// deposit_params defines the parameters related to deposit.
	DepositParams *v1.DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"`
	// tally_params defines the parameters related to tally.
	TallyParams *v1.TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"`
	// custom_params defines the parameters related to custom.
	// params defines all the paramaters of x/gov module.
	//
	// Since: cosmos-sdk 0.47
	Params       *v1.Params    `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"`
	CustomParams *CustomParams `protobuf:"bytes,5,opt,name=custom_params,json=customParams,proto3" json:"custom_params,omitempty"`
}

QueryParamsResponse is the response type for the Query/Params RPC method.

func (*QueryParamsResponse) Descriptor

func (*QueryParamsResponse) Descriptor() ([]byte, []int)

func (*QueryParamsResponse) GetCustomParams

func (m *QueryParamsResponse) GetCustomParams() *CustomParams

func (*QueryParamsResponse) GetDepositParams

func (m *QueryParamsResponse) GetDepositParams() *v1.DepositParams

func (*QueryParamsResponse) GetParams added in v2.11.0

func (m *QueryParamsResponse) GetParams() *v1.Params

func (*QueryParamsResponse) GetTallyParams

func (m *QueryParamsResponse) GetTallyParams() *v1.TallyParams

func (*QueryParamsResponse) GetVotingParams

func (m *QueryParamsResponse) GetVotingParams() *v1.VotingParams

func (*QueryParamsResponse) Marshal

func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)

func (*QueryParamsResponse) MarshalTo

func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsResponse) MarshalToSizedBuffer

func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

func (m *QueryParamsResponse) Size() (n int)

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsResponse) XXX_Merge

func (m *QueryParamsResponse) XXX_Merge(src proto.Message)

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// Constitution queries the chain's constitution.
	Constitution(context.Context, *v1.QueryConstitutionRequest) (*v1.QueryConstitutionResponse, error)
	// Proposal queries proposal details based on ProposalID.
	Proposal(context.Context, *v1.QueryProposalRequest) (*v1.QueryProposalResponse, error)
	// Proposals queries all proposals based on given status.
	Proposals(context.Context, *v1.QueryProposalsRequest) (*v1.QueryProposalsResponse, error)
	// Vote queries voted information based on proposalID, voterAddr.
	Vote(context.Context, *v1.QueryVoteRequest) (*v1.QueryVoteResponse, error)
	// Votes queries votes of a given proposal.
	Votes(context.Context, *v1.QueryVotesRequest) (*v1.QueryVotesResponse, error)
	// Params queries all parameters of the gov module.
	Params(context.Context, *v1.QueryParamsRequest) (*QueryParamsResponse, error)
	// Deposit queries single deposit information based proposalID, depositAddr.
	Deposit(context.Context, *v1.QueryDepositRequest) (*v1.QueryDepositResponse, error)
	// Deposits queries all deposits of a single proposal.
	Deposits(context.Context, *v1.QueryDepositsRequest) (*v1.QueryDepositsResponse, error)
	// TallyResult queries the tally of a proposal vote.
	TallyResult(context.Context, *v1.QueryTallyResultRequest) (*v1.QueryTallyResultResponse, error)
	// Proposal queries proposal details based on ProposalID.
	CertVoted(context.Context, *QueryCertVotedRequest) (*QueryCertVotedResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) CertVoted

func (*UnimplementedQueryServer) Constitution added in v2.12.0

func (*UnimplementedQueryServer) Deposit

func (*UnimplementedQueryServer) Deposits

func (*UnimplementedQueryServer) Params

func (*UnimplementedQueryServer) Proposal

func (*UnimplementedQueryServer) Proposals

func (*UnimplementedQueryServer) TallyResult

func (*UnimplementedQueryServer) Vote

func (*UnimplementedQueryServer) Votes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL