Esempio n. 1
0
        internal static NetworkIdentifier DeserializeNetworkIdentifier(JsonElement element)
        {
            string blockchain = default;
            string network    = default;
            Optional <SubNetworkIdentifier> subNetworkIdentifier = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("blockchain"))
                {
                    blockchain = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("network"))
                {
                    network = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sub_network_identifier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    subNetworkIdentifier = SubNetworkIdentifier.DeserializeSubNetworkIdentifier(property.Value);
                    continue;
                }
            }
            return(new NetworkIdentifier(blockchain, network, subNetworkIdentifier.Value));
        }
 internal NetworkIdentifier(string blockchain, string network, SubNetworkIdentifier subNetworkIdentifier)
 {
     Blockchain           = blockchain;
     Network              = network;
     SubNetworkIdentifier = subNetworkIdentifier;
 }