From bdd6030c7006bb67a232aeb2dd7343a967059dac Mon Sep 17 00:00:00 2001 From: andriiK Date: Wed, 10 Feb 2021 17:59:42 +0200 Subject: [PATCH 01/15] APL-1783 finish api blockchain part --- .../main/resources/yaml/apollo-api-v2.yaml | 399 ++++++++++++++---- 1 file changed, 307 insertions(+), 92 deletions(-) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index 35db46df86..27ad11dd69 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -27,8 +27,12 @@ tags: - name: info description: An information + - name: blockchain + description: Operations with blockchain state. + paths: - /@@account: + + /@@account/child: post: tags: - account @@ -127,10 +131,11 @@ paths: $ref: '#/components/responses/ServerError' security: - bearerAuth: [] + /@@account/{account}: get: tags: - - account + - blockchain summary: Returns the details account information operationId: getAccountInfo parameters: @@ -141,6 +146,24 @@ paths: schema: type: string example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + - name: includeAssets + in: query + schema: + type: boolean + default: false + description: include asserts to the response + - name: includeCurrencies + in: query + schema: + type: boolean + default: false + description: include currencies to the response + - name: includeLessors + in: query + schema: + type: boolean + default: false + description: include lessors to the response responses: 200: description: successful operation @@ -152,6 +175,175 @@ paths: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' + + + /@@transactions/{transactionId}: + get: + tags: + - blockchain + summary: Get transaction object given transaction id. + description: Return the detail information about transaction by id. + operationId: getTxById + parameters: + - name: transactionId + in: path + description: Transaction id + required: true + schema: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionInfoResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + + /@@transactions: + get: + tags: + - blockchain + summary: Get transactions following given filter. + operationId: getTxsByFilter + description: Return the detail information about transactions by filter. + parameters: + - in: query + name: account + description: The account id + schema: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + + - in: query + name: type + description: Transaction type + schema: + type: string + format: int8 + example: '2' + + + - in: query + name: subtype + description: Transaction subtype + schema: + type: string + format: int8 + example: '2' + + - in: query + name: timestamp + description: Show transactions with tx_timestamp >= timestamp + schema: + type: integer + format: int64 + example: 1591696372000 + + - in: query + name: numberOfConfirmations + description: the number of transaction confirmations + schema: + type: integer + format: int32 + + - in: query + name: withMessage + description: show transaction with message + schema: + type: boolean + default: false + + - in: query + name: phasedOnly + description: show only phased transactions + schema: + type: boolean + default: false + + - in: query + name: nonPhasedOnly + description: show only non phased transactions + schema: + type: boolean + default: false + + - in: query + name: includeExpiredPrunable + description: include transactions with expired prunables + schema: + type: boolean + default: false + + - in: query + name: includePhasingResult + description: include transactions with phasing results + schema: + type: boolean + default: false + + - in: query + name: executedOnly + description: show only executed transactions + schema: + type: boolean + default: false + + - $ref: '#/components/parameters/offsetParam' + - $ref: '#/components/parameters/limitParam' + + responses: + 200: + description: successful operation + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TransactionInfoResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + post: + tags: + - blockchain + summary: Broadcast a batch of transactions and return the transaction receipt list. + description: Asynchronously broadcast the batch of the signed transaction to the network. The transactions are immediately put into an unconfirmed transaction pool in the same order as in the batch and later are sending to the network. + operationId: broadcastTxs + requestBody: + description: an array of signed transactions, each item is a byte array in hex format + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TxRequest' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@state/blockchain: get: tags: @@ -341,96 +533,7 @@ paths: $ref: '#/components/responses/ServerError' security: - bearerAuth: [] - /@@transaction: - post: - tags: - - tx - summary: Broadcast transaction and return transaction receipt. - description: | - Asynchronously broadcast the signed transaction to the network. - The transaction is validated and immediately put into an unconfirmed transaction pool - for further sending to the blockchain. - operationId: broadcastTx - requestBody: - description: the signed transaction is a byte array in hex format - content: - application/json: - schema: - $ref: '#/components/schemas/TxRequest' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/TxReceipt' - 400: - $ref: '#/components/responses/BadRequest' - 409: - $ref: '#/components/responses/ConflictResource' - 500: - $ref: '#/components/responses/ServerError' - /@@transaction/batch: - post: - tags: - - tx - summary: Broadcast a batch of transactions and return the transaction receipt list. - description: Asynchronously broadcast the batch of the signed transaction to the network. The transactions are immediately put into an unconfirmed transaction pool in the same order as in the batch and later are sending to the network. - operationId: broadcastTxBatch - requestBody: - description: an array of signed transactions, each item is a byte array in hex format - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/TxRequest' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ListResponse' - 401: - description: Not authenticated - 403: - description: Access token does not have the required scope - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - /@@transaction/{transaction}: - get: - tags: - - tx - summary: Get transaction object given transaction id. - description: Return the detail information about transaction by id. - operationId: getTxById - parameters: - - name: transaction - in: path - description: Transaction id - required: true - schema: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701' - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionInfoResp' - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' + /@@operation/count: post: tags: @@ -929,10 +1032,13 @@ components: type: string format: hex_bytearray example: '001047857c04a00539dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152eef5365f2400292d00ca9a3b0000000000c2eb0b000000000000000000000000000000000000000000000000000000000000000000000000920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d5600000000f1da1300fe7062e6fb2fbb37' + + AccountInfoResp: allOf: - $ref: '#/components/schemas/BaseResponse' - $ref: '#/components/schemas/AccountInfo' + AccountInfo: type: object required: @@ -959,12 +1065,98 @@ components: type: string format: integer example: '45225600000000' + forgedBalance: + type: string + format: integer + example: '45225600000000' status: type: string enum: - created - verified example: created + assetBalances: + type: array + items: + $ref: '#/components/schemas/AssetBalance' + unconfirmedAssetBalances: + type: array + items: + $ref: '#/components/schemas/AssetBalance' + currencies: + type: array + items: + $ref: '#/components/schemas/Currency' + + AssetBalance: + type: object + properties: + asset: + type: string + format: hex_bytearray + description: Asset id + example: 'a2e9b946290b48b69985dc2e5a5860a1' + balance: + type: integer + format: int64 + description: Asset balance. (ATU) + example: 100 + + Currency: + type: object + properties: + id: + type: string + format: hex_bytearray + description: Currency id + example: 'a2e9b946290b48b69985dc2e5a5860a1' + + account: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + + balance: + type: integer + format: int64 + description: Currency balance. (ATU) + example: 98400000 + + unconfirmedBalance: + type: integer + format: int64 + description: Currency unconfirmed balance. + example: 98400000 + name: + type: string + example: 'TTT' + code: + type: string + example: 'TTT' + type: + description: | + The currency type. + There are six types: + EXCHANGEABLE = 0; + CONTROLLABLE = 1; + MINTABLE = 2; + NON_SHUFFLEABLE = 3; + RESERVABLE = 4; + CLAIMABLE = 5; + type: integer + format: int8 + example: 1 + decimals: + type: integer + format: int8 + example: 5 + issuanceHeight: + type: integer + format: int8 + example: 0 + issuerAccount: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + QueryObject: type: object properties: @@ -1133,6 +1325,7 @@ components: format: int64 description: the amount of block transaction example: 1758 + CountResponse: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -1233,6 +1426,28 @@ components: should not be displayed to user. Main purpose is create bug reports with meaningful content. type: string example: 'Description of failure' + + parameters: + offsetParam: + in: query + name: offset + required: false + schema: + type: integer + minimum: 0 + default: 0 + description: The number of items to skip before starting to collect the result set. + limitParam: + in: query + name: limit + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + default: 20 + description: The numbers of items to return. + responses: BadRequest: description: Bad request - malformed request or wrong parameters From de8d312124e7fef5bd5ea9dd7188abaecbbdd254 Mon Sep 17 00:00:00 2001 From: andriiK Date: Thu, 11 Feb 2021 21:21:01 +0200 Subject: [PATCH 02/15] APL-1783 finish api public node info --- .../main/resources/yaml/apollo-api-v2.yaml | 169 ++++++++++++++---- 1 file changed, 132 insertions(+), 37 deletions(-) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index 27ad11dd69..e644ecc30b 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -16,19 +16,18 @@ servers: - url: http://localhost:7876/rest tags: + - name: blockchain + description: Operations with blockchain state. + - name: node public info + description: Public information about node. + - name: account description: Operations about account - name: state description: Everything about blockchain state - - name: tx - description: Access to transactions management - name: operations description: List operations by account (the bank reconcilation) - - name: info - description: An information - - name: blockchain - description: Operations with blockchain state. paths: @@ -98,6 +97,7 @@ paths: $ref: '#/components/responses/ServerError' security: - bearerAuth: [] + /@@account/money: post: tags: @@ -344,6 +344,72 @@ paths: $ref: '#/components/responses/ServerError' + /@@node/x509: + get: + tags: + - node public info + summary: Get node certificate. + description: Return node certificate in x509 format. + operationId: getX509 + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/X509Response' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/health: + get: + tags: + - node public info + summary: Gets node health + operationId: getHealthInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/HealthResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/network: + get: + tags: + - node public info + summary: Gets node network info + operationId: getNetworkInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@node/blockchain: + get: + tags: + - node public info + summary: Get blockchain object + description: Return details information about the blockchain + operationId: getBlockchainInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/BlockchainInfo' + 500: + $ref: '#/components/responses/ServerError' + /@@state/blockchain: get: tags: @@ -595,38 +661,7 @@ paths: security: - bearerAuth: [] - /@@info/health: - get: - tags: - - info - summary: Gets node health - operationId: getHealthInfo - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/HealthResponse' - 500: - $ref: '#/components/responses/ServerError' - /@@info/blockchain: - get: - tags: - - info - summary: Get blockchain object - description: Return details information about the blockchain - operationId: getBlockchainInfo - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BlockchainInfo' - 500: - $ref: '#/components/responses/ServerError' components: schemas: @@ -1326,6 +1361,21 @@ components: description: the amount of block transaction example: 1758 + + X509Response: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + id: + type: string + format: hex_bytearray + example: 'MIIIgjCCB2qgAwIBAgIITFQTbb/xK/QwDQYJKoZIhvcNAQELBQAwVDELMAkGA1UE + .......... + BhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczElMCMGA1UEAxMc' + + + CountResponse: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -1370,6 +1420,51 @@ components: type: boolean description: "Returns true if the trimming process is active" + + NetworkResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/PeerInfo' + - type: object + properties: + inboundPeers: + type: integer + format: int8 + description: "Inbound peers" + outboundPeers: + type: integer + format: int8 + description: "Outbound Peers" + + PeerInfo: + type: object + properties: + sharedAddress: + type: boolean + description: "Is node shared address" + version: + type: string + description: "App version" + example: "1.47.10" + platform: + type: string + description: "Platform where app has been running." + example: "Linux amd64" + apiPort: + type: integer + format: int8 + description: "App port" + inboundWebSocket: + type: boolean + description: "Is inbound web socket works." + outboundWebSocket: + type: boolean + description: "Is outbound web socket works." + chainId: + type: string + description: "Node chain id." + example: 'a2e9b946-290b-48b6-9985-dc2e5a5860a1' + BaseResponse: type: object properties: From 4b1632081b258e64ee454342dc6db549bc267c73 Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 15 Feb 2021 11:48:11 +0200 Subject: [PATCH 03/15] APL-1783 finish api private getForgers getFullHealth --- .../main/resources/yaml/apollo-api-v2.yaml | 309 ++++++++++++++---- 1 file changed, 245 insertions(+), 64 deletions(-) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index e644ecc30b..6e25e4c26d 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -18,8 +18,10 @@ servers: tags: - name: blockchain description: Operations with blockchain state. - - name: node public info - description: Public information about node. + - name: node public + description: Public access to node. + - name: node private + description: Private access to node. - name: account description: Operations about account @@ -347,7 +349,7 @@ paths: /@@node/x509: get: tags: - - node public info + - node public summary: Get node certificate. description: Return node certificate in x509 format. operationId: getX509 @@ -364,7 +366,7 @@ paths: /@@node/health: get: tags: - - node public info + - node public summary: Gets node health operationId: getHealthInfo responses: @@ -373,14 +375,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HealthResponse' + $ref: '#/components/schemas/PublicHealthResponse' 500: $ref: '#/components/responses/ServerError' /@@node/network: get: tags: - - node public info + - node public summary: Gets node network info operationId: getNetworkInfo responses: @@ -396,7 +398,7 @@ paths: /@node/blockchain: get: tags: - - node public info + - node public summary: Get blockchain object description: Return details information about the blockchain operationId: getBlockchainInfo @@ -410,6 +412,42 @@ paths: 500: $ref: '#/components/responses/ServerError' + + /@node/forgers: + get: + tags: + - node private + summary: Get forgers from the node. + description: Return all forgers from the node. + operationId: getForgers + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ForgersInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@node/health-full: + get: + tags: + - node private + summary: Get full health info. + description: Return full health information. + operationId: getHealthFull + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/PrivateHealthResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@@state/blockchain: get: tags: @@ -1374,8 +1412,6 @@ components: .......... BhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczElMCMGA1UEAxMc' - - CountResponse: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -1386,45 +1422,144 @@ components: format: int64 example: 345 - HealthResponse: + ForgersInfoResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - type: object properties: - blockchainHeight: - type: integer - format: int16 - example: 9900345 - description: "Current height of blockchain" - dbConnectionTotal: - type: integer - format: int16 - description: "Total connections in the pool" - dbConnectionActive: - type: integer - format: int16 - description: "Active connections in the pool" - dbConnectionIdle: - type: integer - format: int16 - description: "Idle connections in the pool" - unconfirmedTxCacheSize: - type: integer - format: int16 - description: "The waiting transactions cache size" - maxUnconfirmedTxCount: - type: integer - format: int16 - description: "The max count of the unconfirmed transactions" - isTrimActive: - type: boolean - description: "Returns true if the trimming process is active" + forgers: + description: The array of forgers + type: array + items: + $ref: '#/components/schemas/ForgerInfo' + + ForgerInfo: + type: object + properties: + account: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + effectiveBalanceAPL: + type: integer + format: int64 + description: Effective balance. + example: 98400000 + deadline: + type: integer + format: int64 + description: Dead line. + hitTime: + type: integer + format: int64 + description: Hit time. + + PublicHealthResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/HealthPublicInfo' + + PrivateHealthResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + healthInfo: + $ref: '#/components/schemas/FullHealthInfo' + nodeStatus: + $ref: '#/components/schemas/NodeStatusInfo' + peerInfo: + $ref: '#/components/schemas/FullPeerInfo' + + + FullHealthInfo: + allOf: + - $ref: '#/components/schemas/HealthPublicInfo' + - $ref: '#/components/schemas/HealthPrivateInfo' + + HealthPublicInfo: + type: object + properties: + blockchainHeight: + type: integer + format: int16 + example: 9900345 + description: "Current height of blockchain" + isDbOk: + type: boolean + description: "Database is able to find blocks" + isTrimActive: + type: boolean + description: "Returns true if the trimming process is active" + + HealthPrivateInfo: + type: object + properties: + dbConnectionTotal: + type: integer + format: int16 + description: "Total connections in the pool" + maxUnconfirmedTxCount: + type: integer + format: int16 + description: "The max count of the unconfirmed transactions" + dbConnectionActive: + type: integer + format: int16 + description: "Active connections in the pool" + dbConnectionIdle: + type: integer + format: int16 + description: "Idle connections in the pool" + unconfirmedTxCacheSize: + type: integer + format: int16 + description: "The waiting transactions cache size" + needReboot: + type: boolean + description: "Current total number of DB connections" + NodeStatusInfo: + type: object + properties: + cpuCount: + type: integer + format: int16 + description: "Number of active CPUs" + cpuLoad: + type: number + format: double + description: "Current average CPU load for all cores" + threadsRunning: + type: integer + format: int16 + description: "Threads currently running in application" + memoryFree: + type: integer + format: int32 + description: "Free memory available for this application" + dbConnections: + type: integer + format: int16 + description: "DB connections currently running in application" + memoryTotal: + type: integer + format: int32 + description: "Total memory in bytes" + diskFree: + type: integer + format: int32 + description: "Free disk space available to application" + operatingSystem: + type: string + description: "Operating system of node" NetworkResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - - $ref: '#/components/schemas/PeerInfo' + - type: object + properties: + peerInfo: + $ref: '#/components/schemas/PeerPublicInfo' - type: object properties: inboundPeers: @@ -1436,34 +1571,80 @@ components: format: int8 description: "Outbound Peers" - PeerInfo: + FullPeerInfo: + allOf: + - $ref: '#/components/schemas/PeerPublicInfo' + - $ref: '#/components/schemas/PeerPrivateInfo' + + PeerPublicInfo: type: object properties: - sharedAddress: - type: boolean - description: "Is node shared address" - version: - type: string - description: "App version" - example: "1.47.10" - platform: - type: string - description: "Platform where app has been running." - example: "Linux amd64" - apiPort: - type: integer - format: int8 - description: "App port" - inboundWebSocket: - type: boolean - description: "Is inbound web socket works." - outboundWebSocket: - type: boolean - description: "Is outbound web socket works." - chainId: + announcedAddress: + type: string + description: "Announced address" + sharedAddress: + type: boolean + description: "Is node shared address" + halmark: + type: string + description: "Node hallmark" + version: + type: string + description: "App version" + example: "1.47.10" + platform: + type: string + description: "Platform where app has been running." + example: "Linux amd64" + apiPort: + type: integer + format: int8 + description: "App port" + apiSSLPort: + type: integer + format: int8 + description: "App ssl port" + lastUpdated: + type: integer + format: int32 + description: "Last update" + lastConnectAttempt: + type: integer + format: int32 + description: "Last connect attempt" + inboundWebSocket: + type: boolean + description: "Is inbound web socket works." + outboundWebSocket: + type: boolean + description: "Is outbound web socket works." + blacklistingCause: + type: string + description: "Node has been Blacklisted cause." + blockchainState: + type: string + description: "Blockchain state" + chainId: + type: string + description: "Node chain id." + example: 'a2e9b946-290b-48b6-9985-dc2e5a5860a1' + + PeerPrivateInfo: + type: object + properties: + state: + type: integer + format: int32 + description: "Node state" + weight: + type: integer + format: int32 + description: "Node weight" + services: + type: array + description: "Node services." + items: type: string - description: "Node chain id." - example: 'a2e9b946-290b-48b6-9985-dc2e5a5860a1' BaseResponse: type: object From c046b1370ce093312400825047fcdc943ca533b8 Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 15 Feb 2021 13:55:52 +0200 Subject: [PATCH 04/15] APL-1783 finish api private cache,threads,logs. --- .../aplwallet/api/dto/CacheStatsDTO.java | 2 +- .../aplwallet/api/dto/PeerDTO.java | 2 +- .../main/resources/yaml/apollo-api-v2.yaml | 256 +++++++++++++++++- .../core/rest/converter/PeerConverter.java | 2 +- 4 files changed, 258 insertions(+), 4 deletions(-) diff --git a/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/CacheStatsDTO.java b/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/CacheStatsDTO.java index 3a195cf08b..325669bc6d 100644 --- a/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/CacheStatsDTO.java +++ b/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/CacheStatsDTO.java @@ -16,7 +16,7 @@ @Data @Schema(name = "CacheStats", description = "Statistics about the performance of a Cache.") public class CacheStatsDTO { - @Schema(name = "cacheName", description = "The cahce name.") + @Schema(name = "cacheName", description = "The cache name.") private String cacheName; @NonNull @Schema(name = "hitCount", description = "The number of times Cache lookup methods have returned a cached value.") diff --git a/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/PeerDTO.java b/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/PeerDTO.java index e95891feb4..286557bdcd 100644 --- a/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/PeerDTO.java +++ b/apl-api/src/main/java/com/apollocurrency/aplwallet/api/dto/PeerDTO.java @@ -23,7 +23,7 @@ public class PeerDTO extends BaseDTO { private Integer state; private String announcedAddress; private Boolean sharedAddress; - private String halmark; + private String hallmark; private Integer weight; private Long downloadedVolume; private Long uploadedVolume; diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index 6e25e4c26d..b5cc2e2fb3 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -379,7 +379,7 @@ paths: 500: $ref: '#/components/responses/ServerError' - /@@node/network: + /@@node/info/network: get: tags: - node public @@ -412,6 +412,23 @@ paths: 500: $ref: '#/components/responses/ServerError' + /@node/tasks: + get: + tags: + - node public + summary: Get in progress tasks information. + description: Return details about all inprogress tasks. + operationId: getTasksInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TasksInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + /@node/forgers: get: @@ -447,6 +464,85 @@ paths: 500: $ref: '#/components/responses/ServerError' + /@node/cache: + get: + tags: + - node private + summary: Get cache info. + description: Return full statistics about the performance of a Cache. + operationId: getCacheInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/CacheInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@node/threads: + get: + tags: + - node private + summary: Get threads info. + description: Returns backend threads status + operationId: getThreadsInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadsInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@node/logs: + get: + tags: + - node private + summary: Get list of logs files. + description: Returns all names of logs files from this node. + operationId: getLogs + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ListLogs' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/logs/{logName}: + get: + tags: + - node private + summary: Get log file from the node. + description: Return the log file from the node by file name. + operationId: getLogFile + parameters: + - name: logName + in: path + description: Log file name + required: true + schema: + type: string + example: 'apl-2021-02-05_0.gz' + responses: + 200: + description: successful operation. File with logs in binary format + content: + application/octet-stream: + schema: + type: string + format: binary + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + /@@state/blockchain: get: @@ -1646,6 +1742,164 @@ components: items: type: string + CacheInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: array + items: + $ref: '#/components/schemas/CacheInfo' + + CacheInfo: + type: object + properties: + cacheName: + type: string + description: "Cache name" + example: "PUBLIC_KEY_CACHE" + hitCount: + type: integer + format: int64 + example: 3 + description: "The number of times Cache lookup methods have returned a cached value." + hitRate: + type: number + format: double + example: 1.1 + description: "The ratio of cache requests which were hits. This is defined as hitCount / requestCount, or 1.0 when requestCount == 0. Note that hitRate + missRate =~ 1.0." + missCount: + type: integer + format: int64 + example: 4133 + description: "The number of times Cache lookup methods have returned an uncached (newly loaded) value, or null." + missRate: + type: number + format: double + loadSuccessCount: + type: integer + format: int64 + description: "The number of times Cache lookup methods have successfully loaded a new value." + loadExceptionCount: + type: integer + format: int64 + description: "The number of times Cache lookup methods threw an exception while loading a new value." + totalLoadTime: + type: integer + format: int64 + description: "The total number of nanoseconds the cache has spent loading new values. This can be used to calculate the miss penalty. This value is increased every time loadSuccessCount or loadExceptionCount is incremented." + evictionCount: + type: integer + format: int64 + description: "The number of times an entry has been evicted." + + ThreadsInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: array + items: + $ref: '#/components/schemas/ThreadsInfo' + + + ThreadsInfo: + type: object + properties: + name: + type: string + description: "Name of thread" + example: "Reference Handler" + state: + type: string + description: "State of thread" + example: "RUNNABLE" + priority: + type: integer + format: int8 + example: 10 + description: "Priority of thread" + isDaemon: + type: boolean + description: "Is thread started as daemon thread" + example: true + cpuTime: + type: integer + format: int64 + example: 250346188 + description: "CPU time used by thread" + + + TasksInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: array + items: + $ref: '#/components/schemas/TasksInfo' + + TasksInfo: + type: object + properties: + id: + type: string + description: "Identification of task" + example: "390de590-6f7d-11eb-9439-0242ac130002" + name: + type: string + description: "Short but descriptive name of task" + example: "Shard data import" + decription: + type: string + description: "Description of task in one line" + example: "Data import" + isCrititcal: + type: boolean + description: "Taks is critical and should be displayed on top of UI window" + example: true + stateOfTask: + type: string + description: "Task state in one line in human readable form" + example: "Started" + enum: [ + "Started", + "In progress", + "Finished", + "Cancelled", + "Paused" + ] + started: + type: string + format: date + description: "Task start date and time" + example: "2020-04-12T23:20:50.52Z" + finished: + type: string + format: date + description: "Task finish date and time" + example: "2020-04-12T23:40:50.52Z" + durationMS: + type: integer + format: int64 + example: 250346188 + description: "Task run duration, milliseconds" + missRate: + type: number + format: double + description: "Task completion percent" + example: 100.0 + messages: + type: array + description: "Task messages list" + items: + type: string + + + ListLogs: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: array + description: "List of logs files" + items: + type: string + example: "apl-2021-02-05_0.gz" + + BaseResponse: type: object properties: diff --git a/apl-core/src/main/java/com/apollocurrency/aplwallet/apl/core/rest/converter/PeerConverter.java b/apl-core/src/main/java/com/apollocurrency/aplwallet/apl/core/rest/converter/PeerConverter.java index a77a429d7d..4ff97f5bff 100644 --- a/apl-core/src/main/java/com/apollocurrency/aplwallet/apl/core/rest/converter/PeerConverter.java +++ b/apl-core/src/main/java/com/apollocurrency/aplwallet/apl/core/rest/converter/PeerConverter.java @@ -22,7 +22,7 @@ public PeerDTO apply(Peer peer) { dto.setAnnouncedAddress(peer.getAnnouncedAddress()); dto.setSharedAddress(peer.shareAddress()); if (peer.getHallmark() != null) { - dto.setHalmark(peer.getHallmark().getHallmarkString()); + dto.setHallmark(peer.getHallmark().getHallmarkString()); } dto.setWeight(peer.getWeight()); dto.setDownloadedVolume(peer.getDownloadedVolume()); From 535a49ec9291f388002ff6c9a25c01f909a86745 Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 15 Feb 2021 14:33:56 +0200 Subject: [PATCH 05/15] APL-1783 finish api subscribe --- .../main/resources/yaml/apollo-api-v2.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index b5cc2e2fb3..c54393e115 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -22,6 +22,8 @@ tags: description: Public access to node. - name: node private description: Private access to node. + - name: subscribe + description: Subscribe on some event. - name: account description: Operations about account @@ -544,6 +546,32 @@ paths: $ref: '#/components/responses/ServerError' + /@@subscribe/account: + post: + tags: + - subscribe + summary: Subscribe on change account. + operationId: subscribeOnAccount + description: Subscribe on change something in particular account. + requestBody: + description: the parent account, child account and other + content: + application/json: + schema: + $ref: '#/components/schemas/SubscribeAccountRequest' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/SubscribeAccountResponse' + 500: + $ref: '#/components/responses/ServerError' + + + /@@state/blockchain: get: tags: @@ -1115,6 +1143,27 @@ components: format: hex_bytearray example: '001047857c04a00539dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152eef5365f2400292d00ca9a3b0000000000c2eb0b000000000000000000000000000000000000000000000000000000000000000000000000920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d5600000000f1da1300fe7062e6fb2fbb37' nullable: false + + SubscribeAccountRequest: + required: + - type + - accountId + type: object + properties: + type: + description: Type of the event. + type: string + enum: + - balanse + example: balanse + nullable: false + accountId: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + description: Account id + nullable: false + + AccountReq: required: - parent @@ -1518,6 +1567,15 @@ components: format: int64 example: 345 + SubscribeAccountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + subscribeId: + type: string + example: 'fba2fb94-6f88-11eb-9439-0242ac130002' + ForgersInfoResponse: allOf: - $ref: '#/components/schemas/BaseResponse' From c08a66ecdfc1ca8893d1887d9ff978862cde4203 Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 15 Feb 2021 16:41:53 +0200 Subject: [PATCH 06/15] APL-1783 finish api getSubscriptionStatus --- .../main/resources/yaml/apollo-api-v2.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index c54393e115..5ee13198fd 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -547,6 +547,30 @@ paths: /@@subscribe/account: + get: + tags: + - subscribe + summary: Get subscription status. + operationId: getSubscriptionStatus + description: Return subscription status by subscription id. + parameters: + - name: subscriptionId + description: Subscription id + in: query + required: true + schema: + type: string + example: 'fba2fb94-6f88-11eb-9439-0242ac130002' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/GetSubscriptionAccountResponse' + 500: + $ref: '#/components/responses/ServerError' + post: tags: - subscribe @@ -1576,6 +1600,19 @@ components: type: string example: 'fba2fb94-6f88-11eb-9439-0242ac130002' + GetSubscriptionAccountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + txs: + description: Transactions which changed the account state. (10 transactions is limit.) + type: array + items: + type: string + format: hex_bytearray + example: '8330faaeb404178613417' + ForgersInfoResponse: allOf: - $ref: '#/components/schemas/BaseResponse' From 6f5a52bfa959fdae5e6f2c6a0d969bcffafa6d2d Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 15 Feb 2021 17:59:18 +0200 Subject: [PATCH 07/15] APL-1783 refactoring api --- .../main/resources/yaml/apollo-api-v2.yaml | 302 ++---------------- 1 file changed, 21 insertions(+), 281 deletions(-) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index 5ee13198fd..a1c5e93bd2 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -25,117 +25,13 @@ tags: - name: subscribe description: Subscribe on some event. - - name: account - description: Operations about account - - name: state - description: Everything about blockchain state + - name: operations description: List operations by account (the bank reconcilation) paths: - /@@account/child: - post: - tags: - - account - summary: Returns unsigned CreateChildAccount transaction for creating child accounts - description: | - Returns unsigned CreateChildAccount transaction as a byte array. - The list of child public keys is attached in the transaction appendix. - operationId: createChildAccountTx - requestBody: - description: the parent account and the list of public keys - content: - application/json: - schema: - $ref: '#/components/schemas/AccountReq' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/CreateChildAccountResp' - 401: - description: Unauthorized Error - 403: - description: Access Forbidden - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - /@@account/test: - post: - tags: - - account - summary: Returns signed CreateChildAccount transaction for creating child accounts - description: | - Returns signed CreateChildAccount transaction as a byte array. - The list of child public keys is attached in the transaction appendix. - operationId: createChildAccountTxTest - requestBody: - description: the parent account and the list of public keys - content: - application/json: - schema: - $ref: '#/components/schemas/AccountReqTest' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/CreateChildAccountResp' - 401: - description: Unauthorized Error - 403: - description: Access Forbidden - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - /@@account/money: - post: - tags: - - account - summary: Returns signed SendMoney transaction from child account - description: | - Returns signed SendMoney transaction as a byte array. - This transaction is a multi-signature signed tx. - operationId: createChildAccountTxSendMony - requestBody: - description: the parent account, child account and other - content: - application/json: - schema: - $ref: '#/components/schemas/AccountReqSendMoney' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/CreateChildAccountResp' - 401: - description: Unauthorized Error - 403: - description: Access Forbidden - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - /@@account/{account}: get: tags: @@ -596,26 +492,10 @@ paths: - /@@state/blockchain: - get: - tags: - - state - summary: Get blockchain state object - description: Return details information about the blockchain state - operationId: getBlockchainState - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BlockchainState' - 500: - $ref: '#/components/responses/ServerError' - /@@state/block: + /@@block: get: tags: - - state + - blockchain summary: Get block object description: Return details information about the block given block height. If no height is provided, it will fetch the latest block. operationId: getBlockByHeight @@ -629,29 +509,10 @@ paths: format: int64 example: '4315161' default: '-1' - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/BlockInfo' - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - /@@state/block/{block}: - get: - tags: - - state - summary: Get block object given block id - description: Return the detail information about block given id - operationId: getBlockById - parameters: - - name: block - in: path + - name: blockId + in: query description: Block id - required: true + required: false schema: type: string format: hex_bytearray @@ -667,10 +528,11 @@ paths: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - /@@state/tx/{transaction}: + + /@@tx/{transaction}: get: tags: - - state + - blockchain summary: Get transaction receipt given transaction id. description: Return the brief information about transaction given id. operationId: getTxReceiptById @@ -694,11 +556,11 @@ paths: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - /@@state/tx: + /@@txs: post: tags: - - state - summary: Get transaction receipt list given list of the transaction id. + - blockchain + summary: Get transaction receipt list given list of the transaction ids. description: Return the list of the brief information about transactions. operationId: getTxReceiptList requestBody: @@ -725,10 +587,10 @@ paths: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - /@@state/unconfirmed/count: + /@@transactions/unconfirmed/count: get: tags: - - state + - node private summary: Get count of unconfirmed transaction receipts. description: Return the count of unconfirmed transactions. operationId: getUnconfirmedTxCount @@ -741,10 +603,10 @@ paths: $ref: '#/components/schemas/CountResponse' 500: $ref: '#/components/responses/ServerError' - /@@state/unconfirmed: + /@@transactions/unconfirmed: get: tags: - - state + - node private summary: Get list of unconfirmed transaction receipts. description: Return the list of the detail information about unconfirmed transactions. operationId: getUnconfirmedTx @@ -1081,6 +943,10 @@ components: type: string format: hex_bytearray example: 'a2e9b946290b48b69985dc2e5a5860a1' + height: + type: integer + format: int64 + example: 4789567 ticker: type: string example: 'USDS' @@ -1108,54 +974,17 @@ components: type: string format: hex_bytearray example: '90001259ec21d31a30898d7' - - BlockchainState: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - chainid: - type: string - format: hex_bytearray - example: 'a2e9b946290b48b69985dc2e5a5860a1' - height: - type: integer - format: int64 - example: 4789567 - genesisAccount: - type: string - format: hex_bytearray - example: '90001259ec21d31a30898d7' genesisBlockId: type: string format: hex_bytearray description: Genesis block ID example: '15856251679437054149169000' - genesisBlockTimestamp: - type: integer - format: int64 - description: Genesis block timestamp (epoch beginning), Unix timestamp in milliseconds - example: 1491696372000 - ecBlockId: - type: string - format: hex_bytearray - description: The economic clustering block ID - example: '40faaeb15856251679437054' - ecBlockHeight: - type: integer - format: int64 - description: The economic clustering block height - example: 3301233 - txTimestamp: - type: integer - format: int64 - description: Request timestamp in seconds since the genesis block - example: 1591696371 timestamp: type: integer format: int64 description: Request timestamp, Unix timestamp in milliseconds example: 1591696372300 + TxRequest: required: - tx @@ -1187,95 +1016,6 @@ components: description: Account id nullable: false - - AccountReq: - required: - - parent - - publicKey - type: object - properties: - parent: - type: string - description: parent account id - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - child_publicKey_list: - type: array - description: list of child account public keys - maxItems: 128 - items: - type: string - format: hex_bytearray - example: '39dc2e813bb45ff063a376e316b10cd0adeb7306111ca0eb2890194d37960152' - AccountReqTest: - required: - - parent - - publicKey - type: object - properties: - parent: - type: string - description: parent account id - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - secret: - type: string - description: parent account secret phrase - example: 'topSecretPhrase' - child_secret_list: - type: array - description: list of child secret phrases - maxItems: 128 - items: - type: string - example: 'secret1' - AccountReqSendMoney: - required: - - parent - - publicKey - type: object - properties: - parent: - type: string - description: parent account id - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - psecret: - type: string - description: parent account secret phrase - example: 'ParenttopSecretPhrase' - sender: - type: string - description: child account id - example: 'APL-632K-TWX3-2ALQ-973CU' - csecret: - type: string - description: child account secret phrase - example: 'ChildtopSecretPhrase' - recipient: - type: string - description: recipient account id - example: 'APL-VWMY-APVK-UFHN-3MC7N' - amount: - type: integer - format: int64 - description: the amount - CreateChildAccountResp: - required: - - parent - - tx - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - parent: - type: string - description: parent account id - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - tx: - description: Unsigned transaction data - type: string - format: hex_bytearray - example: '001047857c04a00539dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152eef5365f2400292d00ca9a3b0000000000c2eb0b000000000000000000000000000000000000000000000000000000000000000000000000920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d5600000000f1da1300fe7062e6fb2fbb37' - - AccountInfoResp: allOf: - $ref: '#/components/schemas/BaseResponse' From f6be9afeabbc87f77682ad1d089a66583f3cba20 Mon Sep 17 00:00:00 2001 From: andriiK Date: Fri, 19 Feb 2021 18:03:52 +0200 Subject: [PATCH 08/15] APL-1783 refactoring api-v2 after review --- .../main/resources/yaml/apollo-api-v2.yaml | 588 ++++++++---------- 1 file changed, 251 insertions(+), 337 deletions(-) diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index a1c5e93bd2..9256fa12ea 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -25,27 +25,23 @@ tags: - name: subscribe description: Subscribe on some event. - - - name: operations - description: List operations by account (the bank reconcilation) - - paths: - /@@account/{account}: + /@@account/{accountId}: get: tags: - blockchain summary: Returns the details account information operationId: getAccountInfo parameters: - - name: account + - name: accountId in: path description: The account id required: true schema: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - name: includeAssets in: query schema: @@ -77,7 +73,7 @@ paths: $ref: '#/components/responses/ServerError' - /@@transactions/{transactionId}: + /@@transaction/{transactionId}: get: tags: - blockchain @@ -119,17 +115,41 @@ paths: description: The account id schema: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + + - in: query + name: txIds + description: The transaction ids + schema: + type: array + items: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - in: query name: type - description: Transaction type + description: | + The transaction type, it's an optional parameter and can be missed or specified negative value to avoid + filtering by that criteria. + There are eleven types + PAYMENT = 0; + MESSAGING = 1; + COLORED_COINS = 2; + DIGITAL_GOODS = 3; + ACCOUNT_CONTROL = 4; + MONETARY_SYSTEM = 5; + DATA = 6; + SHUFFLING = 7; + UPDATE = 8; + DEX = 9; + CHILD_ACCOUNT = 10; schema: type: string format: int8 example: '2' - - in: query name: subtype description: Transaction subtype @@ -195,8 +215,9 @@ paths: type: boolean default: false - - $ref: '#/components/parameters/offsetParam' + - $ref: '#/components/parameters/page' - $ref: '#/components/parameters/limitParam' + - $ref: '#/components/parameters/orderBy' responses: 200: @@ -243,6 +264,126 @@ paths: 500: $ref: '#/components/responses/ServerError' + /@@transactions/count: + get: + tags: + - blockchain + summary: Count transactions following given filter. + operationId: countTxsByFilter + description: Count transactions by filter. + parameters: + - in: query + name: account + description: The account id + schema: + type: array + items: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + + - in: query + name: type + description: | + The transaction type, it's an optional parameter and can be missed or specified negative value to avoid + filtering by that criteria. + There are eleven types + PAYMENT = 0; + MESSAGING = 1; + COLORED_COINS = 2; + DIGITAL_GOODS = 3; + ACCOUNT_CONTROL = 4; + MONETARY_SYSTEM = 5; + DATA = 6; + SHUFFLING = 7; + UPDATE = 8; + DEX = 9; + CHILD_ACCOUNT = 10; + schema: + type: string + format: int8 + example: '2' + + - in: query + name: subtype + description: Transaction subtype + schema: + type: string + format: int8 + example: '2' + + - in: query + name: timestamp + description: Show transactions with tx_timestamp >= timestamp + schema: + type: integer + format: int64 + example: 1591696372000 + + - in: query + name: numberOfConfirmations + description: the number of transaction confirmations + schema: + type: integer + format: int32 + + - in: query + name: withMessage + description: show transaction with message + schema: + type: boolean + default: false + + - in: query + name: phasedOnly + description: show only phased transactions + schema: + type: boolean + default: false + + - in: query + name: nonPhasedOnly + description: show only non phased transactions + schema: + type: boolean + default: false + + - in: query + name: includeExpiredPrunable + description: include transactions with expired prunables + schema: + type: boolean + default: false + + - in: query + name: includePhasingResult + description: include transactions with phasing results + schema: + type: boolean + default: false + + - in: query + name: executedOnly + description: show only executed transactions + schema: + type: boolean + default: false + + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/limitParam' + - $ref: '#/components/parameters/orderBy' + + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionCountResponse' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' /@@node/x509: get: @@ -277,7 +418,7 @@ paths: 500: $ref: '#/components/responses/ServerError' - /@@node/info/network: + /@@node/network: get: tags: - node public @@ -293,7 +434,7 @@ paths: 500: $ref: '#/components/responses/ServerError' - /@node/blockchain: + /@@node/blockchain: get: tags: - node public @@ -310,7 +451,7 @@ paths: 500: $ref: '#/components/responses/ServerError' - /@node/tasks: + /@@node/tasks: get: tags: - node public @@ -328,7 +469,7 @@ paths: $ref: '#/components/responses/ServerError' - /@node/forgers: + /@@node/forgers: get: tags: - node private @@ -344,8 +485,10 @@ paths: $ref: '#/components/schemas/ForgersInfoResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] - /@node/health-full: + /@@node/health-full: get: tags: - node private @@ -361,8 +504,10 @@ paths: $ref: '#/components/schemas/PrivateHealthResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] - /@node/cache: + /@@node/cache: get: tags: - node private @@ -378,8 +523,10 @@ paths: $ref: '#/components/schemas/CacheInfoResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] - /@node/threads: + /@@node/threads: get: tags: - node private @@ -395,8 +542,10 @@ paths: $ref: '#/components/schemas/ThreadsInfoResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] - /@node/logs: + /@@node/logs: get: tags: - node private @@ -412,6 +561,8 @@ paths: $ref: '#/components/schemas/ListLogs' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] /@@node/logs/{logName}: get: @@ -440,6 +591,8 @@ paths: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] /@@subscribe/account: @@ -466,6 +619,8 @@ paths: $ref: '#/components/schemas/GetSubscriptionAccountResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] post: tags: @@ -489,6 +644,8 @@ paths: $ref: '#/components/schemas/SubscribeAccountResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] @@ -529,64 +686,6 @@ paths: 500: $ref: '#/components/responses/ServerError' - /@@tx/{transaction}: - get: - tags: - - blockchain - summary: Get transaction receipt given transaction id. - description: Return the brief information about transaction given id. - operationId: getTxReceiptById - parameters: - - name: transaction - in: path - description: Transaction id - required: true - schema: - type: string - format: hex_bytearray - example: '1a0feb06043151604016701' - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/TxReceipt' - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - /@@txs: - post: - tags: - - blockchain - summary: Get transaction receipt list given list of the transaction ids. - description: Return the list of the brief information about transactions. - operationId: getTxReceiptList - requestBody: - description: the list of transaction id - content: - application/json: - schema: - type: array - items: - type: string - format: hex_bytearray - example: '83aa340eb41780f61376852' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/TxReceipt' - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' /@@transactions/unconfirmed/count: get: tags: @@ -603,6 +702,9 @@ paths: $ref: '#/components/schemas/CountResponse' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + /@@transactions/unconfirmed: get: tags: @@ -648,69 +750,6 @@ paths: security: - bearerAuth: [] - /@@operation/count: - post: - tags: - - operations - summary: Returns the count of operations corresponding the query object group by account - operationId: getOperationsCount - requestBody: - description: the query object - content: - application/json: - schema: - $ref: '#/components/schemas/QueryObject' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/QueryCountResult' - 401: - description: Not authenticated - 403: - description: Access token does not have the required scope - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - /@@operation: - post: - tags: - - operations - summary: Returns the operation list corresponding the query object group by account - operationId: getOperations - requestBody: - description: the query object - content: - application/json: - schema: - $ref: '#/components/schemas/QueryObject' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/QueryResult' - 401: - description: Not authenticated - 403: - description: Access token does not have the required scope - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - - components: schemas: TransactionInfoArrayResp: @@ -747,6 +786,14 @@ components: type: string format: int8 example: '1' + status: + type: string + description: | + The transaction status. A transaction is considered as unconfirmed until it is included in a valid block. + A transaction is considered as confirmed after at least one confirmations, so a transaction is considered + as irreversible after 721 confirmations and finally a transaction is permanent if it's confirmed 1440 times. + enum: [unconfirmed, confirmed, irreversible, permanent] + example: unconfirmed phased: description: is true if the transaction is phased type: boolean @@ -849,6 +896,20 @@ components: format: int32 description: the order of the transaction in the block example: 1 + + TransactionCountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/TransactionCount' + + TransactionCount: + type: object + properties: + count: + type: integer + format: int64 + example: 345 + BlockInfo: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -949,7 +1010,7 @@ components: example: 4789567 ticker: type: string - example: 'USDS' + example: 'APL' consensus: type: string example: 'Apollo' @@ -1029,7 +1090,8 @@ components: properties: account: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + format: hex_bytearray + example: '2aa130eb6043151ad6040f16701' publicKey: description: The account public key in a hex string format type: string @@ -1037,7 +1099,8 @@ components: example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' parent: type: string - example: 'APL-AHYW-P3YX-V426-4UMP2' + format: hex_bytearray + example: '3aa130eb6043151ad6040f16701' nullable: true balance: type: string @@ -1139,176 +1202,6 @@ components: type: string example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - QueryObject: - type: object - properties: - type: - description: | - The transaction type, it's an optional parameter and can be missed or specified negative value to avoid - filtering by that criteria. - There are eleven types: - PAYMENT = 0; - MESSAGING = 1; - COLORED_COINS = 2; - DIGITAL_GOODS = 3; - ACCOUNT_CONTROL = 4; - MONETARY_SYSTEM = 5; - DATA = 6; - SHUFFLING = 7; - UPDATE = 8; - DEX = 9; - CHILD_ACCOUNT = 10; - type: integer - format: int8 - example: 0 - default: -1 - accounts: - description: Exactly all items. - nullable: true - type: array - items: - type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - first: - type: integer - format: int64 - description: The first block height - example: 4000123 - last: - type: integer - format: int64 - description: The last block height - example: 4999000 - startTime: - type: integer - format: int64 - description: The start of the time period, Unix timestamp in milliseconds - example: 1591696310000 - endTime: - type: integer - format: int64 - description: The end of the time period, Unix timestamp in milliseconds - example: 1591696372000 - page: - type: integer - format: int32 - description: page number (1-based) - default: 1 - example: 1 - perPage: - type: integer - format: int32 - description: Number of entries per page (max=100) - default: 25 - example: 25 - orderBy: - type: string - nullable: true - enum: [asc, desc] - default: asc - QueryResult: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - count: - type: integer - format: int32 - description: Count of result items - example: 345 - result: - type: array - items: - $ref: '#/components/schemas/TxReceipt' - query: - $ref: '#/components/schemas/QueryObject' - QueryCountResult: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - count: - type: integer - format: int64 - example: 345 - query: - $ref: '#/components/schemas/QueryObject' - TxReceipt: - description: Transaction receipt. The lightweight and compact representation of the blockchain transaction. - Doesn't support the transaction type conversion. - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - required: - - transaction - - sender - - recipient - - signature - properties: - transaction: - type: string - format: hex_bytearray - example: '8330faaeb404178613417' - sender: - type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - recipient: - type: string - example: 'APL-FXHG-6KHM-23LE-42ACU' - signature: - type: string - format: hex_bytearray - example: 'B98CB1890E76C772A10994B210ED9CF7F9A5488672A5D82C2734BBF9D11505D1' - timestamp: - type: integer - format: int64 - description: Transaction timestamp, Unix timestamp in milliseconds - example: 1591696372000 - amount: - type: string - format: integer - example: '34500000000' - fee: - type: string - format: integer - example: '0' - payload: - type: string - example: '{"transaction":"1234567890", "amount":"1234567890.12"}' - status: - type: string - description: | - The transaction status. A transaction is considered as unconfirmed until it is included in a valid block. - A transaction is considered as confirmed after at least one confirmations, so a transaction is considered - as irreversible after 721 confirmations and finally a transaction is permanent if it's confirmed 1440 times. - enum: [unconfirmed, confirmed, irreversible, permanent] - example: unconfirmed - block: - description: The Id of the block containing the confirmed transaction - type: string - format: hex_bytearray - example: '40faaeb1585625167943' - blockTimestamp: - type: integer - format: int64 - description: Block timestamp, Unix timestamp in milliseconds - example: 1591696372000 - height: - type: integer - format: int64 - example: 15623658 - index: - type: integer - format: int32 - description: the order of the transaction in the block - example: 1 - confirmations: - type: integer - format: int64 - description: the amount of block transaction - example: 1758 - - X509Response: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -1580,9 +1473,12 @@ components: CacheInfoResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - - type: array - items: - $ref: '#/components/schemas/CacheInfo' + - type: object + properties: + cacheInfo: + type: array + items: + $ref: '#/components/schemas/CacheInfo' CacheInfo: type: object @@ -1629,10 +1525,12 @@ components: ThreadsInfoResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - - type: array - items: - $ref: '#/components/schemas/ThreadsInfo' - + - type: object + properties: + threadsInfo: + type: array + items: + $ref: '#/components/schemas/ThreadsInfo' ThreadsInfo: type: object @@ -1664,9 +1562,13 @@ components: TasksInfoResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - - type: array - items: - $ref: '#/components/schemas/TasksInfo' + - type: object + properties: + tasksInfo: + description: The array of transactions + type: array + items: + $ref: '#/components/schemas/TasksInfo' TasksInfo: type: object @@ -1728,12 +1630,14 @@ components: ListLogs: allOf: - $ref: '#/components/schemas/BaseResponse' - - type: array - description: "List of logs files" - items: - type: string - example: "apl-2021-02-05_0.gz" - + - type: object + properties: + logs: + description: "List of logs files" + type: array + items: + type: string + example: "apl-2021-02-05_0.gz" BaseResponse: type: object @@ -1793,15 +1697,16 @@ components: example: 'Description of failure' parameters: - offsetParam: + page: in: query - name: offset + name: page required: false schema: type: integer - minimum: 0 - default: 0 - description: The number of items to skip before starting to collect the result set. + minimum: 1 + default: 1 + description: Page number. + limitParam: in: query name: limit @@ -1811,7 +1716,16 @@ components: minimum: 1 maximum: 100 default: 20 - description: The numbers of items to return. + description: The numbers of items on the one page. + + orderBy: + in: query + name: orderBy + required: false + schema: + type: string + enum: [asc, desc] + default: asc responses: BadRequest: From a5a39d9532d80ae1aa18add387cb7ca93f53e62f Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 22 Feb 2021 10:05:03 +0200 Subject: [PATCH 09/15] APL-1783 create new api version v3 --- .../main/resources/yaml/apollo-api-v3.yaml | 1752 +++++++++++++++++ 1 file changed, 1752 insertions(+) create mode 100644 apl-api2/src/main/resources/yaml/apollo-api-v3.yaml diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v3.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v3.yaml new file mode 100644 index 0000000000..44acba28db --- /dev/null +++ b/apl-api2/src/main/resources/yaml/apollo-api-v3.yaml @@ -0,0 +1,1752 @@ +openapi: 3.0.1 +info: + title: Apollo API V3 + description: | + Apollo API V3 work in progress + Notice: + The symbols '@@' in the path definition are used as a marker for the code generation routine. + If you want to use this YAML specification in the Swagger editor manually, you should replace that marker with spaces. + contact: + email: apiteam@firstbridge.io + version: 3.0.0 +externalDocs: + description: The project VCS repository + url: https://github.com/ApolloFoundation/Apollo +servers: + - url: http://localhost:7876/rest + +tags: + - name: blockchain + description: Operations with blockchain state. + - name: node public + description: Public access to node. + - name: node private + description: Private access to node. + - name: subscribe + description: Subscribe on some event. + +paths: + + /@@account/{accountId}: + get: + tags: + - blockchain + summary: Returns the details account information + operationId: getAccountInfo + parameters: + - name: accountId + in: path + description: The account id + required: true + schema: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + - name: includeAssets + in: query + schema: + type: boolean + default: false + description: include asserts to the response + - name: includeCurrencies + in: query + schema: + type: boolean + default: false + description: include currencies to the response + - name: includeLessors + in: query + schema: + type: boolean + default: false + description: include lessors to the response + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AccountInfoResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + + /@@transaction/{transactionId}: + get: + tags: + - blockchain + summary: Get transaction object given transaction id. + description: Return the detail information about transaction by id. + operationId: getTxById + parameters: + - name: transactionId + in: path + description: Transaction id + required: true + schema: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionInfoResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + + /@@transactions: + get: + tags: + - blockchain + summary: Get transactions following given filter. + operationId: getTxsByFilter + description: Return the detail information about transactions by filter. + parameters: + - in: query + name: account + description: The account id + schema: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + + - in: query + name: txIds + description: The transaction ids + schema: + type: array + items: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + + - in: query + name: type + description: | + The transaction type, it's an optional parameter and can be missed or specified negative value to avoid + filtering by that criteria. + There are eleven types + PAYMENT = 0; + MESSAGING = 1; + COLORED_COINS = 2; + DIGITAL_GOODS = 3; + ACCOUNT_CONTROL = 4; + MONETARY_SYSTEM = 5; + DATA = 6; + SHUFFLING = 7; + UPDATE = 8; + DEX = 9; + CHILD_ACCOUNT = 10; + schema: + type: string + format: int8 + example: '2' + + - in: query + name: subtype + description: Transaction subtype + schema: + type: string + format: int8 + example: '2' + + - in: query + name: timestamp + description: Show transactions with tx_timestamp >= timestamp + schema: + type: integer + format: int64 + example: 1591696372000 + + - in: query + name: numberOfConfirmations + description: the number of transaction confirmations + schema: + type: integer + format: int32 + + - in: query + name: withMessage + description: show transaction with message + schema: + type: boolean + default: false + + - in: query + name: phasedOnly + description: show only phased transactions + schema: + type: boolean + default: false + + - in: query + name: nonPhasedOnly + description: show only non phased transactions + schema: + type: boolean + default: false + + - in: query + name: includeExpiredPrunable + description: include transactions with expired prunables + schema: + type: boolean + default: false + + - in: query + name: includePhasingResult + description: include transactions with phasing results + schema: + type: boolean + default: false + + - in: query + name: executedOnly + description: show only executed transactions + schema: + type: boolean + default: false + + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/limitParam' + - $ref: '#/components/parameters/orderBy' + + responses: + 200: + description: successful operation + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TransactionInfoResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + post: + tags: + - blockchain + summary: Broadcast a batch of transactions and return the transaction receipt list. + description: Asynchronously broadcast the batch of the signed transaction to the network. The transactions are immediately put into an unconfirmed transaction pool in the same order as in the batch and later are sending to the network. + operationId: broadcastTxs + requestBody: + description: an array of signed transactions, each item is a byte array in hex format + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TxRequest' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@transactions/count: + get: + tags: + - blockchain + summary: Count transactions following given filter. + operationId: countTxsByFilter + description: Count transactions by filter. + parameters: + - in: query + name: account + description: The account id + schema: + type: array + items: + type: string + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + + - in: query + name: type + description: | + The transaction type, it's an optional parameter and can be missed or specified negative value to avoid + filtering by that criteria. + There are eleven types + PAYMENT = 0; + MESSAGING = 1; + COLORED_COINS = 2; + DIGITAL_GOODS = 3; + ACCOUNT_CONTROL = 4; + MONETARY_SYSTEM = 5; + DATA = 6; + SHUFFLING = 7; + UPDATE = 8; + DEX = 9; + CHILD_ACCOUNT = 10; + schema: + type: string + format: int8 + example: '2' + + - in: query + name: subtype + description: Transaction subtype + schema: + type: string + format: int8 + example: '2' + + - in: query + name: timestamp + description: Show transactions with tx_timestamp >= timestamp + schema: + type: integer + format: int64 + example: 1591696372000 + + - in: query + name: numberOfConfirmations + description: the number of transaction confirmations + schema: + type: integer + format: int32 + + - in: query + name: withMessage + description: show transaction with message + schema: + type: boolean + default: false + + - in: query + name: phasedOnly + description: show only phased transactions + schema: + type: boolean + default: false + + - in: query + name: nonPhasedOnly + description: show only non phased transactions + schema: + type: boolean + default: false + + - in: query + name: includeExpiredPrunable + description: include transactions with expired prunables + schema: + type: boolean + default: false + + - in: query + name: includePhasingResult + description: include transactions with phasing results + schema: + type: boolean + default: false + + - in: query + name: executedOnly + description: show only executed transactions + schema: + type: boolean + default: false + + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/limitParam' + - $ref: '#/components/parameters/orderBy' + + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionCountResponse' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/x509: + get: + tags: + - node public + summary: Get node certificate. + description: Return node certificate in x509 format. + operationId: getX509 + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/X509Response' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/health: + get: + tags: + - node public + summary: Gets node health + operationId: getHealthInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/PublicHealthResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/network: + get: + tags: + - node public + summary: Gets node network info + operationId: getNetworkInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkResponse' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/blockchain: + get: + tags: + - node public + summary: Get blockchain object + description: Return details information about the blockchain + operationId: getBlockchainInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/BlockchainInfo' + 500: + $ref: '#/components/responses/ServerError' + + /@@node/tasks: + get: + tags: + - node public + summary: Get in progress tasks information. + description: Return details about all inprogress tasks. + operationId: getTasksInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TasksInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + + + /@@node/forgers: + get: + tags: + - node private + summary: Get forgers from the node. + description: Return all forgers from the node. + operationId: getForgers + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ForgersInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + /@@node/health-full: + get: + tags: + - node private + summary: Get full health info. + description: Return full health information. + operationId: getHealthFull + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/PrivateHealthResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + /@@node/cache: + get: + tags: + - node private + summary: Get cache info. + description: Return full statistics about the performance of a Cache. + operationId: getCacheInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/CacheInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + /@@node/threads: + get: + tags: + - node private + summary: Get threads info. + description: Returns backend threads status + operationId: getThreadsInfo + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadsInfoResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + /@@node/logs: + get: + tags: + - node private + summary: Get list of logs files. + description: Returns all names of logs files from this node. + operationId: getLogs + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ListLogs' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + /@@node/logs/{logName}: + get: + tags: + - node private + summary: Get log file from the node. + description: Return the log file from the node by file name. + operationId: getLogFile + parameters: + - name: logName + in: path + description: Log file name + required: true + schema: + type: string + example: 'apl-2021-02-05_0.gz' + responses: + 200: + description: successful operation. File with logs in binary format + content: + application/octet-stream: + schema: + type: string + format: binary + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + + /@@subscribe/account: + get: + tags: + - subscribe + summary: Get subscription status. + operationId: getSubscriptionStatus + description: Return subscription status by subscription id. + parameters: + - name: subscriptionId + description: Subscription id + in: query + required: true + schema: + type: string + example: 'fba2fb94-6f88-11eb-9439-0242ac130002' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/GetSubscriptionAccountResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + post: + tags: + - subscribe + summary: Subscribe on change account. + operationId: subscribeOnAccount + description: Subscribe on change something in particular account. + requestBody: + description: the parent account, child account and other + content: + application/json: + schema: + $ref: '#/components/schemas/SubscribeAccountRequest' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/SubscribeAccountResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + + + /@@block: + get: + tags: + - blockchain + summary: Get block object + description: Return details information about the block given block height. If no height is provided, it will fetch the latest block. + operationId: getBlockByHeight + parameters: + - name: height + in: query + description: a blockchain height + required: false + schema: + type: string + format: int64 + example: '4315161' + default: '-1' + - name: blockId + in: query + description: Block id + required: false + schema: + type: string + format: hex_bytearray + example: '1a0feb1043151604016701' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/BlockInfo' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@transactions/unconfirmed/count: + get: + tags: + - node private + summary: Get count of unconfirmed transaction receipts. + description: Return the count of unconfirmed transactions. + operationId: getUnconfirmedTxCount + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/CountResponse' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + + /@@transactions/unconfirmed: + get: + tags: + - node private + summary: Get list of unconfirmed transaction receipts. + description: Return the list of the detail information about unconfirmed transactions. + operationId: getUnconfirmedTx + parameters: + - name: page + in: query + description: page number (1-based) + required: false + schema: + type: integer + format: int32 + default: 1 + example: 1 + - name: perPage + in: query + description: Number of entries per page (max=100) + required: false + schema: + type: integer + format: int32 + maximum: 100 + default: 50 + example: 50 + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionInfoArrayResp' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] + +components: + schemas: + TransactionInfoArrayResp: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + tx: + description: The array of transactions + type: array + items: + $ref: '#/components/schemas/TransactionInfo' + + TransactionInfoResp: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/TransactionInfo' + + TransactionInfo: + type: object + properties: + id: + description: The transaction ID + type: string + format: hex_bytearray + example: '1a0feb1306043151604016701' + type: + description: Transaction type + type: string + format: int8 + example: '2' + subtype: + description: Transaction subtype + type: string + format: int8 + example: '1' + status: + type: string + description: | + The transaction status. A transaction is considered as unconfirmed until it is included in a valid block. + A transaction is considered as confirmed after at least one confirmations, so a transaction is considered + as irreversible after 721 confirmations and finally a transaction is permanent if it's confirmed 1440 times. + enum: [unconfirmed, confirmed, irreversible, permanent] + example: unconfirmed + phased: + description: is true if the transaction is phased + type: boolean + example: false + timestamp: + type: integer + format: int64 + description: Transaction timestamp, Unix timestamp in milliseconds + example: 1591696372000 + deadline: + description: the deadline for the transaction to be confirmed in minutes,ex.1440=24h + type: integer + format: int32 + example: 1440 + senderPublicKey: + type: string + format: hex_bytearray + description: The public key of the sending account for the transaction + recipient: + type: string + description: The account Id of the recipient + example: 'APL-FXHG-6KHM-23LE-42ACU' + amount: + type: string + format: integer + description: The amount of the transaction + example: 34500000000 + fee: + type: string + format: integer + example: 200000000 + description: The fee of the transaction + referencedTransactionFullHash: + type: string + format: hex_bytearray + description: The full hash of a transaction referenced by this one + example: '5424ca4dd976a873839c7d5c9952fa15ae619f678365e8ebbc73f967142eb40d' + signature: + type: string + format: hex_bytearray + example: '920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d56' + description: The digital signature of the transaction + signatureHash: + type: string + format: hex_bytearray + description: SHA-256 hash of the transaction signature + example: '2fc1883e9b76fdc67fabee0a3def5f4b7fc2de9cd65bc8bb6d39eaf5e99498d8' + fullHash: + type: string + format: hex_bytearray + description: The full hash of the transaction + example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' + attachment: + type: object + nullable: true + additionalProperties: + type: object + description: An object containong any additional data needed for the transaction + sender: + type: string + description: The sender account + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + height: + type: integer + format: int64 + example: 4365987 + description: The height of the block in the blockchain + version: + type: string + format: int8 + example: '1' + description: The transaction version number + ecBlockId: + type: string + format: hex_bytearray + description: The economic clustering block ID + example: '40faaeb15856251679437054' + ecBlockHeight: + type: integer + format: int64 + description: The economic clustering block height + example: 3301233 + block: + type: string + format: hex_bytearray + description: The block id + example: '230aeb0f4585625167943' + confirmations: + type: integer + format: int32 + description: the number of transaction confirmations + example: 387 + blockTimestamp: + type: integer + format: int64 + description: Block timestamp, Unix timestamp in milliseconds + example: 1591696372000 + index: + type: integer + format: int32 + description: the order of the transaction in the block + example: 1 + + TransactionCountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/TransactionCount' + + TransactionCount: + type: object + properties: + count: + type: integer + format: int64 + example: 345 + + BlockInfo: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + id: + type: string + format: hex_bytearray + example: '1130faaeb604315160401' + blockSignature: + type: string + format: hex_bytearray + example: 'ff080e64436603df0c3b9a5b792b03a26725a83bbe6aa46eb7eed9ee83707f071b6d529d09be1f2594c6f8545c2772a091896bc808553c1774e39a41248b1e1c' + height: + type: integer + format: int64 + example: 1319854 + generator: + type: string + example: 'APL-FXHG-6KHM-23LE-42ACU' + generationSignature: + type: string + format: hex_bytearray + example: '60e598f6276371119720786b05e507cd628665473b24c8f76de436d99cf113f7' + generatorPublicKey: + type: string + format: hex_bytearray + example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' + timestamp: + type: integer + format: int64 + description: Block timestamp, Unix timestamp in milliseconds + example: 1591696372000 + timeout: + type: integer + format: int32 + example: 1 + version: + description: The block version + type: integer + format: int32 + example: 6 + baseTarget: + type: string + example: '7686143350' + cumulativeDifficulty: + type: string + format: integer + example: '8728234277524822' + previousBlock: + description: Prev block id + type: string + format: hex_bytearray + example: '80faaeb4787337264514' + previousBlockHash: + type: string + format: hex_bytearray + example: '5b8ba14eaebba8cdc682c946947f5352a596d00ac63c4e616785d00cf8b8e016' + nextBlock: + description: Next block id + type: string + format: hex_bytearray + example: '140faaeb81930093118053' + payloadHash: + type: string + format: hex_bytearray + description: Hash of the paylod (all transactions) + example: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' + payloadLength: + description: The length in bytes of all transactions + type: integer + format: int32 + example: 523423 + numberOfTransactions: + type: integer + format: int32 + example: 14 + totalAmountATM: + type: string + format: integer + example: '569000000000000' + totalFeeATM: + type: string + format: integer + example: '2800000000' + BlockchainInfo: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + chainid: + type: string + format: hex_bytearray + example: 'a2e9b946290b48b69985dc2e5a5860a1' + height: + type: integer + format: int64 + example: 4789567 + ticker: + type: string + example: 'APL' + consensus: + type: string + example: 'Apollo' + mining: + type: string + example: 'Pre-mining' + total_supply: + type: integer + format: int64 + example: 10000000000 + description: The total supply + decimals: + type: integer + format: int16 + example: 8 + burning: + type: integer + format: int64 + example: 30000 + description: The total amount of the burned tokens + genesisAccount: + type: string + format: hex_bytearray + example: '90001259ec21d31a30898d7' + genesisBlockId: + type: string + format: hex_bytearray + description: Genesis block ID + example: '15856251679437054149169000' + timestamp: + type: integer + format: int64 + description: Request timestamp, Unix timestamp in milliseconds + example: 1591696372300 + + TxRequest: + required: + - tx + type: object + properties: + tx: + description: Signed transaction data + type: string + format: hex_bytearray + example: '001047857c04a00539dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152eef5365f2400292d00ca9a3b0000000000c2eb0b000000000000000000000000000000000000000000000000000000000000000000000000920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d5600000000f1da1300fe7062e6fb2fbb37' + nullable: false + + SubscribeAccountRequest: + required: + - type + - accountId + type: object + properties: + type: + description: Type of the event. + type: string + enum: + - balanse + example: balanse + nullable: false + accountId: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + description: Account id + nullable: false + + AccountInfoResp: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/AccountInfo' + + AccountInfo: + type: object + required: + - account + - publicKey + properties: + account: + type: string + format: hex_bytearray + example: '2aa130eb6043151ad6040f16701' + publicKey: + description: The account public key in a hex string format + type: string + format: hex_bytearray + example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' + parent: + type: string + format: hex_bytearray + example: '3aa130eb6043151ad6040f16701' + nullable: true + balance: + type: string + format: integer + example: '45225600000000' + unconfirmedbalance: + type: string + format: integer + example: '45225600000000' + forgedBalance: + type: string + format: integer + example: '45225600000000' + status: + type: string + enum: + - created + - verified + example: created + assetBalances: + type: array + items: + $ref: '#/components/schemas/AssetBalance' + unconfirmedAssetBalances: + type: array + items: + $ref: '#/components/schemas/AssetBalance' + currencies: + type: array + items: + $ref: '#/components/schemas/Currency' + + AssetBalance: + type: object + properties: + asset: + type: string + format: hex_bytearray + description: Asset id + example: 'a2e9b946290b48b69985dc2e5a5860a1' + balance: + type: integer + format: int64 + description: Asset balance. (ATU) + example: 100 + + Currency: + type: object + properties: + id: + type: string + format: hex_bytearray + description: Currency id + example: 'a2e9b946290b48b69985dc2e5a5860a1' + + account: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + + balance: + type: integer + format: int64 + description: Currency balance. (ATU) + example: 98400000 + + unconfirmedBalance: + type: integer + format: int64 + description: Currency unconfirmed balance. + example: 98400000 + name: + type: string + example: 'TTT' + code: + type: string + example: 'TTT' + type: + description: | + The currency type. + There are six types: + EXCHANGEABLE = 0; + CONTROLLABLE = 1; + MINTABLE = 2; + NON_SHUFFLEABLE = 3; + RESERVABLE = 4; + CLAIMABLE = 5; + type: integer + format: int8 + example: 1 + decimals: + type: integer + format: int8 + example: 5 + issuanceHeight: + type: integer + format: int8 + example: 0 + issuerAccount: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + + X509Response: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + id: + type: string + format: hex_bytearray + example: 'MIIIgjCCB2qgAwIBAgIITFQTbb/xK/QwDQYJKoZIhvcNAQELBQAwVDELMAkGA1UE + .......... + BhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczElMCMGA1UEAxMc' + + CountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + count: + type: integer + format: int64 + example: 345 + + SubscribeAccountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + subscribeId: + type: string + example: 'fba2fb94-6f88-11eb-9439-0242ac130002' + + GetSubscriptionAccountResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + txs: + description: Transactions which changed the account state. (10 transactions is limit.) + type: array + items: + type: string + format: hex_bytearray + example: '8330faaeb404178613417' + + ForgersInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + forgers: + description: The array of forgers + type: array + items: + $ref: '#/components/schemas/ForgerInfo' + + ForgerInfo: + type: object + properties: + account: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + effectiveBalanceAPL: + type: integer + format: int64 + description: Effective balance. + example: 98400000 + deadline: + type: integer + format: int64 + description: Dead line. + hitTime: + type: integer + format: int64 + description: Hit time. + + PublicHealthResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/HealthPublicInfo' + + PrivateHealthResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + healthInfo: + $ref: '#/components/schemas/FullHealthInfo' + nodeStatus: + $ref: '#/components/schemas/NodeStatusInfo' + peerInfo: + $ref: '#/components/schemas/FullPeerInfo' + + + FullHealthInfo: + allOf: + - $ref: '#/components/schemas/HealthPublicInfo' + - $ref: '#/components/schemas/HealthPrivateInfo' + + HealthPublicInfo: + type: object + properties: + blockchainHeight: + type: integer + format: int16 + example: 9900345 + description: "Current height of blockchain" + isDbOk: + type: boolean + description: "Database is able to find blocks" + isTrimActive: + type: boolean + description: "Returns true if the trimming process is active" + + HealthPrivateInfo: + type: object + properties: + dbConnectionTotal: + type: integer + format: int16 + description: "Total connections in the pool" + maxUnconfirmedTxCount: + type: integer + format: int16 + description: "The max count of the unconfirmed transactions" + dbConnectionActive: + type: integer + format: int16 + description: "Active connections in the pool" + dbConnectionIdle: + type: integer + format: int16 + description: "Idle connections in the pool" + unconfirmedTxCacheSize: + type: integer + format: int16 + description: "The waiting transactions cache size" + needReboot: + type: boolean + description: "Current total number of DB connections" + + NodeStatusInfo: + type: object + properties: + cpuCount: + type: integer + format: int16 + description: "Number of active CPUs" + cpuLoad: + type: number + format: double + description: "Current average CPU load for all cores" + threadsRunning: + type: integer + format: int16 + description: "Threads currently running in application" + memoryFree: + type: integer + format: int32 + description: "Free memory available for this application" + dbConnections: + type: integer + format: int16 + description: "DB connections currently running in application" + memoryTotal: + type: integer + format: int32 + description: "Total memory in bytes" + diskFree: + type: integer + format: int32 + description: "Free disk space available to application" + operatingSystem: + type: string + description: "Operating system of node" + + NetworkResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + peerInfo: + $ref: '#/components/schemas/PeerPublicInfo' + - type: object + properties: + inboundPeers: + type: integer + format: int8 + description: "Inbound peers" + outboundPeers: + type: integer + format: int8 + description: "Outbound Peers" + + FullPeerInfo: + allOf: + - $ref: '#/components/schemas/PeerPublicInfo' + - $ref: '#/components/schemas/PeerPrivateInfo' + + PeerPublicInfo: + type: object + properties: + announcedAddress: + type: string + description: "Announced address" + sharedAddress: + type: boolean + description: "Is node shared address" + halmark: + type: string + description: "Node hallmark" + version: + type: string + description: "App version" + example: "1.47.10" + platform: + type: string + description: "Platform where app has been running." + example: "Linux amd64" + apiPort: + type: integer + format: int8 + description: "App port" + apiSSLPort: + type: integer + format: int8 + description: "App ssl port" + lastUpdated: + type: integer + format: int32 + description: "Last update" + lastConnectAttempt: + type: integer + format: int32 + description: "Last connect attempt" + inboundWebSocket: + type: boolean + description: "Is inbound web socket works." + outboundWebSocket: + type: boolean + description: "Is outbound web socket works." + blacklistingCause: + type: string + description: "Node has been Blacklisted cause." + blockchainState: + type: string + description: "Blockchain state" + chainId: + type: string + description: "Node chain id." + example: 'a2e9b946-290b-48b6-9985-dc2e5a5860a1' + + PeerPrivateInfo: + type: object + properties: + state: + type: integer + format: int32 + description: "Node state" + weight: + type: integer + format: int32 + description: "Node weight" + services: + type: array + description: "Node services." + items: + type: string + + CacheInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + cacheInfo: + type: array + items: + $ref: '#/components/schemas/CacheInfo' + + CacheInfo: + type: object + properties: + cacheName: + type: string + description: "Cache name" + example: "PUBLIC_KEY_CACHE" + hitCount: + type: integer + format: int64 + example: 3 + description: "The number of times Cache lookup methods have returned a cached value." + hitRate: + type: number + format: double + example: 1.1 + description: "The ratio of cache requests which were hits. This is defined as hitCount / requestCount, or 1.0 when requestCount == 0. Note that hitRate + missRate =~ 1.0." + missCount: + type: integer + format: int64 + example: 4133 + description: "The number of times Cache lookup methods have returned an uncached (newly loaded) value, or null." + missRate: + type: number + format: double + loadSuccessCount: + type: integer + format: int64 + description: "The number of times Cache lookup methods have successfully loaded a new value." + loadExceptionCount: + type: integer + format: int64 + description: "The number of times Cache lookup methods threw an exception while loading a new value." + totalLoadTime: + type: integer + format: int64 + description: "The total number of nanoseconds the cache has spent loading new values. This can be used to calculate the miss penalty. This value is increased every time loadSuccessCount or loadExceptionCount is incremented." + evictionCount: + type: integer + format: int64 + description: "The number of times an entry has been evicted." + + ThreadsInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + threadsInfo: + type: array + items: + $ref: '#/components/schemas/ThreadsInfo' + + ThreadsInfo: + type: object + properties: + name: + type: string + description: "Name of thread" + example: "Reference Handler" + state: + type: string + description: "State of thread" + example: "RUNNABLE" + priority: + type: integer + format: int8 + example: 10 + description: "Priority of thread" + isDaemon: + type: boolean + description: "Is thread started as daemon thread" + example: true + cpuTime: + type: integer + format: int64 + example: 250346188 + description: "CPU time used by thread" + + + TasksInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + tasksInfo: + description: The array of transactions + type: array + items: + $ref: '#/components/schemas/TasksInfo' + + TasksInfo: + type: object + properties: + id: + type: string + description: "Identification of task" + example: "390de590-6f7d-11eb-9439-0242ac130002" + name: + type: string + description: "Short but descriptive name of task" + example: "Shard data import" + decription: + type: string + description: "Description of task in one line" + example: "Data import" + isCrititcal: + type: boolean + description: "Taks is critical and should be displayed on top of UI window" + example: true + stateOfTask: + type: string + description: "Task state in one line in human readable form" + example: "Started" + enum: [ + "Started", + "In progress", + "Finished", + "Cancelled", + "Paused" + ] + started: + type: string + format: date + description: "Task start date and time" + example: "2020-04-12T23:20:50.52Z" + finished: + type: string + format: date + description: "Task finish date and time" + example: "2020-04-12T23:40:50.52Z" + durationMS: + type: integer + format: int64 + example: 250346188 + description: "Task run duration, milliseconds" + missRate: + type: number + format: double + description: "Task completion percent" + example: 100.0 + messages: + type: array + description: "Task messages list" + items: + type: string + + + ListLogs: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + logs: + description: "List of logs files" + type: array + items: + type: string + example: "apl-2021-02-05_0.gz" + + BaseResponse: + type: object + properties: + protocol: + description: 'Protocol version' + type: string + example: '2' + requestProcessingTime: + description: 'Time in milliseconds that took from incoming request to response' + type: integer + format: int64 + example: 12 + default: 0 + errorCode: + description: Error code on new API. null or 0 means success, no error. + type: integer + format: int32 + example: 12 + errorDescription: + description: Textual error description, e.g. exception message, etc that could be displayed to user + type: string + example: 'The mandatory parameter ''id'' is not specified.' + + ListResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/BaseResponse' + nullable: true + + ErrorResponse: + type: object + properties: + protocol: + description: 'Protocol version' + type: string + example: '2' + errorCode: + description: Error code on new API. null or 0 means success, no error. + type: integer + format: int32 + example: 12 + errorDescription: + description: Textual error description, e.g. exception message, etc that could be displayed to user + type: string + example: 'The mandatory parameter ''id'' is not specified.' + errorDetails: + description: | + Detailed error description with debug information, helpful error data or stacktrace, by default + should not be displayed to user. Main purpose is create bug reports with meaningful content. + type: string + example: 'Description of failure' + + parameters: + page: + in: query + name: page + required: false + schema: + type: integer + minimum: 1 + default: 1 + description: Page number. + + limitParam: + in: query + name: limit + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + default: 20 + description: The numbers of items on the one page. + + orderBy: + in: query + name: orderBy + required: false + schema: + type: string + enum: [asc, desc] + default: asc + + responses: + BadRequest: + description: Bad request - malformed request or wrong parameters + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + ConflictResource: + description: | + The request could not be completed due to a conflict with the current state of the resource. + The resource is busy and the request might be reissued later. + ServerError: + description: Server error - internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT From b9217d5d34b67c8f6f80d66abc8cf83eb4043ebf Mon Sep 17 00:00:00 2001 From: andriiK Date: Mon, 22 Feb 2021 18:45:37 +0200 Subject: [PATCH 10/15] APL-1783 rollback api-v2, fix api-v3 --- apl-api2/pom.xml | 3 + .../main/resources/yaml/apollo-api-v2.yaml | 1684 ++++++----------- apl-api3/README.md | 14 + apl-api3/pom.xml | 184 ++ .../aplwallet/api/v3/NotFoundException.java | 12 + .../src/main/resources/META-INF/beans.xml | 13 + .../main/resources/yaml/apollo-api-v3.yaml | 18 +- .../main/resources/yaml/apollo-auth-api.yaml | 109 ++ pom.xml | 1 + 9 files changed, 940 insertions(+), 1098 deletions(-) create mode 100644 apl-api3/README.md create mode 100644 apl-api3/pom.xml create mode 100644 apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/NotFoundException.java create mode 100644 apl-api3/src/main/resources/META-INF/beans.xml rename {apl-api2 => apl-api3}/src/main/resources/yaml/apollo-api-v3.yaml (99%) create mode 100644 apl-api3/src/main/resources/yaml/apollo-auth-api.yaml diff --git a/apl-api2/pom.xml b/apl-api2/pom.xml index dc929f58bb..c98013dcc2 100644 --- a/apl-api2/pom.xml +++ b/apl-api2/pom.xml @@ -113,6 +113,7 @@ + io.swagger.codegen.v3 swagger-codegen-maven-plugin @@ -149,6 +150,8 @@ + + diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml index 9256fa12ea..6f8968cc3a 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml +++ b/apl-api2/src/main/resources/yaml/apollo-api-v2.yaml @@ -16,237 +16,99 @@ servers: - url: http://localhost:7876/rest tags: - - name: blockchain - description: Operations with blockchain state. - - name: node public - description: Public access to node. - - name: node private - description: Private access to node. - - name: subscribe - description: Subscribe on some event. + - name: account + description: Operations about account + - name: state + description: Everything about blockchain state + - name: tx + description: Access to transactions management + - name: operations + description: List operations by account (the bank reconcilation) + - name: info + description: An information paths: - - /@@account/{accountId}: - get: - tags: - - blockchain - summary: Returns the details account information - operationId: getAccountInfo - parameters: - - name: accountId - in: path - description: The account id - required: true - schema: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - - name: includeAssets - in: query - schema: - type: boolean - default: false - description: include asserts to the response - - name: includeCurrencies - in: query - schema: - type: boolean - default: false - description: include currencies to the response - - name: includeLessors - in: query - schema: - type: boolean - default: false - description: include lessors to the response - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/AccountInfoResp' - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - - - /@@transaction/{transactionId}: - get: + /@@account: + post: tags: - - blockchain - summary: Get transaction object given transaction id. - description: Return the detail information about transaction by id. - operationId: getTxById - parameters: - - name: transactionId - in: path - description: Transaction id - required: true - schema: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701' + - account + summary: Returns unsigned CreateChildAccount transaction for creating child accounts + description: | + Returns unsigned CreateChildAccount transaction as a byte array. + The list of child public keys is attached in the transaction appendix. + operationId: createChildAccountTx + requestBody: + description: the parent account and the list of public keys + content: + application/json: + schema: + $ref: '#/components/schemas/AccountReq' + required: true responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/TransactionInfoResp' + $ref: '#/components/schemas/CreateChildAccountResp' + 401: + description: Unauthorized Error + 403: + description: Access Forbidden 400: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - - /@@transactions: - get: + security: + - bearerAuth: [] + /@@account/test: + post: tags: - - blockchain - summary: Get transactions following given filter. - operationId: getTxsByFilter - description: Return the detail information about transactions by filter. - parameters: - - in: query - name: account - description: The account id - schema: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - - - in: query - name: txIds - description: The transaction ids - schema: - type: array - items: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - - - in: query - name: type - description: | - The transaction type, it's an optional parameter and can be missed or specified negative value to avoid - filtering by that criteria. - There are eleven types - PAYMENT = 0; - MESSAGING = 1; - COLORED_COINS = 2; - DIGITAL_GOODS = 3; - ACCOUNT_CONTROL = 4; - MONETARY_SYSTEM = 5; - DATA = 6; - SHUFFLING = 7; - UPDATE = 8; - DEX = 9; - CHILD_ACCOUNT = 10; - schema: - type: string - format: int8 - example: '2' - - - in: query - name: subtype - description: Transaction subtype - schema: - type: string - format: int8 - example: '2' - - - in: query - name: timestamp - description: Show transactions with tx_timestamp >= timestamp - schema: - type: integer - format: int64 - example: 1591696372000 - - - in: query - name: numberOfConfirmations - description: the number of transaction confirmations - schema: - type: integer - format: int32 - - - in: query - name: withMessage - description: show transaction with message - schema: - type: boolean - default: false - - - in: query - name: phasedOnly - description: show only phased transactions - schema: - type: boolean - default: false - - - in: query - name: nonPhasedOnly - description: show only non phased transactions - schema: - type: boolean - default: false - - - in: query - name: includeExpiredPrunable - description: include transactions with expired prunables - schema: - type: boolean - default: false - - - in: query - name: includePhasingResult - description: include transactions with phasing results - schema: - type: boolean - default: false - - - in: query - name: executedOnly - description: show only executed transactions + - account + summary: Returns signed CreateChildAccount transaction for creating child accounts + description: | + Returns signed CreateChildAccount transaction as a byte array. + The list of child public keys is attached in the transaction appendix. + operationId: createChildAccountTxTest + requestBody: + description: the parent account and the list of public keys + content: + application/json: schema: - type: boolean - default: false - - - $ref: '#/components/parameters/page' - - $ref: '#/components/parameters/limitParam' - - $ref: '#/components/parameters/orderBy' - + $ref: '#/components/schemas/AccountReqTest' + required: true responses: 200: description: successful operation content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/TransactionInfoResp' + $ref: '#/components/schemas/CreateChildAccountResp' + 401: + description: Unauthorized Error + 403: + description: Access Forbidden 400: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - + security: + - bearerAuth: [] + /@@account/money: post: tags: - - blockchain - summary: Broadcast a batch of transactions and return the transaction receipt list. - description: Asynchronously broadcast the batch of the signed transaction to the network. The transactions are immediately put into an unconfirmed transaction pool in the same order as in the batch and later are sending to the network. - operationId: broadcastTxs + - account + summary: Returns signed SendMoney transaction from child account + description: | + Returns signed SendMoney transaction as a byte array. + This transaction is a multi-signature signed tx. + operationId: createChildAccountTxSendMony requestBody: - description: an array of signed transactions, each item is a byte array in hex format + description: the parent account, child account and other content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/TxRequest' + $ref: '#/components/schemas/AccountReqSendMoney' required: true responses: 200: @@ -254,386 +116,333 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListResponse' + $ref: '#/components/schemas/CreateChildAccountResp' 401: - description: Not authenticated + description: Unauthorized Error 403: - description: Access token does not have the required scope + description: Access Forbidden 400: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - /@@transactions/count: + security: + - bearerAuth: [] + /@@account/{account}: get: tags: - - blockchain - summary: Count transactions following given filter. - operationId: countTxsByFilter - description: Count transactions by filter. + - account + summary: Returns the details account information + operationId: getAccountInfo parameters: - - in: query - name: account + - name: account + in: path description: The account id - schema: - type: array - items: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - - - in: query - name: type - description: | - The transaction type, it's an optional parameter and can be missed or specified negative value to avoid - filtering by that criteria. - There are eleven types - PAYMENT = 0; - MESSAGING = 1; - COLORED_COINS = 2; - DIGITAL_GOODS = 3; - ACCOUNT_CONTROL = 4; - MONETARY_SYSTEM = 5; - DATA = 6; - SHUFFLING = 7; - UPDATE = 8; - DEX = 9; - CHILD_ACCOUNT = 10; - schema: - type: string - format: int8 - example: '2' - - - in: query - name: subtype - description: Transaction subtype + required: true schema: type: string - format: int8 - example: '2' - - - in: query - name: timestamp - description: Show transactions with tx_timestamp >= timestamp - schema: - type: integer - format: int64 - example: 1591696372000 - - - in: query - name: numberOfConfirmations - description: the number of transaction confirmations - schema: - type: integer - format: int32 - - - in: query - name: withMessage - description: show transaction with message - schema: - type: boolean - default: false - - - in: query - name: phasedOnly - description: show only phased transactions - schema: - type: boolean - default: false - - - in: query - name: nonPhasedOnly - description: show only non phased transactions - schema: - type: boolean - default: false - - - in: query - name: includeExpiredPrunable - description: include transactions with expired prunables - schema: - type: boolean - default: false - - - in: query - name: includePhasingResult - description: include transactions with phasing results - schema: - type: boolean - default: false - - - in: query - name: executedOnly - description: show only executed transactions - schema: - type: boolean - default: false - - - $ref: '#/components/parameters/page' - - $ref: '#/components/parameters/limitParam' - - $ref: '#/components/parameters/orderBy' - + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/TransactionCountResponse' + $ref: '#/components/schemas/AccountInfoResp' 400: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - /@@node/x509: + /@@state/blockchain: get: tags: - - node public - summary: Get node certificate. - description: Return node certificate in x509 format. - operationId: getX509 + - state + summary: Get blockchain state object + description: Return details information about the blockchain state + operationId: getBlockchainState responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/X509Response' + $ref: '#/components/schemas/BlockchainState' 500: $ref: '#/components/responses/ServerError' - - /@@node/health: + /@@state/block: get: tags: - - node public - summary: Gets node health - operationId: getHealthInfo + - state + summary: Get block object + description: Return details information about the block given block height. If no height is provided, it will fetch the latest block. + operationId: getBlockByHeight + parameters: + - name: height + in: query + description: a blockchain height + required: false + schema: + type: string + format: int64 + example: '4315161' + default: '-1' responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/PublicHealthResponse' + $ref: '#/components/schemas/BlockInfo' + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - /@@node/network: + /@@state/block/{block}: get: tags: - - node public - summary: Gets node network info - operationId: getNetworkInfo + - state + summary: Get block object given block id + description: Return the detail information about block given id + operationId: getBlockById + parameters: + - name: block + in: path + description: Block id + required: true + schema: + type: string + format: hex_bytearray + example: '1a0feb1043151604016701' responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/NetworkResponse' + $ref: '#/components/schemas/BlockInfo' + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - /@@node/blockchain: + /@@state/tx/{transaction}: get: tags: - - node public - summary: Get blockchain object - description: Return details information about the blockchain - operationId: getBlockchainInfo + - state + summary: Get transaction receipt given transaction id. + description: Return the brief information about transaction given id. + operationId: getTxReceiptById + parameters: + - name: transaction + in: path + description: Transaction id + required: true + schema: + type: string + format: hex_bytearray + example: '1a0feb06043151604016701' responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/BlockchainInfo' + $ref: '#/components/schemas/TxReceipt' + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - /@@node/tasks: - get: + /@@state/tx: + post: tags: - - node public - summary: Get in progress tasks information. - description: Return details about all inprogress tasks. - operationId: getTasksInfo + - state + summary: Get transaction receipt list given list of the transaction id. + description: Return the list of the brief information about transactions. + operationId: getTxReceiptList + requestBody: + description: the list of transaction id + content: + application/json: + schema: + type: array + items: + type: string + format: hex_bytearray + example: '83aa340eb41780f61376852' + required: true responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/TasksInfoResponse' + type: array + items: + $ref: '#/components/schemas/TxReceipt' + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - - - /@@node/forgers: + /@@state/unconfirmed/count: get: tags: - - node private - summary: Get forgers from the node. - description: Return all forgers from the node. - operationId: getForgers + - state + summary: Get count of unconfirmed transaction receipts. + description: Return the count of unconfirmed transactions. + operationId: getUnconfirmedTxCount responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/ForgersInfoResponse' + $ref: '#/components/schemas/CountResponse' 500: $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - /@@node/health-full: + /@@state/unconfirmed: get: tags: - - node private - summary: Get full health info. - description: Return full health information. - operationId: getHealthFull - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/PrivateHealthResponse' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - /@@node/cache: - get: - tags: - - node private - summary: Get cache info. - description: Return full statistics about the performance of a Cache. - operationId: getCacheInfo + - state + summary: Get list of unconfirmed transaction receipts. + description: Return the list of the detail information about unconfirmed transactions. + operationId: getUnconfirmedTx + parameters: + - name: page + in: query + description: page number (1-based) + required: false + schema: + type: integer + format: int32 + default: 1 + example: 1 + - name: perPage + in: query + description: Number of entries per page (max=100) + required: false + schema: + type: integer + format: int32 + maximum: 100 + default: 50 + example: 50 responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/CacheInfoResponse' + $ref: '#/components/schemas/TransactionInfoArrayResp' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' security: - bearerAuth: [] - - /@@node/threads: - get: + /@@transaction: + post: tags: - - node private - summary: Get threads info. - description: Returns backend threads status - operationId: getThreadsInfo + - tx + summary: Broadcast transaction and return transaction receipt. + description: | + Asynchronously broadcast the signed transaction to the network. + The transaction is validated and immediately put into an unconfirmed transaction pool + for further sending to the blockchain. + operationId: broadcastTx + requestBody: + description: the signed transaction is a byte array in hex format + content: + application/json: + schema: + $ref: '#/components/schemas/TxRequest' + required: true responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/ThreadsInfoResponse' + $ref: '#/components/schemas/TxReceipt' + 400: + $ref: '#/components/responses/BadRequest' + 409: + $ref: '#/components/responses/ConflictResource' 500: $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - /@@node/logs: - get: + /@@transaction/batch: + post: tags: - - node private - summary: Get list of logs files. - description: Returns all names of logs files from this node. - operationId: getLogs + - tx + summary: Broadcast a batch of transactions and return the transaction receipt list. + description: Asynchronously broadcast the batch of the signed transaction to the network. The transactions are immediately put into an unconfirmed transaction pool in the same order as in the batch and later are sending to the network. + operationId: broadcastTxBatch + requestBody: + description: an array of signed transactions, each item is a byte array in hex format + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TxRequest' + required: true responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/ListLogs' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - /@@node/logs/{logName}: - get: - tags: - - node private - summary: Get log file from the node. - description: Return the log file from the node by file name. - operationId: getLogFile - parameters: - - name: logName - in: path - description: Log file name - required: true - schema: - type: string - example: 'apl-2021-02-05_0.gz' - responses: - 200: - description: successful operation. File with logs in binary format - content: - application/octet-stream: - schema: - type: string - format: binary + $ref: '#/components/schemas/ListResponse' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope 400: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' security: - bearerAuth: [] - - - /@@subscribe/account: + /@@transaction/{transaction}: get: tags: - - subscribe - summary: Get subscription status. - operationId: getSubscriptionStatus - description: Return subscription status by subscription id. + - tx + summary: Get transaction object given transaction id. + description: Return the detail information about transaction by id. + operationId: getTxById parameters: - - name: subscriptionId - description: Subscription id - in: query + - name: transaction + in: path + description: Transaction id required: true schema: type: string - example: 'fba2fb94-6f88-11eb-9439-0242ac130002' + format: hex_bytearray + example: '1aa130eb6043151ad6040f16701' responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/GetSubscriptionAccountResponse' + $ref: '#/components/schemas/TransactionInfoResp' + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - + /@@operation/count: post: tags: - - subscribe - summary: Subscribe on change account. - operationId: subscribeOnAccount - description: Subscribe on change something in particular account. + - operations + summary: Returns the count of operations corresponding the query object group by account + operationId: getOperationsCount requestBody: - description: the parent account, child account and other + description: the query object content: application/json: schema: - $ref: '#/components/schemas/SubscribeAccountRequest' + $ref: '#/components/schemas/QueryObject' required: true responses: 200: @@ -641,114 +450,80 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubscribeAccountResponse' + $ref: '#/components/schemas/QueryCountResult' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope + 400: + $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' security: - bearerAuth: [] - - - - /@@block: - get: + /@@operation: + post: tags: - - blockchain - summary: Get block object - description: Return details information about the block given block height. If no height is provided, it will fetch the latest block. - operationId: getBlockByHeight - parameters: - - name: height - in: query - description: a blockchain height - required: false - schema: - type: string - format: int64 - example: '4315161' - default: '-1' - - name: blockId - in: query - description: Block id - required: false - schema: - type: string - format: hex_bytearray - example: '1a0feb1043151604016701' + - operations + summary: Returns the operation list corresponding the query object group by account + operationId: getOperations + requestBody: + description: the query object + content: + application/json: + schema: + $ref: '#/components/schemas/QueryObject' + required: true responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/BlockInfo' + $ref: '#/components/schemas/QueryResult' + 401: + description: Not authenticated + 403: + description: Access token does not have the required scope 400: $ref: '#/components/responses/BadRequest' 500: $ref: '#/components/responses/ServerError' + security: + - bearerAuth: [] - /@@transactions/unconfirmed/count: + /@@info/health: get: tags: - - node private - summary: Get count of unconfirmed transaction receipts. - description: Return the count of unconfirmed transactions. - operationId: getUnconfirmedTxCount + - info + summary: Gets node health + operationId: getHealthInfo responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/CountResponse' + $ref: '#/components/schemas/HealthResponse' 500: $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - /@@transactions/unconfirmed: + /@@info/blockchain: get: tags: - - node private - summary: Get list of unconfirmed transaction receipts. - description: Return the list of the detail information about unconfirmed transactions. - operationId: getUnconfirmedTx - parameters: - - name: page - in: query - description: page number (1-based) - required: false - schema: - type: integer - format: int32 - default: 1 - example: 1 - - name: perPage - in: query - description: Number of entries per page (max=100) - required: false - schema: - type: integer - format: int32 - maximum: 100 - default: 50 - example: 50 + - info + summary: Get blockchain object + description: Return details information about the blockchain + operationId: getBlockchainInfo responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/TransactionInfoArrayResp' - 401: - description: Not authenticated - 403: - description: Access token does not have the required scope - 400: - $ref: '#/components/responses/BadRequest' + $ref: '#/components/schemas/BlockchainInfo' 500: $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] components: schemas: @@ -786,14 +561,6 @@ components: type: string format: int8 example: '1' - status: - type: string - description: | - The transaction status. A transaction is considered as unconfirmed until it is included in a valid block. - A transaction is considered as confirmed after at least one confirmations, so a transaction is considered - as irreversible after 721 confirmations and finally a transaction is permanent if it's confirmed 1440 times. - enum: [unconfirmed, confirmed, irreversible, permanent] - example: unconfirmed phased: description: is true if the transaction is phased type: boolean @@ -896,20 +663,6 @@ components: format: int32 description: the order of the transaction in the block example: 1 - - TransactionCountResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - $ref: '#/components/schemas/TransactionCount' - - TransactionCount: - type: object - properties: - count: - type: integer - format: int64 - example: 345 - BlockInfo: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -1004,13 +757,9 @@ components: type: string format: hex_bytearray example: 'a2e9b946290b48b69985dc2e5a5860a1' - height: - type: integer - format: int64 - example: 4789567 ticker: type: string - example: 'APL' + example: 'USDS' consensus: type: string example: 'Apollo' @@ -1035,17 +784,54 @@ components: type: string format: hex_bytearray example: '90001259ec21d31a30898d7' + + BlockchainState: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + chainid: + type: string + format: hex_bytearray + example: 'a2e9b946290b48b69985dc2e5a5860a1' + height: + type: integer + format: int64 + example: 4789567 + genesisAccount: + type: string + format: hex_bytearray + example: '90001259ec21d31a30898d7' genesisBlockId: type: string format: hex_bytearray description: Genesis block ID example: '15856251679437054149169000' + genesisBlockTimestamp: + type: integer + format: int64 + description: Genesis block timestamp (epoch beginning), Unix timestamp in milliseconds + example: 1491696372000 + ecBlockId: + type: string + format: hex_bytearray + description: The economic clustering block ID + example: '40faaeb15856251679437054' + ecBlockHeight: + type: integer + format: int64 + description: The economic clustering block height + example: 3301233 + txTimestamp: + type: integer + format: int64 + description: Request timestamp in seconds since the genesis block + example: 1591696371 timestamp: type: integer format: int64 description: Request timestamp, Unix timestamp in milliseconds example: 1591696372300 - TxRequest: required: - tx @@ -1057,50 +843,113 @@ components: format: hex_bytearray example: '001047857c04a00539dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152eef5365f2400292d00ca9a3b0000000000c2eb0b000000000000000000000000000000000000000000000000000000000000000000000000920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d5600000000f1da1300fe7062e6fb2fbb37' nullable: false - - SubscribeAccountRequest: + AccountReq: required: - - type - - accountId + - parent + - publicKey type: object properties: - type: - description: Type of the event. - type: string - enum: - - balanse - example: balanse - nullable: false - accountId: + parent: type: string + description: parent account id example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - description: Account id - nullable: false - - AccountInfoResp: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - $ref: '#/components/schemas/AccountInfo' - - AccountInfo: - type: object + child_publicKey_list: + type: array + description: list of child account public keys + maxItems: 128 + items: + type: string + format: hex_bytearray + example: '39dc2e813bb45ff063a376e316b10cd0adeb7306111ca0eb2890194d37960152' + AccountReqTest: required: - - account + - parent - publicKey + type: object properties: - account: + parent: type: string - format: hex_bytearray - example: '2aa130eb6043151ad6040f16701' - publicKey: - description: The account public key in a hex string format + description: parent account id + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + secret: + type: string + description: parent account secret phrase + example: 'topSecretPhrase' + child_secret_list: + type: array + description: list of child secret phrases + maxItems: 128 + items: + type: string + example: 'secret1' + AccountReqSendMoney: + required: + - parent + - publicKey + type: object + properties: + parent: + type: string + description: parent account id + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + psecret: + type: string + description: parent account secret phrase + example: 'ParenttopSecretPhrase' + sender: + type: string + description: child account id + example: 'APL-632K-TWX3-2ALQ-973CU' + csecret: + type: string + description: child account secret phrase + example: 'ChildtopSecretPhrase' + recipient: + type: string + description: recipient account id + example: 'APL-VWMY-APVK-UFHN-3MC7N' + amount: + type: integer + format: int64 + description: the amount + CreateChildAccountResp: + required: + - parent + - tx + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + parent: + type: string + description: parent account id + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + tx: + description: Unsigned transaction data + type: string + format: hex_bytearray + example: '001047857c04a00539dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152eef5365f2400292d00ca9a3b0000000000c2eb0b000000000000000000000000000000000000000000000000000000000000000000000000920173ae606d36c1c77fc5bdf294bd048d04f85c46535525771b524dbb1ed20b73311900d4a409c293a10d8a5ab987430be4bd7478fb16a41cf775afa33c4d5600000000f1da1300fe7062e6fb2fbb37' + AccountInfoResp: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/AccountInfo' + AccountInfo: + type: object + required: + - account + - publicKey + properties: + account: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + publicKey: + description: The account public key in a hex string format type: string format: hex_bytearray example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' parent: type: string - format: hex_bytearray - example: '3aa130eb6043151ad6040f16701' + example: 'APL-AHYW-P3YX-V426-4UMP2' nullable: true balance: type: string @@ -1110,534 +959,223 @@ components: type: string format: integer example: '45225600000000' - forgedBalance: - type: string - format: integer - example: '45225600000000' status: type: string enum: - created - verified example: created - assetBalances: - type: array - items: - $ref: '#/components/schemas/AssetBalance' - unconfirmedAssetBalances: - type: array - items: - $ref: '#/components/schemas/AssetBalance' - currencies: - type: array - items: - $ref: '#/components/schemas/Currency' - - AssetBalance: - type: object - properties: - asset: - type: string - format: hex_bytearray - description: Asset id - example: 'a2e9b946290b48b69985dc2e5a5860a1' - balance: - type: integer - format: int64 - description: Asset balance. (ATU) - example: 100 - - Currency: + QueryObject: type: object properties: - id: - type: string - format: hex_bytearray - description: Currency id - example: 'a2e9b946290b48b69985dc2e5a5860a1' - - account: - type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - - balance: - type: integer - format: int64 - description: Currency balance. (ATU) - example: 98400000 - - unconfirmedBalance: - type: integer - format: int64 - description: Currency unconfirmed balance. - example: 98400000 - name: - type: string - example: 'TTT' - code: - type: string - example: 'TTT' type: description: | - The currency type. - There are six types: - EXCHANGEABLE = 0; - CONTROLLABLE = 1; - MINTABLE = 2; - NON_SHUFFLEABLE = 3; - RESERVABLE = 4; - CLAIMABLE = 5; - type: integer - format: int8 - example: 1 - decimals: - type: integer - format: int8 - example: 5 - issuanceHeight: + The transaction type, it's an optional parameter and can be missed or specified negative value to avoid + filtering by that criteria. + There are eleven types: + PAYMENT = 0; + MESSAGING = 1; + COLORED_COINS = 2; + DIGITAL_GOODS = 3; + ACCOUNT_CONTROL = 4; + MONETARY_SYSTEM = 5; + DATA = 6; + SHUFFLING = 7; + UPDATE = 8; + DEX = 9; + CHILD_ACCOUNT = 10; type: integer format: int8 example: 0 - issuerAccount: - type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - - X509Response: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - id: - type: string - format: hex_bytearray - example: 'MIIIgjCCB2qgAwIBAgIITFQTbb/xK/QwDQYJKoZIhvcNAQELBQAwVDELMAkGA1UE - .......... - BhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczElMCMGA1UEAxMc' - - CountResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - count: - type: integer - format: int64 - example: 345 - - SubscribeAccountResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - subscribeId: - type: string - example: 'fba2fb94-6f88-11eb-9439-0242ac130002' - - GetSubscriptionAccountResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - txs: - description: Transactions which changed the account state. (10 transactions is limit.) - type: array - items: - type: string - format: hex_bytearray - example: '8330faaeb404178613417' - - ForgersInfoResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - forgers: - description: The array of forgers - type: array - items: - $ref: '#/components/schemas/ForgerInfo' - - ForgerInfo: - type: object - properties: - account: + default: -1 + accounts: + description: Exactly all items. + nullable: true + type: array + items: type: string example: 'APL-X5JH-TJKJ-DVGC-5T2V8' - effectiveBalanceAPL: - type: integer - format: int64 - description: Effective balance. - example: 98400000 - deadline: - type: integer - format: int64 - description: Dead line. - hitTime: - type: integer - format: int64 - description: Hit time. - - PublicHealthResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - $ref: '#/components/schemas/HealthPublicInfo' - - PrivateHealthResponse: - allOf: - - $ref: '#/components/schemas/BaseResponse' - - type: object - properties: - healthInfo: - $ref: '#/components/schemas/FullHealthInfo' - nodeStatus: - $ref: '#/components/schemas/NodeStatusInfo' - peerInfo: - $ref: '#/components/schemas/FullPeerInfo' - - - FullHealthInfo: - allOf: - - $ref: '#/components/schemas/HealthPublicInfo' - - $ref: '#/components/schemas/HealthPrivateInfo' - - HealthPublicInfo: - type: object - properties: - blockchainHeight: + first: type: integer - format: int16 - example: 9900345 - description: "Current height of blockchain" - isDbOk: - type: boolean - description: "Database is able to find blocks" - isTrimActive: - type: boolean - description: "Returns true if the trimming process is active" - - HealthPrivateInfo: - type: object - properties: - dbConnectionTotal: - type: integer - format: int16 - description: "Total connections in the pool" - maxUnconfirmedTxCount: - type: integer - format: int16 - description: "The max count of the unconfirmed transactions" - dbConnectionActive: - type: integer - format: int16 - description: "Active connections in the pool" - dbConnectionIdle: - type: integer - format: int16 - description: "Idle connections in the pool" - unconfirmedTxCacheSize: - type: integer - format: int16 - description: "The waiting transactions cache size" - needReboot: - type: boolean - description: "Current total number of DB connections" - - NodeStatusInfo: - type: object - properties: - cpuCount: - type: integer - format: int16 - description: "Number of active CPUs" - cpuLoad: - type: number - format: double - description: "Current average CPU load for all cores" - threadsRunning: + format: int64 + description: The first block height + example: 4000123 + last: type: integer - format: int16 - description: "Threads currently running in application" - memoryFree: + format: int64 + description: The last block height + example: 4999000 + startTime: type: integer - format: int32 - description: "Free memory available for this application" - dbConnections: + format: int64 + description: The start of the time period, Unix timestamp in milliseconds + example: 1591696310000 + endTime: type: integer - format: int16 - description: "DB connections currently running in application" - memoryTotal: + format: int64 + description: The end of the time period, Unix timestamp in milliseconds + example: 1591696372000 + page: type: integer format: int32 - description: "Total memory in bytes" - diskFree: + description: page number (1-based) + default: 1 + example: 1 + perPage: type: integer format: int32 - description: "Free disk space available to application" - operatingSystem: + description: Number of entries per page (max=100) + default: 25 + example: 25 + orderBy: type: string - description: "Operating system of node" - - NetworkResponse: + nullable: true + enum: [asc, desc] + default: asc + QueryResult: allOf: - $ref: '#/components/schemas/BaseResponse' - type: object properties: - peerInfo: - $ref: '#/components/schemas/PeerPublicInfo' - - type: object - properties: - inboundPeers: - type: integer - format: int8 - description: "Inbound peers" - outboundPeers: + count: type: integer - format: int8 - description: "Outbound Peers" - - FullPeerInfo: - allOf: - - $ref: '#/components/schemas/PeerPublicInfo' - - $ref: '#/components/schemas/PeerPrivateInfo' - - PeerPublicInfo: - type: object - properties: - announcedAddress: - type: string - description: "Announced address" - sharedAddress: - type: boolean - description: "Is node shared address" - halmark: - type: string - description: "Node hallmark" - version: - type: string - description: "App version" - example: "1.47.10" - platform: - type: string - description: "Platform where app has been running." - example: "Linux amd64" - apiPort: - type: integer - format: int8 - description: "App port" - apiSSLPort: - type: integer - format: int8 - description: "App ssl port" - lastUpdated: - type: integer - format: int32 - description: "Last update" - lastConnectAttempt: - type: integer - format: int32 - description: "Last connect attempt" - inboundWebSocket: - type: boolean - description: "Is inbound web socket works." - outboundWebSocket: - type: boolean - description: "Is outbound web socket works." - blacklistingCause: - type: string - description: "Node has been Blacklisted cause." - blockchainState: - type: string - description: "Blockchain state" - chainId: - type: string - description: "Node chain id." - example: 'a2e9b946-290b-48b6-9985-dc2e5a5860a1' - - PeerPrivateInfo: - type: object - properties: - state: - type: integer - format: int32 - description: "Node state" - weight: - type: integer - format: int32 - description: "Node weight" - services: - type: array - description: "Node services." - items: - type: string - - CacheInfoResponse: + format: int32 + description: Count of result items + example: 345 + result: + type: array + items: + $ref: '#/components/schemas/TxReceipt' + query: + $ref: '#/components/schemas/QueryObject' + QueryCountResult: allOf: - $ref: '#/components/schemas/BaseResponse' - type: object properties: - cacheInfo: - type: array - items: - $ref: '#/components/schemas/CacheInfo' - - CacheInfo: - type: object - properties: - cacheName: - type: string - description: "Cache name" - example: "PUBLIC_KEY_CACHE" - hitCount: - type: integer - format: int64 - example: 3 - description: "The number of times Cache lookup methods have returned a cached value." - hitRate: - type: number - format: double - example: 1.1 - description: "The ratio of cache requests which were hits. This is defined as hitCount / requestCount, or 1.0 when requestCount == 0. Note that hitRate + missRate =~ 1.0." - missCount: - type: integer - format: int64 - example: 4133 - description: "The number of times Cache lookup methods have returned an uncached (newly loaded) value, or null." - missRate: - type: number - format: double - loadSuccessCount: - type: integer - format: int64 - description: "The number of times Cache lookup methods have successfully loaded a new value." - loadExceptionCount: - type: integer - format: int64 - description: "The number of times Cache lookup methods threw an exception while loading a new value." - totalLoadTime: - type: integer - format: int64 - description: "The total number of nanoseconds the cache has spent loading new values. This can be used to calculate the miss penalty. This value is increased every time loadSuccessCount or loadExceptionCount is incremented." - evictionCount: - type: integer - format: int64 - description: "The number of times an entry has been evicted." - - ThreadsInfoResponse: + count: + type: integer + format: int64 + example: 345 + query: + $ref: '#/components/schemas/QueryObject' + TxReceipt: + description: Transaction receipt. The lightweight and compact representation of the blockchain transaction. + Doesn't support the transaction type conversion. allOf: - $ref: '#/components/schemas/BaseResponse' - type: object + required: + - transaction + - sender + - recipient + - signature properties: - threadsInfo: - type: array - items: - $ref: '#/components/schemas/ThreadsInfo' - - ThreadsInfo: - type: object - properties: - name: - type: string - description: "Name of thread" - example: "Reference Handler" - state: - type: string - description: "State of thread" - example: "RUNNABLE" - priority: - type: integer - format: int8 - example: 10 - description: "Priority of thread" - isDaemon: - type: boolean - description: "Is thread started as daemon thread" - example: true - cpuTime: - type: integer - format: int64 - example: 250346188 - description: "CPU time used by thread" - - - TasksInfoResponse: + transaction: + type: string + format: hex_bytearray + example: '8330faaeb404178613417' + sender: + type: string + example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + recipient: + type: string + example: 'APL-FXHG-6KHM-23LE-42ACU' + signature: + type: string + format: hex_bytearray + example: 'B98CB1890E76C772A10994B210ED9CF7F9A5488672A5D82C2734BBF9D11505D1' + timestamp: + type: integer + format: int64 + description: Transaction timestamp, Unix timestamp in milliseconds + example: 1591696372000 + amount: + type: string + format: integer + example: '34500000000' + fee: + type: string + format: integer + example: '0' + payload: + type: string + example: '{"transaction":"1234567890", "amount":"1234567890.12"}' + status: + type: string + description: | + The transaction status. A transaction is considered as unconfirmed until it is included in a valid block. + A transaction is considered as confirmed after at least one confirmations, so a transaction is considered + as irreversible after 721 confirmations and finally a transaction is permanent if it's confirmed 1440 times. + enum: [unconfirmed, confirmed, irreversible, permanent] + example: unconfirmed + block: + description: The Id of the block containing the confirmed transaction + type: string + format: hex_bytearray + example: '40faaeb1585625167943' + blockTimestamp: + type: integer + format: int64 + description: Block timestamp, Unix timestamp in milliseconds + example: 1591696372000 + height: + type: integer + format: int64 + example: 15623658 + index: + type: integer + format: int32 + description: the order of the transaction in the block + example: 1 + confirmations: + type: integer + format: int64 + description: the amount of block transaction + example: 1758 + CountResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - type: object properties: - tasksInfo: - description: The array of transactions - type: array - items: - $ref: '#/components/schemas/TasksInfo' - - TasksInfo: - type: object - properties: - id: - type: string - description: "Identification of task" - example: "390de590-6f7d-11eb-9439-0242ac130002" - name: - type: string - description: "Short but descriptive name of task" - example: "Shard data import" - decription: - type: string - description: "Description of task in one line" - example: "Data import" - isCrititcal: - type: boolean - description: "Taks is critical and should be displayed on top of UI window" - example: true - stateOfTask: - type: string - description: "Task state in one line in human readable form" - example: "Started" - enum: [ - "Started", - "In progress", - "Finished", - "Cancelled", - "Paused" - ] - started: - type: string - format: date - description: "Task start date and time" - example: "2020-04-12T23:20:50.52Z" - finished: - type: string - format: date - description: "Task finish date and time" - example: "2020-04-12T23:40:50.52Z" - durationMS: - type: integer - format: int64 - example: 250346188 - description: "Task run duration, milliseconds" - missRate: - type: number - format: double - description: "Task completion percent" - example: 100.0 - messages: - type: array - description: "Task messages list" - items: - type: string - + count: + type: integer + format: int64 + example: 345 - ListLogs: + HealthResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - type: object properties: - logs: - description: "List of logs files" - type: array - items: - type: string - example: "apl-2021-02-05_0.gz" + blockchainHeight: + type: integer + format: int16 + example: 9900345 + description: "Current height of blockchain" + dbConnectionTotal: + type: integer + format: int16 + description: "Total connections in the pool" + dbConnectionActive: + type: integer + format: int16 + description: "Active connections in the pool" + dbConnectionIdle: + type: integer + format: int16 + description: "Idle connections in the pool" + unconfirmedTxCacheSize: + type: integer + format: int16 + description: "The waiting transactions cache size" + maxUnconfirmedTxCount: + type: integer + format: int16 + description: "The max count of the unconfirmed transactions" + isTrimActive: + type: boolean + description: "Returns true if the trimming process is active" BaseResponse: type: object @@ -1695,38 +1233,6 @@ components: should not be displayed to user. Main purpose is create bug reports with meaningful content. type: string example: 'Description of failure' - - parameters: - page: - in: query - name: page - required: false - schema: - type: integer - minimum: 1 - default: 1 - description: Page number. - - limitParam: - in: query - name: limit - required: false - schema: - type: integer - minimum: 1 - maximum: 100 - default: 20 - description: The numbers of items on the one page. - - orderBy: - in: query - name: orderBy - required: false - schema: - type: string - enum: [asc, desc] - default: asc - responses: BadRequest: description: Bad request - malformed request or wrong parameters @@ -1749,4 +1255,4 @@ components: bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT \ No newline at end of file diff --git a/apl-api3/README.md b/apl-api3/README.md new file mode 100644 index 0000000000..db9e2acb0f --- /dev/null +++ b/apl-api3/README.md @@ -0,0 +1,14 @@ +The Swagger Codegen project - https://github.com/swagger-api/swagger-codegen/tree/3.0.0 + +To build package, please execute the following: + +``` +mvn clean package +``` + +To run swagger editor from DockerHub, please execute the following: + +``` +docker pull swaggerapi/swagger-editor +docker run -d -p 80:8080 swaggerapi/swagger-editor +``` diff --git a/apl-api3/pom.xml b/apl-api3/pom.xml new file mode 100644 index 0000000000..cf6b673c01 --- /dev/null +++ b/apl-api3/pom.xml @@ -0,0 +1,184 @@ + + + 4.0.0 + + com.apollocurrency + apollo-blockchain + 1.48.2 + + + apl-api3 + apl-api3 + jar + + + 3.1.0 + 1.6.0 + 2.0.0 + 9.2.9.v20150224 + 3.0.11.Final + 1.6.3 + 4.8.1 + 2.5 + 3.0.20 + + + + src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + + + + com/apollocurrency/aplwallet/api/impl/v3/* + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + + src/gen/java + + + + + + + maven-antrun-plugin + + + process-sources + + + + + + + + + + run + + + + + + maven-clean-plugin + ${maven-clean-plugin.version} + + + clean-webapp + process-sources + + clean + + + + + src/main/webapp + + + src/genimpl + + + + + + clean-source + clean + + clean + + + + + src/gen/java + + + + + + + + + io.swagger.codegen.v3 + swagger-codegen-maven-plugin + ${swagger-codegen-maven-plugin.version} + + + + generate + + + ${project.basedir}/src/main/resources/yaml/apollo-api-v3.yaml + ${project.basedir} + jaxrs-resteasy + apl-api3 + com.apollocurrency + com.apollocurrency.aplwallet.api.v3 + com.apollocurrency.aplwallet.api.v3.model + com.apollocurrency.aplwallet.api + true + true + false + ApiException.java,NotFoundException.java + + + + false + + src/gen/java + src/genimpl/java + true + true + + + + + + + + + + + + javax.ws.rs + javax.ws.rs-api + provided + + + org.jboss.weld.servlet + weld-servlet-shaded + provided + + + io.swagger.core.v3 + swagger-jaxrs2 + + + + javax.validation + validation-api + provided + + + org.projectlombok + lombok + compile + + + diff --git a/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/NotFoundException.java b/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/NotFoundException.java new file mode 100644 index 0000000000..f6e57d9a7e --- /dev/null +++ b/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/NotFoundException.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2018-2020. Apollo Foundation. + */ + +package com.apollocurrency.aplwallet.api.v3; + +public class NotFoundException extends javax.ws.rs.NotFoundException { + + public NotFoundException(String msg) { + super(msg); + } +} diff --git a/apl-api3/src/main/resources/META-INF/beans.xml b/apl-api3/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..e290abbacc --- /dev/null +++ b/apl-api3/src/main/resources/META-INF/beans.xml @@ -0,0 +1,13 @@ + + + + org.jboss.weld.environment.se.threading.RunnableDecorator + + + + + \ No newline at end of file diff --git a/apl-api2/src/main/resources/yaml/apollo-api-v3.yaml b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml similarity index 99% rename from apl-api2/src/main/resources/yaml/apollo-api-v3.yaml rename to apl-api3/src/main/resources/yaml/apollo-api-v3.yaml index 44acba28db..2ea6b97598 100644 --- a/apl-api2/src/main/resources/yaml/apollo-api-v3.yaml +++ b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.0.3 info: title: Apollo API V3 description: | @@ -1601,15 +1601,15 @@ components: "Paused" ] started: - type: string - format: date - description: "Task start date and time" - example: "2020-04-12T23:20:50.52Z" + type: integer + format: int64 + description: "Task start date" + example: "1613991261" finished: - type: string - format: date - description: "Task finish date and time" - example: "2020-04-12T23:40:50.52Z" + type: integer + format: int64 + description: "Task finish date" + example: "1613991261" durationMS: type: integer format: int64 diff --git a/apl-api3/src/main/resources/yaml/apollo-auth-api.yaml b/apl-api3/src/main/resources/yaml/apollo-auth-api.yaml new file mode 100644 index 0000000000..258d8635ec --- /dev/null +++ b/apl-api3/src/main/resources/yaml/apollo-auth-api.yaml @@ -0,0 +1,109 @@ +openapi: 3.0.1 +info: + title: Apollo Auth API V2 + description: | + Apollo Auth API V2 work in progress. + + JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA. + + Required payload: + - User ID + - Application/Service ID + - Role + + *User ID* - authenticates the user identity for personal responsibility + + *Service ID* - the uniq ID of particular application or service + + *Role* - the granular role to manage access to the different groups of the API methods + + contact: + email: authapiteam@firstbridge.io + version: 2.0.0 + +externalDocs: + description: Introduction to JSON Web Tokens + url: https://jwt.io/introduction/ + +servers: +- url: http://localhost:8080/api/v2 + +tags: +- name: auth + description: System authorisation + +paths: + /auth/login: + post: + tags: + - auth + summary: user login routine + description: basic routine in order to obtain a token + operationId: authLogin + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthRequest' + responses: + 200: + description: Return the access token + content: + application/json: + schema: + $ref: '#/components/schemas/AuthResponse' + 401: + description: Unauthorized Error, cause bad credentials + + /auth/refresh: + post: + tags: + - auth + summary: refresh token + description: Refresh the access token + operationId: authRefresh + responses: + 200: + description: Return refreshed access token + content: + application/json: + schema: + $ref: '#/components/schemas/AuthResponse' + 401: + description: Unauthorized Error + 403: + description: Access Forbidden + security: + - bearerAuth: [] +components: + schemas: + AuthRequest: + type: object + properties: + login: + description: The login name + type: string + example: 'manager1' + password: + description: Top secret password + type: string + AuthResponse: + type: object + properties: + login: + type: string + example: 'manager1' + accessToken: + type: string + description: The access token carry the necessary information to access a resource directly + example: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiMjBlYjIxMzkxZGMyOTg1OWY5NTcwOTM4MTEzNjM1ODc2MDhmNzZmIiwic2NvcGUiOlsiVVNFUl9ST0xFIl0sImlzcyI6Imh0dHBzOi8vYXBvbGxvY3VycmVuY3kub3JnIiwiY29tcGxlbWVudGFyeS1zdWJzY3JpcHRpb24iOiI0NDNmNDY1ZS1lYmVhLTRiYTUtOTA5NS04OGE1YTFhZTY0MDUiLCJleHAiOjE1OTE1Mzc1OTgsImlhdCI6MTU5MTUzMzk5OH0.dBdP7HjNo5DeWUlvlz_K2-lSI0zp6pgyLRU8ADjiDlsMw03_yT4BQxzd3PR5j108jRdiBwdUQo64q0XfIvZc7w' + refreshToken: + type: string + description: The refresh token carry the information necessary to get a new access token + example: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiMjBlYjIxMzkxZGMyOTg1OWY5NTcwOTM4MTEzNjM1ODc2MDhmNzZmIiwic2NvcGUiOlsiUkVGUkVTSF9UT0tFTl9ST0xFIl0sImlzcyI6Imh0dHBzOi8vYXBvbGxvY3VycmVuY3kub3JnIiwiY29tcGxlbWVudGFyeS1zdWJzY3JpcHRpb24iOiJmZTQ0NzY3MS1jNjAwLTRlMTItYjIxMS0wZmU0ZjRkNzg2ZDQiLCJleHAiOjE1OTE1Mzk2MTEsImlhdCI6MTU5MTUzNDIxMX0.r276DFiH1ghvgYyYY68i_HWUHJabOSKcZRD3o_fdOsEBldq3xAOTyBHDGHZWSKSGN89lLJwohu9uJp2XNdhSBA' + + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT diff --git a/pom.xml b/pom.xml index b4b02941d6..66ff0434d6 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,7 @@ apl-db-updater apl-dex apl-vault-wallet + apl-api3 From c335d45cfb7b2b4a3c764d9b2825a0f6db9d859d Mon Sep 17 00:00:00 2001 From: andriiK Date: Tue, 23 Feb 2021 12:06:40 +0200 Subject: [PATCH 11/15] APL-1783 api-v3 fix yaml --- apl-api3/src/main/resources/yaml/apollo-api-v3.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml index 2ea6b97598..83e2fdb7d6 100644 --- a/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml +++ b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml @@ -1384,8 +1384,6 @@ components: properties: peerInfo: $ref: '#/components/schemas/PeerPublicInfo' - - type: object - properties: inboundPeers: type: integer format: int8 From 37bd38096054c9becf64595ee7564e0132329418 Mon Sep 17 00:00:00 2001 From: andriiK Date: Wed, 24 Feb 2021 09:26:30 +0200 Subject: [PATCH 12/15] APL-1783 comment subscribe end points --- .../main/resources/yaml/apollo-api-v3.yaml | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml index 83e2fdb7d6..89791bd06a 100644 --- a/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml +++ b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml @@ -22,8 +22,8 @@ tags: description: Public access to node. - name: node private description: Private access to node. - - name: subscribe - description: Subscribe on some event. +# - name: subscribe +# description: Subscribe on some event. paths: @@ -595,57 +595,57 @@ paths: - bearerAuth: [] - /@@subscribe/account: - get: - tags: - - subscribe - summary: Get subscription status. - operationId: getSubscriptionStatus - description: Return subscription status by subscription id. - parameters: - - name: subscriptionId - description: Subscription id - in: query - required: true - schema: - type: string - example: 'fba2fb94-6f88-11eb-9439-0242ac130002' - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/GetSubscriptionAccountResponse' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] - - post: - tags: - - subscribe - summary: Subscribe on change account. - operationId: subscribeOnAccount - description: Subscribe on change something in particular account. - requestBody: - description: the parent account, child account and other - content: - application/json: - schema: - $ref: '#/components/schemas/SubscribeAccountRequest' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/SubscribeAccountResponse' - 500: - $ref: '#/components/responses/ServerError' - security: - - bearerAuth: [] +# /@@subscribe/account: +# get: +# tags: +# - subscribe +# summary: Get subscription status. +# operationId: getSubscriptionStatus +# description: Return subscription status by subscription id. +# parameters: +# - name: subscriptionId +# description: Subscription id +# in: query +# required: true +# schema: +# type: string +# example: 'fba2fb94-6f88-11eb-9439-0242ac130002' +# responses: +# 200: +# description: successful operation +# content: +# application/json: +# schema: +# $ref: '#/components/schemas/GetSubscriptionAccountResponse' +# 500: +# $ref: '#/components/responses/ServerError' +# security: +# - bearerAuth: [] +# +# post: +# tags: +# - subscribe +# summary: Subscribe on change account. +# operationId: subscribeOnAccount +# description: Subscribe on change something in particular account. +# requestBody: +# description: the parent account, child account and other +# content: +# application/json: +# schema: +# $ref: '#/components/schemas/SubscribeAccountRequest' +# required: true +# responses: +# 200: +# description: successful operation +# content: +# application/json: +# schema: +# $ref: '#/components/schemas/SubscribeAccountResponse' +# 500: +# $ref: '#/components/responses/ServerError' +# security: +# - bearerAuth: [] From 8b776d3902ed9794c24cc5f5cc5e858c1e209ef8 Mon Sep 17 00:00:00 2001 From: andriiK Date: Thu, 4 Mar 2021 11:31:07 +0200 Subject: [PATCH 13/15] APL-1846 refactoring after the first iteration --- .../main/resources/yaml/apollo-api-v3.yaml | 550 +++++++++--------- 1 file changed, 282 insertions(+), 268 deletions(-) diff --git a/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml index 89791bd06a..4e9e955c4b 100644 --- a/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml +++ b/apl-api3/src/main/resources/yaml/apollo-api-v3.yaml @@ -41,25 +41,25 @@ paths: schema: type: string format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - - name: includeAssets + example: '0x1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + - name: includeAssetsCount in: query schema: type: boolean default: false - description: include asserts to the response - - name: includeCurrencies + description: include asserts to count the response + - name: includeUnconfermedAssetsCount in: query schema: type: boolean default: false - description: include currencies to the response - - name: includeLessors + description: include unconfermed asserts count to the response + - name: includeCurrenciesCount in: query schema: type: boolean default: false - description: include lessors to the response + description: include currencies count to the response responses: 200: description: successful operation @@ -72,6 +72,87 @@ paths: 500: $ref: '#/components/responses/ServerError' + /@@account/assets/{accountId}: + get: + tags: + - blockchain + summary: Returns the account assets + operationId: getAccountAssets + parameters: + - name: accountId + in: path + description: The account id + required: true + schema: + type: string + format: hex_bytearray + example: '0x1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AccountAssetsResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@account/unconfermed_assets/{accountId}: + get: + tags: + - blockchain + summary: Returns the account unconfermed assets + operationId: getAccountUnconfermedAssets + parameters: + - name: accountId + in: path + description: The account id + required: true + schema: + type: string + format: hex_bytearray + example: '0x1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AccountAssetsResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@account/currencies/{accountId}: + get: + tags: + - blockchain + summary: Returns the account currencies + operationId: getAccountCurrencies + parameters: + - name: accountId + in: path + description: The account id + required: true + schema: + type: string + format: hex_bytearray + example: '0x1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/AccountCurrenciesResp' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + /@@transaction/{transactionId}: get: @@ -88,7 +169,7 @@ paths: schema: type: string format: hex_bytearray - example: '1aa130eb6043151ad6040f16701' + example: '0x1aa130eb6043151ad6040f16701 or 123123123123123124' responses: 200: description: successful operation @@ -111,12 +192,12 @@ paths: description: Return the detail information about transactions by filter. parameters: - in: query - name: account + name: accountId description: The account id schema: type: string format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + example: '0x1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - in: query name: txIds @@ -126,7 +207,7 @@ paths: items: type: string format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' + example: '0x1aa130eb6043151ad6040f16701 or 12345225623123111' - in: query name: type @@ -194,27 +275,6 @@ paths: type: boolean default: false - - in: query - name: includeExpiredPrunable - description: include transactions with expired prunables - schema: - type: boolean - default: false - - - in: query - name: includePhasingResult - description: include transactions with phasing results - schema: - type: boolean - default: false - - - in: query - name: executedOnly - description: show only executed transactions - schema: - type: boolean - default: false - - $ref: '#/components/parameters/page' - $ref: '#/components/parameters/limitParam' - $ref: '#/components/parameters/orderBy' @@ -264,127 +324,6 @@ paths: 500: $ref: '#/components/responses/ServerError' - /@@transactions/count: - get: - tags: - - blockchain - summary: Count transactions following given filter. - operationId: countTxsByFilter - description: Count transactions by filter. - parameters: - - in: query - name: account - description: The account id - schema: - type: array - items: - type: string - format: hex_bytearray - example: '1aa130eb6043151ad6040f16701 or APL-X5JH-TJKJ-DVGC-5T2V8 or 12345225623123111' - - - in: query - name: type - description: | - The transaction type, it's an optional parameter and can be missed or specified negative value to avoid - filtering by that criteria. - There are eleven types - PAYMENT = 0; - MESSAGING = 1; - COLORED_COINS = 2; - DIGITAL_GOODS = 3; - ACCOUNT_CONTROL = 4; - MONETARY_SYSTEM = 5; - DATA = 6; - SHUFFLING = 7; - UPDATE = 8; - DEX = 9; - CHILD_ACCOUNT = 10; - schema: - type: string - format: int8 - example: '2' - - - in: query - name: subtype - description: Transaction subtype - schema: - type: string - format: int8 - example: '2' - - - in: query - name: timestamp - description: Show transactions with tx_timestamp >= timestamp - schema: - type: integer - format: int64 - example: 1591696372000 - - - in: query - name: numberOfConfirmations - description: the number of transaction confirmations - schema: - type: integer - format: int32 - - - in: query - name: withMessage - description: show transaction with message - schema: - type: boolean - default: false - - - in: query - name: phasedOnly - description: show only phased transactions - schema: - type: boolean - default: false - - - in: query - name: nonPhasedOnly - description: show only non phased transactions - schema: - type: boolean - default: false - - - in: query - name: includeExpiredPrunable - description: include transactions with expired prunables - schema: - type: boolean - default: false - - - in: query - name: includePhasingResult - description: include transactions with phasing results - schema: - type: boolean - default: false - - - in: query - name: executedOnly - description: show only executed transactions - schema: - type: boolean - default: false - - - $ref: '#/components/parameters/page' - - $ref: '#/components/parameters/limitParam' - - $ref: '#/components/parameters/orderBy' - - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionCountResponse' - 400: - $ref: '#/components/responses/BadRequest' - 500: - $ref: '#/components/responses/ServerError' - /@@node/x509: get: tags: @@ -673,14 +612,53 @@ paths: schema: type: string format: hex_bytearray - example: '1a0feb1043151604016701' + example: '0x1a0feb1043151604016701 OR 1231244876873' responses: 200: description: successful operation content: application/json: schema: - $ref: '#/components/schemas/BlockInfo' + $ref: '#/components/schemas/BlockInfoResponse' + 400: + $ref: '#/components/responses/BadRequest' + 500: + $ref: '#/components/responses/ServerError' + + /@@blocks: + get: + tags: + - blockchain + summary: Get list of blocks + description: Return details information about the list of blocks by given criterias. + operationId: getBlocks + parameters: + - in: query + name: blockId + description: The block ids + schema: + type: array + items: + type: string + format: hex_bytearray + example: '0x1aa130eb6043151ad6040f16701 or 12345225623123111' + - in: query + name: height + description: The block heights + schema: + type: array + items: + type: string + format: int64 + example: '4315161' + + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/BlockInfoListResponse' 400: $ref: '#/components/responses/BadRequest' 500: @@ -775,7 +753,7 @@ components: description: The transaction ID type: string format: hex_bytearray - example: '1a0feb1306043151604016701' + example: '0x1a0feb1306043151604016701 OR 123123137876801' type: description: Transaction type type: string @@ -815,7 +793,7 @@ components: recipient: type: string description: The account Id of the recipient - example: 'APL-FXHG-6KHM-23LE-42ACU' + example: '0x1aa130eb6043151ad6040f16701' amount: type: string format: integer @@ -855,7 +833,7 @@ components: sender: type: string description: The sender account - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + example: '0x1aa130eb6043151ad6040f16701' height: type: integer format: int64 @@ -870,7 +848,7 @@ components: type: string format: hex_bytearray description: The economic clustering block ID - example: '40faaeb15856251679437054' + example: '0x40faaeb15856251679437054' ecBlockHeight: type: integer format: int64 @@ -880,7 +858,7 @@ components: type: string format: hex_bytearray description: The block id - example: '230aeb0f4585625167943' + example: '0x230aeb0f4585625167943' confirmations: type: integer format: int32 @@ -910,91 +888,105 @@ components: format: int64 example: 345 - BlockInfo: + BlockInfoResponse: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - $ref: '#/components/schemas/BlockInfo' + + BlockInfoListResponse: allOf: - $ref: '#/components/schemas/BaseResponse' - type: object properties: - id: - type: string - format: hex_bytearray - example: '1130faaeb604315160401' - blockSignature: - type: string - format: hex_bytearray - example: 'ff080e64436603df0c3b9a5b792b03a26725a83bbe6aa46eb7eed9ee83707f071b6d529d09be1f2594c6f8545c2772a091896bc808553c1774e39a41248b1e1c' - height: - type: integer - format: int64 - example: 1319854 - generator: - type: string - example: 'APL-FXHG-6KHM-23LE-42ACU' - generationSignature: - type: string - format: hex_bytearray - example: '60e598f6276371119720786b05e507cd628665473b24c8f76de436d99cf113f7' - generatorPublicKey: - type: string - format: hex_bytearray - example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' - timestamp: - type: integer - format: int64 - description: Block timestamp, Unix timestamp in milliseconds - example: 1591696372000 - timeout: - type: integer - format: int32 - example: 1 - version: - description: The block version - type: integer - format: int32 - example: 6 - baseTarget: - type: string - example: '7686143350' - cumulativeDifficulty: - type: string - format: integer - example: '8728234277524822' - previousBlock: - description: Prev block id - type: string - format: hex_bytearray - example: '80faaeb4787337264514' - previousBlockHash: - type: string - format: hex_bytearray - example: '5b8ba14eaebba8cdc682c946947f5352a596d00ac63c4e616785d00cf8b8e016' - nextBlock: - description: Next block id - type: string - format: hex_bytearray - example: '140faaeb81930093118053' - payloadHash: - type: string - format: hex_bytearray - description: Hash of the paylod (all transactions) - example: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' - payloadLength: - description: The length in bytes of all transactions - type: integer - format: int32 - example: 523423 - numberOfTransactions: - type: integer - format: int32 - example: 14 - totalAmountATM: - type: string - format: integer - example: '569000000000000' - totalFeeATM: - type: string - format: integer - example: '2800000000' + blocksInfo: + description: "List of blocks" + type: array + items: + $ref: '#/components/schemas/BlockInfo' + + BlockInfo: + type: object + properties: + id: + type: string + format: hex_bytearray + example: '0x1130faaeb604315160401' + blockSignature: + type: string + format: hex_bytearray + example: 'ff080e64436603df0c3b9a5b792b03a26725a83bbe6aa46eb7eed9ee83707f071b6d529d09be1f2594c6f8545c2772a091896bc808553c1774e39a41248b1e1c' + height: + type: integer + format: int64 + example: 1319854 + generator: + type: string + example: '0x1aa130eb6043151ad6040f16701' + generationSignature: + type: string + format: hex_bytearray + example: '60e598f6276371119720786b05e507cd628665473b24c8f76de436d99cf113f7' + generatorPublicKey: + type: string + format: hex_bytearray + example: '39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152' + timestamp: + type: integer + format: int64 + description: Block timestamp, Unix timestamp in milliseconds + example: 1591696372000 + timeout: + type: integer + format: int32 + example: 1 + version: + description: The block version + type: integer + format: int32 + example: 6 + baseTarget: + type: string + example: '7686143350' + cumulativeDifficulty: + type: string + format: integer + example: '8728234277524822' + previousBlock: + description: Prev block id + type: string + format: hex_bytearray + example: '0x80faaeb4787337264514' + previousBlockHash: + type: string + format: hex_bytearray + example: '5b8ba14eaebba8cdc682c946947f5352a596d00ac63c4e616785d00cf8b8e016' + nextBlock: + description: Next block id + type: string + format: hex_bytearray + example: '0x140faaeb81930093118053' + payloadHash: + type: string + format: hex_bytearray + description: Hash of the paylod (all transactions) + example: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' + payloadLength: + description: The length in bytes of all transactions + type: integer + format: int32 + example: 523423 + numberOfTransactions: + type: integer + format: int32 + example: 14 + totalAmountATM: + type: string + format: integer + example: '569000000000000' + totalFeeATM: + type: string + format: integer + example: '2800000000' BlockchainInfo: allOf: - $ref: '#/components/schemas/BaseResponse' @@ -1034,12 +1026,12 @@ components: genesisAccount: type: string format: hex_bytearray - example: '90001259ec21d31a30898d7' + example: '0x90001259ec21d31a30898d7' genesisBlockId: type: string format: hex_bytearray description: Genesis block ID - example: '15856251679437054149169000' + example: '0x15856251679437054149169000' timestamp: type: integer format: int64 @@ -1073,7 +1065,7 @@ components: nullable: false accountId: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + example: '0x1aa130eb6043151ad6040f16701' description: Account id nullable: false @@ -1085,13 +1077,13 @@ components: AccountInfo: type: object required: - - account + - accountId - publicKey properties: - account: + accountId: type: string format: hex_bytearray - example: '2aa130eb6043151ad6040f16701' + example: '0x2aa130eb6043151ad6040f16701' publicKey: description: The account public key in a hex string format type: string @@ -1100,7 +1092,7 @@ components: parent: type: string format: hex_bytearray - example: '3aa130eb6043151ad6040f16701' + example: '0x3aa130eb6043151ad6040f16701' nullable: true balance: type: string @@ -1120,18 +1112,40 @@ components: - created - verified example: created - assetBalances: - type: array - items: - $ref: '#/components/schemas/AssetBalance' - unconfirmedAssetBalances: - type: array - items: - $ref: '#/components/schemas/AssetBalance' - currencies: - type: array - items: - $ref: '#/components/schemas/Currency' + assetBalancesCount: + type: integer + format: int8 + example: 25 + unconfirmedAssetBalancesCount: + type: integer + format: int8 + example: 25 + currenciesCount: + type: integer + format: int8 + example: 25 + + AccountAssetsResp: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + assets: + description: "List of account assets" + type: array + items: + $ref: '#/components/schemas/AssetBalance' + + AccountCurrenciesResp: + allOf: + - $ref: '#/components/schemas/BaseResponse' + - type: object + properties: + currencies: + description: "List of account currencies" + type: array + items: + $ref: '#/components/schemas/Currency' AssetBalance: type: object @@ -1140,7 +1154,7 @@ components: type: string format: hex_bytearray description: Asset id - example: 'a2e9b946290b48b69985dc2e5a5860a1' + example: '0xa2e9b946290b48b69985dc2e5a5860a1' balance: type: integer format: int64 @@ -1154,11 +1168,11 @@ components: type: string format: hex_bytearray description: Currency id - example: 'a2e9b946290b48b69985dc2e5a5860a1' + example: '0xa2e9b946290b48b69985dc2e5a5860a1' - account: + accountId: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + example: '0x1aa130eb6043151ad6040f16701' balance: type: integer @@ -1200,7 +1214,7 @@ components: example: 0 issuerAccount: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + example: '0x1aa130eb6043151ad6040f16701' X509Response: allOf: @@ -1244,7 +1258,7 @@ components: items: type: string format: hex_bytearray - example: '8330faaeb404178613417' + example: '0x8330faaeb404178613417' ForgersInfoResponse: allOf: @@ -1260,9 +1274,9 @@ components: ForgerInfo: type: object properties: - account: + accountId: type: string - example: 'APL-X5JH-TJKJ-DVGC-5T2V8' + example: '0x1aa130eb6043151ad6040f16701' effectiveBalanceAPL: type: integer format: int64 From 2b50ab4620a347a46f615cbe2793eaaa704a53cd Mon Sep 17 00:00:00 2001 From: Yuriy Larin Date: Tue, 16 May 2023 13:55:06 +0300 Subject: [PATCH 14/15] minor update copyright --- .../com/apollocurrency/aplwallet/api/v2/NotFoundException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apl-api2/src/main/java/com/apollocurrency/aplwallet/api/v2/NotFoundException.java b/apl-api2/src/main/java/com/apollocurrency/aplwallet/api/v2/NotFoundException.java index fb2817309c..db140af329 100644 --- a/apl-api2/src/main/java/com/apollocurrency/aplwallet/api/v2/NotFoundException.java +++ b/apl-api2/src/main/java/com/apollocurrency/aplwallet/api/v2/NotFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020. Apollo Foundation. + * Copyright (c) 2018-2023. Apollo Foundation. */ package com.apollocurrency.aplwallet.api.v2; From e29bec2204e5f49b9df3dfb98b6c6db9adadf0f2 Mon Sep 17 00:00:00 2001 From: Yuriy Larin Date: Tue, 16 May 2023 13:55:51 +0300 Subject: [PATCH 15/15] minor update copyright --- .../com/apollocurrency/aplwallet/api/v3/model/BaseResponse.java | 2 +- .../apollocurrency/aplwallet/api/v3/model/ErrorResponse.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/BaseResponse.java b/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/BaseResponse.java index bb04a31e97..5143084ca8 100644 --- a/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/BaseResponse.java +++ b/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/BaseResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020. Apollo Foundation. + * Copyright (c) 2018-2023. Apollo Foundation. */ package com.apollocurrency.aplwallet.api.v3.model; diff --git a/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/ErrorResponse.java b/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/ErrorResponse.java index c01ac677e1..2c4340f146 100644 --- a/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/ErrorResponse.java +++ b/apl-api3/src/main/java/com/apollocurrency/aplwallet/api/v3/model/ErrorResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020. Apollo Foundation. + * Copyright (c) 2018-2023. Apollo Foundation. */ package com.apollocurrency.aplwallet.api.v3.model;