From 64744d1ac81f5de63c57c1d1b40b0484c5da6f7d Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Thu, 18 Feb 2021 19:15:02 +0530 Subject: [PATCH 1/7] Add swagger setup --- cmd/doc.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 cmd/doc.go diff --git a/cmd/doc.go b/cmd/doc.go new file mode 100644 index 000000000..48d2c3e85 --- /dev/null +++ b/cmd/doc.go @@ -0,0 +1,41 @@ +// Package cmd Relayer Rest Server. +// +// A REST interface for state queries. +// +// Schemes: http +// Basepath: / +// Version: 1.0.0 +// Host: localhost:5183 +// +// Consumes: +// - application/json +// +// Produces: +// - application/json +// +// +// swagger:meta +package cmd + +// swagger:route GET /version Version version +// Get version. +// responses: +// 200: versionResponse + +// swagger:response versionResponse +type versionResWrapper struct { + // in:body + VersionInfo versionInfo +} + +// swagger:route GET /config Config config +// Get config. +// responses: +// 200: configResponse + +// swagger:response configResponse +type configResWrapper struct { + // Returns config of relayer + // in:body + Config *Config +} From ef167310d0048074501cea2049d4147b1cf34bf5 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Sat, 20 Feb 2021 18:48:33 +0530 Subject: [PATCH 2/7] Add some routes docs and swagger ui --- cmd/api.go | 6 +- cmd/chains.go | 6 +- cmd/doc.go | 62 ++++++++ swagger-ui/favicon-16x16.png | Bin 0 -> 445 bytes swagger-ui/favicon-32x32.png | Bin 0 -> 1141 bytes swagger-ui/index.html | 60 +++++++ swagger-ui/oauth2-redirect.html | 67 ++++++++ swagger-ui/swagger.yaml | 267 ++++++++++++++++++++++++++++++++ 8 files changed, 465 insertions(+), 3 deletions(-) create mode 100644 swagger-ui/favicon-16x16.png create mode 100644 swagger-ui/favicon-32x32.png create mode 100644 swagger-ui/index.html create mode 100644 swagger-ui/oauth2-redirect.html create mode 100644 swagger-ui/swagger.yaml diff --git a/cmd/api.go b/cmd/api.go index 51bb53d87..c52ffd1be 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -168,11 +168,15 @@ func getAPICmd() *cobra.Command { // Data for this should be stored in the ServicesManager struct r.HandleFunc("/listen/{path}/{strategy}/{name}", PostRelayerListenHandler(sm)).Methods("POST") + fs := http.FileServer(http.Dir("./swagger-ui")) + r.PathPrefix("/").Handler(fs) + + fmt.Println("listening on", config.Global.APIListenPort) + if err := http.ListenAndServe(config.Global.APIListenPort, r); err != nil { return err } - fmt.Println("listening on", config.Global.APIListenPort) return nil }, } diff --git a/cmd/chains.go b/cmd/chains.go index b0df260ec..106fcf0a1 100644 --- a/cmd/chains.go +++ b/cmd/chains.go @@ -546,8 +546,10 @@ type addChainRequest struct { GasAdjustment string `json:"gas-adjustment"` GasPrices string `json:"gas-prices"` TrustingPeriod string `json:"trusting-period"` - FilePath string `json:"file"` - URL string `json:"url"` + // required: false + FilePath string `json:"file"` + // required: false + URL string `json:"url"` } // PostChainHandler handles the route diff --git a/cmd/doc.go b/cmd/doc.go index 48d2c3e85..be27298d1 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -17,6 +17,18 @@ // swagger:meta package cmd +import ( + "github.com/cosmos/relayer/relayer" +) + +// swagger:response errorResponse +type errResWrapper struct { + // in:body + Error struct { + Err string `json:"err" yaml:"err"` + } +} + // swagger:route GET /version Version version // Get version. // responses: @@ -39,3 +51,53 @@ type configResWrapper struct { // in:body Config *Config } + +// swagger:route GET /chains Chains getChains +// Get chains list. +// responses: +// 200: getChainsResponse + +// swagger:response getChainsResponse +type getChainsResWrapper struct { + // Returns chains list. + // in:body + Chains relayer.Chains +} + +// swagger:route GET /chains/{name} Chains getChain +// Get single chain details. +// responses: +// 200: getChainResponse +// 400: errorResponse + +// swagger:parameters getChain addChain +type chainParamsWrapper struct { + // in:path + Name string `json:"name" yaml:"name"` +} + +// swagger:response getChainResponse +type getChainResWrapper struct { + // Returns chain details + // in:body + Chain *relayer.Chain +} + +// swagger:route POST /chains/{name} Chains addChain +// Add a chain +// responses: +// 201: addChainResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters addChain +type addChainParamsWrapper struct { + // in:body + Body addChainRequest +} + +// swagger:response addChainResponse +type addChainResWrapper struct { + // in:body + Res string +} diff --git a/swagger-ui/favicon-16x16.png b/swagger-ui/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..0f7e13b0d9903d27a9129950b1dad362361504e4 GIT binary patch literal 445 zcmV;u0Yd(XP)rNm2=6wQ7&2F}_`h_PI>(9Fx!5<0%l6W{u0OQ#*rglqx3__&vD?|#%fhn*Mn&YY1i+JQHqPvZ34FR@_E%P@x zzTL;Bw#nJXWY}D7^bC>-bx{t|^|R6Oci&MKvov8Op~S=}R=h^p-=vZ0uqG@LE6tP7 n92{cY$^db6>&z__iT?Z#Z8BG|DVcT0DjiaEd>Z!7_`J}8! zKk_$1lGm$vJOY&DjT-(&VGn0;R`iN9=1aOuG`H}BlY>&R3KbGER zB2$7euhH;y1C_LTQex%L6khZpkjFn!ajOUK)f3JLz+I;CE@(N)T)CM4AWjfl-(04= zrsMQ)#NG6nr^Y7!6LA;iHXh?UOFE%hhy>7dl=;I$J>g0BH_r|_4ctEsXx z2sDIQnwa*rcK=*3XUC$D{I@}DTNs@GCb7dB2%%nV%jR){xktt;Ah09op7x@l5D6B2 z0uBdt0YmcN!o?lMpu9Io(1&B1s{TUu*a>2&>Iycx__fbDRM8PYtLt+#G*xSt(cn}K zt!~W2{`9r)xkh^xodLS&FbYw`x$t&Vhl?)#f&k-lZIs<`$gTj{^#^HewuJz(WnUZZ z{Ty_aE;^93bhc-^^k6ZM!^e~$q5!Zz`XPta{a@651gPzaFx$&%IHL6hx$mSeAa#n6 zLkyc-M zs$qhBZhCNE^aIEV)H_~^IeqSRnvo!21Qc`Z;S9!IqXl4K(RUImejotzuG65LVuGS# zcqp@OA8~ln^4c^VihUew)IOX^E9KMtvSvnZ| zC@rl{f(B*PA26aFR`|X!!I(7x_|kq{rlqwhCia+CfNbOg_yYt0bDCc4g#h#`3jpCd zNAhr%4#Ye{i>ni$fzY%r0IS%l3HHZ4tTjOi=JW-t_iG~)oC!2C!52Cc|TAPaH zJ}l%m9yPmA-4#lJea@uf$a`(1;={rL2f*8;7%icbF}e^_`X#ndU=SI0nIn8hXPXHS zSN4rbF}jl0HWx(_`q`-SRa9jP8Ab!}sThNkQ634k=qXBVM4`o{M>qrLJD ze*%D)S;wpxG$d%FcDf-6%zMqWA+gw!C1~T5+|ys$G3Ksm&x59Lyd?0l+LWSk6hc4~ z+yC>|4f;X3#cq3!)>#Mvb-^co7LMrzqWeKB$21I>tJgaGFwu6eB%&j?@d*8GAx~In zI1p-lXVKtcvY7;$TX~wjYw|QhB%q!npQES%F~%Aqz~pJB%rNu!xAj;>xZt75!VHju zfFy%B-`3;Qf<{h94~I62zcHv}D5pS-QCN`M8K1>jN9mpbrFk=5no8j!00000NkvXX Hu0mjfOavUK literal 0 HcmV?d00001 diff --git a/swagger-ui/index.html b/swagger-ui/index.html new file mode 100644 index 000000000..b2ee4dff3 --- /dev/null +++ b/swagger-ui/index.html @@ -0,0 +1,60 @@ + + + + + + Swagger UI + + + + + + + +
+ + + + + + diff --git a/swagger-ui/oauth2-redirect.html b/swagger-ui/oauth2-redirect.html new file mode 100644 index 000000000..fb68399d2 --- /dev/null +++ b/swagger-ui/oauth2-redirect.html @@ -0,0 +1,67 @@ + + + + + + diff --git a/swagger-ui/swagger.yaml b/swagger-ui/swagger.yaml new file mode 100644 index 000000000..4aa8b6f03 --- /dev/null +++ b/swagger-ui/swagger.yaml @@ -0,0 +1,267 @@ +basePath: / +consumes: +- application/json +definitions: + Chain: + description: Chain represents the necessary data for connecting to and indentifying + a chain and its counterparites + properties: + account-prefix: + type: string + x-go-name: AccountPrefix + chain-id: + type: string + x-go-name: ChainID + gas-adjustment: + format: double + type: number + x-go-name: GasAdjustment + gas-prices: + type: string + x-go-name: GasPrices + key: + type: string + x-go-name: Key + rpc-addr: + type: string + x-go-name: RPCAddr + trusting-period: + type: string + x-go-name: TrustingPeriod + type: object + x-go-package: github.com/cosmos/relayer/relayer + Chains: + description: Chains is a collection of Chain + items: + $ref: '#/definitions/Chain' + type: array + x-go-package: github.com/cosmos/relayer/relayer + Config: + description: Config represents the config file for the relayer + properties: + chains: + $ref: '#/definitions/Chains' + global: + $ref: '#/definitions/GlobalConfig' + paths: + $ref: '#/definitions/Paths' + type: object + x-go-package: github.com/cosmos/relayer/cmd + GlobalConfig: + description: GlobalConfig describes any global relayer settings + properties: + api-listen-addr: + type: string + x-go-name: APIListenPort + light-cache-size: + format: int64 + type: integer + x-go-name: LightCacheSize + timeout: + type: string + x-go-name: Timeout + type: object + x-go-package: github.com/cosmos/relayer/cmd + Path: + description: |- + Path represents a pair of chains and the identifiers needed to + relay over them + properties: + dst: + $ref: '#/definitions/PathEnd' + src: + $ref: '#/definitions/PathEnd' + strategy: + $ref: '#/definitions/StrategyCfg' + type: object + x-go-package: github.com/cosmos/relayer/relayer + PathEnd: + description: |- + PathEnd represents the local connection identifers for a relay path + The path is set on the chain before performing operations + properties: + chain-id: + type: string + x-go-name: ChainID + channel-id: + type: string + x-go-name: ChannelID + client-id: + type: string + x-go-name: ClientID + connection-id: + type: string + x-go-name: ConnectionID + order: + type: string + x-go-name: Order + port-id: + type: string + x-go-name: PortID + version: + type: string + x-go-name: Version + type: object + x-go-package: github.com/cosmos/relayer/relayer + Paths: + additionalProperties: + $ref: '#/definitions/Path' + description: Paths represent connection paths between chains + type: object + x-go-package: github.com/cosmos/relayer/relayer + StrategyCfg: + description: StrategyCfg defines which relaying strategy to take for a given path + properties: + type: + type: string + x-go-name: Type + type: object + x-go-package: github.com/cosmos/relayer/relayer + addChainRequest: + properties: + account-prefix: + type: string + x-go-name: AccountPrefix + file: + type: string + x-go-name: FilePath + gas-adjustment: + type: string + x-go-name: GasAdjustment + gas-prices: + type: string + x-go-name: GasPrices + key: + type: string + x-go-name: Key + rpc-addr: + type: string + x-go-name: RPCAddr + trusting-period: + type: string + x-go-name: TrustingPeriod + url: + type: string + x-go-name: URL + type: object + x-go-package: github.com/cosmos/relayer/cmd + versionInfo: + properties: + commit: + type: string + x-go-name: Commit + cosmos-sdk: + type: string + x-go-name: CosmosSDK + go: + type: string + x-go-name: Go + version: + type: string + x-go-name: Version + type: object + x-go-package: github.com/cosmos/relayer/cmd +host: localhost:5183 +info: + description: A REST interface for state queries. + title: Relayer Rest Server. + version: 1.0.0 +paths: + /chains: + get: + operationId: getChains + responses: + "200": + $ref: '#/responses/getChainsResponse' + summary: Get chains list. + tags: + - Chains + /chains/{name}: + get: + operationId: getChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + $ref: '#/responses/getChainResponse' + "400": + $ref: '#/responses/errorResponse' + summary: Get single chain details. + tags: + - Chains + post: + description: Add a chain + operationId: addChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: body + name: Body + schema: + $ref: '#/definitions/addChainRequest' + responses: + "201": + $ref: '#/responses/addChainResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + tags: + - Chains + /config: + get: + operationId: config + responses: + "200": + $ref: '#/responses/configResponse' + summary: Get config. + tags: + - Config + /version: + get: + operationId: version + responses: + "200": + $ref: '#/responses/versionResponse' + summary: Get version. + tags: + - Version +produces: +- application/json +responses: + addChainResponse: + description: "" + configResponse: + description: "" + schema: + $ref: '#/definitions/Config' + errorResponse: + description: "" + schema: + properties: + err: + type: string + x-go-name: Err + type: object + getChainResponse: + description: "" + schema: + $ref: '#/definitions/Chain' + getChainsResponse: + description: "" + schema: + $ref: '#/definitions/Chains' + versionResponse: + description: "" + schema: + $ref: '#/definitions/versionInfo' +schemes: +- http +swagger: "2.0" From b91893a6e6fc48c8cdf2dccd8f00dc2416b688b6 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Mon, 22 Feb 2021 17:57:49 +0530 Subject: [PATCH 3/7] Add few more route docs --- cmd/chains.go | 5 +++ cmd/doc.go | 50 ++++++++++++++++++---- swagger-ui/swagger.yaml | 93 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 137 insertions(+), 11 deletions(-) diff --git a/cmd/chains.go b/cmd/chains.go index 106fcf0a1..cde97f333 100644 --- a/cmd/chains.go +++ b/cmd/chains.go @@ -680,6 +680,11 @@ func PutChainHandler(w http.ResponseWriter, r *http.Request) { // DeleteChainHandler handles the route func DeleteChainHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) + _, err := config.Chains.Get(vars["name"]) + if err != nil { + helpers.WriteErrorResponse(http.StatusBadRequest, err, w) + return + } if err := overWriteConfig(config.DeleteChain(vars["name"])); err != nil { helpers.WriteErrorResponse(http.StatusInternalServerError, err, w) return diff --git a/cmd/doc.go b/cmd/doc.go index be27298d1..5cab97d64 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -70,7 +70,7 @@ type getChainsResWrapper struct { // 200: getChainResponse // 400: errorResponse -// swagger:parameters getChain addChain +// swagger:parameters getChain addChain updateChain deleteChain getChainStatus type chainParamsWrapper struct { // in:path Name string `json:"name" yaml:"name"` @@ -84,20 +84,56 @@ type getChainResWrapper struct { } // swagger:route POST /chains/{name} Chains addChain -// Add a chain +// Add a chain. +// +// file and url parameters in body are optional and can't use both at once. // responses: -// 201: addChainResponse +// 201: chainResponse // 400: errorResponse // 500: errorResponse // swagger:parameters addChain type addChainParamsWrapper struct { + // required:true + // in:body + Body addChainRequest `json:"body" yaml:"body"` +} + +// swagger:response chainResponse +type chainResWrapper struct { + // in:body + Res string `json:"res" yaml:"res"` +} + +// swagger:route PUT /chains/{name} Chains updateChain +// Update chain config values. +// responses: +// 200: chainResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters updateChain +type updateChainParamsWrapper struct { + // required:true // in:body - Body addChainRequest + Body editChainRequest `json:"body" yaml:"body"` } -// swagger:response addChainResponse -type addChainResWrapper struct { +// swagger:route DELETE /chains/{name} Chains deleteChain +// Delete Chain. +// responses: +// 200: chainResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:route GET /chains/{name}/status Chains getChainStatus +// Get status of a chain. +// responses: +// 200: chainStatusRes +// 400: errorResponse + +// swagger:response chainStatusRes +type chainStatusResWrapper struct { // in:body - Res string + Status chainStatusResponse } diff --git a/swagger-ui/swagger.yaml b/swagger-ui/swagger.yaml index 4aa8b6f03..80cb222d7 100644 --- a/swagger-ui/swagger.yaml +++ b/swagger-ui/swagger.yaml @@ -145,6 +145,32 @@ definitions: x-go-name: URL type: object x-go-package: github.com/cosmos/relayer/cmd + chainStatusResponse: + properties: + balance: + type: boolean + x-go-name: Balance + key: + type: boolean + x-go-name: Key + light: + type: boolean + x-go-name: Light + path: + type: boolean + x-go-name: Path + type: object + x-go-package: github.com/cosmos/relayer/cmd + editChainRequest: + properties: + key: + type: string + x-go-name: Key + value: + type: string + x-go-name: Value + type: object + x-go-package: github.com/cosmos/relayer/cmd versionInfo: properties: commit: @@ -177,6 +203,22 @@ paths: tags: - Chains /chains/{name}: + delete: + operationId: deleteChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + $ref: '#/responses/chainResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Delete Chain. + tags: + - Chains get: operationId: getChain parameters: @@ -194,7 +236,8 @@ paths: tags: - Chains post: - description: Add a chain + description: file and url parameters in body are optional and can't use both + at once. operationId: addChain parameters: - in: path @@ -203,16 +246,54 @@ paths: type: string x-go-name: Name - in: body - name: Body + name: body + required: true schema: $ref: '#/definitions/addChainRequest' + x-go-name: Body responses: "201": - $ref: '#/responses/addChainResponse' + $ref: '#/responses/chainResponse' "400": $ref: '#/responses/errorResponse' "500": $ref: '#/responses/errorResponse' + summary: Add a chain. + tags: + - Chains + put: + operationId: updateChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: body + name: body + required: true + schema: + $ref: '#/definitions/editChainRequest' + x-go-name: Body + responses: + "200": + $ref: '#/responses/chainResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Update chain config values. + tags: + - Chains + /chains/{name}/status: + get: + operationId: getChainStatus + responses: + "200": + $ref: '#/responses/getChainStatus' + "400": + $ref: '#/responses/errorResponse' + summary: Get status of a chain. tags: - Chains /config: @@ -236,7 +317,7 @@ paths: produces: - application/json responses: - addChainResponse: + chainResponse: description: "" configResponse: description: "" @@ -254,6 +335,10 @@ responses: description: "" schema: $ref: '#/definitions/Chain' + getChainStatus: + description: "" + schema: + $ref: '#/definitions/chainStatusResponse' getChainsResponse: description: "" schema: From c9a0038f172dc0d3f0789373ad1f86d84b981a02 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Tue, 23 Feb 2021 17:57:27 +0530 Subject: [PATCH 4/7] Add swagger docs for remaining routes --- Makefile | 7 + cmd/api.go | 2 +- cmd/config.go | 9 +- cmd/doc.go | 510 +++- cmd/keys.go | 2 +- cmd/paths.go | 36 +- docs/rest-server.md | 8 +- .../swagger-ui}/favicon-16x16.png | Bin .../swagger-ui}/favicon-32x32.png | Bin {swagger-ui => docs/swagger-ui}/index.html | 0 .../swagger-ui}/oauth2-redirect.html | 0 docs/swagger-ui/swagger.yaml | 2156 +++++++++++++++++ swagger-ui/swagger.yaml | 352 --- 13 files changed, 2673 insertions(+), 409 deletions(-) rename {swagger-ui => docs/swagger-ui}/favicon-16x16.png (100%) rename {swagger-ui => docs/swagger-ui}/favicon-32x32.png (100%) rename {swagger-ui => docs/swagger-ui}/index.html (100%) rename {swagger-ui => docs/swagger-ui}/oauth2-redirect.html (100%) create mode 100644 docs/swagger-ui/swagger.yaml delete mode 100644 swagger-ui/swagger.yaml diff --git a/Makefile b/Makefile index c81641dea..e2fe1cfd0 100644 --- a/Makefile +++ b/Makefile @@ -98,3 +98,10 @@ build-wasmd: delete-chains: @echo "Removing the ./chain-code/ directory..." @rm -rf ./chain-code + +check-swagger: + which swagger || (GO111MODULE=off go get -u github.com/go-swagger/go-swagger/cmd/swagger) + +update-swagger-docs: check-swagger + swagger generate spec -o ./docs/swagger-ui/swagger.yaml + diff --git a/cmd/api.go b/cmd/api.go index c52ffd1be..05e8adf39 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -168,7 +168,7 @@ func getAPICmd() *cobra.Command { // Data for this should be stored in the ServicesManager struct r.HandleFunc("/listen/{path}/{strategy}/{name}", PostRelayerListenHandler(sm)).Methods("POST") - fs := http.FileServer(http.Dir("./swagger-ui")) + fs := http.FileServer(http.Dir("./docs/swagger-ui")) r.PathPrefix("/").Handler(fs) fmt.Println("listening on", config.Global.APIListenPort) diff --git a/cmd/config.go b/cmd/config.go index f95c5120e..f470401a9 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -564,15 +564,16 @@ func (c *Config) ValidatePathEnd(pe *relayer.PathEnd) error { return err } + chain, err := c.Chains.Get(pe.ChainID) + if err != nil { + return err + } + // if the identifiers are empty, don't do any validation if pe.ClientID == "" && pe.ConnectionID == "" && pe.ChannelID == "" { return nil } - chain, err := c.Chains.Get(pe.ChainID) - if err != nil { - return err - } // NOTE: this is just to do validation, the path // is not written to the config file if err = chain.SetPath(pe); err != nil { diff --git a/cmd/doc.go b/cmd/doc.go index 5cab97d64..df92f19a2 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -18,7 +18,17 @@ package cmd import ( + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + transfertypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types" + clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types" + conntypes "github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types" + chantypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types" + tmclient "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types" + "github.com/cosmos/relayer/helpers" "github.com/cosmos/relayer/relayer" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + ctypes "github.com/tendermint/tendermint/rpc/core/types" ) // swagger:response errorResponse @@ -52,6 +62,44 @@ type configResWrapper struct { Config *Config } +// swagger:parameters getChain addChain updateChain deleteChain getChainStatus +// swagger:parameters getPath addPath deletePath getPathStatus +// swagger:parameters getKey addKey deleteKey restoreKey +type nameParamsWrapper struct { + // in:path + Name string `json:"name" yaml:"name"` +} + +// swagger:parameters getKeys getKey addKey deleteKey restoreKey +// swagger:parameters getLightHeader getLightHeight initLight updateLight deleteLight +// swagger:parameters queryAccount queryBalance queryHeader queryNodeState queryValSet +// swagger:parameters queryTxs queryTx queryClient queryClients queryConn queryConns +// swagger:parameters queryClientConns queryChan queryChans queryConnChans queryIBCDenoms +type chainIDParamsWrapper struct { + // in:path + ChainID string `json:"chain-id" yaml:"chain-id"` +} + +// swagger:parameters getLightHeader queryHeader queryValSet queryClient queryConn queryClientConns queryChan +type heightParamsWrapper struct { + // in:query + Height int `json:"height" yaml:"height"` +} + +// swagger:parameters queryTxs queryClients queryConns queryChans queryConnChans +type paginationParamsWrapper struct { + // in:query + Offset uint `json:"offset" yaml:"offset"` + // in:query + Limit uint `json:"limit" yaml:"limit"` +} + +// swagger:response stringSuccessResponse +type stringResWrapper struct { + // in:body + Res string `json:"res" yaml:"res"` +} + // swagger:route GET /chains Chains getChains // Get chains list. // responses: @@ -67,18 +115,11 @@ type getChainsResWrapper struct { // swagger:route GET /chains/{name} Chains getChain // Get single chain details. // responses: -// 200: getChainResponse +// 200: body:getChainResponse Returns chain details // 400: errorResponse -// swagger:parameters getChain addChain updateChain deleteChain getChainStatus -type chainParamsWrapper struct { - // in:path - Name string `json:"name" yaml:"name"` -} - // swagger:response getChainResponse type getChainResWrapper struct { - // Returns chain details // in:body Chain *relayer.Chain } @@ -88,7 +129,7 @@ type getChainResWrapper struct { // // file and url parameters in body are optional and can't use both at once. // responses: -// 201: chainResponse +// 201: body:stringSuccessResponse Returns success string // 400: errorResponse // 500: errorResponse @@ -99,16 +140,10 @@ type addChainParamsWrapper struct { Body addChainRequest `json:"body" yaml:"body"` } -// swagger:response chainResponse -type chainResWrapper struct { - // in:body - Res string `json:"res" yaml:"res"` -} - // swagger:route PUT /chains/{name} Chains updateChain // Update chain config values. // responses: -// 200: chainResponse +// 200: body:stringSuccessResponse Returns success string // 400: errorResponse // 500: errorResponse @@ -122,7 +157,7 @@ type updateChainParamsWrapper struct { // swagger:route DELETE /chains/{name} Chains deleteChain // Delete Chain. // responses: -// 200: chainResponse +// 200: body:stringSuccessResponse Returns success string // 400: errorResponse // 500: errorResponse @@ -137,3 +172,444 @@ type chainStatusResWrapper struct { // in:body Status chainStatusResponse } + +// swagger:route GET /paths Paths getPaths +// Get paths list. +// responses: +// 200: getPathsResponse + +// swagger:response getPathsResponse +type getPathsResWrapper struct { + // Returns paths list. + // in:body + Paths relayer.Paths +} + +// swagger:route GET /paths/{name} Paths getPath +// Get single path details. +// responses: +// 200: getPathResponse +// 400: errorResponse + +// swagger:response getPathResponse +type getPathResWrapper struct { + // in:body + Path *relayer.Path +} + +// swagger:route POST /paths/{name} Paths addPath +// Add a path. +// +// file parameter in body is optional and if given, it will considered first. +// +// responses: +// 201: body:stringSuccessResponse Returns success string +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters addPath +type addPathParamsWrapper struct { + // required:true + // in:body + Body postPathRequest `json:"body" yaml:"body"` +} + +// swagger:route DELETE /paths/{name} Paths deletePath +// Delete Path. +// responses: +// 200: body:stringSuccessResponse Returns success string +// 400: errorResponse +// 500: errorResponse + +// swagger:route GET /paths/{name}/status Paths getPathStatus +// Get status of a path. +// responses: +// 200: pathStatusRes +// 400: errorResponse +// 500: errorResponse + +// swagger:response pathStatusRes +type pathStatusResWrapper struct { + // in:body + Status *relayer.PathWithStatus +} + +// swagger:route GET /keys/{chain-id} Keys getKeys +// Get keys list of a chain. +// responses: +// 200: getKeysResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response getKeysResponse +type getKeysResWrapper struct { + // in:body + Keys []keyResponse +} + +// swagger:route GET /keys/{chain-id}/{name} Keys getKey +// Get details of a key in a chain. +// responses: +// 200: getKeyResponse +// 400: errorResponse +// 404: errorResponse +// 500: errorResponse + +// swagger:response getKeyResponse +type getKeyResWrapper struct { + // in:body + Key keyResponse +} + +// swagger:route POST /keys/{chain-id}/{name} Keys addKey +// Add a key in a chain. +// +// coin-type is a query parameter (optional) +// +// responses: +// 201: keyCreatedResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters addKey restoreKey +type addKeyParamsWrapper struct { + // required:false + // in:query + CoinType int `json:"coin-type" yaml:"coin-type"` +} + +// swagger:response keyCreatedResponse +type keyCreatedResWrapper struct { + // in:body + KeyOutput helpers.KeyOutput +} + +// swagger:route POST /keys/{chain-id}/{name}/restore Keys restoreKey +// Restore a key using mnemonic. +// +// coin-type is a query parameter (optional) +// +// responses: +// 200: keyCreatedResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters restoreKey +type restoreKeyParamsWrapper struct { + // required:true + // in:body + Body restoreKeyRequest `json:"body" yaml:"body"` +} + +// swagger:route DELETE /keys/{chain-id}/{name} Keys deleteKey +// Delete key in a chain. +// responses: +// 200: body:stringSuccessResponse Returns success string +// 400: errorResponse +// 404: errorResponse +// 500: errorResponse + +// swagger:route GET /light/{chain-id}/header Light getLightHeader +// Get light header of a chain. +// responses: +// 200: headerResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response headerResponse +type headerResWrapper struct { + // in:body + Header *tmclient.Header +} + +// swagger:route GET /light/{chain-id}/height Light getLightHeight +// Get light height of a chain. +// responses: +// 200: body:getLightHeightResponse Returns light height +// 400: errorResponse +// 500: errorResponse + +// swagger:response getLightHeightResponse +type getLightHeightResWrapper struct { + // in:body + Height int64 `json:"height" yaml:"height"` +} + +// swagger:route POST /light/{chain-id} Light initLight +// Init light header for a chain. +// +// force is optional and if given, it will be considered first, +// height and hash can be used instead of force and need to send both values. +// responses: +// 201: body:stringSuccessResponse Returns success string +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters initLight +type initLightParamsWrapper struct { + // required:true + // in:body + Body postLightRequest `json:"body" yaml:"body"` +} + +// swagger:route PUT /light/{chain-id} Light updateLight +// Update light header of a chain. +// responses: +// 200: body:stringSuccessResponse Returns success string +// 400: errorResponse +// 500: errorResponse + +// swagger:route DELETE /light/{chain-id} Light deleteLight +// Delete light header of a chain. +// responses: +// 200: body:stringSuccessResponse Returns success string +// 400: errorResponse +// 500: errorResponse + +// swagger:route GET /query/{chain-id}/account/{address} Query queryAccount +// Query account of a chain. +// responses: +// 200: body:queryAccountResponse Output format might change if address queried is Module Account +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryAccount queryBalance +type addressParamsWrapper struct { + // in:path + Address string `json:"address" yaml:"address"` +} + +// swagger:response queryAccountResponse +type queryAccountResWrapper struct { + // in:body + Res struct { + Account *authtypes.BaseAccount `json:"account" yaml:"account"` + } +} + +// swagger:route GET /query/{chain-id}/balance/{address} Query queryBalance +// Query balance of a chain. +// responses: +// 200: queryBalanceResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryBalance +type queryBalanceParamsWrapper struct { + // in:query + IBCDenoms bool `json:"ibc-denoms" yaml:"ibc-denoms"` +} + +// swagger:response queryBalanceResponse +type queryBalanceResWrapper struct { + // in:body + Balance sdk.Coins +} + +// swagger:route GET /query/{chain-id}/header Query queryHeader +// Query header of a chain. +// responses: +// 200: headerResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:route GET /query/{chain-id}/node-state Query queryNodeState +// Query node state of a chain. +// responses: +// 200: nodeStateResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response nodeStateResponse +type nodeStateResWrapper struct { + // in:body + ConsensusState *tmclient.ConsensusState +} + +// swagger:route GET /query/{chain-id}/valset Query queryValSet +// Query node state of a chain. +// responses: +// 200: valSetResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response valSetResponse +type valSetResWrapper struct { + // in:body + ValSet *tmproto.ValidatorSet +} + +// swagger:route POST /query/{chain-id}/txs Query queryTxs +// Query Txs using events. +// responses: +// 200: txsResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryTxs +type queryTxsParamsWrapper struct { + // in:body + Body txsRequest `json:"body" yaml:"body"` +} + +// swagger:response txsResponse +type txsResWrapper struct { + // in:body + Txs []*ctypes.ResultTx +} + +// swagger:route GET /query/{chain-id}/tx/{hash} Query queryTx +// Query Tx details by hash. +// responses: +// 200: txResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryTx +type queryTxParamsWrapper struct { + // in:path + Hash string `json:"hash" yaml:"hash"` +} + +// swagger:response txResponse +type txResWrapper struct { + // in:body + Txs *ctypes.ResultTx +} + +// swagger:route GET /query/{chain-id}/clients/{client-id} Query queryClient +// Query client by clientID. +// responses: +// 200: queryClientResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryClient +type clientParamsWrapper struct { + // in:path + ClientID string `json:"client-id" yaml:"client-id"` +} + +// swagger:response queryClientResponse +type queryClientResWrapper struct { + // in:body + Client *clienttypes.QueryClientStateResponse +} + +// swagger:route GET /query/{chain-id}/clients Query queryClients +// Query clients of a chain. +// responses: +// 200: queryClientsResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response queryClientsResponse +type queryClientsResWrapper struct { + // in:body + Clients *clienttypes.QueryClientStatesResponse +} + +// swagger:route GET /query/{chain-id}/connections/{conn-id} Query queryConn +// Query connection by connectionID. +// responses: +// 200: queryConnResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryConn queryConnChans +type connectionParamsWrapper struct { + // in:path + ConnectionID string `json:"conn-id" yaml:"conn-id"` +} + +// swagger:response queryConnResponse +type queryConnResWrapper struct { + // in:body + Connection *conntypes.QueryConnectionResponse +} + +// swagger:route GET /query/{chain-id}/connections Query queryConns +// Query connections of a chain. +// responses: +// 200: queryConnsResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response queryConnsResponse +type queryConnsResWrapper struct { + // in:body + Connections *conntypes.QueryConnectionsResponse +} + +// swagger:route GET /query/{chain-id}/connections/client/{client-id} Query queryClientConns +// Query connections of a client in a chain. +// responses: +// 200: queryClientConnsResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response queryClientConnsResponse +type queryClientConnsResWrapper struct { + // in:body + Connections *conntypes.QueryClientConnectionsResponse +} + +// swagger:route GET /query/{chain-id}/channels/{chan-id}/{port-id} Query queryChan +// Query channel by channelID and portID. +// responses: +// 200: queryChanResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:parameters queryChan +type channelParamsWrapper struct { + // in:path + ChannelID string `json:"chan-id" yaml:"chan-id"` + // in:path + PortID string `json:"port-id" yaml:"port-id"` +} + +// swagger:response queryChanResponse +type queryChanResWrapper struct { + // in:body + Channel *chantypes.QueryChannelResponse +} + +// swagger:route GET /query/{chain-id}/channels Query queryChans +// Query channels of a chain. +// responses: +// 200: queryChansResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response queryChansResponse +type queryChansResWrapper struct { + // in:body + Channels *chantypes.QueryChannelsResponse +} + +// swagger:route GET /query/{chain-id}/channels/connection/{conn-id} Query queryConnChans +// Query channels of a connection in a chain. +// responses: +// 200: queryConnChansResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response queryConnChansResponse +type queryConnChansResWrapper struct { + // in:body + Channels *chantypes.QueryConnectionChannelsResponse +} + +// swagger:route GET /query/{chain-id}/ibc-denoms Query queryIBCDenoms +// Query ibc-denoms of a chain. +// responses: +// 200: queryIBCDenomsResponse +// 400: errorResponse +// 500: errorResponse + +// swagger:response queryIBCDenomsResponse +type queryIBCDenomsResWrapper struct { + // in:body + IBCDenoms *transfertypes.QueryDenomTracesResponse +} diff --git a/cmd/keys.go b/cmd/keys.go index aaf36a507..7e03d4e6e 100644 --- a/cmd/keys.go +++ b/cmd/keys.go @@ -426,7 +426,7 @@ func RestoreKeyHandler(w http.ResponseWriter, r *http.Request) { keyName := vars["name"] if chain.KeyExists(keyName) { - helpers.WriteErrorResponse(http.StatusNotFound, errKeyExists(keyName), w) + helpers.WriteErrorResponse(http.StatusBadRequest, errKeyExists(keyName), w) return } diff --git a/cmd/paths.go b/cmd/paths.go index c0fa61595..2b55490dd 100644 --- a/cmd/paths.go +++ b/cmd/paths.go @@ -706,11 +706,9 @@ func GetPathStatusHandler(w http.ResponseWriter, r *http.Request) { } type postPathRequest struct { - FilePath string `json:"file"` - SrcChainID string `json:"src-chain-id"` - DstChainID string `json:"dst-chain-id"` - Src relayer.PathEnd `json:"src"` - Dst relayer.PathEnd `json:"dst"` + FilePath string `json:"file"` + Src relayer.PathEnd `json:"src"` + Dst relayer.PathEnd `json:"dst"` } // PostPathHandler handles the route @@ -719,28 +717,9 @@ func PostPathHandler(w http.ResponseWriter, r *http.Request) { pathName := vars["name"] var request postPathRequest - if err := json.NewDecoder(r.Body).Decode(&request); err != nil { - helpers.WriteErrorResponse(http.StatusBadRequest, err, w) - return - } - - if request.SrcChainID == "" { - helpers.WriteErrorResponse(http.StatusBadRequest, fmt.Errorf("src-chain-id is required"), w) - return - } - - if request.DstChainID == "" { - helpers.WriteErrorResponse(http.StatusBadRequest, fmt.Errorf("dst-chain-id is required"), w) - return - } - - _, err := config.Chains.Gets(request.SrcChainID, request.DstChainID) + err := json.NewDecoder(r.Body).Decode(&request) if err != nil { - helpers.WriteErrorResponse( - http.StatusBadRequest, - fmt.Errorf("chains need to be configured before paths to them can be added: %w", err), - w, - ) + helpers.WriteErrorResponse(http.StatusBadRequest, err, w) return } @@ -773,8 +752,9 @@ func addPathByRequest(req postPathRequest, pathName string) (*Config, error) { } ) - path.Src.ChainID = req.SrcChainID - path.Dst.ChainID = req.DstChainID + if err := config.ValidatePath(path); err != nil { + return nil, err + } if err := config.Paths.Add(pathName, path); err != nil { return nil, err diff --git a/docs/rest-server.md b/docs/rest-server.md index cdb3ac958..c23f0f381 100644 --- a/docs/rest-server.md +++ b/docs/rest-server.md @@ -45,12 +45,10 @@ $ curl -d '{"key":"testkey3","rpc-addr":"http://localhost:26657","account-prefix "chain ibc-2 added successfully" # Add new path to relay over -$ curl -d '{"src-chain-id":"ibc-0","dst-chain-id":"ibc-1","src":{"client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"}}' -H 'Content-Type: application/json' http://localhost:5183/paths/demo-path +$ curl -d '{"src":{"chain-id":"ibc-0","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"}}' -H 'Content-Type: application/json' http://localhost:5183/paths/demo-path # Here we are creating path by sending data in format { - src-chain-id string - dst-chain-id string src PathEnd dst PathEnd } @@ -58,11 +56,9 @@ $ curl -d '{"src-chain-id":"ibc-0","dst-chain-id":"ibc-1","src":{"client-id":"", # We can also create path by sending file path instead of src and dst data in below format { file string - src-chain-id string - dst-chain-id string } -$ curl -d '{"file":"/root/go/src/github.com/cosmos/relayer/configs/akash/demo.json","src-chain-id":"ibc-0","dst-chain-id":"ibc-1"}' -H 'Content-Type: application/json' http://localhost:5183/paths/demo2 +$ curl -d '{"file":"/root/go/src/github.com/cosmos/relayer/configs/akash/demo.json"}' -H 'Content-Type: application/json' http://localhost:5183/paths/demo2 "path demo2 added successfully" diff --git a/swagger-ui/favicon-16x16.png b/docs/swagger-ui/favicon-16x16.png similarity index 100% rename from swagger-ui/favicon-16x16.png rename to docs/swagger-ui/favicon-16x16.png diff --git a/swagger-ui/favicon-32x32.png b/docs/swagger-ui/favicon-32x32.png similarity index 100% rename from swagger-ui/favicon-32x32.png rename to docs/swagger-ui/favicon-32x32.png diff --git a/swagger-ui/index.html b/docs/swagger-ui/index.html similarity index 100% rename from swagger-ui/index.html rename to docs/swagger-ui/index.html diff --git a/swagger-ui/oauth2-redirect.html b/docs/swagger-ui/oauth2-redirect.html similarity index 100% rename from swagger-ui/oauth2-redirect.html rename to docs/swagger-ui/oauth2-redirect.html diff --git a/docs/swagger-ui/swagger.yaml b/docs/swagger-ui/swagger.yaml new file mode 100644 index 000000000..548e041a1 --- /dev/null +++ b/docs/swagger-ui/swagger.yaml @@ -0,0 +1,2156 @@ +basePath: / +consumes: +- application/json +definitions: + Any: + properties: + type_url: + description: nolint + type: string + x-go-name: TypeUrl + value: + description: Must be a valid serialized protocol buffer of the above specified + type. + items: + format: uint8 + type: integer + type: array + x-go-name: Value + type: object + x-go-package: github.com/cosmos/cosmos-sdk/codec/types + BaseAccount: + description: |- + BaseAccount defines a base account type. It contains all the necessary fields + for basic account functionality. Any custom account type should extend this + type for additional functionality (e.g. vesting). + properties: + account_number: + format: uint64 + type: integer + x-go-name: AccountNumber + address: + type: string + x-go-name: Address + public_key: + $ref: '#/definitions/Any' + sequence: + format: uint64 + type: integer + x-go-name: Sequence + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/auth/types + BlockID: + description: BlockID + properties: + hash: + items: + format: uint8 + type: integer + type: array + x-go-name: Hash + part_set_header: + $ref: '#/definitions/PartSetHeader' + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + BlockIDFlag: + description: BlockIdFlag indicates which BlcokID the signature is for + format: int32 + type: integer + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + Chain: + description: Chain represents the necessary data for connecting to and indentifying + a chain and its counterparites + properties: + account-prefix: + type: string + x-go-name: AccountPrefix + chain-id: + type: string + x-go-name: ChainID + gas-adjustment: + format: double + type: number + x-go-name: GasAdjustment + gas-prices: + type: string + x-go-name: GasPrices + key: + type: string + x-go-name: Key + rpc-addr: + type: string + x-go-name: RPCAddr + trusting-period: + type: string + x-go-name: TrustingPeriod + type: object + x-go-package: github.com/cosmos/relayer/relayer + Chains: + description: Chains is a collection of Chain + items: + $ref: '#/definitions/Chain' + type: array + x-go-package: github.com/cosmos/relayer/relayer + Channel: + description: |- + Channel defines pipeline for exactly-once packet delivery between specific + modules on separate blockchains, which has at least one end capable of + sending packets and one end capable of receiving packets. + properties: + connection_hops: + description: |- + list of connection identifiers, in order, along which packets sent on + this channel will travel + items: + type: string + type: array + x-go-name: ConnectionHops + counterparty: + $ref: '#/definitions/Counterparty' + ordering: + $ref: '#/definitions/Order' + state: + $ref: '#/definitions/State' + version: + description: opaque channel version, which is agreed upon during the handshake + type: string + x-go-name: Version + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + Coin: + description: |- + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + properties: + amount: + $ref: '#/definitions/Int' + denom: + type: string + x-go-name: Denom + title: Coin defines a token with a denomination and an amount. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/types + Coins: + description: Coins is a set of Coin, one per currency + items: + $ref: '#/definitions/Coin' + type: array + x-go-package: github.com/cosmos/cosmos-sdk/types + Commit: + properties: + block_id: + $ref: '#/definitions/BlockID' + height: + format: int64 + type: integer + x-go-name: Height + round: + format: int32 + type: integer + x-go-name: Round + signatures: + items: + $ref: '#/definitions/CommitSig' + type: array + x-go-name: Signatures + title: Commit contains the evidence that a block was committed by a set of validators. + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + CommitSig: + properties: + block_id_flag: + $ref: '#/definitions/BlockIDFlag' + signature: + items: + format: uint8 + type: integer + type: array + x-go-name: Signature + timestamp: + format: date-time + type: string + x-go-name: Timestamp + validator_address: + items: + format: uint8 + type: integer + type: array + x-go-name: ValidatorAddress + title: CommitSig is a part of the Vote included in a Commit. + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + Config: + description: Config represents the config file for the relayer + properties: + chains: + $ref: '#/definitions/Chains' + global: + $ref: '#/definitions/GlobalConfig' + paths: + $ref: '#/definitions/Paths' + type: object + x-go-package: github.com/cosmos/relayer/cmd + ConnectionEnd: + description: |- + ConnectionEnd defines a stateful object on a chain connected to another + separate one. + NOTE: there must only be 2 defined ConnectionEnds to establish + a connection between two chains. + properties: + client_id: + description: client associated with this connection. + type: string + x-go-name: ClientId + counterparty: + $ref: '#/definitions/Counterparty' + delay_period: + description: |- + delay period that must pass before a consensus state can be used for packet-verification + NOTE: delay period logic is only implemented by some clients. + format: uint64 + type: integer + x-go-name: DelayPeriod + state: + $ref: '#/definitions/State' + versions: + description: |- + IBC version which can be utilised to determine encodings or protocols for + channels or packets utilising this connection. + items: + $ref: '#/definitions/Version' + type: array + x-go-name: Versions + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types + ConsensusState: + properties: + next_validators_hash: + $ref: '#/definitions/HexBytes' + root: + $ref: '#/definitions/MerkleRoot' + timestamp: + description: |- + timestamp that corresponds to the block height in which the ConsensusState + was stored. + format: date-time + type: string + x-go-name: Timestamp + title: ConsensusState defines the consensus state from Tendermint. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types + Counterparty: + description: Counterparty defines a channel end counterparty + properties: + channel_id: + description: channel end on the counterparty chain + type: string + x-go-name: ChannelId + port_id: + description: port on the counterparty chain which owns the other end of the + channel. + type: string + x-go-name: PortId + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + DenomTrace: + description: |- + DenomTrace contains the base denomination for ICS20 fungible tokens and the + source tracing information path. + properties: + base_denom: + description: base denomination of the relayed fungible token. + type: string + x-go-name: BaseDenom + path: + description: |- + path defines the chain of port/channel identifiers used for tracing the + source of the fungible token. + type: string + x-go-name: Path + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types + Event: + description: |- + Event allows application developers to attach additional information to + ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + Later, transactions may be queried using these events. + properties: + attributes: + items: + $ref: '#/definitions/EventAttribute' + type: array + x-go-name: Attributes + type: + type: string + x-go-name: Type + type: object + x-go-package: github.com/tendermint/tendermint/abci/types + EventAttribute: + properties: + index: + type: boolean + x-go-name: Index + key: + items: + format: uint8 + type: integer + type: array + x-go-name: Key + value: + items: + format: uint8 + type: integer + type: array + x-go-name: Value + title: EventAttribute is a single key-value pair, associated with an event. + type: object + x-go-package: github.com/tendermint/tendermint/abci/types + GlobalConfig: + description: GlobalConfig describes any global relayer settings + properties: + api-listen-addr: + type: string + x-go-name: APIListenPort + light-cache-size: + format: int64 + type: integer + x-go-name: LightCacheSize + timeout: + type: string + x-go-name: Timeout + type: object + x-go-package: github.com/cosmos/relayer/cmd + Header: + description: |- + It encapsulates all the information necessary to update from a trusted + Tendermint ConsensusState. The inclusion of TrustedHeight and + TrustedValidators allows this update to process correctly, so long as the + ConsensusState for the TrustedHeight exists, this removes race conditions + among relayers The SignedHeader and ValidatorSet are the new untrusted update + fields for the client. The TrustedHeight is the height of a stored + ConsensusState on the client that will be used to verify the new untrusted + header. The Trusted ConsensusState must be within the unbonding period of + current time in order to correctly verify, and the TrustedValidators must + hash to TrustedConsensusState.NextValidatorsHash since that is the last + trusted validator set at the TrustedHeight. + properties: + commit: + $ref: '#/definitions/Commit' + header: + $ref: '#/definitions/Header' + trusted_height: + $ref: '#/definitions/Height' + trusted_validators: + $ref: '#/definitions/ValidatorSet' + validator_set: + $ref: '#/definitions/ValidatorSet' + title: Header defines the Tendermint client consensus Header. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types + Height: + description: |- + Normally the RevisionHeight is incremented at each height while keeping RevisionNumber + the same. However some consensus algorithms may choose to reset the + height in certain conditions e.g. hard forks, state-machine breaking changes + In these cases, the RevisionNumber is incremented so that height continues to + be monitonically increasing even as the RevisionHeight gets reset + properties: + revision_height: + description: the height within the given revision + format: uint64 + type: integer + x-go-name: RevisionHeight + revision_number: + description: the revision that the client is currently on + format: uint64 + type: integer + x-go-name: RevisionNumber + title: |- + Height is a monotonically increasing data type + that can be compared against another Height for the purposes of updating and + freezing clients + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types + HexBytes: + items: + format: uint8 + type: integer + title: The main purpose of HexBytes is to enable HEX-encoding for json/encoding. + type: array + x-go-package: github.com/tendermint/tendermint/libs/bytes + IdentifiedChannel: + description: |- + IdentifiedChannel defines a channel with additional port and channel + identifier fields. + properties: + channel_id: + description: channel identifier + type: string + x-go-name: ChannelId + connection_hops: + description: |- + list of connection identifiers, in order, along which packets sent on + this channel will travel + items: + type: string + type: array + x-go-name: ConnectionHops + counterparty: + $ref: '#/definitions/Counterparty' + ordering: + $ref: '#/definitions/Order' + port_id: + description: port identifier + type: string + x-go-name: PortId + state: + $ref: '#/definitions/State' + version: + description: opaque channel version, which is agreed upon during the handshake + type: string + x-go-name: Version + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + IdentifiedClientState: + description: |- + IdentifiedClientState defines a client state with an additional client + identifier field. + properties: + client_id: + description: client identifier + type: string + x-go-name: ClientId + client_state: + $ref: '#/definitions/Any' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types + IdentifiedClientStates: + description: IdentifiedClientStates defines a slice of ClientConsensusStates that + supports the sort interface + items: + $ref: '#/definitions/IdentifiedClientState' + type: array + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types + IdentifiedConnection: + description: |- + IdentifiedConnection defines a connection with additional connection + identifier field. + properties: + client_id: + description: client associated with this connection. + type: string + x-go-name: ClientId + counterparty: + $ref: '#/definitions/Counterparty' + delay_period: + description: delay period associated with this connection. + format: uint64 + type: integer + x-go-name: DelayPeriod + id: + description: connection identifier. + type: string + x-go-name: Id + state: + $ref: '#/definitions/State' + versions: + description: |- + IBC version which can be utilised to determine encodings or protocols for + channels or packets utilising this connection + items: + $ref: '#/definitions/Version' + type: array + x-go-name: Versions + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types + Int: + description: |- + Int wraps integer with 256 bit range bound + Checks overflow, underflow and division by zero + Exists in range from -(2^maxBitLen-1) to 2^maxBitLen-1 + type: object + x-go-package: github.com/cosmos/cosmos-sdk/types + KeyOutput: + description: KeyOutput contains mnemonic and address of key + properties: + address: + type: string + x-go-name: Address + mnemonic: + type: string + x-go-name: Mnemonic + type: object + x-go-package: github.com/cosmos/relayer/helpers + MerklePrefix: + description: |- + The constructed key from the Path and the key will be append(Path.KeyPath, + append(Path.KeyPrefix, key...)) + properties: + key_prefix: + items: + format: uint8 + type: integer + type: array + x-go-name: KeyPrefix + title: MerklePrefix is merkle path prefixed to the key. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types + MerkleRoot: + description: In the Cosmos SDK, the AppHash of a block header becomes the root. + properties: + hash: + items: + format: uint8 + type: integer + type: array + x-go-name: Hash + title: MerkleRoot defines a merkle root hash. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types + Order: + description: Order defines if a channel is ORDERED or UNORDERED + format: int32 + type: integer + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + PageResponse: + description: |- + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + properties: + next_key: + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + items: + format: uint8 + type: integer + type: array + x-go-name: NextKey + total: + description: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise + format: uint64 + type: integer + x-go-name: Total + title: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/types/query + PartSetHeader: + description: PartsetHeader + properties: + hash: + items: + format: uint8 + type: integer + type: array + x-go-name: Hash + total: + format: uint32 + type: integer + x-go-name: Total + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + Path: + description: |- + Path represents a pair of chains and the identifiers needed to + relay over them + properties: + dst: + $ref: '#/definitions/PathEnd' + src: + $ref: '#/definitions/PathEnd' + strategy: + $ref: '#/definitions/StrategyCfg' + type: object + x-go-package: github.com/cosmos/relayer/relayer + PathEnd: + description: |- + PathEnd represents the local connection identifers for a relay path + The path is set on the chain before performing operations + properties: + chain-id: + type: string + x-go-name: ChainID + channel-id: + type: string + x-go-name: ChannelID + client-id: + type: string + x-go-name: ClientID + connection-id: + type: string + x-go-name: ConnectionID + order: + type: string + x-go-name: Order + port-id: + type: string + x-go-name: PortID + version: + type: string + x-go-name: Version + type: object + x-go-package: github.com/cosmos/relayer/relayer + PathStatus: + description: PathStatus holds the status of the primitives in the path + properties: + chains: + type: boolean + x-go-name: Chains + channel: + type: boolean + x-go-name: Channel + clients: + type: boolean + x-go-name: Clients + connection: + type: boolean + x-go-name: Connection + type: object + x-go-package: github.com/cosmos/relayer/relayer + PathWithStatus: + description: PathWithStatus is used for showing the status of the path + properties: + chains: + $ref: '#/definitions/Path' + status: + $ref: '#/definitions/PathStatus' + type: object + x-go-package: github.com/cosmos/relayer/relayer + Paths: + additionalProperties: + $ref: '#/definitions/Path' + description: Paths represent connection paths between chains + type: object + x-go-package: github.com/cosmos/relayer/relayer + Proof: + description: |- + NOTE: The convention for proofs is to include leaf hashes but to + exclude the root hash. + This convention is implemented across IAVL range proofs as well. + Keep this consistent unless there's a very good reason to change + everything. This also affects the generalized proof system as + well. + properties: + aunts: + items: + items: + format: uint8 + type: integer + type: array + type: array + x-go-name: Aunts + index: + format: int64 + type: integer + x-go-name: Index + leaf_hash: + items: + format: uint8 + type: integer + type: array + x-go-name: LeafHash + total: + format: int64 + type: integer + x-go-name: Total + title: Proof represents a Merkle proof. + type: object + x-go-package: github.com/tendermint/tendermint/crypto/merkle + PublicKey: + description: PublicKey defines the keys available for use with Tendermint Validators + properties: + Sum: + $ref: '#/definitions/isPublicKey_Sum' + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/crypto + QueryChannelResponse: + description: |- + Besides the Channel end, it includes a proof and the height from which the + proof was retrieved. + properties: + channel: + $ref: '#/definitions/Channel' + proof: + description: merkle proof of existence + items: + format: uint8 + type: integer + type: array + x-go-name: Proof + proof_height: + $ref: '#/definitions/Height' + title: QueryChannelResponse is the response type for the Query/Channel RPC method. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + QueryChannelsResponse: + properties: + channels: + description: list of stored channels of the chain. + items: + $ref: '#/definitions/IdentifiedChannel' + type: array + x-go-name: Channels + height: + $ref: '#/definitions/Height' + pagination: + $ref: '#/definitions/PageResponse' + title: QueryChannelsResponse is the response type for the Query/Channels RPC method. + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + QueryClientConnectionsResponse: + description: |- + QueryClientConnectionsResponse is the response type for the + Query/ClientConnections RPC method + properties: + connection_paths: + description: slice of all the connection paths associated with a client. + items: + type: string + type: array + x-go-name: ConnectionPaths + proof: + description: merkle proof of existence + items: + format: uint8 + type: integer + type: array + x-go-name: Proof + proof_height: + $ref: '#/definitions/Height' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types + QueryClientStateResponse: + description: |- + QueryClientStateResponse is the response type for the Query/ClientState RPC + method. Besides the client state, it includes a proof and the height from + which the proof was retrieved. + properties: + client_state: + $ref: '#/definitions/Any' + proof: + description: merkle proof of existence + items: + format: uint8 + type: integer + type: array + x-go-name: Proof + proof_height: + $ref: '#/definitions/Height' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types + QueryClientStatesResponse: + description: |- + QueryClientStatesResponse is the response type for the Query/ClientStates RPC + method. + properties: + client_states: + $ref: '#/definitions/IdentifiedClientStates' + pagination: + $ref: '#/definitions/PageResponse' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types + QueryConnectionChannelsResponse: + description: |- + QueryConnectionChannelsResponse is the Response type for the + Query/QueryConnectionChannels RPC method + properties: + channels: + description: list of channels associated with a connection. + items: + $ref: '#/definitions/IdentifiedChannel' + type: array + x-go-name: Channels + height: + $ref: '#/definitions/Height' + pagination: + $ref: '#/definitions/PageResponse' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + QueryConnectionResponse: + description: |- + QueryConnectionResponse is the response type for the Query/Connection RPC + method. Besides the connection end, it includes a proof and the height from + which the proof was retrieved. + properties: + connection: + $ref: '#/definitions/ConnectionEnd' + proof: + description: merkle proof of existence + items: + format: uint8 + type: integer + type: array + x-go-name: Proof + proof_height: + $ref: '#/definitions/Height' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types + QueryConnectionsResponse: + description: |- + QueryConnectionsResponse is the response type for the Query/Connections RPC + method. + properties: + connections: + description: list of stored connections of the chain. + items: + $ref: '#/definitions/IdentifiedConnection' + type: array + x-go-name: Connections + height: + $ref: '#/definitions/Height' + pagination: + $ref: '#/definitions/PageResponse' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types + QueryDenomTracesResponse: + description: |- + QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + method. + properties: + denom_traces: + $ref: '#/definitions/Traces' + pagination: + $ref: '#/definitions/PageResponse' + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types + ResponseDeliverTx: + properties: + code: + format: uint32 + type: integer + x-go-name: Code + codespace: + type: string + x-go-name: Codespace + data: + items: + format: uint8 + type: integer + type: array + x-go-name: Data + events: + items: + $ref: '#/definitions/Event' + type: array + x-go-name: Events + gas_used: + format: int64 + type: integer + x-go-name: GasUsed + gas_wanted: + format: int64 + type: integer + x-go-name: GasWanted + info: + type: string + x-go-name: Info + log: + type: string + x-go-name: Log + type: object + x-go-package: github.com/tendermint/tendermint/abci/types + ResultTx: + description: Result of querying for a tx + properties: + hash: + $ref: '#/definitions/HexBytes' + height: + format: int64 + type: integer + x-go-name: Height + index: + format: uint32 + type: integer + x-go-name: Index + proof: + $ref: '#/definitions/TxProof' + tx: + $ref: '#/definitions/Tx' + tx_result: + $ref: '#/definitions/ResponseDeliverTx' + type: object + x-go-package: github.com/tendermint/tendermint/rpc/core/types + State: + description: CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + format: int32 + title: 'State defines if a channel is in one of the following states:' + type: integer + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types + StrategyCfg: + description: StrategyCfg defines which relaying strategy to take for a given path + properties: + type: + type: string + x-go-name: Type + type: object + x-go-package: github.com/cosmos/relayer/relayer + Traces: + items: + $ref: '#/definitions/DenomTrace' + title: Traces defines a wrapper type for a slice of DenomTrace. + type: array + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types + Tx: + description: |- + NOTE: Tx has no types at this level, so when wire encoded it's just length-prefixed. + Might we want types here ? + items: + format: uint8 + type: integer + title: Tx is an arbitrary byte array. + type: array + x-go-package: github.com/tendermint/tendermint/types + TxProof: + properties: + data: + $ref: '#/definitions/Tx' + proof: + $ref: '#/definitions/Proof' + root_hash: + $ref: '#/definitions/HexBytes' + title: TxProof represents a Merkle proof of the presence of a transaction in the + Merkle tree. + type: object + x-go-package: github.com/tendermint/tendermint/types + Validator: + properties: + address: + items: + format: uint8 + type: integer + type: array + x-go-name: Address + proposer_priority: + format: int64 + type: integer + x-go-name: ProposerPriority + pub_key: + $ref: '#/definitions/PublicKey' + voting_power: + format: int64 + type: integer + x-go-name: VotingPower + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + ValidatorSet: + properties: + proposer: + $ref: '#/definitions/Validator' + total_voting_power: + format: int64 + type: integer + x-go-name: TotalVotingPower + validators: + items: + $ref: '#/definitions/Validator' + type: array + x-go-name: Validators + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/types + Version: + description: |- + Version defines the versioning scheme used to negotiate the IBC verison in + the connection handshake. + properties: + features: + description: list of features compatible with the specified identifier + items: + type: string + type: array + x-go-name: Features + identifier: + description: unique version identifier + type: string + x-go-name: Identifier + type: object + x-go-package: github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types + addChainRequest: + properties: + account-prefix: + type: string + x-go-name: AccountPrefix + file: + type: string + x-go-name: FilePath + gas-adjustment: + type: string + x-go-name: GasAdjustment + gas-prices: + type: string + x-go-name: GasPrices + key: + type: string + x-go-name: Key + rpc-addr: + type: string + x-go-name: RPCAddr + trusting-period: + type: string + x-go-name: TrustingPeriod + url: + type: string + x-go-name: URL + type: object + x-go-package: github.com/cosmos/relayer/cmd + chainStatusResponse: + properties: + balance: + type: boolean + x-go-name: Balance + key: + type: boolean + x-go-name: Key + light: + type: boolean + x-go-name: Light + path: + type: boolean + x-go-name: Path + type: object + x-go-package: github.com/cosmos/relayer/cmd + editChainRequest: + properties: + key: + type: string + x-go-name: Key + value: + type: string + x-go-name: Value + type: object + x-go-package: github.com/cosmos/relayer/cmd + isPublicKey_Sum: + properties: + Size: + format: int64 + type: integer + type: object + x-go-package: github.com/tendermint/tendermint/proto/tendermint/crypto + keyResponse: + properties: + address: + type: string + x-go-name: Address + name: + type: string + x-go-name: Name + type: object + x-go-package: github.com/cosmos/relayer/cmd + postLightRequest: + properties: + force: + type: boolean + x-go-name: Force + hash: + type: string + x-go-name: Hash + height: + format: int64 + type: integer + x-go-name: Height + type: object + x-go-package: github.com/cosmos/relayer/cmd + postPathRequest: + properties: + dst: + $ref: '#/definitions/PathEnd' + file: + type: string + x-go-name: FilePath + src: + $ref: '#/definitions/PathEnd' + type: object + x-go-package: github.com/cosmos/relayer/cmd + restoreKeyRequest: + properties: + mnemonic: + type: string + x-go-name: Mnemonic + type: object + x-go-package: github.com/cosmos/relayer/cmd + txsRequest: + properties: + events: + items: + type: string + type: array + x-go-name: Events + type: object + x-go-package: github.com/cosmos/relayer/cmd + versionInfo: + properties: + commit: + type: string + x-go-name: Commit + cosmos-sdk: + type: string + x-go-name: CosmosSDK + go: + type: string + x-go-name: Go + version: + type: string + x-go-name: Version + type: object + x-go-package: github.com/cosmos/relayer/cmd +host: localhost:5183 +info: + description: A REST interface for state queries. + title: Relayer Rest Server. + version: 1.0.0 +paths: + /chains: + get: + operationId: getChains + responses: + "200": + $ref: '#/responses/getChainsResponse' + summary: Get chains list. + tags: + - Chains + /chains/{name}: + delete: + operationId: deleteChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Delete Chain. + tags: + - Chains + get: + operationId: getChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + description: Returns chain details + schema: + $ref: '#/definitions/getChainResponse' + "400": + $ref: '#/responses/errorResponse' + summary: Get single chain details. + tags: + - Chains + post: + description: file and url parameters in body are optional and can't use both + at once. + operationId: addChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: body + name: body + required: true + schema: + $ref: '#/definitions/addChainRequest' + x-go-name: Body + responses: + "201": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Add a chain. + tags: + - Chains + put: + operationId: updateChain + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: body + name: body + required: true + schema: + $ref: '#/definitions/editChainRequest' + x-go-name: Body + responses: + "200": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Update chain config values. + tags: + - Chains + /chains/{name}/status: + get: + operationId: getChainStatus + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + $ref: '#/responses/chainStatusRes' + "400": + $ref: '#/responses/errorResponse' + summary: Get status of a chain. + tags: + - Chains + /config: + get: + operationId: config + responses: + "200": + $ref: '#/responses/configResponse' + summary: Get config. + tags: + - Config + /keys/{chain-id}: + get: + operationId: getKeys + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + $ref: '#/responses/getKeysResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Get keys list of a chain. + tags: + - Keys + /keys/{chain-id}/{name}: + delete: + operationId: deleteKey + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "404": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Delete key in a chain. + tags: + - Keys + get: + operationId: getKey + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + $ref: '#/responses/getKeyResponse' + "400": + $ref: '#/responses/errorResponse' + "404": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Get details of a key in a chain. + tags: + - Keys + post: + description: coin-type is a query parameter (optional) + operationId: addKey + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: coin-type + type: integer + x-go-name: CoinType + responses: + "201": + $ref: '#/responses/keyCreatedResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Add a key in a chain. + tags: + - Keys + /keys/{chain-id}/{name}/restore: + post: + description: coin-type is a query parameter (optional) + operationId: restoreKey + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: coin-type + type: integer + x-go-name: CoinType + - in: body + name: body + required: true + schema: + $ref: '#/definitions/restoreKeyRequest' + x-go-name: Body + responses: + "200": + $ref: '#/responses/keyCreatedResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Restore a key using mnemonic. + tags: + - Keys + /light/{chain-id}: + delete: + operationId: deleteLight + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Delete light header of a chain. + tags: + - Light + post: + description: |- + force is optional and if given, it will be considered first, + height and hash can be used instead of force and need to send both values. + operationId: initLight + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - in: body + name: body + required: true + schema: + $ref: '#/definitions/postLightRequest' + x-go-name: Body + responses: + "201": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Init light header for a chain. + tags: + - Light + put: + operationId: updateLight + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Update light header of a chain. + tags: + - Light + /light/{chain-id}/header: + get: + operationId: getLightHeader + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + responses: + "200": + $ref: '#/responses/headerResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Get light header of a chain. + tags: + - Light + /light/{chain-id}/height: + get: + operationId: getLightHeight + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + description: Returns light height + schema: + $ref: '#/definitions/getLightHeightResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Get light height of a chain. + tags: + - Light + /paths: + get: + operationId: getPaths + responses: + "200": + $ref: '#/responses/getPathsResponse' + summary: Get paths list. + tags: + - Paths + /paths/{name}: + delete: + operationId: deletePath + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Delete Path. + tags: + - Paths + get: + operationId: getPath + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + $ref: '#/responses/getPathResponse' + "400": + $ref: '#/responses/errorResponse' + summary: Get single path details. + tags: + - Paths + post: + description: file parameter in body is optional and if given, it will considered + first. + operationId: addPath + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + - in: body + name: body + required: true + schema: + $ref: '#/definitions/postPathRequest' + x-go-name: Body + responses: + "201": + description: Returns success string + schema: + $ref: '#/definitions/stringSuccessResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Add a path. + tags: + - Paths + /paths/{name}/status: + get: + operationId: getPathStatus + parameters: + - in: path + name: name + required: true + type: string + x-go-name: Name + responses: + "200": + $ref: '#/responses/pathStatusRes' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Get status of a path. + tags: + - Paths + /query/{chain-id}/account/{address}: + get: + operationId: queryAccount + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - in: path + name: address + required: true + type: string + x-go-name: Address + responses: + "200": + description: Output format might change if address queried is Module Account + schema: + $ref: '#/definitions/queryAccountResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query account of a chain. + tags: + - Query + /query/{chain-id}/balance/{address}: + get: + operationId: queryBalance + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - in: path + name: address + required: true + type: string + x-go-name: Address + - in: query + name: ibc-denoms + type: boolean + x-go-name: IBCDenoms + responses: + "200": + $ref: '#/responses/queryBalanceResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query balance of a chain. + tags: + - Query + /query/{chain-id}/channels: + get: + operationId: queryChans + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: uint64 + in: query + name: offset + type: integer + x-go-name: Offset + - format: uint64 + in: query + name: limit + type: integer + x-go-name: Limit + responses: + "200": + $ref: '#/responses/queryChansResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query channels of a chain. + tags: + - Query + /query/{chain-id}/channels/{chan-id}/{port-id}: + get: + operationId: queryChan + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + - in: path + name: chan-id + required: true + type: string + x-go-name: ChannelID + - in: path + name: port-id + required: true + type: string + x-go-name: PortID + responses: + "200": + $ref: '#/responses/queryChanResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query channel by channelID and portID. + tags: + - Query + /query/{chain-id}/channels/connection/{conn-id}: + get: + operationId: queryConnChans + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: uint64 + in: query + name: offset + type: integer + x-go-name: Offset + - format: uint64 + in: query + name: limit + type: integer + x-go-name: Limit + - in: path + name: conn-id + required: true + type: string + x-go-name: ConnectionID + responses: + "200": + $ref: '#/responses/queryConnChansResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query channels of a connection in a chain. + tags: + - Query + /query/{chain-id}/clients: + get: + operationId: queryClients + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: uint64 + in: query + name: offset + type: integer + x-go-name: Offset + - format: uint64 + in: query + name: limit + type: integer + x-go-name: Limit + responses: + "200": + $ref: '#/responses/queryClientsResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query clients of a chain. + tags: + - Query + /query/{chain-id}/clients/{client-id}: + get: + operationId: queryClient + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + - in: path + name: client-id + required: true + type: string + x-go-name: ClientID + responses: + "200": + $ref: '#/responses/queryClientResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query client by clientID. + tags: + - Query + /query/{chain-id}/connections: + get: + operationId: queryConns + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: uint64 + in: query + name: offset + type: integer + x-go-name: Offset + - format: uint64 + in: query + name: limit + type: integer + x-go-name: Limit + responses: + "200": + $ref: '#/responses/queryConnsResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query connections of a chain. + tags: + - Query + /query/{chain-id}/connections/{conn-id}: + get: + operationId: queryConn + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + - in: path + name: conn-id + required: true + type: string + x-go-name: ConnectionID + responses: + "200": + $ref: '#/responses/queryConnResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query connection by connectionID. + tags: + - Query + /query/{chain-id}/connections/client/{client-id}: + get: + operationId: queryClientConns + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + responses: + "200": + $ref: '#/responses/queryClientConnsResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query connections of a client in a chain. + tags: + - Query + /query/{chain-id}/header: + get: + operationId: queryHeader + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + responses: + "200": + $ref: '#/responses/headerResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query header of a chain. + tags: + - Query + /query/{chain-id}/ibc-denoms: + get: + operationId: queryIBCDenoms + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + $ref: '#/responses/queryIBCDenomsResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query ibc-denoms of a chain. + tags: + - Query + /query/{chain-id}/node-state: + get: + operationId: queryNodeState + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + responses: + "200": + $ref: '#/responses/nodeStateResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query node state of a chain. + tags: + - Query + /query/{chain-id}/tx/{hash}: + get: + operationId: queryTx + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - in: path + name: hash + required: true + type: string + x-go-name: Hash + responses: + "200": + $ref: '#/responses/txResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query Tx details by hash. + tags: + - Query + /query/{chain-id}/txs: + post: + operationId: queryTxs + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: uint64 + in: query + name: offset + type: integer + x-go-name: Offset + - format: uint64 + in: query + name: limit + type: integer + x-go-name: Limit + - in: body + name: body + schema: + $ref: '#/definitions/txsRequest' + x-go-name: Body + responses: + "200": + $ref: '#/responses/txsResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query Txs using events. + tags: + - Query + /query/{chain-id}/valset: + get: + operationId: queryValSet + parameters: + - in: path + name: chain-id + required: true + type: string + x-go-name: ChainID + - format: int64 + in: query + name: height + type: integer + x-go-name: Height + responses: + "200": + $ref: '#/responses/valSetResponse' + "400": + $ref: '#/responses/errorResponse' + "500": + $ref: '#/responses/errorResponse' + summary: Query node state of a chain. + tags: + - Query + /version: + get: + operationId: version + responses: + "200": + $ref: '#/responses/versionResponse' + summary: Get version. + tags: + - Version +produces: +- application/json +responses: + chainStatusRes: + description: "" + schema: + $ref: '#/definitions/chainStatusResponse' + configResponse: + description: "" + schema: + $ref: '#/definitions/Config' + errorResponse: + description: "" + schema: + properties: + err: + type: string + x-go-name: Err + type: object + getChainResponse: + description: "" + schema: + $ref: '#/definitions/Chain' + getChainsResponse: + description: "" + schema: + $ref: '#/definitions/Chains' + getKeyResponse: + description: "" + schema: + $ref: '#/definitions/keyResponse' + getKeysResponse: + description: "" + schema: + items: + $ref: '#/definitions/keyResponse' + type: array + getLightHeightResponse: + description: "" + getPathResponse: + description: "" + schema: + $ref: '#/definitions/Path' + getPathsResponse: + description: "" + schema: + $ref: '#/definitions/Paths' + headerResponse: + description: "" + schema: + $ref: '#/definitions/Header' + keyCreatedResponse: + description: "" + schema: + $ref: '#/definitions/KeyOutput' + nodeStateResponse: + description: "" + schema: + $ref: '#/definitions/ConsensusState' + pathStatusRes: + description: "" + schema: + $ref: '#/definitions/PathWithStatus' + queryAccountResponse: + description: "" + schema: + properties: + account: + $ref: '#/definitions/BaseAccount' + type: object + queryBalanceResponse: + description: "" + schema: + $ref: '#/definitions/Coins' + queryChanResponse: + description: "" + schema: + $ref: '#/definitions/QueryChannelResponse' + queryChansResponse: + description: "" + schema: + $ref: '#/definitions/QueryChannelsResponse' + queryClientConnsResponse: + description: "" + schema: + $ref: '#/definitions/QueryClientConnectionsResponse' + queryClientResponse: + description: "" + schema: + $ref: '#/definitions/QueryClientStateResponse' + queryClientsResponse: + description: "" + schema: + $ref: '#/definitions/QueryClientStatesResponse' + queryConnChansResponse: + description: "" + schema: + $ref: '#/definitions/QueryConnectionChannelsResponse' + queryConnResponse: + description: "" + schema: + $ref: '#/definitions/QueryConnectionResponse' + queryConnsResponse: + description: "" + schema: + $ref: '#/definitions/QueryConnectionsResponse' + queryIBCDenomsResponse: + description: "" + schema: + $ref: '#/definitions/QueryDenomTracesResponse' + stringSuccessResponse: + description: "" + txResponse: + description: "" + schema: + $ref: '#/definitions/ResultTx' + txsResponse: + description: "" + schema: + items: + $ref: '#/definitions/ResultTx' + type: array + valSetResponse: + description: "" + schema: + $ref: '#/definitions/ValidatorSet' + versionResponse: + description: "" + schema: + $ref: '#/definitions/versionInfo' +schemes: +- http +swagger: "2.0" diff --git a/swagger-ui/swagger.yaml b/swagger-ui/swagger.yaml deleted file mode 100644 index 80cb222d7..000000000 --- a/swagger-ui/swagger.yaml +++ /dev/null @@ -1,352 +0,0 @@ -basePath: / -consumes: -- application/json -definitions: - Chain: - description: Chain represents the necessary data for connecting to and indentifying - a chain and its counterparites - properties: - account-prefix: - type: string - x-go-name: AccountPrefix - chain-id: - type: string - x-go-name: ChainID - gas-adjustment: - format: double - type: number - x-go-name: GasAdjustment - gas-prices: - type: string - x-go-name: GasPrices - key: - type: string - x-go-name: Key - rpc-addr: - type: string - x-go-name: RPCAddr - trusting-period: - type: string - x-go-name: TrustingPeriod - type: object - x-go-package: github.com/cosmos/relayer/relayer - Chains: - description: Chains is a collection of Chain - items: - $ref: '#/definitions/Chain' - type: array - x-go-package: github.com/cosmos/relayer/relayer - Config: - description: Config represents the config file for the relayer - properties: - chains: - $ref: '#/definitions/Chains' - global: - $ref: '#/definitions/GlobalConfig' - paths: - $ref: '#/definitions/Paths' - type: object - x-go-package: github.com/cosmos/relayer/cmd - GlobalConfig: - description: GlobalConfig describes any global relayer settings - properties: - api-listen-addr: - type: string - x-go-name: APIListenPort - light-cache-size: - format: int64 - type: integer - x-go-name: LightCacheSize - timeout: - type: string - x-go-name: Timeout - type: object - x-go-package: github.com/cosmos/relayer/cmd - Path: - description: |- - Path represents a pair of chains and the identifiers needed to - relay over them - properties: - dst: - $ref: '#/definitions/PathEnd' - src: - $ref: '#/definitions/PathEnd' - strategy: - $ref: '#/definitions/StrategyCfg' - type: object - x-go-package: github.com/cosmos/relayer/relayer - PathEnd: - description: |- - PathEnd represents the local connection identifers for a relay path - The path is set on the chain before performing operations - properties: - chain-id: - type: string - x-go-name: ChainID - channel-id: - type: string - x-go-name: ChannelID - client-id: - type: string - x-go-name: ClientID - connection-id: - type: string - x-go-name: ConnectionID - order: - type: string - x-go-name: Order - port-id: - type: string - x-go-name: PortID - version: - type: string - x-go-name: Version - type: object - x-go-package: github.com/cosmos/relayer/relayer - Paths: - additionalProperties: - $ref: '#/definitions/Path' - description: Paths represent connection paths between chains - type: object - x-go-package: github.com/cosmos/relayer/relayer - StrategyCfg: - description: StrategyCfg defines which relaying strategy to take for a given path - properties: - type: - type: string - x-go-name: Type - type: object - x-go-package: github.com/cosmos/relayer/relayer - addChainRequest: - properties: - account-prefix: - type: string - x-go-name: AccountPrefix - file: - type: string - x-go-name: FilePath - gas-adjustment: - type: string - x-go-name: GasAdjustment - gas-prices: - type: string - x-go-name: GasPrices - key: - type: string - x-go-name: Key - rpc-addr: - type: string - x-go-name: RPCAddr - trusting-period: - type: string - x-go-name: TrustingPeriod - url: - type: string - x-go-name: URL - type: object - x-go-package: github.com/cosmos/relayer/cmd - chainStatusResponse: - properties: - balance: - type: boolean - x-go-name: Balance - key: - type: boolean - x-go-name: Key - light: - type: boolean - x-go-name: Light - path: - type: boolean - x-go-name: Path - type: object - x-go-package: github.com/cosmos/relayer/cmd - editChainRequest: - properties: - key: - type: string - x-go-name: Key - value: - type: string - x-go-name: Value - type: object - x-go-package: github.com/cosmos/relayer/cmd - versionInfo: - properties: - commit: - type: string - x-go-name: Commit - cosmos-sdk: - type: string - x-go-name: CosmosSDK - go: - type: string - x-go-name: Go - version: - type: string - x-go-name: Version - type: object - x-go-package: github.com/cosmos/relayer/cmd -host: localhost:5183 -info: - description: A REST interface for state queries. - title: Relayer Rest Server. - version: 1.0.0 -paths: - /chains: - get: - operationId: getChains - responses: - "200": - $ref: '#/responses/getChainsResponse' - summary: Get chains list. - tags: - - Chains - /chains/{name}: - delete: - operationId: deleteChain - parameters: - - in: path - name: name - required: true - type: string - x-go-name: Name - responses: - "200": - $ref: '#/responses/chainResponse' - "500": - $ref: '#/responses/errorResponse' - summary: Delete Chain. - tags: - - Chains - get: - operationId: getChain - parameters: - - in: path - name: name - required: true - type: string - x-go-name: Name - responses: - "200": - $ref: '#/responses/getChainResponse' - "400": - $ref: '#/responses/errorResponse' - summary: Get single chain details. - tags: - - Chains - post: - description: file and url parameters in body are optional and can't use both - at once. - operationId: addChain - parameters: - - in: path - name: name - required: true - type: string - x-go-name: Name - - in: body - name: body - required: true - schema: - $ref: '#/definitions/addChainRequest' - x-go-name: Body - responses: - "201": - $ref: '#/responses/chainResponse' - "400": - $ref: '#/responses/errorResponse' - "500": - $ref: '#/responses/errorResponse' - summary: Add a chain. - tags: - - Chains - put: - operationId: updateChain - parameters: - - in: path - name: name - required: true - type: string - x-go-name: Name - - in: body - name: body - required: true - schema: - $ref: '#/definitions/editChainRequest' - x-go-name: Body - responses: - "200": - $ref: '#/responses/chainResponse' - "400": - $ref: '#/responses/errorResponse' - "500": - $ref: '#/responses/errorResponse' - summary: Update chain config values. - tags: - - Chains - /chains/{name}/status: - get: - operationId: getChainStatus - responses: - "200": - $ref: '#/responses/getChainStatus' - "400": - $ref: '#/responses/errorResponse' - summary: Get status of a chain. - tags: - - Chains - /config: - get: - operationId: config - responses: - "200": - $ref: '#/responses/configResponse' - summary: Get config. - tags: - - Config - /version: - get: - operationId: version - responses: - "200": - $ref: '#/responses/versionResponse' - summary: Get version. - tags: - - Version -produces: -- application/json -responses: - chainResponse: - description: "" - configResponse: - description: "" - schema: - $ref: '#/definitions/Config' - errorResponse: - description: "" - schema: - properties: - err: - type: string - x-go-name: Err - type: object - getChainResponse: - description: "" - schema: - $ref: '#/definitions/Chain' - getChainStatus: - description: "" - schema: - $ref: '#/definitions/chainStatusResponse' - getChainsResponse: - description: "" - schema: - $ref: '#/definitions/Chains' - versionResponse: - description: "" - schema: - $ref: '#/definitions/versionInfo' -schemes: -- http -swagger: "2.0" From 91486fe8ba259b93e96ad6120cafd99210d22734 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Wed, 24 Feb 2021 11:07:41 +0530 Subject: [PATCH 5/7] Fix golint issues --- cmd/doc.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/doc.go b/cmd/doc.go index df92f19a2..e8427381f 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -15,6 +15,7 @@ // // // swagger:meta +// nolint: deadcode package cmd import ( From 164481b22e54854ecffc10c9b4bec86dab920d98 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Wed, 24 Feb 2021 11:11:19 +0530 Subject: [PATCH 6/7] Fix unused lint issues --- cmd/doc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/doc.go b/cmd/doc.go index e8427381f..4709b7cad 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -15,7 +15,7 @@ // // // swagger:meta -// nolint: deadcode +// nolint package cmd import ( From ae99b480143bf22e54cfdb812bdb7ec509925ef7 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Wed, 3 Mar 2021 17:05:47 +0530 Subject: [PATCH 7/7] check chain-id in AddChain --- cmd/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/config.go b/cmd/config.go index f470401a9..2b1f9ed48 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -363,6 +363,9 @@ func newDefaultGlobalConfig() GlobalConfig { // AddChain adds an additional chain to the config func (c *Config) AddChain(chain *relayer.Chain) (err error) { + if chain.ChainID == "" { + return fmt.Errorf("chain ID cannot be empty") + } chn, err := c.Chains.Get(chain.ChainID) if chn == nil || err == nil { return fmt.Errorf("chain with ID %s already exists in config", chain.ChainID)