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_transaction rpc method #1112

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@
"schema": {
"$ref": "#/components/schemas/transaction_id"
}
},
"id": {
"name": "id",
"summary": "ID of the transaction.",
"description": "The unique identifier of this transaction.",
"required": true,
"schema": {
"$ref": "#/components/schemas/transaction_id"
}
}
}
4 changes: 4 additions & 0 deletions openrpc/src/anchor-platform/examples/datetime.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"name": "datetime",
"value": "2023-08-04T10:04:06.280923Z"
},
"created_at": {
"name": "created_at",
"value": "2023-08-04T10:04:06.280923Z"
},
"started_at": {
"name": "started_at",
"value": "2023-08-04T10:04:06.280923Z"
Expand Down
97 changes: 97 additions & 0 deletions openrpc/src/anchor-platform/examples/platform_transaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"platformTransactionResponse": {
"name": "platformTransactionResponse",
"value": {
"id": "1c186184-09ee-486c-82a7-aa7a0ab1119d",
"sep": "31",
"kind": "receive",
"status": "completed",
"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\u0027t 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"
}
}
}
}
4 changes: 4 additions & 0 deletions openrpc/src/anchor-platform/examples/transaction_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"external_transaction_id": {
"name": "external_transaction_id",
"value": "3320c6faad48c3cf39b6d4ac15ed50b6e5868b62551e69cde15df2d66c8ca360"
},
"id": {
"name": "id",
"value": "1c186184-09ee-486c-82a7-aa7a0ab1119d"
}
}
32 changes: 32 additions & 0 deletions openrpc/src/anchor-platform/methods/get_transaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "get_transaction",
"summary": "Retrieve a transaction.",
"description": "Retrieve a transaction by its ID.",
"paramStructure": "by-name",
"tags": [
{ "name": "SEP-6" },
{ "name": "SEP-24" },
{ "name": "SEP-31" }
],
"params": [
{ "$ref": "#/components/contentDescriptors/id" }
],
"result": {
"name": "get_transactionResponse",
"schema": {
"$ref": "#/components/schemas/platform_transaction"
}
},
"examples": [
{
"name": "get_transactionExample",
"description": "Example request to the `get_transaction` method.",
"params": [
{ "$ref": "#/components/examples/id" }
],
"result": {
"$ref": "#/components/examples/platformTransactionResponse"
}
}
]
}
12 changes: 12 additions & 0 deletions openrpc/src/anchor-platform/schemas/account.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"source_account": {
"title": "source_account",
"description":"The account being debited in the Stellar Network.",
"type": "string"
},
"destination_account": {
"title": "destination_account",
"description":"The account being credited in the Stellar Network.",
"type": "string"
}
}
21 changes: 21 additions & 0 deletions openrpc/src/anchor-platform/schemas/customer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"stellar_id": {

"description": "A object that identify end-user. \nFor a SEP-12 customer, the `id` field should be sufficient to fully identify the customer in the business' Backend. \nFor a SEP-31 Sending Anchor, the `account` and `memo` fields should be used. \nFor a SEP-6 or SEP-24 Anchor, the `account` and `memo` fields should be used.",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The `id` of the customer registered through SEP-12."
},
"account": {
"type": "string",
"description": "Either the Stellar account or Muxed account address of the on-chain entity."
},
"memo": {
"type": "string",
"description": "The memo value identifying a customer with a shared account, where the shared account is `account`."
}
}
}
}
5 changes: 5 additions & 0 deletions openrpc/src/anchor-platform/schemas/datetime.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"description": "A date and time.",
"type": "string"
},
"created_at": {
"title": "created_at",
"description": "The date and time when the transaction is created.",
"$ref": "#/components/schemas/datetime"
},
"started_at": {
"title": "started_at",
"description": "Start date and time of transaction.",
Expand Down
12 changes: 12 additions & 0 deletions openrpc/src/anchor-platform/schemas/memo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"memo": {
"title": "memo",
"type": "string"
},
"memo_type": {
"title": "memo_type",
"description": "The memo type of the transaction in the Stellar network. Should be present if memo is not null.",
"type": "string",
"enum": ["id", "hash", "text"]
}
}
105 changes: 105 additions & 0 deletions openrpc/src/anchor-platform/schemas/platform_transaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"platform_transaction": {
JiahuiWho marked this conversation as resolved.
Show resolved Hide resolved
"title": "Platform Transaction",
"description": "A platform transaction object",
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/transaction_id"
},
"sep": {
"$ref": "#/components/schemas/sep"
},
"kind": {
"$ref": "#/components/schemas/kind"
},
"status": {
"$ref": "#/components/schemas/status"
},
"amount_expected": {
JiahuiWho marked this conversation as resolved.
Show resolved Hide resolved
"$ref": "#/components/schemas/amount_expected"
},
"amount_in": {
"$ref": "#/components/schemas/amount_in"
},
"amount_out": {
"$ref": "#/components/schemas/amount_out"
},
"fee_details": {
"$ref": "#/components/schemas/fee_details"
},
"quote_id": {
"$ref": "#/components/schemas/quote_id"
},
"started_at": {
"$ref": "#/components/schemas/started_at"
},
"updated_at": {
"$ref": "#/components/schemas/updated_at"
},
"completed_at": {
"$ref": "#/components/schemas/completed_at"
},
"transfer_received_at": {
"$ref": "#/components/schemas/transfer_received_at"
},
JiahuiWho marked this conversation as resolved.
Show resolved Hide resolved
"message": {
"description": "Human readable explanation of transaction status",
"$ref": "#/components/schemas/message"
},
"refunds": {
"$ref": "#/components/schemas/refunds"
},
"stellar_transactions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/stellar_transaction"
}
},
"source_account": {
"$ref": "#/components/schemas/source_account"
},
"destination_account": {
"$ref": "#/components/schemas/destination_account"
},
"external_transaction_id": {
"$ref": "#/components/schemas/transaction_id"
},
"memo": {
"$ref": "#/components/schemas/memo"
},
"memo_type": {
"$ref": "#/components/schemas/memo_type"
},
"refund_memo": {
"$ref": "#/components/schemas/memo"
},
"refund_memo_type": {
"$ref": "#/components/schemas/memo_type"
},
"client_domain": {
"description": "The domain of the client.",
"type": "string"
},
"client_name": {
"description": "The domain of the client.",
"type": "string"
},
"customers": {
"description": "The Identification info of the sending and receiving customers. If they were created through [SEP-12](https://stellar.org/protocol/sep-12),\n this object should contain the SEP-12 customer `id`. Otherwise, the `account` address of the customer.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can this be moved to customer.json?

"type": "object",
"properties": {
"sender": {
"$ref": "#/components/schemas/stellar_id"
},
"receiver": {
"$ref": "#/components/schemas/stellar_id"
}
}
},
"creator": {
"$ref": "#/components/schemas/stellar_id"
}
}
}
}
41 changes: 41 additions & 0 deletions openrpc/src/anchor-platform/schemas/stellar_transaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"stellar_transaction": {
"title": "stellar_transaction",
"type": "object",
"properties": {
"id": { "$ref": "#/components/schemas/StellarHash" },
"memo": {"$ref": "#/components/schemas/memo" },
"memo_type": {"$ref": "#/components/schemas/memo_type" },
"created_at": {"$ref": "#/components/schemas/created_at" },
"envelop" : {
"description": "The transaction envelope, containing all the transaction information.",
"type": "string"
},
"payments": {
"type": "array",
"items": {
"properties": {
"id": {
"description":" The ID of the payment in the Stellar Network.",
"type": "string"
},
"payment_type": {
"description":" The ID of the payment in the Stellar Network.",
"type": "string",
"enum": [
"payment",
"path_payment"
],
"default": "payment"
},
"source_account": {"$ref": "#/components/schemas/source_account"},
"destination_account": { "$ref": "#/components/schemas/destination_account" },
"amount": { "$ref": "#/components/schemas/AmountObjectString" }
},
"required": ["id", "payment_type", "source_account", "destination_account", "amount"]
}
}
},
"required": ["id", "created_at", "envelope", "payments"]
}
}
2 changes: 1 addition & 1 deletion openrpc/src/anchor-platform/schemas/transaction.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"StellarHash": {
"title": "hash",
"description": "The Stellar transaction hash of the transaction that included the refund payment.",
"description": "The Stellar transaction hash.",
"type": "string"
},
"kind": {
Expand Down
Loading
Loading