diff --git a/.idea/.idea.babylon-gateway/.idea/indexLayout.xml b/.idea/.idea.babylon-gateway/.idea/indexLayout.xml index 015b0c5cb..c341a9534 100644 --- a/.idea/.idea.babylon-gateway/.idea/indexLayout.xml +++ b/.idea/.idea.babylon-gateway/.idea/indexLayout.xml @@ -6,6 +6,7 @@ deployment docs generation + sdk diff --git a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-spec.yaml b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-spec.yaml index 504a7530c..d0627413e 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-spec.yaml +++ b/src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-spec.yaml @@ -233,16 +233,6 @@ components: type: string pattern: "^-?[0-9]+$" - # - # Mapping Enums - # - - ResourceTypeMapping: - type: string - enum: - - fungible - - non_fungible - # # Generic Types # @@ -642,42 +632,79 @@ components: type: array items: $ref: "#/components/schemas/EntityMetadataItem" + EntityDetailsResponseDetailsType: + type: string + enum: + - fungible_resource + - non_fungible_resource + - account_component EntityDetailsResponseDetails: oneOf: - - $ref: "#/components/schemas/EntityDetailsResponseFungibleDetails" - - $ref: "#/components/schemas/EntityDetailsResponseNonFungibleDetails" + - $ref: "#/components/schemas/EntityDetailsResponseFungibleResourceDetails" + - $ref: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetails" + - $ref: "#/components/schemas/EntityDetailsResponseAccountComponentDetails" discriminator: - propertyName: resource_type + propertyName: discriminator mapping: - # Must match ResourceTypeMapping - fungible: "#/components/schemas/EntityDetailsResponseFungibleDetails" - non_fungible: "#/components/schemas/EntityDetailsResponseNonFungibleDetails" - EntityDetailsResponseFungibleDetails: + # Must match EntityDetailsResponseDetailsType + fungible_resource: "#/components/schemas/EntityDetailsResponseFungibleResourceDetails" + non_fungible_resource: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetails" + account_component: "#/components/schemas/EntityDetailsResponseAccountComponentDetails" + EntityDetailsResponseFungibleResourceDetails: type: object required: - - resource_type + - discriminator - total_supply_attos - total_minted_attos - total_burnt_attos properties: - resource_type: - $ref: "#/components/schemas/ResourceTypeMapping" + discriminator: + $ref: "#/components/schemas/EntityDetailsResponseDetailsType" total_supply_attos: $ref: "#/components/schemas/TokenAmountAttos" total_minted_attos: $ref: "#/components/schemas/TokenAmountAttos" total_burnt_attos: $ref: "#/components/schemas/TokenAmountAttos" - EntityDetailsResponseNonFungibleDetails: + EntityDetailsResponseNonFungibleResourceDetails: type: object required: - - resource_type - - tbd + - discriminator + - ids properties: - resource_type: - $ref: "#/components/schemas/ResourceTypeMapping" - tbd: + discriminator: + $ref: "#/components/schemas/EntityDetailsResponseDetailsType" + ids: + $ref: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetailsIds" + EntityDetailsResponseNonFungibleResourceDetailsIds: + allOf: + - $ref: "#/components/schemas/ResultSetCursorMixin" + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetailsIdsItem" + EntityDetailsResponseNonFungibleResourceDetailsIdsItem: + type: object + required: + - id + properties: + id_hex: + type: string + immutable_data_hex: + type: string + mutable_data_hex: type: string + EntityDetailsResponseAccountComponentDetails: + type: object + required: + - discriminator + properties: + discriminator: + $ref: "#/components/schemas/EntityDetailsResponseDetailsType" EntityOverviewRequest: type: object diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseAccountComponentDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseAccountComponentDetails.cs new file mode 100644 index 000000000..a88f5fa71 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseAccountComponentDetails.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 Babylon Gateway API + * + * See https://docs.radixdlt.com/main/apis/introduction.html + * + * The version of the OpenAPI document: 2.0.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 System.ComponentModel.DataAnnotations; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// EntityDetailsResponseAccountComponentDetails + /// + [DataContract(Name = "EntityDetailsResponseAccountComponentDetails")] + public partial class EntityDetailsResponseAccountComponentDetails : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Discriminator + /// + [DataMember(Name = "discriminator", IsRequired = true, EmitDefaultValue = true)] + public EntityDetailsResponseDetailsType Discriminator { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EntityDetailsResponseAccountComponentDetails() { } + /// + /// Initializes a new instance of the class. + /// + /// discriminator (required). + public EntityDetailsResponseAccountComponentDetails(EntityDetailsResponseDetailsType discriminator = default(EntityDetailsResponseDetailsType)) + { + this.Discriminator = discriminator; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EntityDetailsResponseAccountComponentDetails {\n"); + sb.Append(" Discriminator: ").Append(Discriminator).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 EntityDetailsResponseAccountComponentDetails); + } + + /// + /// Returns true if EntityDetailsResponseAccountComponentDetails instances are equal + /// + /// Instance of EntityDetailsResponseAccountComponentDetails to be compared + /// Boolean + public bool Equals(EntityDetailsResponseAccountComponentDetails input) + { + if (input == null) + { + return false; + } + return + ( + this.Discriminator == input.Discriminator || + this.Discriminator.Equals(input.Discriminator) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Discriminator.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetails.cs index 420ec9390..7a91e3d33 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetails.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetails.cs @@ -101,10 +101,10 @@ public partial class EntityDetailsResponseDetails : AbstractOpenAPISchema, IEqua { /// /// Initializes a new instance of the class - /// with the class + /// with the class /// - /// An instance of EntityDetailsResponseFungibleDetails. - public EntityDetailsResponseDetails(EntityDetailsResponseFungibleDetails actualInstance) + /// An instance of EntityDetailsResponseFungibleResourceDetails. + public EntityDetailsResponseDetails(EntityDetailsResponseFungibleResourceDetails actualInstance) { this.IsNullable = false; this.SchemaType= "oneOf"; @@ -113,10 +113,22 @@ public EntityDetailsResponseDetails(EntityDetailsResponseFungibleDetails actualI /// /// Initializes a new instance of the class - /// with the class + /// with the class /// - /// An instance of EntityDetailsResponseNonFungibleDetails. - public EntityDetailsResponseDetails(EntityDetailsResponseNonFungibleDetails actualInstance) + /// An instance of EntityDetailsResponseNonFungibleResourceDetails. + public EntityDetailsResponseDetails(EntityDetailsResponseNonFungibleResourceDetails actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of EntityDetailsResponseAccountComponentDetails. + public EntityDetailsResponseDetails(EntityDetailsResponseAccountComponentDetails actualInstance) { this.IsNullable = false; this.SchemaType= "oneOf"; @@ -137,39 +149,53 @@ public override Object ActualInstance } set { - if (value.GetType() == typeof(EntityDetailsResponseFungibleDetails)) + if (value.GetType() == typeof(EntityDetailsResponseAccountComponentDetails)) { this._actualInstance = value; } - else if (value.GetType() == typeof(EntityDetailsResponseNonFungibleDetails)) + else if (value.GetType() == typeof(EntityDetailsResponseFungibleResourceDetails)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(EntityDetailsResponseNonFungibleResourceDetails)) { this._actualInstance = value; } else { - throw new ArgumentException("Invalid instance found. Must be the following types: EntityDetailsResponseFungibleDetails, EntityDetailsResponseNonFungibleDetails"); + throw new ArgumentException("Invalid instance found. Must be the following types: EntityDetailsResponseAccountComponentDetails, EntityDetailsResponseFungibleResourceDetails, EntityDetailsResponseNonFungibleResourceDetails"); } } } /// - /// Get the actual instance of `EntityDetailsResponseFungibleDetails`. If the actual instance is not `EntityDetailsResponseFungibleDetails`, + /// Get the actual instance of `EntityDetailsResponseFungibleResourceDetails`. If the actual instance is not `EntityDetailsResponseFungibleResourceDetails`, + /// the InvalidClassException will be thrown + /// + /// An instance of EntityDetailsResponseFungibleResourceDetails + public EntityDetailsResponseFungibleResourceDetails GetEntityDetailsResponseFungibleResourceDetails() + { + return (EntityDetailsResponseFungibleResourceDetails)this.ActualInstance; + } + + /// + /// Get the actual instance of `EntityDetailsResponseNonFungibleResourceDetails`. If the actual instance is not `EntityDetailsResponseNonFungibleResourceDetails`, /// the InvalidClassException will be thrown /// - /// An instance of EntityDetailsResponseFungibleDetails - public EntityDetailsResponseFungibleDetails GetEntityDetailsResponseFungibleDetails() + /// An instance of EntityDetailsResponseNonFungibleResourceDetails + public EntityDetailsResponseNonFungibleResourceDetails GetEntityDetailsResponseNonFungibleResourceDetails() { - return (EntityDetailsResponseFungibleDetails)this.ActualInstance; + return (EntityDetailsResponseNonFungibleResourceDetails)this.ActualInstance; } /// - /// Get the actual instance of `EntityDetailsResponseNonFungibleDetails`. If the actual instance is not `EntityDetailsResponseNonFungibleDetails`, + /// Get the actual instance of `EntityDetailsResponseAccountComponentDetails`. If the actual instance is not `EntityDetailsResponseAccountComponentDetails`, /// the InvalidClassException will be thrown /// - /// An instance of EntityDetailsResponseNonFungibleDetails - public EntityDetailsResponseNonFungibleDetails GetEntityDetailsResponseNonFungibleDetails() + /// An instance of EntityDetailsResponseAccountComponentDetails + public EntityDetailsResponseAccountComponentDetails GetEntityDetailsResponseAccountComponentDetails() { - return (EntityDetailsResponseNonFungibleDetails)this.ActualInstance; + return (EntityDetailsResponseAccountComponentDetails)this.ActualInstance; } /// @@ -210,24 +236,30 @@ public static EntityDetailsResponseDetails FromJson(string jsonString) try { - var discriminatorObj = JObject.Parse(jsonString)["resource_type"]; + var discriminatorObj = JObject.Parse(jsonString)["discriminator"]; string discriminatorValue = discriminatorObj == null ?string.Empty :discriminatorObj.ToString(); switch (discriminatorValue) { - case "EntityDetailsResponseFungibleDetails": - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + case "EntityDetailsResponseAccountComponentDetails": + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); return newEntityDetailsResponseDetails; - case "EntityDetailsResponseNonFungibleDetails": - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + case "EntityDetailsResponseFungibleResourceDetails": + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); return newEntityDetailsResponseDetails; - case "fungible": - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + case "EntityDetailsResponseNonFungibleResourceDetails": + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); return newEntityDetailsResponseDetails; - case "non_fungible": - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + case "account_component": + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + return newEntityDetailsResponseDetails; + case "fungible_resource": + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + return newEntityDetailsResponseDetails; + case "non_fungible_resource": + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); return newEntityDetailsResponseDetails; default: - System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for EntityDetailsResponseDetails. Possible values: EntityDetailsResponseFungibleDetails EntityDetailsResponseNonFungibleDetails fungible non_fungible", discriminatorValue)); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to lookup discriminator value `{0}` for EntityDetailsResponseDetails. Possible values: EntityDetailsResponseAccountComponentDetails EntityDetailsResponseFungibleResourceDetails EntityDetailsResponseNonFungibleResourceDetails account_component fungible_resource non_fungible_resource", discriminatorValue)); break; } } @@ -242,41 +274,61 @@ public static EntityDetailsResponseDetails FromJson(string jsonString) try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(EntityDetailsResponseFungibleDetails).GetProperty("AdditionalProperties") == null) + if (typeof(EntityDetailsResponseAccountComponentDetails).GetProperty("AdditionalProperties") == null) + { + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.SerializerSettings)); + } + else + { + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("EntityDetailsResponseAccountComponentDetails"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into EntityDetailsResponseAccountComponentDetails: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(EntityDetailsResponseFungibleResourceDetails).GetProperty("AdditionalProperties") == null) { - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.SerializerSettings)); + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.SerializerSettings)); } else { - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("EntityDetailsResponseFungibleDetails"); + matchedTypes.Add("EntityDetailsResponseFungibleResourceDetails"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into EntityDetailsResponseFungibleDetails: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into EntityDetailsResponseFungibleResourceDetails: {1}", jsonString, exception.ToString())); } try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(EntityDetailsResponseNonFungibleDetails).GetProperty("AdditionalProperties") == null) + if (typeof(EntityDetailsResponseNonFungibleResourceDetails).GetProperty("AdditionalProperties") == null) { - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.SerializerSettings)); + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.SerializerSettings)); } else { - newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); + newEntityDetailsResponseDetails = new EntityDetailsResponseDetails(JsonConvert.DeserializeObject(jsonString, EntityDetailsResponseDetails.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("EntityDetailsResponseNonFungibleDetails"); + matchedTypes.Add("EntityDetailsResponseNonFungibleResourceDetails"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into EntityDetailsResponseNonFungibleDetails: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into EntityDetailsResponseNonFungibleResourceDetails: {1}", jsonString, exception.ToString())); } if (match == 0) diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResourceTypeMapping.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetailsType.cs similarity index 89% rename from src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResourceTypeMapping.cs rename to src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetailsType.cs index 3fca7fb9e..fa52750cf 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/ResourceTypeMapping.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseDetailsType.cs @@ -91,22 +91,28 @@ namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model { /// - /// Defines ResourceTypeMapping + /// Defines EntityDetailsResponseDetailsType /// [JsonConverter(typeof(StringEnumConverter))] - public enum ResourceTypeMapping + public enum EntityDetailsResponseDetailsType { /// - /// Enum Fungible for value: fungible + /// Enum FungibleResource for value: fungible_resource /// - [EnumMember(Value = "fungible")] - Fungible = 1, + [EnumMember(Value = "fungible_resource")] + FungibleResource = 1, /// - /// Enum NonFungible for value: non_fungible + /// Enum NonFungibleResource for value: non_fungible_resource /// - [EnumMember(Value = "non_fungible")] - NonFungible = 2 + [EnumMember(Value = "non_fungible_resource")] + NonFungibleResource = 2, + + /// + /// Enum AccountComponent for value: account_component + /// + [EnumMember(Value = "account_component")] + AccountComponent = 3 } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseFungibleDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseFungibleResourceDetails.cs similarity index 85% rename from src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseFungibleDetails.cs rename to src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseFungibleResourceDetails.cs index 6496926fb..0b82873d7 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseFungibleDetails.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseFungibleResourceDetails.cs @@ -91,48 +91,48 @@ namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model { /// - /// EntityDetailsResponseFungibleDetails + /// EntityDetailsResponseFungibleResourceDetails /// - [DataContract(Name = "EntityDetailsResponseFungibleDetails")] - public partial class EntityDetailsResponseFungibleDetails : IEquatable, IValidatableObject + [DataContract(Name = "EntityDetailsResponseFungibleResourceDetails")] + public partial class EntityDetailsResponseFungibleResourceDetails : IEquatable, IValidatableObject { /// - /// Gets or Sets ResourceType + /// Gets or Sets Discriminator /// - [DataMember(Name = "resource_type", IsRequired = true, EmitDefaultValue = true)] - public ResourceTypeMapping ResourceType { get; set; } + [DataMember(Name = "discriminator", IsRequired = true, EmitDefaultValue = true)] + public EntityDetailsResponseDetailsType Discriminator { get; set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EntityDetailsResponseFungibleDetails() { } + protected EntityDetailsResponseFungibleResourceDetails() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// resourceType (required). + /// discriminator (required). /// A decimal-string-encoded integer between 0 and 2^255-1, which represents the total number of 10^(-18) subunits in the total supply of this resource. (required). /// A decimal-string-encoded integer between 0 and 2^255-1, which represents the total number of 10^(-18) subunits in the total supply of this resource. (required). /// A decimal-string-encoded integer between 0 and 2^255-1, which represents the total number of 10^(-18) subunits in the total supply of this resource. (required). - public EntityDetailsResponseFungibleDetails(ResourceTypeMapping resourceType = default(ResourceTypeMapping), string totalSupplyAttos = default(string), string totalMintedAttos = default(string), string totalBurntAttos = default(string)) + public EntityDetailsResponseFungibleResourceDetails(EntityDetailsResponseDetailsType discriminator = default(EntityDetailsResponseDetailsType), string totalSupplyAttos = default(string), string totalMintedAttos = default(string), string totalBurntAttos = default(string)) { - this.ResourceType = resourceType; + this.Discriminator = discriminator; // to ensure "totalSupplyAttos" is required (not null) if (totalSupplyAttos == null) { - throw new ArgumentNullException("totalSupplyAttos is a required property for EntityDetailsResponseFungibleDetails and cannot be null"); + throw new ArgumentNullException("totalSupplyAttos is a required property for EntityDetailsResponseFungibleResourceDetails and cannot be null"); } this.TotalSupplyAttos = totalSupplyAttos; // to ensure "totalMintedAttos" is required (not null) if (totalMintedAttos == null) { - throw new ArgumentNullException("totalMintedAttos is a required property for EntityDetailsResponseFungibleDetails and cannot be null"); + throw new ArgumentNullException("totalMintedAttos is a required property for EntityDetailsResponseFungibleResourceDetails and cannot be null"); } this.TotalMintedAttos = totalMintedAttos; // to ensure "totalBurntAttos" is required (not null) if (totalBurntAttos == null) { - throw new ArgumentNullException("totalBurntAttos is a required property for EntityDetailsResponseFungibleDetails and cannot be null"); + throw new ArgumentNullException("totalBurntAttos is a required property for EntityDetailsResponseFungibleResourceDetails and cannot be null"); } this.TotalBurntAttos = totalBurntAttos; } @@ -165,8 +165,8 @@ protected EntityDetailsResponseFungibleDetails() { } public override string ToString() { StringBuilder sb = new StringBuilder(); - sb.Append("class EntityDetailsResponseFungibleDetails {\n"); - sb.Append(" ResourceType: ").Append(ResourceType).Append("\n"); + sb.Append("class EntityDetailsResponseFungibleResourceDetails {\n"); + sb.Append(" Discriminator: ").Append(Discriminator).Append("\n"); sb.Append(" TotalSupplyAttos: ").Append(TotalSupplyAttos).Append("\n"); sb.Append(" TotalMintedAttos: ").Append(TotalMintedAttos).Append("\n"); sb.Append(" TotalBurntAttos: ").Append(TotalBurntAttos).Append("\n"); @@ -190,15 +190,15 @@ public virtual string ToJson() /// Boolean public override bool Equals(object input) { - return this.Equals(input as EntityDetailsResponseFungibleDetails); + return this.Equals(input as EntityDetailsResponseFungibleResourceDetails); } /// - /// Returns true if EntityDetailsResponseFungibleDetails instances are equal + /// Returns true if EntityDetailsResponseFungibleResourceDetails instances are equal /// - /// Instance of EntityDetailsResponseFungibleDetails to be compared + /// Instance of EntityDetailsResponseFungibleResourceDetails to be compared /// Boolean - public bool Equals(EntityDetailsResponseFungibleDetails input) + public bool Equals(EntityDetailsResponseFungibleResourceDetails input) { if (input == null) { @@ -206,8 +206,8 @@ public bool Equals(EntityDetailsResponseFungibleDetails input) } return ( - this.ResourceType == input.ResourceType || - this.ResourceType.Equals(input.ResourceType) + this.Discriminator == input.Discriminator || + this.Discriminator.Equals(input.Discriminator) ) && ( this.TotalSupplyAttos == input.TotalSupplyAttos || @@ -235,7 +235,7 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + this.ResourceType.GetHashCode(); + hashCode = (hashCode * 59) + this.Discriminator.GetHashCode(); if (this.TotalSupplyAttos != null) { hashCode = (hashCode * 59) + this.TotalSupplyAttos.GetHashCode(); diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetails.cs new file mode 100644 index 000000000..c8112f905 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetails.cs @@ -0,0 +1,217 @@ +/* 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 Babylon Gateway API + * + * See https://docs.radixdlt.com/main/apis/introduction.html + * + * The version of the OpenAPI document: 2.0.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 System.ComponentModel.DataAnnotations; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// EntityDetailsResponseNonFungibleResourceDetails + /// + [DataContract(Name = "EntityDetailsResponseNonFungibleResourceDetails")] + public partial class EntityDetailsResponseNonFungibleResourceDetails : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Discriminator + /// + [DataMember(Name = "discriminator", IsRequired = true, EmitDefaultValue = true)] + public EntityDetailsResponseDetailsType Discriminator { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EntityDetailsResponseNonFungibleResourceDetails() { } + /// + /// Initializes a new instance of the class. + /// + /// discriminator (required). + /// ids (required). + public EntityDetailsResponseNonFungibleResourceDetails(EntityDetailsResponseDetailsType discriminator = default(EntityDetailsResponseDetailsType), EntityDetailsResponseNonFungibleResourceDetailsIds ids = default(EntityDetailsResponseNonFungibleResourceDetailsIds)) + { + this.Discriminator = discriminator; + // to ensure "ids" is required (not null) + if (ids == null) + { + throw new ArgumentNullException("ids is a required property for EntityDetailsResponseNonFungibleResourceDetails and cannot be null"); + } + this.Ids = ids; + } + + /// + /// Gets or Sets Ids + /// + [DataMember(Name = "ids", IsRequired = true, EmitDefaultValue = true)] + public EntityDetailsResponseNonFungibleResourceDetailsIds Ids { 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 EntityDetailsResponseNonFungibleResourceDetails {\n"); + sb.Append(" Discriminator: ").Append(Discriminator).Append("\n"); + sb.Append(" Ids: ").Append(Ids).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 EntityDetailsResponseNonFungibleResourceDetails); + } + + /// + /// Returns true if EntityDetailsResponseNonFungibleResourceDetails instances are equal + /// + /// Instance of EntityDetailsResponseNonFungibleResourceDetails to be compared + /// Boolean + public bool Equals(EntityDetailsResponseNonFungibleResourceDetails input) + { + if (input == null) + { + return false; + } + return + ( + this.Discriminator == input.Discriminator || + this.Discriminator.Equals(input.Discriminator) + ) && + ( + this.Ids == input.Ids || + (this.Ids != null && + this.Ids.Equals(input.Ids)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Discriminator.GetHashCode(); + if (this.Ids != null) + { + hashCode = (hashCode * 59) + this.Ids.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIds.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIds.cs new file mode 100644 index 000000000..7fdff681d --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIds.cs @@ -0,0 +1,257 @@ +/* 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 Babylon Gateway API + * + * See https://docs.radixdlt.com/main/apis/introduction.html + * + * The version of the OpenAPI document: 2.0.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 System.ComponentModel.DataAnnotations; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// EntityDetailsResponseNonFungibleResourceDetailsIds + /// + [DataContract(Name = "EntityDetailsResponseNonFungibleResourceDetailsIds")] + public partial class EntityDetailsResponseNonFungibleResourceDetailsIds : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EntityDetailsResponseNonFungibleResourceDetailsIds() { } + /// + /// Initializes a new instance of the class. + /// + /// TBD (make it nullable when we're dealing with unknown result set sizes?) (required). + /// TBD (maybe we should use HATEOAS-like permalinks?). + /// TBD (maybe we should use HATEOAS-like permalinks?). + /// items (required). + public EntityDetailsResponseNonFungibleResourceDetailsIds(int totalCount = default(int), string previousCursor = default(string), string nextCursor = default(string), List items = default(List)) + { + this.TotalCount = totalCount; + // to ensure "items" is required (not null) + if (items == null) + { + throw new ArgumentNullException("items is a required property for EntityDetailsResponseNonFungibleResourceDetailsIds and cannot be null"); + } + this.Items = items; + this.PreviousCursor = previousCursor; + this.NextCursor = nextCursor; + } + + /// + /// TBD (make it nullable when we're dealing with unknown result set sizes?) + /// + /// TBD (make it nullable when we're dealing with unknown result set sizes?) + [DataMember(Name = "total_count", IsRequired = true, EmitDefaultValue = true)] + public int TotalCount { get; set; } + + /// + /// TBD (maybe we should use HATEOAS-like permalinks?) + /// + /// TBD (maybe we should use HATEOAS-like permalinks?) + [DataMember(Name = "previous_cursor", EmitDefaultValue = true)] + public string PreviousCursor { get; set; } + + /// + /// TBD (maybe we should use HATEOAS-like permalinks?) + /// + /// TBD (maybe we should use HATEOAS-like permalinks?) + [DataMember(Name = "next_cursor", EmitDefaultValue = true)] + public string NextCursor { get; set; } + + /// + /// Gets or Sets Items + /// + [DataMember(Name = "items", IsRequired = true, EmitDefaultValue = true)] + public List Items { 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 EntityDetailsResponseNonFungibleResourceDetailsIds {\n"); + sb.Append(" TotalCount: ").Append(TotalCount).Append("\n"); + sb.Append(" PreviousCursor: ").Append(PreviousCursor).Append("\n"); + sb.Append(" NextCursor: ").Append(NextCursor).Append("\n"); + sb.Append(" Items: ").Append(Items).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 EntityDetailsResponseNonFungibleResourceDetailsIds); + } + + /// + /// Returns true if EntityDetailsResponseNonFungibleResourceDetailsIds instances are equal + /// + /// Instance of EntityDetailsResponseNonFungibleResourceDetailsIds to be compared + /// Boolean + public bool Equals(EntityDetailsResponseNonFungibleResourceDetailsIds input) + { + if (input == null) + { + return false; + } + return + ( + this.TotalCount == input.TotalCount || + this.TotalCount.Equals(input.TotalCount) + ) && + ( + this.PreviousCursor == input.PreviousCursor || + (this.PreviousCursor != null && + this.PreviousCursor.Equals(input.PreviousCursor)) + ) && + ( + this.NextCursor == input.NextCursor || + (this.NextCursor != null && + this.NextCursor.Equals(input.NextCursor)) + ) && + ( + this.Items == input.Items || + this.Items != null && + input.Items != null && + this.Items.SequenceEqual(input.Items) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TotalCount.GetHashCode(); + if (this.PreviousCursor != null) + { + hashCode = (hashCode * 59) + this.PreviousCursor.GetHashCode(); + } + if (this.NextCursor != null) + { + hashCode = (hashCode * 59) + this.NextCursor.GetHashCode(); + } + if (this.Items != null) + { + hashCode = (hashCode * 59) + this.Items.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleDetails.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf.cs similarity index 76% rename from src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleDetails.cs rename to src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf.cs index cffaecb5e..fcb5d4185 100644 --- a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleDetails.cs +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf.cs @@ -91,43 +91,35 @@ namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model { /// - /// EntityDetailsResponseNonFungibleDetails + /// EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf /// - [DataContract(Name = "EntityDetailsResponseNonFungibleDetails")] - public partial class EntityDetailsResponseNonFungibleDetails : IEquatable, IValidatableObject + [DataContract(Name = "EntityDetailsResponseNonFungibleResourceDetailsIds_allOf")] + public partial class EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf : IEquatable, IValidatableObject { - - /// - /// Gets or Sets ResourceType - /// - [DataMember(Name = "resource_type", IsRequired = true, EmitDefaultValue = true)] - public ResourceTypeMapping ResourceType { get; set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EntityDetailsResponseNonFungibleDetails() { } + protected EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// resourceType (required). - /// tbd (required). - public EntityDetailsResponseNonFungibleDetails(ResourceTypeMapping resourceType = default(ResourceTypeMapping), string tbd = default(string)) + /// items (required). + public EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf(List items = default(List)) { - this.ResourceType = resourceType; - // to ensure "tbd" is required (not null) - if (tbd == null) + // to ensure "items" is required (not null) + if (items == null) { - throw new ArgumentNullException("tbd is a required property for EntityDetailsResponseNonFungibleDetails and cannot be null"); + throw new ArgumentNullException("items is a required property for EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf and cannot be null"); } - this.Tbd = tbd; + this.Items = items; } /// - /// Gets or Sets Tbd + /// Gets or Sets Items /// - [DataMember(Name = "tbd", IsRequired = true, EmitDefaultValue = true)] - public string Tbd { get; set; } + [DataMember(Name = "items", IsRequired = true, EmitDefaultValue = true)] + public List Items { get; set; } /// /// Returns the string presentation of the object @@ -136,9 +128,8 @@ protected EntityDetailsResponseNonFungibleDetails() { } public override string ToString() { StringBuilder sb = new StringBuilder(); - sb.Append("class EntityDetailsResponseNonFungibleDetails {\n"); - sb.Append(" ResourceType: ").Append(ResourceType).Append("\n"); - sb.Append(" Tbd: ").Append(Tbd).Append("\n"); + sb.Append("class EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf {\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -159,15 +150,15 @@ public virtual string ToJson() /// Boolean public override bool Equals(object input) { - return this.Equals(input as EntityDetailsResponseNonFungibleDetails); + return this.Equals(input as EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf); } /// - /// Returns true if EntityDetailsResponseNonFungibleDetails instances are equal + /// Returns true if EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf instances are equal /// - /// Instance of EntityDetailsResponseNonFungibleDetails to be compared + /// Instance of EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf to be compared /// Boolean - public bool Equals(EntityDetailsResponseNonFungibleDetails input) + public bool Equals(EntityDetailsResponseNonFungibleResourceDetailsIdsAllOf input) { if (input == null) { @@ -175,13 +166,10 @@ public bool Equals(EntityDetailsResponseNonFungibleDetails input) } return ( - this.ResourceType == input.ResourceType || - this.ResourceType.Equals(input.ResourceType) - ) && - ( - this.Tbd == input.Tbd || - (this.Tbd != null && - this.Tbd.Equals(input.Tbd)) + this.Items == input.Items || + this.Items != null && + input.Items != null && + this.Items.SequenceEqual(input.Items) ); } @@ -194,10 +182,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + this.ResourceType.GetHashCode(); - if (this.Tbd != null) + if (this.Items != null) { - hashCode = (hashCode * 59) + this.Tbd.GetHashCode(); + hashCode = (hashCode * 59) + this.Items.GetHashCode(); } return hashCode; } diff --git a/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIdsItem.cs b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIdsItem.cs new file mode 100644 index 000000000..d01dad219 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.GatewayApiSdk/generated/Model/EntityDetailsResponseNonFungibleResourceDetailsIdsItem.cs @@ -0,0 +1,229 @@ +/* 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 Babylon Gateway API + * + * See https://docs.radixdlt.com/main/apis/introduction.html + * + * The version of the OpenAPI document: 2.0.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 System.ComponentModel.DataAnnotations; +using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter; +using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter; + +namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model +{ + /// + /// EntityDetailsResponseNonFungibleResourceDetailsIdsItem + /// + [DataContract(Name = "EntityDetailsResponseNonFungibleResourceDetailsIdsItem")] + public partial class EntityDetailsResponseNonFungibleResourceDetailsIdsItem : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// idHex. + /// immutableDataHex. + /// mutableDataHex. + public EntityDetailsResponseNonFungibleResourceDetailsIdsItem(string idHex = default(string), string immutableDataHex = default(string), string mutableDataHex = default(string)) + { + this.IdHex = idHex; + this.ImmutableDataHex = immutableDataHex; + this.MutableDataHex = mutableDataHex; + } + + /// + /// Gets or Sets IdHex + /// + [DataMember(Name = "id_hex", EmitDefaultValue = true)] + public string IdHex { get; set; } + + /// + /// Gets or Sets ImmutableDataHex + /// + [DataMember(Name = "immutable_data_hex", EmitDefaultValue = true)] + public string ImmutableDataHex { get; set; } + + /// + /// Gets or Sets MutableDataHex + /// + [DataMember(Name = "mutable_data_hex", EmitDefaultValue = true)] + public string MutableDataHex { 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 EntityDetailsResponseNonFungibleResourceDetailsIdsItem {\n"); + sb.Append(" IdHex: ").Append(IdHex).Append("\n"); + sb.Append(" ImmutableDataHex: ").Append(ImmutableDataHex).Append("\n"); + sb.Append(" MutableDataHex: ").Append(MutableDataHex).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 EntityDetailsResponseNonFungibleResourceDetailsIdsItem); + } + + /// + /// Returns true if EntityDetailsResponseNonFungibleResourceDetailsIdsItem instances are equal + /// + /// Instance of EntityDetailsResponseNonFungibleResourceDetailsIdsItem to be compared + /// Boolean + public bool Equals(EntityDetailsResponseNonFungibleResourceDetailsIdsItem input) + { + if (input == null) + { + return false; + } + return + ( + this.IdHex == input.IdHex || + (this.IdHex != null && + this.IdHex.Equals(input.IdHex)) + ) && + ( + this.ImmutableDataHex == input.ImmutableDataHex || + (this.ImmutableDataHex != null && + this.ImmutableDataHex.Equals(input.ImmutableDataHex)) + ) && + ( + this.MutableDataHex == input.MutableDataHex || + (this.MutableDataHex != null && + this.MutableDataHex.Equals(input.MutableDataHex)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IdHex != null) + { + hashCode = (hashCode * 59) + this.IdHex.GetHashCode(); + } + if (this.ImmutableDataHex != null) + { + hashCode = (hashCode * 59) + this.ImmutableDataHex.GetHashCode(); + } + if (this.MutableDataHex != null) + { + hashCode = (hashCode * 59) + this.MutableDataHex.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs index 130a3fb23..e36c8c269 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs @@ -113,9 +113,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) HookupPendingTransactions(modelBuilder); modelBuilder.Entity() - .HasDiscriminator("type") + .HasDiscriminator("discriminator") .HasValue("system") - .HasValue("resource_manager") + .HasValue("fungible_resource_manager") + .HasValue("non_fungible_resource_manager") .HasValue("normal_component") .HasValue("account_component") .HasValue("system_component") @@ -145,7 +146,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasIndex(e => new { EntityId = e.EntityId, e.FromStateVersion }); modelBuilder.Entity() - .HasDiscriminator("type") + .HasDiscriminator("discriminator") .HasValue("fungible") .HasValue("non_fungible"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221026123332_InitialCreate.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221028091719_InitialCreate.Designer.cs similarity index 98% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221026123332_InitialCreate.Designer.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221028091719_InitialCreate.Designer.cs index 577733b2e..d9aefc79d 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221026123332_InitialCreate.Designer.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221028091719_InitialCreate.Designer.cs @@ -77,7 +77,7 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations { [DbContext(typeof(MigrationsDbContext))] - [Migration("20221026123332_InitialCreate")] + [Migration("20221028091719_InitialCreate")] partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -127,7 +127,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("parent_ancestor_id"); - b.Property("type") + b.Property("discriminator") .IsRequired() .HasColumnType("text"); @@ -144,7 +144,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("entities"); - b.HasDiscriminator("type").HasValue("Entity"); + b.HasDiscriminator("discriminator").HasValue("Entity"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => @@ -247,7 +247,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("resource_entity_id"); - b.Property("type") + b.Property("discriminator") .IsRequired() .HasColumnType("text"); @@ -259,7 +259,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("entity_resource_history"); - b.HasDiscriminator("type").HasValue("EntityResourceHistory"); + b.HasDiscriminator("discriminator").HasValue("EntityResourceHistory"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FungibleResourceSupplyHistory", b => @@ -621,13 +621,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue("non_fungible"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FungibleResourceManagerEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("global"); + b.HasDiscriminator().HasValue("fungible_resource_manager"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntity", b => @@ -639,40 +639,40 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue("key_value_store"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleStoreEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleResourceManagerEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("non_fungible_store"); + b.HasDiscriminator().HasValue("non_fungible_resource_manager"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NormalComponentEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleStoreEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("normal_component"); + b.HasDiscriminator().HasValue("non_fungible_store"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NormalComponentEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("package"); + b.HasDiscriminator().HasValue("normal_component"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceManagerEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("resource_manager"); + b.HasDiscriminator().HasValue("package"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SystemComponentEntity", b => diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221026123332_InitialCreate.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221028091719_InitialCreate.cs similarity index 99% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221026123332_InitialCreate.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221028091719_InitialCreate.cs index 9db5da3f3..65b939efc 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221026123332_InitialCreate.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20221028091719_InitialCreate.cs @@ -88,7 +88,7 @@ protected override void Up(MigrationBuilder migrationBuilder) parent_ancestor_id = table.Column(type: "bigint", nullable: true), owner_ancestor_id = table.Column(type: "bigint", nullable: true), global_ancestor_id = table.Column(type: "bigint", nullable: true), - type = table.Column(type: "text", nullable: false) + discriminator = table.Column(type: "text", nullable: false) }, constraints: table => { @@ -138,7 +138,7 @@ protected override void Up(MigrationBuilder migrationBuilder) owner_entity_id = table.Column(type: "bigint", nullable: false), global_entity_id = table.Column(type: "bigint", nullable: false), resource_entity_id = table.Column(type: "bigint", nullable: false), - type = table.Column(type: "text", nullable: false), + discriminator = table.Column(type: "text", nullable: false), balance = table.Column(type: "numeric(1000,0)", precision: 1000, scale: 0, nullable: true), ids_count = table.Column(type: "bigint", nullable: true), ids = table.Column(type: "bytea[]", nullable: true) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index 08923e6ce..cde0a33e4 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -125,7 +125,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("parent_ancestor_id"); - b.Property("type") + b.Property("discriminator") .IsRequired() .HasColumnType("text"); @@ -142,7 +142,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("entities"); - b.HasDiscriminator("type").HasValue("Entity"); + b.HasDiscriminator("discriminator").HasValue("Entity"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => @@ -245,7 +245,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasColumnName("resource_entity_id"); - b.Property("type") + b.Property("discriminator") .IsRequired() .HasColumnType("text"); @@ -257,7 +257,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("entity_resource_history"); - b.HasDiscriminator("type").HasValue("EntityResourceHistory"); + b.HasDiscriminator("discriminator").HasValue("EntityResourceHistory"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FungibleResourceSupplyHistory", b => @@ -619,13 +619,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue("non_fungible"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FungibleResourceManagerEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("global"); + b.HasDiscriminator().HasValue("fungible_resource_manager"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntity", b => @@ -637,40 +637,40 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue("key_value_store"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleStoreEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleResourceManagerEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("non_fungible_store"); + b.HasDiscriminator().HasValue("non_fungible_resource_manager"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NormalComponentEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleStoreEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("normal_component"); + b.HasDiscriminator().HasValue("non_fungible_store"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NormalComponentEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("package"); + b.HasDiscriminator().HasValue("normal_component"); }); - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceManagerEntity", b => + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageEntity", b => { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); b.ToTable("entities"); - b.HasDiscriminator().HasValue("resource_manager"); + b.HasDiscriminator().HasValue("package"); }); modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SystemComponentEntity", b => diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs index 9b543db03..e83cc65a8 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs @@ -123,7 +123,15 @@ internal class SystemEntity : Entity { } -internal class ResourceManagerEntity : Entity +internal abstract class ResourceManagerEntity : Entity +{ +} + +internal class FungibleResourceManagerEntity : ResourceManagerEntity +{ +} + +internal class NonFungibleResourceManagerEntity : ResourceManagerEntity { } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/Dumpyard.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/Dumpyard.cs index 08e6744cd..99e8d4b71 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/Dumpyard.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/Dumpyard.cs @@ -63,8 +63,6 @@ */ using RadixDlt.CoreApiSdk.Model; -using RadixDlt.NetworkGateway.Abstractions; -using RadixDlt.NetworkGateway.Abstractions.Extensions; using RadixDlt.NetworkGateway.Abstractions.Numerics; using RadixDlt.NetworkGateway.PostgresIntegration.Models; using System; @@ -101,6 +99,8 @@ internal record ReferencedEntity(string Address, EntityType Type, long StateVers public string? GlobalHrpAddress { get; private set; } + public Type? TypeHint { get; private set; } + public long DatabaseId => GetDatabaseEntity().Id; public long DatabaseOwnerAncestorId => GetDatabaseEntity().OwnerAncestorId ?? throw new Exception("impossible bla bla bla"); @@ -143,6 +143,36 @@ public void IsChildOf(ReferencedEntity parent) _parent = parent; } + public void WithTypeHint(Type type) + { + if (TypeHint != null && TypeHint != type) + { + throw new ArgumentException("Already annotated with different type hint", nameof(type)); + } + + TypeHint = type; + } + + public TEntity CreateUsingTypeHint() + { + if (TypeHint == null) + { + throw new InvalidOperationException("No TypeHint specified"); + } + + if (!TypeHint.IsAssignableTo(typeof(TEntity))) + { + throw new InvalidOperationException("Conflicting hint type"); + } + + if (Activator.CreateInstance(TypeHint) is not TEntity instance) + { + throw new Exception("Unable to create instance"); + } + + return instance; + } + private Entity GetDatabaseEntity() { var de = _databaseEntity ?? throw new Exception("bla bla"); // TODO fix me diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs index 09b636bac..0a7b8bef3 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/EntityStateQuerier.cs @@ -178,38 +178,54 @@ LIMIT 1 EntityDetailsResponseDetails details; - if (entity is ResourceManagerEntity rme) + switch (entity) { - // TODO how to detect between fungible and non-fun? Kind property or something? - // TODO current solution based on supplyHistory == null is just a dirty hack! - - var supplyHistory = await _dbContext.FungibleResourceSupplyHistory - .Where(e => e.FromStateVersion <= ledgerState._Version && e.ResourceEntityId == rme.Id) - .OrderByDescending(e => e.FromStateVersion) - .FirstOrDefaultAsync(token); - - if (supplyHistory == null) + case FungibleResourceManagerEntity frme: { - details = new EntityDetailsResponseDetails(new EntityDetailsResponseNonFungibleDetails( - resourceType: ResourceTypeMapping.NonFungible, - tbd: "unknown")); + var supplyHistory = await _dbContext.FungibleResourceSupplyHistory + .Where(e => e.FromStateVersion <= ledgerState._Version && e.ResourceEntityId == frme.Id) + .OrderByDescending(e => e.FromStateVersion) + .FirstOrDefaultAsync(token); + + // TODO handle null better + + if (supplyHistory == null) + { + details = new EntityDetailsResponseDetails(new EntityDetailsResponseFungibleResourceDetails( + discriminator: EntityDetailsResponseDetailsType.FungibleResource, + totalSupplyAttos: "-1", + totalMintedAttos: "-1", + totalBurntAttos: "-1")); + } + else + { + details = new EntityDetailsResponseDetails(new EntityDetailsResponseFungibleResourceDetails( + discriminator: EntityDetailsResponseDetailsType.FungibleResource, + totalSupplyAttos: supplyHistory.TotalSupply.ToString(), + totalMintedAttos: supplyHistory.TotalMinted.ToString(), + totalBurntAttos: supplyHistory.TotalBurnt.ToString())); + } + + break; } - else - { - details = new EntityDetailsResponseDetails(new EntityDetailsResponseFungibleDetails( - resourceType: ResourceTypeMapping.Fungible, - totalSupplyAttos: supplyHistory.TotalSupply.ToString(), - totalMintedAttos: supplyHistory.TotalMinted.ToString(), - totalBurntAttos: supplyHistory.TotalBurnt.ToString())); - } - } - else if (entity is AccountComponentEntity) - { - return null; // TODO handle somehow - } - else - { - return null; + + case NonFungibleResourceManagerEntity nfrme: + // TODO add support for detailed ids + + details = new EntityDetailsResponseDetails(new EntityDetailsResponseNonFungibleResourceDetails( + discriminator: EntityDetailsResponseDetailsType.NonFungibleResource, + ids: new EntityDetailsResponseNonFungibleResourceDetailsIds( + totalCount: -1, + previousCursor: null, + nextCursor: "TBD (not implemented yet; currently everything is returned)", + items: new List()))); + break; + case AccountComponentEntity: + details = new EntityDetailsResponseDetails(new EntityDetailsResponseAccountComponentDetails( + discriminator: EntityDetailsResponseDetailsType.AccountComponent)); + break; + default: + return null; } var rawMetadata = new Dictionary(); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerExtenderService.cs index 12b99bc5f..ef4b20fce 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/LedgerExtenderService.cs @@ -350,6 +350,18 @@ private async Task ProcessTransactions(ReadWriteDbCon } } + if (data is ResourceManagerSubstate resourceManager) + { + Type typeHint = resourceManager.ResourceType switch + { + ResourceType.Fungible => typeof(FungibleResourceManagerEntity), + ResourceType.NonFungible => typeof(NonFungibleResourceManagerEntity), + _ => throw new ArgumentOutOfRangeException(), + }; + + re.WithTypeHint(typeHint); + } + uppedSubstates.Add(us); } @@ -425,7 +437,7 @@ FROM entities Entity dbEntity = e.Type switch { EntityType.System => new SystemEntity(), - EntityType.ResourceManager => new ResourceManagerEntity(), + EntityType.ResourceManager => e.CreateUsingTypeHint(), EntityType.Component => CreateComponentEntity(e, _networkConfigurationProvider.GetHrpDefinition()), EntityType.Package => new PackageEntity(), EntityType.Vault => new VaultEntity(), @@ -481,13 +493,14 @@ FROM entities sw = Stopwatch.StartNew(); - await using (var writer = await dbConn.BeginBinaryImportAsync("COPY entities (id, from_state_version, address, global_address, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, type) FROM STDIN (FORMAT BINARY)", token)) + await using (var writer = await dbConn.BeginBinaryImportAsync("COPY entities (id, from_state_version, address, global_address, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, discriminator) FROM STDIN (FORMAT BINARY)", token)) { // TODO ouh, we must somehow reuse information already held by EF var typeMapping = new Dictionary { [typeof(SystemEntity)] = "system", - [typeof(ResourceManagerEntity)] = "resource_manager", + [typeof(FungibleResourceManagerEntity)] = "fungible_resource_manager", + [typeof(NonFungibleResourceManagerEntity)] = "non_fungible_resource_manager", [typeof(NormalComponentEntity)] = "normal_component", [typeof(AccountComponentEntity)] = "account_component", [typeof(SystemComponentEntity)] = "system_component", @@ -549,15 +562,21 @@ FROM entities dbWriteDuration += sw.Elapsed; } + // TODO can't we actually merge this with step "scan for any referenced entities"? // step: scan all substates to figure out changes { void HandleResourceManagerSubstate(UppedSubstate us) { var data = us.Data.GetResourceManagerSubstate(); - var totalSupply = TokenAmount.FromSubUnitsString(data.TotalSupplyAttos); metadataChanges.Add(new MetadataChange(us.ReferencedEntity, data.Metadata.ToDictionary(kvp => kvp.Key, kvp => kvp.Value), us.StateVersion)); - fungibleResourceSupplyChanges.Add(new FungibleResourceSupply(us.ReferencedEntity, totalSupply, TokenAmount.Zero, TokenAmount.Zero, us.StateVersion)); // TODO support mint & burnt + + var totalSupply = TokenAmount.FromSubUnitsString(data.TotalSupplyAttos); + + if (data.ResourceType == ResourceType.Fungible) + { + fungibleResourceSupplyChanges.Add(new FungibleResourceSupply(us.ReferencedEntity, totalSupply, TokenAmount.Zero, TokenAmount.Zero, us.StateVersion)); // TODO support mint & burnt + } } void HandleComponentStateSubstate(UppedSubstate us) @@ -600,6 +619,11 @@ void HandleVaultSubstate(UppedSubstate us) throw new Exception("bla bla bla bla x9"); // TODO fix me } + void HandleNonFungibleSubstate(UppedSubstate us) + { + var data = us.Data.GetNonFungibleSubstate(); + } + void HandleKeyValueStoreEntrySubstate(UppedSubstate us) { // TODO handle referenced_entities properly (not sure if we can ensure references types have been seen) @@ -628,7 +652,7 @@ void HandleKeyValueStoreEntrySubstate(UppedSubstate us) HandleVaultSubstate(us); break; case SubstateType.NonFungible: - // TODO handle somehow + HandleNonFungibleSubstate(us); break; case SubstateType.KeyValueStoreEntry: HandleKeyValueStoreEntrySubstate(us); @@ -808,7 +832,7 @@ void HandleKeyValueStoreEntrySubstate(UppedSubstate us) await writer.CompleteAsync(token); } - await using (var writer = await dbConn.BeginBinaryImportAsync("COPY entity_resource_history (id, from_state_version, owner_entity_id, global_entity_id, resource_entity_id, type, balance, ids_count, ids) FROM STDIN (FORMAT BINARY)", token)) + await using (var writer = await dbConn.BeginBinaryImportAsync("COPY entity_resource_history (id, from_state_version, owner_entity_id, global_entity_id, resource_entity_id, discriminator, balance, ids_count, ids) FROM STDIN (FORMAT BINARY)", token)) { var type = "fungible";