Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: Add getTransactions documentation #636

Merged
merged 18 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 soroban-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
22 changes: 22 additions & 0 deletions openrpc/src/examplePairingObjects/GetTransactionsPairs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"SuccessfulGetTransactionsRequest": {
"name": "Successful getTransactions Request",
"description": "Query a list of transactions starting from the given startLedger.",
"params": [
{ "$ref": "#/components/examples/GetTransactionsRequest" }
aditya1702 marked this conversation as resolved.
Show resolved Hide resolved
],
"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/GetTransactionsRequestUsingCursor" }
],
"result": {
"$ref": "#/components/examples/GetTransactionsResultUsingCursor"
}
}
}
163 changes: 163 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 returns details of a list of transactions starting from the user specified start ledger or cursor. The soroban-rpc system maintains a restricted history of recently processed transactions, with the default retention window set at 1440 ledgers, approximately equivalent to a 2-hour timeframe. For private soroban-rpc instances, it is possible to modify the retention window value by adjusting the transaction-retention-window configuration setting. Due to this limited history, clients should make sure that the requests for transactions fall within the ledger range stored by their rpc instance.",
aditya1702 marked this conversation as resolved.
Show resolved Hide resolved
"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" }
]
}
aditya1702 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Pagination": {
"EventsPagination": {
"type": "object",
"properties": {
"cursor": {
Expand Down
45 changes: 45 additions & 0 deletions openrpc/src/schemas/Transactions.json
aditya1702 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"Transactions": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Indicates whether the transaction was successful or not."
},
"applicationOrder": {
"type": "number",
"description": "The index of the transaction among all transactions included in the ledger."
aditya1702 marked this conversation as resolved.
Show resolved Hide resolved
},
"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 transaction was not successful."
},
aditya1702 marked this conversation as resolved.
Show resolved Hide resolved
"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"
}
}
}
}
16 changes: 16 additions & 0 deletions openrpc/src/schemas/TransactionsPagination.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"TransactionsPagination": {
"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."
},
"limit": {
"type": "number",
"description": "The maximum number of records returned. The limit for [getTransactions](https://developers.stellar.org/network/soroban-rpc/getTransactions) can range from 1 to 200 - an upper limit that is hardcoded in Soroban-RPC for performance reasons. If this argument isn't designated, it defaults to 50."
}
},
"required": []
}
}
Loading
Loading