Skip to content

Commit d8d0ca3

Browse files
author
HaoyangLiu
committed
Add swagger-ui for bank module
1 parent ca762d0 commit d8d0ca3

File tree

4 files changed

+456
-19
lines changed

4 files changed

+456
-19
lines changed

client/bank/lcd/rest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
// RegisterRoutes - Central function to define routes that get registered by the main application
1414
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *wire.Codec, kb keys.Keybase) {
15-
r.HandleFunc(fmt.Sprintf("/bank/{address}/send/{%s}/{%s}", utils.GenerateOnly, utils.Async),
15+
r.HandleFunc(fmt.Sprintf("/bank/{address}/send", utils.GenerateOnly, utils.Async),
1616
SendRequestHandlerFn(cdc, kb, cliCtx)).Methods("POST")
1717
r.HandleFunc("/bank/accounts/{address}",
1818
QueryAccountRequestHandlerFn("acc", cdc, authcmd.GetAccountDecoder(cdc), cliCtx)).Methods("GET")

client/bank/lcd/sendTx.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/irisnet/irishub/client/utils"
1010
"io/ioutil"
1111
"net/http"
12-
"strconv"
1312
"github.com/irisnet/irishub/client/bank"
1413
)
1514

@@ -30,16 +29,8 @@ func SendRequestHandlerFn(cdc *wire.Codec, kb keys.Keybase, cliCtx context.CLICo
3029
utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
3130
return
3231
}
33-
cliCtx.GenerateOnly, err = strconv.ParseBool(vars[utils.GenerateOnly])
34-
if err != nil {
35-
utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
36-
return
37-
}
38-
cliCtx.Async, err = strconv.ParseBool(vars[utils.Async])
39-
if err != nil {
40-
utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
41-
return
42-
}
32+
cliCtx.GenerateOnly = utils.GenerateOnlyArg(r)
33+
cliCtx.Async = utils.AsyncOnlyArg(r)
4334

4435
var m sendBody
4536
body, err := ioutil.ReadAll(r.Body)

0 commit comments

Comments
 (0)