From 081d0f279e8843d598cc1ff18b33e0b02cd094aa Mon Sep 17 00:00:00 2001 From: semux Date: Sun, 21 Apr 2019 06:40:00 -0400 Subject: [PATCH 1/3] API: format and sort the Swagger JSON specs It's hard to see the diffs between two versions without a semantic JSON diff tool. This commit sorts the JSON file, by using https://codeshack.io/json-sorter/ --- .../org/semux/api/swagger/v1.0.0.json | 2453 ++++---- .../org/semux/api/swagger/v1.0.1.json | 2752 +++++---- .../org/semux/api/swagger/v2.0.0.json | 3098 +++++----- .../org/semux/api/swagger/v2.1.0.json | 4018 ++++++------- .../org/semux/api/swagger/v2.2.0.json | 5120 +++++++++-------- 5 files changed, 8949 insertions(+), 8492 deletions(-) diff --git a/src/main/resources/org/semux/api/swagger/v1.0.0.json b/src/main/resources/org/semux/api/swagger/v1.0.0.json index a8c29f774..41f3ba33e 100644 --- a/src/main/resources/org/semux/api/swagger/v1.0.0.json +++ b/src/main/resources/org/semux/api/swagger/v1.0.0.json @@ -1,1216 +1,1407 @@ { - "swagger" : "2.0", - "info" : { - "description" : "Semux is an experimental high-performance blockchain platform that powers decentralized application.", - "version" : "1.0.0", - "title" : "Semux", - "contact" : { - "name" : "Semux Foundation", - "url" : "https://www.semux.org" - }, - "license" : { - "name" : "MIT License", - "url" : "https://opensource.org/licenses/mit-license.php" - } - }, - "schemes" : [ "http" ], - "paths" : { - "/add_node" : { - "get" : { - "summary" : "Add node", - "description" : "Adds a node to node manager.", - "operationId" : "addNode", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "node", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/AddNodeResponse" + "definitions": { + "AccountType": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "available": { + "type": "integer", + "format": "int64" + }, + "locked": { + "type": "integer", + "format": "int64" + }, + "nonce": { + "type": "integer", + "format": "int64" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/add_to_blacklist" : { - "get" : { - "summary" : "Add to blacklist", - "description" : "Adds an IP address to blacklist.", - "operationId" : "addToBlacklist", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "ip", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" + "AddNodeResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/add_to_whitelist" : { - "get" : { - "summary" : "Add to Whitelist", - "description" : "Adds an IP address to whitelist.", - "operationId" : "addToWhitelist", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "ip", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" + "ApiHandlerResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/create_account" : { - "get" : { - "summary" : "Create account", - "description" : "Creates a new account.", - "operationId" : "createAccount", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/CreateAccountResponse" + "BlockType": { + "type": "object", + "properties": { + "hash": { + "type": "string" + }, + "number": { + "type": "integer", + "format": "int64" + }, + "view": { + "type": "integer", + "format": "int32" + }, + "coinbase": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "date": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "resultsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "data": { + "type": "string" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/delegate" : { - "get" : { - "summary" : "Register delegate", - "description" : "Registers as a delegate", - "operationId" : "registerDelegate", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "from", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "data", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "CreateAccountResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "string" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_account" : { - "get" : { - "summary" : "Get account", - "description" : "Returns an account.", - "operationId" : "getAccount", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountResponse" + "DelegateType": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "name": { + "type": "string" + }, + "registeredAt": { + "type": "integer", + "format": "int64" + }, + "votes": { + "type": "integer", + "format": "int64" + }, + "blocksForged": { + "type": "integer", + "format": "int64" + }, + "turnsHit": { + "type": "integer", + "format": "int64" + }, + "turnsMissed": { + "type": "integer", + "format": "int64" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_account_transactions" : { - "get" : { - "summary" : "Get account transactions", - "description" : "Returns transactions from/to an account.", - "operationId" : "getAccountTransactions", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "from", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountTransactionsResponse" + "DoTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + }, + "result": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_block" : { - "get" : { - "summary" : "Get block", - "description" : "Returns a block.", - "operationId" : "getBlock", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "number", - "in" : "query", - "required" : false, - "type" : "integer", - "format" : "int64" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" + "GetAccountResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/AccountType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_delegate" : { - "get" : { - "summary" : "Get a delegate", - "description" : "Returns a delegate.", - "operationId" : "getDelegate", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegateResponse" + "GetAccountTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_delegates" : { - "get" : { - "summary" : "Get all delegates", - "description" : "Returns a list of delegates.", - "operationId" : "getDelegates", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegatesResponse" + "GetBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/BlockType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_info" : { - "get" : { - "summary" : "Get info", - "description" : "Returns kernel info.", - "operationId" : "getInfo", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetInfoResponse" + "GetDelegateResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/DelegateType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_latest_block" : { - "get" : { - "summary" : "Get latest block", - "description" : "Returns the latest block.", - "operationId" : "getLatestBlock", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockResponse" + "GetDelegatesResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DelegateType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_latest_block_number" : { - "get" : { - "summary" : "Get latest block number", - "description" : "Returns the number of the latest block.", - "operationId" : "getLatestBlockNumber", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockNumberResponse" + "GetInfoResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/InfoType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_peers" : { - "get" : { - "summary" : "Get peers", - "description" : "Returns connected peers.", - "operationId" : "getPeers", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPeersResponse" + "GetLatestBlockNumberResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_pending_transactions" : { - "get" : { - "summary" : "Get pending transactions", - "description" : "Returns all the pending transactions.", - "operationId" : "getPendingTransactions", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPendingTransactionsResponse" + "GetLatestBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/BlockType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_transaction" : { - "get" : { - "summary" : "Get transaction", - "description" : "Returns a transactions if exists.", - "operationId" : "getTransaction", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "hash", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionResponse" + "GetPeersResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PeerType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_transaction_limits" : { - "get" : { - "summary" : "Get transaction limits", - "description" : "Get minimum fee and maximum size.", - "operationId" : "getTransactionLimits", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "type", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionLimitsResponse" + "GetPendingTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_validators" : { - "get" : { - "summary" : "Get valididators", - "description" : "Returns a list of validators.", - "operationId" : "getValidators", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetValidatorsResponse" + "GetTransactionLimitsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/TransactionLimitsType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_vote" : { - "get" : { - "summary" : "Get vote", - "description" : "Returns the vote from a voter to a delegate.", - "operationId" : "getVote", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "delegate", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "voter", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVoteResponse" + "GetTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/TransactionType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_votes" : { - "get" : { - "summary" : "Get votes", - "description" : "Returns all the votes to a delegate", - "operationId" : "getVotes", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "delegate", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVotesResponse" + "GetValidatorsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "type": "string" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/list_accounts" : { - "get" : { - "summary" : "List accounts", - "description" : "Returns accounts in the wallet.", - "operationId" : "listAccounts", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ListAccountsResponse" + "GetVoteResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/send_transaction" : { - "get" : { - "summary" : "Send a raw transaction", - "description" : "Broadcasts a raw transaction to the network.", - "operationId" : "sendTransaction", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "raw", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SendTransactionResponse" + "GetVotesResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/transfer" : { - "get" : { - "summary" : "Transfer coins", - "description" : "Transfers coins to another address.", - "operationId" : "transfer", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "value", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "from", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "data", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "InfoType": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "coinbase": { + "type": "string" + }, + "latestBlockNumber": { + "type": "integer", + "format": "int64" + }, + "latestBlockHash": { + "type": "string" + }, + "activePeers": { + "type": "integer", + "format": "int32" + }, + "pendingTransactions": { + "type": "integer", + "format": "int32" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/unvote" : { - "get" : { - "summary" : "Unvote", - "description" : "Unvotes for a delegate.", - "operationId" : "unvote", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "from", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "value", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "ListAccountsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "type": "string" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/vote" : { - "get" : { - "summary" : "Vote", - "description" : "Votes for a delegate.", - "operationId" : "vote", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "from", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "value", - "in" : "query", - "required" : false, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "PeerType": { + "type": "object", + "properties": { + "ip": { + "type": "string" + }, + "port": { + "type": "integer", + "format": "int32" + }, + "networkVersion": { + "type": "integer", + "format": "int32" + }, + "clientId": { + "type": "string" + }, + "peerId": { + "type": "string" + }, + "latestBlockNumber": { + "type": "integer", + "format": "int64" + }, + "latency": { + "type": "integer", + "format": "int64" + }, + "capabilities": { + "type": "array", + "items": { + "type": "string" + } + } } - } - }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - } - }, - "securityDefinitions" : { - "basicAuth" : { - "type" : "basic" - } - }, - "definitions" : { - "AccountType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "available" : { - "type" : "integer", - "format" : "int64" - }, - "locked" : { - "type" : "integer", - "format" : "int64" - }, - "nonce" : { - "type" : "integer", - "format" : "int64" - } - } - }, - "AddNodeResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "ApiHandlerResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "BlockType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string" - }, - "number" : { - "type" : "integer", - "format" : "int64" - }, - "view" : { - "type" : "integer", - "format" : "int32" - }, - "coinbase" : { - "type" : "string" - }, - "parentHash" : { - "type" : "string" - }, - "timestamp" : { - "type" : "integer", - "format" : "int64" - }, - "date" : { - "type" : "string" - }, - "transactionsRoot" : { - "type" : "string" - }, - "resultsRoot" : { - "type" : "string" - }, - "stateRoot" : { - "type" : "string" - }, - "data" : { - "type" : "string" - }, - "transactions" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - } - } - }, - "CreateAccountResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "string" - }, - "message" : { - "type" : "string" - } - } - }, - "DelegateType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "registeredAt" : { - "type" : "integer", - "format" : "int64" - }, - "votes" : { - "type" : "integer", - "format" : "int64" - }, - "blocksForged" : { - "type" : "integer", - "format" : "int64" - }, - "turnsHit" : { - "type" : "integer", - "format" : "int64" - }, - "turnsMissed" : { - "type" : "integer", - "format" : "int64" - } - } - }, - "DoTransactionResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - }, - "result" : { - "type" : "string" - } - } - }, - "GetAccountResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/AccountType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetAccountTransactionsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - }, - "message" : { - "type" : "string" - } - } - }, - "GetBlockResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/BlockType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetDelegateResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" }, - "result" : { - "$ref" : "#/definitions/DelegateType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetDelegatesResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DelegateType" - } - }, - "message" : { - "type" : "string" - } - } - }, - "GetInfoResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/InfoType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetLatestBlockNumberResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "integer", - "format" : "int64" - }, - "message" : { - "type" : "string" - } - } - }, - "GetLatestBlockResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/BlockType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetPeersResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "SendTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } + } }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PeerType" - } + "TransactionLimitsType": { + "type": "object", + "properties": { + "maxTransactionDataSize": { + "type": "integer", + "format": "int32" + }, + "minTransactionFee": { + "type": "integer", + "format": "int64" + }, + "minDelegateBurnAmount": { + "type": "integer", + "format": "int64" + } + } }, - "message" : { - "type" : "string" + "TransactionType": { + "type": "object", + "properties": { + "hash": { + "type": "string" + }, + "type": { + "type": "string" + }, + "from": { + "type": "string" + }, + "to": { + "type": "string" + }, + "value": { + "type": "integer", + "format": "int64" + }, + "fee": { + "type": "integer", + "format": "int64" + }, + "nonce": { + "type": "integer", + "format": "int64" + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "data": { + "type": "string" + } + } } - } }, - "GetPendingTransactionsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - }, - "message" : { - "type" : "string" + "info": { + "description": "Semux is an experimental high-performance blockchain platform that powers decentralized application.", + "version": "1.0.0", + "title": "Semux", + "contact": { + "name": "Semux Foundation", + "url": "https://www.semux.org" + }, + "license": { + "name": "MIT License", + "url": "https://opensource.org/licenses/mit-license.php" } - } }, - "GetTransactionLimitsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/TransactionLimitsType" + "paths": { + "/add_node": { + "get": { + "summary": "Add node", + "description": "Adds a node to node manager.", + "operationId": "addNode", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "node", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/AddNodeResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetTransactionResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/add_to_blacklist": { + "get": { + "summary": "Add to blacklist", + "description": "Adds an IP address to blacklist.", + "operationId": "addToBlacklist", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "$ref" : "#/definitions/TransactionType" + "/add_to_whitelist": { + "get": { + "summary": "Add to Whitelist", + "description": "Adds an IP address to whitelist.", + "operationId": "addToWhitelist", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetValidatorsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/create_account": { + "get": { + "summary": "Create account", + "description": "Creates a new account.", + "operationId": "createAccount", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "array", - "items" : { - "type" : "string" - } + "/delegate": { + "get": { + "summary": "Register delegate", + "description": "Registers as a delegate", + "operationId": "registerDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "data", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetVoteResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/get_account": { + "get": { + "summary": "Get account", + "description": "Returns an account.", + "operationId": "getAccount", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "integer", - "format" : "int64" + "/get_account_transactions": { + "get": { + "summary": "Get account transactions", + "description": "Returns transactions from/to an account.", + "operationId": "getAccountTransactions", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "from", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "to", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountTransactionsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetVotesResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/get_block": { + "get": { + "summary": "Get block", + "description": "Returns a block.", + "operationId": "getBlock", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "number", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "object", - "additionalProperties" : { - "type" : "integer", - "format" : "int64" - } + "/get_delegate": { + "get": { + "summary": "Get a delegate", + "description": "Returns a delegate.", + "operationId": "getDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegateResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "InfoType" : { - "type" : "object", - "properties" : { - "clientId" : { - "type" : "string" + "/get_delegates": { + "get": { + "summary": "Get all delegates", + "description": "Returns a list of delegates.", + "operationId": "getDelegates", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegatesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "coinbase" : { - "type" : "string" + "/get_info": { + "get": { + "summary": "Get info", + "description": "Returns kernel info.", + "operationId": "getInfo", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetInfoResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latestBlockNumber" : { - "type" : "integer", - "format" : "int64" + "/get_latest_block": { + "get": { + "summary": "Get latest block", + "description": "Returns the latest block.", + "operationId": "getLatestBlock", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latestBlockHash" : { - "type" : "string" + "/get_latest_block_number": { + "get": { + "summary": "Get latest block number", + "description": "Returns the number of the latest block.", + "operationId": "getLatestBlockNumber", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockNumberResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "activePeers" : { - "type" : "integer", - "format" : "int32" + "/get_peers": { + "get": { + "summary": "Get peers", + "description": "Returns connected peers.", + "operationId": "getPeers", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPeersResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "pendingTransactions" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "ListAccountsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/get_pending_transactions": { + "get": { + "summary": "Get pending transactions", + "description": "Returns all the pending transactions.", + "operationId": "getPendingTransactions", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPendingTransactionsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "array", - "items" : { - "type" : "string" - } + "/get_transaction": { + "get": { + "summary": "Get transaction", + "description": "Returns a transactions if exists.", + "operationId": "getTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "PeerType" : { - "type" : "object", - "properties" : { - "ip" : { - "type" : "string" + "/get_transaction_limits": { + "get": { + "summary": "Get transaction limits", + "description": "Get minimum fee and maximum size.", + "operationId": "getTransactionLimits", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "type", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionLimitsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "port" : { - "type" : "integer", - "format" : "int32" + "/get_validators": { + "get": { + "summary": "Get valididators", + "description": "Returns a list of validators.", + "operationId": "getValidators", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetValidatorsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "networkVersion" : { - "type" : "integer", - "format" : "int32" + "/get_vote": { + "get": { + "summary": "Get vote", + "description": "Returns the vote from a voter to a delegate.", + "operationId": "getVote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "voter", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVoteResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "clientId" : { - "type" : "string" + "/get_votes": { + "get": { + "summary": "Get votes", + "description": "Returns all the votes to a delegate", + "operationId": "getVotes", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVotesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "peerId" : { - "type" : "string" + "/list_accounts": { + "get": { + "summary": "List accounts", + "description": "Returns accounts in the wallet.", + "operationId": "listAccounts", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ListAccountsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latestBlockNumber" : { - "type" : "integer", - "format" : "int64" + "/send_transaction": { + "get": { + "summary": "Send a raw transaction", + "description": "Broadcasts a raw transaction to the network.", + "operationId": "sendTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SendTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latency" : { - "type" : "integer", - "format" : "int64" + "/transfer": { + "get": { + "summary": "Transfer coins", + "description": "Transfers coins to another address.", + "operationId": "transfer", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "from", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "to", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "data", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - } - }, - "SendTransactionResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/unvote": { + "get": { + "summary": "Unvote", + "description": "Unvotes for a delegate.", + "operationId": "unvote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "to", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" + "/vote": { + "get": { + "summary": "Vote", + "description": "Votes for a delegate.", + "operationId": "vote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "to", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } } - } }, - "TransactionLimitsType" : { - "type" : "object", - "properties" : { - "maxTransactionDataSize" : { - "type" : "integer", - "format" : "int32" - }, - "minTransactionFee" : { - "type" : "integer", - "format" : "int64" - }, - "minDelegateBurnAmount" : { - "type" : "integer", - "format" : "int64" + "schemes": [ + "http" + ], + "securityDefinitions": { + "basicAuth": { + "type": "basic" } - } }, - "TransactionType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string" - }, - "type" : { - "type" : "string" - }, - "from" : { - "type" : "string" - }, - "to" : { - "type" : "string" - }, - "value" : { - "type" : "integer", - "format" : "int64" - }, - "fee" : { - "type" : "integer", - "format" : "int64" - }, - "nonce" : { - "type" : "integer", - "format" : "int64" - }, - "timestamp" : { - "type" : "integer", - "format" : "int64" - }, - "data" : { - "type" : "string" - } - } - } - } -} \ No newline at end of file + "swagger": "2.0" +} diff --git a/src/main/resources/org/semux/api/swagger/v1.0.1.json b/src/main/resources/org/semux/api/swagger/v1.0.1.json index 7eb9f9215..f495d0d5e 100644 --- a/src/main/resources/org/semux/api/swagger/v1.0.1.json +++ b/src/main/resources/org/semux/api/swagger/v1.0.1.json @@ -1,1361 +1,1573 @@ { - "swagger" : "2.0", - "info" : { - "description" : "Semux is an experimental high-performance blockchain platform that powers decentralized application.", - "version" : "1.0.1", - "title" : "Semux", - "contact" : { - "name" : "Semux Foundation", - "url" : "https://www.semux.org" - }, - "license" : { - "name" : "MIT License", - "url" : "https://opensource.org/licenses/mit-license.php" - } - }, - "schemes" : [ "http" ], - "paths" : { - "/add_node" : { - "get" : { - "summary" : "Add node", - "description" : "Adds a node to node manager.", - "operationId" : "addNode", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "node", - "in" : "query", - "description" : "Name of the node in host:port format", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/AddNodeResponse" + "definitions": { + "AccountType": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "available": { + "type": "integer", + "format": "int64" + }, + "locked": { + "type": "integer", + "format": "int64" + }, + "nonce": { + "type": "integer", + "format": "int64" + }, + "transactionCount": { + "type": "integer", + "format": "int32" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/add_to_blacklist" : { - "get" : { - "summary" : "Add to blacklist", - "description" : "Adds an IP address to blacklist.", - "operationId" : "addToBlacklist", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" + "AddNodeResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/add_to_whitelist" : { - "get" : { - "summary" : "Add to whitelist", - "description" : "Adds an IP address to whitelist.", - "operationId" : "addToWhitelist", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" + "ApiHandlerResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/create_account" : { - "get" : { - "summary" : "Create account", - "description" : "Creates a new account.", - "operationId" : "createAccount", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "name", - "in" : "query", - "description" : "Assigned alias to the created account.", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/CreateAccountResponse" + "BlockType": { + "type": "object", + "properties": { + "hash": { + "type": "string" + }, + "number": { + "type": "integer", + "format": "int64" + }, + "view": { + "type": "integer", + "format": "int32" + }, + "coinbase": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "date": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "resultsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "data": { + "type": "string" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/delegate" : { - "get" : { - "summary" : "Register delegate", - "description" : "Registers as a delegate", - "operationId" : "registerDelegate", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "from", - "in" : "query", - "description" : "Registering address", - "required" : true, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string" - }, { - "name" : "data", - "in" : "query", - "description" : "Delegate name", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "CreateAccountResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "string" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_account" : { - "get" : { - "summary" : "Get account", - "description" : "Returns an account.", - "operationId" : "getAccount", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountResponse" + "DelegateType": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "name": { + "type": "string" + }, + "registeredAt": { + "type": "integer", + "format": "int64" + }, + "votes": { + "type": "integer", + "format": "int64" + }, + "blocksForged": { + "type": "integer", + "format": "int64" + }, + "turnsHit": { + "type": "integer", + "format": "int64" + }, + "turnsMissed": { + "type": "integer", + "format": "int64" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_account_transactions" : { - "get" : { - "summary" : "Get account transactions", - "description" : "Returns transactions from/to an account.", - "operationId" : "getAccountTransactions", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string" - }, { - "name" : "from", - "in" : "query", - "description" : "Starting range of transactions", - "required" : true, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "description" : "Ending range of transactions", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountTransactionsResponse" + "DoTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + }, + "result": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_block" : { - "get" : { - "summary" : "Get block", - "description" : "Returns a block.", - "operationId" : "getBlock", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "hash", - "in" : "query", - "description" : "Hash of block", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" + "GetAccountResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/AccountType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_delegate" : { - "get" : { - "summary" : "Get a delegate", - "description" : "Returns a delegate.", - "operationId" : "getDelegate", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegateResponse" + "GetAccountTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_delegates" : { - "get" : { - "summary" : "Get all delegates", - "description" : "Returns a list of delegates.", - "operationId" : "getDelegates", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegatesResponse" + "GetBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/BlockType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_info" : { - "get" : { - "summary" : "Get info", - "description" : "Returns kernel info.", - "operationId" : "getInfo", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetInfoResponse" + "GetDelegateResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/DelegateType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_latest_block" : { - "get" : { - "summary" : "Get latest block", - "description" : "Returns the latest block.", - "operationId" : "getLatestBlock", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockResponse" + "GetDelegatesResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DelegateType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_latest_block_number" : { - "get" : { - "summary" : "Get latest block number", - "description" : "Returns the number of the latest block.", - "operationId" : "getLatestBlockNumber", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockNumberResponse" + "GetInfoResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/InfoType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_peers" : { - "get" : { - "summary" : "Get peers", - "description" : "Returns connected peers.", - "operationId" : "getPeers", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPeersResponse" + "GetLatestBlockNumberResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_pending_transactions" : { - "get" : { - "summary" : "Get pending transactions", - "description" : "Returns all the pending transactions.", - "operationId" : "getPendingTransactions", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPendingTransactionsResponse" + "GetLatestBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/BlockType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_transaction" : { - "get" : { - "summary" : "Get transaction", - "description" : "Returns a transactions if exists.", - "operationId" : "getTransaction", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "hash", - "in" : "query", - "description" : "Transaction hash", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionResponse" + "GetPeersResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PeerType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_transaction_limits" : { - "get" : { - "summary" : "Get transaction limits", - "description" : "Get minimum fee and maximum size.", - "operationId" : "getTransactionLimits", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "type", - "in" : "query", - "description" : "Type of transaction", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionLimitsResponse" + "GetPendingTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_validators" : { - "get" : { - "summary" : "Get validators", - "description" : "Returns a list of validators.", - "operationId" : "getValidators", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetValidatorsResponse" + "GetTransactionLimitsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/TransactionLimitsType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_vote" : { - "get" : { - "summary" : "Get vote", - "description" : "Returns the vote from a voter to a delegate.", - "operationId" : "getVote", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - }, { - "name" : "voter", - "in" : "query", - "description" : "Voter address", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVoteResponse" + "GetTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "$ref": "#/definitions/TransactionType" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/get_votes" : { - "get" : { - "summary" : "Get votes", - "description" : "Returns all the votes to a delegate", - "operationId" : "getVotes", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVotesResponse" + "GetValidatorsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "type": "string" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/list_accounts" : { - "get" : { - "summary" : "List accounts", - "description" : "Returns accounts in the wallet.", - "operationId" : "listAccounts", - "produces" : [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ListAccountsResponse" + "GetVoteResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/send_transaction" : { - "get" : { - "summary" : "Send a raw transaction", - "description" : "Broadcasts a raw transaction to the network.", - "operationId" : "sendTransaction", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "raw", - "in" : "query", - "description" : "Raw transaction", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SendTransactionResponse" + "GetVotesResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/sign_message" : { - "get" : { - "summary" : "Sign a message", - "description" : "Sign a message.", - "operationId" : "signMessage", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "description" : "Signing address", - "required" : true, - "type" : "string" - }, { - "name" : "message", - "in" : "query", - "description" : "Message to sign", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignMessageResponse" + "InfoType": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "coinbase": { + "type": "string" + }, + "latestBlockNumber": { + "type": "integer", + "format": "int64" + }, + "latestBlockHash": { + "type": "string" + }, + "activePeers": { + "type": "integer", + "format": "int32" + }, + "pendingTransactions": { + "type": "integer", + "format": "int32" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/transfer" : { - "get" : { - "summary" : "Transfer coins", - "description" : "Transfers coins to another address.", - "operationId" : "transfer", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "value", - "in" : "query", - "description" : "Amount of SEM to transfer", - "required" : true, - "type" : "string" - }, { - "name" : "from", - "in" : "query", - "description" : "Sending address", - "required" : true, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "description" : "Receiving address", - "required" : true, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string" - }, { - "name" : "data", - "in" : "query", - "description" : "Transaction data", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "ListAccountsResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "array", + "items": { + "type": "string" + } + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/unvote" : { - "get" : { - "summary" : "Unvote", - "description" : "Unvotes for a delegate.", - "operationId" : "unvote", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "from", - "in" : "query", - "description" : "Voting address", - "required" : true, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - }, { - "name" : "value", - "in" : "query", - "description" : "Vote amount", - "required" : true, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "PeerType": { + "type": "object", + "properties": { + "ip": { + "type": "string" + }, + "port": { + "type": "integer", + "format": "int32" + }, + "networkVersion": { + "type": "integer", + "format": "int32" + }, + "clientId": { + "type": "string" + }, + "peerId": { + "type": "string" + }, + "latestBlockNumber": { + "type": "integer", + "format": "int64" + }, + "latency": { + "type": "integer", + "format": "int64" + }, + "capabilities": { + "type": "array", + "items": { + "type": "string" + } + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/verify_message" : { - "get" : { - "summary" : "Verify a message", - "description" : "Verify a signed message.", - "operationId" : "verifyMessage", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "address", - "in" : "query", - "description" : "Address", - "required" : true, - "type" : "string" - }, { - "name" : "message", - "in" : "query", - "description" : "Message", - "required" : true, - "type" : "string" - }, { - "name" : "signature", - "in" : "query", - "description" : "Signature to verify", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/VerifyMessageResponse" + "SendTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } } - } }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - }, - "/vote" : { - "get" : { - "summary" : "Vote", - "description" : "Votes for a delegate.", - "operationId" : "vote", - "produces" : [ "application/json" ], - "parameters" : [ { - "name" : "from", - "in" : "query", - "description" : "Voting address", - "required" : true, - "type" : "string" - }, { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - }, { - "name" : "value", - "in" : "query", - "description" : "Vote amount", - "required" : true, - "type" : "string" - }, { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "SignMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "string" + }, + "message": { + "type": "string" + } } - } - }, - "security" : [ { - "basicAuth" : [ ] - } ] - } - } - }, - "securityDefinitions" : { - "basicAuth" : { - "type" : "basic" - } - }, - "definitions" : { - "AccountType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "available" : { - "type" : "integer", - "format" : "int64" - }, - "locked" : { - "type" : "integer", - "format" : "int64" - }, - "nonce" : { - "type" : "integer", - "format" : "int64" - }, - "transactionCount" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "AddNodeResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "ApiHandlerResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "BlockType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string" - }, - "number" : { - "type" : "integer", - "format" : "int64" - }, - "view" : { - "type" : "integer", - "format" : "int32" }, - "coinbase" : { - "type" : "string" - }, - "parentHash" : { - "type" : "string" - }, - "timestamp" : { - "type" : "integer", - "format" : "int64" - }, - "date" : { - "type" : "string" - }, - "transactionsRoot" : { - "type" : "string" - }, - "resultsRoot" : { - "type" : "string" - }, - "stateRoot" : { - "type" : "string" - }, - "data" : { - "type" : "string" - }, - "transactions" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - } - } - }, - "CreateAccountResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "string" - }, - "message" : { - "type" : "string" - } - } - }, - "DelegateType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "registeredAt" : { - "type" : "integer", - "format" : "int64" - }, - "votes" : { - "type" : "integer", - "format" : "int64" - }, - "blocksForged" : { - "type" : "integer", - "format" : "int64" - }, - "turnsHit" : { - "type" : "integer", - "format" : "int64" - }, - "turnsMissed" : { - "type" : "integer", - "format" : "int64" - } - } - }, - "DoTransactionResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - }, - "result" : { - "type" : "string" - } - } - }, - "GetAccountResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/AccountType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetAccountTransactionsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - }, - "message" : { - "type" : "string" - } - } - }, - "GetBlockResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/BlockType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetDelegateResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/DelegateType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetDelegatesResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DelegateType" - } - }, - "message" : { - "type" : "string" - } - } - }, - "GetInfoResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/InfoType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetLatestBlockNumberResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "integer", - "format" : "int64" - }, - "message" : { - "type" : "string" - } - } - }, - "GetLatestBlockResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/BlockType" - }, - "message" : { - "type" : "string" - } - } - }, - "GetPeersResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PeerType" - } - }, - "message" : { - "type" : "string" - } - } - }, - "GetPendingTransactionsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "TransactionLimitsType": { + "type": "object", + "properties": { + "maxTransactionDataSize": { + "type": "integer", + "format": "int32" + }, + "minTransactionFee": { + "type": "integer", + "format": "int64" + }, + "minDelegateBurnAmount": { + "type": "integer", + "format": "int64" + } + } }, - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } + "TransactionType": { + "type": "object", + "properties": { + "blockNumber": { + "type": "integer", + "format": "int64" + }, + "hash": { + "type": "string" + }, + "type": { + "type": "string" + }, + "from": { + "type": "string" + }, + "to": { + "type": "string" + }, + "value": { + "type": "integer", + "format": "int64" + }, + "fee": { + "type": "integer", + "format": "int64" + }, + "nonce": { + "type": "integer", + "format": "int64" + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "data": { + "type": "string" + } + } }, - "message" : { - "type" : "string" + "VerifyMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "boolean" + }, + "message": { + "type": "string" + } + } } - } }, - "GetTransactionLimitsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/TransactionLimitsType" - }, - "message" : { - "type" : "string" + "info": { + "description": "Semux is an experimental high-performance blockchain platform that powers decentralized application.", + "version": "1.0.1", + "title": "Semux", + "contact": { + "name": "Semux Foundation", + "url": "https://www.semux.org" + }, + "license": { + "name": "MIT License", + "url": "https://opensource.org/licenses/mit-license.php" } - } }, - "GetTransactionResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "$ref" : "#/definitions/TransactionType" + "paths": { + "/add_node": { + "get": { + "summary": "Add node", + "description": "Adds a node to node manager.", + "operationId": "addNode", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "node", + "in": "query", + "description": "Name of the node in host:port format", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/AddNodeResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetValidatorsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/add_to_blacklist": { + "get": { + "summary": "Add to blacklist", + "description": "Adds an IP address to blacklist.", + "operationId": "addToBlacklist", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "array", - "items" : { - "type" : "string" - } + "/add_to_whitelist": { + "get": { + "summary": "Add to whitelist", + "description": "Adds an IP address to whitelist.", + "operationId": "addToWhitelist", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetVoteResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/create_account": { + "get": { + "summary": "Create account", + "description": "Creates a new account.", + "operationId": "createAccount", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "description": "Assigned alias to the created account.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "integer", - "format" : "int64" + "/delegate": { + "get": { + "summary": "Register delegate", + "description": "Registers as a delegate", + "operationId": "registerDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Registering address", + "required": true, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string" + }, + { + "name": "data", + "in": "query", + "description": "Delegate name", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "GetVotesResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/get_account": { + "get": { + "summary": "Get account", + "description": "Returns an account.", + "operationId": "getAccount", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "object", - "additionalProperties" : { - "type" : "integer", - "format" : "int64" - } + "/get_account_transactions": { + "get": { + "summary": "Get account transactions", + "description": "Returns transactions from/to an account.", + "operationId": "getAccountTransactions", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string" + }, + { + "name": "from", + "in": "query", + "description": "Starting range of transactions", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Ending range of transactions", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountTransactionsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "InfoType" : { - "type" : "object", - "properties" : { - "clientId" : { - "type" : "string" + "/get_block": { + "get": { + "summary": "Get block", + "description": "Returns a block.", + "operationId": "getBlock", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "description": "Hash of block", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "coinbase" : { - "type" : "string" + "/get_delegate": { + "get": { + "summary": "Get a delegate", + "description": "Returns a delegate.", + "operationId": "getDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegateResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latestBlockNumber" : { - "type" : "integer", - "format" : "int64" + "/get_delegates": { + "get": { + "summary": "Get all delegates", + "description": "Returns a list of delegates.", + "operationId": "getDelegates", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegatesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latestBlockHash" : { - "type" : "string" + "/get_info": { + "get": { + "summary": "Get info", + "description": "Returns kernel info.", + "operationId": "getInfo", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetInfoResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "activePeers" : { - "type" : "integer", - "format" : "int32" + "/get_latest_block": { + "get": { + "summary": "Get latest block", + "description": "Returns the latest block.", + "operationId": "getLatestBlock", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "pendingTransactions" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "ListAccountsResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/get_latest_block_number": { + "get": { + "summary": "Get latest block number", + "description": "Returns the number of the latest block.", + "operationId": "getLatestBlockNumber", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockNumberResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "array", - "items" : { - "type" : "string" - } + "/get_peers": { + "get": { + "summary": "Get peers", + "description": "Returns connected peers.", + "operationId": "getPeers", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPeersResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "PeerType" : { - "type" : "object", - "properties" : { - "ip" : { - "type" : "string" + "/get_pending_transactions": { + "get": { + "summary": "Get pending transactions", + "description": "Returns all the pending transactions.", + "operationId": "getPendingTransactions", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPendingTransactionsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "port" : { - "type" : "integer", - "format" : "int32" + "/get_transaction": { + "get": { + "summary": "Get transaction", + "description": "Returns a transactions if exists.", + "operationId": "getTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "description": "Transaction hash", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "networkVersion" : { - "type" : "integer", - "format" : "int32" + "/get_transaction_limits": { + "get": { + "summary": "Get transaction limits", + "description": "Get minimum fee and maximum size.", + "operationId": "getTransactionLimits", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "type", + "in": "query", + "description": "Type of transaction", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionLimitsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "clientId" : { - "type" : "string" + "/get_validators": { + "get": { + "summary": "Get validators", + "description": "Returns a list of validators.", + "operationId": "getValidators", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetValidatorsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "peerId" : { - "type" : "string" + "/get_vote": { + "get": { + "summary": "Get vote", + "description": "Returns the vote from a voter to a delegate.", + "operationId": "getVote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + }, + { + "name": "voter", + "in": "query", + "description": "Voter address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVoteResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latestBlockNumber" : { - "type" : "integer", - "format" : "int64" + "/get_votes": { + "get": { + "summary": "Get votes", + "description": "Returns all the votes to a delegate", + "operationId": "getVotes", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVotesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "latency" : { - "type" : "integer", - "format" : "int64" + "/list_accounts": { + "get": { + "summary": "List accounts", + "description": "Returns accounts in the wallet.", + "operationId": "listAccounts", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ListAccountsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - } - }, - "SendTransactionResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/send_transaction": { + "get": { + "summary": "Send a raw transaction", + "description": "Broadcasts a raw transaction to the network.", + "operationId": "sendTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Raw transaction", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SendTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "SignMessageResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" + "/sign_message": { + "get": { + "summary": "Sign a message", + "description": "Sign a message.", + "operationId": "signMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Signing address", + "required": true, + "type": "string" + }, + { + "name": "message", + "in": "query", + "description": "Message to sign", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignMessageResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "result" : { - "type" : "string" + "/transfer": { + "get": { + "summary": "Transfer coins", + "description": "Transfers coins to another address.", + "operationId": "transfer", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "value", + "in": "query", + "description": "Amount of SEM to transfer", + "required": true, + "type": "string" + }, + { + "name": "from", + "in": "query", + "description": "Sending address", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Receiving address", + "required": true, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string" + }, + { + "name": "data", + "in": "query", + "description": "Transaction data", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "message" : { - "type" : "string" - } - } - }, - "TransactionLimitsType" : { - "type" : "object", - "properties" : { - "maxTransactionDataSize" : { - "type" : "integer", - "format" : "int32" + "/unvote": { + "get": { + "summary": "Unvote", + "description": "Unvotes for a delegate.", + "operationId": "unvote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voting address", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + }, + { + "name": "value", + "in": "query", + "description": "Vote amount", + "required": true, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "minTransactionFee" : { - "type" : "integer", - "format" : "int64" + "/verify_message": { + "get": { + "summary": "Verify a message", + "description": "Verify a signed message.", + "operationId": "verifyMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address", + "required": true, + "type": "string" + }, + { + "name": "message", + "in": "query", + "description": "Message", + "required": true, + "type": "string" + }, + { + "name": "signature", + "in": "query", + "description": "Signature to verify", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VerifyMessageResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "minDelegateBurnAmount" : { - "type" : "integer", - "format" : "int64" + "/vote": { + "get": { + "summary": "Vote", + "description": "Votes for a delegate.", + "operationId": "vote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voting address", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + }, + { + "name": "value", + "in": "query", + "description": "Vote amount", + "required": true, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + } } - } }, - "TransactionType" : { - "type" : "object", - "properties" : { - "blockNumber" : { - "type" : "integer", - "format" : "int64" - }, - "hash" : { - "type" : "string" - }, - "type" : { - "type" : "string" - }, - "from" : { - "type" : "string" - }, - "to" : { - "type" : "string" - }, - "value" : { - "type" : "integer", - "format" : "int64" - }, - "fee" : { - "type" : "integer", - "format" : "int64" - }, - "nonce" : { - "type" : "integer", - "format" : "int64" - }, - "timestamp" : { - "type" : "integer", - "format" : "int64" - }, - "data" : { - "type" : "string" + "schemes": [ + "http" + ], + "securityDefinitions": { + "basicAuth": { + "type": "basic" } - } }, - "VerifyMessageResponse" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "result" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - } - } -} \ No newline at end of file + "swagger": "2.0" +} diff --git a/src/main/resources/org/semux/api/swagger/v2.0.0.json b/src/main/resources/org/semux/api/swagger/v2.0.0.json index 8dbe6267b..e69ee3139 100644 --- a/src/main/resources/org/semux/api/swagger/v2.0.0.json +++ b/src/main/resources/org/semux/api/swagger/v2.0.0.json @@ -1,1928 +1,1930 @@ { - "swagger" : "2.0", - "info" : { - "description" : "Semux is an experimental high-performance blockchain platform that powers decentralized application.", - "version" : "2.0.0", - "title" : "Semux API", - "contact" : { - "name" : "Semux Foundation", - "url" : "https://www.semux.org" - }, - "license" : { - "name" : "MIT License", - "url" : "https://opensource.org/licenses/mit-license.php" - } - }, - "schemes" : [ - "http" - ], - "consumes" : [ + "basePath": "/v2.0.0", + "consumes": [ "application/x-www-form-urlencoded" ], - "produces" : [ - "application/json" - ], - "basePath" : "/v2.0.0", - "securityDefinitions" : { - "basicAuth" : { - "type" : "basic" - } - }, - "security" : [ - {"basicAuth": []} - ], - "paths" : { - "/node" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Add node", - "description" : "Adds a node to node manager.", - "operationId" : "addNode", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "node", - "in" : "query", - "description" : "Name of the node in host:port format", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/AddNodeResponse" - } - } + "definitions": { + "ApiHandlerResponse": { + "type": "object", + "discriminator": "ApiHandlerResponse", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "message": { + "type": "string" + } } }, - "/blacklist" : { - "put" : { - "tags": [ - "semux" - ], - "summary" : "Add to blacklist", - "description" : "Adds an IP address to blacklist.", - "operationId" : "addToBlacklist", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "GetRootResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "AccountType": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "available": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "locked": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "transactionCount": { + "type": "integer", + "format": "int32" + } } }, - "/whitelist" : { - "put" : { - "tags": [ - "semux" - ], - "summary" : "Add to whitelist", - "description" : "Adds an IP address to whitelist.", - "operationId" : "addToWhitelist", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" - } - } + "AddNodeResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "BlockType": { + "type": "object", + "properties": { + "hash": { + "type": "string" }, - "security" : [ - { - "basicAuth" : [ ] + "number": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "view": { + "type": "integer", + "format": "int32" + }, + "coinbase": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "date": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "resultsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "data": { + "type": "string" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" } - ] + } } }, - "/account" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account", - "description" : "Returns an account.", - "operationId" : "getAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountResponse" - } - } + "CreateAccountResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - }, - "post" : { - "tags": [ - "semux" - ], - "summary" : "Create account", - "description" : "Creates a new account.", - "operationId" : "createAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "name", - "in" : "query", - "description" : "Assigned alias to the created account.", - "required" : false, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/CreateAccountResponse" + { + "properties": { + "result": { + "type": "string" } } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + } + ] + }, + "DelegateType": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "name": { + "type": "string" + }, + "registeredAt": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "votes": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "blocksForged": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "turnsHit": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "turnsMissed": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } }, - "/delegate" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get a delegate", - "description" : "Returns a delegate.", - "operationId" : "getDelegate", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegateResponse" + "DoTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string" } } + } + ] + }, + "GetAccountResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/AccountType" + } } - ] - } + } + ] }, - "/account/transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account transactions", - "description" : "Returns transactions from/to an account.", - "operationId" : "getAccountTransactions", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string" - }, - { - "name" : "from", - "in" : "query", - "description" : "Starting range of transactions", - "required" : true, - "type" : "string" - }, - { - "name" : "to", - "in" : "query", - "description" : "Ending range of transactions", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountTransactionsResponse" + "GetAccountTransactionsResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } } } + } + ] + }, + "GetBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/BlockType" + } } - ] - } + } + ] }, - "/block-by-hash" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get block by hash", - "description" : "Returns a block by block hash.", - "operationId" : "getBlockByHash", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "hash", - "in" : "query", - "description" : "Hash of block", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" + "GetDelegateResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/DelegateType" } } + } + ] + }, + "GetDelegatesResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DelegateType" + } + } } - ] - } + } + ] }, - "/block-by-number" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get block by number", - "description" : "Returns a block by block number.", - "operationId" : "getBlockByNumber", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "number", - "in" : "query", - "description" : "Number of block", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" + "GetInfoResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/InfoType" } } + } + ] + }, + "GetLatestBlockNumberResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } - ] - } + } + ] }, - "/delegates" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get all delegates", - "description" : "Returns a list of delegates.", - "operationId" : "getDelegates", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegatesResponse" + "GetLatestBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/BlockType" } } + } + ] + }, + "GetPeersResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PeerType" + } + } } - ] - } + } + ] }, - "/info" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get info", - "description" : "Returns kernel info.", - "operationId" : "getInfo", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetInfoResponse" + "GetPendingTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } } } + } + ] + }, + "GetTransactionLimitsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionLimitsType" + } } - ] - } + } + ] }, - "/latest-block" : { - "get" : { + "GetTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionType" + } + } + } + ] + }, + "GetValidatorsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + }, + "GetVoteResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + } + ] + }, + "GetVotesResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "object", + "additionalProperties": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + } + } + ] + }, + "InfoType": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "coinbase": { + "type": "string" + }, + "latestBlockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "latestBlockHash": { + "type": "string" + }, + "activePeers": { + "type": "integer", + "format": "int32" + }, + "pendingTransactions": { + "type": "integer", + "format": "int32" + } + } + }, + "ListAccountsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + }, + "PeerType": { + "type": "object", + "properties": { + "ip": { + "type": "string" + }, + "port": { + "type": "integer", + "format": "int32" + }, + "networkVersion": { + "type": "integer", + "format": "int32" + }, + "clientId": { + "type": "string" + }, + "peerId": { + "type": "string" + }, + "latestBlockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "latency": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "capabilities": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "SendTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "SignMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string" + } + } + } + ] + }, + "TransactionLimitsType": { + "type": "object", + "properties": { + "maxTransactionDataSize": { + "type": "integer", + "format": "int32" + }, + "minTransactionFee": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "minDelegateBurnAmount": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + }, + "TransactionType": { + "type": "object", + "properties": { + "blockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "hash": { + "type": "string" + }, + "type": { + "type": "string" + }, + "from": { + "type": "string" + }, + "to": { + "type": "string" + }, + "value": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "fee": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "timestamp": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "data": { + "type": "string" + } + } + }, + "VerifyMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "validSignature": { + "type": "boolean" + } + } + } + ] + }, + "ComposeRawTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string" + } + } + } + ] + }, + "SignRawTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string" + } + } + } + ] + } + }, + "info": { + "description": "Semux is an experimental high-performance blockchain platform that powers decentralized application.", + "version": "2.0.0", + "title": "Semux API", + "contact": { + "name": "Semux Foundation", + "url": "https://www.semux.org" + }, + "license": { + "name": "MIT License", + "url": "https://opensource.org/licenses/mit-license.php" + } + }, + "paths": { + "/node": { + "post": { "tags": [ "semux" ], - "summary" : "Get latest block", - "description" : "Returns the latest block.", - "operationId" : "getLatestBlock", - "produces" : [ + "summary": "Add node", + "description": "Adds a node to node manager.", + "operationId": "addNode", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockResponse" + "parameters": [ + { + "name": "node", + "in": "query", + "description": "Name of the node in host:port format", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/AddNodeResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/latest-block-number" : { - "get" : { + "/blacklist": { + "put": { "tags": [ "semux" ], - "summary" : "Get latest block number", - "description" : "Returns the number of the latest block.", - "operationId" : "getLatestBlockNumber", - "produces" : [ + "summary": "Add to blacklist", + "description": "Adds an IP address to blacklist.", + "operationId": "addToBlacklist", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockNumberResponse" + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/peers" : { - "get" : { + "/whitelist": { + "put": { "tags": [ "semux" ], - "summary" : "Get peers", - "description" : "Returns connected peers.", - "operationId" : "getPeers", - "produces" : [ + "summary": "Add to whitelist", + "description": "Adds an IP address to whitelist.", + "operationId": "addToWhitelist", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPeersResponse" + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/pending-transactions" : { - "get" : { + "/account": { + "get": { "tags": [ "semux" ], - "summary" : "Get pending transactions", - "description" : "Returns all the pending transactions.", - "operationId" : "getPendingTransactions", - "produces" : [ + "summary": "Get account", + "description": "Returns an account.", + "operationId": "getAccount", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPendingTransactionsResponse" + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] - } - }, - "/transaction" : { - "get" : { + }, + "post": { "tags": [ "semux" ], - "summary" : "Get transaction", - "description" : "Returns a transactions if exists.", - "operationId" : "getTransaction", - "produces" : [ + "summary": "Create account", + "description": "Creates a new account.", + "operationId": "createAccount", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ { - "name" : "hash", - "in" : "query", - "description" : "Transaction hash", - "required" : true, - "type" : "string" + "name": "name", + "in": "query", + "description": "Assigned alias to the created account.", + "required": false, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateAccountResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction-limits" : { - "get" : { + "/delegate": { + "get": { "tags": [ "semux" ], - "summary" : "Get transaction limits", - "description" : "Get minimum fee and maximum size.", - "operationId" : "getTransactionLimits", - "produces" : [ + "summary": "Get a delegate", + "description": "Returns a delegate.", + "operationId": "getDelegate", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ { - "name" : "type", - "in" : "query", - "description" : "Type of transaction", - "required" : true, - "type" : "string" + "name": "address", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionLimitsResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegateResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/validators" : { - "get" : { + "/account/transactions": { + "get": { "tags": [ "semux" ], - "summary" : "Get validators", - "description" : "Returns a list of validators.", - "operationId" : "getValidators", - "produces" : [ + "summary": "Get account transactions", + "description": "Returns transactions from/to an account.", + "operationId": "getAccountTransactions", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetValidatorsResponse" + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string" + }, + { + "name": "from", + "in": "query", + "description": "Starting range of transactions", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Ending range of transactions", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountTransactionsResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/vote" : { - "get" : { + "/block-by-hash": { + "get": { "tags": [ "semux" ], - "summary" : "Get vote", - "description" : "Returns the vote from a voter to a delegate.", - "operationId" : "getVote", - "produces" : [ + "summary": "Get block by hash", + "description": "Returns a block by block hash.", + "operationId": "getBlockByHash", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - }, + "parameters": [ { - "name" : "voter", - "in" : "query", - "description" : "Voter address", - "required" : true, - "type" : "string" + "name": "hash", + "in": "query", + "description": "Hash of block", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVoteResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/votes" : { - "get" : { + "/block-by-number": { + "get": { "tags": [ "semux" ], - "summary" : "Get votes", - "description" : "Returns all the votes to a delegate", - "operationId" : "getVotes", - "produces" : [ + "summary": "Get block by number", + "description": "Returns a block by block number.", + "operationId": "getBlockByNumber", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" + "name": "number", + "in": "query", + "description": "Number of block", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVotesResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/accounts" : { - "get" : { + "/delegates": { + "get": { "tags": [ "semux" ], - "summary" : "List accounts", - "description" : "Returns accounts in the wallet.", - "operationId" : "listAccounts", - "produces" : [ + "summary": "Get all delegates", + "description": "Returns a list of delegates.", + "operationId": "getDelegates", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ListAccountsResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegatesResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/sign-message" : { - "get" : { + "/info": { + "get": { "tags": [ "semux" ], - "summary" : "Sign a message", - "description" : "Sign a message.", - "operationId" : "signMessage", - "produces" : [ + "summary": "Get info", + "description": "Returns kernel info.", + "operationId": "getInfo", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Signing address", - "required" : true, - "type" : "string" - }, - { - "name" : "message", - "in" : "query", - "description" : "Message to sign", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignMessageResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetInfoResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/verify-message" : { - "get" : { + "/latest-block": { + "get": { "tags": [ "semux" ], - "summary" : "Verify a message", - "description" : "Verify a signed message.", - "operationId" : "verifyMessage", - "produces" : [ + "summary": "Get latest block", + "description": "Returns the latest block.", + "operationId": "getLatestBlock", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address", - "required" : true, - "type" : "string" - }, - { - "name" : "message", - "in" : "query", - "description" : "Message", - "required" : true, - "type" : "string" - }, - { - "name" : "signature", - "in" : "query", - "description" : "Signature to verify", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/VerifyMessageResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/transfer" : { - "post" : { + "/latest-block-number": { + "get": { "tags": [ "semux" ], - "summary" : "Transfer coins", - "description" : "Transfers coins to another address.", - "operationId" : "transfer", - "produces" : [ + "summary": "Get latest block number", + "description": "Returns the number of the latest block.", + "operationId": "getLatestBlockNumber", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Sending address", - "required" : true, - "type" : "string" - }, - { - "name" : "to", - "in" : "query", - "description" : "Receiving address", - "required" : true, - "type" : "string" - }, - { - "name" : "value", - "in" : "query", - "description" : "Amount of SEM to transfer", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "data", - "in" : "query", - "description" : "Transaction data", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockNumberResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/unvote" : { - "post" : { + "/peers": { + "get": { "tags": [ "semux" ], - "summary" : "Unvote", - "description" : "Unvotes for a delegate.", - "operationId" : "unvote", - "produces" : [ + "summary": "Get peers", + "description": "Returns connected peers.", + "operationId": "getPeers", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Voting address", - "required" : true, - "type" : "string" - }, - { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - }, - { - "name" : "value", - "in" : "query", - "description" : "Vote amount", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPeersResponse" + } + } + }, + "security": [ { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "basicAuth": [] } + ] + } + }, + "/pending-transactions": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get pending transactions", + "description": "Returns all the pending transactions.", + "operationId": "getPendingTransactions", + "produces": [ + "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPendingTransactionsResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/vote" : { - "post" : { + "/transaction": { + "get": { "tags": [ "semux" ], - "summary" : "Vote", - "description" : "Votes for a delegate.", - "operationId" : "vote", - "produces" : [ + "summary": "Get transaction", + "description": "Returns a transactions if exists.", + "operationId": "getTransaction", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Voting address", - "required" : true, - "type" : "string" - }, - { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string" - }, - { - "name" : "value", - "in" : "query", - "description" : "Vote amount", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "name": "hash", + "in": "query", + "description": "Transaction hash", + "required": true, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/delegate": { - "post" : { + "/transaction-limits": { + "get": { "tags": [ "semux" ], - "summary" : "Register delegate", - "description" : "Registers as a delegate", - "operationId" : "registerDelegate", - "produces" : [ + "summary": "Get transaction limits", + "description": "Get minimum fee and maximum size.", + "operationId": "getTransactionLimits", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Registering address", - "required" : true, - "type" : "string" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "data", - "in" : "query", - "description" : "Delegate name", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" + "name": "type", + "in": "query", + "description": "Type of transaction", + "required": true, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionLimitsResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/raw" : { - "post" : { + "/validators": { + "get": { "tags": [ "semux" ], - "summary" : "Broadcast a raw transaction", - "description" : "Broadcasts a raw transaction to the network.", - "operationId" : "broadcastRawTransaction", - "produces" : [ + "summary": "Get validators", + "description": "Returns a list of validators.", + "operationId": "getValidators", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "raw", - "in" : "query", - "description" : "Raw transaction", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SendTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetValidatorsResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/compose-raw-transaction" : { - "get" : { + "/vote": { + "get": { "tags": [ "semux" ], - "summary" : "Compose an unsigned raw transaction", - "description" : "Compose an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be signed using /sign-raw-transaction API.", - "operationId" : "composeRawTransaction", - "produces" : [ + "summary": "Get vote", + "description": "Returns the vote from a voter to a delegate.", + "operationId": "getVote", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "network", - "in" : "query", - "description" : "Network name", - "required" : true, - "type" : "string", - "enum" : [ - "MAINNET", - "TESTNET", - "DEVNET" - ] - }, - { - "name" : "type", - "in" : "query", - "description" : "Transaction type", - "required" : true, - "type" : "string", - "enum" : [ - "TRANSFER", - "DELEGATE", - "VOTE", - "UNVOTE" - ] - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Recipient's address", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Transaction value in nano", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "timestamp", - "in" : "query", - "description" : "Transaction timestamp in milliseconds. Default to current time.", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" }, { - "name" : "data", - "in" : "query", - "description" : "Hexadecimal encoded transaction data.", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^(0x)?[0-9a-fA-F]+$" + "name": "voter", + "in": "query", + "description": "Voter address", + "required": true, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ComposeRawTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVoteResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/sign-raw-transaction" : { - "get" : { + "/votes": { + "get": { "tags": [ "semux" ], - "summary": "Sign an unsigned raw transaction", - "description": "Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.", - "operationId": "signRawTransaction", + "summary": "Get votes", + "description": "Returns all the votes to a delegate", + "operationId": "getVotes", "produces": [ "application/json" ], "parameters": [ { - "name" : "raw", - "in" : "query", - "description" : "Unsigned raw transaction encoded in hexadecimal string.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "address", - "in" : "query", - "description" : "Signer's address. This address must exist in the wallet.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignRawTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVotesResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } - } - }, - "definitions" : { - "ApiHandlerResponse" : { - "type" : "object", - "discriminator" : "ApiHandlerResponse", - "required" : [ - "success" - ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "GetRootResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] - }, - "AccountType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "available" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "locked" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "transactionCount" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "AddNodeResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] }, - "BlockType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string" - }, - "number" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "view" : { - "type" : "integer", - "format" : "int32" - }, - "coinbase" : { - "type" : "string" - }, - "parentHash" : { - "type" : "string" - }, - "timestamp" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "date" : { - "type" : "string" - }, - "transactionsRoot" : { - "type" : "string" - }, - "resultsRoot" : { - "type" : "string" - }, - "stateRoot" : { - "type" : "string" - }, - "data" : { - "type" : "string" - }, - "transactions" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" + "/accounts": { + "get": { + "tags": [ + "semux" + ], + "summary": "List accounts", + "description": "Returns accounts in the wallet.", + "operationId": "listAccounts", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ListAccountsResponse" + } } - } - } - }, - "CreateAccountResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "string" - } + "security": [ + { + "basicAuth": [] } - } - ] - }, - "DelegateType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "registeredAt" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "votes" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "blocksForged" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "turnsHit" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "turnsMissed" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } + ] } }, - "DoTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string" - } + "/sign-message": { + "get": { + "tags": [ + "semux" + ], + "summary": "Sign a message", + "description": "Sign a message.", + "operationId": "signMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Signing address", + "required": true, + "type": "string" + }, + { + "name": "message", + "in": "query", + "description": "Message to sign", + "required": true, + "type": "string" } - } - ] - }, - "GetAccountResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/AccountType" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignMessageResponse" } } - } - ] - }, - "GetAccountTransactionsResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetBlockResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/BlockType" - } + "/verify-message": { + "get": { + "tags": [ + "semux" + ], + "summary": "Verify a message", + "description": "Verify a signed message.", + "operationId": "verifyMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address", + "required": true, + "type": "string" + }, + { + "name": "message", + "in": "query", + "description": "Message", + "required": true, + "type": "string" + }, + { + "name": "signature", + "in": "query", + "description": "Signature to verify", + "required": true, + "type": "string" } - } - ] - }, - "GetDelegateResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/DelegateType" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VerifyMessageResponse" } } - } - ] - }, - "GetDelegatesResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DelegateType" - } - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetInfoResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/InfoType" - } + "/transaction/transfer": { + "post": { + "tags": [ + "semux" + ], + "summary": "Transfer coins", + "description": "Transfers coins to another address.", + "operationId": "transfer", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Sending address", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Receiving address", + "required": true, + "type": "string" + }, + { + "name": "value", + "in": "query", + "description": "Amount of SEM to transfer", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "data", + "in": "query", + "description": "Transaction data", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" } - } - ] - }, - "GetLatestBlockNumberResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] - }, - "GetLatestBlockResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/BlockType" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetPeersResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PeerType" - } - } + "/transaction/unvote": { + "post": { + "tags": [ + "semux" + ], + "summary": "Unvote", + "description": "Unvotes for a delegate.", + "operationId": "unvote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voting address", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + }, + { + "name": "value", + "in": "query", + "description": "Vote amount", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" } - } - ] - }, - "GetPendingTransactionsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] - }, - "GetTransactionLimitsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionLimitsType" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetTransactionResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionType" + "/transaction/vote": { + "post": { + "tags": [ + "semux" + ], + "summary": "Vote", + "description": "Votes for a delegate.", + "operationId": "vote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voting address", + "required": true, + "type": "string" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string" + }, + { + "name": "value", + "in": "query", + "description": "Vote amount", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] - }, - "GetValidatorsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "type" : "string" - } - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetVoteResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "/transaction/delegate": { + "post": { + "tags": [ + "semux" + ], + "summary": "Register delegate", + "description": "Registers as a delegate", + "operationId": "registerDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Registering address", + "required": true, + "type": "string" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "data", + "in": "query", + "description": "Delegate name", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] - }, - "GetVotesResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "object", - "additionalProperties" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - } + "security": [ + { + "basicAuth": [] } - } - ] - }, - "InfoType" : { - "type" : "object", - "properties" : { - "clientId" : { - "type" : "string" - }, - "coinbase" : { - "type" : "string" - }, - "latestBlockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "latestBlockHash" : { - "type" : "string" - }, - "activePeers" : { - "type" : "integer", - "format" : "int32" - }, - "pendingTransactions" : { - "type" : "integer", - "format" : "int32" - } + ] } }, - "ListAccountsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "type" : "string" - } + "/transaction/raw": { + "post": { + "tags": [ + "semux" + ], + "summary": "Broadcast a raw transaction", + "description": "Broadcasts a raw transaction to the network.", + "operationId": "broadcastRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Raw transaction", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SendTransactionResponse" } } - } - ] - }, - "PeerType" : { - "type" : "object", - "properties" : { - "ip" : { - "type" : "string" - }, - "port" : { - "type" : "integer", - "format" : "int32" - }, - "networkVersion" : { - "type" : "integer", - "format" : "int32" - }, - "clientId" : { - "type" : "string" }, - "peerId" : { - "type" : "string" - }, - "latestBlockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "latency" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" + "security": [ + { + "basicAuth": [] } - } + ] } }, - "SendTransactionResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] - }, - "SignMessageResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string" + "/compose-raw-transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Compose an unsigned raw transaction", + "description": "Compose an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be signed using /sign-raw-transaction API.", + "operationId": "composeRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "network", + "in": "query", + "description": "Network name", + "required": true, + "type": "string", + "enum": [ + "MAINNET", + "TESTNET", + "DEVNET" + ] + }, + { + "name": "type", + "in": "query", + "description": "Transaction type", + "required": true, + "type": "string", + "enum": [ + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE" + ] + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "to", + "in": "query", + "description": "Recipient's address", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "value", + "in": "query", + "description": "Transaction value in nano", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "timestamp", + "in": "query", + "description": "Transaction timestamp in milliseconds. Default to current time.", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "data", + "in": "query", + "description": "Hexadecimal encoded transaction data.", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ComposeRawTransactionResponse" } } - } - ] - }, - "TransactionLimitsType" : { - "type" : "object", - "properties" : { - "maxTransactionDataSize" : { - "type" : "integer", - "format" : "int32" - }, - "minTransactionFee" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "minDelegateBurnAmount" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - } - }, - "TransactionType" : { - "type" : "object", - "properties" : { - "blockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "hash" : { - "type" : "string" - }, - "type" : { - "type" : "string" - }, - "from" : { - "type" : "string" - }, - "to" : { - "type" : "string" - }, - "value" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "fee" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "timestamp" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "data" : { - "type" : "string" - } - } - }, - "VerifyMessageResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "validSignature" : { - "type" : "boolean" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "ComposeRawTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string" + "/sign-raw-transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Sign an unsigned raw transaction", + "description": "Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.", + "operationId": "signRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Unsigned raw transaction encoded in hexadecimal string.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "address", + "in": "query", + "description": "Signer's address. This address must exist in the wallet.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignRawTransactionResponse" } } - } - ] - }, - "SignRawTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "string" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } + } + }, + "produces": [ + "application/json" + ], + "schemes": [ + "http" + ], + "security": [ + { + "basicAuth": [] } - } + ], + "securityDefinitions": { + "basicAuth": { + "type": "basic" + } + }, + "swagger": "2.0" } \ No newline at end of file diff --git a/src/main/resources/org/semux/api/swagger/v2.1.0.json b/src/main/resources/org/semux/api/swagger/v2.1.0.json index a459570f7..9656c78c3 100644 --- a/src/main/resources/org/semux/api/swagger/v2.1.0.json +++ b/src/main/resources/org/semux/api/swagger/v2.1.0.json @@ -1,2396 +1,2426 @@ { - "swagger" : "2.0", - "info" : { - "description" : "Semux is an experimental high-performance blockchain platform that powers decentralized application.", - "version" : "2.1.0", - "title" : "Semux API", - "contact" : { - "name" : "Semux Foundation", - "url" : "https://www.semux.org" - }, - "license" : { - "name" : "MIT License", - "url" : "https://opensource.org/licenses/mit-license.php" - } - }, - "schemes" : [ - "http" - ], - "consumes" : [ + "basePath": "/v2.1.0", + "consumes": [ "application/x-www-form-urlencoded" ], - "produces" : [ - "application/json" - ], - "basePath" : "/v2.1.0", - "securityDefinitions" : { - "basicAuth" : { - "type" : "basic" - } - }, - "security" : [ - {"basicAuth": []} - ], - "paths" : { - "/node" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Add node", - "description" : "Adds a node to node manager.", - "operationId" : "addNode", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "node", - "in" : "query", - "description" : "Address of the node in host:port format", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/AddNodeResponse" - } - } + "definitions": { + "ApiHandlerResponse": { + "type": "object", + "discriminator": "ApiHandlerResponse", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "message": { + "type": "string" + } } }, - "/blacklist" : { - "put" : { - "tags": [ - "semux" - ], - "summary" : "Add to blacklist", - "description" : "Adds an IP address to blacklist.", - "operationId" : "addToBlacklist", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string", - "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" - } - } + "GetRootResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "AccountType": { + "type": "object", + "properties": { + "address": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "available": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "locked": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "transactionCount": { + "type": "integer", + "format": "int32" + }, + "pendingTransactionCount": { + "type": "integer", + "format": "int32" + } } }, - "/whitelist" : { - "put" : { - "tags": [ - "semux" - ], - "summary" : "Add to whitelist", - "description" : "Adds an IP address to whitelist.", - "operationId" : "addToWhitelist", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string", - "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" + "AddNodeResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "BlockType": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "number": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "view": { + "type": "integer", + "format": "int32" + }, + "coinbase": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "parentHash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "timestamp": { + "description": "Block timestamp in milliseconds specified by the block forger. There can be a time drift up to 30 seconds.", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "transactionsRoot": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "resultsRoot": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "stateRoot": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "data": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" + } + } + }, + "CreateAccountResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" } } + } + ] + }, + "DelegateType": { + "type": "object", + "properties": { + "address": { + "description": "Delegate SEM address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "name": { + "description": "Delegate name", + "type": "string" + }, + "registeredAt": { + "description": "Delegate registration block number", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "votes": { + "description": "Total votes of the delegate", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "blocksForged": { + "description": "Total forged blocks including primary rounds & backup rounds", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "turnsHit": { + "description": "Forged blocks when the delegate is a primary validator", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "turnsMissed": { + "description": "Missed blocks when the delegate is a primary validator", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "validator": { + "description": "Whether the delegate is currently a validator", + "type": "boolean" + } } }, - "/account" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account", - "description" : "Returns an account.", - "operationId" : "getAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountResponse" + "DoTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" } } + } + ] + }, + "GetAccountResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - }, - "post" : { - "tags": [ - "semux" - ], - "summary" : "Create or import an account", - "description" : "Creates a new account by generating a new private key or importing an existing private key when parameter 'privateKey' is provided.", - "operationId" : "createAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "name", - "in" : "query", - "description" : "Assigned alias to the created account.", - "required" : false, - "type" : "string" - }, - { - "name" : "privateKey", - "in" : "query", - "description" : "The private key to be imported, create a new key if omitted", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{96}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/CreateAccountResponse" + { + "properties": { + "result": { + "$ref": "#/definitions/AccountType" } } + } + ] + }, + "DeleteAccountResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "GetAccountTransactionsResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - }, - "delete" : { - "tags": [ - "semux" - ], - "summary" : "Delete account", - "description" : "Deletes an account from this wallet.", - "operationId" : "deleteAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of the account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DeleteAccountResponse" + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } } } + } + ] + }, + "GetAccountPendingTransactionsResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PendingTransactionType" + } + } } - ] - } + } + ] }, - "/delegate" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get a delegate", - "description" : "Returns a delegate.", - "operationId" : "getDelegate", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegateResponse" + "GetAccountVotesResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/AccountVoteType" + } } } + } + ] + }, + "AccountVoteType": { + "type": "object", + "properties": { + "delegate": { + "type": "object", + "$ref": "#/definitions/DelegateType" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "votes": { + "description": "Votes from the account", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } }, - "/account/transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account transactions", - "description" : "Returns transactions from/to an account.", - "operationId" : "getAccountTransactions", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "from", - "in" : "query", - "description" : "Starting range of transactions", - "required" : true, - "type" : "string", - "format": "int32", - "pattern" : "^\\d+$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Ending range of transactions", - "required" : true, - "type" : "string", - "format": "int32", - "pattern" : "^\\d+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountTransactionsResponse" - } - } + "GetBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/BlockType" + } } - ] - } + } + ] }, - "/account/pending-transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary": "Get pending transactions of the account", - "description": "Returns pending transactions from/to an account.", - "operationId": "getAccountPendingTransactions", - "produces" : [ - "application/json" - ], - "parameters": [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name": "from", - "in": "query", - "description": "Starting range of transactions", - "required": true, - "type": "string", - "format": "int32", - "pattern": "^\\d+$" - }, - { - "name": "to", - "in": "query", - "description": "Ending range of transactions", - "required": true, - "type": "string", - "format": "int32", - "pattern": "^\\d+$" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/GetAccountPendingTransactionsResponse" + "GetDelegateResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/DelegateType" } } } - } + ] }, - "/account/votes" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account votes", - "description" : "Returns votes from the account.", - "operationId" : "getAccountVotes", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountVotesResponse" + "GetDelegatesResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DelegateType" + } } } + } + ] + }, + "GetInfoResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/InfoType" + } } - ] - } + } + ] }, - "/block-by-hash" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get block by hash", - "description" : "Returns a block by block hash.", - "operationId" : "getBlockByHash", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "hash", - "in" : "query", - "description" : "Hash of block", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" + "GetLatestBlockNumberResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" } } + } + ] + }, + "GetLatestBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/BlockType" + } } - ] - } + } + ] }, - "/block-by-number" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get block by number", - "description" : "Returns a block by block number.", - "operationId" : "getBlockByNumber", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "number", - "in" : "query", - "description" : "Number of block", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" + "GetPeersResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PeerType" + } } } + } + ] + }, + "GetPendingTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PendingTransactionType" + } + } } - ] - } + } + ] }, - "/delegates" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get all delegates", - "description" : "Returns a list of delegates.", - "operationId" : "getDelegates", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegatesResponse" + "GetTransactionLimitsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionLimitsType" } } + } + ] + }, + "GetTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionType" + } } - ] - } + } + ] }, - "/info" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get info", - "description" : "Returns kernel info.", - "operationId" : "getInfo", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetInfoResponse" + "GetValidatorsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "A list of validator addresses", + "type": "array", + "items": { + "description": "Validator address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } } } + } + ] + }, + "GetVoteResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } - ] - } + } + ] }, - "/latest-block" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get latest block", - "description" : "Returns the latest block.", - "operationId" : "getLatestBlock", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockResponse" + "GetVotesResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "A map of [voter address] => [votes]", + "type": "object", + "additionalProperties": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } } + } + ] + }, + "InfoType": { + "type": "object", + "properties": { + "network": { + "type": "string", + "enum": [ + "MAINNET", + "TESTNET", + "DEVNET" + ] }, - "security" : [ - { - "basicAuth" : [ ] + "capabilities": { + "type": "array", + "items": { + "type": "string" } - ] + }, + "clientId": { + "type": "string" + }, + "coinbase": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "latestBlockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "latestBlockHash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "activePeers": { + "type": "integer", + "format": "int32" + }, + "pendingTransactions": { + "type": "integer", + "format": "int32" + } } }, - "/latest-block-number" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get latest block number", - "description" : "Returns the number of the latest block.", - "operationId" : "getLatestBlockNumber", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockNumberResponse" + "ListAccountsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "description": "A list of account addresses", + "items": { + "description": "Account address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } } } + } + ] + }, + "PeerType": { + "type": "object", + "properties": { + "ip": { + "type": "string", + "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" }, - "security" : [ - { - "basicAuth" : [ ] + "port": { + "type": "integer", + "format": "int32" + }, + "networkVersion": { + "type": "integer", + "format": "int32" + }, + "clientId": { + "type": "string" + }, + "peerId": { + "type": "string" + }, + "latestBlockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "latency": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "capabilities": { + "type": "array", + "items": { + "type": "string" } - ] + } } }, - "/peers" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get peers", - "description" : "Returns connected peers.", - "operationId" : "getPeers", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPeersResponse" + "SignMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "The message signature encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{192}$" } } + } + ] + }, + "TransactionLimitsType": { + "type": "object", + "properties": { + "maxTransactionDataSize": { + "description": "The maximum transaction size in bytes", + "type": "integer", + "format": "int32" }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + "minTransactionFee": { + "description": "The minimum transaction fee in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "minDelegateBurnAmount": { + "description": "The amount of nano SEM required to burn for delegate registration", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } }, - "/pending-transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get pending transactions", - "description" : "Returns all the pending transactions.", - "operationId" : "getPendingTransactions", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPendingTransactionsResponse" + "TransactionType": { + "type": "object", + "properties": { + "blockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "hash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "type": { + "type": "string", + "enum": [ + "COINBASE", + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE", + "CREATE", + "CALL" + ] + }, + "from": { + "description": "Sender's address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "to": { + "description": "Recipient's address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "value": { + "description": "Transaction value in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "fee": { + "description": "Transaction fee in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "timestamp": { + "description": "Transaction timestamp in milliseconds specified by the transaction creator. There can be a time drift up to 2 hours.", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "data": { + "description": "Transaction data encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + } + } + }, + "PendingTransactionType": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "type": { + "type": "string", + "enum": [ + "COINBASE", + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE", + "CREATE", + "CALL" + ] + }, + "from": { + "description": "Sender's address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "to": { + "description": "Recipient's address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "value": { + "description": "Transaction value in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "fee": { + "description": "Transaction fee in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "timestamp": { + "description": "Transaction timestamp in milliseconds specified by the transaction creator. There can be a time drift up to 2 hours.", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "data": { + "description": "Transaction data encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + } + } + }, + "VerifyMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "validSignature": { + "description": "Whether the signature is valid", + "type": "boolean" } } + } + ] + }, + "ComposeRawTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" }, - "security" : [ - { - "basicAuth" : [ ] + { + "properties": { + "result": { + "description": "The composed raw transaction encoded in hexadecimal string", + "type": "string" + } } - ] - } + } + ] + }, + "SignRawTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "The signed raw transaction encoded in hexadecimal string", + "type": "string" + } + } + } + ] + }, + "GetSyncingProgressResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "required": [ + "result" + ], + "properties": { + "result": { + "type": "object", + "$ref": "#/definitions/SyncingProgressType" + } + } + } + ] }, - "/transaction" : { - "get" : { + "SyncingProgressType": { + "type": "object", + "required": [ + "syncing" + ], + "properties": { + "syncing": { + "description": "Whether the node is syncing", + "type": "boolean" + }, + "startingHeight": { + "description": "The block height at which the sync started", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "currentHeight": { + "description": "The current block height", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "targetHeight": { + "description": "The target block height", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + } + }, + "info": { + "description": "Semux is an experimental high-performance blockchain platform that powers decentralized application.", + "version": "2.1.0", + "title": "Semux API", + "contact": { + "name": "Semux Foundation", + "url": "https://www.semux.org" + }, + "license": { + "name": "MIT License", + "url": "https://opensource.org/licenses/mit-license.php" + } + }, + "paths": { + "/node": { + "post": { "tags": [ "semux" ], - "summary" : "Get transaction", - "description" : "Returns a transactions if exists.", - "operationId" : "getTransaction", - "produces" : [ + "summary": "Add node", + "description": "Adds a node to node manager.", + "operationId": "addNode", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ { - "name" : "hash", - "in" : "query", - "description" : "Transaction hash", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" + "name": "node", + "in": "query", + "description": "Address of the node in host:port format", + "required": true, + "type": "string" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/AddNodeResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction-limits" : { - "get" : { + "/blacklist": { + "put": { "tags": [ "semux" ], - "summary" : "Get transaction limits", - "description" : "Returns transaction limitations including minimum transaction fee and maximum transaction size.", - "operationId" : "getTransactionLimits", - "produces" : [ + "summary": "Add to blacklist", + "description": "Adds an IP address to blacklist.", + "operationId": "addToBlacklist", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ { - "name" : "type", - "in" : "query", - "description" : "Type of transaction", - "required" : true, - "type" : "string", - "enum" : ["COINBASE", "TRANSFER", "DELEGATE", "VOTE", "UNVOTE", "CREATE", "CALL"] - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionLimitsResponse" + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string", + "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/validators" : { - "get" : { + "/whitelist": { + "put": { "tags": [ "semux" ], - "summary" : "Get validators", - "description" : "Returns a list of validators in Semux addresses.", - "operationId" : "getValidators", - "produces" : [ + "summary": "Add to whitelist", + "description": "Adds an IP address to whitelist.", + "operationId": "addToWhitelist", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetValidatorsResponse" + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string", + "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/vote" : { - "get" : { + "/account": { + "get": { "tags": [ "semux" ], - "summary" : "Get vote", - "description" : "Returns the vote from a voter to a delegate.", - "operationId" : "getVote", - "produces" : [ + "summary": "Get account", + "description": "Returns an account.", + "operationId": "getAccount", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, + "parameters": [ { - "name" : "voter", - "in" : "query", - "description" : "Voter address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVoteResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] - } - }, - "/votes" : { - "get" : { + }, + "post": { "tags": [ "semux" ], - "summary" : "Get a delegate's votes", - "description" : "Returns all the votes to a delegate as a map of [voter address] => [votes]", - "operationId" : "getVotes", - "produces" : [ + "summary": "Create or import an account", + "description": "Creates a new account by generating a new private key or importing an existing private key when parameter 'privateKey' is provided.", + "operationId": "createAccount", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ + { + "name": "name", + "in": "query", + "description": "Assigned alias to the created account.", + "required": false, + "type": "string" + }, { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" + "name": "privateKey", + "in": "query", + "description": "The private key to be imported, create a new key if omitted", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{96}$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVotesResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateAccountResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] - } - }, - "/accounts" : { - "get" : { + }, + "delete": { "tags": [ "semux" ], - "summary" : "List accounts", - "description" : "Returns accounts in the wallet.", - "operationId" : "listAccounts", - "produces" : [ + "summary": "Delete account", + "description": "Deletes an account from this wallet.", + "operationId": "deleteAccount", + "produces": [ "application/json" ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ListAccountsResponse" + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of the account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DeleteAccountResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/sign-message" : { - "get" : { + "/delegate": { + "get": { "tags": [ "semux" ], - "summary" : "Sign a message", - "description" : "Sign a message.", - "operationId" : "signMessage", - "produces" : [ + "summary": "Get a delegate", + "description": "Returns a delegate.", + "operationId": "getDelegate", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Signing address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, + "parameters": [ { - "name" : "message", - "in" : "query", - "description" : "Message to sign in UTF-8 string", - "required" : true, - "type" : "string" + "name": "address", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignMessageResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegateResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/verify-message" : { - "get" : { + "/account/transactions": { + "get": { "tags": [ "semux" ], - "summary" : "Verify a message", - "description" : "Verify a signed message.", - "operationId" : "verifyMessage", - "produces" : [ + "summary": "Get account transactions", + "description": "Returns transactions from/to an account.", + "operationId": "getAccountTransactions", + "produces": [ "application/json" ], - "parameters" : [ + "parameters": [ { - "name" : "address", - "in" : "query", - "description" : "Address of the message signer", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" }, { - "name" : "message", - "in" : "query", - "description" : "Message in UTF-8 string", - "required" : true, - "type" : "string" + "name": "from", + "in": "query", + "description": "Starting range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" }, { - "name" : "signature", - "in" : "query", - "description" : "Signature to verify", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{192}$" + "name": "to", + "in": "query", + "description": "Ending range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/VerifyMessageResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountTransactionsResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/transfer" : { - "post" : { + "/account/pending-transactions": { + "get": { "tags": [ "semux" ], - "summary" : "Transfer coins", - "description" : "Transfers coins to another address.", - "operationId" : "transfer", - "produces" : [ + "summary": "Get pending transactions of the account", + "description": "Returns pending transactions from/to an account.", + "operationId": "getAccountPendingTransactions", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Sender's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Recipient's address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Amount of SEM to transfer in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" }, { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" + "name": "from", + "in": "query", + "description": "Starting range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" }, { - "name" : "data", - "in" : "query", - "description" : "Transaction data encoded in hexadecimal string", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" + "name": "to", + "in": "query", + "description": "Ending range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountPendingTransactionsResponse" } } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] + } } }, - "/transaction/unvote" : { - "post" : { + "/account/votes": { + "get": { "tags": [ "semux" ], - "summary" : "Unvote", - "description" : "Unvotes for a delegate.", - "operationId" : "unvote", - "produces" : [ + "summary": "Get account votes", + "description": "Returns votes from the account.", + "operationId": "getAccountVotes", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Voter's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Number of votes in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountVotesResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/vote" : { - "post" : { + "/block-by-hash": { + "get": { "tags": [ "semux" ], - "summary" : "Vote", - "description" : "Votes for a delegate.", - "operationId" : "vote", - "produces" : [ + "summary": "Get block by hash", + "description": "Returns a block by block hash.", + "operationId": "getBlockByHash", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Voter's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Number of votes in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" + "name": "hash", + "in": "query", + "description": "Hash of block", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/delegate": { - "post" : { + "/block-by-number": { + "get": { "tags": [ "semux" ], - "summary" : "Register delegate", - "description" : "Registers as a delegate", - "operationId" : "registerDelegate", - "produces" : [ + "summary": "Get block by number", + "description": "Returns a block by block number.", + "operationId": "getBlockByNumber", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Registering address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "data", - "in" : "query", - "description" : "Delegate name in hexadecimal encoded UTF-8 string, 16 bytes of data at maximum", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, + "parameters": [ { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" + "name": "number", + "in": "query", + "description": "Number of block", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/transaction/raw" : { - "post" : { + "/delegates": { + "get": { "tags": [ "semux" ], - "summary" : "Broadcast a raw transaction", - "description" : "Broadcasts a raw transaction to the network.", - "operationId" : "broadcastRawTransaction", - "produces" : [ + "summary": "Get all delegates", + "description": "Returns a list of delegates.", + "operationId": "getDelegates", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "raw", - "in" : "query", - "description" : "Raw transaction encoded in hexadecimal string.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether to validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegatesResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/compose-raw-transaction" : { - "get" : { + "/info": { + "get": { "tags": [ "semux" ], - "summary" : "Compose an unsigned raw transaction", - "description" : "Compose an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be signed using /sign-raw-transaction API.", - "operationId" : "composeRawTransaction", - "produces" : [ + "summary": "Get info", + "description": "Returns kernel info.", + "operationId": "getInfo", + "produces": [ "application/json" ], - "parameters" : [ - { - "name" : "network", - "in" : "query", - "description" : "Network name", - "required" : true, - "type" : "string", - "enum" : [ - "MAINNET", - "TESTNET", - "DEVNET" - ] - }, - { - "name" : "type", - "in" : "query", - "description" : "Transaction type", - "required" : true, - "type" : "string", - "enum" : [ - "TRANSFER", - "DELEGATE", - "VOTE", - "UNVOTE" - ] - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Recipient's address", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Transaction value in nano SEM", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "timestamp", - "in" : "query", - "description" : "Transaction timestamp in milliseconds. Default to current time.", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "data", - "in" : "query", - "description" : "Hexadecimal encoded transaction data.", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ComposeRawTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetInfoResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/sign-raw-transaction" : { - "get" : { + "/latest-block": { + "get": { "tags": [ "semux" ], - "summary": "Sign an unsigned raw transaction", - "description": "Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.", - "operationId": "signRawTransaction", + "summary": "Get latest block", + "description": "Returns the latest block.", + "operationId": "getLatestBlock", "produces": [ "application/json" ], - "parameters": [ - { - "name" : "raw", - "in" : "query", - "description" : "Unsigned raw transaction encoded in hexadecimal string.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "address", - "in" : "query", - "description" : "Signer's address. This address must exist in the wallet.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignRawTransactionResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } }, - "/syncing" : { - "get" : { - "tags" : [ + "/latest-block-number": { + "get": { + "tags": [ "semux" ], - "summary" : "Get syncing progress", - "description" : "Returns an object with data about the sync status", - "operationId" : "getSyncingProgress", - "produces" : [ + "summary": "Get latest block number", + "description": "Returns the number of the latest block.", + "operationId": "getLatestBlockNumber", + "produces": [ "application/json" ], - "parameters" : [], - "responses" : { - "200" : { - "description" : "An object about the current sync status", - "schema" : { - "$ref" : "#/definitions/GetSyncingProgressResponse" + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockNumberResponse" } } }, - "security" : [ + "security": [ { - "basicAuth" : [ ] + "basicAuth": [] } ] } - } - }, - "definitions" : { - "ApiHandlerResponse" : { - "type" : "object", - "discriminator" : "ApiHandlerResponse", - "required" : [ - "success" - ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "GetRootResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] - }, - "AccountType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "available" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "locked" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "transactionCount" : { - "type" : "integer", - "format" : "int32" - }, - "pendingTransactionCount" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "AddNodeResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] }, - "BlockType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "number" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "view" : { - "type" : "integer", - "format" : "int32" - }, - "coinbase" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "parentHash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "timestamp" : { - "description": "Block timestamp in milliseconds specified by the block forger. There can be a time drift up to 30 seconds.", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "transactionsRoot" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "resultsRoot" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "stateRoot" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "data" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]*$" + "/peers": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get peers", + "description": "Returns connected peers.", + "operationId": "getPeers", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPeersResponse" + } + } }, - "transactions" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" + "security": [ + { + "basicAuth": [] } - } + ] } }, - "CreateAccountResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" + "/pending-transactions": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get pending transactions", + "description": "Returns all the pending transactions.", + "operationId": "getPendingTransactions", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPendingTransactionsResponse" } } - } - ] - }, - "DelegateType" : { - "type" : "object", - "properties" : { - "address" : { - "description": "Delegate SEM address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "name" : { - "description": "Delegate name", - "type" : "string" - }, - "registeredAt" : { - "description": "Delegate registration block number", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "votes" : { - "description": "Total votes of the delegate", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" }, - "blocksForged" : { - "description": "Total forged blocks including primary rounds & backup rounds", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "turnsHit" : { - "description": "Forged blocks when the delegate is a primary validator", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "turnsMissed" : { - "description": "Missed blocks when the delegate is a primary validator", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "validator" : { - "description" : "Whether the delegate is currently a validator", - "type" : "boolean" - } + "security": [ + { + "basicAuth": [] + } + ] } }, - "DoTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" + "/transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get transaction", + "description": "Returns a transactions if exists.", + "operationId": "getTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "description": "Transaction hash", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionResponse" } } - } - ] - }, - "GetAccountResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/AccountType" - } + "security": [ + { + "basicAuth": [] } - } - ] - }, - "DeleteAccountResponse" : { - "type" : "object", - "required": [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] + ] + } }, - "GetAccountTransactionsResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } + "/transaction-limits": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get transaction limits", + "description": "Returns transaction limitations including minimum transaction fee and maximum transaction size.", + "operationId": "getTransactionLimits", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "type", + "in": "query", + "description": "Type of transaction", + "required": true, + "type": "string", + "enum": [ + "COINBASE", + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE", + "CREATE", + "CALL" + ] + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionLimitsResponse" } } - } - ] - }, - "GetAccountPendingTransactionsResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties": { - "result": { - "type": "array", - "items": { - "$ref": "#/definitions/PendingTransactionType" - } - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetAccountVotesResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AccountVoteType" - } + "/validators": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get validators", + "description": "Returns a list of validators in Semux addresses.", + "operationId": "getValidators", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetValidatorsResponse" } } - } - ] - }, - "AccountVoteType" : { - "type" : "object", - "properties": { - "delegate" : { - "type" : "object", - "$ref" : "#/definitions/DelegateType" }, - "votes" : { - "description": "Votes from the account", - "type" : "string", - "format": "int64", - "pattern": "^\\d+$" - } + "security": [ + { + "basicAuth": [] + } + ] } }, - "GetBlockResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/BlockType" + "/vote": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get vote", + "description": "Returns the vote from a voter to a delegate.", + "operationId": "getVote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "voter", + "in": "query", + "description": "Voter address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVoteResponse" } } - } - ] - }, - "GetDelegateResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/DelegateType" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetDelegatesResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DelegateType" - } + "/votes": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get a delegate's votes", + "description": "Returns all the votes to a delegate as a map of [voter address] => [votes]", + "operationId": "getVotes", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVotesResponse" } } - } - ] - }, - "GetInfoResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/InfoType" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetLatestBlockNumberResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "/accounts": { + "get": { + "tags": [ + "semux" + ], + "summary": "List accounts", + "description": "Returns accounts in the wallet.", + "operationId": "listAccounts", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ListAccountsResponse" } } - } - ] - }, - "GetLatestBlockResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/BlockType" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetPeersResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PeerType" - } + "/sign-message": { + "get": { + "tags": [ + "semux" + ], + "summary": "Sign a message", + "description": "Sign a message.", + "operationId": "signMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Signing address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "message", + "in": "query", + "description": "Message to sign in UTF-8 string", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignMessageResponse" } } - } - ] - }, - "GetPendingTransactionsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PendingTransactionType" - } + "security": [ + { + "basicAuth": [] + } + ] + } + }, + "/verify-message": { + "get": { + "tags": [ + "semux" + ], + "summary": "Verify a message", + "description": "Verify a signed message.", + "operationId": "verifyMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of the message signer", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "message", + "in": "query", + "description": "Message in UTF-8 string", + "required": true, + "type": "string" + }, + { + "name": "signature", + "in": "query", + "description": "Signature to verify", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{192}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VerifyMessageResponse" } } - } - ] + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "GetTransactionLimitsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" + "/transaction/transfer": { + "post": { + "tags": [ + "semux" + ], + "summary": "Transfer coins", + "description": "Transfers coins to another address.", + "operationId": "transfer", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Sender's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Recipient's address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Amount of SEM to transfer in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + }, + { + "name": "data", + "in": "query", + "description": "Transaction data encoded in hexadecimal string", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionLimitsType" + "security": [ + { + "basicAuth": [] + } + ] + } + }, + "/transaction/unvote": { + "post": { + "tags": [ + "semux" + ], + "summary": "Unvote", + "description": "Unvotes for a delegate.", + "operationId": "unvote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voter's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Number of votes in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] + }, + "security": [ + { + "basicAuth": [] + } + ] + } }, - "GetTransactionResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" + "/transaction/vote": { + "post": { + "tags": [ + "semux" + ], + "summary": "Vote", + "description": "Votes for a delegate.", + "operationId": "vote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voter's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Number of votes in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionType" + "security": [ + { + "basicAuth": [] + } + ] + } + }, + "/transaction/delegate": { + "post": { + "tags": [ + "semux" + ], + "summary": "Register delegate", + "description": "Registers as a delegate", + "operationId": "registerDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Registering address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "data", + "in": "query", + "description": "Delegate name in hexadecimal encoded UTF-8 string, 16 bytes of data at maximum", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] - }, - "GetValidatorsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "A list of validator addresses", - "type" : "array", - "items" : { - "description" : "Validator address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "GetVoteResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } + "/transaction/raw": { + "post": { + "tags": [ + "semux" + ], + "summary": "Broadcast a raw transaction", + "description": "Broadcasts a raw transaction to the network.", + "operationId": "broadcastRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Raw transaction encoded in hexadecimal string.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether to validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" } - } - ] - }, - "GetVotesResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "description" : "A map of [voter address] => [votes]", - "type" : "object", - "additionalProperties" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" } } - } - ] - }, - "InfoType" : { - "type" : "object", - "properties" : { - "network" : { - "type" : "string", - "enum" : ["MAINNET", "TESTNET", "DEVNET"] }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" + "security": [ + { + "basicAuth": [] } - }, - "clientId" : { - "type" : "string" - }, - "coinbase" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "latestBlockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "latestBlockHash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "activePeers" : { - "type" : "integer", - "format" : "int32" - }, - "pendingTransactions" : { - "type" : "integer", - "format" : "int32" - } + ] } }, - "ListAccountsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "type" : "array", - "description" : "A list of account addresses", - "items" : { - "description" : "Account address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } + "/compose-raw-transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Compose an unsigned raw transaction", + "description": "Compose an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be signed using /sign-raw-transaction API.", + "operationId": "composeRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "network", + "in": "query", + "description": "Network name", + "required": true, + "type": "string", + "enum": [ + "MAINNET", + "TESTNET", + "DEVNET" + ] + }, + { + "name": "type", + "in": "query", + "description": "Transaction type", + "required": true, + "type": "string", + "enum": [ + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE" + ] + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "to", + "in": "query", + "description": "Recipient's address", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Transaction value in nano SEM", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "timestamp", + "in": "query", + "description": "Transaction timestamp in milliseconds. Default to current time.", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "data", + "in": "query", + "description": "Hexadecimal encoded transaction data.", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ComposeRawTransactionResponse" } } - } - ] - }, - "PeerType" : { - "type" : "object", - "properties" : { - "ip" : { - "type" : "string", - "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" - }, - "port" : { - "type" : "integer", - "format" : "int32" - }, - "networkVersion" : { - "type" : "integer", - "format" : "int32" }, - "clientId" : { - "type" : "string" - }, - "peerId" : { - "type" : "string" - }, - "latestBlockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "latency" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" + "security": [ + { + "basicAuth": [] } - } + ] } }, - "SignMessageResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "description" : "The message signature encoded in hexadecimal string", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{192}$" - } + "/sign-raw-transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Sign an unsigned raw transaction", + "description": "Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.", + "operationId": "signRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Unsigned raw transaction encoded in hexadecimal string.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "address", + "in": "query", + "description": "Signer's address. This address must exist in the wallet.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" } - } - ] - }, - "TransactionLimitsType" : { - "type" : "object", - "properties" : { - "maxTransactionDataSize" : { - "description" : "The maximum transaction size in bytes", - "type" : "integer", - "format" : "int32" - }, - "minTransactionFee" : { - "description" : "The minimum transaction fee in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "minDelegateBurnAmount" : { - "description" : "The amount of nano SEM required to burn for delegate registration", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - } - }, - "TransactionType" : { - "type" : "object", - "properties" : { - "blockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "hash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "type" : { - "type" : "string", - "enum" : ["COINBASE", "TRANSFER", "DELEGATE", "VOTE", "UNVOTE", "CREATE", "CALL"] - }, - "from" : { - "description" : "Sender's address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "to" : { - "description" : "Recipient's address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "value" : { - "description" : "Transaction value in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "fee" : { - "description" : "Transaction fee in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "timestamp" : { - "description": "Transaction timestamp in milliseconds specified by the transaction creator. There can be a time drift up to 2 hours.", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "data" : { - "description" : "Transaction data encoded in hexadecimal string", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]*$" - } - } - }, - "PendingTransactionType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "type" : { - "type" : "string", - "enum" : ["COINBASE", "TRANSFER", "DELEGATE", "VOTE", "UNVOTE", "CREATE", "CALL"] - }, - "from" : { - "description" : "Sender's address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "to" : { - "description" : "Recipient's address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "value" : { - "description" : "Transaction value in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "fee" : { - "description" : "Transaction fee in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "timestamp" : { - "description" : "Transaction timestamp in milliseconds specified by the transaction creator. There can be a time drift up to 2 hours.", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "data" : { - "description" : "Transaction data encoded in hexadecimal string", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]*$" - } - } - }, - "VerifyMessageResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "validSignature" : { - "description" : "Whether the signature is valid", - "type" : "boolean" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignRawTransactionResponse" } } - } - ] - }, - "ComposeRawTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "The composed raw transaction encoded in hexadecimal string", - "type" : "string" - } + "security": [ + { + "basicAuth": [] } - } - ] + ] + } }, - "SignRawTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, - { - "properties" : { - "result" : { - "description" : "The signed raw transaction encoded in hexadecimal string", - "type" : "string" + "/syncing": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get syncing progress", + "description": "Returns an object with data about the sync status", + "operationId": "getSyncingProgress", + "produces": [ + "application/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "An object about the current sync status", + "schema": { + "$ref": "#/definitions/GetSyncingProgressResponse" } } - } - ] - }, - "GetSyncingProgressResponse" : { - "type" : "object", - "allOf": [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "required" : [ - "result" - ], - "properties" : { - "result" : { - "type" : "object", - "$ref" : "#/definitions/SyncingProgressType" - } + "security": [ + { + "basicAuth": [] } - } - ] - }, - "SyncingProgressType" : { - "type" : "object", - "required": [ - "syncing" - ], - "properties" : { - "syncing" : { - "description": "Whether the node is syncing", - "type": "boolean" - }, - "startingHeight" : { - "description": "The block height at which the sync started", - "type": "string", - "format": "int64", - "pattern": "^\\d+$" - }, - "currentHeight" : { - "description": "The current block height", - "type" : "string", - "format": "int64", - "pattern": "^\\d+$" - }, - "targetHeight" : { - "description": "The target block height", - "type": "string", - "format" : "int64", - "pattern": "^\\d+$" - } + ] } } - } + }, + "produces": [ + "application/json" + ], + "schemes": [ + "http" + ], + "security": [ + { + "basicAuth": [] + } + ], + "securityDefinitions": { + "basicAuth": { + "type": "basic" + } + }, + "swagger": "2.0" } \ No newline at end of file diff --git a/src/main/resources/org/semux/api/swagger/v2.2.0.json b/src/main/resources/org/semux/api/swagger/v2.2.0.json index 3bded7e09..10ab46325 100644 --- a/src/main/resources/org/semux/api/swagger/v2.2.0.json +++ b/src/main/resources/org/semux/api/swagger/v2.2.0.json @@ -1,2629 +1,2651 @@ { - "swagger" : "2.0", - "info" : { - "description" : "Semux is an experimental high-performance blockchain platform that powers decentralized application.", - "version" : "2.2.0", - "title" : "Semux API", - "contact" : { - "name" : "Semux Foundation", - "url" : "https://www.semux.org" - }, - "license" : { - "name" : "MIT License", - "url" : "https://opensource.org/licenses/mit-license.php" - } - }, - "schemes" : [ - "http" - ], - "consumes" : [ - "application/x-www-form-urlencoded" - ], - "produces" : [ - "application/json" - ], - "basePath" : "/v2.2.0", - "securityDefinitions" : { - "basicAuth" : { - "type" : "basic" - } - }, - "security" : [ - {"basicAuth": []} - ], - "paths" : { - "/node" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Add node", - "description" : "Adds a node to node manager.", - "operationId" : "addNode", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "node", - "in" : "query", - "description" : "Address of the node in host:port format", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/AddNodeResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/blacklist" : { - "put" : { - "tags": [ - "semux" - ], - "summary" : "Add to blacklist", - "description" : "Adds an IP address to blacklist.", - "operationId" : "addToBlacklist", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string", - "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/whitelist" : { - "put" : { - "tags": [ - "semux" - ], - "summary" : "Add to whitelist", - "description" : "Adds an IP address to whitelist.", - "operationId" : "addToWhitelist", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "ip", - "in" : "query", - "description" : "IP address", - "required" : true, - "type" : "string", - "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ApiHandlerResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/account" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account", - "description" : "Returns an account.", - "operationId" : "getAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - }, - "post" : { - "tags": [ - "semux" - ], - "summary" : "Create or import an account", - "description" : "Creates a new account by generating a new private key or importing an existing private key when parameter 'privateKey' is provided.", - "operationId" : "createAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "name", - "in" : "query", - "description" : "Assigned alias to the created account.", - "required" : false, - "type" : "string" - }, - { - "name" : "privateKey", - "in" : "query", - "description" : "The private key to be imported, create a new key if omitted", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{96}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/CreateAccountResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - }, - "delete" : { - "tags": [ - "semux" - ], - "summary" : "Delete account", - "description" : "Deletes an account from this wallet.", - "operationId" : "deleteAccount", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of the account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DeleteAccountResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/delegate" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get a delegate", - "description" : "Returns a delegate.", - "operationId" : "getDelegate", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegateResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/account/transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account transactions", - "description" : "Returns transactions from/to an account.", - "operationId" : "getAccountTransactions", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "from", - "in" : "query", - "description" : "Starting range of transactions", - "required" : true, - "type" : "string", - "format": "int32", - "pattern" : "^\\d+$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Ending range of transactions", - "required" : true, - "type" : "string", - "format": "int32", - "pattern" : "^\\d+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountTransactionsResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/account/pending-transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary": "Get pending transactions of the account", - "description": "Returns pending transactions from/to an account.", - "operationId": "getAccountPendingTransactions", - "produces" : [ - "application/json" - ], - "parameters": [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name": "from", - "in": "query", - "description": "Starting range of transactions", - "required": true, - "type": "string", - "format": "int32", - "pattern": "^\\d+$" - }, - { - "name": "to", - "in": "query", - "description": "Ending range of transactions", - "required": true, - "type": "string", - "format": "int32", - "pattern": "^\\d+$" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/GetAccountPendingTransactionsResponse" - } - } - } - } - }, - "/account/votes" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get account votes", - "description" : "Returns votes from the account.", - "operationId" : "getAccountVotes", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of account", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetAccountVotesResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/block-by-hash" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get block by hash", - "description" : "Returns a block by block hash.", - "operationId" : "getBlockByHash", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "hash", - "in" : "query", - "description" : "Hash of block", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/block-by-number" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get block by number", - "description" : "Returns a block by block number.", - "operationId" : "getBlockByNumber", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "number", - "in" : "query", - "description" : "Number of block", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetBlockResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/delegates" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get all delegates", - "description" : "Returns a list of delegates.", - "operationId" : "getDelegates", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetDelegatesResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/info" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get info", - "description" : "Returns kernel info.", - "operationId" : "getInfo", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetInfoResponse" + "basePath": "/v2.2.0", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "definitions": { + "ApiHandlerResponse": { + "type": "object", + "discriminator": "ApiHandlerResponse", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + }, + "message": { + "type": "string" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/latest-block" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get latest block", - "description" : "Returns the latest block.", - "operationId" : "getLatestBlock", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/latest-block-number" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get latest block number", - "description" : "Returns the number of the latest block.", - "operationId" : "getLatestBlockNumber", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetLatestBlockNumberResponse" + }, + "GetRootResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "AccountType": { + "type": "object", + "properties": { + "address": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "available": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "locked": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "transactionCount": { + "type": "integer", + "format": "int32" + }, + "pendingTransactionCount": { + "type": "integer", + "format": "int32" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/peers" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get peers", - "description" : "Returns connected peers.", - "operationId" : "getPeers", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPeersResponse" + }, + "AddNodeResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "BlockType": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "number": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "view": { + "type": "integer", + "format": "int32" + }, + "coinbase": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "parentHash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "timestamp": { + "description": "Block timestamp in milliseconds specified by the block forger. There can be a time drift up to 30 seconds.", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "transactionsRoot": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "resultsRoot": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "stateRoot": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "data": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/pending-transactions" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get pending transactions", - "description" : "Returns all the pending transactions.", - "operationId" : "getPendingTransactions", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetPendingTransactionsResponse" + }, + "CreateAccountResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + } + } + ] + }, + "DelegateType": { + "type": "object", + "properties": { + "address": { + "description": "Delegate SEM address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "name": { + "description": "Delegate name", + "type": "string" + }, + "registeredAt": { + "description": "Delegate registration block number", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "votes": { + "description": "Total votes of the delegate", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "blocksForged": { + "description": "Total forged blocks including primary rounds & backup rounds", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "turnsHit": { + "description": "Forged blocks when the delegate is a primary validator", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "turnsMissed": { + "description": "Missed blocks when the delegate is a primary validator", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "validator": { + "description": "Whether the delegate is currently a validator", + "type": "boolean" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get transaction", - "description" : "Returns a transactions if exists.", - "operationId" : "getTransaction", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "hash", - "in" : "query", - "description" : "Transaction hash", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionResponse" + }, + "DoTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + } + } + } + ] + }, + "GetAccountResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/AccountType" + } + } + } + ] + }, + "DeleteAccountResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + } + ] + }, + "GetAccountTransactionsResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + } + } + } + ] + }, + "GetAccountPendingTransactionsResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + } + } + } + ] + }, + "GetAccountVotesResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/AccountVoteType" + } + } + } + } + ] + }, + "AccountVoteType": { + "type": "object", + "properties": { + "delegate": { + "type": "object", + "$ref": "#/definitions/DelegateType" + }, + "votes": { + "description": "Votes from the account", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction-result" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get transaction result", - "description" : "Returns the result of the requested transaction.", - "operationId" : "getTransactionResult", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "hash", - "in" : "query", - "description" : "Transaction hash", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionResultResponse" + }, + "GetBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/BlockType" + } + } + } + ] + }, + "GetDelegateResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/DelegateType" + } + } + } + ] + }, + "GetDelegatesResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DelegateType" + } + } + } + } + ] + }, + "GetInfoResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/InfoType" + } + } + } + ] + }, + "GetLatestBlockNumberResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + } + ] + }, + "GetLatestBlockResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/BlockType" + } + } + } + ] + }, + "GetPeersResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/PeerType" + } + } + } + } + ] + }, + "GetPendingTransactionsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransactionType" + } + } + } + } + ] + }, + "GetTransactionLimitsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionLimitsType" + } + } + } + ] + }, + "GetTransactionResultResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionResultType" + } + } + } + ] + }, + "GetTransactionResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "$ref": "#/definitions/TransactionType" + } + } + } + ] + }, + "GetValidatorsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "A list of validator addresses", + "type": "array", + "items": { + "description": "Validator address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + } + } + } + ] + }, + "GetVoteResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + } + ] + }, + "GetVotesResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "A map of [voter address] => [votes]", + "type": "object", + "additionalProperties": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + } + } + } + ] + }, + "InfoType": { + "type": "object", + "properties": { + "network": { + "type": "string", + "enum": [ + "MAINNET", + "TESTNET", + "DEVNET" + ] + }, + "capabilities": { + "type": "array", + "items": { + "type": "string" + } + }, + "clientId": { + "type": "string" + }, + "coinbase": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "latestBlockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "latestBlockHash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "activePeers": { + "type": "integer", + "format": "int32" + }, + "pendingTransactions": { + "type": "integer", + "format": "int32" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction-limits" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get transaction limits", - "description" : "Returns transaction limitations including minimum transaction fee and maximum transaction size.", - "operationId" : "getTransactionLimits", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "type", - "in" : "query", - "description" : "Type of transaction", - "required" : true, - "type" : "string", - "enum" : ["COINBASE", "TRANSFER", "DELEGATE", "VOTE", "UNVOTE", "CREATE", "CALL"] - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetTransactionLimitsResponse" + }, + "ListAccountsResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "type": "array", + "description": "A list of account addresses", + "items": { + "description": "Account address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + } + } + } + ] + }, + "PeerType": { + "type": "object", + "properties": { + "ip": { + "type": "string", + "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" + }, + "port": { + "type": "integer", + "format": "int32" + }, + "networkVersion": { + "type": "integer", + "format": "int32" + }, + "clientId": { + "type": "string" + }, + "peerId": { + "type": "string" + }, + "latestBlockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "latency": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "capabilities": { + "type": "array", + "items": { + "type": "string" + } + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/validators" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get validators", - "description" : "Returns a list of validators in Semux addresses.", - "operationId" : "getValidators", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetValidatorsResponse" + }, + "SignMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "The message signature encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{192}$" + } + } + } + ] + }, + "TransactionLimitsType": { + "type": "object", + "properties": { + "maxTransactionDataSize": { + "description": "The maximum transaction size in bytes", + "type": "integer", + "format": "int32" + }, + "minTransactionFee": { + "description": "The minimum transaction fee in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "minDelegateBurnAmount": { + "description": "The amount of nano SEM required to burn for delegate registration", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/vote" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get vote", - "description" : "Returns the vote from a voter to a delegate.", - "operationId" : "getVote", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "voter", - "in" : "query", - "description" : "Voter address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVoteResponse" + }, + "TransactionType": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "type": { + "type": "string", + "enum": [ + "COINBASE", + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE", + "CREATE", + "CALL" + ] + }, + "from": { + "description": "Sender's address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "to": { + "description": "Recipient's address", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + "value": { + "description": "Transaction value in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "fee": { + "description": "Transaction fee in nano SEM", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "nonce": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "timestamp": { + "description": "Transaction timestamp in milliseconds specified by the transaction creator. There can be a time drift up to 2 hours.", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "data": { + "description": "Transaction data encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/votes" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Get a delegate's votes", - "description" : "Returns all the votes to a delegate as a map of [voter address] => [votes]", - "operationId" : "getVotes", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "delegate", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/GetVotesResponse" + }, + "TransactionResultType": { + "type": "object", + "properties": { + "blockNumber": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "logs": { + "type": "array", + "items": { + "$ref": "#/definitions/LogInfoType" + } + }, + "returnData": { + "description": "Return data encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + }, + "gasUsed": { + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "code": { + "description": "The status of the transaction", + "type": "string" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/accounts" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "List accounts", - "description" : "Returns accounts in the wallet.", - "operationId" : "listAccounts", - "produces" : [ - "application/json" - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ListAccountsResponse" + }, + "LogInfoType": { + "type": "object", + "properties": { + "address": { + "description": "Address encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + }, + "data": { + "description": "Log info data encoded in hexadecimal string", + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]*$" + }, + "topics": { + "description": "Topics encoded in hexadecimal string", + "type": "array", + "items": { + "type": "string" + } + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/sign-message" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Sign a message", - "description" : "Sign a message.", - "operationId" : "signMessage", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Signing address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "message", - "in" : "query", - "description" : "Message to sign in UTF-8 string", - "required" : true, - "type" : "string" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignMessageResponse" + }, + "VerifyMessageResponse": { + "type": "object", + "required": [ + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "validSignature": { + "description": "Whether the signature is valid", + "type": "boolean" + } + } + } + ] + }, + "ComposeRawTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "The composed raw transaction encoded in hexadecimal string", + "type": "string" + } + } + } + ] + }, + "SignRawTransactionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "properties": { + "result": { + "description": "The signed raw transaction encoded in hexadecimal string", + "type": "string" + } + } + } + ] + }, + "GetSyncingProgressResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ApiHandlerResponse" + }, + { + "required": [ + "result" + ], + "properties": { + "result": { + "type": "object", + "$ref": "#/definitions/SyncingProgressType" + } + } + } + ] + }, + "SyncingProgressType": { + "type": "object", + "required": [ + "syncing" + ], + "properties": { + "syncing": { + "description": "Whether the node is syncing", + "type": "boolean" + }, + "startingHeight": { + "description": "The block height at which the sync started", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "currentHeight": { + "description": "The current block height", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + "targetHeight": { + "description": "The target block height", + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } + } }, - "/verify-message" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Verify a message", - "description" : "Verify a signed message.", - "operationId" : "verifyMessage", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "address", - "in" : "query", - "description" : "Address of the message signer", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "message", - "in" : "query", - "description" : "Message in UTF-8 string", - "required" : true, - "type" : "string" - }, - { - "name" : "signature", - "in" : "query", - "description" : "Signature to verify", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{192}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/VerifyMessageResponse" - } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } + "info": { + "description": "Semux is an experimental high-performance blockchain platform that powers decentralized application.", + "version": "2.2.0", + "title": "Semux API", + "contact": { + "name": "Semux Foundation", + "url": "https://www.semux.org" + }, + "license": { + "name": "MIT License", + "url": "https://opensource.org/licenses/mit-license.php" + } }, - "/transaction/transfer" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Transfer coins", - "description" : "Transfers coins to another address.", - "operationId" : "transfer", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Sender's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Recipient's address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Amount of SEM to transfer in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - }, - { - "name" : "data", - "in" : "query", - "description" : "Transaction data encoded in hexadecimal string", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + "paths": { + "/node": { + "post": { + "tags": [ + "semux" + ], + "summary": "Add node", + "description": "Adds a node to node manager.", + "operationId": "addNode", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "node", + "in": "query", + "description": "Address of the node in host:port format", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/AddNodeResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction/create" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Create a contract", - "description" : "Create a VM contract.", - "operationId" : "create", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Sender's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - }, - { - "name" : "data", - "in" : "query", - "description" : "The contract data encoded in hexadecimal string", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "gasPrice", - "in" : "query", - "description" : "The gas price", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "gas", - "in" : "query", - "description" : "The gas limit for the call", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + }, + "/blacklist": { + "put": { + "tags": [ + "semux" + ], + "summary": "Add to blacklist", + "description": "Adds an IP address to blacklist.", + "operationId": "addToBlacklist", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string", + "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction/call" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Call a contract.", - "description" : "Call a VM contract.", - "operationId" : "call", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Sender's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Recipient's address (the contract address)", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Amount of SEM to transfer in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - }, - { - "name" : "data", - "in" : "query", - "description" : "Transaction data encoded in hexadecimal string", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "gasPrice", - "in" : "query", - "description" : "The gas price", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "gas", - "in" : "query", - "description" : "The gas limit for the call", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "local", - "in" : "query", - "description" : "Specifies whether this is a local (free) call, or a transaction", - "required" : false, - "default" : false, - "type" : "boolean" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + }, + "/whitelist": { + "put": { + "tags": [ + "semux" + ], + "summary": "Add to whitelist", + "description": "Adds an IP address to whitelist.", + "operationId": "addToWhitelist", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "IP address", + "required": true, + "type": "string", + "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ApiHandlerResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction/unvote" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Unvote", - "description" : "Unvotes for a delegate.", - "operationId" : "unvote", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Voter's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Number of votes in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + }, + "/account": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get account", + "description": "Returns an account.", + "operationId": "getAccount", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + }, + "post": { + "tags": [ + "semux" + ], + "summary": "Create or import an account", + "description": "Creates a new account by generating a new private key or importing an existing private key when parameter 'privateKey' is provided.", + "operationId": "createAccount", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "description": "Assigned alias to the created account.", + "required": false, + "type": "string" + }, + { + "name": "privateKey", + "in": "query", + "description": "The private key to be imported, create a new key if omitted", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{96}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] + }, + "delete": { + "tags": [ + "semux" + ], + "summary": "Delete account", + "description": "Deletes an account from this wallet.", + "operationId": "deleteAccount", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of the account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DeleteAccountResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction/vote" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Vote", - "description" : "Votes for a delegate.", - "operationId" : "vote", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Voter's address. The address must exist in the wallet.data of this Semux node.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Delegate address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Number of votes in nano SEM", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + }, + "/delegate": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get a delegate", + "description": "Returns a delegate.", + "operationId": "getDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegateResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction/delegate": { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Register delegate", - "description" : "Registers as a delegate", - "operationId" : "registerDelegate", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "from", - "in" : "query", - "description" : "Registering address", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "data", - "in" : "query", - "description" : "Delegate name in hexadecimal encoded UTF-8 string, 16 bytes of data at maximum", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano SEM, default to minimum fee if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce, default to sender's nonce if omitted", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + }, + "/account/transactions": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get account transactions", + "description": "Returns transactions from/to an account.", + "operationId": "getAccountTransactions", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "from", + "in": "query", + "description": "Starting range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" + }, + { + "name": "to", + "in": "query", + "description": "Ending range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountTransactionsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/transaction/raw" : { - "post" : { - "tags": [ - "semux" - ], - "summary" : "Broadcast a raw transaction", - "description" : "Broadcasts a raw transaction to the network.", - "operationId" : "broadcastRawTransaction", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "raw", - "in" : "query", - "description" : "Raw transaction encoded in hexadecimal string.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "validateNonce", - "in" : "query", - "description" : "Whether to validate tx nonce against the current account state, default to false if omitted", - "required" : false, - "default" : false, - "type" : "boolean" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/DoTransactionResponse" + }, + "/account/pending-transactions": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get pending transactions of the account", + "description": "Returns pending transactions from/to an account.", + "operationId": "getAccountPendingTransactions", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "from", + "in": "query", + "description": "Starting range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" + }, + { + "name": "to", + "in": "query", + "description": "Ending range of transactions", + "required": true, + "type": "string", + "format": "int32", + "pattern": "^\\d+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountPendingTransactionsResponse" + } + } + } } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/compose-raw-transaction" : { - "get" : { - "tags": [ - "semux" - ], - "summary" : "Compose an unsigned raw transaction", - "description" : "Compose an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be signed using /sign-raw-transaction API.", - "operationId" : "composeRawTransaction", - "produces" : [ - "application/json" - ], - "parameters" : [ - { - "name" : "network", - "in" : "query", - "description" : "Network name", - "required" : true, - "type" : "string", - "enum" : [ - "MAINNET", - "TESTNET", - "DEVNET" - ] - }, - { - "name" : "type", - "in" : "query", - "description" : "Transaction type", - "required" : true, - "type" : "string", - "enum" : [ - "TRANSFER", - "DELEGATE", - "VOTE", - "UNVOTE" - ] - }, - { - "name" : "fee", - "in" : "query", - "description" : "Transaction fee in nano", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "nonce", - "in" : "query", - "description" : "Transaction nonce", - "required" : true, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "to", - "in" : "query", - "description" : "Recipient's address", - "required" : false, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - { - "name" : "value", - "in" : "query", - "description" : "Transaction value in nano SEM", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "timestamp", - "in" : "query", - "description" : "Transaction timestamp in milliseconds. Default to current time.", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - { - "name" : "data", - "in" : "query", - "description" : "Hexadecimal encoded transaction data.", - "required" : false, - "type" : "string", - "format" : "int64", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/ComposeRawTransactionResponse" + }, + "/account/votes": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get account votes", + "description": "Returns votes from the account.", + "operationId": "getAccountVotes", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of account", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetAccountVotesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/sign-raw-transaction" : { - "get" : { - "tags": [ - "semux" - ], - "summary": "Sign an unsigned raw transaction", - "description": "Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.", - "operationId": "signRawTransaction", - "produces": [ - "application/json" - ], - "parameters": [ - { - "name" : "raw", - "in" : "query", - "description" : "Unsigned raw transaction encoded in hexadecimal string.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]+$" - }, - { - "name" : "address", - "in" : "query", - "description" : "Signer's address. This address must exist in the wallet.", - "required" : true, - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } - ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/SignRawTransactionResponse" + }, + "/block-by-hash": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get block by hash", + "description": "Returns a block by block hash.", + "operationId": "getBlockByHash", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "description": "Hash of block", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - }, - "/syncing" : { - "get" : { - "tags" : [ - "semux" - ], - "summary" : "Get syncing progress", - "description" : "Returns an object with data about the sync status", - "operationId" : "getSyncingProgress", - "produces" : [ - "application/json" - ], - "parameters" : [], - "responses" : { - "200" : { - "description" : "An object about the current sync status", - "schema" : { - "$ref" : "#/definitions/GetSyncingProgressResponse" + }, + "/block-by-number": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get block by number", + "description": "Returns a block by block number.", + "operationId": "getBlockByNumber", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "number", + "in": "query", + "description": "Number of block", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - }, - "security" : [ - { - "basicAuth" : [ ] - } - ] - } - } - }, - "definitions" : { - "ApiHandlerResponse" : { - "type" : "object", - "discriminator" : "ApiHandlerResponse", - "required" : [ - "success" - ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" - } - } - }, - "GetRootResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] - }, - "AccountType" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "available" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "locked" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "transactionCount" : { - "type" : "integer", - "format" : "int32" - }, - "pendingTransactionCount" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "AddNodeResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] - }, - "BlockType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "number" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "view" : { - "type" : "integer", - "format" : "int32" - }, - "coinbase" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "parentHash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "timestamp" : { - "description": "Block timestamp in milliseconds specified by the block forger. There can be a time drift up to 30 seconds.", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "transactionsRoot" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "resultsRoot" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "stateRoot" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "data" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]*$" - }, - "transactions" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } - } - } - }, - "CreateAccountResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" + "/delegates": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get all delegates", + "description": "Returns a list of delegates.", + "operationId": "getDelegates", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetDelegatesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "DelegateType" : { - "type" : "object", - "properties" : { - "address" : { - "description": "Delegate SEM address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "name" : { - "description": "Delegate name", - "type" : "string" - }, - "registeredAt" : { - "description": "Delegate registration block number", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "votes" : { - "description": "Total votes of the delegate", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "blocksForged" : { - "description": "Total forged blocks including primary rounds & backup rounds", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "turnsHit" : { - "description": "Forged blocks when the delegate is a primary validator", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "turnsMissed" : { - "description": "Missed blocks when the delegate is a primary validator", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "validator" : { - "description" : "Whether the delegate is currently a validator", - "type" : "boolean" - } - } - }, - "DoTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" + "/info": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get info", + "description": "Returns kernel info.", + "operationId": "getInfo", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetInfoResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetAccountResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/AccountType" + "/latest-block": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get latest block", + "description": "Returns the latest block.", + "operationId": "getLatestBlock", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "DeleteAccountResponse" : { - "type" : "object", - "required": [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - } - ] - }, - "GetAccountTransactionsResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } + "/latest-block-number": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get latest block number", + "description": "Returns the number of the latest block.", + "operationId": "getLatestBlockNumber", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetLatestBlockNumberResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetAccountPendingTransactionsResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties": { - "result": { - "type": "array", - "items": { - "$ref": "#/definitions/TransactionType" - } + "/peers": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get peers", + "description": "Returns connected peers.", + "operationId": "getPeers", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPeersResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetAccountVotesResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AccountVoteType" - } + "/pending-transactions": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get pending transactions", + "description": "Returns all the pending transactions.", + "operationId": "getPendingTransactions", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetPendingTransactionsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "AccountVoteType" : { - "type" : "object", - "properties": { - "delegate" : { - "type" : "object", - "$ref" : "#/definitions/DelegateType" - }, - "votes" : { - "description": "Votes from the account", - "type" : "string", - "format": "int64", - "pattern": "^\\d+$" - } - } - }, - "GetBlockResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/BlockType" + "/transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get transaction", + "description": "Returns a transactions if exists.", + "operationId": "getTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "description": "Transaction hash", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetDelegateResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/DelegateType" + "/transaction-result": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get transaction result", + "description": "Returns the result of the requested transaction.", + "operationId": "getTransactionResult", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "hash", + "in": "query", + "description": "Transaction hash", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{64}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionResultResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetDelegatesResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DelegateType" - } + "/transaction-limits": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get transaction limits", + "description": "Returns transaction limitations including minimum transaction fee and maximum transaction size.", + "operationId": "getTransactionLimits", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "type", + "in": "query", + "description": "Type of transaction", + "required": true, + "type": "string", + "enum": [ + "COINBASE", + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE", + "CREATE", + "CALL" + ] + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetTransactionLimitsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetInfoResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/InfoType" + "/validators": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get validators", + "description": "Returns a list of validators in Semux addresses.", + "operationId": "getValidators", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetValidatorsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetLatestBlockNumberResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "/vote": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get vote", + "description": "Returns the vote from a voter to a delegate.", + "operationId": "getVote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "voter", + "in": "query", + "description": "Voter address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVoteResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetLatestBlockResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/BlockType" + "/votes": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get a delegate's votes", + "description": "Returns all the votes to a delegate as a map of [voter address] => [votes]", + "operationId": "getVotes", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delegate", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/GetVotesResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetPeersResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PeerType" - } + "/accounts": { + "get": { + "tags": [ + "semux" + ], + "summary": "List accounts", + "description": "Returns accounts in the wallet.", + "operationId": "listAccounts", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ListAccountsResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetPendingTransactionsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TransactionType" - } + "/sign-message": { + "get": { + "tags": [ + "semux" + ], + "summary": "Sign a message", + "description": "Sign a message.", + "operationId": "signMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Signing address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "message", + "in": "query", + "description": "Message to sign in UTF-8 string", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignMessageResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetTransactionLimitsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionLimitsType" + "/verify-message": { + "get": { + "tags": [ + "semux" + ], + "summary": "Verify a message", + "description": "Verify a signed message.", + "operationId": "verifyMessage", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "address", + "in": "query", + "description": "Address of the message signer", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "message", + "in": "query", + "description": "Message in UTF-8 string", + "required": true, + "type": "string" + }, + { + "name": "signature", + "in": "query", + "description": "Signature to verify", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{192}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VerifyMessageResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetTransactionResultResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionResultType" + "/transaction/transfer": { + "post": { + "tags": [ + "semux" + ], + "summary": "Transfer coins", + "description": "Transfers coins to another address.", + "operationId": "transfer", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Sender's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Recipient's address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Amount of SEM to transfer in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + }, + { + "name": "data", + "in": "query", + "description": "Transaction data encoded in hexadecimal string", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetTransactionResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "$ref" : "#/definitions/TransactionType" + "/transaction/create": { + "post": { + "tags": [ + "semux" + ], + "summary": "Create a contract", + "description": "Create a VM contract.", + "operationId": "create", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Sender's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + }, + { + "name": "data", + "in": "query", + "description": "The contract data encoded in hexadecimal string", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "gasPrice", + "in": "query", + "description": "The gas price", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "gas", + "in": "query", + "description": "The gas limit for the call", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetValidatorsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "A list of validator addresses", - "type" : "array", - "items" : { - "description" : "Validator address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } + "/transaction/call": { + "post": { + "tags": [ + "semux" + ], + "summary": "Call a contract.", + "description": "Call a VM contract.", + "operationId": "call", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Sender's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Recipient's address (the contract address)", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Amount of SEM to transfer in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + }, + { + "name": "data", + "in": "query", + "description": "Transaction data encoded in hexadecimal string", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "gasPrice", + "in": "query", + "description": "The gas price", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "gas", + "in": "query", + "description": "The gas limit for the call", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "local", + "in": "query", + "description": "Specifies whether this is a local (free) call, or a transaction", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetVoteResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" + "/transaction/unvote": { + "post": { + "tags": [ + "semux" + ], + "summary": "Unvote", + "description": "Unvotes for a delegate.", + "operationId": "unvote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voter's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Number of votes in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "GetVotesResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "A map of [voter address] => [votes]", - "type" : "object", - "additionalProperties" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } + "/transaction/vote": { + "post": { + "tags": [ + "semux" + ], + "summary": "Vote", + "description": "Votes for a delegate.", + "operationId": "vote", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Voter's address. The address must exist in the wallet.data of this Semux node.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "to", + "in": "query", + "description": "Delegate address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Number of votes in nano SEM", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "InfoType" : { - "type" : "object", - "properties" : { - "network" : { - "type" : "string", - "enum" : ["MAINNET", "TESTNET", "DEVNET"] - }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "clientId" : { - "type" : "string" - }, - "coinbase" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "latestBlockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "latestBlockHash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "activePeers" : { - "type" : "integer", - "format" : "int32" - }, - "pendingTransactions" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "ListAccountsResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "type" : "array", - "description" : "A list of account addresses", - "items" : { - "description" : "Account address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - } + "/transaction/delegate": { + "post": { + "tags": [ + "semux" + ], + "summary": "Register delegate", + "description": "Registers as a delegate", + "operationId": "registerDelegate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "from", + "in": "query", + "description": "Registering address", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "data", + "in": "query", + "description": "Delegate name in hexadecimal encoded UTF-8 string, 16 bytes of data at maximum", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano SEM, default to minimum fee if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce, default to sender's nonce if omitted", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "PeerType" : { - "type" : "object", - "properties" : { - "ip" : { - "type" : "string", - "pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$" - }, - "port" : { - "type" : "integer", - "format" : "int32" - }, - "networkVersion" : { - "type" : "integer", - "format" : "int32" - }, - "clientId" : { - "type" : "string" - }, - "peerId" : { - "type" : "string" - }, - "latestBlockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "latency" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "capabilities" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - } - }, - "SignMessageResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "The message signature encoded in hexadecimal string", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{192}$" + "/transaction/raw": { + "post": { + "tags": [ + "semux" + ], + "summary": "Broadcast a raw transaction", + "description": "Broadcasts a raw transaction to the network.", + "operationId": "broadcastRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Raw transaction encoded in hexadecimal string.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "validateNonce", + "in": "query", + "description": "Whether to validate tx nonce against the current account state, default to false if omitted", + "required": false, + "default": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/DoTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "TransactionLimitsType" : { - "type" : "object", - "properties" : { - "maxTransactionDataSize" : { - "description" : "The maximum transaction size in bytes", - "type" : "integer", - "format" : "int32" - }, - "minTransactionFee" : { - "description" : "The minimum transaction fee in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "minDelegateBurnAmount" : { - "description" : "The amount of nano SEM required to burn for delegate registration", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - } - } - }, - "TransactionType" : { - "type" : "object", - "properties" : { - "hash" : { - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{64}$" - }, - "type" : { - "type" : "string", - "enum" : ["COINBASE", "TRANSFER", "DELEGATE", "VOTE", "UNVOTE", "CREATE", "CALL"] - }, - "from" : { - "description" : "Sender's address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "to" : { - "description" : "Recipient's address", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]{40}$" - }, - "value" : { - "description" : "Transaction value in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "fee" : { - "description" : "Transaction fee in nano SEM", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "nonce" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "timestamp" : { - "description": "Transaction timestamp in milliseconds specified by the transaction creator. There can be a time drift up to 2 hours.", - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "data" : { - "description" : "Transaction data encoded in hexadecimal string", - "type" : "string", - "pattern" : "^(0x)?[0-9a-fA-F]*$" - } - } - }, - "TransactionResultType" : { - "type" : "object", - "properties" : { - "blockNumber" : { - "type" : "string", - "format" : "int64", - "pattern" : "^\\d+$" - }, - "logs": { - "type": "array", - "items": { - "$ref": "#/definitions/LogInfoType" - } - }, - "returnData": { - "description": "Return data encoded in hexadecimal string", - "type": "string", - "pattern": "^(0x)?[0-9a-fA-F]*$" - }, - "gasUsed": { - "type": "string", - "format": "int64", - "pattern": "^\\d+$" - }, - "code": { - "description": "The status of the transaction", - "type": "string" - } - } - }, - "LogInfoType": { - "type": "object", - "properties": { - "address": { - "description": "Address encoded in hexadecimal string", - "type": "string", - "pattern": "^(0x)?[0-9a-fA-F]{64}$" - }, - "data": { - "description": "Log info data encoded in hexadecimal string", - "type": "string", - "pattern": "^(0x)?[0-9a-fA-F]*$" - }, - "topics": { - "description": "Topics encoded in hexadecimal string", - "type" : "array", - "items" : { - "type" : "string" - } - } - } - }, - "VerifyMessageResponse" : { - "type" : "object", - "required" : [ - "success" - ], - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "validSignature" : { - "description" : "Whether the signature is valid", - "type" : "boolean" + "/compose-raw-transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Compose an unsigned raw transaction", + "description": "Compose an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be signed using /sign-raw-transaction API.", + "operationId": "composeRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "network", + "in": "query", + "description": "Network name", + "required": true, + "type": "string", + "enum": [ + "MAINNET", + "TESTNET", + "DEVNET" + ] + }, + { + "name": "type", + "in": "query", + "description": "Transaction type", + "required": true, + "type": "string", + "enum": [ + "TRANSFER", + "DELEGATE", + "VOTE", + "UNVOTE" + ] + }, + { + "name": "fee", + "in": "query", + "description": "Transaction fee in nano", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "nonce", + "in": "query", + "description": "Transaction nonce", + "required": true, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "to", + "in": "query", + "description": "Recipient's address", + "required": false, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + }, + { + "name": "value", + "in": "query", + "description": "Transaction value in nano SEM", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "timestamp", + "in": "query", + "description": "Transaction timestamp in milliseconds. Default to current time.", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^\\d+$" + }, + { + "name": "data", + "in": "query", + "description": "Hexadecimal encoded transaction data.", + "required": false, + "type": "string", + "format": "int64", + "pattern": "^(0x)?[0-9a-fA-F]+$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ComposeRawTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "ComposeRawTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "The composed raw transaction encoded in hexadecimal string", - "type" : "string" + "/sign-raw-transaction": { + "get": { + "tags": [ + "semux" + ], + "summary": "Sign an unsigned raw transaction", + "description": "Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.", + "operationId": "signRawTransaction", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "raw", + "in": "query", + "description": "Unsigned raw transaction encoded in hexadecimal string.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]+$" + }, + { + "name": "address", + "in": "query", + "description": "Signer's address. This address must exist in the wallet.", + "required": true, + "type": "string", + "pattern": "^(0x)?[0-9a-fA-F]{40}$" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/SignRawTransactionResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } - } - ] - }, - "SignRawTransactionResponse" : { - "type" : "object", - "allOf" : [ - { - "$ref" : "#/definitions/ApiHandlerResponse" }, - { - "properties" : { - "result" : { - "description" : "The signed raw transaction encoded in hexadecimal string", - "type" : "string" + "/syncing": { + "get": { + "tags": [ + "semux" + ], + "summary": "Get syncing progress", + "description": "Returns an object with data about the sync status", + "operationId": "getSyncingProgress", + "produces": [ + "application/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "An object about the current sync status", + "schema": { + "$ref": "#/definitions/GetSyncingProgressResponse" + } + } + }, + "security": [ + { + "basicAuth": [] + } + ] } - } } - ] }, - "GetSyncingProgressResponse" : { - "type" : "object", - "allOf": [ - { - "$ref" : "#/definitions/ApiHandlerResponse" - }, + "produces": [ + "application/json" + ], + "schemes": [ + "http" + ], + "security": [ { - "required" : [ - "result" - ], - "properties" : { - "result" : { - "type" : "object", - "$ref" : "#/definitions/SyncingProgressType" - } - } + "basicAuth": [] } - ] - }, - "SyncingProgressType" : { - "type" : "object", - "required": [ - "syncing" - ], - "properties" : { - "syncing" : { - "description": "Whether the node is syncing", - "type": "boolean" - }, - "startingHeight" : { - "description": "The block height at which the sync started", - "type": "string", - "format": "int64", - "pattern": "^\\d+$" - }, - "currentHeight" : { - "description": "The current block height", - "type" : "string", - "format": "int64", - "pattern": "^\\d+$" - }, - "targetHeight" : { - "description": "The target block height", - "type": "string", - "format" : "int64", - "pattern": "^\\d+$" + ], + "securityDefinitions": { + "basicAuth": { + "type": "basic" } - } - } - } -} \ No newline at end of file + }, + "swagger": "2.0" +} From 0518617d31058b59db70273f8cf927f88ebc9768 Mon Sep 17 00:00:00 2001 From: semux Date: Sun, 21 Apr 2019 06:46:05 -0400 Subject: [PATCH 2/3] Docs: add v1.4.0 changelog --- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f1399a8..97a760624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,40 @@ # Change Log +## [v1.4.0](https://github.com/semuxproject/semux-core/tree/v1.4.0) (2019-04-22) + +This release includes incremental improvements and bugfixes since last version. Major changes +are the block rewards adjustment and virtual machine implementation (in place but **not activated**). + +**Bugfixes:** +- Fix the 2/3 BFT quorum size rounding error (#134, #142) +- Start syncing when the number of connections is low (#130) + +**Improvements:** +- Fast block validation using batch validation (#150) +- Add `aarch64` native support (#89, #117) +- Suggest use OpenJDK (#131) +- Update error messages and descriptions (#81, #79, #94, #103) +- Add empty password shortcut (#108) +- Update dependent libraries (#79, #141) +- Limit the number of validators on testnet (#123) + +**Features:** + +- Consensus + - Update the block reward function (#151) +- VM + - Introduce the VM fork signal (#67, #137, #139) + - Refactor transaction results (#77, #149) + - VM tests (#90, #97, #113, #114, #117, #112, #129, #140) +- Wallet + - HD wallet tests (#133, #132, #138) +- API + - Bump version to v2.2.0 + - Remove `blockNumber` from `*TransactionType` + - Add `/transaction-result` endpoint for transaction result +- P2P + - Upgrade protocol to support light client (#146) + ## [v1.3.0](https://github.com/semuxproject/semux-core/tree/v1.3.0) (2018-08-05) This release fix the validator timestamp issue and introduces fast syncing. From 79832d7cb10e0d42627c7eae6bde43c6041e5f81 Mon Sep 17 00:00:00 2001 From: semux Date: Sun, 21 Apr 2019 07:07:29 -0400 Subject: [PATCH 3/3] Tools: no need to install jdk 8 for macos for travis --- .travis.yml | 1 - .travis/macos_install_jdk8.sh | 32 -------------------------------- 2 files changed, 33 deletions(-) delete mode 100755 .travis/macos_install_jdk8.sh diff --git a/.travis.yml b/.travis.yml index 51fe80b91..0e42a4c98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,4 +54,3 @@ cache: before_install: - rm ~/.m2/settings.xml || true # remove the default settings.xml in order to use custom repos - if [ "$TRAVIS_OS_NAME" == "linux" ]; then source .travis/linux_start_xvfb.sh; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then .travis/macos_install_jdk8.sh; fi diff --git a/.travis/macos_install_jdk8.sh b/.travis/macos_install_jdk8.sh deleted file mode 100755 index 6f4d844b2..000000000 --- a/.travis/macos_install_jdk8.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -euv - -# What Java versions do we have? -/usr/libexec/java_home -V - -# Prep brew itself -brew update -brew outdated caskroom/cask/brew-cask || brew upgrade caskroom/cask/brew-cask - -# We must be able to get older Java versions than the latest. -brew tap caskroom/versions -sudo rm -rf /Library/Java/JavaVirtualMachines -brew cask install caskroom/versions/java8 - -# Fail unless we installed JDK 8 correctly. -/usr/libexec/java_home --failfast --version 1.8