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

[ANCHOR-849] Add get_transactions rpc method #1114

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 56 additions & 0 deletions openrpc/src/anchor-platform/contentDescriptors/query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"sep": {
"name": "sep",
"summary": "Sep of the transaction.",
"description": "Sep of the transaction belongs to",
"required": true,
"schema": {
"$ref": "#/components/schemas/sep"
}
},
"order_by": {
"name": "order_by",
"summary": "The field that transactions will be ordered by .",
"description": "Specifies field that transactions will be ordered by. Note, that secondary sort is transaction id in ascending value.",
"required": false,
"schema": {
"$ref": "#/components/schemas/order_by"
}
},
"order": {
"name": "order",
"summary": "The direction of ordering.",
"description": "Specifies the direction of ordering. Note, that secondary sort is transaction id in ascending value.",
"required": false,
"schema": {
"$ref": "#/components/schemas/order"
}
},
"statuses": {
"name": "statuses",
"summary": "The statuses of transactions.",
"description": "The statuses of the transaction to filter by.",
"required": false,
"schema": {
"$ref": "#/components/schemas/statuses"
}
},
"page_size": {
"name": "page_size",
"summary": "The number of transactions to return.",
"description": "The number of records to return in each page.",
"required": false,
"schema": {
"$ref": "#/components/schemas/page_size"
}
},
"page_number": {
"name": "page_number",
"summary": "The page number of transactions to return.",
"description": "Page number to use for continuous search. Page count beings at 0.",
"required": false,
"schema": {
"$ref": "#/components/schemas/page_number"
}
}
}
100 changes: 100 additions & 0 deletions openrpc/src/anchor-platform/examples/platform_transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,105 @@
"id": "creator-id"
}
}
},
"platformTransactionResponses": {
"name": "platformTransactionResponses",
"value": {
"records": [
{
"id": "1c186184-09ee-486c-82a7-aa7a0ab1119d",
"sep": "31",
"kind": "receive",
"status": "completed",
"funding_method": "SWIFT",
"amount_expected": {
"amount": "100",
"asset": "iso4217:USD"
},
"amount_in": {
"amount": "100.0000",
"asset": "iso4217:USD"
},
"amount_out": {
"amount": "98.0000000",
"asset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
},
"fee_details": {
"total": "2.0000",
"asset": "iso4217:USD"
},
"quote_id": "quote-id",
"message": "Please don't forget to foo bar",
"refunds": {
"amount_refunded": {
"amount": "90.0000",
"asset": "iso4217:USD"
},
"amount_fee": {
"amount": "8.0000",
"asset": "iso4217:USD"
},
"payments": [
{
"id": "1111",
"id_type": "stellar",
"amount": {
"amount": "50.0000",
"asset": "iso4217:USD"
},
"fee": {
"amount": "4.0000",
"asset": "iso4217:USD"
}
},
{
"id": "2222",
"id_type": "stellar",
"amount": {
"amount": "40.0000",
"asset": "iso4217:USD"
},
"fee": {
"amount": "4.0000",
"asset": "iso4217:USD"
}
}
]
},
"stellar_transactions": [
{
"id": "stellar-tx-id",
"memo": "my-memo",
"memo_type": "text",
"envelope": "here_comes_the_envelope",
"payments": [
{
"id": "payment-id",
"amount": {
"amount": "100.0000",
"asset": "iso4217:USD"
},
"payment_type": "payment",
"source_account": "GB4GJAV4Q7DPGU7WI3H5TMVKEYZJ4JFLFEF3O3TRJKDPXK7NAMRBXWFL",
"destination_account": "GDIN5ZULIOT5YPBIXJXFGNH4TCNTDKIA4ZF6QQE3S2P5P44BHCQQJNDC"
}
]
}
],
"external_transaction_id": "external-tx-id",
"customers": {
"sender": {
"id": "sender-id"
},
"receiver": {
"id": "receiver-id"
}
},
"creator": {
"id": "creator-id"
}
}
]
}
}
}
26 changes: 26 additions & 0 deletions openrpc/src/anchor-platform/examples/query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"sep31": {
"name": "sep",
"value": "31"
},
"order_by": {
"name": "order_by",
"value": "created_at"
},
"order": {
"name": "order",
"value": "asc"
},
"statuses" : {
"name": "statuses",
"value": ["completed"]
},
"page_size": {
"name": "page_size",
"value": 10
},
"page_number": {
"name": "page",
"value": 0
}
}
38 changes: 38 additions & 0 deletions openrpc/src/anchor-platform/methods/get_transactions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "get_transactions",
"summary": "Retrieve a list of transactions.",
"description": "Query a list of transactions by SEP, transaction status or other criteria.",
"paramStructure": "by-name",
"tags": [
{ "name": "SEP-6" },
{ "name": "SEP-24" },
{ "name": "SEP-31" }
],
"params": [
{ "$ref": "#/components/contentDescriptors/sep" },
{ "$ref": "#/components/contentDescriptors/order_by" },
{ "$ref": "#/components/contentDescriptors/statuses" },
{ "$ref": "#/components/contentDescriptors/page_size" },
{ "$ref": "#/components/contentDescriptors/page_number" }
],
"result": {
"name": "get_transactionResponse",
"schema": {
"$ref": "#/components/schemas/platform_transactions"
}
},
"examples": [
{
"name": "get_transactionsExample",
"description": "Example request to the `get_transactions` method.",
"params": [
{ "$ref": "#/components/examples/sep31" },
{ "$ref": "#/components/examples/order_by" },
{ "$ref": "#/components/examples/statuses" }
],
"result": {
"$ref": "#/components/examples/platformTransactionResponses"
}
}
]
}
11 changes: 11 additions & 0 deletions openrpc/src/anchor-platform/schemas/platform_transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,16 @@
"$ref": "#/components/schemas/stellar_id"
}
}
},
"platform_transactions": {
"type": "object",
"properties": {
"records": {
"type": "array",
"items": {
"$ref": "#/components/schemas/platform_transaction"
}
}
}
}
}
58 changes: 58 additions & 0 deletions openrpc/src/anchor-platform/schemas/query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"order_by": {
"title": "order_by",
"description": "The order by string used to sort the results.",
"type": "string",
"enum": [
"created_at",
"transfer_received_at",
"user_action_required_by"
],
"default": "created_at"
},
"order": {
"title": "order",
"description": "The order in which to sort the results.",
"type": "string",
"enum": ["asc", "desc"],
"default": "asc"
},
"statuses": {
"title": "status",
"description": "The statuses of the transaction to filter by.",
"type": "array",
"enum": [
"incomplete",
"completed",
"refunded",
"expired",
"error",
"pending_stellar",
"pending_external",
"pending_user_transfer_start",
"pending_user_transfer_complete",
"pending_anchor",
"pending_trust",
"pending_user",
"no_market",
"too_small",
"too_large",
"pending_sender",
"pending_receiver",
"pending_transaction_info_update",
"pending_customer_info_update"
]
},
"page_size": {
"title": "page_size",
"description": "The number of records to return in each page.",
"type": "integer",
"default": 20
},
"page_number": {
"title": "page_number",
"description": "Page number to use for continuous search. Page count beings at 0.",
"type": "integer",
"default": 0
}
}
Loading
Loading