Documentation ¶
Overview ¶
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func ParamKeyTable() paramtypes.KeyTable
- func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
- func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
- func RegisterQueryServer(s grpc1.Server, srv QueryServer)
- func ValidateGenesis(data GenesisState) error
- type AccountKeeper
- type BankKeeper
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetLastBlockTime() *time.Time
- func (m *GenesisState) GetParams() Params
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type InflationSchedule
- func (*InflationSchedule) Descriptor() ([]byte, []int)
- func (m *InflationSchedule) GetEndTime() time.Time
- func (m *InflationSchedule) GetStartTime() time.Time
- func (m *InflationSchedule) Marshal() (dAtA []byte, err error)
- func (m *InflationSchedule) MarshalTo(dAtA []byte) (int, error)
- func (m *InflationSchedule) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*InflationSchedule) ProtoMessage()
- func (m *InflationSchedule) Reset()
- func (m *InflationSchedule) Size() (n int)
- func (m *InflationSchedule) String() string
- func (m *InflationSchedule) Unmarshal(dAtA []byte) error
- func (m *InflationSchedule) XXX_DiscardUnknown()
- func (m *InflationSchedule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *InflationSchedule) XXX_Merge(src proto.Message)
- func (m *InflationSchedule) XXX_Size() int
- func (m *InflationSchedule) XXX_Unmarshal(b []byte) error
- type Params
- func (*Params) Descriptor() ([]byte, []int)
- func (m *Params) GetBlockTimeThreshold() time.Duration
- func (m *Params) GetInflationSchedules() []InflationSchedule
- func (m *Params) GetMintDenom() string
- func (m *Params) GetMintPoolAddress() string
- func (m *Params) Marshal() (dAtA []byte, err error)
- func (m *Params) MarshalTo(dAtA []byte) (int, error)
- func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs
- func (*Params) ProtoMessage()
- func (m *Params) Reset()
- func (m *Params) Size() (n int)
- func (m *Params) String() string
- func (m *Params) Unmarshal(dAtA []byte) error
- func (p Params) Validate() error
- func (m *Params) XXX_DiscardUnknown()
- func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Params) XXX_Merge(src proto.Message)
- func (m *Params) XXX_Size() int
- func (m *Params) XXX_Unmarshal(b []byte) error
- type QueryClient
- type QueryParamsRequest
- func (*QueryParamsRequest) Descriptor() ([]byte, []int)
- func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryParamsRequest) ProtoMessage()
- func (m *QueryParamsRequest) Reset()
- func (m *QueryParamsRequest) Size() (n int)
- func (m *QueryParamsRequest) String() string
- func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error
- func (m *QueryParamsRequest) XXX_DiscardUnknown()
- func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryParamsRequest) XXX_Merge(src proto.Message)
- func (m *QueryParamsRequest) XXX_Size() int
- func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error
- type QueryParamsResponse
- func (*QueryParamsResponse) Descriptor() ([]byte, []int)
- func (m *QueryParamsResponse) GetParams() Params
- func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryParamsResponse) ProtoMessage()
- func (m *QueryParamsResponse) Reset()
- func (m *QueryParamsResponse) Size() (n int)
- func (m *QueryParamsResponse) String() string
- func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error
- func (m *QueryParamsResponse) XXX_DiscardUnknown()
- func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryParamsResponse) XXX_Merge(src proto.Message)
- func (m *QueryParamsResponse) XXX_Size() int
- func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error
- type QueryServer
- type UnimplementedQueryServer
Constants ¶
const ( EventTypeMint = ModuleName AttributeKeyBlockDuration = "block_duration" )
Mint module event types
const ( // module name ModuleName = "mint" // StoreKey is the default store key for mint StoreKey = ModuleName // QuerierRoute is the querier route for the mint store. QuerierRoute = StoreKey // Query endpoints supported by the mint querier QueryParameters = "parameters" )
Variables ¶
var ( ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthMint = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMint = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupMint = fmt.Errorf("proto: unexpected end of group") )
var ( KeyMintDenom = []byte("MintDenom") KeyMintPoolAddress = []byte("MintPoolAddress") KeyBlockTimeThreshold = []byte("BlockTimeThreshold") KeyInflationSchedules = []byte("InflationSchedules") DefaultBlockTimeThreshold = 10 * time.Second // DefaultMintPoolAddress is the fee collector of the auth module such as the mint module of the original cosmos-sdk DefaultMintPoolAddress = authtypes.NewModuleAddress(authtypes.FeeCollectorName) // MintModuleAcc is customized mint pool, If the fee collector as default mint pool is used, // there is a problem that the fee and inflation are mixed with the fee collector. // In order to solve this problem, mint pool can be set to CustomMintPoolAddress // and staking reward can be sent to the fee collector through Budget module functionality MintModuleAcc = authtypes.NewModuleAddress(ModuleName) // DefaultInflationSchedules is example of inflation schedules, It could be rearranged on genesis or gov DefaultInflationSchedules = []InflationSchedule{ { StartTime: utils.ParseTime("2022-01-01T00:00:00Z"), EndTime: utils.ParseTime("2023-01-01T00:00:00Z"), Amount: sdk.NewInt(300000000000000), }, { StartTime: utils.ParseTime("2023-01-01T00:00:00Z"), EndTime: utils.ParseTime("2024-01-01T00:00:00Z"), Amount: sdk.NewInt(200000000000000), }, } )
Parameter store keys
var ( ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") )
var LastBlockTimeKey = []byte{0x90}
LastBlockTimeKey is the key to use for the keeper store.
Functions ¶
func RegisterQueryHandler ¶
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 (such as grpc.SendHeader, etc) 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 the provided genesis state to ensure the expected invariants holds.
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI }
AccountKeeper defines the contract required for account APIs.
type BankKeeper ¶
type BankKeeper interface { SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error }
BankKeeper defines the contract needed to be fulfilled for banking and supply dependencies.
type GenesisState ¶
type GenesisState struct { // last_block_time defines the last block time, which is used to calculate inflation. LastBlockTime *time.Time `` /* 133-byte string literal not displayed */ // params defines all the parameters of the module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` }
GenesisState defines the mint module's genesis state.
func DefaultGenesisState ¶
func DefaultGenesisState() *GenesisState
DefaultGenesisState creates a default GenesisState object
func NewGenesisState ¶
func NewGenesisState(params Params, lastBlockTime *time.Time) *GenesisState
NewGenesisState creates a new GenesisState object
func (*GenesisState) Descriptor ¶
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetLastBlockTime ¶
func (m *GenesisState) GetLastBlockTime() *time.Time
func (*GenesisState) GetParams ¶
func (m *GenesisState) GetParams() Params
func (*GenesisState) Marshal ¶
func (m *GenesisState) Marshal() (dAtA []byte, err 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) 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 InflationSchedule ¶
type InflationSchedule struct { // start_time defines the start date time for the inflation schedule StartTime time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"` // end_time defines the end date time for the inflation schedule EndTime time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time" yaml:"end_time"` // amount defines the total amount of inflation for the schedule Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` }
InflationSchedule defines the start and end time of the inflation period, and the amount of inflation during that period.
func (*InflationSchedule) Descriptor ¶
func (*InflationSchedule) Descriptor() ([]byte, []int)
func (*InflationSchedule) GetEndTime ¶
func (m *InflationSchedule) GetEndTime() time.Time
func (*InflationSchedule) GetStartTime ¶
func (m *InflationSchedule) GetStartTime() time.Time
func (*InflationSchedule) Marshal ¶
func (m *InflationSchedule) Marshal() (dAtA []byte, err error)
func (*InflationSchedule) MarshalTo ¶
func (m *InflationSchedule) MarshalTo(dAtA []byte) (int, error)
func (*InflationSchedule) MarshalToSizedBuffer ¶
func (m *InflationSchedule) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*InflationSchedule) ProtoMessage ¶
func (*InflationSchedule) ProtoMessage()
func (*InflationSchedule) Reset ¶
func (m *InflationSchedule) Reset()
func (*InflationSchedule) Size ¶
func (m *InflationSchedule) Size() (n int)
func (*InflationSchedule) String ¶
func (m *InflationSchedule) String() string
func (*InflationSchedule) Unmarshal ¶
func (m *InflationSchedule) Unmarshal(dAtA []byte) error
func (*InflationSchedule) XXX_DiscardUnknown ¶
func (m *InflationSchedule) XXX_DiscardUnknown()
func (*InflationSchedule) XXX_Marshal ¶
func (m *InflationSchedule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*InflationSchedule) XXX_Merge ¶
func (m *InflationSchedule) XXX_Merge(src proto.Message)
func (*InflationSchedule) XXX_Size ¶
func (m *InflationSchedule) XXX_Size() int
func (*InflationSchedule) XXX_Unmarshal ¶
func (m *InflationSchedule) XXX_Unmarshal(b []byte) error
type Params ¶
type Params struct { // mint_denom defines denomination of coin to be minted MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` // mint_pool_address defines the address where inflation will be minted. The default is FeeCollector, // but if it is set to FeeCollector, minted inflation could be mixed together with collected tx fees. // Therefore, it is recommended to specify a separate address depending on usage. MintPoolAddress string `protobuf:"bytes,2,opt,name=mint_pool_address,json=mintPoolAddress,proto3" json:"mint_pool_address,omitempty"` // block_time_threshold defines block time threshold to prevent from any inflationary manipulation attacks // it is used for maximum block duration when calculating block inflation BlockTimeThreshold time.Duration `protobuf:"bytes,3,opt,name=block_time_threshold,json=blockTimeThreshold,proto3,stdduration" json:"block_time_threshold"` // inflation_schedules defines a list of inflation schedules InflationSchedules []InflationSchedule `protobuf:"bytes,4,rep,name=inflation_schedules,json=inflationSchedules,proto3" json:"inflation_schedules"` }
Params holds parameters for the mint module.
func (*Params) Descriptor ¶
func (*Params) GetBlockTimeThreshold ¶
func (*Params) GetInflationSchedules ¶
func (m *Params) GetInflationSchedules() []InflationSchedule
func (*Params) GetMintDenom ¶
func (*Params) GetMintPoolAddress ¶
func (*Params) MarshalToSizedBuffer ¶
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs
Implements params.ParamSet
func (*Params) ProtoMessage ¶
func (*Params) ProtoMessage()
func (*Params) XXX_DiscardUnknown ¶
func (m *Params) XXX_DiscardUnknown()
func (*Params) XXX_Marshal ¶
func (*Params) XXX_Unmarshal ¶
type QueryClient ¶
type QueryClient interface { // Params returns the total set of minting parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, 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 QueryParamsRequest ¶
type QueryParamsRequest struct { }
QueryParamsRequest is the request type for the Query/Params RPC method.
func (*QueryParamsRequest) Descriptor ¶
func (*QueryParamsRequest) Descriptor() ([]byte, []int)
func (*QueryParamsRequest) Marshal ¶
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)
func (*QueryParamsRequest) MarshalTo ¶
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryParamsRequest) MarshalToSizedBuffer ¶
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryParamsRequest) ProtoMessage ¶
func (*QueryParamsRequest) ProtoMessage()
func (*QueryParamsRequest) Reset ¶
func (m *QueryParamsRequest) Reset()
func (*QueryParamsRequest) Size ¶
func (m *QueryParamsRequest) Size() (n int)
func (*QueryParamsRequest) String ¶
func (m *QueryParamsRequest) String() string
func (*QueryParamsRequest) Unmarshal ¶
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error
func (*QueryParamsRequest) XXX_DiscardUnknown ¶
func (m *QueryParamsRequest) XXX_DiscardUnknown()
func (*QueryParamsRequest) XXX_Marshal ¶
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryParamsRequest) XXX_Merge ¶
func (m *QueryParamsRequest) XXX_Merge(src proto.Message)
func (*QueryParamsRequest) XXX_Size ¶
func (m *QueryParamsRequest) XXX_Size() int
func (*QueryParamsRequest) XXX_Unmarshal ¶
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error
type QueryParamsResponse ¶
type QueryParamsResponse struct { // params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` }
QueryParamsResponse is the response type for the Query/Params RPC method.
func (*QueryParamsResponse) Descriptor ¶
func (*QueryParamsResponse) Descriptor() ([]byte, []int)
func (*QueryParamsResponse) GetParams ¶
func (m *QueryParamsResponse) GetParams() Params
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 { // Params returns the total set of minting parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, 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) Params ¶
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error)