lcd

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryDelegationDistInfoHandlerFn

func QueryDelegationDistInfoHandlerFn(storeName string, cliCtx context.CLIContext) http.HandlerFunc

QueryDelegationDistInfoHandlerFn query delegation distribution info

func QueryDelegatorDistInfoHandlerFn

func QueryDelegatorDistInfoHandlerFn(storeName string, cliCtx context.CLIContext) http.HandlerFunc

// QueryWithdrawAddressHandlerFn performs withdraw address query

func QueryWithdrawAddressHandlerFn(storeName string, cliCtx context.CLIContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		vars := mux.Vars(r)
		bech32addr := vars["delegatorAddr"]

		delAddr, err := sdk.AccAddressFromBech32(bech32addr)
		if err != nil {
			utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
			return
		}

		key := distribution.GetDelegatorWithdrawAddrKey(delAddr)

		res, err := cliCtx.QueryStore(key, storeName)
		if err != nil {
			utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
			return
		}
		if len(res) == 0 {
			utils.WriteErrorResponse(w, http.StatusNoContent, "")
			return
		}
		withdrawAddress := sdk.AccAddress(res)

		w.Write([]byte(withdrawAddress.String()))
	}
}

QueryDelegatorDistInfoHandlerFn query all delegation distribution info of the specified delegator

func QueryValidatorDistInfoHandlerFn

func QueryValidatorDistInfoHandlerFn(storeName string, cliCtx context.CLIContext) http.HandlerFunc

QueryValidatorDistInfoHandlerFn query validator distribution info

func RegisterRoutes

func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec)

RegisterRoutes - Central function to define routes that get registered by the main application

func WithdrawRewardsHandlerFn

func WithdrawRewardsHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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