From e19084121bdaf2e6cbbcba9feaa7a6922272e088 Mon Sep 17 00:00:00 2001 From: Aditya Vyas Date: Thu, 19 Dec 2024 11:54:18 +0530 Subject: [PATCH] Update RPC OpenRPC spec with P22 fields (#1136) Update rpc openAPI spec with new fields --- .../contentDescriptors/Format.json | 10 +++++ .../src/stellar-rpc/methods/getEvents.json | 7 ++++ .../stellar-rpc/methods/getVersionInfo.json | 9 ++-- .../methods/simulateTransaction.json | 16 ------- openrpc/src/stellar-rpc/schemas/Cursor.json | 5 +++ openrpc/src/stellar-rpc/schemas/Format.json | 7 ++++ static/stellar-rpc.openrpc.json | 42 +++++++++---------- 7 files changed, 52 insertions(+), 44 deletions(-) create mode 100644 openrpc/src/stellar-rpc/contentDescriptors/Format.json create mode 100644 openrpc/src/stellar-rpc/schemas/Format.json diff --git a/openrpc/src/stellar-rpc/contentDescriptors/Format.json b/openrpc/src/stellar-rpc/contentDescriptors/Format.json new file mode 100644 index 000000000..06cc1bd07 --- /dev/null +++ b/openrpc/src/stellar-rpc/contentDescriptors/Format.json @@ -0,0 +1,10 @@ +{ + "Format": { + "name": "format", + "summary": "indicates which the response format to return - json or xdr", + "description": "Lets the user choose the format in which the response should be returned - either as unpacked JSON or as base64-encoded XDR strings. Note that you should not rely on any schema for the JSON, as it will change when the underlying XDR changes.", + "schema": { + "$ref": "#/components/schemas/Format" + } + } +} diff --git a/openrpc/src/stellar-rpc/methods/getEvents.json b/openrpc/src/stellar-rpc/methods/getEvents.json index 1d6512e7a..a5e201b3a 100644 --- a/openrpc/src/stellar-rpc/methods/getEvents.json +++ b/openrpc/src/stellar-rpc/methods/getEvents.json @@ -18,6 +18,9 @@ }, { "$ref": "#/components/contentDescriptors/EventsPagination" + }, + { + "$ref": "#/components/contentDescriptors/Format" } ], "result": { @@ -33,6 +36,10 @@ "items": { "$ref": "#/components/schemas/Event" } + }, + "cursor": { + "type": "string", + "$ref": "#/components/schemas/GetEventsCursor" } } } diff --git a/openrpc/src/stellar-rpc/methods/getVersionInfo.json b/openrpc/src/stellar-rpc/methods/getVersionInfo.json index 89498455a..f163182ff 100644 --- a/openrpc/src/stellar-rpc/methods/getVersionInfo.json +++ b/openrpc/src/stellar-rpc/methods/getVersionInfo.json @@ -12,28 +12,27 @@ "schema": { "type": "object", "properties": { - "version": { "type": "string", "description": "The version of the RPC server.", "example": "21.1.0" }, - "commit_hash": { + "commitHash": { "type": "string", "description": "The commit hash of the RPC server.", "example": "fcd2f0523f04279bae4502f3e3fa00ca627e6f6a" }, - "build_time_stamp": { + "buildTimestamp": { "type": "string", "description": "The build timestamp of the RPC server.", "example": "2024-05-10T11:18:38" }, - "captive_core_version": { + "captiveCoreVersion": { "type": "string", "description": "The version of the Captive Core.", "example": "stellar-core 21.0.0.rc2 (c6f474133738ae5f6d11b07963ca841909210273)" }, - "protocol_version": { + "protocolVersion": { "type": "integer", "description": "The protocol version.", "example": 21 diff --git a/openrpc/src/stellar-rpc/methods/simulateTransaction.json b/openrpc/src/stellar-rpc/methods/simulateTransaction.json index badcd52f0..57b8f62a8 100644 --- a/openrpc/src/stellar-rpc/methods/simulateTransaction.json +++ b/openrpc/src/stellar-rpc/methods/simulateTransaction.json @@ -28,22 +28,6 @@ "type": "string", "description": "(optional) Stringified number - Recommended minimum resource fee to add when submitting the transaction. This fee is to be added on top of the [Stellar network fee](https://developers.stellar.org/docs/learn/fundamentals/fees-resource-limits-metering#inclusion-fee). Not present in case of error." }, - "cost": { - "type": "object", - "description": "(optional) - The cost object is legacy, inaccurate, and will be deprecated in future RPC releases. Please decode transactionData XDR to retrieve the correct resources.", - "deprecated": true, - "properties": { - "cpuInsns": { - "type": "string", - "description": "Stringified number - Total cpu instructions consumed by this transaction" - }, - "memBytes": { - "type": "string", - "description": "Stringified number - Total memory bytes allocated by this transaction" - } - }, - "required": [ "cpuInsns", "memBytes" ] - }, "results": { "type": "array", "description": "(optional) - This array will only have one element: the result for the Host Function invocation. Only present on successful simulation (i.e. no error) of `InvokeHostFunction` operations.", diff --git a/openrpc/src/stellar-rpc/schemas/Cursor.json b/openrpc/src/stellar-rpc/schemas/Cursor.json index 1be2d4dcb..ebf028ef8 100644 --- a/openrpc/src/stellar-rpc/schemas/Cursor.json +++ b/openrpc/src/stellar-rpc/schemas/Cursor.json @@ -3,5 +3,10 @@ "title": "cursor", "type": "string", "description": "A unique identifier (specifically, a [TOID](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0035.md#specification)) that points to a specific location in a collection of responses and is pulled from the `paging_token` value of a record. When a cursor is provided, RPC will _not_ include the element whose ID matches the cursor in the response: only elements which appear _after_ the cursor will be included." + }, + "GetEventsCursor": { + "title": "cursor", + "type": "string", + "description": "The last populated event ID if total events reach the limit or end of the search window." } } diff --git a/openrpc/src/stellar-rpc/schemas/Format.json b/openrpc/src/stellar-rpc/schemas/Format.json new file mode 100644 index 000000000..9ed44d204 --- /dev/null +++ b/openrpc/src/stellar-rpc/schemas/Format.json @@ -0,0 +1,7 @@ +{ + "Format": { + "title": "xdrFormat", + "type": "string", + "description": "A string which indicates whether the response should be decoded to json or return the base64 encoded xdr strings." + } +} diff --git a/static/stellar-rpc.openrpc.json b/static/stellar-rpc.openrpc.json index 5d56caf39..938362075 100644 --- a/static/stellar-rpc.openrpc.json +++ b/static/stellar-rpc.openrpc.json @@ -129,6 +129,16 @@ } } } + }, + { + "name": "format", + "summary": "indicates which the response format to return - json or xdr", + "description": "Lets the user choose the format in which the response should be returned - either as json or base64 encoded xdr strings.", + "schema": { + "title": "xdrFormat", + "type": "string", + "description": "A string which indicates whether the response should be decoded to json or return the base64 encoded xdr strings." + } } ], "result": { @@ -207,6 +217,11 @@ } } } + }, + "cursor": { + "title": "cursor", + "type": "string", + "description": "The last populated event ID if total events reach the limit or end of the search window." } } } @@ -1527,22 +1542,22 @@ "description": "The version of the RPC server.", "example": "21.1.0" }, - "commit_hash": { + "commitHash": { "type": "string", "description": "The commit hash of the RPC server.", "example": "fcd2f0523f04279bae4502f3e3fa00ca627e6f6a" }, - "build_time_stamp": { + "buildTimeStamp": { "type": "string", "description": "The build timestamp of the RPC server.", "example": "2024-05-10T11:18:38" }, - "captive_core_version": { + "captiveCoreVersion": { "type": "string", "description": "The version of the Captive Core.", "example": "stellar-core 21.0.0.rc2 (c6f474133738ae5f6d11b07963ca841909210273)" }, - "protocol_version": { + "protocolVersion": { "type": "integer", "description": "The protocol version.", "example": 21 @@ -1792,25 +1807,6 @@ "type": "string", "description": "(optional) Stringified number - Recommended minimum resource fee to add when submitting the transaction. This fee is to be added on top of the [Stellar network fee](https://developers.stellar.org/docs/learn/fundamentals/fees-resource-limits-metering#inclusion-fee). Not present in case of error." }, - "cost": { - "type": "object", - "description": "(optional) - The cost object is legacy, inaccurate, and will be deprecated in future RPC releases. Please decode transactionData XDR to retrieve the correct resources.", - "deprecated": true, - "required": [ - "cpuInsns", - "memBytes" - ], - "properties": { - "cpuInsns": { - "type": "string", - "description": "Stringified number - Total cpu instructions consumed by this transaction" - }, - "memBytes": { - "type": "string", - "description": "Stringified number - Total memory bytes allocated by this transaction" - } - } - }, "results": { "type": "array", "description": "(optional) - This array will only have one element: the result for the Host Function invocation. Only present on successful simulation (i.e. no error) of `InvokeHostFunction` operations.",