Skip to content

Commit

Permalink
rpc: Add getTransactions documentation (#636)
Browse files Browse the repository at this point in the history
* Add getTransactions documenation - 1

* Add getTransactions documentation - 2

* Add getTransactions documentation - 4

* Refactor Pagination changes

* Refactor the params object in getTransactions examples

* Change naming to only RPC

* Change description of diagnosticEventsXdr

* Add "items"

* Update openrpc/src/methods/getTransactions.json

Co-authored-by: George <Shaptic@users.noreply.github.com>

* Update openrpc/src/schemas/Cursor.json

Co-authored-by: George <Shaptic@users.noreply.github.com>

* Update openrpc/src/schemas/Pagination.json

Co-authored-by: George <Shaptic@users.noreply.github.com>

* Small changes - 1

* Remove links - 1

* Remove links - 2

* Fix broken TOID link

---------

Co-authored-by: George <Shaptic@users.noreply.github.com>
  • Loading branch information
aditya1702 and Shaptic authored Jun 14, 2024
1 parent c961713 commit 7b235e8
Show file tree
Hide file tree
Showing 11 changed files with 624 additions and 11 deletions.
8 changes: 8 additions & 0 deletions network/soroban-rpc/api-reference/methods/getTransactions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
hide_title: true
description: Returns list of transactions
---

import { RpcMethod } from "@site/src/components/RpcMethod";

<RpcMethod method="getTransactions" platform="soroban" />
13 changes: 11 additions & 2 deletions openrpc/src/contentDescriptors/Pagination.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"Pagination": {
"EventsPagination": {
"name": "pagination",
"summary": "pagination options",
"description": "Pagination in soroban-rpc is similar to pagination in Horizon. See [Pagination](https://developers.stellar.org/network/soroban-rpc/pagination).",
"required": false,
"schema": {
"$ref": "#/components/schemas/Pagination"
"$ref": "#/components/schemas/EventsPagination"
}
},
"TransactionsPagination": {
"name": "pagination",
"summary": "pagination options",
"description": "Pagination in RPC is similar to pagination in Horizon. See [Pagination](https://developers.stellar.org/network/soroban-rpc/pagination).",
"required": false,
"schema": {
"$ref": "#/components/schemas/TransactionsPagination"
}
}
}
2 changes: 1 addition & 1 deletion openrpc/src/contentDescriptors/StartLedger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"StartLedger": {
"name": "startLedger",
"summary": "ledger to begin searching from",
"description": "Ledger sequence number to fetch events after (inclusive). This method will return an error if `startLedger` is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request, `startLedger` must be omitted.",
"description": "Ledger sequence number to start fetching responses from (inclusive). This method will return an error if `startLedger` is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request, `startLedger` must be omitted.",
"required": true,
"schema": {
"$ref": "#/components/schemas/LedgerSequence"
Expand Down
23 changes: 23 additions & 0 deletions openrpc/src/examplePairingObjects/GetTransactionsPairs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"SuccessfulGetTransactionsRequest": {
"name": "Successful getTransactions Request",
"description": "Query a list of transactions starting from the given startLedger.",
"params": [
{ "$ref": "#/components/examples/GetTransactionsStartLedger" },
{ "$ref": "#/components/examples/GetTransactionsPagination" }
],
"result": {
"$ref": "#/components/examples/GetTransactionsResult"
}
},
"SuccessfulGetTransactionsRequestUsingCursor": {
"name": "Successful getTransactions Request Using Cursor",
"description": "Query a list of transactions starting from the given cursor.",
"params": [
{ "$ref": "#/components/examples/GetTransactionsPaginationWithCursor" }
],
"result": {
"$ref": "#/components/examples/GetTransactionsResultUsingCursor"
}
}
}
162 changes: 162 additions & 0 deletions openrpc/src/examples/Transactions.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openrpc/src/methods/getEvents.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"$ref": "#/components/contentDescriptors/EventFilters"
},
{
"$ref": "#/components/contentDescriptors/Pagination"
"$ref": "#/components/contentDescriptors/EventsPagination"
}
],
"result": {
Expand Down
47 changes: 47 additions & 0 deletions openrpc/src/methods/getTransactions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "getTransactions",
"summary": "returns a list of transactions with their details",
"description": "The `getTransactions` method return a detailed list of transactions starting from the user specified starting point that you can paginate as long as the pages fall within the history retention of their corresponding RPC provider.",
"externalDocs": {
"url": "https://developers.stellar.org/network/soroban-rpc/api-reference/methods/getTransactions"
},
"paramStructure": "by-name",
"params": [
{
"$ref": "#/components/contentDescriptors/StartLedger"
},
{
"$ref": "#/components/contentDescriptors/TransactionsPagination"
}
],
"result": {
"name": "getTransactionsResult",
"schema": {
"type": "object",
"properties": {
"transactions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Transactions"
}
},
"latestLedger": {
"$ref": "#/components/schemas/LatestLedger"
},
"latestLedgerCloseTime": {
"$ref": "#/components/schemas/LatestLedgerCloseTime"
},
"oldestLedger": {
"$ref": "#/components/schemas/OldestLedger"
},
"oldestLedgerCloseTime": {
"$ref": "#/components/schemas/OldestLedgerCloseTime"
}
}
}
},
"examples": [
{ "$ref": "#/components/examplePairingObjects/SuccessfulGetTransactionsRequest" },
{ "$ref": "#/components/examplePairingObjects/SuccessfulGetTransactionsRequestUsingCursor" }
]
}
7 changes: 7 additions & 0 deletions openrpc/src/schemas/Cursor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Cursor": {
"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."
}
}
20 changes: 16 additions & 4 deletions openrpc/src/schemas/Pagination.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
{
"Pagination": {
"EventsPagination": {
"type": "object",
"properties": {
"cursor": {
"type": "string",
"description": "A string ID 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 Soroban-RPC will _not_ include the element whose id matches the cursor in the response. Only elements which appear _after_ the cursor are included."
"$ref": "#/components/schemas/Cursor"
},
"limit": {
"type": "number",
"description": "The maximum number of records returned. The limit for [getEvents](https://developers.stellar.org/network/soroban-rpc/getEvents) can range from 1 to 10000 - an upper limit that is hardcoded in Soroban-RPC for performance reasons. If this argument isn't designated, it defaults to 100."
"description": "The maximum number of records returned. The limit for getEvents can range from 1 to 10000 - an upper limit that is hardcoded in Soroban-RPC for performance reasons. If this argument isn't designated, it defaults to 100."
}
},
"required": []
},
"TransactionsPagination": {
"type": "object",
"properties": {
"cursor": {
"$ref": "#/components/schemas/Cursor"
},
"limit": {
"type": "number",
"description": "The maximum number of records returned. For getTransactions, this ranges from 1 to 200 and defaults to 50."
}
},
"required": []
Expand Down
48 changes: 48 additions & 0 deletions openrpc/src/schemas/Transactions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"Transactions": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Indicates whether the transaction was successful or not."
},
"applicationOrder": {
"type": "number",
"description": "The 1-based index of the transaction among all transactions included in the ledger."
},
"feeBump": {
"type": "boolean",
"description": "Indicates whether the transaction was fee bumped."
},
"envelopeXdr": {
"type": "string",
"description": "A base64 encoded string of the raw TransactionEnvelope XDR struct for this transaction."
},
"resultXdr": {
"type": "string",
"description": "A base64 encoded string of the raw TransactionResult XDR struct for this transaction."
},
"resultMetaXdr": {
"type": "string",
"description": "A base64 encoded string of the raw TransactionMeta XDR struct for this transaction."
},
"diagnosticEventsXdr": {
"type": "array",
"description": "(optional) A base64 encoded slice of xdr.DiagnosticEvent. This is only present if the `ENABLE_SOROBAN_DIAGNOSTIC_EVENTS` has been enabled in the stellar-core config.",
"items": {
"type": "string"
}
},
"ledger": {
"title": "ledger",
"description": "The sequence number of the ledger which included the transaction.",
"$ref": "#/components/schemas/LedgerSequence"
},
"ledgerCloseTime": {
"title": "createdAt",
"description": "The unix timestamp of when the transaction was included in the ledger.",
"$ref": "#/components/schemas/LedgerCloseTime"
}
}
}
}
Loading

0 comments on commit 7b235e8

Please sign in to comment.