From 8f411346f114fd53cd04ecd21a83c944fb23b370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orkun=20K=C3=BCl=C3=A7e?= Date: Tue, 7 Apr 2020 14:39:59 +0300 Subject: [PATCH] Rename account/nonce to nonce (#67) --- cmd/bnsapi/docs/docs.go | 94 ++++++++++++++++----------------- cmd/bnsapi/docs/swagger.json | 92 ++++++++++++++++---------------- cmd/bnsapi/docs/swagger.yaml | 68 ++++++++++++------------ cmd/bnsapi/handlers/handlers.go | 8 +-- cmd/bnsapi/main.go | 4 +- 5 files changed, 133 insertions(+), 133 deletions(-) diff --git a/cmd/bnsapi/docs/docs.go b/cmd/bnsapi/docs/docs.go index 6ef1534..c50e987 100644 --- a/cmd/bnsapi/docs/docs.go +++ b/cmd/bnsapi/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2020-04-02 11:02:25.4904652 +0000 UTC m=+10.383077301 +// 2020-04-07 09:36:19.268982074 +0000 UTC m=+8.400265190 package docs @@ -103,52 +103,6 @@ var doc = `{ } } }, - "/account/nonce/address/{address}": { - "get": { - "description": "Returns nonce and public key registered for a given address if it was ever used.", - "tags": [ - "Nonce" - ], - "summary": "Returns nonce based on an address", - "parameters": [ - { - "type": "string", - "description": "Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un", - "name": "address", - "in": "path", - "required": true - } - ], - "responses": { - "200": {}, - "404": {}, - "500": {} - } - } - }, - "/account/nonce/pubkey/{pubKey}": { - "get": { - "description": "Returns nonce and public key registered for a given pubkey if it was ever used.", - "tags": [ - "Nonce" - ], - "summary": "Returns nonce based on an address", - "parameters": [ - { - "type": "string", - "description": "Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95", - "name": "pubKey", - "in": "path", - "required": true - } - ], - "responses": { - "200": {}, - "404": {}, - "500": {} - } - } - }, "/account/resolve/{starname}": { "get": { "description": "Resolve a given starname (like orkun*neuma) and return all metadata related to this starname,\nlist of crypto-addresses (targets), expiration date and owner address of the starname.", @@ -463,6 +417,52 @@ var doc = `{ } } }, + "/nonce/address/{address}": { + "get": { + "description": "Returns nonce and public key registered for a given address if it was ever used.", + "tags": [ + "Nonce" + ], + "summary": "Returns nonce based on an address", + "parameters": [ + { + "type": "string", + "description": "Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un", + "name": "address", + "in": "path", + "required": true + } + ], + "responses": { + "200": {}, + "404": {}, + "500": {} + } + } + }, + "/nonce/pubkey/{pubKey}": { + "get": { + "description": "Returns nonce and public key registered for a given pubkey if it was ever used.", + "tags": [ + "Nonce" + ], + "summary": "Returns nonce based on an address", + "parameters": [ + { + "type": "string", + "description": "Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95", + "name": "pubKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": {}, + "404": {}, + "500": {} + } + } + }, "/termdeposit/contracts": { "get": { "description": "The term deposit Contract are the contract defining the dates until which one can deposit.", diff --git a/cmd/bnsapi/docs/swagger.json b/cmd/bnsapi/docs/swagger.json index e8bb7c7..e66cf0a 100644 --- a/cmd/bnsapi/docs/swagger.json +++ b/cmd/bnsapi/docs/swagger.json @@ -83,52 +83,6 @@ } } }, - "/account/nonce/address/{address}": { - "get": { - "description": "Returns nonce and public key registered for a given address if it was ever used.", - "tags": [ - "Nonce" - ], - "summary": "Returns nonce based on an address", - "parameters": [ - { - "type": "string", - "description": "Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un", - "name": "address", - "in": "path", - "required": true - } - ], - "responses": { - "200": {}, - "404": {}, - "500": {} - } - } - }, - "/account/nonce/pubkey/{pubKey}": { - "get": { - "description": "Returns nonce and public key registered for a given pubkey if it was ever used.", - "tags": [ - "Nonce" - ], - "summary": "Returns nonce based on an address", - "parameters": [ - { - "type": "string", - "description": "Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95", - "name": "pubKey", - "in": "path", - "required": true - } - ], - "responses": { - "200": {}, - "404": {}, - "500": {} - } - } - }, "/account/resolve/{starname}": { "get": { "description": "Resolve a given starname (like orkun*neuma) and return all metadata related to this starname,\nlist of crypto-addresses (targets), expiration date and owner address of the starname.", @@ -443,6 +397,52 @@ } } }, + "/nonce/address/{address}": { + "get": { + "description": "Returns nonce and public key registered for a given address if it was ever used.", + "tags": [ + "Nonce" + ], + "summary": "Returns nonce based on an address", + "parameters": [ + { + "type": "string", + "description": "Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un", + "name": "address", + "in": "path", + "required": true + } + ], + "responses": { + "200": {}, + "404": {}, + "500": {} + } + } + }, + "/nonce/pubkey/{pubKey}": { + "get": { + "description": "Returns nonce and public key registered for a given pubkey if it was ever used.", + "tags": [ + "Nonce" + ], + "summary": "Returns nonce based on an address", + "parameters": [ + { + "type": "string", + "description": "Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95", + "name": "pubKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": {}, + "404": {}, + "500": {} + } + } + }, "/termdeposit/contracts": { "get": { "description": "The term deposit Contract are the contract defining the dates until which one can deposit.", diff --git a/cmd/bnsapi/docs/swagger.yaml b/cmd/bnsapi/docs/swagger.yaml index 8facbd6..86c28e6 100644 --- a/cmd/bnsapi/docs/swagger.yaml +++ b/cmd/bnsapi/docs/swagger.yaml @@ -211,40 +211,6 @@ paths: summary: Returns a list of `bnsd/x/domain` entities (like *neuma). tags: - Starname - /account/nonce/address/{address}: - get: - description: Returns nonce and public key registered for a given address if - it was ever used. - parameters: - - description: 'Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un' - in: path - name: address - required: true - type: string - responses: - "200": {} - "404": {} - "500": {} - summary: Returns nonce based on an address - tags: - - Nonce - /account/nonce/pubkey/{pubKey}: - get: - description: Returns nonce and public key registered for a given pubkey if it - was ever used. - parameters: - - description: 'Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95' - in: path - name: pubKey - required: true - type: string - responses: - "200": {} - "404": {} - "500": {} - summary: Returns nonce based on an address - tags: - - Nonce /account/resolve/{starname}: get: description: |- @@ -462,6 +428,40 @@ paths: summary: Returns a list of all the multisig Contracts. tags: - IOV token + /nonce/address/{address}: + get: + description: Returns nonce and public key registered for a given address if + it was ever used. + parameters: + - description: 'Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un' + in: path + name: address + required: true + type: string + responses: + "200": {} + "404": {} + "500": {} + summary: Returns nonce based on an address + tags: + - Nonce + /nonce/pubkey/{pubKey}: + get: + description: Returns nonce and public key registered for a given pubkey if it + was ever used. + parameters: + - description: 'Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95' + in: path + name: pubKey + required: true + type: string + responses: + "200": {} + "404": {} + "500": {} + summary: Returns nonce based on an address + tags: + - Nonce /termdeposit/contracts: get: description: The term deposit Contract are the contract defining the dates until diff --git a/cmd/bnsapi/handlers/handlers.go b/cmd/bnsapi/handlers/handlers.go index 60ba39a..d3dd9ba 100644 --- a/cmd/bnsapi/handlers/handlers.go +++ b/cmd/bnsapi/handlers/handlers.go @@ -472,8 +472,8 @@ var wEndpoint = []string{ "/account/domains?admin=_&offset=_", "/account/resolve/{starname}", "/account/accounts/{accountKey}", - "/account/nonce/address/{address}", - "/account/nonce/pubkey/{pubKey}", + "/nonce/address/{address}", + "/nonce/pubkey/{pubKey}", "/cash/balances?address=_[OR]offset=_", "/msgfee/msgfee?msgfee=_", "/username/resolve/{username}", @@ -632,7 +632,7 @@ type NonceAddressHandler struct { // @Success 200 // @Failure 404 // @Failure 500 -// @Router /account/nonce/address/{address} [get] +// @Router /nonce/address/{address} [get] func (h *NonceAddressHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { addressStr := LastChunk(r.URL.Path) addr, err := WeaveAddressFromQuery(addressStr) @@ -668,7 +668,7 @@ type NoncePubKeyHandler struct { // @Success 200 // @Failure 404 // @Failure 500 -// @Router /account/nonce/pubkey/{pubKey} [get] +// @Router /nonce/pubkey/{pubKey} [get] func (h *NoncePubKeyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { pubKeyStr := LastChunk(r.URL.Path) hexKey, err := hex.DecodeString(pubKeyStr) diff --git a/cmd/bnsapi/main.go b/cmd/bnsapi/main.go index d1c4a38..2bee050 100644 --- a/cmd/bnsapi/main.go +++ b/cmd/bnsapi/main.go @@ -79,8 +79,8 @@ func run(conf Configuration) error { rt.Handle("/account/domains", &handlers.DomainsHandler{Bns: bnscli}) rt.Handle("/account/accounts", &handlers.AccountsHandler{Bns: bnscli}) rt.Handle("/account/resolve/", &handlers.AccountResolveHandler{Bns: bnscli}) - rt.Handle("/account/nonce/address/", &handlers.NonceAddressHandler{Bns: bnscli}) - rt.Handle("/account/nonce/pubkey/", &handlers.NoncePubKeyHandler{Bns: bnscli}) + rt.Handle("/nonce/address/", &handlers.NonceAddressHandler{Bns: bnscli}) + rt.Handle("/nonce/pubkey/", &handlers.NoncePubKeyHandler{Bns: bnscli}) rt.Handle("/username/owner/", &handlers.OwnerHandler{Bns: bnscli}) rt.Handle("/username/resolve/", &handlers.ResolveHandler{Bns: bnscli}) rt.Handle("/cash/balances", &handlers.CashBalanceHandler{Bns: bnscli})