Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cbermudez97 specs #26

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
308 changes: 308 additions & 0 deletions cbermudez97_specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
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/single/{operationId}:
get:
summary: Return broadcasted transaction by the operationId.
description: Should return broadcasted transaction by the operationId . All transactions with single input and output, that were broadcasted by the [POST] /api/transactions/broadcast should be available here.

parameters:
- name: operationId
in: path
required: true
schema:
type: string
description: Operation Id.

responses:
'200':
description: Broadcasted transaction by the opreationId.
content:
application/json:
schema:
type: object
properties:
operationId:
type: string
description: Operation ID.

state:
type: string
enum:
- inProgress
- completed
- failed
description: State of the transaction.

timestamp:
type: string
description: 'Transaction moment as ISO 8601 in UTC.'

amount:
type: string
description: Amount without fee. Is integer as string, aligned to the asset accuracy. Should be non empty if the state is Completed.

fee:
type: string
description: Fee should be zero if the state is Completed.

hash:
type: string
description: Transaction hash as base64 string. Can be empty. Should be non empty if the state is Completed.

error:
type: string
description: Error description. Can be empty. Should be non empty if the state is Error.

errorCode:
type: string
enum:
- unknown
- amountIsTooSmall
- notEnoughBalance
description: Error code. Can be empty. Should be non empty if the state is Failed.

block:
type: integer
format: int64
description: Incremental ID of the moment, when the transaction state changing is detected. It should be the same sequence as for block in the [GET] /api/balances response. In other words block number/height.
default:
$ref : '#/components/schemas/genericError'

/api/transactions/broadcast/many-inputs/{operationId}:
get:
summary: 'Return broadcasted transaction by the opreationId.'
description: Should return broadcasted transaction by the opreationId. All transactions with many inputs, that were broadcasted by the should be available here.

parameters:
- name: operationId
in: path
required: true
schema:
type: string
description: Operation Id.

responses:
'200':
description: Broadcasted transaction by the opreationId.
content:
application/json:
schema:
type: object
properties:
operationId:
type: string
description: Operation ID.

state:
type: string
enum:
- inProgress
- completed
- failed
description: State of the transaction.

timestamp:
type: string
description: 'Transaction moment as ISO 8601 in UTC.'

inputs:
type: array
items:
type: object
properties:
fromAddress:
type: string
description: Destination address.
amount:
type: string
description: Actual amount that is transferred from the fromAddress. Integer as string, aligned to the asset accuracy.
description: Destinations. Should be non null if the state is Completed.

toAddress:
type: string
description: Destination address.

fee:
type: string
description: Fee. Is integer as string, aligned to the asset accuracy.

hash:
type: string
description: Transaction hash as base64 string. Can be empty. Should be non empty if the state is Completed.

error:
type: string
description: Error description. Can be empty. Should be non empty if the state is Error.

errorCode:
type: string
enum:
- unknown
- amountIsTooSmall
- notEnoughBalance
description: Error code. Can be empty. Should be non empty if the state is Failed.

block:
type: integer
format: int64
description: Incremental ID of the moment, when the transaction state changing is detected. It should be the same sequence as for block in the [GET] /api/balances response. In other words block number/height.


default:
$ref : '#/components/schemas/genericError'

/api/transactions/broadcast/many-outputs/{operationId}:
get:
summary: Return broadcasted transactions by operation ID.

description: Should return broadcasted transaction by operation ID . All transactions with many outputs, that were broadcasted by the [POST] /api/transaction/broadcast should be available here.

security:
- CsrfTokenAuth: []

parameters:
- name: operationId
in: path
description: Operation ID.
required: true
schema:
type: string


responses:
'200':
description: Broadcasted transactions by Operation ID.
content:
application/json:
schema:
type: object
properties:
operationId:
type: string
description: Operation ID.

state:
type: string
enum:
- inProgress
- completed
- failed
description: State of the transaction.

timestamp:
type: string
description: 'Transaction moment as ISO 8601 in UTC.'

fromAddress:
type: string
description: Source address.

outputs:
type: array
items:
type: object
properties:
toAddress:
type: string
description: Destination address.
amount:
type: string
description: Actual amount that is transferred to the toAddress. Integer as string, aligned to the asset accuracy.
description: Destinations. Should be non null if the state is Completed.

fee:
type: string
description: Fee. Is integer as string, aligned to the asset accuracy.

hash:
type: string
description: Transaction hash as base64 string. Can be empty. Should be non empty if the state is Completed.

error:
type: string
description: Error description. Can be empty. Should be non empty if the state is Error

errorCode:
type: string
enum:
- unknown
- amountIsTooSmall
- notEnoughBalance
description: Error code. Can be empty. Should be non empty if the state is Failed.

block:
type: integer
format: int64
description: Incremental ID of the moment, when the transaction state changing is detected. It should be the same sequence as for block in the [GET] /api/balances response. In other words block number/height.

default:
$ref : '#/components/schemas/genericError'

/api/sign:
post:
summary: Sign transaction method.

description: Should sign given transaction with the given private key.

security:
- CsrfTokenAuth: []

requestBody:
description: 'A JSON object containing: The Private Keys, which were returned by the [POST] /api/wallets. Multiple keys can be used for transactions with multiple inputs. The Transaction Context in the blockchain specific format [POST] /api/transactions or [PUT] /api/transactions.'
required: true
content:
application/json:
schema:
type: object
properties:
privateKeys:
type: array
items:
type: string
transactionContext:
type: string

responses:
'200': # status code
description: Signed transaction, which will be used to broadcast the transaction [PUT] /api/transactions/broadcast
content:
application/json:
schema:
type: object
properties:
signedTransaction:
type: string
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