UNPKG

rosetta-sdk-typescript

Version:

Typescript SDK to create and interact with Rosetta API implementations.

1,252 lines 104 kB
{ "openapi":"3.0.2", "info": { "version":"1.4.10", "title":"Rosetta", "description":"Build Once. Integrate Your Blockchain Everywhere.", "license": { "name":"Apache 2.0", "url":"http://www.apache.org/licenses/LICENSE-2.0.html" } }, "paths": { "/network/list": { "post": { "summary":"Get List of Available Networks", "description":"This endpoint returns a list of NetworkIdentifiers that the Rosetta server supports.", "operationId":"networkList", "tags": [ "Network" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/MetadataRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/NetworkListResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/network/status": { "post": { "summary":"Get Network Status", "description":"This endpoint returns the current status of the network requested. Any NetworkIdentifier returned by /network/list should be accessible here.", "operationId":"networkStatus", "tags": [ "Network" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/NetworkRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/NetworkStatusResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/network/options": { "post": { "summary":"Get Network Options", "description":"This endpoint returns the version information and allowed network-specific types for a NetworkIdentifier. Any NetworkIdentifier returned by /network/list should be accessible here. Because options are retrievable in the context of a NetworkIdentifier, it is possible to define unique options for each network.", "operationId":"networkOptions", "tags": [ "Network" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/NetworkRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/NetworkOptionsResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/block": { "post": { "summary":"Get a Block", "description":"Get a block by its Block Identifier. If transactions are returned in the same call to the node as fetching the block, the response should include these transactions in the Block object. If not, an array of Transaction Identifiers should be returned so /block/transaction fetches can be done to get all transaction information. When requesting a block by the hash component of the BlockIdentifier, this request MUST be idempotent: repeated invocations for the same hash-identified block must return the exact same block contents. No such restriction is imposed when requesting a block by height, given that a chain reorg event might cause the specific block at height `n` to be set to a different one.", "operationId":"block", "tags": [ "Block" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/BlockRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/BlockResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/block/transaction": { "post": { "summary":"Get a Block Transaction", "description":"Get a transaction in a block by its Transaction Identifier. This endpoint should only be used when querying a node for a block does not return all transactions contained within it. All transactions returned by this endpoint must be appended to any transactions returned by the /block method by consumers of this data. Fetching a transaction by hash is considered an Explorer Method (which is classified under the Future Work section). This method can be used to let consumers to paginate results when the block trasactions count is too big to be returned in a single BlockResponse. Calling this endpoint requires reference to a BlockIdentifier because transaction parsing can change depending on which block contains the transaction. For example, in Bitcoin it is necessary to know which block contains a transaction to determine the destination of fee payments. Without specifying a block identifier, the node would have to infer which block to use (which could change during a re-org). Implementations that require fetching previous transactions to populate the response (ex: Previous UTXOs in Bitcoin) may find it useful to run a cache within the Rosetta server in the /data directory (on a path that does not conflict with the node).", "operationId":"blockTransaction", "tags": [ "Block" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/BlockTransactionRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/BlockTransactionResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/mempool": { "post": { "summary":"Get All Mempool Transactions", "description":"Get all Transaction Identifiers in the mempool", "operationId":"mempool", "tags": [ "Mempool" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/NetworkRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/MempoolResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/mempool/transaction": { "post": { "summary":"Get a Mempool Transaction", "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.", "operationId":"mempoolTransaction", "tags": [ "Mempool" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/MempoolTransactionRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/MempoolTransactionResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/account/balance": { "post": { "summary":"Get an Account's Balance", "description":"Get an array of all AccountBalances for an AccountIdentifier and the BlockIdentifier at which the balance lookup was performed. The BlockIdentifier must always be returned because some consumers of account balance data need to know specifically at which block the balance was calculated to compare balances they compute from operations with the balance returned by the node. It is important to note that making a balance request for an account without populating the SubAccountIdentifier should not result in the balance of all possible SubAccountIdentifiers being returned. Rather, it should result in the balance pertaining to no SubAccountIdentifiers being returned (sometimes called the liquid balance). To get all balances associated with an account, it may be necessary to perform multiple balance requests with unique AccountIdentifiers. It is also possible to perform a historical balance lookup (if the server supports it) by passing in an optional BlockIdentifier.", "operationId":"accountBalance", "tags": [ "Account" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/AccountBalanceRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/AccountBalanceResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/account/coins": { "post": { "summary":"Get an Account's Unspent Coins", "description":"Get an array of all unspent coins for an AccountIdentifier and the BlockIdentifier at which the lookup was performed. If your implementation does not support coins (i.e. it is for an account-based blockchain), you do not need to implement this endpoint. If you implementation does support coins (i.e. it is fro a UTXO-based blockchain), you MUST also complete the `/account/balance` endpoint. It is important to note that making a coins request for an account without populating the SubAccountIdentifier should not result in the coins of all possible SubAccountIdentifiers being returned. Rather, it should result in the coins pertaining to no SubAccountIdentifiers being returned. To get all coins associated with an account, it may be necessary to perform multiple coin requests with unique AccountIdentifiers. Optionally, an implementation may choose to support updating an AccountIdentifier's unspent coins based on the contents of the mempool. Note, using this functionality breaks any guarantee of idempotency.", "operationId":"accountCoins", "tags": [ "Account" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/AccountCoinsRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/AccountCoinsResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/derive": { "post": { "summary":"Derive an AccountIdentifier from a PublicKey", "description":"Derive returns the AccountIdentifier associated with a public key. Blockchains that require an on-chain action to create an account should not implement this method.", "operationId":"constructionDerive", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionDeriveRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionDeriveResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/preprocess": { "post": { "summary":"Create a Request to Fetch Metadata", "description":"Preprocess is called prior to `/construction/payloads` to construct a request for any metadata that is needed for transaction construction given (i.e. account nonce). The `options` object returned from this endpoint will be sent to the `/construction/metadata` endpoint UNMODIFIED by the caller (in an offline execution environment). If your Construction API implementation has configuration options, they MUST be specified in the `/construction/preprocess` request (in the `metadata` field).", "operationId":"constructionPreprocess", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionPreprocessRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionPreprocessResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/metadata": { "post": { "summary":"Get Metadata for Transaction Construction", "description":"Get any information required to construct a transaction for a specific network. Metadata returned here could be a recent hash to use, an account sequence number, or even arbitrary chain state. The request used when calling this endpoint is created by calling `/construction/preprocess` in an offline environment. You should NEVER assume that the request sent to this endpoint will be created by the caller or populated with any custom parameters. This must occur in `/construction/preprocess`. It is important to clarify that this endpoint should not pre-construct any transactions for the client (this should happen in `/construction/payloads`). This endpoint is left purposely unstructured because of the wide scope of metadata that could be required.", "operationId":"constructionMetadata", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionMetadataRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionMetadataResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/payloads": { "post": { "summary":"Generate an Unsigned Transaction and Signing Payloads", "description":"Payloads is called with an array of operations and the response from `/construction/metadata`. It returns an unsigned transaction blob and a collection of payloads that must be signed by particular AccountIdentifiers using a certain SignatureType. The array of operations provided in transaction construction often times can not specify all \"effects\" of a transaction (consider invoked transactions in Ethereum). However, they can deterministically specify the \"intent\" of the transaction, which is sufficient for construction. For this reason, parsing the corresponding transaction in the Data API (when it lands on chain) will contain a superset of whatever operations were provided during construction.", "operationId":"constructionPayloads", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionPayloadsRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionPayloadsResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/combine": { "post": { "summary":"Create Network Transaction from Signatures", "description":"Combine creates a network-specific transaction from an unsigned transaction and an array of provided signatures. The signed transaction returned from this method will be sent to the `/construction/submit` endpoint by the caller.", "operationId":"constructionCombine", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionCombineRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionCombineResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/parse": { "post": { "summary":"Parse a Transaction", "description":"Parse is called on both unsigned and signed transactions to understand the intent of the formulated transaction. This is run as a sanity check before signing (after `/construction/payloads`) and before broadcast (after `/construction/combine`). ", "operationId":"constructionParse", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionParseRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionParseResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/hash": { "post": { "summary":"Get the Hash of a Signed Transaction", "description":"TransactionHash returns the network-specific transaction hash for a signed transaction.", "operationId":"constructionHash", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionHashRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/TransactionIdentifierResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/construction/submit": { "post": { "summary":"Submit a Signed Transaction", "description":"Submit a pre-signed transaction to the node. This call should not block on the transaction being included in a block. Rather, it should return immediately with an indication of whether or not the transaction was included in the mempool. The transaction submission response should only return a 200 status if the submitted transaction could be included in the mempool. Otherwise, it should return an error.", "operationId":"constructionSubmit", "tags": [ "Construction" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/ConstructionSubmitRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/TransactionIdentifierResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/call": { "post": { "summary":"Make a Network-Specific Procedure Call", "description":"Call invokes an arbitrary, network-specific procedure call with network-specific parameters. The guidance for what this endpoint should or could do is purposely left vague. In Ethereum, this could be used to invoke `eth_call` to implement an entire Rosetta API interface for some smart contract that is not parsed by the implementation creator (like a DEX). This endpoint could also be used to provide access to data that does not map to any Rosetta models instead of requiring an integrator to use some network-specific SDK and call some network-specific endpoint (like surfacing staking parameters). Call is NOT a replacement for implementing Rosetta API endpoints or mapping network-specific data to Rosetta models. Rather, it enables developers to build additional Rosetta API interfaces for things they care about without introducing complexity into a base-level Rosetta implementation. Simply put, imagine that the average integrator will use layered Rosetta API implementations that each surfaces unique data.", "operationId":"call", "tags": [ "Call" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/CallRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/CallResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/events/blocks": { "post": { "summary":"[INDEXER] Get a range of BlockEvents", "description":"`/events/blocks` allows the caller to query a sequence of BlockEvents indicating which blocks were added and removed from storage to reach the current state. Following BlockEvents allows lightweight clients to update their state without needing to implement their own syncing logic (like finding the common parent in a reorg). `/events/blocks` is considered an \"indexer\" endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta spec. However, any Rosetta \"indexer\" MUST support this endpoint.", "operationId":"eventsBlocks", "tags": [ "Events" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/EventsBlocksRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/EventsBlocksResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } }, "/search/transactions": { "post": { "summary":"[INDEXER] Search for Transactions", "description":"`/search/transactions` allows the caller to search for transactions that meet certain conditions. Some conditions include matching a transaction hash, containing an operation with a certain status, or containing an operation that affects a certain account. `/search/transactions` is considered an \"indexer\" endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta spec. However, any Rosetta \"indexer\" MUST support this endpoint.", "operationId":"searchTransactions", "tags": [ "Search" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref":"#/components/schemas/SearchTransactionsRequest" } } } }, "responses": { "200": { "description":"Expected response to a valid request", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/SearchTransactionsResponse" } } } }, "500": { "description":"unexpected error", "content": { "application/json": { "schema": { "$ref":"#/components/schemas/Error" } } } } } } } }, "components": { "schemas": { "NetworkIdentifier": { "description":"The network_identifier specifies which network a particular object is associated with.", "type":"object", "required": [ "blockchain", "network" ], "properties": { "blockchain": { "type":"string", "example":"bitcoin" }, "network": { "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.", "type":"string", "example":"mainnet" }, "sub_network_identifier": { "$ref":"#/components/schemas/SubNetworkIdentifier" } } }, "SubNetworkIdentifier": { "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.", "type":"object", "required": [ "network" ], "properties": { "network": { "type":"string", "example":"shard 1" }, "metadata": { "type":"object", "example": { "producer":"0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5" } } } }, "BlockIdentifier": { "description":"The block_identifier uniquely identifies a block in a particular network.", "type":"object", "required": [ "index", "hash" ], "properties": { "index": { "description":"This is also known as the block height.", "type":"integer", "format":"int64", "example": 1123941 }, "hash": { "type":"string", "example":"0x1f2cc6c5027d2f201a5453ad1119574d2aed23a392654742ac3c78783c071f85" } } }, "PartialBlockIdentifier": { "type":"object", "description":"When fetching data by BlockIdentifier, it may be possible to only specify the index or hash. If neither property is specified, it is assumed that the client is making a request at the current block.", "properties": { "index": { "type":"integer", "format":"int64", "example": 1123941 }, "hash": { "type":"string", "example":"0x1f2cc6c5027d2f201a5453ad1119574d2aed23a392654742ac3c78783c071f85" } } }, "TransactionIdentifier": { "description":"The transaction_identifier uniquely identifies a transaction in a particular network and block or in the mempool.", "type":"object", "required": [ "hash" ], "properties": { "hash": { "description":"Any transactions that are attributable only to a block (ex: a block event) should use the hash of the block as the identifier.", "type":"string", "example":"0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f" } } }, "OperationIdentifier": { "description":"The operation_identifier uniquely identifies an operation within a transaction.", "type":"object", "required": [ "index" ], "properties": { "index": { "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.", "type":"integer", "format":"int64", "minimum": 0, "example": 5 }, "network_index": { "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).", "type":"integer", "format":"int64", "minimum": 0, "example": 0 } } }, "AccountIdentifier": { "description":"The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated).", "type":"object", "required": [ "address" ], "properties": { "address": { "description":"The address may be a cryptographic public key (or some encoding of it) or a provided username.", "type":"string", "example":"0x3a065000ab4183c6bf581dc1e55a605455fc6d61" }, "sub_account": { "$ref":"#/components/schemas/SubAccountIdentifier" }, "metadata": { "description":"Blockchains that utilize a username model (where the address is not a derivative of a cryptographic public key) should specify the public key(s) owned by the address in metadata.", "type":"object" } } }, "SubAccountIdentifier": { "description":"An account may have state specific to a contract address (ERC-20 token) and/or a stake (delegated balance). The sub_account_identifier should specify which state (if applicable) an account instantiation refers to.", "type":"object", "required": [ "address" ], "properties": { "address": { "description":"The SubAccount address may be a cryptographic value or some other identifier (ex: bonded) that uniquely specifies a SubAccount.", "type":"string", "example":"0x6b175474e89094c44da98b954eedeac495271d0f" }, "metadata": { "description":"If the SubAccount address is not sufficient to uniquely specify a SubAccount, any other identifying information can be stored here. It is important to note that two SubAccounts with identical addresses but differing metadata will not be considered equal by clients.", "type":"object" } } }, "Block": { "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.", "type":"object", "required": [ "block_identifier", "parent_block_identifier", "timestamp", "transactions" ], "properties": { "block_identifier": { "$ref":"#/components/schemas/BlockIdentifier" }, "parent_block_identifier": { "$ref":"#/components/schemas/BlockIdentifier" }, "timestamp": { "$ref":"#/components/schemas/Timestamp" }, "transactions": { "type":"array", "items": { "$ref":"#/components/schemas/Transaction" } }, "metadata": { "type":"object", "example": { "transactions_root":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "difficulty":"123891724987128947" } } } }, "Transaction": { "description":"Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.", "type":"object", "required": [ "transaction_identifier", "operations" ], "properties": { "transaction_identifier": { "$ref":"#/components/schemas/TransactionIdentifier" }, "operations": { "type":"array", "items": { "$ref":"#/components/schemas/Operation" } }, "related_transactions": { "type":"array", "items": { "$ref":"#/components/schemas/RelatedTransaction" } }, "metadata": { "description":"Transactions that are related to other transactions (like a cross-shard transaction) should include the tranaction_identifier of these transactions in the metadata.", "type":"object", "example": { "size": 12378, "lockTime": 1582272577 } } } }, "Operation": { "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. Operations are used both to represent on-chain data (Data API) and to construct new transactions (Construction API), creating a standard interface for reading and writing to blockchains.", "type":"object", "required": [ "operation_identifier", "type" ], "properties": { "operation_identifier": { "$ref":"#/components/schemas/OperationIdentifier" }, "related_operations": { "description":"Restrict referenced related_operations to identifier indices < 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.", "type":"array", "items": { "$ref":"#/components/schemas/OperationIdentifier" }, "example": [ { "index": 1 }, { "index": 2 } ] }, "type": { "description":"Type is the network-specific type of the operation. Ensure that any type that can be returned here is also specified in the NetworkOptionsResponse. This can be very useful to downstream consumers that parse all block data.", "type":"string", "example":"Transfer" }, "status": { "description":"Status is 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 (some operations are successful and some are not). Blockchains with atomic transactions (all operations succeed or all operations fail) will have the same status for each operation. On-chain operations (operations retrieved in the `/block` and `/block/transaction` endpoints) MUST have a populated status field (anything on-chain must have succeeded or failed). However, operations provided during transaction construction (often times called \"intent\" in the documentation) MUST NOT have a populated status field (operations yet to be included on-chain have not yet succeeded or failed).", "type":"string", "example":"Reverted" }, "account": { "$ref":"#/components/schemas/AccountIdentifier" }, "amount": { "$ref":"#/components/schemas/Amount" }, "coin_change": { "$ref":"#/components/schemas/CoinChange" }, "metadata": { "type":"object", "example": { "asm":"304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd01 03301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2", "hex":"48304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd012103301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2" } } } }, "Amount": { "description":"Amount is some Value of a Currency. It is considered invalid to specify a Value without a Currency.", "type":"object", "required": [ "value", "currency" ], "properties": { "value": { "description":"Value of the transaction in atomic units represented as an arbitrary-sized signed integer. For example, 1 BTC would be represented by a value of 100000000.", "type":"string", "example":"1238089899992" }, "currency": { "$ref":"#/components/schemas/Currency" }, "metadata": { "type":"object" } } }, "Currency": { "description":"Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins).", "type":"object", "required": [ "symbol", "decimals" ], "properties": { "symbol": { "description":"Canonical symbol associated with a currency.", "type":"string", "example":"BTC" }, "decimals": { "description":"Number of decimal places in the standard unit representation of the amount. For example, BTC has 8 decimals. Note that it is not possible to represent the value of some currency in atomic units that is not base 10.", "type":"integer", "format":"int32", "minimum": 0, "example": 8 }, "metadata": { "description":"Any additional information related to the currency itself. For example, it would be useful to populate this object with the contract address of an ERC-20 token.", "type":"object", "example": { "Issuer":"Satoshi" } } } }, "SyncStatus": { "description":"SyncStatus is used to provide additional context about an implementation's sync status. This object is often used by implementations to indicate healthiness when block data cannot be queried until some sync phase completes or cannot be determined by comparing the timestamp of the most recent block with the current time.", "type":"object", "properties": { "current_index": { "description":"CurrentIndex is the index of the last synced block in the current stage. This is a separate field from current_block_identifier in NetworkStatusResponse because blocks with indices up to and including the current_index may not yet be queryable by the caller. To reiterate, all indices up to and including current_block_identifier in NetworkStatusResponse must be queryable via the /block endpoint (excluding indices less than oldest_block_identifier).", "type":"integer", "format":"int64", "example": 100 }, "target_index": { "description":"TargetIndex is the index of the block that the implementation is attempting to sync to in the current stage.", "type":"integer", "format":"int64", "example": 150 }, "stage": { "description":"Stage is the phase of the sync process.", "type":"string", "example":"header sync" }, "synced": { "description":"sycned is a boolean that indicates if an implementation has synced up to the most recent block. If this field is not populated, the caller should rely on a traditional tip timestamp comparison to determine if an implementation is synced. This field is particularly useful for quiescent blockchains (blocks only produced when there are pending transactions). In these blockchains, the most recent block could have a timestamp far behind the current time but the node could be healthy and at tip.", "type":"boolean" } } }, "Peer": { "description":"A Peer is a representation of a node's peer.", "type":"object", "required": [ "peer_id" ], "properties": { "peer_id": { "type":"string", "example":"0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5" }, "metadata": { "type":"object" } } }, "Version": { "description":"The Version object is utilized to inform the client of the versions of different components of the Rosetta implementation.", "type":"object", "required": [ "rosetta_version", "node_version" ], "properties": { "rosetta_version": { "description":"The rosetta_version is the version of the Rosetta interface the implementation adheres to. This can be useful for clients looking to reliably parse responses.", "type":"string", "example":"1.2.5" }, "node_version": { "description":"The node_version is the canonical version of the node runtime. This can help clients manage deployments.", "type":"string", "example":"1.0.2" }, "middleware_version": { "description":"When a middleware server is used to adhere to the Rosetta interface, it should return its version here. This can help clients manage deployments.", "type":"string", "example":"0.2.7" }, "metadata": { "description":"Any other information that may be useful about versioning of dependent services should be returned here.", "type":"object" } } }, "Allow": { "description":"Allow specifies supported Operation status, Operation types, and all possible error statuses. This Allow object is used by clients to validate the correctness of a Rosetta Server implementation. It is expected that these clients will error if