232 lines
5.8 KiB
JSON
232 lines
5.8 KiB
JSON
{
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"title": "bdware/bdledger/api/ledger.proto",
|
||
"version": "version not set"
|
||
},
|
||
"tags": [
|
||
{
|
||
"name": "Ledger"
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"paths": {
|
||
"/v0/ledgers": {
|
||
"get": {
|
||
"summary": "*\nGet all ledgers\n查询所有帐本列表",
|
||
"operationId": "Ledger_GetLedgers",
|
||
"responses": {
|
||
"200": {
|
||
"description": "A successful response.",
|
||
"schema": {
|
||
"$ref": "#/definitions/apiGetLedgersResponse"
|
||
}
|
||
},
|
||
"default": {
|
||
"description": "An unexpected error response.",
|
||
"schema": {
|
||
"$ref": "#/definitions/rpcStatus"
|
||
}
|
||
}
|
||
},
|
||
"tags": [
|
||
"Ledger"
|
||
]
|
||
},
|
||
"post": {
|
||
"summary": "*\nCreate a new ledger\n创建一个新账本",
|
||
"operationId": "Ledger_CreateLedger",
|
||
"responses": {
|
||
"200": {
|
||
"description": "A successful response.",
|
||
"schema": {
|
||
"$ref": "#/definitions/apiCreateLedgerResponse"
|
||
}
|
||
},
|
||
"default": {
|
||
"description": "An unexpected error response.",
|
||
"schema": {
|
||
"$ref": "#/definitions/rpcStatus"
|
||
}
|
||
}
|
||
},
|
||
"parameters": [
|
||
{
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/apiCreateLedgerRequest"
|
||
}
|
||
}
|
||
],
|
||
"tags": [
|
||
"Ledger"
|
||
]
|
||
}
|
||
},
|
||
"/v0/ledgers/{ledger}/transactions": {
|
||
"post": {
|
||
"summary": "*\nSend a new transaction\n发送一个新事务",
|
||
"operationId": "Ledger_SendTransaction",
|
||
"responses": {
|
||
"200": {
|
||
"description": "A successful response.",
|
||
"schema": {
|
||
"$ref": "#/definitions/apiSendTransactionResponse"
|
||
}
|
||
},
|
||
"default": {
|
||
"description": "An unexpected error response.",
|
||
"schema": {
|
||
"$ref": "#/definitions/rpcStatus"
|
||
}
|
||
}
|
||
},
|
||
"parameters": [
|
||
{
|
||
"name": "ledger",
|
||
"description": "Ledger name\n账本名称",
|
||
"in": "path",
|
||
"required": true,
|
||
"type": "string"
|
||
},
|
||
{
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"transaction": {
|
||
"$ref": "#/definitions/apiSendTransactionRequestTransaction",
|
||
"title": "Transaction info\n事务信息"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"tags": [
|
||
"Ledger"
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"apiCreateLedgerRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"title": "Ledger name\n账本名称"
|
||
}
|
||
}
|
||
},
|
||
"apiCreateLedgerResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"ok": {
|
||
"type": "boolean",
|
||
"title": "Boolean value indicating if the ledger is successfully created\n是否创建成功"
|
||
}
|
||
}
|
||
},
|
||
"apiGetLedgersResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"ledgers": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"title": "List of ledger names\n帐本名称列表"
|
||
}
|
||
}
|
||
},
|
||
"apiSendTransactionRequestTransaction": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": {
|
||
"$ref": "#/definitions/apiTransactionType",
|
||
"title": "事务类型,目前仅支持通用数据记录,即type为RECORD (0)"
|
||
},
|
||
"from": {
|
||
"type": "string",
|
||
"format": "byte",
|
||
"title": "任意20字节的地址,用于区分使用同一节点的事务发起者"
|
||
},
|
||
"nonce": {
|
||
"type": "string",
|
||
"format": "uint64",
|
||
"title": "正整数,同一from每个nonce应只使用一次,防止重复的事务(可以每次发送事务+1)"
|
||
},
|
||
"to": {
|
||
"type": "string",
|
||
"format": "byte",
|
||
"title": "对于通用数据记录不需传递,无意义"
|
||
},
|
||
"data": {
|
||
"type": "string",
|
||
"format": "byte",
|
||
"title": "事务数据内容,字节数组"
|
||
}
|
||
}
|
||
},
|
||
"apiSendTransactionResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"hash": {
|
||
"type": "string",
|
||
"format": "byte",
|
||
"title": "Hash of the created transaction\n事务哈希"
|
||
}
|
||
}
|
||
},
|
||
"apiTransactionType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"RECORD",
|
||
"MESSAGE",
|
||
"CONTRACT_CREATION",
|
||
"CONTRACT_INVOCATION",
|
||
"CONTRACT_STATUS"
|
||
],
|
||
"default": "RECORD",
|
||
"description": "- RECORD: 通用数据记录\n - MESSAGE: 消息\n - CONTRACT_CREATION: 合约创建\n - CONTRACT_INVOCATION: 合约调用\n - CONTRACT_STATUS: 合约状态",
|
||
"title": "事务类型"
|
||
},
|
||
"protobufAny": {
|
||
"type": "object",
|
||
"properties": {
|
||
"@type": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"additionalProperties": {}
|
||
},
|
||
"rpcStatus": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"format": "int32"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"details": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/protobufAny"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|