Skip to content

Commit

Permalink
Update RPC OpenRPC spec with P22 fields (#1136)
Browse files Browse the repository at this point in the history
Update rpc openAPI spec with new fields
  • Loading branch information
aditya1702 authored Dec 19, 2024
1 parent 88b6a1a commit e190841
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 44 deletions.
10 changes: 10 additions & 0 deletions openrpc/src/stellar-rpc/contentDescriptors/Format.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
7 changes: 7 additions & 0 deletions openrpc/src/stellar-rpc/methods/getEvents.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
},
{
"$ref": "#/components/contentDescriptors/EventsPagination"
},
{
"$ref": "#/components/contentDescriptors/Format"
}
],
"result": {
Expand All @@ -33,6 +36,10 @@
"items": {
"$ref": "#/components/schemas/Event"
}
},
"cursor": {
"type": "string",
"$ref": "#/components/schemas/GetEventsCursor"
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions openrpc/src/stellar-rpc/methods/getVersionInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions openrpc/src/stellar-rpc/methods/simulateTransaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
5 changes: 5 additions & 0 deletions openrpc/src/stellar-rpc/schemas/Cursor.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
7 changes: 7 additions & 0 deletions openrpc/src/stellar-rpc/schemas/Format.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
42 changes: 19 additions & 23 deletions static/stellar-rpc.openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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."
}
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.",
Expand Down

0 comments on commit e190841

Please sign in to comment.