From 68bc29313cfe1cc2aca91cb759a66dc64345bdc0 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Mon, 25 Feb 2019 14:43:19 -0500 Subject: [PATCH 01/14] Create spec for: /api/wallets --- AdrianPaez_spec.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 AdrianPaez_spec.yml diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml new file mode 100644 index 0000000..ada3fa0 --- /dev/null +++ b/AdrianPaez_spec.yml @@ -0,0 +1,59 @@ +openapi: 3.0.0 +info: + title: Python to .Net + description: Still whitout description. + version: 0.25.1 +servers: +- url: http://www.skycoin.net + description: Main Skycoin server +- url: http://staging.node.skycoin.net + description: Internal staging server for developer. +components: + securitySchemes: + CsrfTokenAuth: # arbitrary name for the security scheme + type: apiKey + in: header # can be "header", "query" or "cookie" + name: X-CSRF-TOKEN # name of the header, query parameter or cookie + schemas: + genericError: + description: This is a generic error that should be default response + type: object + properties: + code: + type: integer + format: int64 + message: + type: string +paths: + /api/wallets: + post: + summary: Create wallet method. + description: Should create a new wallet (address) in the blockchain. + + security: + - CsrfTokenAuth: [] + + responses: + '200': + description: Should create a new wallet (address) in the blockchain + content: + application/json: + schema: + type: object + properties: + privateKey: + description: Private key, which will be used to sign transactions by the [POST] /api/sign + type: string + publicAddress: + description: Address which identifies the wallet in the blockchain + type: string + addressContext: + description: Any non security sensitive data associated with wallet. This context will be passed to [POST] /api/transactions/*. Can be empty. + type: string + default: + $ref : '#/components/schemas/genericError' + +# To remember : +# Every post method should use security schema. +# Feel free to use and reuse components +# I will remember other stuffs in the process \ No newline at end of file From 6618ae9cd93f665051b65ec70e15524994bf7944 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Mon, 25 Feb 2019 14:44:57 -0500 Subject: [PATCH 02/14] Add spec for: /api/balances/{address}/observation --- AdrianPaez_spec.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index ada3fa0..6b871ab 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -52,6 +52,26 @@ paths: type: string default: $ref : '#/components/schemas/genericError' + + /api/balances/{address}/observation: + delete: + summary: Delete observation + description: Should forget the wallet address and stop observing its balance. + + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + required: true + description: Address of the wallet + schema: + type: string + + responses: + default: + $ref: '#/components/schemas/genericError' # To remember : # Every post method should use security schema. From 90e3ee9b6e937e2c40d3ef610b40ab94c0c26a53 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Mon, 25 Feb 2019 16:57:03 -0500 Subject: [PATCH 03/14] Add spec for: /api/balances/{address}/observation --- AdrianPaez_spec.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 6b871ab..4b0fabd 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -73,6 +73,27 @@ paths: default: $ref: '#/components/schemas/genericError' + /api/balances/{address}/observation: + post: + summary: Create balance observation + + description: Should remember the wallet address to observe the wallet balance and return it in the [GET] /api/balances , if the balance is non zero. + + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + description: Address of the wallet + in: path + required: true + schema: + type: string + + responses: + default: + $ref: '#/components/schemas/genericError' + # To remember : # Every post method should use security schema. # Feel free to use and reuse components From bb5de0e18beb548274ec085436d364bef7d80d0c Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Mon, 25 Feb 2019 17:01:54 -0500 Subject: [PATCH 04/14] Make better: /api/balances/{address}/observation --- AdrianPaez_spec.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 4b0fabd..46d4a71 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -72,8 +72,7 @@ paths: responses: default: $ref: '#/components/schemas/genericError' - - /api/balances/{address}/observation: + post: summary: Create balance observation From 71bcae72866f1d8f7fbad63295846ffae71216a1 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Tue, 26 Feb 2019 15:07:14 -0500 Subject: [PATCH 05/14] Add transiction schema --- AdrianPaez_spec.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 46d4a71..38c3a87 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -24,6 +24,33 @@ components: format: int64 message: type: string + + transaction: + description: Represents a transiction + type: object + properties: + operationId: + description: Operation ID. Can be empty. Should be not empty for ransactions that broadcasted using this Blockchain.Api + type: guid + timespam: + description: Transaction moment as ISO 8601 in UTC + type: datetime + fromAddress: + description: Source address + type: string + toAddress: + description: Destination address + type: string + assetId: + description: Asset ID e.g. SKY + type: string + ammount: + description: Amount without fee. Is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceAmount * (10 ^ asset.Accuracy) + type: string + hash: + description: Transaction hash as base64 string + type: string + paths: /api/wallets: post: From cddd8f1387c6e8b1f7419296d02525634c1c2e1c Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Tue, 26 Feb 2019 15:09:09 -0500 Subject: [PATCH 06/14] Add spec for for issue 12 --- AdrianPaez_spec.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 38c3a87..4dd8417 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -120,6 +120,43 @@ paths: default: $ref: '#/components/schemas/genericError' + /api/transactions/history/to/{address}?take=integer&[afterHash=string]: + get: + summary: Get history to address + description: Should return completed transactions that transfer fund to the address and that were broadcasted after the transaction with the hash equal to the `afterHash`. If `afterHash` is empty, transactions should be read from the beginning. Should include all transactions broadcasted even those not going through `/transaction/broadcast/*` API endpoints. If there are no transactions to return, empty array should be returned. Amount of the returned transactions should not exceed take. + + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + required: true + description: Address from which you want to know the history + schema: + type: string + - name: take + in: query + required: false + description: Maximum return transactions + schema: + type: integer + - name: afterHash + in: query + required: false + description: Address of the transaction after which you have to search + schema: + type: string + + responses: + '200': + description: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/transaction' # To remember : # Every post method should use security schema. # Feel free to use and reuse components From 0c2063f4cae63ec91125cec03e660dd63b99beae Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Tue, 26 Feb 2019 15:39:59 -0500 Subject: [PATCH 07/14] Make better timespam property --- AdrianPaez_spec.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 4dd8417..81df41b 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -34,7 +34,8 @@ components: type: guid timespam: description: Transaction moment as ISO 8601 in UTC - type: datetime + format: date-time + type: string fromAddress: description: Source address type: string From e8b99199a4b78f9694346de57b5797d1ef32d9a6 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Wed, 27 Feb 2019 09:42:22 -0500 Subject: [PATCH 08/14] [spec] refs #6 - Add spec for POST /api/wallets --- AdrianPaez_spec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 81df41b..c10724a 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -63,7 +63,7 @@ paths: responses: '200': - description: Should create a new wallet (address) in the blockchain + description: The private key, public address and address context for the wallet created. content: application/json: schema: From 1b80aa2c633101e03b816958e992c35131cc8337 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Wed, 27 Feb 2019 09:45:05 -0500 Subject: [PATCH 09/14] [spec] refs #10 - Add spec: DELETE /api/balances/{address}/observation --- AdrianPaez_spec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index c10724a..59f4aa2 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -98,6 +98,8 @@ paths: type: string responses: + '200': + description: DELETE is OK default: $ref: '#/components/schemas/genericError' From b6987d77310b39707234efb135ffe97ef8ce9d80 Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Wed, 27 Feb 2019 10:13:40 -0500 Subject: [PATCH 10/14] [spec] refs #11 - Add spec: POST /api/balances/{address}/observation --- AdrianPaez_spec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 59f4aa2..39a71d7 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -120,6 +120,8 @@ paths: type: string responses: + '200': + description: POST is OK default: $ref: '#/components/schemas/genericError' From 4d1cdc3460ffa511ee0d5d85df7227f9492c961d Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Wed, 27 Feb 2019 10:47:59 -0500 Subject: [PATCH 11/14] [spec] refs #12 - Add spec: GET /api/transactions/history/to/{address} --- AdrianPaez_spec.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml index 39a71d7..5d42f15 100644 --- a/AdrianPaez_spec.yml +++ b/AdrianPaez_spec.yml @@ -31,10 +31,9 @@ components: properties: operationId: description: Operation ID. Can be empty. Should be not empty for ransactions that broadcasted using this Blockchain.Api - type: guid + type: string timespam: description: Transaction moment as ISO 8601 in UTC - format: date-time type: string fromAddress: description: Source address @@ -125,7 +124,7 @@ paths: default: $ref: '#/components/schemas/genericError' - /api/transactions/history/to/{address}?take=integer&[afterHash=string]: + /api/transactions/history/to/{address}: get: summary: Get history to address description: Should return completed transactions that transfer fund to the address and that were broadcasted after the transaction with the hash equal to the `afterHash`. If `afterHash` is empty, transactions should be read from the beginning. Should include all transactions broadcasted even those not going through `/transaction/broadcast/*` API endpoints. If there are no transactions to return, empty array should be returned. Amount of the returned transactions should not exceed take. @@ -155,7 +154,7 @@ paths: responses: '200': - description: + description: Transactions array. content: application/json: schema: From 3160ea4ee7cfb9108bb5da6dbbdb6c05c30e54ea Mon Sep 17 00:00:00 2001 From: AdrianPaez Date: Thu, 28 Feb 2019 10:41:44 -0500 Subject: [PATCH 12/14] [spec] Pass the specifications for the spec.yml file --- AdrianPaez_spec.yml | 167 -------------------------------------------- espec.yml | 137 +++++++++++++++++++++++++++++++++++- 2 files changed, 136 insertions(+), 168 deletions(-) delete mode 100644 AdrianPaez_spec.yml diff --git a/AdrianPaez_spec.yml b/AdrianPaez_spec.yml deleted file mode 100644 index 5d42f15..0000000 --- a/AdrianPaez_spec.yml +++ /dev/null @@ -1,167 +0,0 @@ -openapi: 3.0.0 -info: - title: Python to .Net - description: Still whitout description. - version: 0.25.1 -servers: -- url: http://www.skycoin.net - description: Main Skycoin server -- url: http://staging.node.skycoin.net - description: Internal staging server for developer. -components: - securitySchemes: - CsrfTokenAuth: # arbitrary name for the security scheme - type: apiKey - in: header # can be "header", "query" or "cookie" - name: X-CSRF-TOKEN # name of the header, query parameter or cookie - schemas: - genericError: - description: This is a generic error that should be default response - type: object - properties: - code: - type: integer - format: int64 - message: - type: string - - transaction: - description: Represents a transiction - type: object - properties: - operationId: - description: Operation ID. Can be empty. Should be not empty for ransactions that broadcasted using this Blockchain.Api - type: string - timespam: - description: Transaction moment as ISO 8601 in UTC - type: string - fromAddress: - description: Source address - type: string - toAddress: - description: Destination address - type: string - assetId: - description: Asset ID e.g. SKY - type: string - ammount: - description: Amount without fee. Is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceAmount * (10 ^ asset.Accuracy) - type: string - hash: - description: Transaction hash as base64 string - type: string - -paths: - /api/wallets: - post: - summary: Create wallet method. - description: Should create a new wallet (address) in the blockchain. - - security: - - CsrfTokenAuth: [] - - responses: - '200': - description: The private key, public address and address context for the wallet created. - content: - application/json: - schema: - type: object - properties: - privateKey: - description: Private key, which will be used to sign transactions by the [POST] /api/sign - type: string - publicAddress: - description: Address which identifies the wallet in the blockchain - type: string - addressContext: - description: Any non security sensitive data associated with wallet. This context will be passed to [POST] /api/transactions/*. Can be empty. - type: string - default: - $ref : '#/components/schemas/genericError' - - /api/balances/{address}/observation: - delete: - summary: Delete observation - description: Should forget the wallet address and stop observing its balance. - - security: - - CsrfTokenAuth: [] - - parameters: - - name: address - in: path - required: true - description: Address of the wallet - schema: - type: string - - responses: - '200': - description: DELETE is OK - default: - $ref: '#/components/schemas/genericError' - - post: - summary: Create balance observation - - description: Should remember the wallet address to observe the wallet balance and return it in the [GET] /api/balances , if the balance is non zero. - - security: - - CsrfTokenAuth: [] - - parameters: - - name: address - description: Address of the wallet - in: path - required: true - schema: - type: string - - responses: - '200': - description: POST is OK - default: - $ref: '#/components/schemas/genericError' - - /api/transactions/history/to/{address}: - get: - summary: Get history to address - description: Should return completed transactions that transfer fund to the address and that were broadcasted after the transaction with the hash equal to the `afterHash`. If `afterHash` is empty, transactions should be read from the beginning. Should include all transactions broadcasted even those not going through `/transaction/broadcast/*` API endpoints. If there are no transactions to return, empty array should be returned. Amount of the returned transactions should not exceed take. - - security: - - CsrfTokenAuth: [] - - parameters: - - name: address - in: path - required: true - description: Address from which you want to know the history - schema: - type: string - - name: take - in: query - required: false - description: Maximum return transactions - schema: - type: integer - - name: afterHash - in: query - required: false - description: Address of the transaction after which you have to search - schema: - type: string - - responses: - '200': - description: Transactions array. - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/transaction' -# To remember : -# Every post method should use security schema. -# Feel free to use and reuse components -# I will remember other stuffs in the process \ No newline at end of file diff --git a/espec.yml b/espec.yml index 90f96f5..3e33160 100644 --- a/espec.yml +++ b/espec.yml @@ -24,4 +24,139 @@ components: format: int64 message: type: string -paths: \ No newline at end of file + + transaction: + description: Represents a transiction + type: object + properties: + operationId: + description: Operation ID. Can be empty. Should be not empty for ransactions that broadcasted using this Blockchain.Api + type: string + timespam: + description: Transaction moment as ISO 8601 in UTC + type: string + fromAddress: + description: Source address + type: string + toAddress: + description: Destination address + type: string + assetId: + description: Asset ID e.g. SKY + type: string + ammount: + description: Amount without fee. Is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceAmount * (10 ^ asset.Accuracy) + type: string + hash: + description: Transaction hash as base64 string + type: string +paths: + /api/wallets: + post: + summary: Create wallet method. + description: Should create a new wallet (address) in the blockchain. + + security: + - CsrfTokenAuth: [] + + responses: + '200': + description: The private key, public address and address context for the wallet created. + content: + application/json: + schema: + type: object + properties: + privateKey: + description: Private key, which will be used to sign transactions by the [POST] /api/sign + type: string + publicAddress: + description: Address which identifies the wallet in the blockchain + type: string + addressContext: + description: Any non security sensitive data associated with wallet. This context will be passed to [POST] /api/transactions/*. Can be empty. + type: string + default: + $ref : '#/components/schemas/genericError' + + /api/balances/{address}/observation: + delete: + summary: Delete observation + description: Should forget the wallet address and stop observing its balance. + + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + required: true + description: Address of the wallet + schema: + type: string + + responses: + '200': + description: DELETE is OK + default: + $ref: '#/components/schemas/genericError' + + post: + summary: Create balance observation + + description: Should remember the wallet address to observe the wallet balance and return it in the [GET] /api/balances , if the balance is non zero. + + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + description: Address of the wallet + in: path + required: true + schema: + type: string + + responses: + '200': + description: POST is OK + default: + $ref: '#/components/schemas/genericError' + + /api/transactions/history/to/{address}: + get: + summary: Get history to address + description: Should return completed transactions that transfer fund to the address and that were broadcasted after the transaction with the hash equal to the `afterHash`. If `afterHash` is empty, transactions should be read from the beginning. Should include all transactions broadcasted even those not going through `/transaction/broadcast/*` API endpoints. If there are no transactions to return, empty array should be returned. Amount of the returned transactions should not exceed take. + + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + required: true + description: Address from which you want to know the history + schema: + type: string + - name: take + in: query + required: false + description: Maximum return transactions + schema: + type: integer + - name: afterHash + in: query + required: false + description: Address of the transaction after which you have to search + schema: + type: string + + responses: + '200': + description: Transactions array. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/transaction' \ No newline at end of file From 5d78ab37ff430c746dd355d505539068a417e973 Mon Sep 17 00:00:00 2001 From: Marcos Maceo Date: Thu, 28 Feb 2019 16:50:27 -0500 Subject: [PATCH 13/14] [spec] Update spect with default response for /api/transactions/history/to/{address}: --- espec.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/espec.yml b/espec.yml index 3e33160..e57eb21 100644 --- a/espec.yml +++ b/espec.yml @@ -159,4 +159,6 @@ paths: schema: type: array items: - $ref: '#/components/schemas/transaction' \ No newline at end of file + $ref: '#/components/schemas/transaction' + default: + $ref: '#/components/schemas/genericError' \ No newline at end of file From 53da491dda8d8df10719f66fe02e7a3b917722f5 Mon Sep 17 00:00:00 2001 From: Marcos Maceo Date: Thu, 28 Feb 2019 16:53:02 -0500 Subject: [PATCH 14/14] [spec] Rename espec.yml to spec.yml --- espec.yml => spec.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename espec.yml => spec.yml (100%) diff --git a/espec.yml b/spec.yml similarity index 100% rename from espec.yml rename to spec.yml