From 479885442349ab4005c58f6869b610011dd07fe8 Mon Sep 17 00:00:00 2001 From: Raul Date: Mon, 25 Feb 2019 21:03:33 -0500 Subject: [PATCH 1/3] [LazaroRaul] refs #22 Create initial endpoint for endpoint [api] Broadcast signed tx --- LazaroRaul_specs.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 LazaroRaul_specs.yml diff --git a/LazaroRaul_specs.yml b/LazaroRaul_specs.yml new file mode 100644 index 0000000..70ddb43 --- /dev/null +++ b/LazaroRaul_specs.yml @@ -0,0 +1,72 @@ +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/transactions/broadcast: + post: + summary: Broadcast the signed transaction. + description: Should broadcast the signed transaction. Result code can be evaluated synchronously or returned asynchronously in the [GET] /api/transactions/broadcast/* response with error code. + security: + - CsrfTokenAuth: [] + + requestBody: + description: 'A JSON object containing: Operation ID. The signed transaction returned by the [POST] /api/sign' + required: true + content: + application/json: + schema: + type: object + properties: + operationId: + type: string + description: Operation ID. + signedTransaction: + type: string + description: The signed transaction returned by the [POST] /api/sign. + + responses: + '200': # status code + description: Error code. + content: + application/json: + schema: + type: object + properties: + errorCode: + type: string + enum: + - amountIsTooSmall + - notEnoughBalance + description: Error code. Can be empty. Should be non empty if an error that match one of the listed code is occured. For other errors use HTTP status codes. + default: + $ref : '#/components/schemas/genericError' + +# To remember : +# Every post method should use security schema. +# Feel free to use and reuse components +# I think, at some point, someone should use oneOf and anyOf, pls take a look From 9c89154c0ee44dec27e497d5bc03e00c1bee8b3d Mon Sep 17 00:00:00 2001 From: Raul Date: Mon, 25 Feb 2019 21:50:34 -0500 Subject: [PATCH 2/3] [LazaroRaul] refs #24 Create initial specification for endpoint [api] Explorer URL --- LazaroRaul_specs.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/LazaroRaul_specs.yml b/LazaroRaul_specs.yml index 70ddb43..c0e42e4 100644 --- a/LazaroRaul_specs.yml +++ b/LazaroRaul_specs.yml @@ -48,7 +48,7 @@ paths: signedTransaction: type: string description: The signed transaction returned by the [POST] /api/sign. - + responses: '200': # status code description: Error code. @@ -66,6 +66,34 @@ paths: default: $ref : '#/components/schemas/genericError' + /api/addresses/{address}/explorer-url: + get: + summary: Return one or many blockchain explorer URLs. + description: Should return one or many blockchain explorer URLs for the given address. + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + description: Address for find blockchain explorer URLs + required: true + schema: + type: string + + responses: + '200': + description: Blockchain explorer URL for the given address + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref : '#/components/schemas/genericError' + + # To remember : # Every post method should use security schema. # Feel free to use and reuse components From 8e88afca5a33bc3218acc1684949273ad338e67c Mon Sep 17 00:00:00 2001 From: Raul Date: Mon, 25 Feb 2019 22:43:31 -0500 Subject: [PATCH 3/3] [LazaroRaul] refs #23 Create initial specification for endpoint [api] Many-outputs tx --- LazaroRaul_specs.yml | 63 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/LazaroRaul_specs.yml b/LazaroRaul_specs.yml index c0e42e4..124f256 100644 --- a/LazaroRaul_specs.yml +++ b/LazaroRaul_specs.yml @@ -30,7 +30,7 @@ paths: /api/transactions/broadcast: post: summary: Broadcast the signed transaction. - description: Should broadcast the signed transaction. Result code can be evaluated synchronously or returned asynchronously in the [GET] /api/transactions/broadcast/* response with error code. + description: Should broadcast the signed transaction. Result code can be evaluated synchronously or returned asynchronously in the `[GET] /api/transactions/broadcast/*` response with error code. security: - CsrfTokenAuth: [] @@ -76,14 +76,14 @@ paths: parameters: - name: address in: path - description: Address for find blockchain explorer URLs + description: Address for find blockchain explorer URLs. required: true schema: type: string responses: '200': - description: Blockchain explorer URL for the given address + description: Blockchain explorer URLs for the given address. content: application/json: schema: @@ -93,6 +93,63 @@ paths: default: $ref : '#/components/schemas/genericError' + /api/transactions/many-outputs: + post: + summary: Build not signed transaction with many outputs. + description: Should build not signed transaction with many outputs. If the transaction with the specified `operationId` has already been built by one of the `[POST] /api/transactions/*` call, it should be ignored and regular response (as in the first request) should be returned. Fee should be added to the specified amount. + security: + - CsrfTokenAuth: [] + + requestBody: + description: 'A JSON object containing: Operation ID. Source address. Destinations. Asset ID to transfer, defaults to SKY' + required: true + content: + application/json: + schema: + type: object + properties: + operationId: + type: string + description: Operation ID. + fromAddress: + type: string + description: Source address. + outputs: + type: array + items: + type: object + properties: + toAddress: + type: string + description: Destination address. + amount: + type: string + description: Amount to transfer to the toAddress. Integer as string, aligned to the asset accuracy. Actual value can be calculated as x = amount / (10 ^ asset.Accuracy). + description: Destinations. + assetId: + type: string + description: Asset ID to transfer, defaults to SKY. + + responses: + '200': # status code + description: Error code. The transaction context + content: + application/json: + schema: + type: object + properties: + errorCode: + type: string + enum: + - amountIsTooSmall + - notEnoughBalance + description: Error code. Can be empty. Should be non empty if an error that match one of the listed code is occured. For other errors use HTTP status codes. + transactionContext: + type: string + description: The transaction context in the blockchain specific format, which will be passed to the [POST] /api/sign. Should be not empty when result is successful. + default: + $ref : '#/components/schemas/genericError' + # To remember : # Every post method should use security schema.