diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fce4fb99..bf3426db3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Release built: _not released yet_ - `/extensions/entities-by-role-requirement/page` – allows querying and paginating by a single requirement. - The `manifest_classes` of the transaction manifest in the `/stream/transactions` endpoint have been adjusted slightly. Notably: - The `General` classification has been expanded to permit validator stake/unstake/claim actions and pool contribute and redeem actions. +- Added a new endpoint `/extensions/implicit-requirements/lookup` for resolving implicit access rule requirements (https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements). ### 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`. @@ -22,9 +23,12 @@ Release built: _not released yet_ - New `outer_object_entity_id` column in the `entities` table, which holds the outer object entity id (e.g resource entity id for vaults and consensus manager entity id for validators). - New `receipt_event_emitter_entity_ids` column in the `ledger_transaction_events` table, which holds the emitter entity ids for transaction events. - Added a new `entities_by_role_requirement_entry_definition` table that stores information about entities that have ever used a requirement (resource or non-fungible global ID) in their access rules. +- Added a new `implicit_requirements` table to store data necessary for resolving implicit access rule requirements. ### What’s new? - Added a new configuration parameter, `GatewayApi__Endpoint__EntitiesByRoleRequirementLookupMaxRequestedRequirementsCount`, which sets the limit (default `50`) on the number of requirements that can be queried using the `/extensions/entities-by-role-requirement/lookup` endpoint. +- Added a new configuration parameter, `GatewayApi__Endpoint__ImplicitRequirementsLookupMaxRequestedRequirementsCount`, which sets the limit (default `100`) on the number of implicit requirements that can be queried using the `/extensions/implicit-requirements/lookup` endpoint. + ## 1.9.2 Release built: 9.12.2024 diff --git a/Directory.Packages.props b/Directory.Packages.props index ed55e3595..1418c81b8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,7 +17,6 @@ - diff --git a/apps/DataAggregator/packages.lock.json b/apps/DataAggregator/packages.lock.json index d1894a199..a6199963a 100644 --- a/apps/DataAggregator/packages.lock.json +++ b/apps/DataAggregator/packages.lock.json @@ -458,27 +458,6 @@ "Newtonsoft.Json": "12.0.1" } }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Npgsql": { "type": "Transitive", "resolved": "8.0.2", @@ -635,7 +614,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -831,16 +809,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Npgsql.EntityFrameworkCore.PostgreSQL": { "type": "CentralTransitive", "requested": "[8.0.2, )", diff --git a/apps/DatabaseMigrations/packages.lock.json b/apps/DatabaseMigrations/packages.lock.json index 0714293b2..7b18a6e50 100644 --- a/apps/DatabaseMigrations/packages.lock.json +++ b/apps/DatabaseMigrations/packages.lock.json @@ -391,27 +391,6 @@ "System.CodeDom": "4.4.0" } }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Npgsql": { "type": "Transitive", "resolved": "8.0.2", @@ -568,7 +547,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -756,16 +734,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Npgsql.EntityFrameworkCore.PostgreSQL": { "type": "CentralTransitive", "requested": "[8.0.2, )", diff --git a/apps/GatewayApi/Controllers/ExtensionsController.cs b/apps/GatewayApi/Controllers/ExtensionsController.cs index 7593fbf4f..555aa05ef 100644 --- a/apps/GatewayApi/Controllers/ExtensionsController.cs +++ b/apps/GatewayApi/Controllers/ExtensionsController.cs @@ -81,14 +81,20 @@ public class ExtensionsController(IExtensionsHandler extensionsHandler) : Contro } [HttpPost("entities-by-role-requirement/page")] - public async Task ResourceHoldersPage(GatewayModel.EntitiesByRoleRequirementPageRequest request, CancellationToken token) + public async Task EntitiesByRoleRequirementPage(GatewayModel.EntitiesByRoleRequirementPageRequest request, CancellationToken token) { return await extensionsHandler.EntitiesByRoleRequirementPage(request, token); } [HttpPost("entities-by-role-requirement/lookup")] - public async Task ResourceHoldersLookup(GatewayModel.EntitiesByRoleRequirementLookupRequest request, CancellationToken token) + public async Task EntitiesByRoleRequirementLookup(GatewayModel.EntitiesByRoleRequirementLookupRequest request, CancellationToken token) { return await extensionsHandler.EntitiesByRoleRequirementLookup(request, token); } + + [HttpPost("implicit-requirements/lookup")] + public async Task ImplicitRequirementsLookup(GatewayModel.ImplicitRequirementsLookupRequest request, CancellationToken token) + { + return await extensionsHandler.ImplicitRequirementsLookup(request, token); + } } diff --git a/apps/GatewayApi/Controllers/StatusController.cs b/apps/GatewayApi/Controllers/StatusController.cs index 76b23a27a..7ee2c0f51 100644 --- a/apps/GatewayApi/Controllers/StatusController.cs +++ b/apps/GatewayApi/Controllers/StatusController.cs @@ -91,9 +91,9 @@ public StatusController(IStatusHandler statusHandler, INetworkConfigurationProvi } [HttpPost("network-configuration")] - public async Task NetworkConfiguration(CancellationToken token) + public GatewayModel.NetworkConfigurationResponse NetworkConfiguration() { - var networkConfiguration = await _networkConfigurationProvider.GetNetworkConfiguration(token); + var networkConfiguration = _networkConfigurationProvider.GetNetworkConfiguration(); var wellKnownAddresses = networkConfiguration.WellKnownAddresses; return new GatewayModel.NetworkConfigurationResponse( diff --git a/apps/GatewayApi/OpenApiDocumentHandler.cs b/apps/GatewayApi/OpenApiDocumentHandler.cs index ea1b4cb52..3de6b835a 100644 --- a/apps/GatewayApi/OpenApiDocumentHandler.cs +++ b/apps/GatewayApi/OpenApiDocumentHandler.cs @@ -127,8 +127,11 @@ public static async Task Handle( response = OptionalReplace(response, "", placeholderReplacements.NetworkId?.ToString()); response = OptionalReplace(response, "", placeholderReplacements.NetworkName); response = OptionalReplace(response, "", placeholderReplacements.SamplePreviewTransactionHex); - response = OptionalReplace(response, "", placeholderReplacements.SampleRequirementNonFungibleId); response = OptionalReplace(response, "", placeholderReplacements.SampleRequirementResourceAddress); + response = OptionalReplace(response, "", placeholderReplacements.SampleRequirementNonFungibleId); + response = OptionalReplace(response, "", placeholderReplacements.SampleImplicitRequirementResourceAddress); + response = OptionalReplace(response, "", placeholderReplacements.SampleImplicitRequirementNonFungibleId); + await context.Response.WriteAsync(response, Encoding.UTF8, token); } @@ -178,6 +181,10 @@ private class PlaceholderReplacements public string? SampleRequirementResourceAddress { get; set; } public string? SampleRequirementNonFungibleId { get; set; } + + public string? SampleImplicitRequirementResourceAddress { get; set; } + + public string? SampleImplicitRequirementNonFungibleId { get; set; } } private static async Task GetPlaceholderReplacementsAsync( @@ -186,7 +193,7 @@ private static async Task GetPlaceholderReplacementsAsy CancellationToken token) { var placeholderReplacements = new PlaceholderReplacements(); - var networkConfiguration = await networkConfigurationProvider.GetNetworkConfiguration(token); + var networkConfiguration = networkConfigurationProvider.GetNetworkConfiguration(); try { @@ -208,6 +215,8 @@ private static async Task GetPlaceholderReplacementsAsy placeholderReplacements.CommittedSubintentHash = placeholderData.RandomSubintentHash; placeholderReplacements.SampleRequirementResourceAddress = placeholderData.RequirementResourceAddress; placeholderReplacements.SampleRequirementNonFungibleId = placeholderData.RequirementNonFungibleId; + placeholderReplacements.SampleImplicitRequirementResourceAddress = networkConfiguration.WellKnownAddresses.GlobalCallerVirtualBadge; + placeholderReplacements.SampleImplicitRequirementNonFungibleId = placeholderData.SampleImplicitRequirementGlobalCallerEntityHash; placeholderReplacements.SamplePreviewTransactionHex = GenerateRandomPreviewTransactionHex(networkConfiguration.Id, (ulong?)placeholderData.CurrentEpoch); } catch (Exception) diff --git a/apps/GatewayApi/packages.lock.json b/apps/GatewayApi/packages.lock.json index 5f5f298cb..e000c2f2b 100644 --- a/apps/GatewayApi/packages.lock.json +++ b/apps/GatewayApi/packages.lock.json @@ -490,27 +490,6 @@ "Newtonsoft.Json": "12.0.1" } }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Npgsql": { "type": "Transitive", "resolved": "8.0.2", @@ -693,7 +672,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -889,16 +867,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Npgsql.EntityFrameworkCore.PostgreSQL": { "type": "CentralTransitive", "requested": "[8.0.2, )", diff --git a/src/RadixDlt.CoreApiSdk/Model/UserLedgerTransactionV2.cs b/src/RadixDlt.CoreApiSdk/Model/UserLedgerTransactionV2.cs new file mode 100644 index 000000000..8b968c4ca --- /dev/null +++ b/src/RadixDlt.CoreApiSdk/Model/UserLedgerTransactionV2.cs @@ -0,0 +1,74 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using System; + +namespace RadixDlt.CoreApiSdk.Model; + +public partial class UserLedgerTransactionV2 +{ + private byte[] _payloadBytes; + + public byte[] GetPayloadBytes() => _payloadBytes ??= Convert.FromHexString(PayloadHex); +} diff --git a/src/RadixDlt.NetworkGateway.Abstractions/Model/ImplicitRequirementType.cs b/src/RadixDlt.NetworkGateway.Abstractions/Model/ImplicitRequirementType.cs new file mode 100644 index 000000000..306c4bad7 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.Abstractions/Model/ImplicitRequirementType.cs @@ -0,0 +1,74 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +namespace RadixDlt.NetworkGateway.Abstractions.Model; + +public enum ImplicitRequirementType +{ + PackageOfDirectCaller, + GlobalCallerEntity, + GlobalCallerBlueprint, + Ed25519PublicKey, + Secp256k1PublicKey, +} diff --git a/src/RadixDlt.NetworkGateway.Abstractions/Model/QueriedImplicitRequirementType.cs b/src/RadixDlt.NetworkGateway.Abstractions/Model/QueriedImplicitRequirementType.cs new file mode 100644 index 000000000..de299c7c7 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.Abstractions/Model/QueriedImplicitRequirementType.cs @@ -0,0 +1,73 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +namespace RadixDlt.NetworkGateway.Abstractions.Model; + +public enum QueriedImplicitRequirementType +{ + PackageOfDirectCaller, + GlobalCaller, + Ed25519PublicKey, + Secp256k1PublicKey, +} diff --git a/src/RadixDlt.NetworkGateway.Abstractions/Network/INetworkConfigurationProvider.cs b/src/RadixDlt.NetworkGateway.Abstractions/Network/INetworkConfigurationProvider.cs index 6202be1e2..8f70d9f7f 100644 --- a/src/RadixDlt.NetworkGateway.Abstractions/Network/INetworkConfigurationProvider.cs +++ b/src/RadixDlt.NetworkGateway.Abstractions/Network/INetworkConfigurationProvider.cs @@ -63,9 +63,10 @@ */ using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Nito.AsyncEx; +using Polly; using RadixDlt.NetworkGateway.Abstractions.Configuration; using RadixDlt.NetworkGateway.Abstractions.CoreCommunications; using RadixDlt.NetworkGateway.Abstractions.Extensions; @@ -80,16 +81,17 @@ namespace RadixDlt.NetworkGateway.Abstractions.Network; public interface INetworkConfigurationProvider { - public Task GetNetworkConfiguration(CancellationToken token = default); + public NetworkConfiguration GetNetworkConfiguration(); } -public sealed class NetworkConfigurationProvider : INetworkConfigurationProvider +public sealed class NetworkConfigurationProvider : IHostedService, INetworkConfigurationProvider { private readonly ILogger _logger; private readonly NetworkOptions _networkOptions; private readonly IServiceProvider _serviceProvider; private readonly IEnumerable _observers; - private readonly AsyncLazy _factory; + + private NetworkConfiguration? _networkConfiguration; public NetworkConfigurationProvider( IOptions networkOptions, @@ -101,15 +103,32 @@ public NetworkConfigurationProvider( _serviceProvider = serviceProvider; _observers = observers; _logger = logger; - _factory = new AsyncLazy(ReadNetworkConfiguration, AsyncLazyFlags.RetryOnFailure); } - public Task GetNetworkConfiguration(CancellationToken token = default) + public NetworkConfiguration GetNetworkConfiguration() + { + if (_networkConfiguration == null) + { + throw new Exception("Network configuration is not available."); + } + + return _networkConfiguration; + } + + public async Task StartAsync(CancellationToken cancellationToken) + { + var policy = Policy.Handle() + .WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))); + + await policy.ExecuteAsync(async () => _networkConfiguration = await ReadNetworkConfiguration(cancellationToken)); + } + + public Task StopAsync(CancellationToken cancellationToken) { - return _factory.Task; + return Task.CompletedTask; } - private async Task ReadNetworkConfiguration() + private async Task ReadNetworkConfiguration(CancellationToken cancellationToken) { using var scope = _serviceProvider.CreateScope(); var coreApiNode = scope.ServiceProvider.GetRequiredService>().CurrentValue.CoreApiNodes.GetRandomEnabledNode(); @@ -118,8 +137,8 @@ private async Task ReadNetworkConfiguration() try { - var configuration = await coreApiProvider.StatusApi.StatusNetworkConfigurationPostAsync(); - var status = await coreApiProvider.StatusApi.StatusNetworkStatusPostAsync(new CoreModel.NetworkStatusRequest(_networkOptions.NetworkName)); + var configuration = await coreApiProvider.StatusApi.StatusNetworkConfigurationPostAsync(cancellationToken); + var status = await coreApiProvider.StatusApi.StatusNetworkStatusPostAsync(new CoreModel.NetworkStatusRequest(_networkOptions.NetworkName), cancellationToken); var addressTypeDefinitions = new List(); @@ -214,7 +233,6 @@ string GetHrpPrefix(AddressEntityType entityType) catch (Exception ex) { await _observers.ForEachAsync(x => x.GetNetworkConfigurationFailed(coreApiProvider.CoreApiNode.Name, ex)); - throw; } } diff --git a/src/RadixDlt.NetworkGateway.Abstractions/RadixDlt.NetworkGateway.Abstractions.csproj b/src/RadixDlt.NetworkGateway.Abstractions/RadixDlt.NetworkGateway.Abstractions.csproj index 15c772c69..461a36fad 100644 --- a/src/RadixDlt.NetworkGateway.Abstractions/RadixDlt.NetworkGateway.Abstractions.csproj +++ b/src/RadixDlt.NetworkGateway.Abstractions/RadixDlt.NetworkGateway.Abstractions.csproj @@ -5,7 +5,6 @@ - diff --git a/src/RadixDlt.NetworkGateway.Abstractions/ServiceCollectionExtensions.cs b/src/RadixDlt.NetworkGateway.Abstractions/ServiceCollectionExtensions.cs index 4f9011e24..de9c4d708 100644 --- a/src/RadixDlt.NetworkGateway.Abstractions/ServiceCollectionExtensions.cs +++ b/src/RadixDlt.NetworkGateway.Abstractions/ServiceCollectionExtensions.cs @@ -77,9 +77,16 @@ public static IServiceCollection AddNetworkGatewayAbstractions(this IServiceColl return services; } - public static IServiceCollection AddNetworkGatewayCoreServices(this IServiceCollection services) + public static IServiceCollection AddNetworkConfigurationProvider(this IServiceCollection services) { - services.TryAddSingleton(); + // NetworkConfigurationProvider is registered as a HostedService as we want to fetch network configuration on app startup using the `StartAsync()` method. + // NetworkConfigurationProvider is registered as singleton as we want to reuse fetched network configuration once it's fetched. + // To provide better separation it's also registered as INetworkConfigurationProvider (no need to share NetworkConfigurationProvider which contains also HostedService methods). + // https://stackoverflow.com/questions/58397807/how-to-resolve-hostedservice-in-controller + + services.AddSingleton(); + services.AddSingleton(serviceProvider => serviceProvider.GetRequiredService()); + services.AddHostedService(serviceProvider => serviceProvider.GetRequiredService()); return services; } diff --git a/src/RadixDlt.NetworkGateway.Abstractions/packages.lock.json b/src/RadixDlt.NetworkGateway.Abstractions/packages.lock.json index b334a4d15..6176a079e 100644 --- a/src/RadixDlt.NetworkGateway.Abstractions/packages.lock.json +++ b/src/RadixDlt.NetworkGateway.Abstractions/packages.lock.json @@ -53,16 +53,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "Direct", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "StyleCop.Analyzers": { "type": "Direct", "requested": "[1.2.0-beta.556, )", @@ -308,27 +298,6 @@ "resolved": "8.0.0", "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Polly.Core": { "type": "Transitive", "resolved": "8.3.0", @@ -339,11 +308,6 @@ "resolved": "1.2.0.556", "contentHash": "zvn9Mqs/ox/83cpYPignI8hJEM2A93s2HkHs8HYMOAQW0PkampyoErAiIyKxgTLqbbad29HX/shv/6LGSjPJNQ==" }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "1.7.1", - "contentHash": "B43Zsz5EfMwyEbnObwRxW5u85fzJma3lrDeGcSAV1qkhSRTNY5uXAByTn9h9ddNdhM+4/YoLc/CI43umjwIl9Q==" - }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", "resolved": "8.0.0", diff --git a/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/NetworkStatusReader.cs b/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/NetworkStatusReader.cs index 2df1fc6f3..ac5a271c1 100644 --- a/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/NetworkStatusReader.cs +++ b/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/NetworkStatusReader.cs @@ -95,7 +95,7 @@ public NetworkStatusReader( { return await _coreApiProvider.StatusApi.StatusNetworkStatusPostAsync( new CoreModel.NetworkStatusRequest( - network: (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name + network: _networkConfigurationProvider.GetNetworkConfiguration().Name ), token ); diff --git a/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/TransactionStreamReader.cs b/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/TransactionStreamReader.cs index 167aca666..63b6035e2 100644 --- a/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/TransactionStreamReader.cs +++ b/src/RadixDlt.NetworkGateway.DataAggregator/NodeServices/ApiReaders/TransactionStreamReader.cs @@ -96,7 +96,7 @@ public TransactionStreamReader( { return await _coreApiProvider.StreamApi.StreamTransactionsPostWithHttpInfoAsync( new CoreModel.StreamTransactionsRequest( - network: (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name, + network: _networkConfigurationProvider.GetNetworkConfiguration().Name, fromStateVersion: fromStateVersion, limit: count, transactionFormatOptions: new CoreModel.TransactionFormatOptions diff --git a/src/RadixDlt.NetworkGateway.DataAggregator/ServiceCollectionExtensions.cs b/src/RadixDlt.NetworkGateway.DataAggregator/ServiceCollectionExtensions.cs index cc10337e7..e9871d177 100644 --- a/src/RadixDlt.NetworkGateway.DataAggregator/ServiceCollectionExtensions.cs +++ b/src/RadixDlt.NetworkGateway.DataAggregator/ServiceCollectionExtensions.cs @@ -95,7 +95,7 @@ public static DataAggregatorBuilder AddNetworkGatewayDataAggregatorCore(this ISe { services .AddNetworkGatewayAbstractions() - .AddNetworkGatewayCoreServices(); + .AddNetworkConfigurationProvider(); services .AddValidatableOptionsAtSection("DataAggregator:Network") diff --git a/src/RadixDlt.NetworkGateway.DataAggregator/Services/LedgerTransactionsProcessor.cs b/src/RadixDlt.NetworkGateway.DataAggregator/Services/LedgerTransactionsProcessor.cs index a1e62d537..c2d9ca849 100644 --- a/src/RadixDlt.NetworkGateway.DataAggregator/Services/LedgerTransactionsProcessor.cs +++ b/src/RadixDlt.NetworkGateway.DataAggregator/Services/LedgerTransactionsProcessor.cs @@ -122,7 +122,7 @@ public LedgerTransactionsProcessor( public async Task ProcessTransactions(CancellationToken token) { - var networkConfiguration = await _networkConfigurationProvider.GetNetworkConfiguration(token); + var networkConfiguration = _networkConfigurationProvider.GetNetworkConfiguration(); var lastCommittedTransactionSummary = await _topOfLedgerProvider.GetTopOfLedger(token); await _observers.ForEachAsync(x => x.PreHandleLedgerExtension(_clock.UtcNow)); diff --git a/src/RadixDlt.NetworkGateway.DataAggregator/packages.lock.json b/src/RadixDlt.NetworkGateway.DataAggregator/packages.lock.json index fedab64ae..220013c83 100644 --- a/src/RadixDlt.NetworkGateway.DataAggregator/packages.lock.json +++ b/src/RadixDlt.NetworkGateway.DataAggregator/packages.lock.json @@ -247,27 +247,6 @@ "resolved": "8.0.0", "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Polly.Core": { "type": "Transitive", "resolved": "8.3.0", @@ -278,11 +257,6 @@ "resolved": "1.2.0.556", "contentHash": "zvn9Mqs/ox/83cpYPignI8hJEM2A93s2HkHs8HYMOAQW0PkampyoErAiIyKxgTLqbbad29HX/shv/6LGSjPJNQ==" }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "1.7.1", - "contentHash": "B43Zsz5EfMwyEbnObwRxW5u85fzJma3lrDeGcSAV1qkhSRTNY5uXAByTn9h9ddNdhM+4/YoLc/CI43umjwIl9Q==" - }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", "resolved": "8.0.0", @@ -321,8 +295,7 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", - "RadixDlt.CoreApiSdk": "[1.7.0-develop, )" + "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, "FluentValidation": { @@ -395,16 +368,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Polly": { "type": "CentralTransitive", "requested": "[8.3.0, )", diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Configuration/EndpointOptions.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Configuration/EndpointOptions.cs index 58cb79e88..5837e875c 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Configuration/EndpointOptions.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Configuration/EndpointOptions.cs @@ -113,6 +113,9 @@ public sealed class EndpointOptions [ConfigurationKeyName("EntitiesByRoleRequirementLookupMaxRequestedRequirementsCount")] public int EntitiesByRoleRequirementLookupMaxRequestedRequirementsCount { get; set; } = 50; + [ConfigurationKeyName("ImplicitRequirementsLookupMaxRequestedRequirementsCount")] + public int ImplicitRequirementsLookupMaxRequestedRequirementsCount { get; set; } = 100; + [ConfigurationKeyName("MaxDefinitionsLookupLimit")] public int MaxDefinitionsLookupLimit { get; set; } = 50_000; diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultExtensionsHandler.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultExtensionsHandler.cs index d4093c5b3..fa294c0ae 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultExtensionsHandler.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultExtensionsHandler.cs @@ -79,11 +79,14 @@ public interface IExtensionsHandler Task EntitiesByRoleRequirementPage(GatewayModel.EntitiesByRoleRequirementPageRequest request, CancellationToken token); Task EntitiesByRoleRequirementLookup(GatewayModel.EntitiesByRoleRequirementLookupRequest request, CancellationToken token); + + Task ImplicitRequirementsLookup(GatewayModel.ImplicitRequirementsLookupRequest request, CancellationToken token); } internal class DefaultExtensionsHandler( IResourceHoldersQuerier resourceHoldersQuerier, IEntitiesByRoleRequirementQuerier entitiesByRoleRequirementQuerier, + IImplicitRequirementsQuerier implicitRequirementsQuerier, IOptionsSnapshot endpointConfiguration) : IExtensionsHandler { public async Task ResourceHolders(GatewayModel.ResourceHoldersRequest request, CancellationToken token) @@ -116,4 +119,9 @@ internal class DefaultExtensionsHandler( endpointConfiguration.Value.MaxHeavyCollectionsPageSize, token); } + + public async Task ImplicitRequirementsLookup(GatewayModel.ImplicitRequirementsLookupRequest request, CancellationToken token) + { + return await implicitRequirementsQuerier.ImplicitRequirementsLookup(request.Requirements, token); + } } diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs index a82dc6747..188862fee 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Handlers/DefaultTransactionHandler.cs @@ -192,22 +192,24 @@ public DefaultTransactionHandler( request.ManifestBadgesPresentedFilter?.ForEach(a => searchCriteria.BadgesPresented.Add((EntityAddress)a)); request.ManifestResourcesFilter?.ForEach(a => searchCriteria.ManifestResources.Add((EntityAddress)a)); request.BalanceChangeResourcesFilter?.ForEach(a => searchCriteria.BalanceChangeResources.Add((EntityAddress)a)); - request.EventsFilter?.ForEach(ef => - { - var eventType = ef.Event switch - { - GatewayModel.StreamTransactionsRequestEventFilterItem.EventEnum.Deposit => LedgerTransactionEventFilter.EventType.Deposit, - GatewayModel.StreamTransactionsRequestEventFilterItem.EventEnum.Withdrawal => LedgerTransactionEventFilter.EventType.Withdrawal, - _ => throw new UnreachableException($"Didn't expect {ef.Event} value"), - }; - - searchCriteria.Events.Add(new LedgerTransactionEventFilter + request.EventsFilter?.ForEach( + ef => { - Event = eventType, - EmitterEntityAddress = ef.EmitterAddress != null ? (EntityAddress)ef.EmitterAddress : null, - ResourceAddress = ef.ResourceAddress != null ? (EntityAddress)ef.ResourceAddress : null, + var eventType = ef.Event switch + { + GatewayModel.StreamTransactionsRequestEventFilterItem.EventEnum.Deposit => LedgerTransactionEventFilter.EventType.Deposit, + GatewayModel.StreamTransactionsRequestEventFilterItem.EventEnum.Withdrawal => LedgerTransactionEventFilter.EventType.Withdrawal, + _ => throw new UnreachableException($"Didn't expect {ef.Event} value"), + }; + + searchCriteria.Events.Add( + new LedgerTransactionEventFilter + { + Event = eventType, + EmitterEntityAddress = ef.EmitterAddress != null ? (EntityAddress)ef.EmitterAddress : null, + ResourceAddress = ef.ResourceAddress != null ? (EntityAddress)ef.ResourceAddress : null, + }); }); - }); request.AccountsWithManifestOwnerMethodCalls?.ForEach(a => searchCriteria.AccountsWithManifestOwnerMethodCalls.Add((EntityAddress)a)); request.AccountsWithoutManifestOwnerMethodCalls?.ForEach(a => searchCriteria.AccountsWithoutManifestOwnerMethodCalls.Add((EntityAddress)a)); @@ -246,7 +248,12 @@ public DefaultTransactionHandler( var decidingFactors = await _depositPreValidationQuerier.AccountTryDepositPreValidation( (EntityAddress)request.AccountAddress, request.ResourceAddresses.Select(x => (EntityAddress)x).ToArray(), - request.Badge != null ? (EntityAddress)request.Badge.ResourceAddress : null, + request.Badge switch + { + GatewayModel.AccountDepositPreValidationNonFungibleBadge accountDepositPreValidationNonFungibleBadge => (EntityAddress)accountDepositPreValidationNonFungibleBadge.ResourceAddress, + GatewayModel.AccountDepositPreValidationResourceBadge accountDepositPreValidationResourceBadge => (EntityAddress)accountDepositPreValidationResourceBadge.ResourceAddress, + _ => null, + }, nonFungibleBadgeNfid, atLedgerState, token @@ -257,7 +264,8 @@ public DefaultTransactionHandler( return new GatewayModel.AccountDepositPreValidationResponse( atLedgerState, true, - decidingFactors.ResourceSpecificDetails + decidingFactors + .ResourceSpecificDetails .Select(x => new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(x.ResourceAddress, true)) .ToList(), decidingFactors); @@ -270,43 +278,43 @@ public DefaultTransactionHandler( switch (decidingFactorItem.ResourcePreferenceRule) { case GatewayModel.AccountResourcePreferenceRule.Allowed: - { - var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, true); - resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); - break; - } + { + var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, true); + resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); + break; + } case GatewayModel.AccountResourcePreferenceRule.Disallowed: - { - var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, false); - resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); - break; - } + { + var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, false); + resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); + break; + } case null: switch (decidingFactors.DefaultDepositRule) { case GatewayModel.AccountDefaultDepositRule.Reject: - { - var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, false); - resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); - break; - } + { + var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, false); + resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); + break; + } case GatewayModel.AccountDefaultDepositRule.Accept: - { - var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, true); - resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); - break; - } + { + var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, true); + resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); + break; + } case GatewayModel.AccountDefaultDepositRule.AllowExisting: - { - var allowsTryDeposit = decidingFactorItem.IsXrd || decidingFactorItem.VaultExists; - var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, allowsTryDeposit); - resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); - break; - } + { + var allowsTryDeposit = decidingFactorItem.IsXrd || decidingFactorItem.VaultExists; + var resourceSpecificResponseItem = new GatewayModel.AccountDepositPreValidationResourceSpecificBehaviourItem(decidingFactorItem.ResourceAddress, allowsTryDeposit); + resourceSpecificResponseCollection.Add(resourceSpecificResponseItem); + break; + } default: throw new ArgumentOutOfRangeException($"Unexpected value of {decidingFactors.DefaultDepositRule}"); diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/ServiceCollectionExtensions.cs b/src/RadixDlt.NetworkGateway.GatewayApi/ServiceCollectionExtensions.cs index 2848edc54..a7b501feb 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/ServiceCollectionExtensions.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/ServiceCollectionExtensions.cs @@ -97,7 +97,7 @@ public static GatewayApiBuilder AddNetworkGatewayApiCore(this IServiceCollection { services .AddNetworkGatewayAbstractions() - .AddNetworkGatewayCoreServices(); + .AddNetworkConfigurationProvider(); services .AddValidatableOptionsAtSection("GatewayApi:Endpoint") diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Services/IImplicitRequirementsQuerier.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Services/IImplicitRequirementsQuerier.cs new file mode 100644 index 000000000..efc6605f0 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Services/IImplicitRequirementsQuerier.cs @@ -0,0 +1,76 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace RadixDlt.NetworkGateway.GatewayApi.Services; + +public interface IImplicitRequirementsQuerier +{ + Task ImplicitRequirementsLookup( + List nonFungibleGlobalIds, + CancellationToken token = default); +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Services/IOpenApiDocumentQuerier.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Services/IOpenApiDocumentQuerier.cs index c32063bcf..a109b9a02 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Services/IOpenApiDocumentQuerier.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Services/IOpenApiDocumentQuerier.cs @@ -67,7 +67,13 @@ namespace RadixDlt.NetworkGateway.GatewayApi.Services; -public record OpenApiDocumentPlaceholderData(string? RandomIntentHash, string? RandomSubintentHash, long? CurrentEpoch, string? RequirementResourceAddress, string? RequirementNonFungibleId); +public record OpenApiDocumentPlaceholderData( + string? RandomIntentHash, + string? RandomSubintentHash, + long? CurrentEpoch, + string? RequirementResourceAddress, + string? RequirementNonFungibleId, + string? SampleImplicitRequirementGlobalCallerEntityHash); public interface IOpenApiDocumentQuerier { diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Services/SubmissionService.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Services/SubmissionService.cs index ea55c05b6..1fafef6d5 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Services/SubmissionService.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Services/SubmissionService.cs @@ -123,7 +123,7 @@ public SubmissionService( var options = _coreApiIntegrationOptions.CurrentValue; var submissionResult = await _submissionTrackingService.ObserveSubmissionToGatewayAndSubmitToNetworkIfNew( _coreApiProvider.TransactionApi, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name, + _networkConfigurationProvider.GetNetworkConfiguration().Name, targetNode.Name, new PendingTransactionHandlingConfig( options.MaxSubmissionAttempts, @@ -183,12 +183,12 @@ private async Task HandlePreSubmissionParseTransaction(by if (isV1UserTransaction) { - return await HandlePreSubmissionParseTransactionV1(notarizedTransactionBytes); + return HandlePreSubmissionParseTransactionV1(notarizedTransactionBytes); } if (isV2UserTransaction) { - return await HandlePreSubmissionParseTransactionV2(notarizedTransactionBytes); + return HandlePreSubmissionParseTransactionV2(notarizedTransactionBytes); } throw InvalidTransactionException.FromStaticallyInvalid("Unable to decode transaction. Unexpected payload prefix."); @@ -212,10 +212,10 @@ private async Task HandlePreSubmissionParseTransaction(by } } - private async Task HandlePreSubmissionParseTransactionV1(byte[] notarizedTransactionBytes) + private ParsedTransactionData HandlePreSubmissionParseTransactionV1(byte[] notarizedTransactionBytes) { using var notarizedTransaction = ToolkitModel.NotarizedTransactionV1.FromPayloadBytes(notarizedTransactionBytes); - notarizedTransaction.StaticallyValidate((await _networkConfigurationProvider.GetNetworkConfiguration()).Id); + notarizedTransaction.StaticallyValidate(_networkConfigurationProvider.GetNetworkConfiguration().Id); return new ParsedTransactionData( notarizedTransaction.IntentHash().AsStr(), @@ -224,10 +224,10 @@ private async Task HandlePreSubmissionParseTransactionV1( notarizedTransaction.SignedIntent().Intent().Header().endEpochExclusive); } - private async Task HandlePreSubmissionParseTransactionV2(byte[] notarizedTransactionBytes) + private ParsedTransactionData HandlePreSubmissionParseTransactionV2(byte[] notarizedTransactionBytes) { using var notarizedTransaction = ToolkitModel.NotarizedTransactionV2.FromPayloadBytes(notarizedTransactionBytes); - notarizedTransaction.StaticallyValidate((await _networkConfigurationProvider.GetNetworkConfiguration()).Id); + notarizedTransaction.StaticallyValidate(_networkConfigurationProvider.GetNetworkConfiguration().Id); return new ParsedTransactionData( notarizedTransaction.IntentHash().AsStr(), diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Services/TransactionPreviewService.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Services/TransactionPreviewService.cs index f435d0227..020f66f76 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Services/TransactionPreviewService.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Services/TransactionPreviewService.cs @@ -182,7 +182,7 @@ public TransactionPreviewService( } var coreRequest = new CoreModel.TransactionPreviewRequest( - network: (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name, + network: _networkConfigurationProvider.GetNetworkConfiguration().Name, manifest: request.Manifest, blobsHex: request.BlobsHex, startEpochInclusive: request.StartEpochInclusive, @@ -231,7 +231,7 @@ CoreModel.PreviewTransaction MapPreviewTransaction(GatewayModel.PreviewTransacti disableAuthChecks: request.Flags.DisableAuthChecks); var coreRequest = new CoreModel.TransactionPreviewV2Request( - network: (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name, + network: _networkConfigurationProvider.GetNetworkConfiguration().Name, previewTransaction: MapPreviewTransaction(request.PreviewTransaction), flags: coreRequestFlags, options: new CoreModel.TransactionPreviewV2ResponseOptions( diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Validators/ImplicitRequirementsLookupRequestValidator.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Validators/ImplicitRequirementsLookupRequestValidator.cs new file mode 100644 index 000000000..3ee37c72f --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Validators/ImplicitRequirementsLookupRequestValidator.cs @@ -0,0 +1,118 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using FluentValidation; +using Microsoft.Extensions.Options; +using RadixDlt.NetworkGateway.Abstractions.Network; +using RadixDlt.NetworkGateway.GatewayApi.Configuration; +using RadixDlt.NetworkGateway.GatewayApiSdk.Model; +using System.Linq; + +namespace RadixDlt.NetworkGateway.GatewayApi.Validators; + +internal class ImplicitRequirementsLookupRequestValidator : AbstractValidator +{ + public ImplicitRequirementsLookupRequestValidator( + IOptionsSnapshot endpointOptionsSnapshot, + RadixAddressValidator radixAddressValidator, + INetworkConfigurationProvider networkConfigurationProvider + ) + { + RuleFor(x => x.Requirements) + .NotEmpty() + .DependentRules( + () => + { + RuleFor(x => x.Requirements.Count) + .GreaterThan(0) + .LessThanOrEqualTo(endpointOptionsSnapshot.Value.ImplicitRequirementsLookupMaxRequestedRequirementsCount); + + RuleForEach(x => x.Requirements) + .NotEmpty() + .SetValidator(new ImplicitRequirementNonFungibleGlobalIdValidator(radixAddressValidator, networkConfigurationProvider)); + }); + } +} + +internal class ImplicitRequirementNonFungibleGlobalIdValidator : AbstractValidator +{ + public ImplicitRequirementNonFungibleGlobalIdValidator(RadixAddressValidator radixAddressValidator, INetworkConfigurationProvider networkConfigurationProvider) + { + var wka = networkConfigurationProvider.GetNetworkConfiguration().WellKnownAddresses; + var allowedImplicitRequirementResourceAddresses = new[] + { + wka.Ed25519SignatureVirtualBadge, + wka.Secp256k1SignatureVirtualBadge, + wka.GlobalCallerVirtualBadge, + wka.PackageOfDirectCallerVirtualBadge, + wka.SystemTransactionBadge, + }; + + RuleFor(x => x.ResourceAddress) + .NotEmpty() + .SetValidator(radixAddressValidator) + .Must(x => allowedImplicitRequirementResourceAddresses.Contains(x)) + .WithMessage("Only implicit requirement resource addresses are allowed: " + string.Join(", ", allowedImplicitRequirementResourceAddresses)); + } +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/Validators/RadixAddressValidator.cs b/src/RadixDlt.NetworkGateway.GatewayApi/Validators/RadixAddressValidator.cs index e6a18edf3..cc404932f 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/Validators/RadixAddressValidator.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApi/Validators/RadixAddressValidator.cs @@ -80,7 +80,7 @@ public RadixAddressValidator(INetworkConfigurationProvider networkConfigurationP try { - var networkHrpSuffix = networkConfigurationProvider.GetNetworkConfiguration().GetAwaiter().GetResult().HrpSuffix; + var networkHrpSuffix = networkConfigurationProvider.GetNetworkConfiguration().HrpSuffix; var decodedAddress = RadixAddressCodec.Decode(address); if (!decodedAddress.Hrp.EndsWith(networkHrpSuffix, StringComparison.OrdinalIgnoreCase)) diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml index 457561282..1a9cdc22a 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml @@ -2165,6 +2165,48 @@ paths: "4XX": $ref: "#/components/responses/ErrorResponse" + /extensions/implicit-requirements/lookup: + post: + operationId: ImplicitRequirementsLookup + summary: Resolve implicit requirement target from global non-fungible id + description: | + Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. + These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. + + The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: + - **Secp256k1 Signature Resource** + - **Ed25519 Signature Resource** + - **Package of Direct Caller Resource** + - **Global Caller Resource** + - **System Execution Resource** + + When querying, you must provide a pair of the following for each requirement to resolve: + - `resource_address` (one of the above) + - `non_fungible_id`, of the requirement. + + You can query a maximum of `100` implicit requirements at a time. + + See the documentation on + [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) + for more information. + tags: + - Extensions + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ImplicitRequirementsLookupRequest" + responses: + "200": + description: List of resolved implicit requirements. + content: + application/json: + schema: + $ref: "#/components/schemas/ImplicitRequirementsLookupResponse" + "4XX": + $ref: "#/components/responses/ErrorResponse" + components: responses: ErrorResponse: @@ -3119,14 +3161,9 @@ components: type: object required: - badge_type - - resource_address properties: badge_type: $ref: "#/components/schemas/AccountAuthorizedDepositorBadgeType" - resource_address: - # That is part of parent type because moving it to child broke OpenAPI generator and removed some other types: - # MetadataNonFungibleGlobalIdValueAllOf StateNonFungibleIdsRequestAllOf MetadataNonFungibleGlobalIdArrayValueAllOf and MetadataNonFungibleGlobalIdArrayValue were affected - $ref: "#/components/schemas/Address" discriminator: propertyName: badge_type mapping: @@ -3137,13 +3174,21 @@ components: allOf: - $ref: "#/components/schemas/TransactionAccountDepositPreValidationAuthorizedDepositorBadge" - type: object + required: + - resource_address + properties: + resource_address: + $ref: "#/components/schemas/Address" AccountDepositPreValidationNonFungibleBadge: allOf: - $ref: "#/components/schemas/TransactionAccountDepositPreValidationAuthorizedDepositorBadge" - type: object required: + - resource_address - non_fungible_id properties: + resource_address: + $ref: "#/components/schemas/Address" non_fungible_id: $ref: "#/components/schemas/NonFungibleId" @@ -3618,6 +3663,17 @@ components: type: integer format: int64 + NonFungibleGlobalId: + type: object + required: + - resource_address + - non_fungible_id + properties: + resource_address: + $ref: "#/components/schemas/Address" + non_fungible_id: + $ref: "#/components/schemas/NonFungibleId" + EntitiesByRoleRequirementItem: type: object required: @@ -3630,6 +3686,117 @@ components: type: integer format: int64 + ResolvedImplicitRequirementType: + type: string + enum: + - Secp256k1PublicKey + - Ed25519PublicKey + - GlobalCallerBlueprint + - GlobalCallerEntity + - PackageOfDirectCaller + - ProtocolExecution + - ValidatorExecution + ResolvedImplicitRequirement: + type: object + required: + - type + properties: + type: + $ref: "#/components/schemas/ResolvedImplicitRequirementType" + discriminator: + propertyName: type + mapping: + Secp256k1PublicKey: "#/components/schemas/ResolvedSecp256k1PublicKeyImplicitRequirement" + Ed25519PublicKey: "#/components/schemas/ResolvedEd25519PublicKeyImplicitRequirement" + GlobalCallerBlueprint: "#/components/schemas/ResolvedGlobalCallerBlueprintImplicitRequirement" + GlobalCallerEntity: "#/components/schemas/ResolvedGlobalCallerEntityImplicitRequirement" + PackageOfDirectCaller: "#/components/schemas/ResolvedPackageOfDirectCallerImplicitRequirement" + ProtocolExecution: "#/components/schemas/ResolvedProtocolExecutionImplicitRequirement" + ValidatorExecution: "#/components/schemas/ResolvedValidatorExecutionImplicitRequirement" + + ResolvedProtocolExecutionImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + + ResolvedValidatorExecutionImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + + ResolvedSecp256k1PublicKeyImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + required: + - first_seen_state_version + - public_key_bytes_hex + properties: + first_seen_state_version: + type: integer + format: int64 + public_key_bytes_hex: + $ref: "#/components/schemas/HexString" + + ResolvedEd25519PublicKeyImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + required: + - public_key_bytes_hex + - first_seen_state_version + properties: + first_seen_state_version: + type: integer + format: int64 + public_key_bytes_hex: + $ref: "#/components/schemas/HexString" + + ResolvedGlobalCallerBlueprintImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + required: + - first_seen_state_version + - package_address + - blueprint_name + properties: + first_seen_state_version: + type: integer + format: int64 + package_address: + $ref: "#/components/schemas/Address" + blueprint_name: + type: string + + ResolvedGlobalCallerEntityImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + required: + - first_seen_state_version + - entity_address + properties: + first_seen_state_version: + type: integer + format: int64 + entity_address: + $ref: "#/components/schemas/Address" + + ResolvedPackageOfDirectCallerImplicitRequirement: + allOf: + - $ref: "#/components/schemas/ResolvedImplicitRequirement" + - type: object + required: + - first_seen_state_version + - package_address + properties: + first_seen_state_version: + type: integer + format: int64 + package_address: + $ref: "#/components/schemas/Address" + ResourceHoldersCollection: allOf: - $ref: "#/components/schemas/ResultSetCursorMixin" @@ -3678,7 +3845,6 @@ components: amount: $ref: "#/components/schemas/BigDecimal" - ResourceHoldersCollectionNonFungibleResourceItem: allOf: - $ref: "#/components/schemas/ResourceHoldersCollectionItem" @@ -5825,6 +5991,42 @@ components: items: $ref: "#/components/schemas/EntitiesByRoleRequirementItem" + ImplicitRequirementsLookupRequest: + allOf: + - type: object + required: + - requirements + properties: + requirements: + type: array + description: limited to max 100 items. + items: + $ref: "#/components/schemas/NonFungibleGlobalId" + example: + requirements: + - resource_address: "" + non_fungible_id: "" + + ImplicitRequirementsLookupResponse: + type: object + required: + - resolved_requirements + properties: + resolved_requirements: + type: array + items: + $ref: "#/components/schemas/ImplicitRequirementsLookupCollectionItem" + + ImplicitRequirementsLookupCollectionItem: + type: object + required: + - requirement + properties: + requirement: + $ref: "#/components/schemas/NonFungibleGlobalId" + resolved: + $ref: "#/components/schemas/ResolvedImplicitRequirement" + ResourceHoldersRequest: allOf: - $ref: "#/components/schemas/CursorLimitMixin" diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/packages.lock.json b/src/RadixDlt.NetworkGateway.GatewayApi/packages.lock.json index deb52456a..eb94d5f26 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/packages.lock.json +++ b/src/RadixDlt.NetworkGateway.GatewayApi/packages.lock.json @@ -296,27 +296,6 @@ "resolved": "8.0.0", "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Polly.Core": { "type": "Transitive", "resolved": "8.3.0", @@ -335,11 +314,6 @@ "resolved": "1.2.0.556", "contentHash": "zvn9Mqs/ox/83cpYPignI8hJEM2A93s2HkHs8HYMOAQW0PkampyoErAiIyKxgTLqbbad29HX/shv/6LGSjPJNQ==" }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "1.7.1", - "contentHash": "B43Zsz5EfMwyEbnObwRxW5u85fzJma3lrDeGcSAV1qkhSRTNY5uXAByTn9h9ddNdhM+4/YoLc/CI43umjwIl9Q==" - }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", "resolved": "8.0.0", @@ -378,7 +352,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -461,16 +434,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Polly": { "type": "CentralTransitive", "requested": "[8.3.0, )", diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Api/ExtensionsApi.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Api/ExtensionsApi.cs index 218771f2e..b5d021f01 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Api/ExtensionsApi.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Api/ExtensionsApi.cs @@ -134,6 +134,27 @@ public interface IExtensionsApiSync : IApiAccessor /// ApiResponse of EntitiesByRoleRequirementPageResponse ApiResponse EntitiesByRoleRequirementPageWithHttpInfo(EntitiesByRoleRequirementPageRequest entitiesByRoleRequirementPageRequest); /// + /// Resolve implicit requirement target from global non-fungible id + /// + /// + /// Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// ImplicitRequirementsLookupResponse + ImplicitRequirementsLookupResponse ImplicitRequirementsLookup(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest); + + /// + /// Resolve implicit requirement target from global non-fungible id + /// + /// + /// Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of ImplicitRequirementsLookupResponse + ApiResponse ImplicitRequirementsLookupWithHttpInfo(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest); + /// /// Get Resource Holders Page /// /// @@ -210,6 +231,29 @@ public interface IExtensionsApiAsync : IApiAccessor /// Task of ApiResponse (EntitiesByRoleRequirementPageResponse) System.Threading.Tasks.Task> EntitiesByRoleRequirementPageWithHttpInfoAsync(EntitiesByRoleRequirementPageRequest entitiesByRoleRequirementPageRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// Resolve implicit requirement target from global non-fungible id + /// + /// + /// Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ImplicitRequirementsLookupResponse + System.Threading.Tasks.Task ImplicitRequirementsLookupAsync(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Resolve implicit requirement target from global non-fungible id + /// + /// + /// Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ImplicitRequirementsLookupResponse) + System.Threading.Tasks.Task> ImplicitRequirementsLookupWithHttpInfoAsync(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Get Resource Holders Page /// /// @@ -679,6 +723,123 @@ public RadixDlt.NetworkGateway.GatewayApiSdk.Client.ApiResponse + /// Resolve implicit requirement target from global non-fungible id Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// ImplicitRequirementsLookupResponse + public ImplicitRequirementsLookupResponse ImplicitRequirementsLookup(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest) + { + RadixDlt.NetworkGateway.GatewayApiSdk.Client.ApiResponse localVarResponse = ImplicitRequirementsLookupWithHttpInfo(implicitRequirementsLookupRequest); + return localVarResponse.Data; + } + + /// + /// Resolve implicit requirement target from global non-fungible id Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of ImplicitRequirementsLookupResponse + public RadixDlt.NetworkGateway.GatewayApiSdk.Client.ApiResponse ImplicitRequirementsLookupWithHttpInfo(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest) + { + // verify the required parameter 'implicitRequirementsLookupRequest' is set + if (implicitRequirementsLookupRequest == null) + throw new RadixDlt.NetworkGateway.GatewayApiSdk.Client.ApiException(400, "Missing required parameter 'implicitRequirementsLookupRequest' when calling ExtensionsApi->ImplicitRequirementsLookup"); + + RadixDlt.NetworkGateway.GatewayApiSdk.Client.RequestOptions localVarRequestOptions = new RadixDlt.NetworkGateway.GatewayApiSdk.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = RadixDlt.NetworkGateway.GatewayApiSdk.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = RadixDlt.NetworkGateway.GatewayApiSdk.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = implicitRequirementsLookupRequest; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/extensions/implicit-requirements/lookup", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ImplicitRequirementsLookup", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Resolve implicit requirement target from global non-fungible id Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ImplicitRequirementsLookupResponse + public async System.Threading.Tasks.Task ImplicitRequirementsLookupAsync(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + RadixDlt.NetworkGateway.GatewayApiSdk.Client.ApiResponse localVarResponse = await ImplicitRequirementsLookupWithHttpInfoAsync(implicitRequirementsLookupRequest, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Resolve implicit requirement target from global non-fungible id Access rules can include [implicit requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) referencing special system-reserved resource addresses, which have specific meanings for the Radix Engine and are not part of the standard authorization zone system. These implicit requirements typically store their details as a hash, which means the subject of the requirement can't be easily resolved. This is where this endpoint comes in. It can resolve the subject of the implicit requirements, using a database of reverse hash lookups populated from ledger data. The following [resource addresses](https://docs.radixdlt.com/docs/well-known-addresses) are supported: - **Secp256k1 Signature Resource** - **Ed25519 Signature Resource** - **Package of Direct Caller Resource** - **Global Caller Resource** - **System Execution Resource** When querying, you must provide a pair of the following for each requirement to resolve: - `resource_address` (one of the above) - `non_fungible_id`, of the requirement. You can query a maximum of `100` implicit requirements at a time. See the documentation on [implicit-requirements](https://docs.radixdlt.com/docs/advanced-accessrules#implicit-requirements) for more information. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ImplicitRequirementsLookupResponse) + public async System.Threading.Tasks.Task> ImplicitRequirementsLookupWithHttpInfoAsync(ImplicitRequirementsLookupRequest implicitRequirementsLookupRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'implicitRequirementsLookupRequest' is set + if (implicitRequirementsLookupRequest == null) + throw new RadixDlt.NetworkGateway.GatewayApiSdk.Client.ApiException(400, "Missing required parameter 'implicitRequirementsLookupRequest' when calling ExtensionsApi->ImplicitRequirementsLookup"); + + + RadixDlt.NetworkGateway.GatewayApiSdk.Client.RequestOptions localVarRequestOptions = new RadixDlt.NetworkGateway.GatewayApiSdk.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = RadixDlt.NetworkGateway.GatewayApiSdk.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = RadixDlt.NetworkGateway.GatewayApiSdk.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = implicitRequirementsLookupRequest; + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/extensions/implicit-requirements/lookup", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ImplicitRequirementsLookup", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + /// /// Get Resource Holders Page A paginated endpoint to discover which global entities hold the most of a given resource. More specifically, it returns a page of global entities which hold the given resource, ordered descending by the total fungible balance / total count of non-fungibles stored in vaults in the state tree of that entity (excluding unclaimed royalty balances). This endpoint operates only at the **current state version**, it is not possible to browse historical data. Because of that, it is not possible to offer stable pagination as data constantly changes. Balances might change between pages being read, which might result in gaps or some entries being returned twice. Under default Gateway configuration, up to 100 entries are returned per response. This can be increased up to 1000 entries per page with the `limit_per_page` parameter. /// diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadge.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadge.cs index 4ac1570fe..f37cb00d5 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadge.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadge.cs @@ -107,11 +107,17 @@ protected AccountDepositPreValidationNonFungibleBadge() { } /// /// Initializes a new instance of the class. /// + /// Bech32m-encoded human readable version of the address. (required). /// String-encoded non-fungible ID. (required). /// badgeType (required) (default to AccountAuthorizedDepositorBadgeType.NonFungibleBadge). - /// Bech32m-encoded human readable version of the address. (required). - public AccountDepositPreValidationNonFungibleBadge(string nonFungibleId = default(string), AccountAuthorizedDepositorBadgeType badgeType = AccountAuthorizedDepositorBadgeType.NonFungibleBadge, string resourceAddress = default(string)) : base(badgeType, resourceAddress) + public AccountDepositPreValidationNonFungibleBadge(string resourceAddress = default(string), string nonFungibleId = default(string), AccountAuthorizedDepositorBadgeType badgeType = AccountAuthorizedDepositorBadgeType.NonFungibleBadge) : base(badgeType) { + // to ensure "resourceAddress" is required (not null) + if (resourceAddress == null) + { + throw new ArgumentNullException("resourceAddress is a required property for AccountDepositPreValidationNonFungibleBadge and cannot be null"); + } + this.ResourceAddress = resourceAddress; // to ensure "nonFungibleId" is required (not null) if (nonFungibleId == null) { @@ -120,6 +126,13 @@ protected AccountDepositPreValidationNonFungibleBadge() { } this.NonFungibleId = nonFungibleId; } + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "resource_address", IsRequired = true, EmitDefaultValue = true)] + public string ResourceAddress { get; set; } + /// /// String-encoded non-fungible ID. /// @@ -136,6 +149,7 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class AccountDepositPreValidationNonFungibleBadge {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" ResourceAddress: ").Append(ResourceAddress).Append("\n"); sb.Append(" NonFungibleId: ").Append(NonFungibleId).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -172,6 +186,11 @@ public bool Equals(AccountDepositPreValidationNonFungibleBadge input) return false; } return base.Equals(input) && + ( + this.ResourceAddress == input.ResourceAddress || + (this.ResourceAddress != null && + this.ResourceAddress.Equals(input.ResourceAddress)) + ) && base.Equals(input) && ( this.NonFungibleId == input.NonFungibleId || (this.NonFungibleId != null && @@ -188,6 +207,10 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); + if (this.ResourceAddress != null) + { + hashCode = (hashCode * 59) + this.ResourceAddress.GetHashCode(); + } if (this.NonFungibleId != null) { hashCode = (hashCode * 59) + this.NonFungibleId.GetHashCode(); diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadgeAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadgeAllOf.cs index 61435f89b..fcf5fd42f 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadgeAllOf.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationNonFungibleBadgeAllOf.cs @@ -103,9 +103,16 @@ protected AccountDepositPreValidationNonFungibleBadgeAllOf() { } /// /// Initializes a new instance of the class. /// + /// Bech32m-encoded human readable version of the address. (required). /// String-encoded non-fungible ID. (required). - public AccountDepositPreValidationNonFungibleBadgeAllOf(string nonFungibleId = default(string)) + public AccountDepositPreValidationNonFungibleBadgeAllOf(string resourceAddress = default(string), string nonFungibleId = default(string)) { + // to ensure "resourceAddress" is required (not null) + if (resourceAddress == null) + { + throw new ArgumentNullException("resourceAddress is a required property for AccountDepositPreValidationNonFungibleBadgeAllOf and cannot be null"); + } + this.ResourceAddress = resourceAddress; // to ensure "nonFungibleId" is required (not null) if (nonFungibleId == null) { @@ -114,6 +121,13 @@ protected AccountDepositPreValidationNonFungibleBadgeAllOf() { } this.NonFungibleId = nonFungibleId; } + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "resource_address", IsRequired = true, EmitDefaultValue = true)] + public string ResourceAddress { get; set; } + /// /// String-encoded non-fungible ID. /// @@ -129,6 +143,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class AccountDepositPreValidationNonFungibleBadgeAllOf {\n"); + sb.Append(" ResourceAddress: ").Append(ResourceAddress).Append("\n"); sb.Append(" NonFungibleId: ").Append(NonFungibleId).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -165,6 +180,11 @@ public bool Equals(AccountDepositPreValidationNonFungibleBadgeAllOf input) return false; } return + ( + this.ResourceAddress == input.ResourceAddress || + (this.ResourceAddress != null && + this.ResourceAddress.Equals(input.ResourceAddress)) + ) && ( this.NonFungibleId == input.NonFungibleId || (this.NonFungibleId != null && @@ -181,6 +201,10 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; + if (this.ResourceAddress != null) + { + hashCode = (hashCode * 59) + this.ResourceAddress.GetHashCode(); + } if (this.NonFungibleId != null) { hashCode = (hashCode * 59) + this.NonFungibleId.GetHashCode(); diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadge.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadge.cs index 803f9a4e4..b9208c424 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadge.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadge.cs @@ -107,12 +107,25 @@ protected AccountDepositPreValidationResourceBadge() { } /// /// Initializes a new instance of the class. /// - /// badgeType (required) (default to AccountAuthorizedDepositorBadgeType.ResourceBadge). /// Bech32m-encoded human readable version of the address. (required). - public AccountDepositPreValidationResourceBadge(AccountAuthorizedDepositorBadgeType badgeType = AccountAuthorizedDepositorBadgeType.ResourceBadge, string resourceAddress = default(string)) : base(badgeType, resourceAddress) + /// badgeType (required) (default to AccountAuthorizedDepositorBadgeType.ResourceBadge). + public AccountDepositPreValidationResourceBadge(string resourceAddress = default(string), AccountAuthorizedDepositorBadgeType badgeType = AccountAuthorizedDepositorBadgeType.ResourceBadge) : base(badgeType) { + // to ensure "resourceAddress" is required (not null) + if (resourceAddress == null) + { + throw new ArgumentNullException("resourceAddress is a required property for AccountDepositPreValidationResourceBadge and cannot be null"); + } + this.ResourceAddress = resourceAddress; } + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "resource_address", IsRequired = true, EmitDefaultValue = true)] + public string ResourceAddress { get; set; } + /// /// Returns the string presentation of the object /// @@ -122,6 +135,7 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class AccountDepositPreValidationResourceBadge {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" ResourceAddress: ").Append(ResourceAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -156,7 +170,12 @@ public bool Equals(AccountDepositPreValidationResourceBadge input) { return false; } - return base.Equals(input); + return base.Equals(input) && + ( + this.ResourceAddress == input.ResourceAddress || + (this.ResourceAddress != null && + this.ResourceAddress.Equals(input.ResourceAddress)) + ); } /// @@ -168,6 +187,10 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); + if (this.ResourceAddress != null) + { + hashCode = (hashCode * 59) + this.ResourceAddress.GetHashCode(); + } return hashCode; } } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadgeAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadgeAllOf.cs new file mode 100644 index 000000000..6a2943928 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/AccountDepositPreValidationResourceBadgeAllOf.cs @@ -0,0 +1,194 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// AccountDepositPreValidationResourceBadgeAllOf + /// + [DataContract(Name = "AccountDepositPreValidationResourceBadge_allOf")] + public partial class AccountDepositPreValidationResourceBadgeAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AccountDepositPreValidationResourceBadgeAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// Bech32m-encoded human readable version of the address. (required). + public AccountDepositPreValidationResourceBadgeAllOf(string resourceAddress = default(string)) + { + // to ensure "resourceAddress" is required (not null) + if (resourceAddress == null) + { + throw new ArgumentNullException("resourceAddress is a required property for AccountDepositPreValidationResourceBadgeAllOf and cannot be null"); + } + this.ResourceAddress = resourceAddress; + } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "resource_address", IsRequired = true, EmitDefaultValue = true)] + public string ResourceAddress { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AccountDepositPreValidationResourceBadgeAllOf {\n"); + sb.Append(" ResourceAddress: ").Append(ResourceAddress).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AccountDepositPreValidationResourceBadgeAllOf); + } + + /// + /// Returns true if AccountDepositPreValidationResourceBadgeAllOf instances are equal + /// + /// Instance of AccountDepositPreValidationResourceBadgeAllOf to be compared + /// Boolean + public bool Equals(AccountDepositPreValidationResourceBadgeAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.ResourceAddress == input.ResourceAddress || + (this.ResourceAddress != null && + this.ResourceAddress.Equals(input.ResourceAddress)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ResourceAddress != null) + { + hashCode = (hashCode * 59) + this.ResourceAddress.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupCollectionItem.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupCollectionItem.cs new file mode 100644 index 000000000..d279ee95f --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupCollectionItem.cs @@ -0,0 +1,211 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ImplicitRequirementsLookupCollectionItem + /// + [DataContract(Name = "ImplicitRequirementsLookupCollectionItem")] + public partial class ImplicitRequirementsLookupCollectionItem : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ImplicitRequirementsLookupCollectionItem() { } + /// + /// Initializes a new instance of the class. + /// + /// requirement (required). + /// resolved. + public ImplicitRequirementsLookupCollectionItem(NonFungibleGlobalId requirement = default(NonFungibleGlobalId), ResolvedImplicitRequirement resolved = default(ResolvedImplicitRequirement)) + { + // to ensure "requirement" is required (not null) + if (requirement == null) + { + throw new ArgumentNullException("requirement is a required property for ImplicitRequirementsLookupCollectionItem and cannot be null"); + } + this.Requirement = requirement; + this.Resolved = resolved; + } + + /// + /// Gets or Sets Requirement + /// + [DataMember(Name = "requirement", IsRequired = true, EmitDefaultValue = true)] + public NonFungibleGlobalId Requirement { get; set; } + + /// + /// Gets or Sets Resolved + /// + [DataMember(Name = "resolved", EmitDefaultValue = true)] + public ResolvedImplicitRequirement Resolved { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ImplicitRequirementsLookupCollectionItem {\n"); + sb.Append(" Requirement: ").Append(Requirement).Append("\n"); + sb.Append(" Resolved: ").Append(Resolved).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ImplicitRequirementsLookupCollectionItem); + } + + /// + /// Returns true if ImplicitRequirementsLookupCollectionItem instances are equal + /// + /// Instance of ImplicitRequirementsLookupCollectionItem to be compared + /// Boolean + public bool Equals(ImplicitRequirementsLookupCollectionItem input) + { + if (input == null) + { + return false; + } + return + ( + this.Requirement == input.Requirement || + (this.Requirement != null && + this.Requirement.Equals(input.Requirement)) + ) && + ( + this.Resolved == input.Resolved || + (this.Resolved != null && + this.Resolved.Equals(input.Resolved)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requirement != null) + { + hashCode = (hashCode * 59) + this.Requirement.GetHashCode(); + } + if (this.Resolved != null) + { + hashCode = (hashCode * 59) + this.Resolved.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupRequest.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupRequest.cs new file mode 100644 index 000000000..3a6661c30 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupRequest.cs @@ -0,0 +1,195 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ImplicitRequirementsLookupRequest + /// + [DataContract(Name = "ImplicitRequirementsLookupRequest")] + public partial class ImplicitRequirementsLookupRequest : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ImplicitRequirementsLookupRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// limited to max 100 items. (required). + public ImplicitRequirementsLookupRequest(List requirements = default(List)) + { + // to ensure "requirements" is required (not null) + if (requirements == null) + { + throw new ArgumentNullException("requirements is a required property for ImplicitRequirementsLookupRequest and cannot be null"); + } + this.Requirements = requirements; + } + + /// + /// limited to max 100 items. + /// + /// limited to max 100 items. + [DataMember(Name = "requirements", IsRequired = true, EmitDefaultValue = true)] + public List Requirements { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ImplicitRequirementsLookupRequest {\n"); + sb.Append(" Requirements: ").Append(Requirements).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ImplicitRequirementsLookupRequest); + } + + /// + /// Returns true if ImplicitRequirementsLookupRequest instances are equal + /// + /// Instance of ImplicitRequirementsLookupRequest to be compared + /// Boolean + public bool Equals(ImplicitRequirementsLookupRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.Requirements == input.Requirements || + this.Requirements != null && + input.Requirements != null && + this.Requirements.SequenceEqual(input.Requirements) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requirements != null) + { + hashCode = (hashCode * 59) + this.Requirements.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupRequestAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupRequestAllOf.cs new file mode 100644 index 000000000..2492d3e0e --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupRequestAllOf.cs @@ -0,0 +1,195 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ImplicitRequirementsLookupRequestAllOf + /// + [DataContract(Name = "ImplicitRequirementsLookupRequest_allOf")] + public partial class ImplicitRequirementsLookupRequestAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ImplicitRequirementsLookupRequestAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// limited to max 100 items. (required). + public ImplicitRequirementsLookupRequestAllOf(List requirements = default(List)) + { + // to ensure "requirements" is required (not null) + if (requirements == null) + { + throw new ArgumentNullException("requirements is a required property for ImplicitRequirementsLookupRequestAllOf and cannot be null"); + } + this.Requirements = requirements; + } + + /// + /// limited to max 100 items. + /// + /// limited to max 100 items. + [DataMember(Name = "requirements", IsRequired = true, EmitDefaultValue = true)] + public List Requirements { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ImplicitRequirementsLookupRequestAllOf {\n"); + sb.Append(" Requirements: ").Append(Requirements).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ImplicitRequirementsLookupRequestAllOf); + } + + /// + /// Returns true if ImplicitRequirementsLookupRequestAllOf instances are equal + /// + /// Instance of ImplicitRequirementsLookupRequestAllOf to be compared + /// Boolean + public bool Equals(ImplicitRequirementsLookupRequestAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.Requirements == input.Requirements || + this.Requirements != null && + input.Requirements != null && + this.Requirements.SequenceEqual(input.Requirements) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requirements != null) + { + hashCode = (hashCode * 59) + this.Requirements.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupResponse.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupResponse.cs new file mode 100644 index 000000000..644615bcd --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ImplicitRequirementsLookupResponse.cs @@ -0,0 +1,194 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ImplicitRequirementsLookupResponse + /// + [DataContract(Name = "ImplicitRequirementsLookupResponse")] + public partial class ImplicitRequirementsLookupResponse : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ImplicitRequirementsLookupResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// resolvedRequirements (required). + public ImplicitRequirementsLookupResponse(List resolvedRequirements = default(List)) + { + // to ensure "resolvedRequirements" is required (not null) + if (resolvedRequirements == null) + { + throw new ArgumentNullException("resolvedRequirements is a required property for ImplicitRequirementsLookupResponse and cannot be null"); + } + this.ResolvedRequirements = resolvedRequirements; + } + + /// + /// Gets or Sets ResolvedRequirements + /// + [DataMember(Name = "resolved_requirements", IsRequired = true, EmitDefaultValue = true)] + public List ResolvedRequirements { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ImplicitRequirementsLookupResponse {\n"); + sb.Append(" ResolvedRequirements: ").Append(ResolvedRequirements).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ImplicitRequirementsLookupResponse); + } + + /// + /// Returns true if ImplicitRequirementsLookupResponse instances are equal + /// + /// Instance of ImplicitRequirementsLookupResponse to be compared + /// Boolean + public bool Equals(ImplicitRequirementsLookupResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.ResolvedRequirements == input.ResolvedRequirements || + this.ResolvedRequirements != null && + input.ResolvedRequirements != null && + this.ResolvedRequirements.SequenceEqual(input.ResolvedRequirements) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ResolvedRequirements != null) + { + hashCode = (hashCode * 59) + this.ResolvedRequirements.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/NonFungibleGlobalId.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/NonFungibleGlobalId.cs new file mode 100644 index 000000000..75b9b1944 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/NonFungibleGlobalId.cs @@ -0,0 +1,218 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// NonFungibleGlobalId + /// + [DataContract(Name = "NonFungibleGlobalId")] + public partial class NonFungibleGlobalId : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected NonFungibleGlobalId() { } + /// + /// Initializes a new instance of the class. + /// + /// Bech32m-encoded human readable version of the address. (required). + /// String-encoded non-fungible ID. (required). + public NonFungibleGlobalId(string resourceAddress = default(string), string nonFungibleId = default(string)) + { + // to ensure "resourceAddress" is required (not null) + if (resourceAddress == null) + { + throw new ArgumentNullException("resourceAddress is a required property for NonFungibleGlobalId and cannot be null"); + } + this.ResourceAddress = resourceAddress; + // to ensure "nonFungibleId" is required (not null) + if (nonFungibleId == null) + { + throw new ArgumentNullException("nonFungibleId is a required property for NonFungibleGlobalId and cannot be null"); + } + this.NonFungibleId = nonFungibleId; + } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "resource_address", IsRequired = true, EmitDefaultValue = true)] + public string ResourceAddress { get; set; } + + /// + /// String-encoded non-fungible ID. + /// + /// String-encoded non-fungible ID. + [DataMember(Name = "non_fungible_id", IsRequired = true, EmitDefaultValue = true)] + public string NonFungibleId { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NonFungibleGlobalId {\n"); + sb.Append(" ResourceAddress: ").Append(ResourceAddress).Append("\n"); + sb.Append(" NonFungibleId: ").Append(NonFungibleId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as NonFungibleGlobalId); + } + + /// + /// Returns true if NonFungibleGlobalId instances are equal + /// + /// Instance of NonFungibleGlobalId to be compared + /// Boolean + public bool Equals(NonFungibleGlobalId input) + { + if (input == null) + { + return false; + } + return + ( + this.ResourceAddress == input.ResourceAddress || + (this.ResourceAddress != null && + this.ResourceAddress.Equals(input.ResourceAddress)) + ) && + ( + this.NonFungibleId == input.NonFungibleId || + (this.NonFungibleId != null && + this.NonFungibleId.Equals(input.NonFungibleId)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ResourceAddress != null) + { + hashCode = (hashCode * 59) + this.ResourceAddress.GetHashCode(); + } + if (this.NonFungibleId != null) + { + hashCode = (hashCode * 59) + this.NonFungibleId.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedEd25519PublicKeyImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedEd25519PublicKeyImplicitRequirement.cs new file mode 100644 index 000000000..87e47b9de --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedEd25519PublicKeyImplicitRequirement.cs @@ -0,0 +1,219 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedEd25519PublicKeyImplicitRequirement + /// + [DataContract(Name = "ResolvedEd25519PublicKeyImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedEd25519PublicKeyImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedEd25519PublicKeyImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Hex-encoded binary blob. (required). + /// type (required) (default to ResolvedImplicitRequirementType.Ed25519PublicKey). + public ResolvedEd25519PublicKeyImplicitRequirement(long firstSeenStateVersion = default(long), string publicKeyBytesHex = default(string), ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.Ed25519PublicKey) : base(type) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "publicKeyBytesHex" is required (not null) + if (publicKeyBytesHex == null) + { + throw new ArgumentNullException("publicKeyBytesHex is a required property for ResolvedEd25519PublicKeyImplicitRequirement and cannot be null"); + } + this.PublicKeyBytesHex = publicKeyBytesHex; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Hex-encoded binary blob. + /// + /// Hex-encoded binary blob. + [DataMember(Name = "public_key_bytes_hex", IsRequired = true, EmitDefaultValue = true)] + public string PublicKeyBytesHex { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedEd25519PublicKeyImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PublicKeyBytesHex: ").Append(PublicKeyBytesHex).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedEd25519PublicKeyImplicitRequirement); + } + + /// + /// Returns true if ResolvedEd25519PublicKeyImplicitRequirement instances are equal + /// + /// Instance of ResolvedEd25519PublicKeyImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedEd25519PublicKeyImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && base.Equals(input) && + ( + this.PublicKeyBytesHex == input.PublicKeyBytesHex || + (this.PublicKeyBytesHex != null && + this.PublicKeyBytesHex.Equals(input.PublicKeyBytesHex)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PublicKeyBytesHex != null) + { + hashCode = (hashCode * 59) + this.PublicKeyBytesHex.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedEd25519PublicKeyImplicitRequirementAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedEd25519PublicKeyImplicitRequirementAllOf.cs new file mode 100644 index 000000000..d2f72d010 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedEd25519PublicKeyImplicitRequirementAllOf.cs @@ -0,0 +1,208 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedEd25519PublicKeyImplicitRequirementAllOf + /// + [DataContract(Name = "ResolvedEd25519PublicKeyImplicitRequirement_allOf")] + public partial class ResolvedEd25519PublicKeyImplicitRequirementAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedEd25519PublicKeyImplicitRequirementAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Hex-encoded binary blob. (required). + public ResolvedEd25519PublicKeyImplicitRequirementAllOf(long firstSeenStateVersion = default(long), string publicKeyBytesHex = default(string)) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "publicKeyBytesHex" is required (not null) + if (publicKeyBytesHex == null) + { + throw new ArgumentNullException("publicKeyBytesHex is a required property for ResolvedEd25519PublicKeyImplicitRequirementAllOf and cannot be null"); + } + this.PublicKeyBytesHex = publicKeyBytesHex; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Hex-encoded binary blob. + /// + /// Hex-encoded binary blob. + [DataMember(Name = "public_key_bytes_hex", IsRequired = true, EmitDefaultValue = true)] + public string PublicKeyBytesHex { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedEd25519PublicKeyImplicitRequirementAllOf {\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PublicKeyBytesHex: ").Append(PublicKeyBytesHex).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedEd25519PublicKeyImplicitRequirementAllOf); + } + + /// + /// Returns true if ResolvedEd25519PublicKeyImplicitRequirementAllOf instances are equal + /// + /// Instance of ResolvedEd25519PublicKeyImplicitRequirementAllOf to be compared + /// Boolean + public bool Equals(ResolvedEd25519PublicKeyImplicitRequirementAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && + ( + this.PublicKeyBytesHex == input.PublicKeyBytesHex || + (this.PublicKeyBytesHex != null && + this.PublicKeyBytesHex.Equals(input.PublicKeyBytesHex)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PublicKeyBytesHex != null) + { + hashCode = (hashCode * 59) + this.PublicKeyBytesHex.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerBlueprintImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerBlueprintImplicitRequirement.cs new file mode 100644 index 000000000..c194c63e1 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerBlueprintImplicitRequirement.cs @@ -0,0 +1,242 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedGlobalCallerBlueprintImplicitRequirement + /// + [DataContract(Name = "ResolvedGlobalCallerBlueprintImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedGlobalCallerBlueprintImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedGlobalCallerBlueprintImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Bech32m-encoded human readable version of the address. (required). + /// blueprintName (required). + /// type (required) (default to ResolvedImplicitRequirementType.GlobalCallerBlueprint). + public ResolvedGlobalCallerBlueprintImplicitRequirement(long firstSeenStateVersion = default(long), string packageAddress = default(string), string blueprintName = default(string), ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.GlobalCallerBlueprint) : base(type) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "packageAddress" is required (not null) + if (packageAddress == null) + { + throw new ArgumentNullException("packageAddress is a required property for ResolvedGlobalCallerBlueprintImplicitRequirement and cannot be null"); + } + this.PackageAddress = packageAddress; + // to ensure "blueprintName" is required (not null) + if (blueprintName == null) + { + throw new ArgumentNullException("blueprintName is a required property for ResolvedGlobalCallerBlueprintImplicitRequirement and cannot be null"); + } + this.BlueprintName = blueprintName; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "package_address", IsRequired = true, EmitDefaultValue = true)] + public string PackageAddress { get; set; } + + /// + /// Gets or Sets BlueprintName + /// + [DataMember(Name = "blueprint_name", IsRequired = true, EmitDefaultValue = true)] + public string BlueprintName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedGlobalCallerBlueprintImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PackageAddress: ").Append(PackageAddress).Append("\n"); + sb.Append(" BlueprintName: ").Append(BlueprintName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedGlobalCallerBlueprintImplicitRequirement); + } + + /// + /// Returns true if ResolvedGlobalCallerBlueprintImplicitRequirement instances are equal + /// + /// Instance of ResolvedGlobalCallerBlueprintImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedGlobalCallerBlueprintImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && base.Equals(input) && + ( + this.PackageAddress == input.PackageAddress || + (this.PackageAddress != null && + this.PackageAddress.Equals(input.PackageAddress)) + ) && base.Equals(input) && + ( + this.BlueprintName == input.BlueprintName || + (this.BlueprintName != null && + this.BlueprintName.Equals(input.BlueprintName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PackageAddress != null) + { + hashCode = (hashCode * 59) + this.PackageAddress.GetHashCode(); + } + if (this.BlueprintName != null) + { + hashCode = (hashCode * 59) + this.BlueprintName.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerBlueprintImplicitRequirementAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerBlueprintImplicitRequirementAllOf.cs new file mode 100644 index 000000000..694846f1a --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerBlueprintImplicitRequirementAllOf.cs @@ -0,0 +1,231 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedGlobalCallerBlueprintImplicitRequirementAllOf + /// + [DataContract(Name = "ResolvedGlobalCallerBlueprintImplicitRequirement_allOf")] + public partial class ResolvedGlobalCallerBlueprintImplicitRequirementAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedGlobalCallerBlueprintImplicitRequirementAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Bech32m-encoded human readable version of the address. (required). + /// blueprintName (required). + public ResolvedGlobalCallerBlueprintImplicitRequirementAllOf(long firstSeenStateVersion = default(long), string packageAddress = default(string), string blueprintName = default(string)) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "packageAddress" is required (not null) + if (packageAddress == null) + { + throw new ArgumentNullException("packageAddress is a required property for ResolvedGlobalCallerBlueprintImplicitRequirementAllOf and cannot be null"); + } + this.PackageAddress = packageAddress; + // to ensure "blueprintName" is required (not null) + if (blueprintName == null) + { + throw new ArgumentNullException("blueprintName is a required property for ResolvedGlobalCallerBlueprintImplicitRequirementAllOf and cannot be null"); + } + this.BlueprintName = blueprintName; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "package_address", IsRequired = true, EmitDefaultValue = true)] + public string PackageAddress { get; set; } + + /// + /// Gets or Sets BlueprintName + /// + [DataMember(Name = "blueprint_name", IsRequired = true, EmitDefaultValue = true)] + public string BlueprintName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedGlobalCallerBlueprintImplicitRequirementAllOf {\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PackageAddress: ").Append(PackageAddress).Append("\n"); + sb.Append(" BlueprintName: ").Append(BlueprintName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedGlobalCallerBlueprintImplicitRequirementAllOf); + } + + /// + /// Returns true if ResolvedGlobalCallerBlueprintImplicitRequirementAllOf instances are equal + /// + /// Instance of ResolvedGlobalCallerBlueprintImplicitRequirementAllOf to be compared + /// Boolean + public bool Equals(ResolvedGlobalCallerBlueprintImplicitRequirementAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && + ( + this.PackageAddress == input.PackageAddress || + (this.PackageAddress != null && + this.PackageAddress.Equals(input.PackageAddress)) + ) && + ( + this.BlueprintName == input.BlueprintName || + (this.BlueprintName != null && + this.BlueprintName.Equals(input.BlueprintName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PackageAddress != null) + { + hashCode = (hashCode * 59) + this.PackageAddress.GetHashCode(); + } + if (this.BlueprintName != null) + { + hashCode = (hashCode * 59) + this.BlueprintName.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerEntityImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerEntityImplicitRequirement.cs new file mode 100644 index 000000000..837d5baf8 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerEntityImplicitRequirement.cs @@ -0,0 +1,219 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedGlobalCallerEntityImplicitRequirement + /// + [DataContract(Name = "ResolvedGlobalCallerEntityImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedGlobalCallerEntityImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedGlobalCallerEntityImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Bech32m-encoded human readable version of the address. (required). + /// type (required) (default to ResolvedImplicitRequirementType.GlobalCallerEntity). + public ResolvedGlobalCallerEntityImplicitRequirement(long firstSeenStateVersion = default(long), string entityAddress = default(string), ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.GlobalCallerEntity) : base(type) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "entityAddress" is required (not null) + if (entityAddress == null) + { + throw new ArgumentNullException("entityAddress is a required property for ResolvedGlobalCallerEntityImplicitRequirement and cannot be null"); + } + this.EntityAddress = entityAddress; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "entity_address", IsRequired = true, EmitDefaultValue = true)] + public string EntityAddress { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedGlobalCallerEntityImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" EntityAddress: ").Append(EntityAddress).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedGlobalCallerEntityImplicitRequirement); + } + + /// + /// Returns true if ResolvedGlobalCallerEntityImplicitRequirement instances are equal + /// + /// Instance of ResolvedGlobalCallerEntityImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedGlobalCallerEntityImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && base.Equals(input) && + ( + this.EntityAddress == input.EntityAddress || + (this.EntityAddress != null && + this.EntityAddress.Equals(input.EntityAddress)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.EntityAddress != null) + { + hashCode = (hashCode * 59) + this.EntityAddress.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerEntityImplicitRequirementAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerEntityImplicitRequirementAllOf.cs new file mode 100644 index 000000000..196b8ae68 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedGlobalCallerEntityImplicitRequirementAllOf.cs @@ -0,0 +1,208 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedGlobalCallerEntityImplicitRequirementAllOf + /// + [DataContract(Name = "ResolvedGlobalCallerEntityImplicitRequirement_allOf")] + public partial class ResolvedGlobalCallerEntityImplicitRequirementAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedGlobalCallerEntityImplicitRequirementAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Bech32m-encoded human readable version of the address. (required). + public ResolvedGlobalCallerEntityImplicitRequirementAllOf(long firstSeenStateVersion = default(long), string entityAddress = default(string)) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "entityAddress" is required (not null) + if (entityAddress == null) + { + throw new ArgumentNullException("entityAddress is a required property for ResolvedGlobalCallerEntityImplicitRequirementAllOf and cannot be null"); + } + this.EntityAddress = entityAddress; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "entity_address", IsRequired = true, EmitDefaultValue = true)] + public string EntityAddress { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedGlobalCallerEntityImplicitRequirementAllOf {\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" EntityAddress: ").Append(EntityAddress).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedGlobalCallerEntityImplicitRequirementAllOf); + } + + /// + /// Returns true if ResolvedGlobalCallerEntityImplicitRequirementAllOf instances are equal + /// + /// Instance of ResolvedGlobalCallerEntityImplicitRequirementAllOf to be compared + /// Boolean + public bool Equals(ResolvedGlobalCallerEntityImplicitRequirementAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && + ( + this.EntityAddress == input.EntityAddress || + (this.EntityAddress != null && + this.EntityAddress.Equals(input.EntityAddress)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.EntityAddress != null) + { + hashCode = (hashCode * 59) + this.EntityAddress.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedImplicitRequirement.cs new file mode 100644 index 000000000..5ba97afb1 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedImplicitRequirement.cs @@ -0,0 +1,200 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedImplicitRequirement + /// + [DataContract(Name = "ResolvedImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "ResolvedEd25519PublicKeyImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "ResolvedGlobalCallerBlueprintImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "ResolvedGlobalCallerEntityImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "ResolvedPackageOfDirectCallerImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ResolvedProtocolExecutionImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "ResolvedSecp256k1PublicKeyImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ResolvedValidatorExecutionImplicitRequirement")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedImplicitRequirement : IEquatable + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public ResolvedImplicitRequirementType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + public ResolvedImplicitRequirement(ResolvedImplicitRequirementType type = default(ResolvedImplicitRequirementType)) + { + this.Type = type; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedImplicitRequirement {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedImplicitRequirement); + } + + /// + /// Returns true if ResolvedImplicitRequirement instances are equal + /// + /// Instance of ResolvedImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedImplicitRequirement input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedImplicitRequirementType.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedImplicitRequirementType.cs new file mode 100644 index 000000000..95bd8fdca --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedImplicitRequirementType.cs @@ -0,0 +1,142 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// Defines ResolvedImplicitRequirementType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResolvedImplicitRequirementType + { + /// + /// Enum Secp256k1PublicKey for value: Secp256k1PublicKey + /// + [EnumMember(Value = "Secp256k1PublicKey")] + Secp256k1PublicKey = 1, + + /// + /// Enum Ed25519PublicKey for value: Ed25519PublicKey + /// + [EnumMember(Value = "Ed25519PublicKey")] + Ed25519PublicKey = 2, + + /// + /// Enum GlobalCallerBlueprint for value: GlobalCallerBlueprint + /// + [EnumMember(Value = "GlobalCallerBlueprint")] + GlobalCallerBlueprint = 3, + + /// + /// Enum GlobalCallerEntity for value: GlobalCallerEntity + /// + [EnumMember(Value = "GlobalCallerEntity")] + GlobalCallerEntity = 4, + + /// + /// Enum PackageOfDirectCaller for value: PackageOfDirectCaller + /// + [EnumMember(Value = "PackageOfDirectCaller")] + PackageOfDirectCaller = 5, + + /// + /// Enum ProtocolExecution for value: ProtocolExecution + /// + [EnumMember(Value = "ProtocolExecution")] + ProtocolExecution = 6, + + /// + /// Enum ValidatorExecution for value: ValidatorExecution + /// + [EnumMember(Value = "ValidatorExecution")] + ValidatorExecution = 7 + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedPackageOfDirectCallerImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedPackageOfDirectCallerImplicitRequirement.cs new file mode 100644 index 000000000..92946f8c2 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedPackageOfDirectCallerImplicitRequirement.cs @@ -0,0 +1,219 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedPackageOfDirectCallerImplicitRequirement + /// + [DataContract(Name = "ResolvedPackageOfDirectCallerImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedPackageOfDirectCallerImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedPackageOfDirectCallerImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Bech32m-encoded human readable version of the address. (required). + /// type (required) (default to ResolvedImplicitRequirementType.PackageOfDirectCaller). + public ResolvedPackageOfDirectCallerImplicitRequirement(long firstSeenStateVersion = default(long), string packageAddress = default(string), ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.PackageOfDirectCaller) : base(type) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "packageAddress" is required (not null) + if (packageAddress == null) + { + throw new ArgumentNullException("packageAddress is a required property for ResolvedPackageOfDirectCallerImplicitRequirement and cannot be null"); + } + this.PackageAddress = packageAddress; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "package_address", IsRequired = true, EmitDefaultValue = true)] + public string PackageAddress { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedPackageOfDirectCallerImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PackageAddress: ").Append(PackageAddress).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedPackageOfDirectCallerImplicitRequirement); + } + + /// + /// Returns true if ResolvedPackageOfDirectCallerImplicitRequirement instances are equal + /// + /// Instance of ResolvedPackageOfDirectCallerImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedPackageOfDirectCallerImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && base.Equals(input) && + ( + this.PackageAddress == input.PackageAddress || + (this.PackageAddress != null && + this.PackageAddress.Equals(input.PackageAddress)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PackageAddress != null) + { + hashCode = (hashCode * 59) + this.PackageAddress.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedPackageOfDirectCallerImplicitRequirementAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedPackageOfDirectCallerImplicitRequirementAllOf.cs new file mode 100644 index 000000000..d36c2381e --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedPackageOfDirectCallerImplicitRequirementAllOf.cs @@ -0,0 +1,208 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedPackageOfDirectCallerImplicitRequirementAllOf + /// + [DataContract(Name = "ResolvedPackageOfDirectCallerImplicitRequirement_allOf")] + public partial class ResolvedPackageOfDirectCallerImplicitRequirementAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedPackageOfDirectCallerImplicitRequirementAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Bech32m-encoded human readable version of the address. (required). + public ResolvedPackageOfDirectCallerImplicitRequirementAllOf(long firstSeenStateVersion = default(long), string packageAddress = default(string)) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "packageAddress" is required (not null) + if (packageAddress == null) + { + throw new ArgumentNullException("packageAddress is a required property for ResolvedPackageOfDirectCallerImplicitRequirementAllOf and cannot be null"); + } + this.PackageAddress = packageAddress; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Bech32m-encoded human readable version of the address. + /// + /// Bech32m-encoded human readable version of the address. + [DataMember(Name = "package_address", IsRequired = true, EmitDefaultValue = true)] + public string PackageAddress { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedPackageOfDirectCallerImplicitRequirementAllOf {\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PackageAddress: ").Append(PackageAddress).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedPackageOfDirectCallerImplicitRequirementAllOf); + } + + /// + /// Returns true if ResolvedPackageOfDirectCallerImplicitRequirementAllOf instances are equal + /// + /// Instance of ResolvedPackageOfDirectCallerImplicitRequirementAllOf to be compared + /// Boolean + public bool Equals(ResolvedPackageOfDirectCallerImplicitRequirementAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && + ( + this.PackageAddress == input.PackageAddress || + (this.PackageAddress != null && + this.PackageAddress.Equals(input.PackageAddress)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PackageAddress != null) + { + hashCode = (hashCode * 59) + this.PackageAddress.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedProtocolExecutionImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedProtocolExecutionImplicitRequirement.cs new file mode 100644 index 000000000..293a3a2ab --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedProtocolExecutionImplicitRequirement.cs @@ -0,0 +1,181 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedProtocolExecutionImplicitRequirement + /// + [DataContract(Name = "ResolvedProtocolExecutionImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedProtocolExecutionImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedProtocolExecutionImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required) (default to ResolvedImplicitRequirementType.ProtocolExecution). + public ResolvedProtocolExecutionImplicitRequirement(ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.ProtocolExecution) : base(type) + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedProtocolExecutionImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedProtocolExecutionImplicitRequirement); + } + + /// + /// Returns true if ResolvedProtocolExecutionImplicitRequirement instances are equal + /// + /// Instance of ResolvedProtocolExecutionImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedProtocolExecutionImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedSecp256k1PublicKeyImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedSecp256k1PublicKeyImplicitRequirement.cs new file mode 100644 index 000000000..3e31b8b63 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedSecp256k1PublicKeyImplicitRequirement.cs @@ -0,0 +1,219 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedSecp256k1PublicKeyImplicitRequirement + /// + [DataContract(Name = "ResolvedSecp256k1PublicKeyImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedSecp256k1PublicKeyImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedSecp256k1PublicKeyImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Hex-encoded binary blob. (required). + /// type (required) (default to ResolvedImplicitRequirementType.Secp256k1PublicKey). + public ResolvedSecp256k1PublicKeyImplicitRequirement(long firstSeenStateVersion = default(long), string publicKeyBytesHex = default(string), ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.Secp256k1PublicKey) : base(type) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "publicKeyBytesHex" is required (not null) + if (publicKeyBytesHex == null) + { + throw new ArgumentNullException("publicKeyBytesHex is a required property for ResolvedSecp256k1PublicKeyImplicitRequirement and cannot be null"); + } + this.PublicKeyBytesHex = publicKeyBytesHex; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Hex-encoded binary blob. + /// + /// Hex-encoded binary blob. + [DataMember(Name = "public_key_bytes_hex", IsRequired = true, EmitDefaultValue = true)] + public string PublicKeyBytesHex { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedSecp256k1PublicKeyImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PublicKeyBytesHex: ").Append(PublicKeyBytesHex).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedSecp256k1PublicKeyImplicitRequirement); + } + + /// + /// Returns true if ResolvedSecp256k1PublicKeyImplicitRequirement instances are equal + /// + /// Instance of ResolvedSecp256k1PublicKeyImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedSecp256k1PublicKeyImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && base.Equals(input) && + ( + this.PublicKeyBytesHex == input.PublicKeyBytesHex || + (this.PublicKeyBytesHex != null && + this.PublicKeyBytesHex.Equals(input.PublicKeyBytesHex)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PublicKeyBytesHex != null) + { + hashCode = (hashCode * 59) + this.PublicKeyBytesHex.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedSecp256k1PublicKeyImplicitRequirementAllOf.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedSecp256k1PublicKeyImplicitRequirementAllOf.cs new file mode 100644 index 000000000..2633cc754 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedSecp256k1PublicKeyImplicitRequirementAllOf.cs @@ -0,0 +1,208 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedSecp256k1PublicKeyImplicitRequirementAllOf + /// + [DataContract(Name = "ResolvedSecp256k1PublicKeyImplicitRequirement_allOf")] + public partial class ResolvedSecp256k1PublicKeyImplicitRequirementAllOf : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedSecp256k1PublicKeyImplicitRequirementAllOf() { } + /// + /// Initializes a new instance of the class. + /// + /// firstSeenStateVersion (required). + /// Hex-encoded binary blob. (required). + public ResolvedSecp256k1PublicKeyImplicitRequirementAllOf(long firstSeenStateVersion = default(long), string publicKeyBytesHex = default(string)) + { + this.FirstSeenStateVersion = firstSeenStateVersion; + // to ensure "publicKeyBytesHex" is required (not null) + if (publicKeyBytesHex == null) + { + throw new ArgumentNullException("publicKeyBytesHex is a required property for ResolvedSecp256k1PublicKeyImplicitRequirementAllOf and cannot be null"); + } + this.PublicKeyBytesHex = publicKeyBytesHex; + } + + /// + /// Gets or Sets FirstSeenStateVersion + /// + [DataMember(Name = "first_seen_state_version", IsRequired = true, EmitDefaultValue = true)] + public long FirstSeenStateVersion { get; set; } + + /// + /// Hex-encoded binary blob. + /// + /// Hex-encoded binary blob. + [DataMember(Name = "public_key_bytes_hex", IsRequired = true, EmitDefaultValue = true)] + public string PublicKeyBytesHex { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedSecp256k1PublicKeyImplicitRequirementAllOf {\n"); + sb.Append(" FirstSeenStateVersion: ").Append(FirstSeenStateVersion).Append("\n"); + sb.Append(" PublicKeyBytesHex: ").Append(PublicKeyBytesHex).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedSecp256k1PublicKeyImplicitRequirementAllOf); + } + + /// + /// Returns true if ResolvedSecp256k1PublicKeyImplicitRequirementAllOf instances are equal + /// + /// Instance of ResolvedSecp256k1PublicKeyImplicitRequirementAllOf to be compared + /// Boolean + public bool Equals(ResolvedSecp256k1PublicKeyImplicitRequirementAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.FirstSeenStateVersion == input.FirstSeenStateVersion || + this.FirstSeenStateVersion.Equals(input.FirstSeenStateVersion) + ) && + ( + this.PublicKeyBytesHex == input.PublicKeyBytesHex || + (this.PublicKeyBytesHex != null && + this.PublicKeyBytesHex.Equals(input.PublicKeyBytesHex)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FirstSeenStateVersion.GetHashCode(); + if (this.PublicKeyBytesHex != null) + { + hashCode = (hashCode * 59) + this.PublicKeyBytesHex.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedValidatorExecutionImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedValidatorExecutionImplicitRequirement.cs new file mode 100644 index 000000000..0888d865e --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResolvedValidatorExecutionImplicitRequirement.cs @@ -0,0 +1,181 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +/* + * Radix Gateway API - Babylon + * + * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission. It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up. The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network. This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own. ## Migration guide Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases). ## Integration and forward compatibility guarantees All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects. When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out. On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway. The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. + * + * The version of the OpenAPI document: v1.10.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using JsonSubTypes; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// ResolvedValidatorExecutionImplicitRequirement + /// + [DataContract(Name = "ResolvedValidatorExecutionImplicitRequirement")] + [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(ResolvedEd25519PublicKeyImplicitRequirement), "Ed25519PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerBlueprintImplicitRequirement), "GlobalCallerBlueprint")] + [JsonSubtypes.KnownSubType(typeof(ResolvedGlobalCallerEntityImplicitRequirement), "GlobalCallerEntity")] + [JsonSubtypes.KnownSubType(typeof(ResolvedPackageOfDirectCallerImplicitRequirement), "PackageOfDirectCaller")] + [JsonSubtypes.KnownSubType(typeof(ResolvedProtocolExecutionImplicitRequirement), "ProtocolExecution")] + [JsonSubtypes.KnownSubType(typeof(ResolvedSecp256k1PublicKeyImplicitRequirement), "Secp256k1PublicKey")] + [JsonSubtypes.KnownSubType(typeof(ResolvedValidatorExecutionImplicitRequirement), "ValidatorExecution")] + public partial class ResolvedValidatorExecutionImplicitRequirement : ResolvedImplicitRequirement, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ResolvedValidatorExecutionImplicitRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required) (default to ResolvedImplicitRequirementType.ValidatorExecution). + public ResolvedValidatorExecutionImplicitRequirement(ResolvedImplicitRequirementType type = ResolvedImplicitRequirementType.ValidatorExecution) : base(type) + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ResolvedValidatorExecutionImplicitRequirement {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ResolvedValidatorExecutionImplicitRequirement); + } + + /// + /// Returns true if ResolvedValidatorExecutionImplicitRequirement instances are equal + /// + /// Instance of ResolvedValidatorExecutionImplicitRequirement to be compared + /// Boolean + public bool Equals(ResolvedValidatorExecutionImplicitRequirement input) + { + if (input == null) + { + return false; + } + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/TransactionAccountDepositPreValidationAuthorizedDepositorBadge.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/TransactionAccountDepositPreValidationAuthorizedDepositorBadge.cs index 97e213802..51bb3fbd2 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/TransactionAccountDepositPreValidationAuthorizedDepositorBadge.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/TransactionAccountDepositPreValidationAuthorizedDepositorBadge.cs @@ -116,25 +116,11 @@ protected TransactionAccountDepositPreValidationAuthorizedDepositorBadge() { } /// Initializes a new instance of the class. /// /// badgeType (required). - /// Bech32m-encoded human readable version of the address. (required). - public TransactionAccountDepositPreValidationAuthorizedDepositorBadge(AccountAuthorizedDepositorBadgeType badgeType = default(AccountAuthorizedDepositorBadgeType), string resourceAddress = default(string)) + public TransactionAccountDepositPreValidationAuthorizedDepositorBadge(AccountAuthorizedDepositorBadgeType badgeType = default(AccountAuthorizedDepositorBadgeType)) { this.BadgeType = badgeType; - // to ensure "resourceAddress" is required (not null) - if (resourceAddress == null) - { - throw new ArgumentNullException("resourceAddress is a required property for TransactionAccountDepositPreValidationAuthorizedDepositorBadge and cannot be null"); - } - this.ResourceAddress = resourceAddress; } - /// - /// Bech32m-encoded human readable version of the address. - /// - /// Bech32m-encoded human readable version of the address. - [DataMember(Name = "resource_address", IsRequired = true, EmitDefaultValue = true)] - public string ResourceAddress { get; set; } - /// /// Returns the string presentation of the object /// @@ -144,7 +130,6 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class TransactionAccountDepositPreValidationAuthorizedDepositorBadge {\n"); sb.Append(" BadgeType: ").Append(BadgeType).Append("\n"); - sb.Append(" ResourceAddress: ").Append(ResourceAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -183,11 +168,6 @@ public bool Equals(TransactionAccountDepositPreValidationAuthorizedDepositorBadg ( this.BadgeType == input.BadgeType || this.BadgeType.Equals(input.BadgeType) - ) && - ( - this.ResourceAddress == input.ResourceAddress || - (this.ResourceAddress != null && - this.ResourceAddress.Equals(input.ResourceAddress)) ); } @@ -201,10 +181,6 @@ public override int GetHashCode() { int hashCode = 41; hashCode = (hashCode * 59) + this.BadgeType.GetHashCode(); - if (this.ResourceAddress != null) - { - hashCode = (hashCode * 59) + this.ResourceAddress.GetHashCode(); - } return hashCode; } } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/packages.lock.json b/src/RadixDlt.NetworkGateway.GatewayApiSdk/packages.lock.json index c9a603679..c354f35bb 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/packages.lock.json +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/packages.lock.json @@ -271,27 +271,6 @@ "resolved": "8.0.0", "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Polly.Core": { "type": "Transitive", "resolved": "8.3.0", @@ -302,11 +281,6 @@ "resolved": "1.2.0.556", "contentHash": "zvn9Mqs/ox/83cpYPignI8hJEM2A93s2HkHs8HYMOAQW0PkampyoErAiIyKxgTLqbbad29HX/shv/6LGSjPJNQ==" }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "1.7.1", - "contentHash": "B43Zsz5EfMwyEbnObwRxW5u85fzJma3lrDeGcSAV1qkhSRTNY5uXAByTn9h9ddNdhM+4/YoLc/CI43umjwIl9Q==" - }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", "resolved": "8.0.0", @@ -345,8 +319,7 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", - "RadixDlt.CoreApiSdk": "[1.7.0-develop, )" + "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, "FluentValidation": { @@ -403,16 +376,6 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } - }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } } } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs index 051a1a300..105180f54 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs @@ -69,8 +69,6 @@ using RadixDlt.NetworkGateway.Abstractions.StandardMetadata; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using RadixDlt.NetworkGateway.PostgresIntegration.ValueConverters; -using System; -using System.Diagnostics; namespace RadixDlt.NetworkGateway.PostgresIntegration; @@ -173,6 +171,8 @@ internal abstract class CommonDbContext : DbContext public DbSet ResourceHolders => Set(); + public DbSet ImplicitRequirements => Set(); + public DbSet EntitiesByRoleRequirement => Set(); public DbSet EntityResourceEntryDefinition => Set(); @@ -227,6 +227,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) HookupTransactions(modelBuilder); HookupPendingTransactions(modelBuilder); HookupDefinitions(modelBuilder); + RegisterImplicitRequirements(modelBuilder); + RegisterEntitiesByRoleRequirement(modelBuilder); HookupHistory(modelBuilder); } @@ -472,6 +474,96 @@ private static void HookupDefinitions(ModelBuilder modelBuilder) .HasIndex(e => new { e.VaultEntityId, e.FromStateVersion }); } + private static void RegisterImplicitRequirements(ModelBuilder modelBuilder) + { + modelBuilder.HasPostgresEnum(); + modelBuilder.HasPostgresEnum(); + + modelBuilder + .Entity() + .HasDiscriminator(e => e.Discriminator) + .HasValue(ImplicitRequirementType.GlobalCallerEntity) + .HasValue(ImplicitRequirementType.PackageOfDirectCaller) + .HasValue(ImplicitRequirementType.GlobalCallerBlueprint) + .HasValue(ImplicitRequirementType.Secp256k1PublicKey) + .HasValue(ImplicitRequirementType.Ed25519PublicKey); + + // All indexes here are used by both DataAggregator and API. + // Only difference is that API when reading needed to include `FirstSeenStateVersion` field. + modelBuilder + .Entity() + .HasIndex(e => new { e.Hash, e.EntityId }) + .HasFilter("discriminator = 'global_caller_entity'") + .HasDatabaseName("IX_implicit_requirements_global_caller_entity") + .IncludeProperties(x => new { x.FirstSeenStateVersion }) + .IsUnique(); + + modelBuilder + .Entity() + .HasIndex(e => new { e.Hash, e.EntityId }) + .HasFilter("discriminator = 'package_of_direct_caller'") + .HasDatabaseName("IX_implicit_requirements_package_of_direct_caller") + .IncludeProperties(x => new { x.FirstSeenStateVersion }) + .IsUnique(); + + modelBuilder + .Entity() + .HasIndex(e => new { e.Hash, e.EntityId, e.BlueprintName }) + .HasFilter("discriminator = 'global_caller_blueprint'") + .HasDatabaseName("IX_implicit_requirements_global_caller_blueprint") + .IncludeProperties(x => new { x.FirstSeenStateVersion }) + .IsUnique(); + + modelBuilder + .Entity() + .HasIndex(e => new { e.Hash }) + .HasFilter("discriminator = 'secp256k1public_key'") + .HasDatabaseName("IX_implicit_requirements_secp256k1public_key") + .IncludeProperties(x => new { x.PublicKeyBytes, x.FirstSeenStateVersion }) + .IsUnique(); + + modelBuilder + .Entity() + .HasIndex(e => new { e.Hash }) + .HasFilter("discriminator = 'ed25519public_key'") + .HasDatabaseName("IX_implicit_requirements_ed25519public_key") + .IncludeProperties(x => new { x.PublicKeyBytes, x.FirstSeenStateVersion }) + .IsUnique(); + } + + private static void RegisterEntitiesByRoleRequirement(ModelBuilder modelBuilder) + { + modelBuilder + .Entity() + .HasDiscriminator(DiscriminatorColumnName) + .HasValue(EntityRoleRequirementType.Resource) + .HasValue(EntityRoleRequirementType.NonFungible); + + // Used by DA to insert data. + modelBuilder + .Entity() + .HasIndex(e => new { e.EntityId, e.ResourceEntityId }) + .HasFilter("discriminator = 'resource'"); + + // Used by API to fetch page of data. + modelBuilder + .Entity() + .HasIndex(e => new { e.FirstSeenStateVersion, e.Id, e.EntityId, e.ResourceEntityId }) + .HasFilter("discriminator = 'resource'"); + + // Used by DA to insert data. + modelBuilder + .Entity() + .HasIndex(e => new { e.EntityId, e.ResourceEntityId, e.NonFungibleLocalId }) + .HasFilter("discriminator = 'non_fungible'"); + + // Used by API to fetch page of data. + modelBuilder + .Entity() + .HasIndex(e => new { e.FirstSeenStateVersion, e.Id, e.EntityId, e.ResourceEntityId, e.NonFungibleLocalId }) + .HasFilter("discriminator = 'non_fungible'"); + } + private static void HookupHistory(ModelBuilder modelBuilder) { modelBuilder @@ -668,36 +760,6 @@ private static void HookupHistory(ModelBuilder modelBuilder) .HasIndex(e => new { e.ResourceEntityId, e.Balance, e.EntityId }) .IsDescending(false, true, false); - modelBuilder - .Entity() - .HasDiscriminator(DiscriminatorColumnName) - .HasValue(EntityRoleRequirementType.Resource) - .HasValue(EntityRoleRequirementType.NonFungible); - - // Used by DA to insert data. - modelBuilder - .Entity() - .HasIndex(e => new { e.ResourceEntityId }) - .HasFilter("discriminator = 'resource'"); - - // Used by API to fetch page of data. - modelBuilder - .Entity() - .HasIndex(e => new { e.FirstSeenStateVersion, e.Id, e.EntityId, e.ResourceEntityId }) - .HasFilter("discriminator = 'resource'"); - - // Used by DA to insert data. - modelBuilder - .Entity() - .HasIndex(e => new { e.ResourceEntityId, e.NonFungibleLocalId }) - .HasFilter("discriminator = 'non_fungible'"); - - // Used by API to fetch page of data. - modelBuilder - .Entity() - .HasIndex(e => new { e.FirstSeenStateVersion, e.Id, e.EntityId, e.ResourceEntityId, e.NonFungibleLocalId }) - .HasFilter("discriminator = 'non_fungible'"); - modelBuilder .Entity() .HasIndex(e => new { e.EntityId, e.FromStateVersion }); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypesRegistrator.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypesRegistrator.cs index 17b66feb1..eb44982e7 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypesRegistrator.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CustomTypesRegistrator.cs @@ -127,6 +127,8 @@ public static void EnsureConfigured() NpgsqlConnection.GlobalTypeMapper.MapEnum(); NpgsqlConnection.GlobalTypeMapper.MapEnum(); NpgsqlConnection.GlobalTypeMapper.MapEnum(); + NpgsqlConnection.GlobalTypeMapper.MapEnum(); + NpgsqlConnection.GlobalTypeMapper.MapEnum(); #pragma warning restore CS0618 _configured = true; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/GatewayApiBuilderExtensions.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/GatewayApiBuilderExtensions.cs index d970acf85..3e9abbbe5 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/GatewayApiBuilderExtensions.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/GatewayApiBuilderExtensions.cs @@ -93,6 +93,7 @@ public static GatewayApiBuilder AddPostgresPersistenceCore(this GatewayApiBuilde .AddScoped() .AddScoped() .AddScoped() + .AddScoped() .AddScoped() .AddScoped() .AddScoped() diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/ServiceCollectionExtensions.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/ServiceCollectionExtensions.cs index 355b45d1f..a4c618d20 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/ServiceCollectionExtensions.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/IoC/ServiceCollectionExtensions.cs @@ -142,6 +142,7 @@ internal static IServiceCollection AddNpgsqlDataSourceHolder(this IServiceCol dataSourceBuilder.MapEnum(); dataSourceBuilder.MapEnum(); dataSourceBuilder.MapEnum(); + dataSourceBuilder.MapEnum(); return new NpgsqlDataSourceHolder(dataSourceBuilder.Build()); }, diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/IProcessor.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/IProcessorBase.cs similarity index 100% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/IProcessor.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/IProcessorBase.cs diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 1b35f5168..248f23c0f 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -230,7 +230,7 @@ UPDATE pending_transactions private async Task ProcessTransactions(ReadWriteDbContext dbContext, ConsistentLedgerExtension ledgerExtension, CancellationToken token) { - var networkConfiguration = await _networkConfigurationProvider.GetNetworkConfiguration(token); + var networkConfiguration = _networkConfigurationProvider.GetNetworkConfiguration(); var rowsInserted = 0; var rowsUpdated = 0; var dbReadDuration = TimeSpan.Zero; @@ -268,19 +268,57 @@ private async Task ProcessTransactions(ReadWriteDbContext db } var processorContext = new ProcessorContext(sequences, _storageOptionsMonitor.CurrentValue, readHelper, writeHelper, networkConfiguration, token); - var relationshipProcessor = new EntityRelationshipProcessor(referencedEntities); - var entityByRoleProcessor = new EntitiesByRoleRequirementProcessor( - processorContext, dbContext, referencedEntities, _ledgerProcessorsOptionsMonitor, _observers, _entitiesByRoleRequirementProcessorLogger); + + // Have to be created here as we're sharing them between + // - ledgerTransactionProcessor (produces manifest class for transaction) + // - LedgerTransactionMarkersProcessor (produces markers for manifest addresses and markers for manifest classes) var manifestProcessor = new ManifestProcessor(processorContext, referencedEntities, networkConfiguration); + + // Have to be created here as we're sharing them between + // - ledgerTransactionProcessor (produces affected global entities per transaction) + // - LedgerTransactionMarkersProcessor (produces markers affected global entities) var affectedGlobalEntitiesProcessor = new AffectedGlobalEntitiesProcessor(processorContext, referencedEntities, networkConfiguration); - var ledgerTransactionMarkersProcessor = new LedgerTransactionMarkersProcessor( - manifestProcessor, - affectedGlobalEntitiesProcessor, + // Created explicitly here not as part of processors list as it's completely different processor and one of it's own. + // Better to call it explicitly. + var entityRelationshipProcessor = new EntityRelationshipProcessor(referencedEntities); + + // This processor has to be assigned here as we're using it to GetSummaryOfLastProcessedTransaction() + // Can't be created as item in processors list. + var ledgerTransactionProcessor = new LedgerTransactionProcessor( processorContext, + _clock, referencedEntities, + manifestProcessor, + affectedGlobalEntitiesProcessor, writeHelper, - networkConfiguration); + ledgerExtension.LatestTransactionSummary); + + var processors = new List + { + ledgerTransactionProcessor, + new LedgerTransactionMarkersProcessor(manifestProcessor, affectedGlobalEntitiesProcessor, processorContext, referencedEntities, writeHelper, networkConfiguration), + new ResourceSupplyProcessor(processorContext), + new EntityStateProcessor(processorContext, referencedEntities), + new EntityMetadataProcessor(processorContext), + new EntitySchemaProcessor(processorContext, referencedEntities), + new ComponentMethodRoyaltyProcessor(processorContext), + new EntityRoleAssignmentProcessor(processorContext), + new EntitiesByRoleRequirementProcessor(processorContext, dbContext, referencedEntities, _ledgerProcessorsOptionsMonitor, _observers, _entitiesByRoleRequirementProcessorLogger), + new PackageCodeProcessor(processorContext), + new PackageBlueprintProcessor(processorContext, referencedEntities), + new AccountAuthorizedDepositorsProcessor(processorContext, referencedEntities), + new AccountResourcePreferenceRulesProcessor(processorContext, referencedEntities), + new AccountDefaultDepositRuleProcessor(processorContext), + new KeyValueStoreProcessor(processorContext), + new ValidatorProcessor(processorContext, referencedEntities), + new ValidatorEmissionProcessor(processorContext), + new AccountLockerProcessor(processorContext, referencedEntities), + new StandardMetadataProcessor(processorContext, referencedEntities), + new EntityResourceProcessor(processorContext, dbContext, _observers), + new VaultProcessor(processorContext), + new ImplicitRequirementsProcessor(processorContext, referencedEntities, dbContext, _observers), + }; // step: scan for any referenced entities { @@ -300,7 +338,11 @@ private async Task ProcessTransactions(ReadWriteDbContext db try { - ledgerTransactionMarkersProcessor.OnTransactionScan(committedTransaction, stateVersion); + foreach (var processor in processors.OfType()) + { + processor.OnTransactionScan(committedTransaction, stateVersion); + } + foreach (var newGlobalEntity in stateUpdates.NewGlobalEntities) { var referencedEntity = referencedEntities.GetOrAdd((EntityAddress)newGlobalEntity.EntityAddress, ea => new ReferencedEntity(ea, newGlobalEntity.EntityType, stateVersion)); @@ -434,8 +476,12 @@ private async Task ProcessTransactions(ReadWriteDbContext db }); } - relationshipProcessor.OnUpsertScan(substate, referencedEntity, stateVersion); - entityByRoleProcessor.OnUpsertScan(substate, referencedEntity, stateVersion); + entityRelationshipProcessor.OnUpsertScan(substate, referencedEntity, stateVersion); + + foreach (var processor in processors.OfType()) + { + processor.OnUpsertScan(substate, referencedEntity, stateVersion); + } } foreach (var deletedSubstate in stateUpdates.DeletedSubstates) @@ -621,40 +667,6 @@ private async Task ProcessTransactions(ReadWriteDbContext db await _observers.ForEachAsync(x => x.StageCompleted("resolve_and_create_entities", sw.Elapsed, null)); } - var ledgerTransactionProcessor = new LedgerTransactionProcessor( - processorContext, - _clock, - referencedEntities, - manifestProcessor, - affectedGlobalEntitiesProcessor, - writeHelper, - ledgerExtension.LatestTransactionSummary); - - var processors = new List - { - ledgerTransactionProcessor, - ledgerTransactionMarkersProcessor, - new ResourceSupplyProcessor(processorContext), - new EntityStateProcessor(processorContext, referencedEntities), - new EntityMetadataProcessor(processorContext), - new EntitySchemaProcessor(processorContext, referencedEntities), - new ComponentMethodRoyaltyProcessor(processorContext), - new EntityRoleAssignmentProcessor(processorContext), - entityByRoleProcessor, - new PackageCodeProcessor(processorContext), - new PackageBlueprintProcessor(processorContext, referencedEntities), - new AccountAuthorizedDepositorsProcessor(processorContext, referencedEntities), - new AccountResourcePreferenceRulesProcessor(processorContext, referencedEntities), - new AccountDefaultDepositRuleProcessor(processorContext), - new KeyValueStoreProcessor(processorContext), - new ValidatorProcessor(processorContext, referencedEntities), - new ValidatorEmissionProcessor(processorContext), - new AccountLockerProcessor(processorContext, referencedEntities), - new StandardMetadataProcessor(processorContext, referencedEntities), - new EntityResourceProcessor(processorContext, dbContext, _observers), - new VaultProcessor(processorContext), - }; - // step: scan all substates & events to figure out changes { var sw = Stopwatch.StartNew(); @@ -664,8 +676,11 @@ private async Task ProcessTransactions(ReadWriteDbContext db var stateVersion = committedTransaction.ResultantStateIdentifiers.StateVersion; var stateUpdates = committedTransaction.Receipt.StateUpdates; var events = committedTransaction.Receipt.Events ?? new List(); - ledgerTransactionMarkersProcessor.VisitTransaction(committedTransaction, stateVersion); - ledgerTransactionProcessor.VisitTransaction(committedTransaction, stateVersion); + + foreach (var processor in processors.OfType()) + { + processor.VisitTransaction(committedTransaction, stateVersion); + } try { @@ -685,8 +700,6 @@ private async Task ProcessTransactions(ReadWriteDbContext db var substateId = deletedSubstate.SubstateId; var referencedEntity = referencedEntities.GetOrAdd((EntityAddress)substateId.EntityAddress, ea => new ReferencedEntity(ea, substateId.EntityType, stateVersion)); - ledgerTransactionMarkersProcessor.VisitDelete(substateId, referencedEntity, stateVersion); - foreach (var processor in processors.OfType()) { processor.VisitDelete(substateId, referencedEntity, stateVersion); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/EntitiesByRoleRequirementProcessor.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/EntitiesByRoleRequirementProcessor.cs index 0a339948b..dc542852b 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/EntitiesByRoleRequirementProcessor.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/EntitiesByRoleRequirementProcessor.cs @@ -88,9 +88,7 @@ internal class EntitiesByRoleRequirementProcessor : IProcessorBase, ISubstateSca private readonly record struct NonFungibleDbLookup(string EntityAddress, string ResourceAddress, string NonFungibleLocalId); private readonly ProcessorContext _context; - private readonly IEnumerable _observers; - private readonly Dictionary _observedByResource = new(); private readonly Dictionary _observedByNonFungible = new(); private readonly List _toAdd = new(); @@ -286,8 +284,20 @@ await connection.BeginBinaryImportAsync( await using var mergeCommand = connection.CreateCommand(); mergeCommand.CommandText = @" MERGE INTO entities_by_role_requirement_entry_definition ebrr -USING tmp_entities_by_role_requirement_entry_definition tmp -ON ebrr.entity_id = tmp.entity_id AND ebrr.resource_entity_id = tmp.resource_entity_id AND ebrr.non_fungible_local_id = tmp.non_fungible_local_id +USING (SELECT * FROM tmp_entities_by_role_requirement_entry_definition WHERE discriminator = 'resource') tmp +ON + ebrr.discriminator = tmp.discriminator AND + ebrr.entity_id = tmp.entity_id AND + ebrr.resource_entity_id = tmp.resource_entity_id +WHEN NOT MATCHED THEN INSERT VALUES (id, entity_id, first_seen_state_version, discriminator, resource_entity_id, non_fungible_local_id); + +MERGE INTO entities_by_role_requirement_entry_definition ebrr +USING (SELECT * FROM tmp_entities_by_role_requirement_entry_definition WHERE discriminator = 'non_fungible') tmp +ON + ebrr.discriminator = tmp.discriminator AND + ebrr.entity_id = tmp.entity_id AND + ebrr.resource_entity_id = tmp.resource_entity_id AND + ebrr.non_fungible_local_id = tmp.non_fungible_local_id WHEN NOT MATCHED THEN INSERT VALUES(id, entity_id, first_seen_state_version, discriminator, resource_entity_id, non_fungible_local_id);"; await mergeCommand.ExecuteNonQueryAsync(_context.Token); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/ImplicitRequirementsProcessor.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/ImplicitRequirementsProcessor.cs new file mode 100644 index 000000000..2b84160c9 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/ImplicitRequirementsProcessor.cs @@ -0,0 +1,420 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using Microsoft.EntityFrameworkCore; +using Npgsql; +using NpgsqlTypes; +using RadixDlt.NetworkGateway.Abstractions; +using RadixDlt.NetworkGateway.Abstractions.Extensions; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.DataAggregator.Services; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; +using RadixEngineToolkit; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading.Tasks; +using CoreModel = RadixDlt.CoreApiSdk.Model; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; + +internal class ImplicitRequirementsProcessor : IProcessorBase, ITransactionProcessor, ISubstateUpsertProcessor +{ + private readonly ProcessorContext _context; + private readonly List _newEntriesToAdd = new(); + + private record struct GlobalCallerBlueprintKey(string Hash, string BlueprintName, long PackageEntityId); + + private record struct GlobalCallerEntityKey(string Hash, long EntityId); + + private record struct PackageOfDirectCallerKey(string Hash, long PackageEntityId); + + private readonly Dictionary _ed25519PublicKeyCopyImplicitRequirements = new(); + private readonly Dictionary _secp256K1PublicKeyImplicitRequirements = new(); + private readonly Dictionary _globalCallerBlueprintImplicitRequirements = new(); + private readonly Dictionary _globalCallerEntityImplicitRequirements = new(); + private readonly Dictionary _packageOfDirectCallerImplicitRequirements = new(); + + private readonly ReferencedEntityDictionary _referencedEntityDictionary; + private readonly CommonDbContext _dbContext; + private readonly IEnumerable _observers; + + public ImplicitRequirementsProcessor( + ProcessorContext context, + ReferencedEntityDictionary referencedEntityDictionary, + CommonDbContext dbContext, + IEnumerable observers) + { + _context = context; + _referencedEntityDictionary = referencedEntityDictionary; + _dbContext = dbContext; + _observers = observers; + } + + public void VisitTransaction(CoreModel.CommittedTransaction transaction, long stateVersion) + { + switch (transaction.LedgerTransaction) + { + case CoreModel.FlashLedgerTransaction: + return; + case CoreModel.GenesisLedgerTransaction: + return; + case CoreModel.RoundUpdateLedgerTransaction: + return; + case CoreModel.UserLedgerTransaction userLedgerTransactionV1: + { + var signerPublicKeys = NotarizedTransactionV1.FromPayloadBytes(userLedgerTransactionV1.NotarizedTransaction.GetPayloadBytes()).SignerPublicKeys(); + foreach (var key in signerPublicKeys) + { + ObservePublicKeyHash(key, stateVersion); + } + + break; + } + + case CoreModel.UserLedgerTransactionV2 userLedgerTransactionV2: + { + var signerPublicKeys = NotarizedTransactionV2.FromPayloadBytes(userLedgerTransactionV2.NotarizedTransaction.GetPayloadBytes()).SignerPublicKeys(); + foreach (var key in signerPublicKeys) + { + ObservePublicKeyHash(key, stateVersion); + } + + break; + } + + default: + throw new NotSupportedException($"Unsupported transaction type: {transaction.LedgerTransaction.GetType()}"); + } + + foreach (var newGlobalEntity in transaction.Receipt.StateUpdates.NewGlobalEntities) + { + ObserveGlobalCallerEntityHash((EntityAddress)newGlobalEntity.EntityAddress, stateVersion); + + if (newGlobalEntity.EntityType == CoreModel.EntityType.GlobalPackage) + { + ObservePackageOfDirectCallerHash((EntityAddress)newGlobalEntity.EntityAddress, stateVersion); + } + } + } + + public void VisitUpsert(CoreModel.IUpsertedSubstate substate, ReferencedEntity referencedEntity, long stateVersion) + { + var substateData = substate.Value.SubstateData; + + if (substateData is CoreModel.PackageBlueprintDefinitionEntrySubstate packageBlueprintDefinition) + { + ObserveGlobalCallerBlueprintImplicitRequirement(packageBlueprintDefinition, referencedEntity, stateVersion); + } + } + + public async Task LoadDependenciesAsync() + { + await Task.CompletedTask; + } + + public void ProcessChanges() + { + _newEntriesToAdd.AddRange(_globalCallerBlueprintImplicitRequirements.Values); + _newEntriesToAdd.AddRange(_globalCallerEntityImplicitRequirements.Values); + _newEntriesToAdd.AddRange(_packageOfDirectCallerImplicitRequirements.Values); + _newEntriesToAdd.AddRange(_secp256K1PublicKeyImplicitRequirements.Values); + _newEntriesToAdd.AddRange(_ed25519PublicKeyCopyImplicitRequirements.Values); + } + + public async Task SaveEntitiesAsync() + { + var rowsInserted = 0; + rowsInserted += await CopyImplicitRequirements(); + return rowsInserted; + } + + private void ObserveGlobalCallerEntityHash(EntityAddress entityAddress, long stateVersion) + { + using var retAddress = new Address(entityAddress); + + var globalCallerNfid = RadixEngineToolkitUniffiMethods.DeriveGlobalCallerNonFungibleGlobalIdFromGlobalAddress(retAddress, _context.NetworkConfiguration.Id); + + if (globalCallerNfid.LocalId() is not NonFungibleLocalId.Bytes globalCallerBytes) + { + throw new UnreachableException($"Derived global caller should always be NonFungibleLocalId.Bytes but found: {globalCallerNfid.LocalId().GetType()}"); + } + + _globalCallerEntityImplicitRequirements.TryAdd( + new GlobalCallerEntityKey(globalCallerBytes.value.ToHex(), _referencedEntityDictionary.Get(entityAddress).DatabaseId), + new GlobalCallerEntityImplicitRequirement + { + Id = _context.Sequences.ImplicitRequirementsSequence++, + Hash = globalCallerBytes.value.ToHex(), + FirstSeenStateVersion = stateVersion, + EntityId = _referencedEntityDictionary.Get(entityAddress).DatabaseId, + }); + } + + private void ObservePackageOfDirectCallerHash(EntityAddress entityAddress, long stateVersion) + { + using var retAddress = new Address(entityAddress); + + var packageOfDirectCallerNfid = RadixEngineToolkitUniffiMethods.DerivePackageOfDirectCallerNonFungibleGlobalIdFromPackageAddress(retAddress, _context.NetworkConfiguration.Id); + + if (packageOfDirectCallerNfid.LocalId() is not NonFungibleLocalId.Bytes packageOfDirectCallerBytes) + { + throw new UnreachableException($"Derived package of direct caller should always be NonFungibleLocalId.Bytes but found: {packageOfDirectCallerNfid.LocalId().GetType()}"); + } + + _packageOfDirectCallerImplicitRequirements.TryAdd( + new PackageOfDirectCallerKey(packageOfDirectCallerBytes.value.ToHex(), _referencedEntityDictionary.Get(entityAddress).DatabaseId), new PackageOfDirectCallerImplicitRequirement + { + Id = _context.Sequences.ImplicitRequirementsSequence++, + Hash = packageOfDirectCallerBytes.value.ToHex(), + FirstSeenStateVersion = stateVersion, + EntityId = _referencedEntityDictionary.Get(entityAddress).DatabaseId, + }); + } + + private void ObservePublicKeyHash(PublicKey publicKey, long stateVersion) + { + var publicKeyHash = RadixEngineToolkitUniffiMethods.PublicKeyHashFromPublicKey(publicKey); + + switch (publicKeyHash) + { + case PublicKeyHash.Ed25519 ed25519: + _ed25519PublicKeyCopyImplicitRequirements.TryAdd( + ed25519.value.ToHex(), + new Ed25519PublicKeyImplicitRequirement + { + Id = _context.Sequences.ImplicitRequirementsSequence++, + Hash = ed25519.value.ToHex(), + FirstSeenStateVersion = stateVersion, + PublicKeyBytes = ((PublicKey.Ed25519)publicKey).value, + }); + break; + case PublicKeyHash.Secp256k1 secp256K1: + _secp256K1PublicKeyImplicitRequirements.TryAdd( + secp256K1.value.ToHex(), + new Secp256K1PublicKeyImplicitRequirement + { + Id = _context.Sequences.ImplicitRequirementsSequence++, + Hash = secp256K1.value.ToHex(), + FirstSeenStateVersion = stateVersion, + PublicKeyBytes = ((PublicKey.Secp256k1)publicKey).value, + }); + break; + + default: + throw new NotSupportedException($"Not supported public key type: {publicKeyHash.GetType()}"); + } + } + + private void ObserveGlobalCallerBlueprintImplicitRequirement( + CoreModel.PackageBlueprintDefinitionEntrySubstate blueprintDefinitionEntrySubstate, + ReferencedEntity referencedEntity, + long stateVersion) + { + var packageAddress = new Address(referencedEntity.Address); + + var globalCallerBlueprintNfid = RadixEngineToolkitUniffiMethods.DeriveGlobalCallerNonFungibleGlobalIdFromBlueprintId( + packageAddress, blueprintDefinitionEntrySubstate.Key.BlueprintName, _context.NetworkConfiguration.Id); + + if (globalCallerBlueprintNfid.LocalId() is not NonFungibleLocalId.Bytes bytes) + { + throw new UnreachableException($"Derived blueprint direct caller should always be NonFungibleLocalId.Bytes but found: {globalCallerBlueprintNfid.LocalId().GetType()}"); + } + + _globalCallerBlueprintImplicitRequirements.TryAdd( + new GlobalCallerBlueprintKey(bytes.value.ToHex(), blueprintDefinitionEntrySubstate.Key.BlueprintName, referencedEntity.DatabaseId), + new GlobalCallerBlueprintImplicitRequirement + { + Id = _context.Sequences.ImplicitRequirementsSequence++, + Hash = bytes.value.ToHex(), + FirstSeenStateVersion = stateVersion, + BlueprintName = blueprintDefinitionEntrySubstate.Key.BlueprintName, + EntityId = referencedEntity.DatabaseId, + } + ); + } + + private async Task CopyImplicitRequirements() + { + var entities = _newEntriesToAdd; + + if (entities.Count == 0) + { + return 0; + } + + var connection = (NpgsqlConnection)_dbContext.Database.GetDbConnection(); + + var sw = Stopwatch.GetTimestamp(); + + await using var createTempTableCommand = connection.CreateCommand(); + createTempTableCommand.CommandText = @" +CREATE TEMP TABLE tmp_implicit_requirements +(LIKE implicit_requirements INCLUDING DEFAULTS) +ON COMMIT DROP"; + + await createTempTableCommand.ExecuteNonQueryAsync(_context.Token); + + await using var writer = + await connection.BeginBinaryImportAsync( + "COPY tmp_implicit_requirements(id, hash, first_seen_state_version, discriminator, public_key_bytes, entity_id, blueprint_name) FROM STDIN (FORMAT BINARY)", + _context.Token); + + foreach (var e in entities) + { + var discriminator = _context.WriteHelper.GetDiscriminator(e.GetType()); + + await writer.StartRowAsync(_context.Token); + await writer.WriteAsync(e.Id, NpgsqlDbType.Bigint, _context.Token); + await writer.WriteAsync(e.Hash, NpgsqlDbType.Text, _context.Token); + await writer.WriteAsync(e.FirstSeenStateVersion, NpgsqlDbType.Bigint, _context.Token); + await writer.WriteAsync(discriminator, "implicit_requirement_type", _context.Token); + + if (e is PackageOfDirectCallerImplicitRequirement packageOfDirectCallerImplicitRequirement) + { + await writer.WriteNullAsync(_context.Token); + await writer.WriteAsync(packageOfDirectCallerImplicitRequirement.EntityId, NpgsqlDbType.Bigint, _context.Token); + await writer.WriteNullAsync(_context.Token); + } + + if (e is GlobalCallerEntityImplicitRequirement globalCallerEntityImplicitRequirement) + { + await writer.WriteNullAsync(_context.Token); + await writer.WriteAsync(globalCallerEntityImplicitRequirement.EntityId, NpgsqlDbType.Bigint, _context.Token); + await writer.WriteNullAsync(_context.Token); + } + + if (e is GlobalCallerBlueprintImplicitRequirement globalCallerBlueprintImplicitRequirement) + { + await writer.WriteNullAsync(_context.Token); + await writer.WriteAsync(globalCallerBlueprintImplicitRequirement.EntityId, NpgsqlDbType.Bigint, _context.Token); + await writer.WriteAsync(globalCallerBlueprintImplicitRequirement.BlueprintName, NpgsqlDbType.Text, _context.Token); + } + + if (e is Ed25519PublicKeyImplicitRequirement ed25519PublicKeyImplicitRequirement) + { + await writer.WriteAsync(ed25519PublicKeyImplicitRequirement.PublicKeyBytes, NpgsqlDbType.Bytea, _context.Token); + await writer.WriteNullAsync(_context.Token); + await writer.WriteNullAsync(_context.Token); + } + + if (e is Secp256K1PublicKeyImplicitRequirement secp256K1PublicKeyImplicitRequirement) + { + await writer.WriteAsync(secp256K1PublicKeyImplicitRequirement.PublicKeyBytes, NpgsqlDbType.Bytea, _context.Token); + await writer.WriteNullAsync(_context.Token); + await writer.WriteNullAsync(_context.Token); + } + } + + await writer.CompleteAsync(_context.Token); + await writer.DisposeAsync(); + + await using var mergeCommand = connection.CreateCommand(); + mergeCommand.CommandText = @" +MERGE INTO implicit_requirements oh +USING (select * from tmp_implicit_requirements where discriminator = 'ed25519public_key') tmp +ON + oh.hash = tmp.hash AND + oh.discriminator = tmp.discriminator +WHEN NOT MATCHED THEN INSERT VALUES(id, hash, first_seen_state_version, discriminator, public_key_bytes, entity_id, blueprint_name); + +MERGE INTO implicit_requirements oh +USING (select * from tmp_implicit_requirements where discriminator = 'secp256k1public_key') tmp +ON + oh.hash = tmp.hash AND + oh.discriminator = tmp.discriminator +WHEN NOT MATCHED THEN INSERT VALUES(id, hash, first_seen_state_version, discriminator, public_key_bytes, entity_id, blueprint_name); + +MERGE INTO implicit_requirements oh +USING (select * from tmp_implicit_requirements where discriminator = 'package_of_direct_caller') tmp +ON + oh.hash = tmp.hash AND + oh.discriminator = tmp.discriminator AND + oh.entity_id = tmp.entity_id +WHEN NOT MATCHED THEN INSERT VALUES(id, hash, first_seen_state_version, discriminator, public_key_bytes, entity_id, blueprint_name); + +MERGE INTO implicit_requirements oh +USING (select * from tmp_implicit_requirements where discriminator = 'global_caller_entity') tmp +ON + oh.hash = tmp.hash AND + oh.discriminator = tmp.discriminator AND + oh.entity_id = tmp.entity_id +WHEN NOT MATCHED THEN INSERT VALUES(id, hash, first_seen_state_version, discriminator, public_key_bytes, entity_id, blueprint_name); + +MERGE INTO implicit_requirements oh +USING (select * from tmp_implicit_requirements where discriminator = 'global_caller_blueprint') tmp +ON + oh.hash = tmp.hash AND + oh.discriminator = tmp.discriminator AND + oh.entity_id = tmp.entity_id AND + oh.blueprint_name = tmp.blueprint_name +WHEN NOT MATCHED THEN INSERT VALUES(id, hash, first_seen_state_version, discriminator, public_key_bytes, entity_id, blueprint_name);"; + + await mergeCommand.ExecuteNonQueryAsync(_context.Token); + + await _observers.ForEachAsync(x => x.StageCompleted(nameof(CopyImplicitRequirements), Stopwatch.GetElapsedTime(sw), entities.Count)); + + return entities.Count; + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/EpochChangeLedgerTransactionMarkerProcessor.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/EpochChangeLedgerTransactionMarkerProcessor.cs index 2ffa418ba..49f37ed24 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/EpochChangeLedgerTransactionMarkerProcessor.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/EpochChangeLedgerTransactionMarkerProcessor.cs @@ -67,7 +67,7 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension.Processors.LedgerTransactionMarkers; -internal class EpochChangeLedgerTransactionMarkerProcessor : ITransactionMarkerProcessor +internal class EpochChangeLedgerTransactionMarkerProcessor : ITransactionMarkerProcessor, ITransactionProcessor { private readonly ProcessorContext _context; private readonly List _ledgerTransactionMarkersToAdd = new(); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/ResourceBalanceChangeProcessor.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/ResourceBalanceChangeProcessor.cs index 53c1dbe03..4cb180568 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/ResourceBalanceChangeProcessor.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/ResourceBalanceChangeProcessor.cs @@ -64,7 +64,6 @@ using RadixDlt.CoreApiSdk.Model; using RadixDlt.NetworkGateway.Abstractions; -using RadixDlt.NetworkGateway.Abstractions.Network; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using System.Collections.Generic; using System.Linq; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/TransactionTypeLedgerTransactionMarkerProcessor.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/TransactionTypeLedgerTransactionMarkerProcessor.cs index 56cf81dd5..41608a109 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/TransactionTypeLedgerTransactionMarkerProcessor.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/Processors/LedgerTransactionMarkers/TransactionTypeLedgerTransactionMarkerProcessor.cs @@ -69,7 +69,7 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension.Processors.LedgerTransactionMarkers; -internal class TransactionTypeLedgerTransactionMarkerProcessor : ITransactionMarkerProcessor +internal class TransactionTypeLedgerTransactionMarkerProcessor : ITransactionMarkerProcessor, ITransactionProcessor { private readonly ProcessorContext _context; private readonly List _ledgerTransactionMarkersToAdd = new(); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs index 9cb75ca14..eacdd040e 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/ReadHelper.cs @@ -185,6 +185,7 @@ public async Task LoadSequences(CancellationToken token) nextval('unverified_standard_metadata_aggregate_history_id_seq') AS UnverifiedStandardMetadataAggregateHistorySequence, nextval('unverified_standard_metadata_entry_history_id_seq') AS UnverifiedStandardMetadataEntryHistorySequence, nextval('resource_holders_id_seq') AS ResourceHoldersSequence, + nextval('implicit_requirements_id_seq') AS ImplicitRequirementsSequence, nextval('entities_by_role_requirement_entry_definition_id_seq') AS EntitiesByRoleRequirementSequence, nextval('entity_resource_entry_definition_id_seq') AS EntityResourceEntryDefinitionSequence, nextval('entity_resource_vault_entry_definition_id_seq') AS EntityResourceVaultEntryDefinitionSequence, diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs index e04aff3d2..ec0245f6b 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/SequencesHolder.cs @@ -144,6 +144,8 @@ internal class SequencesHolder public long ResourceHoldersSequence { get; set; } + public long ImplicitRequirementsSequence { get; set; } + public long EntitiesByRoleRequirementSequence { get; set; } public long EntityResourceEntryDefinitionSequence { get; set; } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs index b93dbf662..24a858abc 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs @@ -242,6 +242,7 @@ public async Task UpdateSequences(SequencesHolder sequences, CancellationToken t unverifiedStandardMetadataAggregateHistorySequence = sequences.UnverifiedStandardMetadataAggregateHistorySequence, unverifiedStandardMetadataEntryHistorySequence = sequences.UnverifiedStandardMetadataEntryHistorySequence, resourceHoldersSequence = sequences.ResourceHoldersSequence, + implicitRequirementsSequence = sequences.ImplicitRequirementsSequence, entitiesByRoleRequirementSequence = sequences.EntitiesByRoleRequirementSequence, entityResourceEntryDefinitionSequence = sequences.EntityResourceEntryDefinitionSequence, entityResourceVaultEntryDefinitionSequence = sequences.EntityResourceVaultEntryDefinitionSequence, @@ -295,6 +296,7 @@ public async Task UpdateSequences(SequencesHolder sequences, CancellationToken t setval('unverified_standard_metadata_aggregate_history_id_seq', @unverifiedStandardMetadataAggregateHistorySequence), setval('unverified_standard_metadata_entry_history_id_seq', @unverifiedStandardMetadataEntryHistorySequence), setval('resource_holders_id_seq', @resourceHoldersSequence), + setval('implicit_requirements_id_seq', @implicitRequirementsSequence), setval('entities_by_role_requirement_entry_definition_id_seq', @entitiesByRoleRequirementSequence), setval('entity_resource_entry_definition_id_seq', @entityResourceEntryDefinitionSequence), setval('entity_resource_vault_entry_definition_id_seq', @entityResourceVaultEntryDefinitionSequence), diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250204103839_InitialCreate.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250211120656_InitialCreate.Designer.cs similarity index 95% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250204103839_InitialCreate.Designer.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250211120656_InitialCreate.Designer.cs index b3a5972d1..632edef21 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250204103839_InitialCreate.Designer.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250211120656_InitialCreate.Designer.cs @@ -81,7 +81,7 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations { [DbContext(typeof(MigrationsDbContext))] - [Migration("20250204103839_InitialCreate")] + [Migration("20250211120656_InitialCreate")] partial class InitialCreate { /// @@ -98,6 +98,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_relationship", new[] { "component_to_instantiating_package", "vault_to_resource", "validator_to_stake_vault", "validator_to_pending_xrd_withdraw_vault", "validator_to_locked_owner_stake_unit_vault", "validator_to_pending_owner_stake_unit_unlock_vault", "stake_unit_of_validator", "claim_token_of_validator", "entity_to_royalty_vault", "royalty_vault_of_entity", "account_locker_of_locker", "account_locker_of_account", "resource_pool_to_unit_resource", "resource_pool_to_resource", "resource_pool_to_resource_vault", "unit_resource_of_resource_pool", "resource_vault_of_resource_pool", "access_controller_to_recovery_badge", "recovery_badge_of_access_controller" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_role_requirement_type", new[] { "resource", "non_fungible" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker", "global_account_locker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "implicit_requirement_type", new[] { "package_of_direct_caller", "global_caller_entity", "global_caller_blueprint", "ed25519public_key", "secp256k1public_key" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_manifest_class", new[] { "general", "transfer", "validator_stake", "validator_unstake", "validator_claim", "account_deposit_settings_update", "pool_contribution", "pool_redemption" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from", "account_owner_method_call", "badge_presented" }); @@ -111,6 +112,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "queried_implicit_requirement_type", new[] { "package_of_direct_caller", "global_caller", "ed25519public_key", "secp256k1public_key" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "standard_metadata_key", new[] { "dapp_account_type", "dapp_definition", "dapp_definitions", "dapp_claimed_websites", "dapp_claimed_entities", "dapp_account_locker" }); @@ -903,6 +905,37 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("entity_role_assignments_owner_role_history"); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Discriminator") + .HasColumnType("implicit_requirement_type") + .HasColumnName("discriminator"); + + b.Property("FirstSeenStateVersion") + .HasColumnType("bigint") + .HasColumnName("first_seen_state_version"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("hash"); + + b.HasKey("Id"); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator("Discriminator"); + + b.UseTphMappingStrategy(); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryDefinition", b => { b.Property("Id") @@ -2169,8 +2202,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("resource_entity_id"); - b.HasIndex("ResourceEntityId", "NonFungibleLocalId") - .HasDatabaseName("IX_entities_by_role_requirement_entry_definition_resource_ent~1") + b.HasIndex("EntityId", "ResourceEntityId", "NonFungibleLocalId") + .HasDatabaseName("IX_entities_by_role_requirement_entry_definition_entity_id_re~1") .HasFilter("discriminator = 'non_fungible'"); b.HasIndex("FirstSeenStateVersion", "Id", "EntityId", "ResourceEntityId", "NonFungibleLocalId") @@ -2191,7 +2224,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("resource_entity_id"); - b.HasIndex("ResourceEntityId") + b.HasIndex("EntityId", "ResourceEntityId") .HasFilter("discriminator = 'resource'"); b.HasIndex("FirstSeenStateVersion", "Id", "EntityId", "ResourceEntityId") @@ -2683,6 +2716,118 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Ed25519PublicKeyImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("PublicKeyBytes") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bytea") + .HasColumnName("public_key_bytes"); + + b.HasIndex("Hash") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_ed25519public_key") + .HasFilter("discriminator = 'ed25519public_key'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash"), new[] { "PublicKeyBytes", "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.Ed25519PublicKey); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalCallerBlueprintImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("BlueprintName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("Hash", "EntityId", "BlueprintName") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_global_caller_blueprint") + .HasFilter("discriminator = 'global_caller_blueprint'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash", "EntityId", "BlueprintName"), new[] { "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.GlobalCallerBlueprint); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalCallerEntityImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("Hash", "EntityId") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_global_caller_entity") + .HasFilter("discriminator = 'global_caller_entity'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash", "EntityId"), new[] { "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.GlobalCallerEntity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageOfDirectCallerImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("Hash", "EntityId") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_package_of_direct_caller") + .HasFilter("discriminator = 'package_of_direct_caller'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash", "EntityId"), new[] { "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.PackageOfDirectCaller); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Secp256K1PublicKeyImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("PublicKeyBytes") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bytea") + .HasColumnName("public_key_bytes"); + + b.HasIndex("Hash") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_secp256k1public_key") + .HasFilter("discriminator = 'secp256k1public_key'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash"), new[] { "PublicKeyBytes", "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.Secp256k1PublicKey); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.BaseUserLedgerTransaction", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250204103839_InitialCreate.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250211120656_InitialCreate.cs similarity index 96% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250204103839_InitialCreate.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250211120656_InitialCreate.cs index 59b7a46d8..be7c4b353 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250204103839_InitialCreate.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20250211120656_InitialCreate.cs @@ -88,6 +88,7 @@ protected override void Up(MigrationBuilder migrationBuilder) .Annotation("Npgsql:Enum:entity_relationship", "component_to_instantiating_package,vault_to_resource,validator_to_stake_vault,validator_to_pending_xrd_withdraw_vault,validator_to_locked_owner_stake_unit_vault,validator_to_pending_owner_stake_unit_unlock_vault,stake_unit_of_validator,claim_token_of_validator,entity_to_royalty_vault,royalty_vault_of_entity,account_locker_of_locker,account_locker_of_account,resource_pool_to_unit_resource,resource_pool_to_resource,resource_pool_to_resource_vault,unit_resource_of_resource_pool,resource_vault_of_resource_pool,access_controller_to_recovery_badge,recovery_badge_of_access_controller") .Annotation("Npgsql:Enum:entity_role_requirement_type", "resource,non_fungible") .Annotation("Npgsql:Enum:entity_type", "global_consensus_manager,global_fungible_resource,global_non_fungible_resource,global_generic_component,internal_generic_component,global_account_component,global_package,internal_key_value_store,internal_fungible_vault,internal_non_fungible_vault,global_validator,global_access_controller,global_identity,global_one_resource_pool,global_two_resource_pool,global_multi_resource_pool,global_transaction_tracker,global_account_locker") + .Annotation("Npgsql:Enum:implicit_requirement_type", "package_of_direct_caller,global_caller_entity,global_caller_blueprint,ed25519public_key,secp256k1public_key") .Annotation("Npgsql:Enum:ledger_transaction_manifest_class", "general,transfer,validator_stake,validator_unstake,validator_claim,account_deposit_settings_update,pool_contribution,pool_redemption") .Annotation("Npgsql:Enum:ledger_transaction_marker_event_type", "withdrawal,deposit") .Annotation("Npgsql:Enum:ledger_transaction_marker_operation_type", "resource_in_use,account_deposited_into,account_withdrawn_from,account_owner_method_call,badge_presented") @@ -101,6 +102,7 @@ protected override void Up(MigrationBuilder migrationBuilder) .Annotation("Npgsql:Enum:pending_transaction_intent_ledger_status", "unknown,committed,commit_pending,permanent_rejection,possible_to_commit,likely_but_not_certain_rejection") .Annotation("Npgsql:Enum:pending_transaction_payload_ledger_status", "unknown,committed,commit_pending,clashing_commit,permanently_rejected,transiently_accepted,transiently_rejected") .Annotation("Npgsql:Enum:public_key_type", "ecdsa_secp256k1,eddsa_ed25519") + .Annotation("Npgsql:Enum:queried_implicit_requirement_type", "package_of_direct_caller,global_caller,ed25519public_key,secp256k1public_key") .Annotation("Npgsql:Enum:resource_type", "fungible,non_fungible") .Annotation("Npgsql:Enum:sbor_type_kind", "well_known,schema_local") .Annotation("Npgsql:Enum:standard_metadata_key", "dapp_account_type,dapp_definition,dapp_definitions,dapp_claimed_websites,dapp_claimed_entities,dapp_account_locker") @@ -488,6 +490,24 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_entity_role_assignments_owner_role_history", x => x.id); }); + migrationBuilder.CreateTable( + name: "implicit_requirements", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + hash = table.Column(type: "text", nullable: false), + first_seen_state_version = table.Column(type: "bigint", nullable: false), + discriminator = table.Column(type: "implicit_requirement_type", nullable: false), + public_key_bytes = table.Column(type: "bytea", nullable: true), + entity_id = table.Column(type: "bigint", nullable: true), + blueprint_name = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_implicit_requirements", x => x.id); + }); + migrationBuilder.CreateTable( name: "key_value_store_entry_definition", columns: table => new @@ -1155,27 +1175,27 @@ protected override void Up(MigrationBuilder migrationBuilder) filter: "discriminator = 'global_validator'"); migrationBuilder.CreateIndex( - name: "IX_entities_by_role_requirement_entry_definition_first_seen_s~1", + name: "IX_entities_by_role_requirement_entry_definition_entity_id_re~1", table: "entities_by_role_requirement_entry_definition", - columns: new[] { "first_seen_state_version", "id", "entity_id", "resource_entity_id", "non_fungible_local_id" }, + columns: new[] { "entity_id", "resource_entity_id", "non_fungible_local_id" }, filter: "discriminator = 'non_fungible'"); migrationBuilder.CreateIndex( - name: "IX_entities_by_role_requirement_entry_definition_first_seen_st~", + name: "IX_entities_by_role_requirement_entry_definition_entity_id_res~", table: "entities_by_role_requirement_entry_definition", - columns: new[] { "first_seen_state_version", "id", "entity_id", "resource_entity_id" }, + columns: new[] { "entity_id", "resource_entity_id" }, filter: "discriminator = 'resource'"); migrationBuilder.CreateIndex( - name: "IX_entities_by_role_requirement_entry_definition_resource_ent~1", + name: "IX_entities_by_role_requirement_entry_definition_first_seen_s~1", table: "entities_by_role_requirement_entry_definition", - columns: new[] { "resource_entity_id", "non_fungible_local_id" }, + columns: new[] { "first_seen_state_version", "id", "entity_id", "resource_entity_id", "non_fungible_local_id" }, filter: "discriminator = 'non_fungible'"); migrationBuilder.CreateIndex( - name: "IX_entities_by_role_requirement_entry_definition_resource_enti~", + name: "IX_entities_by_role_requirement_entry_definition_first_seen_st~", table: "entities_by_role_requirement_entry_definition", - column: "resource_entity_id", + columns: new[] { "first_seen_state_version", "id", "entity_id", "resource_entity_id" }, filter: "discriminator = 'resource'"); migrationBuilder.CreateIndex( @@ -1250,6 +1270,46 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "entity_role_assignments_owner_role_history", columns: new[] { "entity_id", "from_state_version" }); + migrationBuilder.CreateIndex( + name: "IX_implicit_requirements_ed25519public_key", + table: "implicit_requirements", + column: "hash", + unique: true, + filter: "discriminator = 'ed25519public_key'") + .Annotation("Npgsql:IndexInclude", new[] { "public_key_bytes", "first_seen_state_version" }); + + migrationBuilder.CreateIndex( + name: "IX_implicit_requirements_global_caller_blueprint", + table: "implicit_requirements", + columns: new[] { "hash", "entity_id", "blueprint_name" }, + unique: true, + filter: "discriminator = 'global_caller_blueprint'") + .Annotation("Npgsql:IndexInclude", new[] { "first_seen_state_version" }); + + migrationBuilder.CreateIndex( + name: "IX_implicit_requirements_global_caller_entity", + table: "implicit_requirements", + columns: new[] { "hash", "entity_id" }, + unique: true, + filter: "discriminator = 'global_caller_entity'") + .Annotation("Npgsql:IndexInclude", new[] { "first_seen_state_version" }); + + migrationBuilder.CreateIndex( + name: "IX_implicit_requirements_package_of_direct_caller", + table: "implicit_requirements", + columns: new[] { "hash", "entity_id" }, + unique: true, + filter: "discriminator = 'package_of_direct_caller'") + .Annotation("Npgsql:IndexInclude", new[] { "first_seen_state_version" }); + + migrationBuilder.CreateIndex( + name: "IX_implicit_requirements_secp256k1public_key", + table: "implicit_requirements", + column: "hash", + unique: true, + filter: "discriminator = 'secp256k1public_key'") + .Annotation("Npgsql:IndexInclude", new[] { "public_key_bytes", "first_seen_state_version" }); + migrationBuilder.CreateIndex( name: "IX_key_value_store_entry_definition_key_value_store_entity_id_~", table: "key_value_store_entry_definition", @@ -1601,6 +1661,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "entity_role_assignments_owner_role_history"); + migrationBuilder.DropTable( + name: "implicit_requirements"); + migrationBuilder.DropTable( name: "key_value_store_entry_definition"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index 699f327eb..451f36961 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -9,13 +9,14 @@ START TRANSACTION; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TYPE account_default_deposit_rule AS ENUM ('accept', 'reject', 'allow_existing'); CREATE TYPE account_resource_preference_rule AS ENUM ('allowed', 'disallowed'); CREATE TYPE authorized_depositor_badge_type AS ENUM ('resource', 'non_fungible'); CREATE TYPE entity_relationship AS ENUM ('component_to_instantiating_package', 'vault_to_resource', 'validator_to_stake_vault', 'validator_to_pending_xrd_withdraw_vault', 'validator_to_locked_owner_stake_unit_vault', 'validator_to_pending_owner_stake_unit_unlock_vault', 'stake_unit_of_validator', 'claim_token_of_validator', 'entity_to_royalty_vault', 'royalty_vault_of_entity', 'account_locker_of_locker', 'account_locker_of_account', 'resource_pool_to_unit_resource', 'resource_pool_to_resource', 'resource_pool_to_resource_vault', 'unit_resource_of_resource_pool', 'resource_vault_of_resource_pool', 'access_controller_to_recovery_badge', 'recovery_badge_of_access_controller'); CREATE TYPE entity_role_requirement_type AS ENUM ('resource', 'non_fungible'); CREATE TYPE entity_type AS ENUM ('global_consensus_manager', 'global_fungible_resource', 'global_non_fungible_resource', 'global_generic_component', 'internal_generic_component', 'global_account_component', 'global_package', 'internal_key_value_store', 'internal_fungible_vault', 'internal_non_fungible_vault', 'global_validator', 'global_access_controller', 'global_identity', 'global_one_resource_pool', 'global_two_resource_pool', 'global_multi_resource_pool', 'global_transaction_tracker', 'global_account_locker'); + CREATE TYPE implicit_requirement_type AS ENUM ('package_of_direct_caller', 'global_caller_entity', 'global_caller_blueprint', 'ed25519public_key', 'secp256k1public_key'); CREATE TYPE ledger_transaction_manifest_class AS ENUM ('general', 'transfer', 'validator_stake', 'validator_unstake', 'validator_claim', 'account_deposit_settings_update', 'pool_contribution', 'pool_redemption'); CREATE TYPE ledger_transaction_marker_event_type AS ENUM ('withdrawal', 'deposit'); CREATE TYPE ledger_transaction_marker_operation_type AS ENUM ('resource_in_use', 'account_deposited_into', 'account_withdrawn_from', 'account_owner_method_call', 'badge_presented'); @@ -29,6 +30,7 @@ BEGIN CREATE TYPE pending_transaction_intent_ledger_status AS ENUM ('unknown', 'committed', 'commit_pending', 'permanent_rejection', 'possible_to_commit', 'likely_but_not_certain_rejection'); CREATE TYPE pending_transaction_payload_ledger_status AS ENUM ('unknown', 'committed', 'commit_pending', 'clashing_commit', 'permanently_rejected', 'transiently_accepted', 'transiently_rejected'); CREATE TYPE public_key_type AS ENUM ('ecdsa_secp256k1', 'eddsa_ed25519'); + CREATE TYPE queried_implicit_requirement_type AS ENUM ('package_of_direct_caller', 'global_caller', 'ed25519public_key', 'secp256k1public_key'); CREATE TYPE resource_type AS ENUM ('fungible', 'non_fungible'); CREATE TYPE sbor_type_kind AS ENUM ('well_known', 'schema_local'); CREATE TYPE standard_metadata_key AS ENUM ('dapp_account_type', 'dapp_definition', 'dapp_definitions', 'dapp_claimed_websites', 'dapp_claimed_entities', 'dapp_account_locker'); @@ -38,7 +40,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_authorized_depositor_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -51,7 +53,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_authorized_depositor_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -67,7 +69,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_default_deposit_rule_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -80,7 +82,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_locker_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -94,7 +96,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_locker_entry_resource_vault_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -108,7 +110,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_locker_entry_touch_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -120,7 +122,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_resource_preference_rule_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -133,7 +135,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE account_resource_preference_rule_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -148,7 +150,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE component_method_royalty_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -161,7 +163,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE component_method_royalty_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -176,7 +178,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entities ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -203,7 +205,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entities_by_role_requirement_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, entity_id bigint NOT NULL, @@ -218,7 +220,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_metadata_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -231,7 +233,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_metadata_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -246,7 +248,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_metadata_totals_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -260,7 +262,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_resource_balance_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -274,7 +276,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_resource_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -288,7 +290,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_resource_totals_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -303,7 +305,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_resource_vault_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -317,7 +319,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_resource_vault_totals_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -331,7 +333,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_role_assignments_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -345,7 +347,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_role_assignments_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -361,7 +363,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE entity_role_assignments_owner_role_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -374,7 +376,23 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE TABLE implicit_requirements ( + id bigint GENERATED BY DEFAULT AS IDENTITY, + hash text NOT NULL, + first_seen_state_version bigint NOT NULL, + discriminator implicit_requirement_type NOT NULL, + public_key_bytes bytea, + entity_id bigint, + blueprint_name text, + CONSTRAINT "PK_implicit_requirements" PRIMARY KEY (id) + ); + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE key_value_store_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -387,7 +405,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE key_value_store_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -402,7 +420,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE key_value_store_schema_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -422,7 +440,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE key_value_store_totals_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -436,7 +454,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE ledger_finalized_subintents ( subintent_hash character varying(90) NOT NULL, finalized_at_state_version bigint NOT NULL, @@ -448,7 +466,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE ledger_transaction_events ( state_version bigint NOT NULL, receipt_event_emitter_entity_ids bigint[] NOT NULL, @@ -466,7 +484,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE ledger_transaction_markers ( id bigint GENERATED BY DEFAULT AS IDENTITY, state_version bigint NOT NULL, @@ -487,7 +505,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE ledger_transaction_subintent_data ( state_version bigint NOT NULL, child_subintent_hashes text[] NOT NULL, @@ -499,7 +517,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE ledger_transactions ( state_version bigint NOT NULL, epoch bigint NOT NULL, @@ -540,7 +558,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE non_fungible_id_data_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -555,7 +573,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE non_fungible_id_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -568,7 +586,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE non_fungible_id_location_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -581,7 +599,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE non_fungible_schema_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -597,7 +615,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE non_fungible_vault_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -610,7 +628,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE non_fungible_vault_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -623,7 +641,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE package_blueprint_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -636,7 +654,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE package_blueprint_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -656,7 +674,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE package_code_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -669,7 +687,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE package_code_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -685,7 +703,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE pending_transactions ( id bigint GENERATED BY DEFAULT AS IDENTITY, payload_hash text NOT NULL, @@ -713,7 +731,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE resource_entity_supply_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -728,7 +746,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE resource_holders ( id bigint GENERATED BY DEFAULT AS IDENTITY, entity_id bigint NOT NULL, @@ -742,7 +760,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE schema_entry_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -755,7 +773,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE schema_entry_definition ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -769,7 +787,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE state_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -788,7 +806,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE unverified_standard_metadata_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -801,7 +819,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE unverified_standard_metadata_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -818,7 +836,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE validator_cumulative_emission_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -834,7 +852,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE validator_public_key_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -848,7 +866,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE vault_balance_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -861,7 +879,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE pending_transaction_payloads ( id bigint GENERATED BY DEFAULT AS IDENTITY, pending_transaction_id bigint, @@ -874,7 +892,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE TABLE validator_active_set_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -889,604 +907,639 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_authorized_depositor_aggregate_history_account_enti~" ON account_authorized_depositor_aggregate_history (account_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_authorized_depositor_entry_history_account_entity_~1" ON account_authorized_depositor_entry_history (account_entity_id, resource_entity_id, non_fungible_id, from_state_version) WHERE discriminator = 'non_fungible'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_authorized_depositor_entry_history_account_entity_~2" ON account_authorized_depositor_entry_history (account_entity_id, resource_entity_id, from_state_version) WHERE discriminator = 'resource'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_authorized_depositor_entry_history_account_entity_i~" ON account_authorized_depositor_entry_history (account_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_default_deposit_rule_history_account_entity_id_from~" ON account_default_deposit_rule_history (account_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_account_locker_entry_definition_account_locker_entity_id_ac~" ON account_locker_entry_definition (account_locker_entity_id, account_entity_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_locker_entry_resource_vault_definition_account_lock~" ON account_locker_entry_resource_vault_definition (account_locker_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_locker_entry_touch_history_account_locker_definitio~" ON account_locker_entry_touch_history (account_locker_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_resource_preference_rule_aggregate_history_account_~" ON account_resource_preference_rule_aggregate_history (account_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_account_resource_preference_rule_entry_history_account_enti~" ON account_resource_preference_rule_entry_history (account_entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_component_method_royalty_aggregate_history_entity_id_from_s~" ON component_method_royalty_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_component_method_royalty_entry_history_entity_id_from_state~" ON component_method_royalty_entry_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_component_method_royalty_entry_history_entity_id_method_nam~" ON component_method_royalty_entry_history (entity_id, method_name, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_entities_address" ON entities (address); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entities_from_state_version" ON entities (from_state_version) WHERE discriminator = 'global_validator'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN - CREATE INDEX "IX_entities_by_role_requirement_entry_definition_first_seen_s~1" ON entities_by_role_requirement_entry_definition (first_seen_state_version, id, entity_id, resource_entity_id, non_fungible_local_id) WHERE discriminator = 'non_fungible'; + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE INDEX "IX_entities_by_role_requirement_entry_definition_entity_id_re~1" ON entities_by_role_requirement_entry_definition (entity_id, resource_entity_id, non_fungible_local_id) WHERE discriminator = 'non_fungible'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN - CREATE INDEX "IX_entities_by_role_requirement_entry_definition_first_seen_st~" ON entities_by_role_requirement_entry_definition (first_seen_state_version, id, entity_id, resource_entity_id) WHERE discriminator = 'resource'; + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE INDEX "IX_entities_by_role_requirement_entry_definition_entity_id_res~" ON entities_by_role_requirement_entry_definition (entity_id, resource_entity_id) WHERE discriminator = 'resource'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN - CREATE INDEX "IX_entities_by_role_requirement_entry_definition_resource_ent~1" ON entities_by_role_requirement_entry_definition (resource_entity_id, non_fungible_local_id) WHERE discriminator = 'non_fungible'; + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE INDEX "IX_entities_by_role_requirement_entry_definition_first_seen_s~1" ON entities_by_role_requirement_entry_definition (first_seen_state_version, id, entity_id, resource_entity_id, non_fungible_local_id) WHERE discriminator = 'non_fungible'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN - CREATE INDEX "IX_entities_by_role_requirement_entry_definition_resource_enti~" ON entities_by_role_requirement_entry_definition (resource_entity_id) WHERE discriminator = 'resource'; + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE INDEX "IX_entities_by_role_requirement_entry_definition_first_seen_st~" ON entities_by_role_requirement_entry_definition (first_seen_state_version, id, entity_id, resource_entity_id) WHERE discriminator = 'resource'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_metadata_entry_definition_entity_id_from_state_versi~" ON entity_metadata_entry_definition (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_metadata_entry_definition_entity_id_key" ON entity_metadata_entry_definition (entity_id, key); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_metadata_entry_history_entity_metadata_entry_definit~" ON entity_metadata_entry_history (entity_metadata_entry_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_metadata_totals_history_entity_id_from_state_version" ON entity_metadata_totals_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_balance_history_entity_id_resource_entity_i~" ON entity_resource_balance_history (entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_entry_definition_entity_id_from_state_versi~" ON entity_resource_entry_definition (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_entry_definition_fungibles" ON entity_resource_entry_definition (entity_id, from_state_version) WHERE resource_type = 'fungible'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_entry_definition_non_fungibles" ON entity_resource_entry_definition (entity_id, from_state_version) WHERE resource_type = 'non_fungible'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_totals_history_entity_id_from_state_version" ON entity_resource_totals_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_vault_entry_definition_entity_id_resource_e~" ON entity_resource_vault_entry_definition (entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_resource_vault_totals_history_entity_id_resource_ent~" ON entity_resource_vault_totals_history (entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_role_assignments_aggregate_history_entity_id_from_st~" ON entity_role_assignments_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_role_assignments_entry_history_entity_id_key_role_ke~" ON entity_role_assignments_entry_history (entity_id, key_role, key_module, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_entity_role_assignments_owner_role_history_entity_id_from_s~" ON entity_role_assignments_owner_role_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_implicit_requirements_ed25519public_key" ON implicit_requirements (hash) INCLUDE (public_key_bytes, first_seen_state_version) WHERE discriminator = 'ed25519public_key'; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_implicit_requirements_global_caller_blueprint" ON implicit_requirements (hash, entity_id, blueprint_name) INCLUDE (first_seen_state_version) WHERE discriminator = 'global_caller_blueprint'; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_implicit_requirements_global_caller_entity" ON implicit_requirements (hash, entity_id) INCLUDE (first_seen_state_version) WHERE discriminator = 'global_caller_entity'; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_implicit_requirements_package_of_direct_caller" ON implicit_requirements (hash, entity_id) INCLUDE (first_seen_state_version) WHERE discriminator = 'package_of_direct_caller'; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_implicit_requirements_secp256k1public_key" ON implicit_requirements (hash) INCLUDE (public_key_bytes, first_seen_state_version) WHERE discriminator = 'secp256k1public_key'; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_key_value_store_entry_definition_key_value_store_entity_id_~" ON key_value_store_entry_definition (key_value_store_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_key_value_store_entry_definition_key_value_store_entity_id~1" ON key_value_store_entry_definition (key_value_store_entity_id, key); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_key_value_store_entry_history_key_value_store_entry_definit~" ON key_value_store_entry_history (key_value_store_entry_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_key_value_store_schema_history_key_value_store_entity_id_fr~" ON key_value_store_schema_history (key_value_store_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_key_value_store_totals_history_entity_id_from_state_version" ON key_value_store_totals_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_entity_id_state_version" ON ledger_transaction_markers (entity_id, state_version) WHERE discriminator = 'event_global_emitter'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_entity_id_state_version1" ON ledger_transaction_markers (entity_id, state_version) WHERE discriminator = 'affected_global_entity'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_epoch_change_state_version" ON ledger_transaction_markers (epoch_change, state_version) WHERE discriminator = 'epoch_change'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_event_type_entity_id_state_versi~" ON ledger_transaction_markers (event_type, entity_id, state_version) WHERE discriminator = 'event'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_manifest_class" ON ledger_transaction_markers (manifest_class, state_version) WHERE discriminator = 'manifest_class'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_manifest_class_is_most_specific" ON ledger_transaction_markers (manifest_class, state_version) WHERE discriminator = 'manifest_class' and is_most_specific = true; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_operation_type_entity_id_state_v~" ON ledger_transaction_markers (operation_type, entity_id, state_version) WHERE discriminator = 'manifest_address'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_resource_balance_change" ON ledger_transaction_markers (entity_id, state_version) WHERE discriminator = 'resource_balance_change'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_state_version" ON ledger_transaction_markers (state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_transaction_type_state_version" ON ledger_transaction_markers (transaction_type, state_version) WHERE discriminator = 'transaction_type'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_ledger_transactions_epoch_round_in_epoch" ON ledger_transactions (epoch, round_in_epoch) WHERE index_in_round = 0; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transactions_intent_hash" ON ledger_transactions USING hash (intent_hash) WHERE intent_hash IS NOT NULL; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transactions_receipt_status_state_version" ON ledger_transactions (receipt_status, state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_ledger_transactions_round_timestamp" ON ledger_transactions (round_timestamp); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_data_history_non_fungible_id_definition_id_~" ON non_fungible_id_data_history (non_fungible_id_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_definition_non_fungible_resource_entity_id_~" ON non_fungible_id_definition (non_fungible_resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_non_fungible_id_definition_non_fungible_resource_entity_id~1" ON non_fungible_id_definition (non_fungible_resource_entity_id, non_fungible_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_location_history_non_fungible_id_definition~" ON non_fungible_id_location_history (non_fungible_id_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_non_fungible_schema_history_resource_entity_id_from_state_v~" ON non_fungible_schema_history (resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_non_fungible_vault_entry_definition_vault_entity_id_from_st~" ON non_fungible_vault_entry_definition (vault_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_non_fungible_vault_entry_history_non_fungible_vault_entry_d~" ON non_fungible_vault_entry_history (non_fungible_vault_entry_definition_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_package_blueprint_aggregate_history_package_entity_id_from_~" ON package_blueprint_aggregate_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_package_blueprint_history_package_entity_id_from_state_vers~" ON package_blueprint_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_package_blueprint_history_package_entity_id_name_version_fr~" ON package_blueprint_history (package_entity_id, name, version, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_package_code_aggregate_history_package_entity_id_from_state~" ON package_code_aggregate_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_package_code_history_package_entity_id_from_state_version" ON package_code_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_pending_transaction_payloads_pending_transaction_id" ON pending_transaction_payloads (pending_transaction_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_pending_transactions_first_submitted_to_gateway_timestamp" ON pending_transactions (first_submitted_to_gateway_timestamp); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_pending_transactions_intent_hash" ON pending_transactions (intent_hash); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_pending_transactions_payload_hash" ON pending_transactions (payload_hash); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_pending_transactions_resubmit_from_timestamp" ON pending_transactions (resubmit_from_timestamp); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_resource_entity_supply_history_resource_entity_id_from_stat~" ON resource_entity_supply_history (resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE UNIQUE INDEX "IX_resource_holders_entity_id_resource_entity_id" ON resource_holders (entity_id, resource_entity_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_resource_holders_resource_entity_id_balance_entity_id" ON resource_holders (resource_entity_id, balance DESC, entity_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_schema_entry_aggregate_history_entity_id_from_state_version" ON schema_entry_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_schema_entry_definition_entity_id_schema_hash" ON schema_entry_definition (entity_id, schema_hash); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_state_history_entity_id_from_state_version" ON state_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_unverified_standard_metadata_aggregate_history_entity_id_fr~" ON unverified_standard_metadata_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_unverified_standard_metadata_entry_history_entity_id_discri~" ON unverified_standard_metadata_entry_history (entity_id, discriminator, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_active_set_history_epoch" ON validator_active_set_history (epoch); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_active_set_history_from_state_version" ON validator_active_set_history (from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_active_set_history_validator_public_key_history_id" ON validator_active_set_history (validator_public_key_history_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_cumulative_emission_history_validator_entity_id_e~" ON validator_cumulative_emission_history (validator_entity_id, epoch_number); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_cumulative_emission_history_validator_entity_id_f~" ON validator_cumulative_emission_history (validator_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_public_key_history_validator_entity_id_from_state~" ON validator_public_key_history (validator_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_validator_public_key_history_validator_entity_id_key_type_k~" ON validator_public_key_history (validator_entity_id, key_type, key); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN CREATE INDEX "IX_vault_balance_history_vault_entity_id_from_state_version" ON vault_balance_history (vault_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250204103839_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20250211120656_InitialCreate') THEN INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20250204103839_InitialCreate', '8.0.2'); + VALUES ('20250211120656_InitialCreate', '8.0.2'); END IF; END $EF$; COMMIT; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index 7e402a4e2..a61cc522f 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -68,11 +68,8 @@ using System.Numerics; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using RadixDlt.NetworkGateway.Abstractions.Model; using RadixDlt.NetworkGateway.Abstractions.StandardMetadata; -using RadixDlt.NetworkGateway.PostgresIntegration; using RadixDlt.NetworkGateway.PostgresIntegration.Models; #nullable disable @@ -95,6 +92,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_relationship", new[] { "component_to_instantiating_package", "vault_to_resource", "validator_to_stake_vault", "validator_to_pending_xrd_withdraw_vault", "validator_to_locked_owner_stake_unit_vault", "validator_to_pending_owner_stake_unit_unlock_vault", "stake_unit_of_validator", "claim_token_of_validator", "entity_to_royalty_vault", "royalty_vault_of_entity", "account_locker_of_locker", "account_locker_of_account", "resource_pool_to_unit_resource", "resource_pool_to_resource", "resource_pool_to_resource_vault", "unit_resource_of_resource_pool", "resource_vault_of_resource_pool", "access_controller_to_recovery_badge", "recovery_badge_of_access_controller" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_role_requirement_type", new[] { "resource", "non_fungible" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker", "global_account_locker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "implicit_requirement_type", new[] { "package_of_direct_caller", "global_caller_entity", "global_caller_blueprint", "ed25519public_key", "secp256k1public_key" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_manifest_class", new[] { "general", "transfer", "validator_stake", "validator_unstake", "validator_claim", "account_deposit_settings_update", "pool_contribution", "pool_redemption" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from", "account_owner_method_call", "badge_presented" }); @@ -108,6 +106,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "queried_implicit_requirement_type", new[] { "package_of_direct_caller", "global_caller", "ed25519public_key", "secp256k1public_key" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "standard_metadata_key", new[] { "dapp_account_type", "dapp_definition", "dapp_definitions", "dapp_claimed_websites", "dapp_claimed_entities", "dapp_account_locker" }); @@ -900,6 +899,37 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("entity_role_assignments_owner_role_history"); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Discriminator") + .HasColumnType("implicit_requirement_type") + .HasColumnName("discriminator"); + + b.Property("FirstSeenStateVersion") + .HasColumnType("bigint") + .HasColumnName("first_seen_state_version"); + + b.Property("Hash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("hash"); + + b.HasKey("Id"); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator("Discriminator"); + + b.UseTphMappingStrategy(); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryDefinition", b => { b.Property("Id") @@ -2166,8 +2196,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("resource_entity_id"); - b.HasIndex("ResourceEntityId", "NonFungibleLocalId") - .HasDatabaseName("IX_entities_by_role_requirement_entry_definition_resource_ent~1") + b.HasIndex("EntityId", "ResourceEntityId", "NonFungibleLocalId") + .HasDatabaseName("IX_entities_by_role_requirement_entry_definition_entity_id_re~1") .HasFilter("discriminator = 'non_fungible'"); b.HasIndex("FirstSeenStateVersion", "Id", "EntityId", "ResourceEntityId", "NonFungibleLocalId") @@ -2188,7 +2218,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("resource_entity_id"); - b.HasIndex("ResourceEntityId") + b.HasIndex("EntityId", "ResourceEntityId") .HasFilter("discriminator = 'resource'"); b.HasIndex("FirstSeenStateVersion", "Id", "EntityId", "ResourceEntityId") @@ -2680,6 +2710,118 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Ed25519PublicKeyImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("PublicKeyBytes") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bytea") + .HasColumnName("public_key_bytes"); + + b.HasIndex("Hash") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_ed25519public_key") + .HasFilter("discriminator = 'ed25519public_key'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash"), new[] { "PublicKeyBytes", "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.Ed25519PublicKey); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalCallerBlueprintImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("BlueprintName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("Hash", "EntityId", "BlueprintName") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_global_caller_blueprint") + .HasFilter("discriminator = 'global_caller_blueprint'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash", "EntityId", "BlueprintName"), new[] { "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.GlobalCallerBlueprint); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalCallerEntityImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("Hash", "EntityId") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_global_caller_entity") + .HasFilter("discriminator = 'global_caller_entity'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash", "EntityId"), new[] { "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.GlobalCallerEntity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageOfDirectCallerImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("Hash", "EntityId") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_package_of_direct_caller") + .HasFilter("discriminator = 'package_of_direct_caller'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash", "EntityId"), new[] { "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.PackageOfDirectCaller); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Secp256K1PublicKeyImplicitRequirement", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.ImplicitRequirement"); + + b.Property("PublicKeyBytes") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bytea") + .HasColumnName("public_key_bytes"); + + b.HasIndex("Hash") + .IsUnique() + .HasDatabaseName("IX_implicit_requirements_secp256k1public_key") + .HasFilter("discriminator = 'secp256k1public_key'"); + + NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("Hash"), new[] { "PublicKeyBytes", "FirstSeenStateVersion" }); + + b.ToTable("implicit_requirements"); + + b.HasDiscriminator().HasValue(ImplicitRequirementType.Secp256k1PublicKey); + }); + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.BaseUserLedgerTransaction", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/ImplicitRequirement.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/ImplicitRequirement.cs new file mode 100644 index 000000000..e43feafb2 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/ImplicitRequirement.cs @@ -0,0 +1,119 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using RadixDlt.NetworkGateway.Abstractions.Model; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Models; + +[Table("implicit_requirements")] +internal abstract class ImplicitRequirement +{ + [Key] + [Column("id")] + public long Id { get; set; } + + [Column("hash")] + public string Hash { get; set; } + + [Column("first_seen_state_version")] + public long FirstSeenStateVersion { get; set; } + + [Column(CommonDbContext.DiscriminatorColumnName)] + public ImplicitRequirementType Discriminator { get; set; } +} + +internal class GlobalCallerEntityImplicitRequirement : ImplicitRequirement +{ + [Column("entity_id")] + public long EntityId { get; set; } +} + +internal class PackageOfDirectCallerImplicitRequirement : ImplicitRequirement +{ + [Column("entity_id")] + public long EntityId { get; set; } +} + +internal class GlobalCallerBlueprintImplicitRequirement : ImplicitRequirement +{ + [Column("entity_id")] + public long EntityId { get; set; } + + [Column("blueprint_name")] + public string BlueprintName { get; set; } +} + +internal class Secp256K1PublicKeyImplicitRequirement : ImplicitRequirement +{ + [Column("public_key_bytes")] + public byte[] PublicKeyBytes { get; set; } +} + +internal class Ed25519PublicKeyImplicitRequirement : ImplicitRequirement +{ + [Column("public_key_bytes")] + public byte[] PublicKeyBytes { get; set; } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/LedgerTransactions/LedgerTransactionSubintentData.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/LedgerTransactions/LedgerTransactionSubintentData.cs index 7d244d942..6aa3c8402 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/LedgerTransactions/LedgerTransactionSubintentData.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/LedgerTransactions/LedgerTransactionSubintentData.cs @@ -65,7 +65,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using CoreModel = RadixDlt.CoreApiSdk.Model; namespace RadixDlt.NetworkGateway.PostgresIntegration.Models; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/AccountStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/AccountStateQuerier.cs index 3f3f1cf92..574bc08c0 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/AccountStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/AccountStateQuerier.cs @@ -68,7 +68,6 @@ using RadixDlt.NetworkGateway.GatewayApi.Services; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using RadixDlt.NetworkGateway.PostgresIntegration.Queries; -using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/DepositPreValidationQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/DepositPreValidationQuerier.cs index c284ac049..5b1918e76 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/DepositPreValidationQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/AccountDepositSettings/DepositPreValidationQuerier.cs @@ -109,7 +109,7 @@ public DepositPreValidationQuerier( CancellationToken token = default ) { - var xrdResourceAddress = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).WellKnownAddresses.Xrd; + var xrdResourceAddress = _networkConfigurationProvider.GetNetworkConfiguration().WellKnownAddresses.Xrd; var accountEntity = await _entityQuerier.GetEntity(accountAddress, ledgerState, token); if (accountEntity is PreAllocatedAccountComponentEntity) { diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntitiesByRoleRequirementQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntitiesByRoleRequirementQuerier.cs index 083608857..6fedeeda7 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntitiesByRoleRequirementQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntitiesByRoleRequirementQuerier.cs @@ -64,11 +64,9 @@ using Microsoft.EntityFrameworkCore; using RadixDlt.NetworkGateway.Abstractions; -using RadixDlt.NetworkGateway.Abstractions.Model; using RadixDlt.NetworkGateway.GatewayApi.Exceptions; using RadixDlt.NetworkGateway.GatewayApi.Services; using RadixDlt.NetworkGateway.PostgresIntegration.Queries; -using System; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs index 2b5896905..737c3941d 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs @@ -131,7 +131,7 @@ public EntityStateQuerier( { var defaultPageSize = _endpointConfiguration.Value.DefaultPageSize; var packagePageSize = _endpointConfiguration.Value.DefaultHeavyCollectionsPageSize; - var networkConfiguration = await _networkConfigurationProvider.GetNetworkConfiguration(token); + var networkConfiguration = _networkConfigurationProvider.GetNetworkConfiguration(); var entities = await _entityQuerier.GetEntities(addresses, ledgerState, token); var componentEntities = entities.OfType().ToList(); @@ -152,7 +152,7 @@ public EntityStateQuerier( PageSize = _endpointConfiguration.Value.DefaultPageSize, MaxDefinitionsLookupLimit = _endpointConfiguration.Value.MaxDefinitionsLookupLimit, }, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id, + _networkConfigurationProvider.GetNetworkConfiguration().Id, token); var roleAssignmentsHistory = await _roleAssignmentQuerier.GetRoleAssignmentsHistory(globalPersistedComponentEntities, ledgerState, token); @@ -160,6 +160,7 @@ public EntityStateQuerier( var packageBlueprintHistory = await PackageQueries.PackageBlueprintHistoryMultiLookup(_dbContext, packageEntities.Select(e => e.Id).ToArray(), 0, packagePageSize, ledgerState, token); var packageCodeHistory = await PackageQueries.PackageCodeHistoryMultiLookup(_dbContext, packageEntities.Select(e => e.Id).ToArray(), 0, packagePageSize, ledgerState, token); var packageSchemaHistory = await GetEntitySchemaHistory(packageEntities.Select(e => e.Id).ToArray(), 0, packagePageSize, ledgerState, token); + var resolvedTwoWayLinks = optIns.DappTwoWayLinks ? await new StandardMetadataResolver(_dbContext, _dapperWrapper).ResolveTwoWayLinks(entities, true, ledgerState, token) : ImmutableDictionary>.Empty; @@ -345,7 +346,7 @@ public EntityStateQuerier( case PreAllocatedIdentityEntity: case PreAllocatedAccountComponentEntity: - var preAllocatedEntityData = await _preAllocatedEntityDataProvider.GetPreAllocatedEntityData(entity.Address); + var preAllocatedEntityData = _preAllocatedEntityDataProvider.GetPreAllocatedEntityData(entity.Address); details = preAllocatedEntityData.Details; metadata[entity.Id] = preAllocatedEntityData.Metadata; @@ -383,6 +384,7 @@ public EntityStateQuerier( string? componentRoyaltyVaultBalance = null; ComponentMethodRoyaltyEntryHistory[]? componentRoyaltyConfig = null; GatewayModel.TwoWayLinkedDappOnLedgerDetails? twoWayLinkedDappOnLedgerDetails = null; + var nonAccountTwoWayLinkedDapp = twoWayLinks?.OfType().FirstOrDefault()?.EntityAddress; if (ce is GlobalAccountEntity) @@ -488,7 +490,7 @@ public EntityStateQuerier( entityIds, optIns.ExplicitMetadata.ToArray(), ledgerState, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id, + _networkConfigurationProvider.GetNetworkConfiguration().Id, token) : null; @@ -560,7 +562,7 @@ public EntityStateQuerier( entityIds, optIns.ExplicitMetadata.ToArray(), ledgerState, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id, + _networkConfigurationProvider.GetNetworkConfiguration().Id, token) : null; @@ -631,7 +633,7 @@ public EntityStateQuerier( if (entity is PreAllocatedIdentityEntity or PreAllocatedAccountComponentEntity) { - var (_, preAllocatedEntityMetadata) = await _preAllocatedEntityDataProvider.GetPreAllocatedEntityData(entity.Address); + var (_, preAllocatedEntityMetadata) = _preAllocatedEntityDataProvider.GetPreAllocatedEntityData(entity.Address); metadata = preAllocatedEntityMetadata; } else @@ -647,7 +649,7 @@ public EntityStateQuerier( PageSize = request.Limit, MaxDefinitionsLookupLimit = _endpointConfiguration.Value.MaxDefinitionsLookupLimit, }, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id, + _networkConfigurationProvider.GetNetworkConfiguration().Id, token))[entity.Id]; } @@ -868,7 +870,7 @@ FROM schema_entry_definition schemaBytes!, sborStateHistory.SborTypeKind, sborStateHistory.TypeIndex, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id); + _networkConfigurationProvider.GetNetworkConfiguration().Id); result.Add(state.EntityId, jsonState); break; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ImplicitRequirementsQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ImplicitRequirementsQuerier.cs new file mode 100644 index 000000000..f033767c4 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ImplicitRequirementsQuerier.cs @@ -0,0 +1,316 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using Microsoft.EntityFrameworkCore; +using RadixDlt.NetworkGateway.Abstractions; +using RadixDlt.NetworkGateway.Abstractions.Extensions; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.Abstractions.Network; +using RadixDlt.NetworkGateway.GatewayApi.Services; +using RadixDlt.NetworkGateway.PostgresIntegration.LedgerExtension; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using GatewayModel = RadixDlt.NetworkGateway.GatewayApiSdk.Model; + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Services; + +internal class ImplicitRequirementsQuerier : IImplicitRequirementsQuerier +{ + private record struct ImplicitRequirementLookup(QueriedImplicitRequirementType Type, string Hash); + + private record struct ImplicitRequirementQueryResult( + QueriedImplicitRequirementType QueriedType, + string QueriedHash, + long? FirstSeenStateVersion, + ImplicitRequirementType ResolvedType, + EntityAddress? EntityAddress, + string? BlueprintName, + byte[] PublicKeyBytes); + + private readonly ReadOnlyDbContext _dbContext; + private readonly IDapperWrapper _dapperWrapper; + private readonly INetworkConfigurationProvider _networkConfigurationProvider; + + public ImplicitRequirementsQuerier( + ReadOnlyDbContext dbContext, + IDapperWrapper dapperWrapper, + INetworkConfigurationProvider networkConfigurationProvider) + { + _dbContext = dbContext; + _dapperWrapper = dapperWrapper; + _networkConfigurationProvider = networkConfigurationProvider; + } + + public async Task ImplicitRequirementsLookup( + List nonFungibleGlobalIds, + CancellationToken token = default) + { + if (nonFungibleGlobalIds.Count == 0) + { + return new GatewayModel.ImplicitRequirementsLookupResponse(new List()); + } + + var wellKnownAddresses = _networkConfigurationProvider.GetNetworkConfiguration().WellKnownAddresses; + + var implicitRequirementsToResolve = new Dictionary(); + var resolvedSystemExecutionRequirements = new Dictionary(); + + foreach (var item in nonFungibleGlobalIds) + { + if (item.ResourceAddress == wellKnownAddresses.SystemTransactionBadge) + { + var mapped = MapSystemExecutionImplicitRequirements(item); + resolvedSystemExecutionRequirements.TryAdd(item.NonFungibleId, mapped); + } + else + { + var lookup = MapToLookup(item, wellKnownAddresses); + implicitRequirementsToResolve.TryAdd(lookup, item); + } + } + + Dictionary resolvedFromDb = new Dictionary(); + + if (implicitRequirementsToResolve.Count > 0) + { + implicitRequirementsToResolve.Keys.Unzip( + x => x.Type, + x => x.Hash, + out var implicitRequirementTypes, + out var implicitRequirementHashes); + + var parameters = new + { + implicitRequirementTypes = implicitRequirementTypes, + implicitRequirementHashes = implicitRequirementHashes, + }; + + var cd = DapperExtensions.CreateCommandDefinition( + @" +WITH variables(queried_type, hash) AS +( + SELECT + UNNEST(@implicitRequirementTypes), + UNNEST(@implicitRequirementHashes) +) +SELECT + variables.queried_type AS QueriedType + , variables.hash AS QueriedHash + , ir.first_seen_state_version AS FirstSeenStateVersion + , ir.discriminator AS ResolvedType + , e.address AS EntityAddress + , ir.blueprint_name AS BlueprintName + , ir.public_key_bytes AS PublicKeyBytes +FROM variables +LEFT JOIN LATERAL ( + SELECT + first_seen_state_version + ,discriminator + ,entity_id + ,blueprint_name + ,public_key_bytes + FROM implicit_requirements ir + WHERE + variables.queried_type = 'package_of_direct_caller'::queried_implicit_requirement_type AND + ir.discriminator = 'package_of_direct_caller' AND + ir.hash = variables.hash + UNION + SELECT + first_seen_state_version + ,discriminator + ,entity_id + ,blueprint_name + ,public_key_bytes + FROM implicit_requirements ir + WHERE + variables.queried_type = 'ed25519public_key'::queried_implicit_requirement_type AND + ir.discriminator = 'ed25519public_key' AND + ir.hash = variables.hash + UNION + SELECT + first_seen_state_version + ,discriminator + ,entity_id + ,blueprint_name + ,public_key_bytes + FROM implicit_requirements ir + WHERE + variables.queried_type = 'secp256k1public_key'::queried_implicit_requirement_type AND + ir.discriminator = 'secp256k1public_key' AND + ir.hash = variables.hash + UNION + SELECT + first_seen_state_version + ,discriminator + ,entity_id + ,blueprint_name + ,public_key_bytes + FROM implicit_requirements ir + WHERE + variables.queried_type = 'global_caller'::queried_implicit_requirement_type AND + (ir.discriminator = 'global_caller_entity' OR ir.discriminator = 'global_caller_blueprint') AND + ir.hash = variables.hash +) ir ON true +LEFT JOIN entities e ON ir.entity_id = e.id;", + parameters, + cancellationToken: token + ); + + resolvedFromDb = (await _dapperWrapper.ToListAsync(_dbContext.Database.GetDbConnection(), cd)) + .ToDictionary(x => new ImplicitRequirementLookup(x.QueriedType, x.QueriedHash), y => y); + } + + var result = new List(); + + foreach (var requestNfid in nonFungibleGlobalIds) + { + if (requestNfid.ResourceAddress == wellKnownAddresses.SystemTransactionBadge) + { + var mappedResultItem = resolvedSystemExecutionRequirements[requestNfid.NonFungibleId]; + result.Add(mappedResultItem); + } + else + { + var lookup = MapToLookup(requestNfid, wellKnownAddresses); + var dbResolvedItem = resolvedFromDb[lookup]; + var dbResolvedMappedItem = MapDbResolvedItem(dbResolvedItem, requestNfid); + result.Add(dbResolvedMappedItem); + } + } + + return new GatewayModel.ImplicitRequirementsLookupResponse(result); + } + + private ImplicitRequirementLookup MapToLookup(GatewayModel.NonFungibleGlobalId item, WellKnownAddresses wellKnownAddresses) + { + if (item.ResourceAddress == wellKnownAddresses.Secp256k1SignatureVirtualBadge) + { + return new ImplicitRequirementLookup(QueriedImplicitRequirementType.Secp256k1PublicKey, item.NonFungibleId); + } + + if (item.ResourceAddress == wellKnownAddresses.Ed25519SignatureVirtualBadge) + { + return new ImplicitRequirementLookup(QueriedImplicitRequirementType.Ed25519PublicKey, item.NonFungibleId); + } + + if (item.ResourceAddress == wellKnownAddresses.GlobalCallerVirtualBadge) + { + return new ImplicitRequirementLookup(QueriedImplicitRequirementType.GlobalCaller, item.NonFungibleId); + } + + if (item.ResourceAddress == wellKnownAddresses.PackageOfDirectCallerVirtualBadge) + { + return new ImplicitRequirementLookup(QueriedImplicitRequirementType.PackageOfDirectCaller, item.NonFungibleId); + } + + throw new NotSupportedException($"Not supported implicit requirement type: {item.ResourceAddress}"); + } + + private GatewayModel.ImplicitRequirementsLookupCollectionItem MapSystemExecutionImplicitRequirements(GatewayModel.NonFungibleGlobalId item) + { + const string ProtocolExecutionNfid = "#0#"; + const string ValidatorExecutionNfid = "#1#"; + + return item.NonFungibleId switch + { + ProtocolExecutionNfid => new GatewayModel.ImplicitRequirementsLookupCollectionItem(requirement: item, resolved: new GatewayModel.ResolvedProtocolExecutionImplicitRequirement()), + ValidatorExecutionNfid => new GatewayModel.ImplicitRequirementsLookupCollectionItem(requirement: item, resolved: new GatewayModel.ResolvedValidatorExecutionImplicitRequirement()), + _ => new GatewayModel.ImplicitRequirementsLookupCollectionItem(requirement: item, resolved: null), + }; + } + + private GatewayModel.ImplicitRequirementsLookupCollectionItem MapDbResolvedItem(ImplicitRequirementQueryResult resultRow, GatewayModel.NonFungibleGlobalId requestItem) + { + if (!resultRow.FirstSeenStateVersion.HasValue) + { + return + new GatewayModel.ImplicitRequirementsLookupCollectionItem( + requirement: requestItem, + resolved: null + ); + } + + GatewayModel.ResolvedImplicitRequirement resolved = resultRow.ResolvedType switch + { + ImplicitRequirementType.PackageOfDirectCaller => + new GatewayModel.ResolvedPackageOfDirectCallerImplicitRequirement(resultRow.FirstSeenStateVersion.Value, resultRow.EntityAddress), + ImplicitRequirementType.GlobalCallerEntity => + new GatewayModel.ResolvedGlobalCallerEntityImplicitRequirement(resultRow.FirstSeenStateVersion.Value, resultRow.EntityAddress), + ImplicitRequirementType.GlobalCallerBlueprint => + new GatewayModel.ResolvedGlobalCallerBlueprintImplicitRequirement(resultRow.FirstSeenStateVersion.Value, resultRow.EntityAddress, resultRow.BlueprintName), + ImplicitRequirementType.Ed25519PublicKey => + new GatewayModel.ResolvedEd25519PublicKeyImplicitRequirement(resultRow.FirstSeenStateVersion.Value, resultRow.PublicKeyBytes.ToHex()), + ImplicitRequirementType.Secp256k1PublicKey => + new GatewayModel.ResolvedSecp256k1PublicKeyImplicitRequirement(resultRow.FirstSeenStateVersion.Value, resultRow.PublicKeyBytes.ToHex()), + _ => throw new NotSupportedException($"Not supported implicit requirement type: {resultRow.ResolvedType}"), + }; + + return new GatewayModel.ImplicitRequirementsLookupCollectionItem( + requirement: requestItem, + resolved: resolved); + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/KeyValueStoreQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/KeyValueStoreQuerier.cs index d57ca12c9..0dd12c4b0 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/KeyValueStoreQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/KeyValueStoreQuerier.cs @@ -105,7 +105,7 @@ public KeyValueStoreQuerier( int pageSize, CancellationToken token = default) { - var networkId = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id; + var networkId = _networkConfigurationProvider.GetNetworkConfiguration().Id; var keyValueStore = await _entityQuerier.GetNonPreAllocatedEntity(keyValueStoreAddress, ledgerState, token); var keyValueStoreSchema = await KeyValueStoreQueries.KeyValueStoreSchemaLookupQuery( @@ -137,7 +137,7 @@ public KeyValueStoreQuerier( GatewayModel.LedgerState ledgerState, CancellationToken token = default) { - var networkId = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id; + var networkId = _networkConfigurationProvider.GetNetworkConfiguration().Id; var keyValueStore = await _entityQuerier.GetNonPreAllocatedEntity(keyValueStoreAddress, ledgerState, token); var keyValueStoreSchema = await KeyValueStoreQueries.KeyValueStoreSchemaLookupQuery( diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerStateQuerier.cs index 122c39a41..3f55008a8 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerStateQuerier.cs @@ -128,7 +128,7 @@ public LedgerStateQuerier( return new GatewayModel.GatewayStatusResponse( new GatewayModel.LedgerState( - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name, + _networkConfigurationProvider.GetNetworkConfiguration().Name, topLedgerTransaction.StateVersion, topLedgerTransaction.RoundTimestamp.AsUtcIsoDateWithMillisString(), topLedgerTransaction.Epoch, @@ -411,7 +411,7 @@ private async Task GetLedgerStateAtEpochStart(long epoch, Can ? null : new LedgerStateReport( new GatewayModel.LedgerState( - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Name, + _networkConfigurationProvider.GetNetworkConfiguration().Name, lt.StateVersion, lt.RoundTimestamp.AsUtcIsoDateWithMillisString(), lt.Epoch, diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/NonFungibleQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/NonFungibleQuerier.cs index c26a26a00..fd15a1b20 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/NonFungibleQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/NonFungibleQuerier.cs @@ -121,7 +121,7 @@ public NonFungibleQuerier(ReadOnlyDbContext readOnlyDbContext, IDapperWrapper da _dapperWrapper, nonFungibleResourceEntity, nonFungibleIds, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id, + _networkConfigurationProvider.GetNetworkConfiguration().Id, ledgerState, token); } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/OpenApiDocumentQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/OpenApiDocumentQuerier.cs index 0be02779b..978acca5b 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/OpenApiDocumentQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/OpenApiDocumentQuerier.cs @@ -114,6 +114,17 @@ public async Task GetPlaceholderData(Cancellatio ) .FirstOrDefaultAsync(token); - return new OpenApiDocumentPlaceholderData(randomIntentHash, randomSubintentHash, currentEpoch, requirement?.Address, requirement?.NonFungibleLocalId); + var implicitRequirement = await _dbContext + .ImplicitRequirements + .OfType() + .FirstOrDefaultAsync(token); + + return new OpenApiDocumentPlaceholderData( + randomIntentHash, + randomSubintentHash, + currentEpoch, + requirement?.Address, + requirement?.NonFungibleLocalId, + implicitRequirement?.Hash); } } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PendingTransactions/PendingTransactionResubmissionService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PendingTransactions/PendingTransactionResubmissionService.cs index 963c3ae63..cc4e0bc1e 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PendingTransactions/PendingTransactionResubmissionService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PendingTransactions/PendingTransactionResubmissionService.cs @@ -288,7 +288,7 @@ private async Task Resubmit(PendingTransactionWithCh new SubmitContext( TransactionApi: coreApiProvider.TransactionApi, TargetNode: chosenNode.Name, - NetworkName: (await _networkConfigurationProvider.GetNetworkConfiguration(cancellationToken)).Name, + NetworkName: _networkConfigurationProvider.GetNetworkConfiguration().Name, SubmissionTimeout: _mempoolOptionsMonitor.CurrentValue.ResubmissionNodeRequestTimeout, IsResubmission: true, ForceNodeToRecalculateResult: false), diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PreAllocatedEntityDataProvider.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PreAllocatedEntityDataProvider.cs index 3c1e4ecc3..6d2a9a082 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PreAllocatedEntityDataProvider.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/PreAllocatedEntityDataProvider.cs @@ -69,7 +69,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using CoreModel = RadixDlt.CoreApiSdk.Model; using GatewayModel = RadixDlt.NetworkGateway.GatewayApiSdk.Model; using ToolkitModel = RadixEngineToolkit; @@ -78,7 +77,7 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.Services; internal interface IPreAllocatedEntityDataProvider { - Task<(GatewayModel.StateEntityDetailsResponseComponentDetails Details, GatewayModel.EntityMetadataCollection Metadata)> GetPreAllocatedEntityData(EntityAddress address); + (GatewayModel.StateEntityDetailsResponseComponentDetails Details, GatewayModel.EntityMetadataCollection Metadata) GetPreAllocatedEntityData(EntityAddress address); } internal class PreAllocatedEntityDataProvider : IPreAllocatedEntityDataProvider @@ -94,10 +93,10 @@ public PreAllocatedEntityDataProvider(INetworkConfigurationProvider networkConfi _preAllocatedIdentityRoleAssignmentEntries = GeneratePreAllocatedIdentityRoleAssignmentEntries(roleAssignmentsKeyProvider); } - public async Task<(GatewayModel.StateEntityDetailsResponseComponentDetails Details, GatewayModel.EntityMetadataCollection Metadata)> GetPreAllocatedEntityData(EntityAddress address) + public (GatewayModel.StateEntityDetailsResponseComponentDetails Details, GatewayModel.EntityMetadataCollection Metadata) GetPreAllocatedEntityData(EntityAddress address) { var decoded = address.Decode(); - var networkConfiguration = await _networkConfigurationProvider.GetNetworkConfiguration(); + var networkConfiguration = _networkConfigurationProvider.GetNetworkConfiguration(); if (!decoded.IsSecp256k() && !decoded.IsEd25519()) { diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TopOfLedgerProvider.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TopOfLedgerProvider.cs index e6d64145e..5be044921 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TopOfLedgerProvider.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TopOfLedgerProvider.cs @@ -118,7 +118,7 @@ public async Task GetTopOfLedger(CancellationToken token) .FirstOrDefaultAsync(token); return lastTransaction == null - ? await PreGenesisTransactionSummary() + ? PreGenesisTransactionSummary() : new TransactionSummary( StateVersion: lastTransaction.StateVersion, RoundTimestamp: lastTransaction.RoundTimestamp, @@ -131,7 +131,7 @@ public async Task GetTopOfLedger(CancellationToken token) ); } - private async Task PreGenesisTransactionSummary() + private TransactionSummary PreGenesisTransactionSummary() { // Nearly all of theses turn out to be unused! return new TransactionSummary( @@ -139,8 +139,8 @@ private async Task PreGenesisTransactionSummary() RoundTimestamp: DateTimeOffset.FromUnixTimeSeconds(0).UtcDateTime, NormalizedRoundTimestamp: DateTimeOffset.FromUnixTimeSeconds(0).UtcDateTime, CreatedTimestamp: _clock.UtcNow, - Epoch: (await _networkConfigurationProvider.GetNetworkConfiguration()).GenesisEpoch, - RoundInEpoch: (await _networkConfigurationProvider.GetNetworkConfiguration()).GenesisRound, + Epoch: _networkConfigurationProvider.GetNetworkConfiguration().GenesisEpoch, + RoundInEpoch: _networkConfigurationProvider.GetNetworkConfiguration().GenesisRound, IndexInEpoch: -1, // invalid, but we increase it by one to in ProcessTransactions IndexInRound: -1 // invalid, but we increase it by one to in ProcessTransactions ); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs index 5b9c2df59..f9f533fad 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/TransactionQuerier.cs @@ -591,7 +591,7 @@ FROM schema_entry_definition eventDetailsData = await SchemaDefinitionDataQuery.Execute(_dapperWrapper, _dbContext, entityIds, token); } - var networkId = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id; + var networkId = _networkConfigurationProvider.GetNetworkConfiguration().Id; var mappedTransactions = MapTransactions(transactions, transactionStateVersions, optIns, entityIdToAddressMap, eventDetailsData, schemas, networkId); return mappedTransactions; } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs index 07b219258..b6359e5f5 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/ValidatorQuerier.cs @@ -289,7 +289,7 @@ LIMIT 1 PageSize = _endpointConfiguration.Value.DefaultPageSize, MaxDefinitionsLookupLimit = _endpointConfiguration.Value.MaxDefinitionsLookupLimit, }, - (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id, + _networkConfigurationProvider.GetNetworkConfiguration().Id, token); var items = validatorsAndOneMore diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/packages.lock.json b/src/RadixDlt.NetworkGateway.PostgresIntegration/packages.lock.json index 4f30fcc15..2e014c7f6 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/packages.lock.json +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/packages.lock.json @@ -467,27 +467,6 @@ "System.CodeDom": "4.4.0" } }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Npgsql": { "type": "Transitive", "resolved": "8.0.2", @@ -644,7 +623,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -758,16 +736,6 @@ "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Polly": { "type": "CentralTransitive", "requested": "[8.3.0, )", diff --git a/src/RadixDlt.NetworkGateway.PrometheusIntegration/packages.lock.json b/src/RadixDlt.NetworkGateway.PrometheusIntegration/packages.lock.json index b6997c006..bd3f94f69 100644 --- a/src/RadixDlt.NetworkGateway.PrometheusIntegration/packages.lock.json +++ b/src/RadixDlt.NetworkGateway.PrometheusIntegration/packages.lock.json @@ -284,27 +284,6 @@ "resolved": "8.0.0", "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Polly.Core": { "type": "Transitive", "resolved": "8.3.0", @@ -323,11 +302,6 @@ "resolved": "1.2.0.556", "contentHash": "zvn9Mqs/ox/83cpYPignI8hJEM2A93s2HkHs8HYMOAQW0PkampyoErAiIyKxgTLqbbad29HX/shv/6LGSjPJNQ==" }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "1.7.1", - "contentHash": "B43Zsz5EfMwyEbnObwRxW5u85fzJma3lrDeGcSAV1qkhSRTNY5uXAByTn9h9ddNdhM+4/YoLc/CI43umjwIl9Q==" - }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", "resolved": "8.0.0", @@ -366,7 +340,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -486,16 +459,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Polly": { "type": "CentralTransitive", "requested": "[8.3.0, )", diff --git a/tests/RadixDlt.NetworkGateway.UnitTests/GatewayApi/Validators/RadixAddressValidatorTests.cs b/tests/RadixDlt.NetworkGateway.UnitTests/GatewayApi/Validators/RadixAddressValidatorTests.cs index c3b83596d..48ae9cee4 100644 --- a/tests/RadixDlt.NetworkGateway.UnitTests/GatewayApi/Validators/RadixAddressValidatorTests.cs +++ b/tests/RadixDlt.NetworkGateway.UnitTests/GatewayApi/Validators/RadixAddressValidatorTests.cs @@ -66,7 +66,6 @@ using Moq; using RadixDlt.NetworkGateway.Abstractions.Network; using RadixDlt.NetworkGateway.GatewayApi.Validators; -using System.Threading; using System.Threading.Tasks; using Xunit; @@ -133,8 +132,8 @@ public async Task WhenGiven_ValidValue_Succeeds(string address, string expectedN // Prepare. var networkConfigurationProviderMock = new Mock(); networkConfigurationProviderMock - .Setup(x => x.GetNetworkConfiguration(It.IsAny())) - .ReturnsAsync(new NetworkConfiguration(0, null!, 0, 0, null!, null!, expectedNetworkHrpSuffix, null!)); + .Setup(x => x.GetNetworkConfiguration()) + .Returns(new NetworkConfiguration(0, null!, 0, 0, null!, null!, expectedNetworkHrpSuffix, null!)); var validator = new RadixAddressValidator(networkConfigurationProviderMock.Object); // Act. @@ -156,8 +155,8 @@ public async Task WhenGiven_InvalidValue_Fails(string address, string expectedNe // Prepare. var networkConfigurationProviderMock = new Mock(); networkConfigurationProviderMock - .Setup(x => x.GetNetworkConfiguration(It.IsAny())) - .ReturnsAsync(new NetworkConfiguration(0, null!, 0, 0, null!, null!, expectedNetworkHrpSuffix, null!)); + .Setup(x => x.GetNetworkConfiguration()) + .Returns(new NetworkConfiguration(0, null!, 0, 0, null!, null!, expectedNetworkHrpSuffix, null!)); var validator = new RadixAddressValidator(networkConfigurationProviderMock.Object); // Act. diff --git a/tests/RadixDlt.NetworkGateway.UnitTests/PostgresIntegration/AccountDepositPreValidationTests.cs b/tests/RadixDlt.NetworkGateway.UnitTests/PostgresIntegration/AccountDepositPreValidationTests.cs index 8f782eb64..669d9d7a0 100644 --- a/tests/RadixDlt.NetworkGateway.UnitTests/PostgresIntegration/AccountDepositPreValidationTests.cs +++ b/tests/RadixDlt.NetworkGateway.UnitTests/PostgresIntegration/AccountDepositPreValidationTests.cs @@ -104,7 +104,7 @@ public async Task AccountIsConfiguredToAllowExistings_AllResourceVaultsExists_De var accountAddress = "account1"; var resourceAddresses = new List { "resource1", "resource2", "xrd_resource" }; - var badge = new AccountDepositPreValidationResourceBadge(AccountAuthorizedDepositorBadgeType.ResourceBadge, "badge_resource"); + var badge = new AccountDepositPreValidationResourceBadge("badge_resource"); var request = new AccountDepositPreValidationRequest(accountAddress, resourceAddresses, badge); mockDepositPreValidationQuerier diff --git a/tests/RadixDlt.NetworkGateway.UnitTests/packages.lock.json b/tests/RadixDlt.NetworkGateway.UnitTests/packages.lock.json index f142bbfb4..61f50fffe 100644 --- a/tests/RadixDlt.NetworkGateway.UnitTests/packages.lock.json +++ b/tests/RadixDlt.NetworkGateway.UnitTests/packages.lock.json @@ -472,27 +472,6 @@ "System.CodeDom": "4.4.0" } }, - "Nito.AsyncEx.Tasks": { - "type": "Transitive", - "resolved": "5.1.2", - "contentHash": "jEkCfR2/M26OK/U4G7SEN063EU/F4LiVA06TtpZILMdX/quIHCg+wn31Zerl2LC+u1cyFancjTY3cNAr2/89PA==", - "dependencies": { - "Nito.Disposables": "2.2.1" - } - }, - "Nito.Collections.Deque": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "CU0/Iuv5VDynK8I8pDLwkgF0rZhbQoZahtodfL0M3x2gFkpBRApKs8RyMyNlAi1mwExE4gsmqQXk4aFVvW9a4Q==" - }, - "Nito.Disposables": { - "type": "Transitive", - "resolved": "2.2.1", - "contentHash": "6sZ5uynQeAE9dPWBQGKebNmxbY4xsvcc5VplB5WkYEESUS7oy4AwnFp0FhqxTSKm/PaFrFqLrYr696CYN8cugg==", - "dependencies": { - "System.Collections.Immutable": "1.7.1" - } - }, "Npgsql": { "type": "Transitive", "resolved": "8.0.2", @@ -702,7 +681,6 @@ "Microsoft.Extensions.Hosting": "[8.0.0, )", "Microsoft.Extensions.Logging.Abstractions": "[8.0.0, )", "Newtonsoft.Json": "[13.0.3, )", - "Nito.AsyncEx.Coordination": "[5.1.2, )", "RadixDlt.CoreApiSdk": "[1.10.0-develop, )" } }, @@ -890,16 +868,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "Nito.AsyncEx.Coordination": { - "type": "CentralTransitive", - "requested": "[5.1.2, )", - "resolved": "5.1.2", - "contentHash": "QMyUfsaxov//0ZMbOHWr9hJaBFteZd66DV1ay4J5wRODDb8+K/uHC7+3VsOflo6SVw/29mu8OWZp8vMDSuzc0w==", - "dependencies": { - "Nito.AsyncEx.Tasks": "5.1.2", - "Nito.Collections.Deque": "1.1.1" - } - }, "Npgsql.EntityFrameworkCore.PostgreSQL": { "type": "CentralTransitive", "requested": "[8.0.2, )",