fix: separate out rosetta request/response schema files from entity files

Several schema files referenced entity files in the docs/api/rosetta
directory.  They entity files have all been moved to docs/entities/rosetta
and references updated.
This commit is contained in:
Asim Mehmood
2020-08-28 21:09:47 +05:00
committed by Matthew Little
parent 09e373b3f9
commit bd4dc86493
36 changed files with 274 additions and 379 deletions

View File

@@ -13,8 +13,7 @@
"$ref": "./../../entities/rosetta/rosetta-account.schema.json"
},
"block_identifier": {
"$ref": "./../../entities/rosetta/rosetta-block-identifier.schema.json"
"$ref": "./../../entities/rosetta/rosetta-partial-block-identifier.schema.json"
}
},
"additionalProperties": true
}
}

View File

@@ -1,24 +0,0 @@
{
"network_identifier": {
"blockchain": "bitcoin",
"network": "mainnet",
"sub_network_identifier": {
"network": "shard 1",
"metadata": {
"producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
}
}
},
"account_identifier": {
"address": "0x3a065000ab4183c6bf581dc1e55a605455fc6d61",
"sub_account": {
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"metadata": {}
},
"metadata": {}
},
"block_identifier": {
"index": 1123941,
"hash": "0x1f2cc6c5027d2f201a5453ad1119574d2aed23a392654742ac3c78783c071f85"
}
}

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rosetta-account",
"$id": "rosetta-account-response",
"type": "object",
"title": "RosettaAccountBalanceResponse",
"description": "An AccountBalanceResponse is returned on the /account/balance endpoint. If an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on a few smart contracts), an account balance request must be made with each AccountIdentifier.",

View File

@@ -1,17 +0,0 @@
{
"$id": "rosetta-block-identifier.schema.json",
"type": "object",
"title": "RosettaBlockIdentifier",
"description": "The block_identifier uniquely identifies a block in a particular network.",
"required": ["index", "hash"],
"properties": {
"index": {
"type": "integer",
"description": "This is also known as the block height."
},
"hash": {
"type": "string",
"description": "Block hash"
}
}
}

View File

@@ -3,14 +3,14 @@
"$id": "rosetta-block-request",
"type": "object",
"title": "RosettaBlockRequest",
"description": "A MempoolTransactionRequest is utilized to retrieve a transaction from the mempool.",
"description": "A BlockRequest is utilized to make a block request on the /block endpoint.",
"required": ["network_identifier", "block_identifier"],
"properties": {
"network_identifier": {
"$ref": "./../../entities/rosetta/rosetta-network-identifier.schema.json"
},
"block_identifier": {
"$ref": "./../../entities/rosetta/rosetta-block-identifier.schema.json"
"$ref": "./../../entities/rosetta/rosetta-partial-block-identifier.schema.json"
}
}
}

View File

@@ -7,13 +7,13 @@
"required": [],
"properties": {
"block": {
"$ref": "./rosetta-block.schema.json"
"$ref": "./../../entities/rosetta/rosetta-block.schema.json"
},
"other_transactions": {
"type": "array",
"description": "Some blockchains may require additional transactions to be fetched that weren't returned in the block response (ex: block only returns transaction hashes). For blockchains with a lot of transactions in each block, this can be very useful as consumers can concurrently fetch all transactions returned.",
"items": {
"$ref": "./rosetta-other-transaction-identifier.schema.json"
"$ref": "./../../entities/rosetta/rosetta-other-transaction-identifier.schema.json"
}
}
}

View File

@@ -13,7 +13,7 @@
"$ref": "./../../entities/rosetta/rosetta-block-identifier.schema.json"
},
"transaction_identifier": {
"$ref": "./rosetta-transaction-identifier.schema.json"
"$ref": "./../../entities/rosetta/rosetta-transaction-identifier.schema.json"
}
}
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rosetta-block-transaction-response",
"type": "object",
"title": "RosettaBlockTransactionResponse",
"description": "A BlockTransactionResponse contains information about a block transaction.",
"required": ["transaction"],
"properties": {
"transaction": {
"$ref": "./../../entities/rosetta/rosetta-transaction.schema.json"
}
}
}

View File

@@ -1,43 +0,0 @@
{
"$id": "rosetta-block.schema.json",
"type": "object",
"title": "RosettaBlock",
"description": "Blocks contain an array of Transactions that occurred at a particular BlockIdentifier. A hard requirement for blocks returned by Rosetta implementations is that they MUST be inalterable: once a client has requested and received a block identified by a specific BlockIndentifier, all future calls for that same BlockIdentifier must return the same block contents.",
"required": ["block_identifier", "parent_block_identifier", "timestamp", "transactions"],
"properties": {
"block_identifier": {
"$ref": "./rosetta-block-identifier.schema.json"
},
"parent_block_identifier": {
"$ref": "./rosetta-parent-block-identifier.schema.json"
},
"timestamp": {
"type": "integer",
"description": "The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in milliseconds because some blockchains produce blocks more often than once a second."
},
"transactions": {
"type": "array",
"description": "All the transactions in the block",
"additionalItems": true,
"items": {
"$ref": "./rosetta-transaction.schema.json"
}
},
"metadata": {
"type": "object",
"description": "meta data",
"required": ["transactions_root", "difficulty"],
"properties": {
"transactions_root": {
"type": "string",
"description": ""
},
"difficulty": {
"type": "string",
"description": ""
}
},
"additionalProperties": true
}
}
}

View File

@@ -1,24 +0,0 @@
{
"type": "object",
"title": "RosettaCoinChange",
"description": "CoinChange is used to represent a change in state of a some coin identified by a coin_identifier. This object is part of the Operation model and must be populated for UTXO-based blockchains. Coincidentally, this abstraction of UTXOs allows for supporting both account-based transfers and UTXO-based transfers on the same blockchain (when a transfer is account-based, don't populate this model).",
"required": ["coin_identifier", "coin_action"],
"properties": {
"coin_identifier": {
"type": "object",
"description": "CoinIdentifier uniquely identifies a Coin.",
"required": ["identifier"],
"properties": {
"identifier": {
"type": "string",
"description": "Identifier should be populated with a globally unique identifier of a Coin. In Bitcoin, this identifier would be transaction_hash:index."
}
}
},
"coin_action": {
"type": "string",
"description": "CoinActions are different state changes that a Coin can undergo. When a Coin is created, it is coin_created. When a Coin is spent, it is coin_spent. It is assumed that a single Coin cannot be created or spent more than once.",
"enum": ["coin_created", "coin_spent"]
}
}
}

View File

@@ -1,15 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "RosettaMempoolTransactionRequest",
"description": "Get a transaction in the mempool by its Transaction Identifier. This is a separate request than fetching a block transaction (/block/transaction) because some blockchain nodes need to know that a transaction query is for something in the mempool instead of a transaction in a block. Transactions may not be fully parsable until they are in a block (ex: may not be possible to determine the fee to pay before a transaction is executed). On this endpoint, it is ok that returned transactions are only estimates of what may actually be included in a block.",
"required": ["network_identifier", "transaction_identifier"],
"title": "RosettaMempoolTransactionListRequest",
"description": "Get all Transaction Identifiers in the mempool",
"required": ["network_identifier"],
"properties": {
"network_identifier": {
"$ref": "./rosetta-network-identifier.schema.json"
"description": "The network_identifier specifies which network a particular object is associated with.",
"$ref": "./../../entities/rosetta/rosetta-network-identifier.schema.json"
},
"transaction_identifier": {
"$ref": "./rosetta-transaction-identifier.schema.json"
"metadata": {
"type": "object"
}
}
}

View File

@@ -2,16 +2,14 @@
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "RosettaMempoolTransactionListResponse",
"description": "The root schema comprises the entire JSON document.",
"required": [
"transaction_identifiers"
],
"description": "A MempoolResponse contains all transaction identifiers in the mempool for a particular network_identifier.",
"required": ["transaction_identifiers"],
"properties": {
"transaction_identifiers": {
"type": "array",
"description": "An explanation about the purpose of this instance.",
"description": "",
"items": {
"$ref": "./rosetta-transaction-identifier.schema.json"
"$ref": "./../../entities/rosetta/rosetta-transaction-identifier.schema.json"
}
},
"metadata": {
@@ -33,4 +31,4 @@
}
}
}
}
}

View File

@@ -10,7 +10,7 @@
"$ref": "./../../entities/rosetta/rosetta-network-identifier.schema.json"
},
"transaction_identifier": {
"$ref": "./rosetta-transaction-identifier.schema.json"
"$ref": "./../../entities/rosetta/rosetta-transaction-identifier.schema.json"
}
}
}

View File

@@ -6,26 +6,22 @@
"required": ["transaction"],
"properties": {
"transaction": {
"$ref": "./rosetta-transaction.schema.json"
"$ref": "./../../entities/rosetta/rosetta-transaction.schema.json"
},
"metadata": {
"type": "object",
"description": "An explanation about the purpose of this instance.",
"required": ["descendant_fees", "ancestor_count"],
"description": "",
"required": [],
"properties": {
"descendant_fees": {
"$id": "#/properties/metadata/properties/descendant_fees",
"type": "integer",
"description": "An explanation about the purpose of this instance."
"description": ""
},
"ancestor_count": {
"$id": "#/properties/metadata/properties/ancestor_count",
"type": "integer",
"description": "An explanation about the purpose of this instance."
"description": ""
}
},
"additionalProperties": true
}
}
},
"additionalProperties": true
}
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "NetworkIdentifier",
"description": "The network_identifier specifies which network a particular object is associated with.",
"required": ["blockchain", "network"],
"properties": {
"blockchain": {
"type": "string",
"description": "Blockchain name"
},
"network": {
"type": "string",
"description": "If a blockchain has a specific chain-id or network identifier, it should go in this field. It is up to the client to determine which network-specific identifier is mainnet or testnet."
},
"sub_network_identifier": {
"$id": "#/properties/network_identifier/properties/sub_network_identifier",
"type": "object",
"description": "In blockchains with sharded state, the SubNetworkIdentifier is required to query some object on a specific shard. This identifier is optional for all non-sharded blockchains.",
"required": ["network"],
"properties": {
"network": {
"$id": "#/properties/network_identifier/properties/sub_network_identifier/properties/network",
"type": "string",
"description": "Netowork name"
},
"metadata": {
"$id": "#/properties/network_identifier/properties/sub_network_identifier/properties/metadata",
"type": "object",
"description": "Meta data from subnetwork identifier",
"required": ["producer"],
"properties": {
"producer": {
"$id": "#/properties/network_identifier/properties/sub_network_identifier/properties/metadata/properties/producer",
"type": "string",
"description": "producer",
"default": "",
"examples": ["0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"]
}
},
"additionalProperties": true
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rosetta-network-options",
"$id": "rosetta-network-options-response",
"type": "object",
"title": "RosettaNetworkOptionsResponse",
"description": "NetworkOptionsResponse contains information about the versioning of the node and the allowed operation statuses, operation types, and errors.",

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "Rosetta-options-request",
"$id": "Rosetta-status-request",
"type": "object",
"title": "RosettaStatusRequest",
"description": "This endpoint returns the current status of the network requested. Any NetworkIdentifier returned by /network/list should be accessible here.",
@@ -10,7 +10,9 @@
"$ref": "../../entities/rosetta/rosetta-network-identifier.schema.json"
},
"metadata": {
"type": "object"
"type": "object",
"description": "",
"required": []
}
}
}

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rosetta-network-status.schema.json",
"$id": "rosetta-network-status-response.schema.json",
"type": "object",
"title": "RosettaNetworkStatusResponse",
"description": "NetworkStatusResponse contains basic information about the node's view of a blockchain network. It is assumed that any BlockIdentifier.Index less than or equal to CurrentBlockIdentifier.Index can be queried. If a Rosetta implementation prunes historical state, it should populate the optional oldest_block_identifier field with the oldest block available to query. If this is not populated, it is assumed that the genesis_block_identifier is the oldest queryable block. If a Rosetta implementation performs some pre-sync before it is possible to query blocks, sync_status should be populated so that clients can still monitor healthiness. Without this field, it may appear that the implementation is stuck syncing and needs to be terminated.",

View File

@@ -1,16 +0,0 @@
{
"type": "object",
"title": "RosettaOperationIdentifier",
"description": "The operation_identifier uniquely identifies an operation within a transaction.",
"required": ["index"],
"properties": {
"index": {
"type": "integer",
"description": "The operation index is used to ensure each operation has a unique identifier within a transaction. This index is only relative to the transaction and NOT GLOBAL. The operations in each transaction should start from index 0. To clarify, there may not be any notion of an operation index in the blockchain being described."
},
"network_index": {
"type": "integer",
"description": "Some blockchains specify an operation index that is essential for client use. For example, Bitcoin uses a network_index to identify which UTXO was used in a transaction. network_index should not be populated if there is no notion of an operation index in a blockchain (typically most account-based blockchains)."
}
}
}

View File

@@ -1,51 +0,0 @@
{
"type": "object",
"title": "RosettaOperation",
"description": "Operations contain all balance-changing information within a transaction. They are always one-sided (only affect 1 AccountIdentifier) and can succeed or fail independently from a Transaction.",
"required": ["operation_identifier", "type", "status"],
"properties": {
"operation_identifier": {
"description": "The operation_identifier uniquely identifies an operation within a transaction.",
"$ref": "./rosetta-operation-identifier.schema.json"
},
"related_operations": {
"type": "array",
"description": "Restrict referenced related_operations to identifier indexes < the current operation_identifier.index. This ensures there exists a clear DAG-structure of relations. Since operations are one-sided, one could imagine relating operations in a single transfer or linking operations in a call tree.",
"items": {
"$ref": "./rosetta-related-operation.schema.json"
}
},
"type": {
"type": "string",
"description": "The network-specific type of the operation. Ensure that any type that can be returned here is also specified in the NetworkStatus. This can be very useful to downstream consumers that parse all block data."
},
"status": {
"type": "string",
"description": "The network-specific status of the operation. Status is not defined on the transaction object because blockchains with smart contracts may have transactions that partially apply. Blockchains with atomic transactions (all operations succeed or all operations fail) will have the same status for each operation."
},
"account": {
"$ref": "./../../entities/rosetta/rosetta-account.schema.json"
},
"amount": {
"$ref": "./../../entities/rosetta/rosetta-amount.schema.json"
},
"coin_change": {
"$ref": "./rosetta-coin-change.schema.json"
},
"metadata": {
"type": "object",
"description": "Operations Meta Data",
"required": ["asm", "hex"],
"properties": {
"asm": {
"type": "string",
"description": "The asm"
},
"hex": {
"type": "string",
"description": "The hex"
}
}
}
}
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "OtherTransactionIdentifier",
"description": "The transaction_identifier uniquely identifies a transaction in a particular network and block or in the mempool.",
"required": ["hash"],
"properties": {
"hash": {
"type": "string",
"description": "Any transactions that are attributable only to a block (ex: a block event) should use the hash of the block as the identifier."
}
}
}

View File

@@ -1,16 +0,0 @@
{
"type": "object",
"title": "RosettaParentBlockIdentifier",
"description": "The block_identifier uniquely identifies a block in a particular network.",
"required": ["index", "hash"],
"properties": {
"index": {
"type": "integer",
"description": "This is also known as the block height."
},
"hash": {
"type": "string",
"description": "Block hash"
}
}
}

View File

@@ -1,16 +0,0 @@
{
"title": "RosettaRelatedOperation",
"type": "object",
"description": "Restrict referenced related_operations to identifier indexes < the current operation_identifier.index. This ensures there exists a clear DAG-structure of relations. Since operations are one-sided, one could imagine relating operations in a single transfer or linking operations in a call tree.",
"required": ["operation_identifier"],
"properties": {
"index": {
"type": "integer",
"description": "Describes the index of related operation."
},
"operation_identifier": {
"description": "The operation_identifier uniquely identifies an operation within a transaction.",
"$ref": "./rosetta-operation-identifier.schema.json"
}
}
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "TransactionIdentifier",
"description": "The transaction_identifier uniquely identifies a transaction in a particular network and block or in the mempool.",
"required": ["hash"],
"properties": {
"hash": {
"type": "string",
"description": "Any transactions that are attributable only to a block (ex: a block event) should use the hash of the block as the identifier."
}
}
}

View File

@@ -1,35 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "RosettaTransaction",
"description": "Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.",
"required": ["transaction_identifier", "operations"],
"properties": {
"transaction_identifier": {
"$ref": "./rosetta-transaction-identifier.schema.json"
},
"operations": {
"type": "array",
"description": "List of operations",
"items": {
"$ref": "./rosetta-operation.schema.json"
}
},
"metadata": {
"type": "object",
"description": "Transactions that are related to other transactions (like a cross-shard transaction) should include the tranaction_identifier of these transactions in the metadata.",
"required": ["size", "lockTime"],
"properties": {
"size": {
"type": "integer",
"description": "The Size"
},
"lockTime": {
"type": "integer",
"description": "The locktime"
}
},
"additionalProperties": true
}
}
}