types

package
v0.0.0-...-b8140f3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// module name
	ModuleName = "vbank"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	ReservePoolName   = "vbank/reserve"
	GiveawayPoolName  = "vbank/giveaway"
	ProvisionPoolName = "vbank/provision"
)
View Source
const (
	QueryParams = "params"
	QueryState  = "state"
)

querier keys

View Source
const RouterKey = ModuleName // this was defined in your key.go file

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 (
	ParamStoreKeyRewardEpochDurationBlocks = []byte("reward_epoch_duration_blocks")
	ParamStoreKeyRewardSmoothingBlocks     = []byte("reward_smoothing_blocks")
	ParamStoreKeyPerEpochRewardFraction    = []byte("per_epoch_reward_fraction")
)

Parameter 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")
)
View Source
var (
	ErrInvalidLengthVbank        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowVbank          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupVbank = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (

	// ModuleCdc references the global x/deployment module codec. Note, the codec should
	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
	// still used for that purpose.
	//
	// The actual codec used for serialization should be provided to x/swingset and
	// defined at the application level.
	ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)

Functions

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable returns the parameter key table.

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

RegisterCodec registers concrete types on the Amino codec

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

RegisterInterfaces registers the x/swingset interfaces types with the interface registry

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

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)

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
}

type BankKeeper

type BankKeeper interface {
	BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
	GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
	MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
}

A subset of github.com/cosmos/cosmos-sdk/x/bank/keeper.Keeper

type GenesisState

type GenesisState struct {
	// parms defines all the parameters of the module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// state is the current operation state.
	State State `protobuf:"bytes,2,opt,name=state,proto3" json:"state"`
}

The initial and exported module state.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetState

func (m *GenesisState) GetState() State

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) 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 MsgClient

type MsgClient interface {
}

MsgClient is the client API for Msg service.

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

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
}

MsgServer is the server API for Msg service.

type Params

type Params struct {
	// reward_epoch_duration_blocks is the length of a reward epoch, in blocks.
	// A value of zero has the same meaning as a value of one:
	// the full reward buffer should be distributed immediately.
	RewardEpochDurationBlocks int64 `` /* 177-byte string literal not displayed */
	// per_epoch_reward_fraction is a fraction of the reward pool to distrubute
	// once every reward epoch.  If less than zero, use approximately continuous
	// per-block distribution.
	PerEpochRewardFraction github_com_cosmos_cosmos_sdk_types.Dec `` /* 209-byte string literal not displayed */
	// reward_smoothing_blocks is the number of blocks over which to distribute
	// an epoch's rewards.  If zero, use the same value as
	// reward_epoch_duration_blocks.
	RewardSmoothingBlocks int64 `` /* 158-byte string literal not displayed */
}

The module governance/configuration parameters.

func DefaultParams

func DefaultParams() Params

DefaultParams returns default distribution parameters

func (*Params) Descriptor

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

func (*Params) Equal

func (this *Params) Equal(that interface{}) bool

func (*Params) GetRewardEpochDurationBlocks

func (m *Params) GetRewardEpochDurationBlocks() int64

func (*Params) GetRewardSmoothingBlocks

func (m *Params) GetRewardSmoothingBlocks() int64

func (Params) GetSmoothingBlocks

func (p Params) GetSmoothingBlocks() int64

func (*Params) Marshal

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

func (*Params) MarshalTo

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

func (*Params) MarshalToSizedBuffer

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

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs returns the parameter set pairs.

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (Params) RewardRate

func (p Params) RewardRate(pool sdk.Coins, blocks int64) sdk.Coins

RewardRate calculates the rate for dispensing the pool of coins over the specified number of blocks. Fractions are rounded up. In other words, it returns the smallest Coins such that pool is exhausted after #blocks withdrawals.

func (*Params) Size

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

func (Params) String

func (p Params) String() string

func (*Params) Unmarshal

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

func (Params) ValidateBasic

func (p Params) ValidateBasic() error

ValidateBasic performs basic validation on distribution parameters.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

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

func (*Params) XXX_Merge

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

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	// Params queries params of the vbank module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// State queries current state of the vbank module.
	State(ctx context.Context, in *QueryStateRequest, opts ...grpc.CallOption) (*QueryStateResponse, 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 queries params of the vbank module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
	// State queries current state of the vbank module.
	State(context.Context, *QueryStateRequest) (*QueryStateResponse, error)
}

QueryServer is the server API for Query service.

type QueryStateRequest

type QueryStateRequest struct {
}

QueryStateRequest is the request type for the Query/State RPC method.

func (*QueryStateRequest) Descriptor

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

func (*QueryStateRequest) Marshal

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

func (*QueryStateRequest) MarshalTo

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

func (*QueryStateRequest) MarshalToSizedBuffer

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

func (*QueryStateRequest) ProtoMessage

func (*QueryStateRequest) ProtoMessage()

func (*QueryStateRequest) Reset

func (m *QueryStateRequest) Reset()

func (*QueryStateRequest) Size

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

func (*QueryStateRequest) String

func (m *QueryStateRequest) String() string

func (*QueryStateRequest) Unmarshal

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

func (*QueryStateRequest) XXX_DiscardUnknown

func (m *QueryStateRequest) XXX_DiscardUnknown()

func (*QueryStateRequest) XXX_Marshal

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

func (*QueryStateRequest) XXX_Merge

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

func (*QueryStateRequest) XXX_Size

func (m *QueryStateRequest) XXX_Size() int

func (*QueryStateRequest) XXX_Unmarshal

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

type QueryStateResponse

type QueryStateResponse struct {
	// state defines the parameters of the module.
	State State `protobuf:"bytes,1,opt,name=state,proto3" json:"state"`
}

QueryStateResponse is the response type for the Query/State RPC method.

func (*QueryStateResponse) Descriptor

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

func (*QueryStateResponse) GetState

func (m *QueryStateResponse) GetState() State

func (*QueryStateResponse) Marshal

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

func (*QueryStateResponse) MarshalTo

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

func (*QueryStateResponse) MarshalToSizedBuffer

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

func (*QueryStateResponse) ProtoMessage

func (*QueryStateResponse) ProtoMessage()

func (*QueryStateResponse) Reset

func (m *QueryStateResponse) Reset()

func (*QueryStateResponse) Size

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

func (*QueryStateResponse) String

func (m *QueryStateResponse) String() string

func (*QueryStateResponse) Unmarshal

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

func (*QueryStateResponse) XXX_DiscardUnknown

func (m *QueryStateResponse) XXX_DiscardUnknown()

func (*QueryStateResponse) XXX_Marshal

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

func (*QueryStateResponse) XXX_Merge

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

func (*QueryStateResponse) XXX_Size

func (m *QueryStateResponse) XXX_Size() int

func (*QueryStateResponse) XXX_Unmarshal

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

type State

type State struct {
	// rewardPool is the current balance of rewards in the module account.
	// NOTE: Tracking manually since there is no bank call for getting a
	// module account balance by name.
	RewardPool github_com_cosmos_cosmos_sdk_types.Coins `` /* 154-byte string literal not displayed */
	// reward_block_amount is the amount of reward, if available, to send to the
	// fee collector module on every block.
	RewardBlockAmount github_com_cosmos_cosmos_sdk_types.Coins `` /* 185-byte string literal not displayed */
	// last_sequence is a sequence number for communicating with the VM.
	LastSequence                uint64 `protobuf:"varint,3,opt,name=last_sequence,json=lastSequence,proto3" json:"last_sequence,omitempty" yaml:"last_sequence"`
	LastRewardDistributionBlock int64  `` /* 185-byte string literal not displayed */
}

The current state of the module.

func (*State) Descriptor

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

func (*State) Equal

func (this *State) Equal(that interface{}) bool

func (*State) GetLastRewardDistributionBlock

func (m *State) GetLastRewardDistributionBlock() int64

func (*State) GetLastSequence

func (m *State) GetLastSequence() uint64

func (*State) GetRewardBlockAmount

func (m *State) GetRewardBlockAmount() github_com_cosmos_cosmos_sdk_types.Coins

func (*State) GetRewardPool

func (m *State) GetRewardPool() github_com_cosmos_cosmos_sdk_types.Coins

func (*State) Marshal

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

func (*State) MarshalTo

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

func (*State) MarshalToSizedBuffer

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

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) Reset

func (m *State) Reset()

func (*State) Size

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

func (*State) String

func (m *State) String() string

func (*State) Unmarshal

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

func (*State) XXX_DiscardUnknown

func (m *State) XXX_DiscardUnknown()

func (*State) XXX_Marshal

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

func (*State) XXX_Merge

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

func (*State) XXX_Size

func (m *State) XXX_Size() int

func (*State) XXX_Unmarshal

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

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

func (*UnimplementedQueryServer) State

type VbankBalanceUpdate

type VbankBalanceUpdate struct {
	Nonce   uint64                     `json:"nonce"`
	Type    string                     `json:"type"`
	Updated []VbankSingleBalanceUpdate `json:"updated"`
}

type VbankSingleBalanceUpdate

type VbankSingleBalanceUpdate struct {
	Address string `json:"address"`
	Denom   string `json:"denom"`
	Amount  string `json:"amount"`
}

Jump to

Keyboard shortcuts

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