-
Notifications
You must be signed in to change notification settings - Fork 578
/
rest.go
35 lines (30 loc) · 1004 Bytes
/
rest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package rest
import (
"github.com/gorilla/mux"
"github.com/cosmos/cosmos-sdk/client"
clientrest "github.com/cosmos/cosmos-sdk/client/rest"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
)
// REST Variable names
// nolint
const (
LockID = "lock-id"
RestOwnerAddress = "owner"
RestDenom = "denom"
RestTimestamp = "timestamp"
RestDuration = "duration"
)
// RegisterRoutes register query and tx rest routes
func RegisterRoutes(clientCtx client.Context, rtr *mux.Router) {
r := clientrest.WithHTTPDeprecationHeaders(rtr)
registerQueryRoutes(clientCtx, r)
registerTxHandlers(clientCtx, r)
}
// LockTokensReq defines the properties of a MsgLockTokens request
type LockTokensReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
Owner sdk.AccAddress `json:"owner,omitempty" yaml:"owner"`
Duration string `json:"duration,omitempty" yaml:"duration"`
Coins sdk.Coins `json:"coins" yaml:"coins"`
}