forked from osmosis-labs/osmosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest.go
47 lines (40 loc) · 1.43 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
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"`
}
// UnlockTokensReq defines the properties of a MsgUnlockTokens request.
type UnlockTokensReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
Owner sdk.AccAddress `json:"owner,omitempty" yaml:"owner"`
}
// UnlockTokensByIDReq defines the properties of a MsgUnlockTokens request.
type UnlockTokensByIDReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
Owner sdk.AccAddress `json:"owner,omitempty" yaml:"owner"`
}