コード例 #1
0
        internal static AccountIdentifier DeserializeAccountIdentifier(JsonElement element)
        {
            string address = default;
            Optional <SubAccountIdentifier> subAccount = default;
            Optional <object> metadata = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("address"))
                {
                    address = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sub_account"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    subAccount = SubAccountIdentifier.DeserializeSubAccountIdentifier(property.Value);
                    continue;
                }
                if (property.NameEquals("metadata"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    metadata = property.Value.GetObject();
                    continue;
                }
            }
            return(new AccountIdentifier(address, subAccount.Value, metadata.Value));
        }
コード例 #2
0
 internal AccountIdentifier(string address, SubAccountIdentifier subAccount, object metadata)
 {
     Address    = address;
     SubAccount = subAccount;
     Metadata   = metadata;
 }