From 2575ac4472165444ec62f6197018cd478e09cd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Tue, 17 Dec 2024 13:27:30 +0100 Subject: [PATCH] fix description in changelog and yaml. --- CHANGELOG.md | 6 ++-- .../Model/LedgerTransactionStatusFilter.cs | 4 +-- .../Handlers/DefaultTransactionHandler.cs | 4 +-- .../gateway-api-schema.yaml | 16 +++++---- .../Model/StreamTransactionsRequest.cs | 34 +++++++++---------- .../Model/StreamTransactionsRequestAllOf.cs | 34 +++++++++---------- .../Services/TransactionQuerier.cs | 4 +-- 7 files changed, 53 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a99772ba..29095a9e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ Release built: _not released yet_ ### API Changes -- Two new filters to `/stream/transactions` endpoint. - - `transaction_status_filter` - Allows filtering by transaction status (`Successful`,`Failed`, `All`). Defaults to `All`. - - `balance_change_resources_filter` - Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources. +- New filters are supported on the `/stream/transactions` endpoint: + - `transaction_status_filter` - Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. + - `balance_change_resources_filter` - Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend integrators use this instead of the `manifest_resources_filter` in most instances. ### Database changes - New entries added to the `ledger_transaction_markers` table for each resource whose balance (excluding fee-related changes) was modified in a transaction. Each resource balance change will be represented by an entry with the `resource_balance_change` discriminator and the resource's `entity_id`. diff --git a/src/RadixDlt.NetworkGateway.Abstractions/Model/LedgerTransactionStatusFilter.cs b/src/RadixDlt.NetworkGateway.Abstractions/Model/LedgerTransactionStatusFilter.cs index 40225a8fd..842e1c90f 100644 --- a/src/RadixDlt.NetworkGateway.Abstractions/Model/LedgerTransactionStatusFilter.cs +++ b/src/RadixDlt.NetworkGateway.Abstractions/Model/LedgerTransactionStatusFilter.cs @@ -66,7 +66,7 @@ namespace RadixDlt.NetworkGateway.Abstractions.Model; public enum LedgerTransactionStatusFilter { - Successful, - Failed, + Success, + Failure, All, } diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs index d65bf9323..a82dc6747 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs @@ -174,8 +174,8 @@ public DefaultTransactionHandler( var statusFilter = request.TransactionStatusFilter switch { - GatewayModel.StreamTransactionsRequest.TransactionStatusFilterEnum.Successful => LedgerTransactionStatusFilter.Successful, - GatewayModel.StreamTransactionsRequest.TransactionStatusFilterEnum.Failed => LedgerTransactionStatusFilter.Failed, + GatewayModel.StreamTransactionsRequest.TransactionStatusFilterEnum.Success => LedgerTransactionStatusFilter.Success, + GatewayModel.StreamTransactionsRequest.TransactionStatusFilterEnum.Failure => LedgerTransactionStatusFilter.Failure, _ => LedgerTransactionStatusFilter.All, }; diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index f13b99315..4567526df 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -619,7 +619,7 @@ tags: * `manifest_accounts_deposited_into_filter` - Similar to withdrawn, but will return only transactions with a manifest containing deposits to the given accounts. - * `manifest_resources_filter` - Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). + * `manifest_resources_filter` - Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. * `manifest_badges_presented_filter` - Allows specifying array of badge resource addresses. If specified, the response will contain only transactions where the given badges were presented. @@ -635,6 +635,10 @@ tags: * `events_filter` - Filters the transaction stream to transactions which emitted at least one event matching each filter (each filter can be satisfied by a different event). Currently *only* deposit and withdrawal events emitted by an internal vault entity are tracked. For the purpose of filtering, the emitter address is replaced by the global ancestor of the emitter, for example, the top-level account / component which contains the vault which emitted the event. + * `balance_change_resources_filter` - Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. + + * `transaction_status_filter` - Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. + Each filter is a complex object where you can specify: - `event` (required) - the event tag. Currently only the following tags are supported: * `{"event": "Withdrawal"}` - Filters to "Withdraw" events from fungible and non-fungible vaults @@ -4317,7 +4321,7 @@ components: items: $ref: "#/components/schemas/Address" manifest_resources_filter: - description: Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). + description: Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. type: array items: $ref: "#/components/schemas/Address" @@ -4358,17 +4362,17 @@ components: items: $ref: "#/components/schemas/Address" balance_change_resources_filter: - description: Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources. + description: Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. type: array items: $ref: "#/components/schemas/Address" transaction_status_filter: - description: Allows filtering by transaction status. Defaults to `All`. + description: Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. type: string default: All enum: - - Successful - - Failed + - Success + - Failure - All order: description: Configures the order of returned result set. Defaults to `desc`. diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequest.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequest.cs index dee8c6c5f..d4df78d9b 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequest.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequest.cs @@ -130,23 +130,23 @@ public enum KindFilterEnum [DataMember(Name = "kind_filter", EmitDefaultValue = true)] public KindFilterEnum? KindFilter { get; set; } /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. [JsonConverter(typeof(StringEnumConverter))] public enum TransactionStatusFilterEnum { /// - /// Enum Successful for value: Successful + /// Enum Success for value: Success /// - [EnumMember(Value = "Successful")] - Successful = 1, + [EnumMember(Value = "Success")] + Success = 1, /// - /// Enum Failed for value: Failed + /// Enum Failure for value: Failure /// - [EnumMember(Value = "Failed")] - Failed = 2, + [EnumMember(Value = "Failure")] + Failure = 2, /// /// Enum All for value: All @@ -158,9 +158,9 @@ public enum TransactionStatusFilterEnum /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. [DataMember(Name = "transaction_status_filter", EmitDefaultValue = true)] public TransactionStatusFilterEnum? TransactionStatusFilter { get; set; } /// @@ -202,15 +202,15 @@ public enum OrderEnum /// Allows specifying an array of account addresses. If specified, the response will contain only transactions with a manifest containing withdrawals from the given accounts.. /// Similar to `manifest_accounts_withdrawn_from_filter`, but will return only transactions with a manifest containing deposits to the given accounts.. /// Allows specifying array of badge resource addresses. If specified, the response will contain only transactions where the given badges were presented.. - /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage).. + /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest.. /// Allows specifying an array of global addresses. If specified, the response will contain transactions that affected all of the given global entities. A global entity is marked as \"affected\" by a transaction if any of its state (or its descendents' state) was modified as a result of the transaction. For performance reasons consensus manager and transaction tracker are excluded from that filter.. /// Filters the transaction stream to transactions which emitted at least one event matching each filter (each filter can be satisfied by a different event). Currently *only* deposit and withdrawal events emitted by an internal vault entity are tracked. For the purpose of filtering, the emitter address is replaced by the global ancestor of the emitter, for example, the top-level account / component which contains the vault which emitted the event.. /// Allows specifying an array of account addresses. If specified, the response will contain only transactions that, for all specified accounts, contain manifest method calls to that account which require the owner role. See the [account docs](https://docs.radixdlt.com/docs/account) for more information.. /// Allows specifying an array of account addresses. If specified, the response will contain only transactions that, for all specified accounts, do NOT contain manifest method calls to that account which require owner role. See the [account docs](https://docs.radixdlt.com/docs/account) for more information.. /// manifestClassFilter. /// Allows specifying an array of global addresses. If specified, the response will contain transactions in which all entities emitted events. If an event was published by an internal entity, it is going to be indexed as it is a global ancestor. For performance reasons events published by consensus manager and native XRD resource are excluded from that filter.. - /// Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources.. - /// Allows filtering by transaction status. Defaults to `All`. (default to TransactionStatusFilterEnum.All). + /// Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest.. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. (default to TransactionStatusFilterEnum.All). /// Configures the order of returned result set. Defaults to `desc`.. /// optIns. public StreamTransactionsRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), LedgerStateSelector fromLedgerState = default(LedgerStateSelector), string cursor = default(string), int? limitPerPage = default(int?), KindFilterEnum? kindFilter = default(KindFilterEnum?), List manifestAccountsWithdrawnFromFilter = default(List), List manifestAccountsDepositedIntoFilter = default(List), List manifestBadgesPresentedFilter = default(List), List manifestResourcesFilter = default(List), List affectedGlobalEntitiesFilter = default(List), List eventsFilter = default(List), List accountsWithManifestOwnerMethodCalls = default(List), List accountsWithoutManifestOwnerMethodCalls = default(List), StreamTransactionsRequestAllOfManifestClassFilter manifestClassFilter = default(StreamTransactionsRequestAllOfManifestClassFilter), List eventGlobalEmittersFilter = default(List), List balanceChangeResourcesFilter = default(List), TransactionStatusFilterEnum? transactionStatusFilter = TransactionStatusFilterEnum.All, OrderEnum? order = default(OrderEnum?), TransactionDetailsOptIns optIns = default(TransactionDetailsOptIns)) @@ -284,9 +284,9 @@ public enum OrderEnum public List ManifestBadgesPresentedFilter { get; set; } /// - /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). + /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. /// - /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). + /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. [DataMember(Name = "manifest_resources_filter", EmitDefaultValue = true)] public List ManifestResourcesFilter { get; set; } @@ -332,9 +332,9 @@ public enum OrderEnum public List EventGlobalEmittersFilter { get; set; } /// - /// Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources. + /// Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. /// - /// Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources. + /// Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. [DataMember(Name = "balance_change_resources_filter", EmitDefaultValue = true)] public List BalanceChangeResourcesFilter { get; set; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequestAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequestAllOf.cs index 6a1cb0d81..1fc91df9a 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequestAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/StreamTransactionsRequestAllOf.cs @@ -130,23 +130,23 @@ public enum KindFilterEnum [DataMember(Name = "kind_filter", EmitDefaultValue = true)] public KindFilterEnum? KindFilter { get; set; } /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. [JsonConverter(typeof(StringEnumConverter))] public enum TransactionStatusFilterEnum { /// - /// Enum Successful for value: Successful + /// Enum Success for value: Success /// - [EnumMember(Value = "Successful")] - Successful = 1, + [EnumMember(Value = "Success")] + Success = 1, /// - /// Enum Failed for value: Failed + /// Enum Failure for value: Failure /// - [EnumMember(Value = "Failed")] - Failed = 2, + [EnumMember(Value = "Failure")] + Failure = 2, /// /// Enum All for value: All @@ -158,9 +158,9 @@ public enum TransactionStatusFilterEnum /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. /// - /// Allows filtering by transaction status. Defaults to `All`. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. [DataMember(Name = "transaction_status_filter", EmitDefaultValue = true)] public TransactionStatusFilterEnum? TransactionStatusFilter { get; set; } /// @@ -198,15 +198,15 @@ public enum OrderEnum /// Allows specifying an array of account addresses. If specified, the response will contain only transactions with a manifest containing withdrawals from the given accounts.. /// Similar to `manifest_accounts_withdrawn_from_filter`, but will return only transactions with a manifest containing deposits to the given accounts.. /// Allows specifying array of badge resource addresses. If specified, the response will contain only transactions where the given badges were presented.. - /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage).. + /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest.. /// Allows specifying an array of global addresses. If specified, the response will contain transactions that affected all of the given global entities. A global entity is marked as \"affected\" by a transaction if any of its state (or its descendents' state) was modified as a result of the transaction. For performance reasons consensus manager and transaction tracker are excluded from that filter.. /// Filters the transaction stream to transactions which emitted at least one event matching each filter (each filter can be satisfied by a different event). Currently *only* deposit and withdrawal events emitted by an internal vault entity are tracked. For the purpose of filtering, the emitter address is replaced by the global ancestor of the emitter, for example, the top-level account / component which contains the vault which emitted the event.. /// Allows specifying an array of account addresses. If specified, the response will contain only transactions that, for all specified accounts, contain manifest method calls to that account which require the owner role. See the [account docs](https://docs.radixdlt.com/docs/account) for more information.. /// Allows specifying an array of account addresses. If specified, the response will contain only transactions that, for all specified accounts, do NOT contain manifest method calls to that account which require owner role. See the [account docs](https://docs.radixdlt.com/docs/account) for more information.. /// manifestClassFilter. /// Allows specifying an array of global addresses. If specified, the response will contain transactions in which all entities emitted events. If an event was published by an internal entity, it is going to be indexed as it is a global ancestor. For performance reasons events published by consensus manager and native XRD resource are excluded from that filter.. - /// Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources.. - /// Allows filtering by transaction status. Defaults to `All`. (default to TransactionStatusFilterEnum.All). + /// Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest.. + /// Allows filtering by the transaction commit status (`Success`,`Failure`, `All`). Defaults to `All`. (default to TransactionStatusFilterEnum.All). /// Configures the order of returned result set. Defaults to `desc`.. /// optIns. public StreamTransactionsRequestAllOf(KindFilterEnum? kindFilter = default(KindFilterEnum?), List manifestAccountsWithdrawnFromFilter = default(List), List manifestAccountsDepositedIntoFilter = default(List), List manifestBadgesPresentedFilter = default(List), List manifestResourcesFilter = default(List), List affectedGlobalEntitiesFilter = default(List), List eventsFilter = default(List), List accountsWithManifestOwnerMethodCalls = default(List), List accountsWithoutManifestOwnerMethodCalls = default(List), StreamTransactionsRequestAllOfManifestClassFilter manifestClassFilter = default(StreamTransactionsRequestAllOfManifestClassFilter), List eventGlobalEmittersFilter = default(List), List balanceChangeResourcesFilter = default(List), TransactionStatusFilterEnum? transactionStatusFilter = TransactionStatusFilterEnum.All, OrderEnum? order = default(OrderEnum?), TransactionDetailsOptIns optIns = default(TransactionDetailsOptIns)) @@ -250,9 +250,9 @@ public enum OrderEnum public List ManifestBadgesPresentedFilter { get; set; } /// - /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). + /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. /// - /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). + /// Allows specifying array of resource addresses. If specified, the response will contain only transactions containing the given resources in the manifest (regardless of their usage). We recommend that integrators use `balance_change_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. [DataMember(Name = "manifest_resources_filter", EmitDefaultValue = true)] public List ManifestResourcesFilter { get; set; } @@ -298,9 +298,9 @@ public enum OrderEnum public List EventGlobalEmittersFilter { get; set; } /// - /// Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources. + /// Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. /// - /// Allows specifying an array of resources. If specified, the response will contain transactions which included non-fee related balance changes for all resources. + /// Allows filtering to transactions which included non-fee related balance changes for all provided resources. Defaults to `[]`. We recommend that integrators use this instead of the `manifest_resources_filter` in most cases, as it also captures resource changes that are not specified in the manifest. [DataMember(Name = "balance_change_resources_filter", EmitDefaultValue = true)] public List BalanceChangeResourcesFilter { get; set; } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs index 5e8345f02..46b090a8f 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs @@ -190,8 +190,8 @@ public async Task GetTransactionStream(TransactionS var searchQuery = request.SearchCriteria.Status switch { LedgerTransactionStatusFilter.All => baseQuery.Select(lt => lt.StateVersion), - LedgerTransactionStatusFilter.Successful => baseQuery.Where(x => x.ReceiptStatus == LedgerTransactionStatus.Succeeded).Select(lt => lt.StateVersion), - LedgerTransactionStatusFilter.Failed => baseQuery.Where(x => x.ReceiptStatus == LedgerTransactionStatus.Failed).Select(lt => lt.StateVersion), + LedgerTransactionStatusFilter.Success => baseQuery.Where(x => x.ReceiptStatus == LedgerTransactionStatus.Succeeded).Select(lt => lt.StateVersion), + LedgerTransactionStatusFilter.Failure => baseQuery.Where(x => x.ReceiptStatus == LedgerTransactionStatus.Failed).Select(lt => lt.StateVersion), _ => throw new NotSupportedException($"Not supported status: {request.SearchCriteria.Status}"), };