diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..029125c8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,612 @@ +# editorconfig.org + +# top-most EditorConfig file +root = true + +# Default settings: +# A newline ending every file +# Use 4 spaces as indentation +[*] +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[project.json] +indent_size = 2 + +# C# files +[*.cs] +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + +# avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# only use var when it's obvious what the variable type is +csharp_style_var_for_built_in_types = false:none +csharp_style_var_when_type_is_apparent = false:none +csharp_style_var_elsewhere = false:suggestion + +# use language keywords instead of BCL types +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# name all constant fields using PascalCase +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# static fields should have s_ prefix +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_prefix_style.required_prefix = s_ +dotnet_naming_style.static_prefix_style.capitalization = camel_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style + +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal + +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +# Code style defaults +csharp_using_directive_placement = outside_namespace:suggestion +dotnet_sort_system_directives_first = true +csharp_prefer_braces = true:silent +csharp_preserve_single_line_blocks = true:none +csharp_preserve_single_line_statements = false:none +csharp_prefer_static_local_function = true:suggestion +csharp_prefer_simple_using_statement = false:none +csharp_style_prefer_switch_expression = true:suggestion + +# Code quality +dotnet_style_readonly_field = true:suggestion +dotnet_code_quality_unused_parameters = non_public:suggestion + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +csharp_prefer_simple_default_expression = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_constructors = true:silent +csharp_style_expression_bodied_operators = true:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = true:silent + +# Pattern matching +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# Null checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Other features +csharp_style_prefer_index_operator = false:none +csharp_style_prefer_range_operator = false:none +csharp_style_pattern_local_over_anonymous_function = false:none + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Analyzers +dotnet_code_quality.CA1802.api_surface = private, internal +dotnet_code_quality.CA2208.api_surface = public + +# Id Web Rules + +# RS0030: Do not used banned APIs +dotnet_diagnostic.RS0030.severity = error + +# https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/Microsoft.CodeAnalysis.PublicApiAnalyzers.md +dotnet_diagnostic.RS0051.severity = error +dotnet_diagnostic.RS0052.severity = error +dotnet_diagnostic.RS0053.severity = error +dotnet_diagnostic.RS0054.severity = error +dotnet_diagnostic.RS0055.severity = error +dotnet_diagnostic.RS0057.severity = error +dotnet_diagnostic.RS0058.severity = error +dotnet_diagnostic.RS0061.severity = error + +# CA1000: Do not declare static members on generic types +dotnet_diagnostic.CA1000.severity = error + +# CA1008: Enums should have zero value +dotnet_diagnostic.CA1008.severity = warning + +# CA1010: Collections should implement generic interface +dotnet_diagnostic.CA1010.severity = error + +# CA1012: Abstract types should not have constructors +dotnet_diagnostic.CA1012.severity = error + +# CA1016: Mark assemblies with assembly version +dotnet_diagnostic.CA1016.severity = none + +# CA1017: Mark assemblies with ComVisible +dotnet_diagnostic.CA1017.severity = error + +# CA1018: Mark attributes with AttributeUsageAttribute +dotnet_diagnostic.CA1018.severity = error + +# CA1027: Mark enums with FlagsAttribute +dotnet_diagnostic.CA1027.severity = error + +# CA1028: Enum Storage should be Int32 +dotnet_diagnostic.CA1028.severity = error + +# CA1030: Use events where appropriate +dotnet_diagnostic.CA1030.severity = error + +# CA1033: Interface methods should be callable by child types +dotnet_diagnostic.CA1033.severity = error + +# CA1034: Nested types should not be visible +dotnet_diagnostic.CA1034.severity = warning + +# CA1036: Override methods on comparable types +dotnet_diagnostic.CA1036.severity = error + +# CA1040: Avoid empty interfaces +dotnet_diagnostic.CA1040.severity = none + +# CA1041: Provide ObsoleteAttribute message +dotnet_diagnostic.CA1041.severity = error + +# CA1043: Use Integral Or String Argument For Indexers +dotnet_diagnostic.CA1043.severity = error + +# CA1044: Properties should not be write only +dotnet_diagnostic.CA1044.severity = none + +# CA1050: Declare types in namespaces +dotnet_diagnostic.CA1050.severity = warning + +# CA1051: Do not declare visible instance fields +dotnet_diagnostic.CA1051.severity = none + +# CA1052: Static holder types should be Static or NotInheritable +dotnet_diagnostic.CA1052.severity = none + +# CA1054: Uri parameters should not be strings +dotnet_diagnostic.CA1054.severity = none + +# CA1055: Uri return values should not be strings +dotnet_diagnostic.CA1055.severity = error + +# CA1056: Uri properties should not be strings +dotnet_diagnostic.CA1056.severity = none + +# CA1061: Do not hide base class methods +dotnet_diagnostic.CA1061.severity = error + +# CA1063: Implement IDisposable Correctly +dotnet_diagnostic.CA1063.severity = none + +# CA1064: Exceptions should be public +dotnet_diagnostic.CA1064.severity = none + +# CA1066: Type {0} should implement IEquatable because it overrides Equals +dotnet_diagnostic.CA1066.severity = none + +# CA1067: Override Object.Equals(object) when implementing IEquatable +dotnet_diagnostic.CA1067.severity = error + +# CA1068: CancellationToken parameters must come last +dotnet_diagnostic.CA1068.severity = error + +# CA1308: Normalize strings to uppercase +dotnet_diagnostic.CA1308.severity=warning + +# CA1505: Avoid unmaintainable code +dotnet_diagnostic.CA1505.severity = error + +# CA1707: Identifiers should not contain underscores +dotnet_diagnostic.CA1707.severity = none + +# CA1710: Identifiers should have correct suffix +dotnet_diagnostic.CA1710.severity = none + +# CA1714: Flags enums should have plural names +dotnet_diagnostic.CA1714.severity = none + +# CA1715: Identifiers should have correct prefix +dotnet_diagnostic.CA1715.severity = none + +# CA1716: Identifiers should not match keywords +dotnet_diagnostic.CA1716.severity = none + +# CA1717: Only FlagsAttribute enums should have plural names +dotnet_diagnostic.CA1717.severity = none + +# CA1720: Identifier contains type name +dotnet_diagnostic.CA1720.severity = none + +# CA1721: Property names should not match get methods +dotnet_diagnostic.CA1721.severity = none + +# CA1724: Type names should not match namespaces +dotnet_diagnostic.CA1724.severity = none + +# CA1801: Review unused parameters +dotnet_diagnostic.CA1801.severity = none + +# CA1802: Use literals where appropriate +dotnet_diagnostic.CA1802.severity = none + +# CA1806: Do not ignore method results +dotnet_diagnostic.CA1806.severity = none + +# CA1812: Avoid uninstantiated internal classes +dotnet_diagnostic.CA1812.severity = none + +# CA1814: Prefer jagged arrays over multidimensional +dotnet_diagnostic.CA1814.severity = none + +# CA1815: Override equals and operator equals on value types +dotnet_diagnostic.CA1815.severity = none + +# CA1819: Properties should not return arrays +dotnet_diagnostic.CA1819.severity = none + +# CA1822: Mark members as static +dotnet_diagnostic.CA1822.severity = none + +# CA1823: Avoid unused private fields +dotnet_diagnostic.CA1823.severity = none + +# CA2119: Seal methods that satisfy private interfaces +dotnet_diagnostic.CA2119.severity = none + +# CA2211: Non-constant fields should not be visible +dotnet_diagnostic.CA2211.severity = none + +# CA2214: Do not call overridable methods in constructors +dotnet_diagnostic.CA2214.severity = none + +# CA2219: Do not raise exceptions in finally clauses +dotnet_diagnostic.CA2219.severity = none + +# CA2226: Operators should have symmetrical overloads +dotnet_diagnostic.CA2226.severity = none + +# CA2225: Operator overloads have named alternates +dotnet_diagnostic.CA2225.severity = none + +# CA2227: Collection properties should be read only +dotnet_diagnostic.CA2227.severity = none + +# CA2231: Overload operator equals on overriding value type Equals +dotnet_diagnostic.CA2231.severity = none + +# CA2244: Do not duplicate indexed element initializations +dotnet_diagnostic.CA2244.severity = none + +# CA9999: Analyzer version mismatch +dotnet_diagnostic.CA9999.severity = none + +# CA1001: Types that own disposable fields should be disposable +dotnet_diagnostic.CA1001.severity = none + +# CA1032: Implement standard exception constructors +dotnet_diagnostic.CA1032.severity = none + +# CA1065: Do not raise exceptions in unexpected locations +dotnet_diagnostic.CA1065.severity = none + +# CA1200: Avoid using cref tags with a prefix +dotnet_diagnostic.CA1200.severity = none + +# CA1507: Use nameof to express symbol names +dotnet_diagnostic.CA1507.severity = none + +# CA1821: Remove empty Finalizers +dotnet_diagnostic.CA1821.severity = none + +# CA2200: Rethrow to preserve stack details. +dotnet_diagnostic.CA2200.severity = none + +# CA2234: Pass system uri objects instead of strings +dotnet_diagnostic.CA2234.severity = none + +# CA1304: Specify CultureInfo +dotnet_diagnostic.CA1304.severity = warning + +# CA1305: Specify IFormatProvider +dotnet_diagnostic.CA1305.severity = warning + +# CA1307: Specify StringComparison +dotnet_diagnostic.CA1307.severity = warning + +# CA1308: Normalize strings to uppercase +dotnet_diagnostic.CA1308.severity = none + +# CA1309: Use ordinal StringComparison +dotnet_diagnostic.CA1309.severity = warning + +# CA1310: Specify StringComparison for correctness +dotnet_diagnostic.CA1310.severity = warning + +# CA1401: P/Invokes should not be visible +dotnet_diagnostic.CA1401.severity = none + +# CA1816: Dispose methods should call SuppressFinalize +dotnet_diagnostic.CA1816.severity = none + +# CA1820: Test for empty strings using string length +dotnet_diagnostic.CA1820.severity = none + +# CA1826: Do not use Enumerable methods on indexable collections. Instead use the collection directly +dotnet_diagnostic.CA1826.severity = none + +# CA2002: Do not lock on objects with weak identity +dotnet_diagnostic.CA2002.severity = none + +# CA2008: Do not create tasks without passing a TaskScheduler +dotnet_diagnostic.CA2008.severity = none + +# CA2009: Do not call ToImmutableCollection on an ImmutableCollection value +dotnet_diagnostic.CA2009.severity = none + +# CA2101: Specify marshaling for P/Invoke string arguments +dotnet_diagnostic.CA2101.severity = none + +# CA2208: Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = none + +# CA2216: Disposable types should declare finalizer +dotnet_diagnostic.CA2216.severity = none + +# CA2241: Provide correct arguments to formatting methods +dotnet_diagnostic.CA2241.severity = none + +# CA2242: Test for NaN correctly +dotnet_diagnostic.CA2242.severity = none + +# CA2243: Attribute string literals should parse correctly +dotnet_diagnostic.CA2243.severity = none + +# CA1810: Initialize reference type static fields inline +dotnet_diagnostic.CA1810.severity = none + +# CA1824: Mark assemblies with NeutralResourcesLanguageAttribute +dotnet_diagnostic.CA1824.severity = none + +# CA1825: Avoid zero-length array allocations. +dotnet_diagnostic.CA1825.severity = none + +# CA2010: Always consume the value returned by methods marked with PreserveSigAttribute +dotnet_diagnostic.CA2010.severity = none + +# CA2201: Do not raise reserved exception types +dotnet_diagnostic.CA2201.severity = warning + +# CA2207: Initialize value type static fields inline +dotnet_diagnostic.CA2207.severity = none + +# CA1058: Types should not extend certain base types +dotnet_diagnostic.CA1058.severity = none + +# CA2153: Do Not Catch Corrupted State Exceptions +dotnet_diagnostic.CA2153.severity = error + +# CA2229: Implement serialization constructors +dotnet_diagnostic.CA2229.severity = none + +# CA2235: Mark all non-serializable fields +dotnet_diagnostic.CA2235.severity = none + +# CA2237: Mark ISerializable types with serializable +dotnet_diagnostic.CA2237.severity = none + +# IDE0073: Require file header +dotnet_diagnostic.IDE0073.severity = warning +file_header_template = NodeGuard\nCopyright (C) 2025 Elenpay\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY, without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/. + +# Remove unused imports +dotnet_diagnostic.CS8019.severity = warning +dotnet_diagnostic.IDE0005.severity = warning + +# SDL Required +# CA3075: Insecure DTD processing in XML +dotnet_diagnostic.CA3075.severity = error + +# SDL Required +# CA3147: Mark Verb Handlers With Validate Antiforgery Token +dotnet_diagnostic.CA3147.severity = error + +# SDL Required +# CA3076: Insecure XSLT script processing. +dotnet_diagnostic.CA3076.severity = error + +# SDL Required +# CA3077: Insecure Processing in API Design, XmlDocument and XmlTextReader +dotnet_diagnostic.CA3077.severity = error + +# SDL Required +# CA5350: Do Not Use Weak Cryptographic Algorithms +dotnet_diagnostic.CA5350.severity = error + +# SDL Required +# CA5351: Do Not Use Broken Cryptographic Algorithms +dotnet_diagnostic.CA5351.severity = error + +# SA1101: Prefix local calls with this +dotnet_diagnostic.SA1101.severity = none + +# SX1101: Do not prefix local calls with 'this.' +dotnet_diagnostic.SX1101.severity = error + +# SA1309: Field names should not begin with underscore +dotnet_diagnostic.SA1309.severity = none + +# SA1414: Tuple types in signatures should have element names +dotnet_diagnostic.SA1414.severity = none + +######################################################### +# Below is a list of rules for which the warnings need to be addressed +# These rules are only temporarily suppressed to reduce the noise +# For each rule +# If the rule truly needs to be suppressed +# Move it into the list above to apply to the whole solution +# Or move it into the \tests\.editorconfig to apply to the test projects +# Or suppress the rule in Global Suppressions file for specific classes, etc. +# If the rule does not need to be suppressed +# Apply the fixes for warnings and remove the rule from the list below +######################################################### + +# CA1031: Do not catch general exception types +dotnet_diagnostic.CA1031.severity = none + +# CA1303: Do not pass literals as localized parameters +dotnet_diagnostic.CA1303.severity = none + +# SA1118: Parameter should not span multiple lines +dotnet_diagnostic.SA1118.severity = none + +# SA1201: Elements should appear in the correct order +dotnet_diagnostic.SA1201.severity = none + +# SA1202: Elements should be ordered by access +dotnet_diagnostic.SA1202.severity = none + +# SA1203: Constants should appear before fields +dotnet_diagnostic.SA1203.severity = none + +# SA1204: Static elements should appear before instance elements +dotnet_diagnostic.SA1204.severity = none + +# SA1214: Readonly fields should appear before non-readonly fields +dotnet_diagnostic.SA1214.severity = none + +# SA1300: Element should begin with upper-case letter +dotnet_diagnostic.SA1300.severity = none + +# SA1307: Accessible fields should begin with upper-case letter +dotnet_diagnostic.SA1307.severity = none + +# SA1308: Variable names should not be prefixed +dotnet_diagnostic.SA1308.severity = none + +# SA1311: Static readonly fields should begin with upper-case letter +dotnet_diagnostic.SA1311.severity = none + +# SA1401: Fields should be private +dotnet_diagnostic.SA1401.severity = none + +# SA1512: Single-line comments should not be followed by blank line +dotnet_diagnostic.SA1512.severity = none + +# SA1515: Single-line comment should be preceded by blank line +dotnet_diagnostic.SA1515.severity = none + +# SA1516: Elements should be separated by blank line +dotnet_diagnostic.SA1516.severity = none + +# SA1623: Property summary documentation should match accessors +dotnet_diagnostic.SA1623.severity = none + +# SA1642: Constructor summary documentation should begin with standard text +dotnet_diagnostic.SA1642.severity = none + +## SA1649: File name should match first type name +dotnet_diagnostic.SA1649.severity = none +######################################################### +######################################################### + +[*.{cpp,h,in}] +curly_bracket_next_line = true +indent_brace_style = Allman + +# Xml project files +[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] +indent_size = 2 + +[*.{csproj,vbproj,proj,nativeproj,locproj}] +charset = utf-8 + +# Xml build files +[*.builds] +indent_size = 2 + +# Xml files +[*.{xml,stylecop,resx,ruleset}] +indent_size = 2 + +# Xml config files +[*.{props,targets,config,nuspec}] +indent_size = 2 + +# Shell scripts +[*.sh] +end_of_line = lf +[*.{cmd, bat}] +end_of_line = crlf diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..5607cf0f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.formatOnSave": true, + "dotnet.formatting.organizeImportsOnFormat": true, + "editor.codeActionsOnSave": { + "source.removeUnusedImports": "explicit", + "source.organizeImports": "explicit" + }, + "files.trimTrailingWhitespace": true, + "files.associations": { + "*.*proj": "xml", + "*.props": "xml", + "*.targets": "xml", + "*.tasks": "xml" + }, + "dotnet.preferCSharpExtension": true +} diff --git a/src/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs b/src/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs index 02296990..5d5867ae 100644 --- a/src/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs @@ -1,5 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable using Microsoft.AspNetCore.Mvc.RazorPages; diff --git a/src/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs b/src/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs index 28ce4bba..29e1b743 100644 --- a/src/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs @@ -1,17 +1,27 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Linq; using System.Text; -using System.Threading.Tasks; -using NodeGuard.Data.Models; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { diff --git a/src/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs b/src/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs index a9ba5229..8a68e746 100644 --- a/src/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs @@ -1,16 +1,27 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.Text; -using System.Threading.Tasks; -using NodeGuard.Data.Models; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { diff --git a/src/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs b/src/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs index 581dd0ce..7cb72fb5 100644 --- a/src/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs @@ -1,23 +1,32 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; using System.Security.Claims; using System.Text; using System.Text.Encodings.Web; -using System.Threading; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Options; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -86,7 +95,7 @@ public class InputModel [EmailAddress] public string Email { get; set; } } - + public IActionResult OnGet() => RedirectToPage("./Login"); public IActionResult OnPost(string provider, string returnUrl = null) diff --git a/src/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs b/src/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs index 097fc914..b45ad7c7 100644 --- a/src/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs @@ -1,19 +1,27 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading.Tasks; -using NodeGuard.Data.Models; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -50,9 +58,9 @@ public class InputModel public string Email { get; set; } } - public async Task OnPostAsync() + public Task OnPostAsync() { - return NotFound(); + return Task.FromResult(NotFound()); //if (ModelState.IsValid) //{ @@ -84,4 +92,4 @@ public async Task OnPostAsync() //return Page(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs b/src/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs index 878c92ca..9940876e 100644 --- a/src/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs @@ -1,5 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable using Microsoft.AspNetCore.Authorization; diff --git a/src/Areas/Identity/Pages/Account/Lockout.cshtml.cs b/src/Areas/Identity/Pages/Account/Lockout.cshtml.cs index 9956e1aa..a5cf5f03 100644 --- a/src/Areas/Identity/Pages/Account/Lockout.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Lockout.cshtml.cs @@ -1,5 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable using Microsoft.AspNetCore.Authorization; diff --git a/src/Areas/Identity/Pages/Account/Login.cshtml.cs b/src/Areas/Identity/Pages/Account/Login.cshtml.cs index 35ab49a2..7c663c5c 100644 --- a/src/Areas/Identity/Pages/Account/Login.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Login.cshtml.cs @@ -1,20 +1,27 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using NodeGuard.Data.Models; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -87,13 +94,13 @@ public class InputModel public async Task OnGetAsync(string returnUrl = null) { //If there are no ApplicationUsers in the db, redirect to SetupSuperadmin page to create the new superadmin - - if (! _signInManager.UserManager.Users.Any()) + + if (!_signInManager.UserManager.Users.Any()) { return RedirectToPage("./SetupSuperadmin"); } - - + + if (!string.IsNullOrEmpty(ErrorMessage)) { ModelState.AddModelError(string.Empty, ErrorMessage); @@ -150,4 +157,4 @@ public async Task OnPostAsync(string returnUrl = null) return Page(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs b/src/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs index 048cb491..e9aed82b 100644 --- a/src/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs @@ -1,12 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable using System.ComponentModel.DataAnnotations; -using NodeGuard.Data.Models; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.Identity; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { diff --git a/src/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs b/src/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs index 89e5a9e9..cf5ef992 100644 --- a/src/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs @@ -1,16 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using NodeGuard.Data.Models; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { public class LoginWithRecoveryCodeModel : PageModel diff --git a/src/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs index 446f9c35..2ba10371 100644 --- a/src/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs @@ -1,15 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -125,4 +136,4 @@ public async Task OnPostAsync() return RedirectToPage(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs index d37b5b14..eb38790a 100644 --- a/src/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs @@ -1,15 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -101,4 +112,4 @@ public async Task OnPostAsync() return Redirect("~/"); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs index 6a7c8df9..295e6172 100644 --- a/src/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs @@ -1,14 +1,25 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -67,4 +78,4 @@ public async Task OnPostAsync() return RedirectToPage("./TwoFactorAuthentication"); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs index a4abfe5d..b6f2f79c 100644 --- a/src/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs @@ -1,18 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -61,8 +69,8 @@ public async Task OnPostAsync() personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user)); - Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json"); + Response.Headers.Append("Content-Disposition", "attachment; filename=PersonalData.json"); return new FileContentResult(JsonSerializer.SerializeToUtf8Bytes(personalData), "application/json"); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs index a9843426..1c18348e 100644 --- a/src/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs @@ -1,18 +1,30 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; using System.Text; using System.Text.Encodings.Web; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -87,9 +99,9 @@ private async Task LoadAsync(ApplicationUser user) IsEmailConfirmed = await _userManager.IsEmailConfirmedAsync(user); } - public async Task OnGetAsync() + public Task OnGetAsync() { - return NotFound(); + return Task.FromResult(NotFound()); //var user = await _userManager.GetUserAsync(User); //if (user == null) //{ @@ -100,9 +112,9 @@ public async Task OnGetAsync() //return Page(); } - public async Task OnPostChangeEmailAsync() + public Task OnPostChangeEmailAsync() { - return NotFound(); + return Task.FromResult(NotFound()); //var user = await _userManager.GetUserAsync(User); //if (user == null) @@ -172,4 +184,4 @@ await _emailSender.SendEmailAsync( return RedirectToPage(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs index dff5b05f..f1cddce6 100644 --- a/src/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml.cs @@ -1,19 +1,29 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; using System.Globalization; -using System.Linq; using System.Text; using System.Text.Encodings.Web; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -186,4 +196,4 @@ private string GenerateQrCodeUri(string username, string unformattedKey) unformattedKey); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs index f8772be6..2c7ee484 100644 --- a/src/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs @@ -1,17 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -139,4 +148,4 @@ public async Task OnGetLinkLoginCallbackAsync() return RedirectToPage(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs index cfe87fa2..84e8425e 100644 --- a/src/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml.cs @@ -1,15 +1,25 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Linq; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -80,4 +90,4 @@ public async Task OnPostAsync() return RedirectToPage("./ShowRecoveryCodes"); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs index 93834771..a1e79f86 100644 --- a/src/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs @@ -1,15 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Text.Encodings.Web; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -116,4 +127,4 @@ public async Task OnPostAsync() return RedirectToPage(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs b/src/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs index ccac8a80..c8f401bf 100644 --- a/src/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs +++ b/src/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs @@ -1,11 +1,24 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using Microsoft.AspNetCore.Mvc.Rendering; -namespace NodeGuard.Areas.Identity.Pages.Account.Manage +namespace NodeGuard.Areas.Identity.Pages.Account.Manage { /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used diff --git a/src/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs index 213b08aa..161527fa 100644 --- a/src/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs @@ -1,12 +1,23 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Threading.Tasks; -using NodeGuard.Data.Models; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -34,4 +45,4 @@ public async Task OnGet() return Page(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs index c76f2712..80304014 100644 --- a/src/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml.cs @@ -1,14 +1,25 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -65,4 +76,4 @@ public async Task OnPostAsync() return RedirectToPage("./EnableAuthenticator"); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs index 4441621f..ca100002 100644 --- a/src/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml.cs @@ -1,14 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -112,4 +124,4 @@ public async Task OnPostAsync() return RedirectToPage(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs index 5a64f9eb..89114dd2 100644 --- a/src/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs @@ -1,11 +1,23 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { diff --git a/src/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs b/src/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs index 30f48c08..f8710c2e 100644 --- a/src/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs @@ -1,14 +1,25 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account.Manage { @@ -87,4 +98,4 @@ public async Task OnPostAsync() return RedirectToPage(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/Register.cshtml.cs b/src/Areas/Identity/Pages/Account/Register.cshtml.cs index c3229192..4cd633fa 100644 --- a/src/Areas/Identity/Pages/Account/Register.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/Register.cshtml.cs @@ -1,24 +1,28 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.WebUtilities; -using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -100,16 +104,16 @@ public class InputModel public string ConfirmPassword { get; set; } } - public async Task OnGetAsync(string returnUrl = null) + public Task OnGetAsync(string returnUrl = null) { //Register is disabled - return RedirectToPage("Login"); + return Task.FromResult(RedirectToPage("Login")); } - public async Task OnPostAsync(string returnUrl = null) + public Task OnPostAsync(string returnUrl = null) { //Register is disabled - return RedirectToPage("Login"); + return Task.FromResult(RedirectToPage("Login")); } private ApplicationUser CreateUser() @@ -135,4 +139,4 @@ private IUserEmailStore GetEmailStore() return (IUserEmailStore)_userStore; } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs b/src/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs index e5215b2e..2963a4e7 100644 --- a/src/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs @@ -1,17 +1,27 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; -using System.Text; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -45,10 +55,10 @@ public RegisterConfirmationModel(UserManager userManager, IEmai /// public string EmailConfirmationUrl { get; set; } - public async Task OnGetAsync(string email, string returnUrl = null) + public Task OnGetAsync(string email, string returnUrl = null) { //Register is disabled - return RedirectToPage("Login"); + return Task.FromResult(RedirectToPage("Login")); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs b/src/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs index 59bd10be..6042b012 100644 --- a/src/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ResendEmailConfirmation.cshtml.cs @@ -1,19 +1,28 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Text.Encodings.Web; -using System.Threading.Tasks; -using NodeGuard.Data.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -55,9 +64,9 @@ public void OnGet() { } - public async Task OnPostAsync() + public Task OnPostAsync() { - return NotFound(); + return Task.FromResult(NotFound()); //if (!ModelState.IsValid) //{ @@ -88,4 +97,4 @@ public async Task OnPostAsync() //return Page(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs b/src/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs index 7ca01a02..49c17e6b 100644 --- a/src/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs @@ -1,17 +1,28 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable -using System; using System.ComponentModel.DataAnnotations; using System.Text; -using System.Threading.Tasks; -using NodeGuard.Data.Models; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; +using NodeGuard.Data.Models; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -113,4 +124,4 @@ public async Task OnPostAsync() return Page(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Account/ResetPasswordConfirmation.cshtml.cs b/src/Areas/Identity/Pages/Account/ResetPasswordConfirmation.cshtml.cs index 91bf803b..d7698453 100644 --- a/src/Areas/Identity/Pages/Account/ResetPasswordConfirmation.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/ResetPasswordConfirmation.cshtml.cs @@ -1,5 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable using Microsoft.AspNetCore.Authorization; diff --git a/src/Areas/Identity/Pages/Account/SetupSuperadmin.cshtml.cs b/src/Areas/Identity/Pages/Account/SetupSuperadmin.cshtml.cs index 41a20da3..ab901e1b 100644 --- a/src/Areas/Identity/Pages/Account/SetupSuperadmin.cshtml.cs +++ b/src/Areas/Identity/Pages/Account/SetupSuperadmin.cshtml.cs @@ -1,14 +1,27 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. #nullable disable using System.ComponentModel.DataAnnotations; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Areas.Identity.Pages.Account { @@ -75,12 +88,12 @@ public class InputModel public string ConfirmationPassword { get; init; } } - public async Task OnGetAsync() + public Task OnGetAsync() { //If user exists in the database redirect to login if (_signInManager.UserManager.Users.Any()) { - return RedirectToPage("./Login"); + return Task.FromResult(RedirectToPage("./Login")); } if (!string.IsNullOrEmpty(ErrorMessage)) @@ -88,7 +101,7 @@ public async Task OnGetAsync() ModelState.AddModelError(string.Empty, ErrorMessage); } - return Page(); + return Task.FromResult(Page()); } public async Task OnPostAsync() @@ -98,7 +111,7 @@ public async Task OnPostAsync() { return RedirectToPage("./Login"); } - + if (ModelState.IsValid) { //Check for passwords match @@ -140,4 +153,4 @@ public async Task OnPostAsync() return Page(); } } -} \ No newline at end of file +} diff --git a/src/Areas/Identity/Pages/Error.cshtml.cs b/src/Areas/Identity/Pages/Error.cshtml.cs index 46492503..782d3bb1 100644 --- a/src/Areas/Identity/Pages/Error.cshtml.cs +++ b/src/Areas/Identity/Pages/Error.cshtml.cs @@ -1,5 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + #nullable disable using System.Diagnostics; diff --git a/src/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs b/src/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs index 50a99c1b..5e66396b 100644 --- a/src/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs +++ b/src/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs @@ -1,28 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.AspNetCore.Components; + + +using System.Security.Claims; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Server; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Options; -using System.Security.Claims; namespace NodeGuard.Areas.Identity { @@ -88,4 +86,4 @@ private async Task ValidateSecurityStampAsync(UserManager userManag } } } -} \ No newline at end of file +} diff --git a/src/Automapper/MapperProfile.cs b/src/Automapper/MapperProfile.cs index a0b79e1d..1dece2f9 100644 --- a/src/Automapper/MapperProfile.cs +++ b/src/Automapper/MapperProfile.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; -using NodeGuard.Data.Models; using NBitcoin; +using NodeGuard.Data.Models; using UTXO = NBXplorer.Models.UTXO; namespace NodeGuard.Automapper diff --git a/src/Data/ApplicationDbContext.cs b/src/Data/ApplicationDbContext.cs index f3171e4a..86260e9a 100644 --- a/src/Data/ApplicationDbContext.cs +++ b/src/Data/ApplicationDbContext.cs @@ -1,27 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Reflection; using System.Text.Json; -using NodeGuard.Data.Models; -using NodeGuard.Helpers; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; +using NodeGuard.Data.Models; +using NodeGuard.Helpers; namespace NodeGuard.Data { diff --git a/src/Data/DataProtectionKeysContext.cs b/src/Data/DataProtectionKeysContext.cs index 65bd1094..1954b989 100644 --- a/src/Data/DataProtectionKeysContext.cs +++ b/src/Data/DataProtectionKeysContext.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -14,4 +30,4 @@ public DataProtectionKeysContext(DbContextOptions opt // This maps to the table that stores keys. public DbSet DataProtectionKeys { get; set; } -} \ No newline at end of file +} diff --git a/src/Data/DbInitializer.cs b/src/Data/DbInitializer.cs index 4ba4bab3..bd763248 100644 --- a/src/Data/DbInitializer.cs +++ b/src/Data/DbInitializer.cs @@ -1,27 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Net; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; -using NodeGuard.TestHelpers; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using NBitcoin; @@ -29,7 +24,11 @@ using NBXplorer; using NBXplorer.DerivationStrategy; using NBXplorer.Models; +using NodeGuard.Data.Models; using NodeGuard.Data.Repositories; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; +using NodeGuard.TestHelpers; namespace NodeGuard.Data { @@ -223,10 +222,12 @@ public static async Task InitializeAsync(IServiceProvider serviceProvider) { await minerRPC.UnloadWalletAsync(""); // RPCErrorCode.RPC_WALLET_NOT_FOUND if already unloaded await minerRPC.LoadWalletAsync("default"); // RPCErrorCode.RPC_WALLET_ALREADY_LOADED if already loaded - } catch (RPCException e) when (e.RPCCode == RPCErrorCode.RPC_WALLET_ALREADY_LOADED || e.RPCCode == RPCErrorCode.RPC_WALLET_NOT_FOUND) + } + catch (RPCException e) when (e.RPCCode == RPCErrorCode.RPC_WALLET_ALREADY_LOADED || e.RPCCode == RPCErrorCode.RPC_WALLET_NOT_FOUND) { // Ignore these errors - } catch (Exception e) + } + catch (Exception e) { throw new Exception("Error while loading default wallet in bitcoind", e); } @@ -550,7 +551,7 @@ private static APIToken CreateApiToken(string name, string token, string userId) if (retryCount-- == 0) break; - + Thread.Sleep(1_000); } diff --git a/src/Data/Models/APIToken.cs b/src/Data/Models/APIToken.cs index eca06bd0..c13a4151 100644 --- a/src/Data/Models/APIToken.cs +++ b/src/Data/Models/APIToken.cs @@ -1,35 +1,50 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. using Microsoft.AspNetCore.Cryptography.KeyDerivation; namespace NodeGuard.Data.Models; -public class APIToken: Entity +public class APIToken : Entity { - public string Name { get; set; } - public string TokenHash { get; set; } + public required string Name { get; set; } + public required string TokenHash { get; set; } public bool IsBlocked { get; set; } - + #region Relationships - - public string CreatorId { get; set; } - public ApplicationUser Creator { get; set; } + + public required string CreatorId { get; set; } + public required ApplicationUser Creator { get; set; } // Not using it actively atm but could be helpful if we decide to use it in the future public DateTime? ExpirationDate { get; set; } - + #endregion Relationships - + public void GenerateTokenHash(string password, string salt) { var hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: password!, - salt: Convert.FromBase64String(salt), + salt: Convert.FromBase64String(salt), prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, numBytesRequested: 256 / 8)); - + TokenHash = hashed; } -} \ No newline at end of file +} diff --git a/src/Data/Models/ApplicationUser.cs b/src/Data/Models/ApplicationUser.cs index 05ab6a2f..399b4b2c 100644 --- a/src/Data/Models/ApplicationUser.cs +++ b/src/Data/Models/ApplicationUser.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; @@ -37,11 +36,11 @@ public class ApplicationUser : IdentityUser #region Relationships - public ICollection Keys { get; set; } - public ICollection ChannelOperationRequests { get; set; } - public ICollection Nodes { get; set; } - public ICollection WalletWithdrawalRequests { get; set; } + public required ICollection Keys { get; set; } + public required ICollection ChannelOperationRequests { get; set; } + public required ICollection Nodes { get; set; } + public required ICollection WalletWithdrawalRequests { get; set; } #endregion Relationships } -} \ No newline at end of file +} diff --git a/src/Data/Models/Channel.cs b/src/Data/Models/Channel.cs index 263d0f96..5ee4f5df 100644 --- a/src/Data/Models/Channel.cs +++ b/src/Data/Models/Channel.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; @@ -30,7 +29,7 @@ public enum ChannelStatus Closed = 2 } - public string FundingTx { get; set; } + public required string FundingTx { get; set; } public uint FundingTxOutputIndex { get; set; } /// @@ -67,17 +66,17 @@ public enum ChannelStatus #region Relationships - public ICollection ChannelOperationRequests { get; set; } + public required ICollection ChannelOperationRequests { get; set; } - public ICollection LiquidityRules { get; set; } + public required ICollection LiquidityRules { get; set; } public int SourceNodeId { get; set; } - public Node SourceNode { get; set; } + public required Node SourceNode { get; set; } public int DestinationNodeId { get; set; } - public Node DestinationNode { get; set; } + public required Node DestinationNode { get; set; } #endregion } -} \ No newline at end of file +} diff --git a/src/Data/Models/ChannelOperationRequest.cs b/src/Data/Models/ChannelOperationRequest.cs index 17e8e226..c15c10ee 100644 --- a/src/Data/Models/ChannelOperationRequest.cs +++ b/src/Data/Models/ChannelOperationRequest.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; -using NodeGuard.Helpers; using NBitcoin; +using NodeGuard.Helpers; using NodeGuard.Services; namespace NodeGuard.Data.Models @@ -121,13 +120,13 @@ public decimal Amount #region Relationships - public ICollection ChannelOperationRequestPsbts { get; set; } + public required ICollection ChannelOperationRequestPsbts { get; set; } public int? WalletId { get; set; } public Wallet? Wallet { get; set; } public int SourceNodeId { get; set; } - public Node SourceNode { get; set; } + public required Node SourceNode { get; set; } public int? DestNodeId { get; set; } public Node? DestNode { get; set; } public string? UserId { get; set; } @@ -137,7 +136,7 @@ public decimal Amount public bool IsChannelPrivate { get; set; } - public List Utxos { get; set; } + public required List Utxos { get; set; } #endregion Relationships @@ -169,13 +168,13 @@ private bool CheckSignatures() //We add the internal Wallet signature if (Wallet != null && Wallet.IsHotWallet) return ChannelOperationRequestPsbts.Count(x => x.IsTemplatePSBT) == 1; - + //if it is a BIP39 or watch only wallet, we don't need to add the internal wallet signature if (Wallet != null && (Wallet.IsBIP39Imported || Wallet.IsWatchOnly)) { return userPSBTsCount == Wallet.MofN; } - + userPSBTsCount++; if (userPSBTsCount == Wallet.MofN) @@ -217,4 +216,4 @@ public override int GetHashCode() return !Equals(left, right); } } -} \ No newline at end of file +} diff --git a/src/Data/Models/ChannelOperationRequestPSBT.cs b/src/Data/Models/ChannelOperationRequestPSBT.cs index 08175544..1df37a16 100644 --- a/src/Data/Models/ChannelOperationRequestPSBT.cs +++ b/src/Data/Models/ChannelOperationRequestPSBT.cs @@ -1,30 +1,29 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -namespace NodeGuard.Data.Models +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +namespace NodeGuard.Data.Models { /// /// A ChannelOperationRequestPSBT is a PSBT with the input signed by the approver /// public class ChannelOperationRequestPSBT : Entity { - public string PSBT { get; set; } + public required string PSBT { get; set; } /// /// Bool used to mark this sig's PSBT as the template for others to sign @@ -44,11 +43,11 @@ public class ChannelOperationRequestPSBT : Entity #region Relationships public int ChannelOperationRequestId { get; set; } - public ChannelOperationRequest ChannelOperationRequest { get; set; } + public required ChannelOperationRequest ChannelOperationRequest { get; set; } public string? UserSignerId { get; set; } public ApplicationUser? UserSigner { get; set; } #endregion Relationships } -} \ No newline at end of file +} diff --git a/src/Data/Models/Entity.cs b/src/Data/Models/Entity.cs index d12bf5b1..1f6f9374 100644 --- a/src/Data/Models/Entity.cs +++ b/src/Data/Models/Entity.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations; @@ -44,4 +43,4 @@ public override string ToString() return $"{Id}"; } } -} \ No newline at end of file +} diff --git a/src/Data/Models/FMUTXO.cs b/src/Data/Models/FMUTXO.cs index 379ca610..28e074cb 100644 --- a/src/Data/Models/FMUTXO.cs +++ b/src/Data/Models/FMUTXO.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + namespace NodeGuard.Data.Models { @@ -24,7 +23,7 @@ namespace NodeGuard.Data.Models /// public class FMUTXO : Entity, IEquatable { - public string TxId { get; set; } + public required string TxId { get; set; } public uint OutputIndex { get; set; } @@ -34,10 +33,10 @@ public class FMUTXO : Entity, IEquatable // M-N Because if the UTXO is used in a request that gets cancelled, // the UTXO should be unlocked and assigned to another request - public List ChannelOperationRequests { get; set; } + public required List ChannelOperationRequests { get; set; } // Idem as ChannelOperationRequests - public List WalletWithdrawalRequests { get; set; } + public required List WalletWithdrawalRequests { get; set; } #endregion Relationships @@ -73,4 +72,4 @@ public override int GetHashCode() return !Equals(left, right); } } -} \ No newline at end of file +} diff --git a/src/Data/Models/Interfaces/IBitcoinRequest.cs b/src/Data/Models/Interfaces/IBitcoinRequest.cs index 5a56c87e..a7eded3b 100644 --- a/src/Data/Models/Interfaces/IBitcoinRequest.cs +++ b/src/Data/Models/Interfaces/IBitcoinRequest.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + namespace NodeGuard.Data.Models; @@ -35,4 +34,4 @@ public interface IBitcoinRequest public long SatsAmount { get; } public Wallet? Wallet { get; set; } -} \ No newline at end of file +} diff --git a/src/Data/Models/InternalWallet.cs b/src/Data/Models/InternalWallet.cs index 34138509..649d5d35 100644 --- a/src/Data/Models/InternalWallet.cs +++ b/src/Data/Models/InternalWallet.cs @@ -1,120 +1,39 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Helpers; -using NBitcoin; - -namespace NodeGuard.Data.Models +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +public required string DerivationPath { get; set; } + +/// +/// 24 Words mnemonic +/// +public string? MnemonicString { get; set; } + +/// +/// XPUB in the case the Mnemonic is not set (Remote signer mode) +/// +public string? XPUB { - /// - /// This is another type of Wallet entity. - /// ONLY FOR USE INTERNALLY BY THE NodeGuard as middleman in the signing process for security reasons - /// - public class InternalWallet : Entity - { - - /// - /// Derivation path of the wallet - /// - public string DerivationPath { get; set; } - - /// - /// 24 Words mnemonic - /// - public string? MnemonicString { get; set; } - - /// - /// XPUB in the case the Mnemonic is not set (Remote signer mode) - /// - public string? XPUB - { - get => GetXPUB(); - set => _xpub = value; - } - private string? _xpub; - - public string? MasterFingerprint - { - get => GetMasterFingerprint(); - set => _masterFingerprint = value; - } - private string? _masterFingerprint; - - /// - /// Returns the xpub/tpub as nbxplorer uses - /// - /// - private string? GetXPUB() - { - - var network = CurrentNetworkHelper.GetCurrentNetwork(); - if(!string.IsNullOrWhiteSpace(MnemonicString)) - { - var masterKey = new Mnemonic(MnemonicString).DeriveExtKey().GetWif(network); - var keyPath = new KeyPath(DerivationPath); //https://github.com/dgarage/NBXplorer/blob/0595a87fc14aee6a6e4a0194f75aec4717819/NBXplorer/Controllers/MainController.cs#L1141 - var accountKey = masterKey.Derive(keyPath); - var bitcoinExtPubKey = accountKey.Neuter(); + get => GetXPUB(); + set => _xpub = value; +} +private string? _xpub; - var walletDerivationScheme = bitcoinExtPubKey.ToWif(); - - return walletDerivationScheme; - } - - return _xpub; - } - - public string GetXpubForAccount(string accountId) - { - var network = CurrentNetworkHelper.GetCurrentNetwork(); - - if(!string.IsNullOrWhiteSpace(MnemonicString)) - { - var masterKey = new Mnemonic(MnemonicString).DeriveExtKey().GetWif(network); - var keyPath = new KeyPath($"{DerivationPath}/{accountId}"); //https://github.com/dgarage/NBXplorer/blob/0595a87fc14aee6a6e4a0194f75aec4717819/NBXplorer/Controllers/MainController.cs#L1141 - var accountKey = masterKey.Derive(keyPath); - var bitcoinExtPubKey = accountKey.Neuter(); - return bitcoinExtPubKey.ToWif(); - } - else - { - var extKey = new BitcoinExtPubKey(_xpub, network); - var derivedXpub = extKey.Derive(new KeyPath(accountId)); - return derivedXpub.ToWif(); - } - } - - public string GetKeyPathForAccount(string accountId) - { - return $"{DerivationPath}/{accountId}"; - } - - private string? GetMasterFingerprint() - { - var network = CurrentNetworkHelper.GetCurrentNetwork(); - if (!string.IsNullOrWhiteSpace(MnemonicString)) - { - var masterFingerprint = new Mnemonic(MnemonicString).DeriveExtKey().GetWif(network).GetPublicKey() - .GetHDFingerPrint().ToString(); - return masterFingerprint; - } - - return _masterFingerprint; - } - } -} \ No newline at end of file +public string? MasterFingerprint +{ + get => GetMasterFingerprint(); + set => _masterFingerprint = value; +} +private string? _masterFingerprint; diff --git a/src/Data/Models/Key.cs b/src/Data/Models/Key.cs index 95cb71ca..d7496910 100644 --- a/src/Data/Models/Key.cs +++ b/src/Data/Models/Key.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NBitcoin; @@ -23,9 +22,9 @@ namespace NodeGuard.Data.Models { public class Key : Entity, IEquatable { - public string Name { get; set; } + public required string Name { get; set; } - public string XPUB { get; set; } + public required string XPUB { get; set; } public string? Description { get; set; } @@ -39,7 +38,7 @@ public class Key : Entity, IEquatable /// Derivation Path (e.g. m/84'/0'/0') /// public string? Path { get; set; } - + /// /// Flag to indicate that this key was imported from a BIP39 mnemonic /// @@ -50,7 +49,7 @@ public class Key : Entity, IEquatable public string? UserId { get; set; } public ApplicationUser? User { get; set; } - public ICollection Wallets { get; set; } + public required ICollection Wallets { get; set; } /// /// The internal wallet where this key belongs (if it were a internal wallet key) @@ -89,8 +88,8 @@ public override int GetHashCode() { return !Equals(left, right); } - - private sealed class CheckEquality: IEqualityComparer + + private sealed class CheckEquality : IEqualityComparer { public bool Equals(Key? b1, Key? b2) { @@ -103,14 +102,14 @@ public int GetHashCode(Key obj) throw new NotImplementedException(); } } - + private static readonly IEqualityComparer Comparer = new CheckEquality(); - public static bool Contains(ICollection source, Key? key) + public static bool Contains(ICollection source, Key? key) { return source.Contains(key, Comparer!); } - + public BitcoinExtPubKey GetBitcoinExtPubKey(Network network) { return new BitcoinExtPubKey(XPUB, network); @@ -137,4 +136,4 @@ public RootedKeyPath GetAddressRootedKeyPath(KeyPath utxoKeyPath) return new RootedKeyPath(HDFingerprint.Parse(MasterFingerprint), utxoKeyPath); } } -} \ No newline at end of file +} diff --git a/src/Data/Models/LiquidityRule.cs b/src/Data/Models/LiquidityRule.cs index 667e2072..723bbb75 100644 --- a/src/Data/Models/LiquidityRule.cs +++ b/src/Data/Models/LiquidityRule.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.ComponentModel.DataAnnotations.Schema; namespace NodeGuard.Data.Models; @@ -30,23 +46,23 @@ public class LiquidityRule : Entity #region Relationships public int ChannelId { get; set; } - public Channel Channel { get; set; } + public required Channel Channel { get; set; } public int SwapWalletId { get; set; } - public Wallet SwapWallet { get; set; } + public required Wallet SwapWallet { get; set; } public int? ReverseSwapWalletId { get; set; } public Wallet? ReverseSwapWallet { get; set; } public int NodeId { get; set; } - public Node Node { get; set; } + public required Node Node { get; set; } /// /// The pubkey of the node that is the remote counterparty of the channel /// [NotMapped] public string? RemoteNodePubkey => Channel?.SourceNode?.PubKey != Node.PubKey ? Channel?.SourceNode?.PubKey : Channel?.DestinationNode?.PubKey; - + #endregion } diff --git a/src/Data/Models/Node.cs b/src/Data/Models/Node.cs index 120796c6..da0e518a 100644 --- a/src/Data/Models/Node.cs +++ b/src/Data/Models/Node.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; @@ -23,9 +22,9 @@ namespace NodeGuard.Data.Models { public class Node : Entity { - public string PubKey { get; set; } + public required string PubKey { get; set; } - public string Name { get; set; } + public required string Name { get; set; } public string? Description { get; set; } @@ -68,13 +67,13 @@ public class Node : Entity #region Relationships - public ICollection ChannelOperationRequestsAsSource { get; set; } - public ICollection ChannelOperationRequestsAsDestination { get; set; } + public required ICollection ChannelOperationRequestsAsSource { get; set; } + public required ICollection ChannelOperationRequestsAsDestination { get; set; } - public ICollection Users { get; set; } + public required ICollection Users { get; set; } - public List SwapOuts { get; set; } + public required List SwapOuts { get; set; } #endregion Relationships } -} \ No newline at end of file +} diff --git a/src/Data/Models/Swaps.cs b/src/Data/Models/Swaps.cs index 0f949396..6350ec39 100644 --- a/src/Data/Models/Swaps.cs +++ b/src/Data/Models/Swaps.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; using NBitcoin; @@ -24,103 +23,103 @@ namespace NodeGuard.Data.Models; public enum SwapDirection { - Out, + Out, } public enum SwapProvider { - Loop, + Loop, } public enum SwapOutStatus { - Pending, - Completed, - Failed, + Pending, + Completed, + Failed, } // TODO: When we support SwapOuts, we should rename this to just Swap and reuse this table for both public class SwapOut : Entity { - public SwapProvider Provider { get; set; } + public SwapProvider Provider { get; set; } - /// - /// The ID of the swap in the provider's system - /// - public string? ProviderId { get; set; } + /// + /// The ID of the swap in the provider's system + /// + public string? ProviderId { get; set; } - /// - /// The current status of the swap - /// - public SwapOutStatus Status { get; set; } + /// + /// The current status of the swap + /// + public SwapOutStatus Status { get; set; } - /// - /// Whether the swap is manual or automatic - /// - public bool IsManual { get; set; } + /// + /// Whether the swap is manual or automatic + /// + public bool IsManual { get; set; } - /// - /// Amount in satoshis - /// - public long SatsAmount { get; set; } + /// + /// Amount in satoshis + /// + public long SatsAmount { get; set; } - /// - /// Calculated property to convert to btc - /// - [NotMapped] - public decimal Amount => new Money(SatsAmount, MoneyUnit.Satoshi).ToDecimal(MoneyUnit.BTC); + /// + /// Calculated property to convert to btc + /// + [NotMapped] + public decimal Amount => new Money(SatsAmount, MoneyUnit.Satoshi).ToDecimal(MoneyUnit.BTC); - /// - /// The address where the funds are sent to - /// - public int? DestinationWalletId { get; set; } + /// + /// The address where the funds are sent to + /// + public int? DestinationWalletId { get; set; } - public Wallet? DestinationWallet { get; set; } + public Wallet? DestinationWallet { get; set; } - /// - /// The node that executed the swap - /// - public int? NodeId { get; set; } - public Node? Node { get; set; } + /// + /// The node that executed the swap + /// + public int? NodeId { get; set; } + public Node? Node { get; set; } - /// - /// Fees charged by the swap provider - /// - public long? ServiceFeeSats { get; set; } + /// + /// Fees charged by the swap provider + /// + public long? ServiceFeeSats { get; set; } - public Money ServiceFee => new Money(ServiceFeeSats ?? 0, MoneyUnit.Satoshi); + public Money ServiceFee => new Money(ServiceFeeSats ?? 0, MoneyUnit.Satoshi); - /// - /// Fees charged by the lightning network for the swap - /// - public long? LightningFeeSats { get; set; } + /// + /// Fees charged by the lightning network for the swap + /// + public long? LightningFeeSats { get; set; } - public Money LightningFee => new Money(LightningFeeSats ?? 0, MoneyUnit.Satoshi); + public Money LightningFee => new Money(LightningFeeSats ?? 0, MoneyUnit.Satoshi); - /// - /// Fees charged by the on-chain network for the swap - /// - public long? OnChainFeeSats { get; set; } + /// + /// Fees charged by the on-chain network for the swap + /// + public long? OnChainFeeSats { get; set; } - public Money OnChainFee => new Money(OnChainFeeSats ?? 0, MoneyUnit.Satoshi); + public Money OnChainFee => new Money(OnChainFeeSats ?? 0, MoneyUnit.Satoshi); - public long TotalFeesSats => - (ServiceFeeSats ?? 0) + (LightningFeeSats ?? 0) + (OnChainFeeSats ?? 0); + public long TotalFeesSats => + (ServiceFeeSats ?? 0) + (LightningFeeSats ?? 0) + (OnChainFeeSats ?? 0); - public Money TotalFees => new Money(TotalFeesSats, MoneyUnit.Satoshi); + public Money TotalFees => new Money(TotalFeesSats, MoneyUnit.Satoshi); - /// - /// Error details if the swap failed - /// - public string? ErrorDetails { get; set; } + /// + /// Error details if the swap failed + /// + public string? ErrorDetails { get; set; } - public string? UserRequestorId { get; set; } + public string? UserRequestorId { get; set; } - public ApplicationUser? UserRequestor { get; set; } + public ApplicationUser? UserRequestor { get; set; } - /// - /// The Transaction ID of the swap - /// - public string? TxId { get; set; } + /// + /// The Transaction ID of the swap + /// + public string? TxId { get; set; } -} \ No newline at end of file +} diff --git a/src/Data/Models/UTXOTag.cs b/src/Data/Models/UTXOTag.cs index 877e7d78..43b5d125 100644 --- a/src/Data/Models/UTXOTag.cs +++ b/src/Data/Models/UTXOTag.cs @@ -1,11 +1,27 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + namespace NodeGuard.Data.Models; - + public class UTXOTag : Entity { - public string Key { get; set; } - - public string Value { get; set; } - + public required string Key { get; set; } + + public required string Value { get; set; } + // Outpoint of the UTXO in format "hash-index" - public string Outpoint { get; set; } -} \ No newline at end of file + public required string Outpoint { get; set; } +} diff --git a/src/Data/Models/Wallet.cs b/src/Data/Models/Wallet.cs index d7fb95f1..45636c5c 100644 --- a/src/Data/Models/Wallet.cs +++ b/src/Data/Models/Wallet.cs @@ -1,27 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; -using NodeGuard.Helpers; using NBitcoin; -using NBitcoin.Scripting; using NBXplorer.DerivationStrategy; +using NodeGuard.Helpers; namespace NodeGuard.Data.Models { @@ -38,7 +36,7 @@ public enum WalletAddressType /// public class Wallet : Entity { - public string Name { get; set; } + public required string Name { get; set; } /// /// M-of-N Multisig threshold @@ -117,8 +115,8 @@ public class Wallet : Entity #region Relationships - public ICollection ChannelOperationRequestsAsSource { get; set; } - public ICollection Keys { get; set; } + public required ICollection ChannelOperationRequestsAsSource { get; set; } + public required ICollection Keys { get; set; } /// @@ -129,11 +127,11 @@ public class Wallet : Entity public InternalWallet? InternalWallet { get; set; } - public ICollection LiquidityRulesAsSwapWallet { get; set; } - - public ICollection LiquidityRulesAsReverseSwapWallet { get; set; } + public required ICollection LiquidityRulesAsSwapWallet { get; set; } + + public required ICollection LiquidityRulesAsReverseSwapWallet { get; set; } - public List SwapOuts { get; set; } + public required List SwapOuts { get; set; } #endregion Relationships @@ -227,4 +225,4 @@ public NBitcoin.Key DeriveUtxoPrivateKey(Network network, KeyPath utxoKeyPath) } } } -} \ No newline at end of file +} diff --git a/src/Data/Models/WalletWithdrawalRequest.cs b/src/Data/Models/WalletWithdrawalRequest.cs index 0a72993c..a6ba609e 100644 --- a/src/Data/Models/WalletWithdrawalRequest.cs +++ b/src/Data/Models/WalletWithdrawalRequest.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.ComponentModel.DataAnnotations.Schema; using NBitcoin; @@ -81,7 +80,7 @@ public class WalletWithdrawalRequest : Entity, IEquatable /// Description by the requestor /// - public string Description { get; set; } + public required string Description { get; set; } /// /// Bool used to mark if the output of the request should the maximum as possible to the destination address. @@ -189,18 +188,18 @@ public bool Equals(WalletWithdrawalRequest? other) /// public string? UserRequestorId { get; set; } - public ApplicationUser UserRequestor { get; set; } + public required ApplicationUser UserRequestor { get; set; } public int WalletId { get; set; } - public Wallet Wallet { get; set; } + public required Wallet Wallet { get; set; } public int? BumpingWalletWithdrawalRequestId { get; set; } public WalletWithdrawalRequest? BumpingWalletWithdrawalRequest { get; set; } - public List WalletWithdrawalRequestPSBTs { get; set; } + public required List WalletWithdrawalRequestPSBTs { get; set; } - public List UTXOs { get; set; } + public required List UTXOs { get; set; } /// /// This is a optional field that you can used to link withdrawals with externally-generated IDs (e.g. a withdrawal/settlement that belongs to an elenpay store) @@ -229,4 +228,4 @@ public override int GetHashCode() return !Equals(left, right); } } -} \ No newline at end of file +} diff --git a/src/Data/Models/WalletWithdrawalRequestDestination.cs b/src/Data/Models/WalletWithdrawalRequestDestination.cs index 1e83f0f0..d637a3fa 100644 --- a/src/Data/Models/WalletWithdrawalRequestDestination.cs +++ b/src/Data/Models/WalletWithdrawalRequestDestination.cs @@ -1,25 +1,18 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using System.ComponentModel.DataAnnotations.Schema; -using NBitcoin; -using NodeGuard.Services; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. namespace NodeGuard.Data.Models { @@ -49,4 +42,4 @@ public class WalletWithdrawalRequestDestination : Entity #endregion } -} \ No newline at end of file +} diff --git a/src/Data/Models/WalletWithdrawalRequestPSBT.cs b/src/Data/Models/WalletWithdrawalRequestPSBT.cs index 1f482a3d..89321456 100644 --- a/src/Data/Models/WalletWithdrawalRequestPSBT.cs +++ b/src/Data/Models/WalletWithdrawalRequestPSBT.cs @@ -1,30 +1,29 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -namespace NodeGuard.Data.Models +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +namespace NodeGuard.Data.Models { /// /// PSBTs related to a WalletWithdrawalRequest /// public class WalletWithdrawalRequestPSBT : Entity { - public string PSBT { get; set; } + public required string PSBT { get; set; } /// /// Represents the PSBT signed with the Internal Wallet key of the moment @@ -49,8 +48,8 @@ public class WalletWithdrawalRequestPSBT : Entity public int WalletWithdrawalRequestId { get; set; } - public WalletWithdrawalRequest WalletWithdrawalRequest { get; set; } + public required WalletWithdrawalRequest WalletWithdrawalRequest { get; set; } #endregion Relationships } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/APITokenRepository.cs b/src/Data/Repositories/APITokenRepository.cs index a25f8f71..069f72b1 100644 --- a/src/Data/Repositories/APITokenRepository.cs +++ b/src/Data/Repositories/APITokenRepository.cs @@ -1,9 +1,23 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Security.Cryptography; -using Google.Protobuf.WellKnownTypes; using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; namespace NodeGuard.Data.Repositories; @@ -12,7 +26,7 @@ public class APITokenRepository : IAPITokenRepository private readonly IRepository _repository; private readonly ILogger _logger; private readonly IDbContextFactory _dbContextFactory; - + public APITokenRepository(IRepository repository, ILogger logger, IDbContextFactory dbContextFactory) @@ -21,41 +35,41 @@ public APITokenRepository(IRepository repository, _logger = logger; _dbContextFactory = dbContextFactory; } - - + + public async Task<(bool, string?)> AddAsync(APIToken type) + { + await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); + + type.SetCreationDatetime(); + type.SetUpdateDatetime(); + + var password = Convert.ToBase64String(RandomNumberGenerator.GetBytes(32)); + try + { + type.GenerateTokenHash(password, Constants.API_TOKEN_SALT); + } + catch (Exception e) + { + var errorMsg = "Error generating API token hash"; + _logger.LogError(e, errorMsg); + + return (false, errorMsg); + } + + try + { + var addResult = await _repository.AddAsync(type, applicationDbContext); + return addResult; + } + catch (Exception e) { - await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); - - type.SetCreationDatetime(); - type.SetUpdateDatetime(); - - var password = Convert.ToBase64String(RandomNumberGenerator.GetBytes(32)); - try - { - type.GenerateTokenHash(password, Constants.API_TOKEN_SALT); - } - catch (Exception e) - { - var errorMsg = "Error generating API token hash"; - _logger.LogError(e, errorMsg); - - return (false, errorMsg); - } - - try - { - var addResult = await _repository.AddAsync(type, applicationDbContext); - return addResult; - } - catch (Exception e) - { - var errorMsg = "Error adding API token on repository"; - _logger.LogError(e, errorMsg); - - return (false, errorMsg); - } + var errorMsg = "Error adding API token on repository"; + _logger.LogError(e, errorMsg); + + return (false, errorMsg); } + } public async Task GetByToken(string token) { @@ -70,16 +84,16 @@ public async Task> GetAll() return result; } - + public (bool, string?) Update(APIToken type) { using var applicationDbContext = _dbContextFactory.CreateDbContext(); - + type.SetUpdateDatetime(); - + return _repository.Update(type, applicationDbContext); } - + public bool BlockToken(APIToken type) { return ChangeBlockStatus(type, true); @@ -89,7 +103,7 @@ public bool UnblockToken(APIToken type) { return ChangeBlockStatus(type, false); } - + private bool ChangeBlockStatus(APIToken type, bool status) { try @@ -105,4 +119,4 @@ private bool ChangeBlockStatus(APIToken type, bool status) return false; } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/ApplicationUserRepository.cs b/src/Data/Repositories/ApplicationUserRepository.cs index 61292073..ef305822 100644 --- a/src/Data/Repositories/ApplicationUserRepository.cs +++ b/src/Data/Repositories/ApplicationUserRepository.cs @@ -1,31 +1,30 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using System.Text; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using System.Text; using AutoMapper; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; using Humanizer; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.AspNetCore.WebUtilities; using Microsoft.EntityFrameworkCore; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Data.Repositories { @@ -171,7 +170,7 @@ on userRoles.UserId equals user.Id var token = await _userManager.GeneratePasswordResetTokenAsync(applicationUser); var tokenBase64 = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(token)); - + if (Constants.FUNDSMANAGER_ENDPOINT == null) { _logger.LogError("FUNDSMANAGER_ENDPOINT env var not found"); @@ -227,26 +226,26 @@ on userRoles.UserId equals user.Id throw new ArgumentException("Value cannot be null or whitespace.", nameof(username)); if (string.IsNullOrWhiteSpace(confirmationPassword)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(confirmationPassword)); - + var superadminAddResult = await AddAsync(new ApplicationUser { - UserName = username, + UserName = username, NormalizedUserName = username.ToUpper(), }, confirmationPassword); - + if (!superadminAddResult.Item1) { var message = $"Error while creating superadmin user:{username}"; _logger.LogError(message); return (false, message); } - + var superadmin = await GetByUsername(username); if (superadmin != null) { - var selectedRoles = new List{ApplicationUserRole.Superadmin}; - - var addRole = await UpdateUserRoles( selectedRoles, superadmin); + var selectedRoles = new List { ApplicationUserRole.Superadmin }; + + var addRole = await UpdateUserRoles(selectedRoles, superadmin); if (!addRole.Item1) { var message = $"Error while adding superadmin role to user:{username}"; @@ -370,7 +369,7 @@ public async Task> GetAll(bool includeBanned = false) //Hash the password var passwordHasher = new PasswordHasher(); type.PasswordHash = passwordHasher.HashPassword(type, password); - + } var identityResult = await userStore.CreateAsync(type); @@ -406,4 +405,4 @@ public async Task> GetAll(bool includeBanned = false) return _repository.Update(type, applicationDbContext); } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/ChannelOperationRequestPSBTRepository.cs b/src/Data/Repositories/ChannelOperationRequestPSBTRepository.cs index 8086f324..6a351fd1 100644 --- a/src/Data/Repositories/ChannelOperationRequestPSBTRepository.cs +++ b/src/Data/Repositories/ChannelOperationRequestPSBTRepository.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Data.Repositories { @@ -45,7 +44,7 @@ public ChannelOperationRequestPSBTRepository(IRepository x.Id == id); } - public async Task> GetAll() + public Task> GetAll() { throw new NotImplementedException(); } @@ -109,4 +108,4 @@ public async Task> GetAll() return _repository.Update(type, applicationDbContext); } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/ChannelOperationRequestRepository.cs b/src/Data/Repositories/ChannelOperationRequestRepository.cs index e6f7de72..d100d16f 100644 --- a/src/Data/Repositories/ChannelOperationRequestRepository.cs +++ b/src/Data/Repositories/ChannelOperationRequestRepository.cs @@ -1,28 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; +using Humanizer; +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Services; -using Humanizer; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories { @@ -92,6 +91,7 @@ public async Task> GetUnsignedPendingRequestsByUse .ToListAsync(); } + [Obsolete] public async Task<(bool, string?)> AddAsync(ChannelOperationRequest request) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); @@ -212,7 +212,7 @@ public async Task> GetUnsignedPendingRequestsByUse } catch (Exception e) { - _logger.LogError(e, "Error while getting UTXOs from channel op request: {RequestId}", request.Id); + _logger.LogError(e, "Error while getting UTXOs from channel op request: {RequestId}", request.Id); result.Item1 = false; } @@ -234,4 +234,4 @@ public async Task> GetPendingRequests() .ToListAsync(); } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/ChannelRepository.cs b/src/Data/Repositories/ChannelRepository.cs index e64bda12..5fa85f83 100644 --- a/src/Data/Repositories/ChannelRepository.cs +++ b/src/Data/Repositories/ChannelRepository.cs @@ -1,31 +1,30 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; +using Microsoft.EntityFrameworkCore; +using NBitcoin; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Jobs; using NodeGuard.Helpers; +using NodeGuard.Jobs; using NodeGuard.Services; using Quartz; -using Microsoft.EntityFrameworkCore; -using NBitcoin; using Channel = NodeGuard.Data.Models.Channel; namespace NodeGuard.Data.Repositories @@ -270,4 +269,4 @@ public async Task> GetAllManagedByUserNodes(string loggedUserId) return markAsClosed; } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/FUTXORepository.cs b/src/Data/Repositories/FUTXORepository.cs index 2220e56c..9bc483ed 100644 --- a/src/Data/Repositories/FUTXORepository.cs +++ b/src/Data/Repositories/FUTXORepository.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories { @@ -159,7 +158,7 @@ public async Task> GetLockedUTXOs(int? ignoredWalletWithdrawalReque return result; } - + public async Task> GetLockedUTXOsByWalletId(int walletId) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); diff --git a/src/Data/Repositories/Interfaces/IAPITokenRepository.cs b/src/Data/Repositories/Interfaces/IAPITokenRepository.cs index 19c647a0..a4b59ed2 100644 --- a/src/Data/Repositories/Interfaces/IAPITokenRepository.cs +++ b/src/Data/Repositories/Interfaces/IAPITokenRepository.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories.Interfaces; @@ -10,5 +26,5 @@ public interface IAPITokenRepository (bool, string?) Update(APIToken type); bool BlockToken(APIToken type); bool UnblockToken(APIToken type); - -} \ No newline at end of file + +} diff --git a/src/Data/Repositories/Interfaces/IApplicationUserRepository.cs b/src/Data/Repositories/Interfaces/IApplicationUserRepository.cs index 7d75fb06..9f6eca13 100644 --- a/src/Data/Repositories/Interfaces/IApplicationUserRepository.cs +++ b/src/Data/Repositories/Interfaces/IApplicationUserRepository.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories.Interfaces; @@ -84,5 +83,5 @@ public interface IApplicationUserRepository /// /// /// - Task<(bool,string?)> CreateSuperAdmin(string username, string confirmationPassword); -} \ No newline at end of file + Task<(bool, string?)> CreateSuperAdmin(string username, string confirmationPassword); +} diff --git a/src/Data/Repositories/Interfaces/IBitcoinRequestRepository.cs b/src/Data/Repositories/Interfaces/IBitcoinRequestRepository.cs index cc5bb588..778e41e3 100644 --- a/src/Data/Repositories/Interfaces/IBitcoinRequestRepository.cs +++ b/src/Data/Repositories/Interfaces/IBitcoinRequestRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; @@ -32,4 +31,4 @@ public interface IBitcoinRequestRepository Task<(bool, string?)> AddUTXOs(IBitcoinRequest type, List utxos); public Task<(bool, List?)> GetUTXOs(IBitcoinRequest type); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IChannelOperationRequestPSBTRepository.cs b/src/Data/Repositories/Interfaces/IChannelOperationRequestPSBTRepository.cs index ad84ba52..2c57e57b 100644 --- a/src/Data/Repositories/Interfaces/IChannelOperationRequestPSBTRepository.cs +++ b/src/Data/Repositories/Interfaces/IChannelOperationRequestPSBTRepository.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories.Interfaces; @@ -36,4 +35,4 @@ public interface IChannelOperationRequestPSBTRepository (bool, string?) RemoveRange(List types); (bool, string?) Update(ChannelOperationRequestPSBT type); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IChannelOperationRequestRepository.cs b/src/Data/Repositories/Interfaces/IChannelOperationRequestRepository.cs index 34d050a6..aa52fac3 100644 --- a/src/Data/Repositories/Interfaces/IChannelOperationRequestRepository.cs +++ b/src/Data/Repositories/Interfaces/IChannelOperationRequestRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; @@ -44,4 +43,4 @@ public interface IChannelOperationRequestRepository : IBitcoinRequestRepository /// /// Task> GetPendingRequests(); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IChannelRepository.cs b/src/Data/Repositories/Interfaces/IChannelRepository.cs index f99ed872..3164277d 100644 --- a/src/Data/Repositories/Interfaces/IChannelRepository.cs +++ b/src/Data/Repositories/Interfaces/IChannelRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Channel = NodeGuard.Data.Models.Channel; @@ -54,4 +53,4 @@ public interface IChannelRepository /// /// Task> GetAllManagedByUserNodes(string loggedUserId); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IFMUTXORepository.cs b/src/Data/Repositories/Interfaces/IFMUTXORepository.cs index 40529b0b..c1fcd06c 100644 --- a/src/Data/Repositories/Interfaces/IFMUTXORepository.cs +++ b/src/Data/Repositories/Interfaces/IFMUTXORepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; @@ -44,8 +43,8 @@ public interface IFMUTXORepository Task> GetLockedUTXOs(int? ignoredWalletWithdrawalRequestId = null, int? ignoredChannelOperationRequestId = null); Task> GetLockedUTXOsByWalletId(int walletId); /// - /// Gets the current list of UTXOs locked on WalletWithdrawalRequest by passing its id + /// Gets the current list of UTXOs locked on WalletWithdrawalRequest by passing its id /// /// Task> GetLockedUTXOsByWithdrawalId(int walletWithdrawalRequestId); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IInternalWalletRepository.cs b/src/Data/Repositories/Interfaces/IInternalWalletRepository.cs index 1a25d847..1c3818b9 100644 --- a/src/Data/Repositories/Interfaces/IInternalWalletRepository.cs +++ b/src/Data/Repositories/Interfaces/IInternalWalletRepository.cs @@ -1,23 +1,18 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. namespace NodeGuard.Data.Repositories.Interfaces; @@ -50,4 +45,4 @@ public interface IInternalWalletRepository /// Indicates if the wallet is read-only and the seedphrase should not be generated here /// Task GenerateNewInternalWallet(bool generateReadOnlyWallet = false); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IKeyRepository.cs b/src/Data/Repositories/Interfaces/IKeyRepository.cs index 24b31010..5ce448df 100644 --- a/src/Data/Repositories/Interfaces/IKeyRepository.cs +++ b/src/Data/Repositories/Interfaces/IKeyRepository.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories.Interfaces; @@ -44,4 +43,4 @@ public interface IKeyRepository /// /// Task GetCurrentInternalWalletKey(string accountId); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/ILiquidityRuleRepository.cs b/src/Data/Repositories/Interfaces/ILiquidityRuleRepository.cs index 66e7b621..7070f940 100644 --- a/src/Data/Repositories/Interfaces/ILiquidityRuleRepository.cs +++ b/src/Data/Repositories/Interfaces/ILiquidityRuleRepository.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories; @@ -11,11 +27,11 @@ public interface ILiquidityRuleRepository (bool, string?) Remove(LiquidityRule type); (bool, string?) RemoveRange(List types); (bool, string?) Update(LiquidityRule type); - + /// /// Gets all the liquidity rules for a given node /// /// /// Task> GetByNodePubKey(string nodePubKey); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/INodeRepository.cs b/src/Data/Repositories/Interfaces/INodeRepository.cs index 7d5a6593..c080ebf9 100644 --- a/src/Data/Repositories/Interfaces/INodeRepository.cs +++ b/src/Data/Repositories/Interfaces/INodeRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; using NodeGuard.Services; diff --git a/src/Data/Repositories/Interfaces/IRepository.cs b/src/Data/Repositories/Interfaces/IRepository.cs index e8d1eb85..491463f0 100644 --- a/src/Data/Repositories/Interfaces/IRepository.cs +++ b/src/Data/Repositories/Interfaces/IRepository.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -namespace NodeGuard.Data.Repositories.Interfaces + + +namespace NodeGuard.Data.Repositories.Interfaces { /// /// Interface of a base Repository implementation @@ -73,4 +72,4 @@ public interface IRepository /// A tuple (bool, string). The bool represents the call success and the string any possible message. public (bool, string) Update(T type, ApplicationDbContext applicationDbContext); } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/ISwapOutRepository.cs b/src/Data/Repositories/Interfaces/ISwapOutRepository.cs index 5ad136c3..e5244ba3 100644 --- a/src/Data/Repositories/Interfaces/ISwapOutRepository.cs +++ b/src/Data/Repositories/Interfaces/ISwapOutRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; @@ -23,11 +22,11 @@ namespace NodeGuard.Data.Repositories.Interfaces; public interface ISwapOutRepository { - Task GetById(int id); - Task> GetByIds(List ids); - Task> GetAll(); - Task> GetAllPending(); - Task<(bool, string?)> AddAsync(SwapOut swap); - Task<(bool, string?)> AddRangeAsync(List swaps); - (bool, string?) Update(SwapOut swap); -} \ No newline at end of file + Task GetById(int id); + Task> GetByIds(List ids); + Task> GetAll(); + Task> GetAllPending(); + Task<(bool, string?)> AddAsync(SwapOut swap); + Task<(bool, string?)> AddRangeAsync(List swaps); + (bool, string?) Update(SwapOut swap); +} diff --git a/src/Data/Repositories/Interfaces/IUTXOTagRepository.cs b/src/Data/Repositories/Interfaces/IUTXOTagRepository.cs index 9bb4b62a..11312db3 100644 --- a/src/Data/Repositories/Interfaces/IUTXOTagRepository.cs +++ b/src/Data/Repositories/Interfaces/IUTXOTagRepository.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories.Interfaces; @@ -5,11 +21,11 @@ namespace NodeGuard.Data.Repositories.Interfaces; public interface IUTXOTagRepository { Task> GetByOutpoint(string outpoint); - + Task GetByKeyAndOutpoint(string key, string outpoint); - + Task> GetByKeyValue(string key, string value); - + Task<(bool, string?)> AddAsync(UTXOTag type); Task<(bool, string?)> AddRangeAsync(List type); diff --git a/src/Data/Repositories/Interfaces/IWalletRepository.cs b/src/Data/Repositories/Interfaces/IWalletRepository.cs index b552700f..d58f70d2 100644 --- a/src/Data/Repositories/Interfaces/IWalletRepository.cs +++ b/src/Data/Repositories/Interfaces/IWalletRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Nodeguard; using Wallet = NodeGuard.Data.Models.Wallet; @@ -27,9 +26,9 @@ public interface IWalletRepository Task GetById(int id); Task> GetAll(); - + Task> GetAvailableByType(WALLET_TYPE type); - + Task> GetAvailableByIds(List ids); /// @@ -81,5 +80,5 @@ public interface IWalletRepository /// /// /// - Task<(bool,string?)> ImportWatchOnlyWallet(string name, string? description, string outputDescriptor, string? userId = null); -} \ No newline at end of file + Task<(bool, string?)> ImportWatchOnlyWallet(string name, string? description, string outputDescriptor, string? userId = null); +} diff --git a/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestDestinationRepository.cs b/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestDestinationRepository.cs index df8cb73e..956787f5 100644 --- a/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestDestinationRepository.cs +++ b/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestDestinationRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; diff --git a/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestPsbtRepository.cs b/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestPsbtRepository.cs index 1f7afea4..a5598791 100644 --- a/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestPsbtRepository.cs +++ b/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestPsbtRepository.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using NodeGuard.Data.Models; + + +using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories.Interfaces; @@ -30,4 +29,4 @@ public interface IWalletWithdrawalRequestPsbtRepository (bool, string?) Remove(WalletWithdrawalRequestPSBT type); (bool, string?) RemoveRange(List types); (bool, string?) Update(WalletWithdrawalRequestPSBT type); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestRepository.cs b/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestRepository.cs index ee266e7f..b3bb025f 100644 --- a/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestRepository.cs +++ b/src/Data/Repositories/Interfaces/IWalletWithdrawalRequestRepository.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Models; @@ -47,4 +46,4 @@ public interface IWalletWithdrawalRequestRepository : IBitcoinRequestRepository Task> GetPendingRequests(); Task> GetOnChainPendingWithdrawals(); -} \ No newline at end of file +} diff --git a/src/Data/Repositories/InternalWalletRepository.cs b/src/Data/Repositories/InternalWalletRepository.cs index fcb509e9..aeb2d846 100644 --- a/src/Data/Repositories/InternalWalletRepository.cs +++ b/src/Data/Repositories/InternalWalletRepository.cs @@ -1,26 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore; using NBitcoin; +using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Data.Repositories { @@ -104,7 +102,7 @@ public async Task GenerateNewInternalWallet(bool generateReadOnl var internalWallet = new InternalWallet { DerivationPath = Constants.DEFAULT_DERIVATION_PATH, - MnemonicString = generateReadOnlyWallet ? null : new Mnemonic(Wordlist.English).ToString(), + MnemonicString = generateReadOnlyWallet ? null : new Mnemonic(Wordlist.English).ToString(), CreationDatetime = DateTimeOffset.Now, }; @@ -123,4 +121,4 @@ public async Task GenerateNewInternalWallet(bool generateReadOnl return internalWallet; } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/KeysRepository.cs b/src/Data/Repositories/KeysRepository.cs index b88df9c1..5f5ece6b 100644 --- a/src/Data/Repositories/KeysRepository.cs +++ b/src/Data/Repositories/KeysRepository.cs @@ -1,27 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using Microsoft.EntityFrameworkCore; +using NBitcoin; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; -using Microsoft.EntityFrameworkCore; -using NBitcoin; using Key = NodeGuard.Data.Models.Key; namespace NodeGuard.Data.Repositories @@ -157,4 +156,4 @@ public async Task GetCurrentInternalWalletKey(string accountId) return result; } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/LiquidityRuleRepository.cs b/src/Data/Repositories/LiquidityRuleRepository.cs index 8c0b34ad..fb9891ea 100644 --- a/src/Data/Repositories/LiquidityRuleRepository.cs +++ b/src/Data/Repositories/LiquidityRuleRepository.cs @@ -1,25 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories; @@ -120,4 +120,4 @@ public async Task> GetByNodePubKey(string nodePubKey) return result; } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/NodeRepository.cs b/src/Data/Repositories/NodeRepository.cs index 157b8004..2b55b044 100644 --- a/src/Data/Repositories/NodeRepository.cs +++ b/src/Data/Repositories/NodeRepository.cs @@ -1,27 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Services; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories { @@ -67,7 +66,7 @@ public NodeRepository(IRepository repository, .Include(x => x.ReturningFundsWallet) .SingleOrDefaultAsync(x => x.PubKey == key); } - + public async Task GetOrCreateByPubKey(string pubKey, ILightningService lightningService) { @@ -102,11 +101,11 @@ public async Task> GetAll() return await applicationDbContext.Nodes .Include(node => node.Users) - .Include(x=> x.ChannelOperationRequestsAsSource) + .Include(x => x.ChannelOperationRequestsAsSource) .ThenInclude(request => request.Channel) .Include(node => node.ChannelOperationRequestsAsDestination) .ThenInclude(request => request.Channel) - .Include(x=> x.ReturningFundsWallet) + .Include(x => x.ReturningFundsWallet) .ToListAsync(); } @@ -129,15 +128,15 @@ public async Task> GetAllManagedByNodeGuard(bool withDisabled = true) return resultAsync; } - + public async Task> GetAllManagedByUser(string userId) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); return await applicationDbContext.Nodes - .Include(x=> x.ReturningFundsWallet) - .Include(x=> x.ChannelOperationRequestsAsDestination) - .Include(x=> x.ChannelOperationRequestsAsSource) + .Include(x => x.ReturningFundsWallet) + .Include(x => x.ChannelOperationRequestsAsDestination) + .Include(x => x.ChannelOperationRequestsAsSource) .Where(node => node.Endpoint != null && node.Users.Any(user => user.Id == userId)) .ToListAsync(); @@ -154,7 +153,8 @@ public async Task> GetAllLoopdConfigured(string? userId = null) .Where(node => node.Endpoint != null) .Where(node => !string.IsNullOrEmpty(node.LoopdEndpoint) && !string.IsNullOrEmpty(node.LoopdMacaroon)); - if (!string.IsNullOrEmpty(userId)) { + if (!string.IsNullOrEmpty(userId)) + { query = query.Where(node => node.Users.Any(user => user.Id == userId)); } diff --git a/src/Data/Repositories/Repository.cs b/src/Data/Repositories/Repository.cs index 3bec0c5b..d08d8ba6 100644 --- a/src/Data/Repositories/Repository.cs +++ b/src/Data/Repositories/Repository.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Repositories.Interfaces; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Data.Repositories { @@ -25,8 +24,8 @@ namespace NodeGuard.Data.Repositories /// Class-less CRUD Entity manager. /// /// - /// - + /// + public class Repository : IRepository { private readonly ILogger _logger; @@ -42,7 +41,7 @@ public Task GetById(ApplicationDbContext applicationDbContext) throw new NotImplementedException(); } - public async Task> GetAll(ApplicationDbContext applicationDbContext) + public Task> GetAll(ApplicationDbContext applicationDbContext) { //TO BE IMPLEMENTED BY EACH REPOSITORY throw new NotImplementedException(); @@ -139,4 +138,4 @@ public async Task> GetAll(ApplicationDbContext applicationDbContext) return (rowsChanged, null); } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/SwapOutRepository.cs b/src/Data/Repositories/SwapOutRepository.cs index 58615419..f27ed02b 100644 --- a/src/Data/Repositories/SwapOutRepository.cs +++ b/src/Data/Repositories/SwapOutRepository.cs @@ -1,122 +1,120 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using AutoMapper; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Data.Repositories { - public class SwapOutRepository : ISwapOutRepository - { - private readonly IRepository _repository; - private readonly IDbContextFactory _dbContextFactory; - - public SwapOutRepository(IRepository repository, IDbContextFactory dbContextFactory) - { - _repository = repository; - _dbContextFactory = dbContextFactory; - } - - public async Task GetById(int id) - { - await using var context = await _dbContextFactory.CreateDbContextAsync(); - - var swap = await context.SwapOuts - .Include(s => s.DestinationWallet) - .Include(s => s.UserRequestor) - .SingleOrDefaultAsync(s => s.Id == id); - - return swap; - } - - public async Task> GetByIds(List ids) - { - await using var context = await _dbContextFactory.CreateDbContextAsync(); - - var swaps = await context.SwapOuts - .Include(s => s.DestinationWallet) - .Include(s => s.UserRequestor) - .Where(s => ids.Contains(s.Id)) - .ToListAsync(); - - return swaps; - } - - public async Task> GetAll() - { - await using var context = await _dbContextFactory.CreateDbContextAsync(); - - var swaps = await context.SwapOuts - .Include(s => s.DestinationWallet) - .ThenInclude(w => w!.Keys) - .Include(s => s.UserRequestor) - .Include(s => s.Node) - .ToListAsync(); - - return swaps; - } - - public async Task> GetAllPending() - { - await using var context = await _dbContextFactory.CreateDbContextAsync(); - - var swaps = await context.SwapOuts - .Include(s => s.DestinationWallet) - .Include(s => s.UserRequestor) - .Where(s => s.Status == SwapOutStatus.Pending) - .ToListAsync(); - - return swaps; - } - - public async Task<(bool, string?)> AddAsync(SwapOut swap) - { - await using var context = await _dbContextFactory.CreateDbContextAsync(); - - swap.SetCreationDatetime(); - swap.SetUpdateDatetime(); - - return await _repository.AddAsync(swap, context); - } - - public async Task<(bool, string?)> AddRangeAsync(List swaps) - { - await using var context = await _dbContextFactory.CreateDbContextAsync(); - - foreach (var swap in swaps) - { + public class SwapOutRepository : ISwapOutRepository + { + private readonly IRepository _repository; + private readonly IDbContextFactory _dbContextFactory; + + public SwapOutRepository(IRepository repository, IDbContextFactory dbContextFactory) + { + _repository = repository; + _dbContextFactory = dbContextFactory; + } + + public async Task GetById(int id) + { + await using var context = await _dbContextFactory.CreateDbContextAsync(); + + var swap = await context.SwapOuts + .Include(s => s.DestinationWallet) + .Include(s => s.UserRequestor) + .SingleOrDefaultAsync(s => s.Id == id); + + return swap; + } + + public async Task> GetByIds(List ids) + { + await using var context = await _dbContextFactory.CreateDbContextAsync(); + + var swaps = await context.SwapOuts + .Include(s => s.DestinationWallet) + .Include(s => s.UserRequestor) + .Where(s => ids.Contains(s.Id)) + .ToListAsync(); + + return swaps; + } + + public async Task> GetAll() + { + await using var context = await _dbContextFactory.CreateDbContextAsync(); + + var swaps = await context.SwapOuts + .Include(s => s.DestinationWallet) + .ThenInclude(w => w!.Keys) + .Include(s => s.UserRequestor) + .Include(s => s.Node) + .ToListAsync(); + + return swaps; + } + + public async Task> GetAllPending() + { + await using var context = await _dbContextFactory.CreateDbContextAsync(); + + var swaps = await context.SwapOuts + .Include(s => s.DestinationWallet) + .Include(s => s.UserRequestor) + .Where(s => s.Status == SwapOutStatus.Pending) + .ToListAsync(); + + return swaps; + } + + public async Task<(bool, string?)> AddAsync(SwapOut swap) + { + await using var context = await _dbContextFactory.CreateDbContextAsync(); + swap.SetCreationDatetime(); swap.SetUpdateDatetime(); - } - return await _repository.AddRangeAsync(swaps, context); - } + return await _repository.AddAsync(swap, context); + } - public (bool, string?) Update(SwapOut swap) - { - using var context = _dbContextFactory.CreateDbContext(); + public async Task<(bool, string?)> AddRangeAsync(List swaps) + { + await using var context = await _dbContextFactory.CreateDbContextAsync(); - swap.SetUpdateDatetime(); + foreach (var swap in swaps) + { + swap.SetCreationDatetime(); + swap.SetUpdateDatetime(); + } + + return await _repository.AddRangeAsync(swaps, context); + } + + public (bool, string?) Update(SwapOut swap) + { + using var context = _dbContextFactory.CreateDbContext(); + + swap.SetUpdateDatetime(); - return _repository.Update(swap, context); - } - } -} \ No newline at end of file + return _repository.Update(swap, context); + } + } +} diff --git a/src/Data/Repositories/UTXOTagRepository.cs b/src/Data/Repositories/UTXOTagRepository.cs index a595602b..6211084e 100644 --- a/src/Data/Repositories/UTXOTagRepository.cs +++ b/src/Data/Repositories/UTXOTagRepository.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; @@ -9,7 +25,7 @@ public class UTXOTagRepository : IUTXOTagRepository private readonly IRepository _repository; private readonly ILogger _logger; private readonly IDbContextFactory _dbContextFactory; - + public UTXOTagRepository(IRepository repository, ILogger logger, IDbContextFactory dbContextFactory) @@ -18,25 +34,25 @@ public UTXOTagRepository(IRepository repository, _logger = logger; _dbContextFactory = dbContextFactory; } - + public async Task> GetByOutpoint(string outpoint) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); - + return await applicationDbContext.UTXOTags.Where(x => x.Outpoint == outpoint).ToListAsync(); } public async Task GetByKeyAndOutpoint(string key, string outpoint) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); - + return await applicationDbContext.UTXOTags.FirstOrDefaultAsync(x => x.Key == key && x.Outpoint == outpoint); } public async Task> GetByKeyValue(string key, string value) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); - + return await applicationDbContext.UTXOTags .Where(x => x.Key == key && x.Value == value).ToListAsync(); } @@ -44,9 +60,9 @@ public async Task> GetByKeyValue(string key, string value) public async Task<(bool, string?)> AddAsync(UTXOTag type) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); - + type.SetCreationDatetime(); - + return await _repository.AddAsync(type, applicationDbContext); } @@ -103,14 +119,14 @@ public async Task> GetByKeyValue(string key, string value) public (bool, string?) Remove(UTXOTag type) { using var applicationDbContext = _dbContextFactory.CreateDbContext(); - + return _repository.Remove(type, applicationDbContext); } public (bool, string?) RemoveRange(List types) { using var applicationDbContext = _dbContextFactory.CreateDbContext(); - + return _repository.RemoveRange(types, applicationDbContext); } @@ -119,7 +135,7 @@ public async Task> GetByKeyValue(string key, string value) using var applicationDbContext = _dbContextFactory.CreateDbContext(); type.SetUpdateDatetime(); - + return _repository.Update(type, applicationDbContext); } } diff --git a/src/Data/Repositories/WalletRepository.cs b/src/Data/Repositories/WalletRepository.cs index 2144ef93..57e1e0dd 100644 --- a/src/Data/Repositories/WalletRepository.cs +++ b/src/Data/Repositories/WalletRepository.cs @@ -1,30 +1,29 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; -using NodeGuard.Services; using Microsoft.EntityFrameworkCore; using NBitcoin; using NBXplorer.DerivationStrategy; using Nodeguard; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; +using NodeGuard.Services; using Key = NodeGuard.Data.Models.Key; using Wallet = NodeGuard.Data.Models.Wallet; @@ -387,7 +386,8 @@ public async Task GetNextSubderivationPath() return (true, null); } - public async Task TrackAndScanWallet(Wallet wallet){ + public async Task TrackAndScanWallet(Wallet wallet) + { var derivationStrategyBase = wallet.GetDerivationStrategy(); if (derivationStrategyBase == null) @@ -426,7 +426,7 @@ public async Task TrackAndScanWallet(Wallet wallet){ CreationDatetime = DateTimeOffset.UtcNow, Name = "Imported key from output descriptor", XPUB = x.Item1.ToString() ?? throw new InvalidOperationException(), - Description =null, + Description = null, MasterFingerprint = x.Item2.MasterFingerprint.ToString(), Path = x.Item2.KeyPath.ToString(), IsBIP39ImportedKey = false, @@ -520,4 +520,4 @@ public async Task TrackAndScanWallet(Wallet wallet){ return result; } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/WalletWithdrawalRequestDestinationRepository.cs b/src/Data/Repositories/WalletWithdrawalRequestDestinationRepository.cs index 6f3ec81b..0460b166 100644 --- a/src/Data/Repositories/WalletWithdrawalRequestDestinationRepository.cs +++ b/src/Data/Repositories/WalletWithdrawalRequestDestinationRepository.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories { diff --git a/src/Data/Repositories/WalletWithdrawalRequestPsbtRepository.cs b/src/Data/Repositories/WalletWithdrawalRequestPsbtRepository.cs index d1969ef1..6ec1bdce 100644 --- a/src/Data/Repositories/WalletWithdrawalRequestPsbtRepository.cs +++ b/src/Data/Repositories/WalletWithdrawalRequestPsbtRepository.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; namespace NodeGuard.Data.Repositories { @@ -45,7 +44,7 @@ public WalletWithdrawalRequestPsbtRepository(IRepository x.Id == id); } - public async Task> GetAll() + public Task> GetAll() { throw new NotImplementedException(); } @@ -62,7 +61,7 @@ public async Task> GetAll() x.Id == type.WalletWithdrawalRequestId); try { - if (request != null && !type.IsTemplatePSBT ) + if (request != null && !type.IsTemplatePSBT) { request.Status = WalletWithdrawalRequestStatus.PSBTSignaturesPending; @@ -109,4 +108,4 @@ public async Task> GetAll() return _repository.Update(type, applicationDbContext); } } -} \ No newline at end of file +} diff --git a/src/Data/Repositories/WalletWithdrawalRequestRepository.cs b/src/Data/Repositories/WalletWithdrawalRequestRepository.cs index 46fd702f..12ef4aa1 100644 --- a/src/Data/Repositories/WalletWithdrawalRequestRepository.cs +++ b/src/Data/Repositories/WalletWithdrawalRequestRepository.cs @@ -1,29 +1,28 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; using Humanizer; using Microsoft.EntityFrameworkCore; using NBitcoin; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Services; using Exception = System.Exception; namespace NodeGuard.Data.Repositories @@ -130,6 +129,7 @@ public async Task> GetAllUnsignedPendingRequests() .ToListAsync(); } + [Obsolete] public async Task<(bool, string?)> AddAsync(WalletWithdrawalRequest type) { await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); diff --git a/src/Helpers/ChannelState.cs b/src/Helpers/ChannelState.cs index 890ccc0a..99657eee 100644 --- a/src/Helpers/ChannelState.cs +++ b/src/Helpers/ChannelState.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + namespace NodeGuard.Helpers; public class ChannelState @@ -5,4 +21,4 @@ public class ChannelState public long LocalBalance { get; set; } public long RemoteBalance { get; set; } public bool Active { get; set; } -} \ No newline at end of file +} diff --git a/src/Helpers/ChannelStatusLog.cs b/src/Helpers/ChannelStatusLog.cs index 14242108..046f5dd3 100644 --- a/src/Helpers/ChannelStatusLog.cs +++ b/src/Helpers/ChannelStatusLog.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Text.Json.Serialization; namespace NodeGuard.Helpers; @@ -7,7 +23,7 @@ public class ChannelStatusLog public DateTime DateTime { get; set; } public LogLevel Level { get; set; } public string Description { get; set; } - + [JsonConstructor] public ChannelStatusLog(DateTime dateTime, LogLevel level, string description) { @@ -15,26 +31,26 @@ public ChannelStatusLog(DateTime dateTime, LogLevel level, string description) Level = level; Description = description; } - + public ChannelStatusLog(LogLevel level, string description) { DateTime = DateTime.Now; Level = level; Description = description; } - + public static ChannelStatusLog Info(string description) { return new ChannelStatusLog(LogLevel.Information, description); } - + public static ChannelStatusLog Error(string description) { return new ChannelStatusLog(LogLevel.Error, description); } - + public static ChannelStatusLog Warning(string description) { return new ChannelStatusLog(LogLevel.Warning, description); } -} \ No newline at end of file +} diff --git a/src/Helpers/ColumnHelpers.cs b/src/Helpers/ColumnHelpers.cs index b76fb97a..1492d43e 100644 --- a/src/Helpers/ColumnHelpers.cs +++ b/src/Helpers/ColumnHelpers.cs @@ -1,28 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + namespace NodeGuard.Helpers; public class ColumnDefault { public string Name { get; } - public bool Visibility { get; } + public bool Visibility { get; } public ColumnDefault(string name, bool visibility = true) { diff --git a/src/Helpers/Constants.cs b/src/Helpers/Constants.cs index 3feb6dd5..5eef3af3 100644 --- a/src/Helpers/Constants.cs +++ b/src/Helpers/Constants.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Globalization; using System.Reflection; using NBitcoin; @@ -62,7 +61,7 @@ public class Constants public static readonly string MONITOR_CHANNELS_CRON = "0 0 */1 * * ?"; public static readonly string JOB_RETRY_INTERVAL_LIST_IN_MINUTES = "1,2,5,10,20"; /// - /// The interval in minutes for the SweepAllNodesWalletsJob to run. + /// The interval in minutes for the SweepAllNodesWalletsJob to run. /// This job sweeps funds from all lightning node wallets. Default is 15 minutes. /// Can be configured via SWEEP_ALL_NODES_WALLETS_INTERVAL_MINUTES environment variable. /// diff --git a/src/Helpers/CreateWallet.cs b/src/Helpers/CreateWallet.cs index 6d0e88b4..7d37addb 100644 --- a/src/Helpers/CreateWallet.cs +++ b/src/Helpers/CreateWallet.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ -using NodeGuard.Data.Models; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NBitcoin; +using NodeGuard.Data.Models; using Key = NodeGuard.Data.Models.Key; namespace NodeGuard.TestHelpers; @@ -35,7 +34,7 @@ public static InternalWallet CreateInternalWallet(ILogger? logger = null) }; // force the saving of the master fingerprint internalWallet.MasterFingerprint = internalWallet.MasterFingerprint; - + logger?.LogInformation("Internal wallet setup, seed: {MnemonicString}", internalWallet.MnemonicString); return internalWallet; } @@ -47,9 +46,9 @@ private static Key CreateInternalKey(InternalWallet internalWallet, string accou Name = "NodeGuard Co-signing Key", XPUB = internalWallet.GetXpubForAccount(accountId), InternalWalletId = internalWallet.Id, - Path = internalWallet.GetKeyPathForAccount(accountId), + Path = internalWallet.GetKeyPathForAccount(accountId), MasterFingerprint = internalWallet.MasterFingerprint - }; + }; } public static Key CreateUserKey(string keyName, string userId, string walletSeed) @@ -71,7 +70,7 @@ public static Key CreateUserKey(string keyName, string userId, string walletSeed MasterFingerprint = accountKeyPath1.MasterFingerprint.ToString(), }; } - + public static Wallet SingleSig(InternalWallet internalWallet, string accountId = "1") { var internalWalletKey = CreateInternalKey(internalWallet, accountId); @@ -143,13 +142,13 @@ public static Wallet MultiSig(InternalWallet internalWallet, string accountId = "social mango annual basic work brain economy one safe physical junk other toy valid load cook napkin maple runway island oil fan legend stem"; var wallet2Seed = "solar goat auto bachelor chronic input twin depth fork scale divorce fury mushroom column image sauce car public artist announce treat spend jacket physical"; - + logger?.LogInformation("Wallet 1 seed: {MnemonicString}", wallet1Seed); logger?.LogInformation("Wallet 2 seed: {MnemonicString}", wallet2Seed); var user1Key = CreateUserKey("Key 1", user1, wallet1Seed); var user2Key = CreateUserKey("Key 2", user2, wallet2Seed); - + return MultiSig(internalWallet, accountId, user1Key, user2Key); } @@ -196,4 +195,4 @@ public static Wallet LegacyMultiSig(InternalWallet internalWallet, string accoun return MultiSig(internalWallet, accountId, user1Key, user2Key); } -} \ No newline at end of file +} diff --git a/src/Helpers/CurrentNetworkHelper.cs b/src/Helpers/CurrentNetworkHelper.cs index d4c9186b..f4719478 100644 --- a/src/Helpers/CurrentNetworkHelper.cs +++ b/src/Helpers/CurrentNetworkHelper.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using NBitcoin; + + +using NBitcoin; namespace NodeGuard.Helpers { @@ -41,4 +40,4 @@ public static Network GetCurrentNetwork() return result; } } -} \ No newline at end of file +} diff --git a/src/Helpers/CustomExceptions.cs b/src/Helpers/CustomExceptions.cs index 34e9fc72..eab6f206 100644 --- a/src/Helpers/CustomExceptions.cs +++ b/src/Helpers/CustomExceptions.cs @@ -1,40 +1,56 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + namespace NodeGuard.Helpers; -public class NoUTXOsAvailableException: Exception {} +public class NoUTXOsAvailableException : Exception { } -public class UTXOsNoLongerValidException: Exception {} +public class UTXOsNoLongerValidException : Exception { } -public class NBXplorerNotFullySyncedException: Exception +public class NBXplorerNotFullySyncedException : Exception { - public NBXplorerNotFullySyncedException(): base("Error, nbxplorer not fully synched") {} + public NBXplorerNotFullySyncedException() : base("Error, nbxplorer not fully synched") { } } public class ShowToUserException : Exception { - public ShowToUserException(string? message): base(message) {} + public ShowToUserException(string? message) : base(message) { } } public class PeerNotOnlineException : Exception { - public PeerNotOnlineException(string? message = null): base(message) {} + public PeerNotOnlineException(string? message = null) : base(message) { } } public class RemoteCanceledFundingException : Exception { - public RemoteCanceledFundingException(string? message = null): base(message) {} + public RemoteCanceledFundingException(string? message = null) : base(message) { } } public class NotEnoughRoomInUtxosForFeesException : Exception { - public NotEnoughRoomInUtxosForFeesException(): base("Not enough room in the UTXOs to cover the fees") {} + public NotEnoughRoomInUtxosForFeesException() : base("Not enough room in the UTXOs to cover the fees") { } } public class NotEnoughBalanceInWalletException : Exception { - public NotEnoughBalanceInWalletException(string? message = null): base(message) {} + public NotEnoughBalanceInWalletException(string? message = null) : base(message) { } } public class BumpingException : Exception { - public BumpingException(string? message = null): base(message) {} -} \ No newline at end of file + public BumpingException(string? message = null) : base(message) { } +} diff --git a/src/Helpers/DatadogLogEnricher.cs b/src/Helpers/DatadogLogEnricher.cs index d8dc7e66..c9e80fdd 100644 --- a/src/Helpers/DatadogLogEnricher.cs +++ b/src/Helpers/DatadogLogEnricher.cs @@ -1,27 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Diagnostics; -using Serilog.Events; using Serilog.Core; +using Serilog.Events; namespace NodeGuard.Helpers; + public class DatadogLogEnricher : ILogEventEnricher { public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) @@ -43,4 +43,4 @@ public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) logEvent.AddPropertyIfAbsent(new LogEventProperty("dd.span_id", new ScalarValue(ddSpanId))); } } -} \ No newline at end of file +} diff --git a/src/Helpers/GRPCLoggerFactoryHelper.cs b/src/Helpers/GRPCLoggerFactoryHelper.cs index e7a07930..578f54b9 100644 --- a/src/Helpers/GRPCLoggerFactoryHelper.cs +++ b/src/Helpers/GRPCLoggerFactoryHelper.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -namespace NodeGuard.Helpers + + +namespace NodeGuard.Helpers { public class GRPCLoggerFactoryHelper { @@ -32,4 +31,4 @@ public static ILoggerFactory LoggerFactory() return loggerFactory; } } -} \ No newline at end of file +} diff --git a/src/Helpers/JobTypes.cs b/src/Helpers/JobTypes.cs index ebe93881..a2aae57b 100644 --- a/src/Helpers/JobTypes.cs +++ b/src/Helpers/JobTypes.cs @@ -1,25 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Quartz; -using Quartz.Impl; -using Quartz.Impl.Matchers; using Quartz.Impl.Triggers; namespace NodeGuard.Helpers; @@ -46,7 +43,7 @@ public static JobAndTrigger Create(JobDataMap data, string identitySuffix) wh return new JobAndTrigger(job, trigger); } - + public static async Task Reschedule(IScheduler scheduler, string identitySuffix) where T : IJob { try @@ -57,7 +54,7 @@ public static async Task Reschedule(IScheduler scheduler, string identitySuff .WithIdentity($"{typeof(T).Name}Trigger-{identitySuffix}") .StartNow() .Build(); - + await scheduler.RescheduleJob(triggerKey, trigger); } @@ -66,7 +63,7 @@ public static async Task Reschedule(IScheduler scheduler, string identitySuff Console.WriteLine($"Unexpected error rescheduling job of type {typeof(T).Name} with identity suffix {identitySuffix}: {ex.Message}"); } } - + public static async Task DeleteJob(IScheduler scheduler, string identitySuffix) where T : IJob { try @@ -85,7 +82,7 @@ public static async Task IsJobExists(IScheduler scheduler, string ident JobKey jobKey = new JobKey($"{typeof(T).Name}-{identitySuffix}"); return await scheduler.CheckExists(jobKey); } - + } public class RetriableJob @@ -232,4 +229,4 @@ public JobAndTrigger(IJobDetail job, ITrigger trigger) Job = job; Trigger = trigger; } -} \ No newline at end of file +} diff --git a/src/Helpers/LightningHelper.cs b/src/Helpers/LightningHelper.cs index 9ff27374..8dae732b 100644 --- a/src/Helpers/LightningHelper.cs +++ b/src/Helpers/LightningHelper.cs @@ -1,28 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using NodeGuard.Data.Models; -using NodeGuard.Services; using Google.Protobuf; using NBitcoin; using NBXplorer; using NBXplorer.Models; +using NodeGuard.Data.Models; +using NodeGuard.Services; namespace NodeGuard.Helpers { @@ -120,7 +119,7 @@ public static void RemoveDuplicateUTXOs(this UTXOChanges utxoChanges) /// /// /// - public static async Task CreateNBExplorerClient() + public static Task CreateNBExplorerClient() { //Nbxplorer api client var nbXplorerNetwork = CurrentNetworkHelper.GetCurrentNetwork(); @@ -129,7 +128,7 @@ public static async Task CreateNBExplorerClient() var nbxplorerClient = new ExplorerClient( provider.GetFromCryptoCode(nbXplorerNetwork.NetworkSet.CryptoCode), new Uri(Constants.NBXPLORER_URI)); - return nbxplorerClient; + return Task.FromResult(nbxplorerClient); } /// @@ -140,7 +139,7 @@ public static async Task CreateNBExplorerClient() /// /// /// - public static async Task> SelectUTXOsByOldest( + public static Task> SelectUTXOsByOldest( Wallet wallet, long satsAmount, List availableUTXOs, ILogger logger) { if (wallet == null) throw new ArgumentNullException(nameof(wallet)); @@ -154,7 +153,7 @@ public static async Task> SelectUTXOsByOldest( { logger.LogError("The PSBT cannot be generated, no UTXOs are available for walletId: {WalletId}", wallet.Id); - return selectedUTXOs; + return Task.FromResult(selectedUTXOs); } var utxosStack = new Stack(availableUTXOs.OrderByDescending(x => x.Confirmations)); @@ -168,7 +167,7 @@ public static async Task> SelectUTXOsByOldest( logger.LogError( "Error, the total UTXOs set balance for walletid: {WalletId} ({AvailableSats} sats) is less than the amount in the request ({RequestedSats} sats)", wallet.Id, totalUTXOsConfirmedSats, satsAmount); - return selectedUTXOs; + return Task.FromResult(selectedUTXOs); } var utxosSatsAmountAccumulator = 0M; @@ -190,7 +189,7 @@ public static async Task> SelectUTXOsByOldest( } } - return selectedUTXOs; + return Task.FromResult(selectedUTXOs); } /// @@ -199,7 +198,7 @@ public static async Task> SelectUTXOsByOldest( /// /// /// - public static async Task> SelectCoins(Wallet wallet, List selectedUTXOs) + public static Task> SelectCoins(Wallet wallet, List selectedUTXOs) { if (wallet == null) throw new ArgumentNullException(nameof(wallet)); if (wallet == null) throw new ArgumentNullException(nameof(wallet)); @@ -207,7 +206,7 @@ public static async Task> SelectCoins(Wallet wallet, List sele var derivationStrategy = wallet.GetDerivationStrategy(); //UTXOS to Enumerable of ICOINS - return selectedUTXOs.Select(x => + return Task.FromResult(selectedUTXOs.Select(x => { var coin = x.AsCoin(derivationStrategy); if (wallet.IsHotWallet) @@ -217,7 +216,7 @@ public static async Task> SelectCoins(Wallet wallet, List sele return coin.ToScriptCoin(x.ScriptPubKey); }) - .ToList(); + .ToList()); } /// @@ -291,4 +290,4 @@ public static string DecodeTxId(ByteString TxIdBytes) .ToLower(); } } -} \ No newline at end of file +} diff --git a/src/Helpers/LowerCaseJsonFormatter.cs b/src/Helpers/LowerCaseJsonFormatter.cs index 41a41fa1..755034e1 100644 --- a/src/Helpers/LowerCaseJsonFormatter.cs +++ b/src/Helpers/LowerCaseJsonFormatter.cs @@ -1,4 +1,19 @@ -using Blazorise; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Serilog.Events; using Serilog.Formatting; using Serilog.Formatting.Json; diff --git a/src/Helpers/StringHelper.cs b/src/Helpers/StringHelper.cs index 5dee880e..6e95fef1 100644 --- a/src/Helpers/StringHelper.cs +++ b/src/Helpers/StringHelper.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Humanizer; @@ -79,4 +78,4 @@ public static bool IsTrue(string? str) return lowerStr == "true" || str == "1" || lowerStr == "yes"; } } -} \ No newline at end of file +} diff --git a/src/Helpers/ToastOnException.cs b/src/Helpers/ToastOnException.cs index bfc6db48..7bb4c1b1 100644 --- a/src/Helpers/ToastOnException.cs +++ b/src/Helpers/ToastOnException.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Blazored.Toast.Services; namespace NodeGuard.Helpers; @@ -37,4 +53,4 @@ public static T Execute(Func action, ILogger logger, IToastService toastSe return defaultValue; } -} \ No newline at end of file +} diff --git a/src/Helpers/ValidationHelper.cs b/src/Helpers/ValidationHelper.cs index 3ff4f325..8129d0e8 100644 --- a/src/Helpers/ValidationHelper.cs +++ b/src/Helpers/ValidationHelper.cs @@ -1,26 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Text.RegularExpressions; using Blazorise; -using NodeGuard.Data.Models; using NBitcoin; +using NodeGuard.Data.Models; namespace NodeGuard.Helpers; @@ -181,4 +180,4 @@ public static bool IsValidEmail(string email) return false; } } -} \ No newline at end of file +} diff --git a/src/Helpers/WalletParser.cs b/src/Helpers/WalletParser.cs index 83a4d745..98f35e1f 100644 --- a/src/Helpers/WalletParser.cs +++ b/src/Helpers/WalletParser.cs @@ -1,5 +1,19 @@ -using System.Text; -using Humanizer; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NBitcoin; using NBitcoin.Scripting; using NBXplorer.DerivationStrategy; @@ -50,7 +64,7 @@ public static (DerivationStrategyBase, (BitcoinExtPubKey, RootedKeyPath)[]) Pars "Legacy multisig is not supported, please use segwit multisig instead."); case OutputDescriptor.WPKH wpkh: return ExtractFromPkProvider(wpkh.PkProvider, ""); - case OutputDescriptor.WSH {Inner: OutputDescriptor.Multi multi}: + case OutputDescriptor.WSH { Inner: OutputDescriptor.Multi multi }: return ExtractFromMulti(multi); case OutputDescriptor.WSH: throw new FormatException("wsh descriptors are only supported with multisig"); @@ -61,14 +75,14 @@ public static (DerivationStrategyBase, (BitcoinExtPubKey, RootedKeyPath)[]) Pars (DerivationStrategyBase, (BitcoinExtPubKey, RootedKeyPath)[]) ExtractFromMulti(OutputDescriptor.Multi multi) { var multiPkProviders = multi.PkProviders; - + var xpubs = multiPkProviders.Select(provider => ExtractFromPkProvider(provider)).ToArray(); var xpubsStrings = xpubs.Select(tuple => tuple.Item1.ToString()).ToArray(); - - if(multi.IsSorted) + + if (multi.IsSorted) xpubsStrings = xpubsStrings.OrderBy(x => x).ToArray(); - + var extractFromMulti = ( Parse( $"{multi.Threshold}-of-{(string.Join('-', xpubsStrings))}{(multi.IsSorted ? "" : "-[keeporder]")}"), @@ -95,7 +109,7 @@ public static (DerivationStrategyBase, (BitcoinExtPubKey, RootedKeyPath)[]) Pars var innerResult = ExtractFromPkProvider(origin.Inner, suffix); var bitcoinExtPubKey = innerResult.Item1.GetExtPubKeys().First().GetWif(currentNetwork); var rootedKeyPath = origin.KeyOriginInfo; - return (innerResult.Item1, new[] {(extPubKey: bitcoinExtPubKey, KeyOriginInfo: rootedKeyPath)}); + return (innerResult.Item1, new[] { (extPubKey: bitcoinExtPubKey, KeyOriginInfo: rootedKeyPath) }); default: throw new ArgumentOutOfRangeException(); } @@ -145,7 +159,7 @@ public static string GetOutputDescriptor(this Wallet wallet, string bitcoinNetwo KeyPath.Parse(key.Path) ); pubKeyProvider = PubKeyProvider.NewOrigin(rootedKeyPath, pubKeyProvider); - + switch (wallet.WalletAddressType) { case WalletAddressType.NativeSegwit: @@ -189,7 +203,7 @@ public static string GetOutputDescriptor(this Wallet wallet, string bitcoinNetwo pubKeyProviders, !wallet.IsUnSortedMultiSig, network); - + switch (wallet.WalletAddressType) { case WalletAddressType.NativeSegwit: @@ -207,7 +221,7 @@ public static string GetOutputDescriptor(this Wallet wallet, string bitcoinNetwo return outputDescriptor is not null ? outputDescriptor.ToString() : throw new Exception("Something went wrong"); } - + /// /// Converts a hexadecimal string representation of a master fingerprint into a byte array. /// @@ -224,4 +238,4 @@ public static byte[] GetMasterFingerprint(string masterFingerprint) .ToArray(); return internalBytes; } -} \ No newline at end of file +} diff --git a/src/Jobs/ChannelAcceptorJob.cs b/src/Jobs/ChannelAcceptorJob.cs index 5a2c9031..01a09f64 100644 --- a/src/Jobs/ChannelAcceptorJob.cs +++ b/src/Jobs/ChannelAcceptorJob.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; diff --git a/src/Jobs/ChannelCloseJob.cs b/src/Jobs/ChannelCloseJob.cs index 1d8d77d6..bc331737 100644 --- a/src/Jobs/ChannelCloseJob.cs +++ b/src/Jobs/ChannelCloseJob.cs @@ -1,28 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; using NodeGuard.Helpers; -using NodeGuard.Data.Models; +using NodeGuard.Services; using Quartz; -using Quartz.Impl.Triggers; namespace NodeGuard.Jobs; @@ -74,4 +72,4 @@ await RetriableJob.OnFail(context, async () => _logger.LogInformation("{JobName} ended", nameof(ChannelCloseJob)); } -} \ No newline at end of file +} diff --git a/src/Jobs/ChannelMonitorJob.cs b/src/Jobs/ChannelMonitorJob.cs index e7bd4a6b..8a28184b 100644 --- a/src/Jobs/ChannelMonitorJob.cs +++ b/src/Jobs/ChannelMonitorJob.cs @@ -1,29 +1,28 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using Google.Protobuf; +using Lnrpc; +using Microsoft.EntityFrameworkCore; using NodeGuard.Data; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Services; -using Google.Protobuf; -using Lnrpc; -using Microsoft.EntityFrameworkCore; using Quartz; using Channel = Lnrpc.Channel; using ChannelStatus = NodeGuard.Data.Models.Channel.ChannelStatus; @@ -139,17 +138,18 @@ public async Task RecoverGhostChannels(Node source, Node destination, Channel ch try { await using var dbContext = await _dbContextFactory.CreateDbContextAsync(); - + var channelPoint = channel.ChannelPoint.Split(":"); var fundingTx = channelPoint[0]; var outputIndex = Convert.ToUInt32(channelPoint[1]); - var channelExists = await dbContext.Channels.AnyAsync(c => c.FundingTx.Equals(fundingTx) && c.FundingTxOutputIndex == outputIndex); + var channelExists = await dbContext.Channels.AnyAsync(c => c.FundingTx.Equals(fundingTx, StringComparison.Ordinal) && c.FundingTxOutputIndex == outputIndex); if (channelExists) return; var parsedChannelPoint = new ChannelPoint { - FundingTxidStr = fundingTx, FundingTxidBytes = ByteString.CopyFrom(Convert.FromHexString(fundingTx).Reverse().ToArray()), + FundingTxidStr = fundingTx, + FundingTxidBytes = ByteString.CopyFrom(Convert.FromHexString(fundingTx).Reverse().ToArray()), OutputIndex = outputIndex }; @@ -214,4 +214,4 @@ public async Task MarkClosedChannelsAsClosed(Node source, List? channel _logger.LogError(e, "Error while marking closed channels as closed, {SourceNodeId}: {Error}", source.Id, e); } } -} \ No newline at end of file +} diff --git a/src/Jobs/ChannelOpenJob.cs b/src/Jobs/ChannelOpenJob.cs index 9e530f68..f89a6acf 100644 --- a/src/Jobs/ChannelOpenJob.cs +++ b/src/Jobs/ChannelOpenJob.cs @@ -1,28 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; using NodeGuard.Helpers; -using NodeGuard.Data.Models; +using NodeGuard.Services; using Quartz; -using Quartz.Impl.Triggers; namespace NodeGuard.Jobs; @@ -115,4 +113,4 @@ private async Task LogToChannelRequest(int openRequestId, Exception e, IJo return true; } -} \ No newline at end of file +} diff --git a/src/Jobs/MonitorChannelsJob.cs b/src/Jobs/MonitorChannelsJob.cs index 72dd7e16..da562ce9 100644 --- a/src/Jobs/MonitorChannelsJob.cs +++ b/src/Jobs/MonitorChannelsJob.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; using Quartz; diff --git a/src/Jobs/MonitorSwapsJob.cs b/src/Jobs/MonitorSwapsJob.cs index 5f5d07dd..9f20bdc5 100644 --- a/src/Jobs/MonitorSwapsJob.cs +++ b/src/Jobs/MonitorSwapsJob.cs @@ -1,6 +1,21 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; using NodeGuard.Services; using Quartz; diff --git a/src/Jobs/MonitorWithdrawalsJob.cs b/src/Jobs/MonitorWithdrawalsJob.cs index c1ecf2d4..cac33950 100644 --- a/src/Jobs/MonitorWithdrawalsJob.cs +++ b/src/Jobs/MonitorWithdrawalsJob.cs @@ -1,26 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using NBitcoin; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Services; -using NBitcoin; using Quartz; namespace NodeGuard.Jobs; @@ -57,7 +56,7 @@ public async Task Execute(IJobExecutionContext context) try { //Let's check if the minimum amount of confirmations are established - + var getTxResult = await _nbXplorerService.GetTransactionAsync(uint256.Parse(walletWithdrawalRequest.TxId), default); if (getTxResult.Confirmations >= Constants.TRANSACTION_CONFIRMATION_MINIMUM_BLOCKS) @@ -91,4 +90,4 @@ public async Task Execute(IJobExecutionContext context) _logger.LogInformation($"Job {nameof(MonitorWithdrawalsJob)} ended"); } -} \ No newline at end of file +} diff --git a/src/Jobs/NodeChannelSubscribeJob.cs b/src/Jobs/NodeChannelSubscribeJob.cs index 146a7981..57fa2a1c 100644 --- a/src/Jobs/NodeChannelSubscribeJob.cs +++ b/src/Jobs/NodeChannelSubscribeJob.cs @@ -1,26 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; using Grpc.Core; using Lnrpc; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Services; using Quartz; using Channel = NodeGuard.Data.Models.Channel; using Node = NodeGuard.Data.Models.Node; @@ -87,18 +86,18 @@ public async Task Execute(IJobExecutionContext context) _logger.LogError(e, "Error reading and update event of node {NodeId}", nodeId); throw new JobExecutionException(e, true); } - - + + } - - + + } catch (Exception e) { _logger.LogError(e, "Error while subscribing for the channel updates of node {NodeId}", nodeId); //Sleep to avoid massive requests await Task.Delay(5000); - + throw new JobExecutionException(e, true); } diff --git a/src/Jobs/NodeSubscriptorJob.cs b/src/Jobs/NodeSubscriptorJob.cs index 4a030f1b..a1e6f709 100644 --- a/src/Jobs/NodeSubscriptorJob.cs +++ b/src/Jobs/NodeSubscriptorJob.cs @@ -1,4 +1,19 @@ -using NodeGuard.Data.Repositories; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; using Quartz; @@ -26,7 +41,7 @@ public async Task Execute(IJobExecutionContext context) var managedNodes = await _nodeRepository.GetAllManagedByNodeGuard(false); var scheduler = await _schedulerFactory.GetScheduler(); - + foreach (var managedNode in managedNodes) { if (managedNode.ChannelAdminMacaroon != null) @@ -35,7 +50,7 @@ public async Task Execute(IJobExecutionContext context) map.Put("nodeId", managedNode.Id.ToString()); var job = SimpleJob.Create(map, managedNode.Id.ToString()); await scheduler.ScheduleJob(job.Job, job.Trigger); - + var jobUpateResult = _nodeRepository.Update(managedNode); } } @@ -45,7 +60,7 @@ public async Task Execute(IJobExecutionContext context) _logger.LogError(e, "Error on {JobName}", nameof(NodeSubscriptorJob)); throw new JobExecutionException(e, false); } - + _logger.LogInformation("{JobName} ended", nameof(NodeSubscriptorJob)); } } diff --git a/src/Jobs/PerformWithdrawalJob.cs b/src/Jobs/PerformWithdrawalJob.cs index ba016d3c..d7a4f8ae 100644 --- a/src/Jobs/PerformWithdrawalJob.cs +++ b/src/Jobs/PerformWithdrawalJob.cs @@ -1,28 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Services; -using NodeGuard.Helpers; -using NodeGuard.Data.Models; using Quartz; -using Quartz.Impl.Triggers; namespace NodeGuard.Jobs; diff --git a/src/Jobs/ProcessNodeChannelAcceptorJob.cs b/src/Jobs/ProcessNodeChannelAcceptorJob.cs index 25f32e7e..7ccae3c8 100644 --- a/src/Jobs/ProcessNodeChannelAcceptorJob.cs +++ b/src/Jobs/ProcessNodeChannelAcceptorJob.cs @@ -1,30 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; -using NodeGuard.Services; using Grpc.Core; -using Grpc.Net.Client; using Lnrpc; using NBXplorer.DerivationStrategy; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Services; using Quartz; namespace NodeGuard.Jobs; @@ -87,7 +84,7 @@ async Task AcceptChannelOpeningRequestWithUpfrontShutdown(INBXplorerService nbXp var openerNodePubKey = Convert.ToHexString(response.NodePubkey.ToByteArray()).ToLower(); var capacity = response.FundingAmt; - var address = await _nBXplorerService.GetUnusedAsync(returningMultisigWallet.GetDerivationStrategy(), + var address = await _nBXplorerService.GetUnusedAsync(returningMultisigWallet.GetDerivationStrategy(), DerivationFeature.Deposit, 0, false, default); //Reserve is false to avoid DoS if (address != null) @@ -238,7 +235,7 @@ await AcceptChannelOpeningRequestWithUpfrontShutdown(_nBXplorerService, catch (Exception e) { _logger.LogError(e, "Error on {JobName}", nameof(ProcessNodeChannelAcceptorJob)); - + //Sleep to avoid massive requests await Task.Delay(5000); diff --git a/src/Jobs/SweepAllNodesWalletsJob.cs b/src/Jobs/SweepAllNodesWalletsJob.cs index a69f0dcc..dbb3c18e 100644 --- a/src/Jobs/SweepAllNodesWalletsJob.cs +++ b/src/Jobs/SweepAllNodesWalletsJob.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using NodeGuard.Data.Repositories.Interfaces; + + +using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; using Quartz; @@ -54,7 +53,7 @@ public async Task Execute(IJobExecutionContext context) var map = new JobDataMap(); map.Put("managedNodeId", managedNode.Id.ToString()); var job = SimpleJob.Create(map, managedNode.Id.ToString()); - + var jobExists = await scheduler.CheckExists(job.Job.Key); if (!jobExists) { diff --git a/src/Jobs/SweepNodeWalletsJob.cs b/src/Jobs/SweepNodeWalletsJob.cs index ca5a72d9..b3edd3bd 100644 --- a/src/Jobs/SweepNodeWalletsJob.cs +++ b/src/Jobs/SweepNodeWalletsJob.cs @@ -1,30 +1,27 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; -using NodeGuard.Services; using Grpc.Core; -using Grpc.Net.Client; using Lnrpc; using NBXplorer.DerivationStrategy; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Services; using Quartz; namespace NodeGuard.Jobs; @@ -95,7 +92,7 @@ async Task SweepFunds(Node node, Wallet wallet, Lightning.LightningClient lightn if (returningAddress != null && lndChangeAddress != null && utxos.Any() && totalSatsAvailable > Constants.MINIMUM_SWEEP_TRANSACTION_AMOUNT_SATS) { // We need to maintain onchain balance to be at least RequiredAnchorChannelClosingAmount but also we apply a 10% buffer to pay for this sweep fees and let some more money on the wallet - var sweepedFundsAmount = (long)((totalSatsAvailable - requiredAnchorChannelClosingAmount) * 0.9); + var sweepedFundsAmount = (long)((totalSatsAvailable - requiredAnchorChannelClosingAmount) * 0.9); var sendManyResponse = await lightningClient.SendManyAsync(new SendManyRequest() { AddrToAmount = @@ -230,4 +227,4 @@ async Task SweepFunds(Node node, Wallet wallet, Lightning.LightningClient lightn } _logger.LogInformation("{JobName} ended on node: {NodeName}", nameof(SweepNodeWalletsJob), node.Name); } -} \ No newline at end of file +} diff --git a/src/Migrations/20220623121702_initial.Designer.cs b/src/Migrations/20220623121702_initial.Designer.cs index e0e85e13..818bcafc 100644 --- a/src/Migrations/20220623121702_initial.Designer.cs +++ b/src/Migrations/20220623121702_initial.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220623121702_initial.cs b/src/Migrations/20220623121702_initial.cs index 705211f5..e2c33cca 100644 --- a/src/Migrations/20220623121702_initial.cs +++ b/src/Migrations/20220623121702_initial.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20220623122017_NullableDescription.Designer.cs b/src/Migrations/20220623122017_NullableDescription.Designer.cs index 4884124f..fe770d2e 100644 --- a/src/Migrations/20220623122017_NullableDescription.Designer.cs +++ b/src/Migrations/20220623122017_NullableDescription.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220623122017_NullableDescription.cs b/src/Migrations/20220623122017_NullableDescription.cs index a97ceda3..422d9e5c 100644 --- a/src/Migrations/20220623122017_NullableDescription.cs +++ b/src/Migrations/20220623122017_NullableDescription.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.Designer.cs b/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.Designer.cs index 57afcdb4..a21935e6 100644 --- a/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.Designer.cs +++ b/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.cs b/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.cs index 07dd493e..5432af1e 100644 --- a/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.cs +++ b/src/Migrations/20220623154915_ChannelIdBtcCloseAddressNullable.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220623172806_OpRequestAmountInSatoshis.Designer.cs b/src/Migrations/20220623172806_OpRequestAmountInSatoshis.Designer.cs index 0fd0de92..e88f8aa6 100644 --- a/src/Migrations/20220623172806_OpRequestAmountInSatoshis.Designer.cs +++ b/src/Migrations/20220623172806_OpRequestAmountInSatoshis.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220623172806_OpRequestAmountInSatoshis.cs b/src/Migrations/20220623172806_OpRequestAmountInSatoshis.cs index b8b3c4b0..10c164aa 100644 --- a/src/Migrations/20220623172806_OpRequestAmountInSatoshis.cs +++ b/src/Migrations/20220623172806_OpRequestAmountInSatoshis.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220706143616_InternalWallet.Designer.cs b/src/Migrations/20220706143616_InternalWallet.Designer.cs index 83078908..8224e215 100644 --- a/src/Migrations/20220706143616_InternalWallet.Designer.cs +++ b/src/Migrations/20220706143616_InternalWallet.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220706143616_InternalWallet.cs b/src/Migrations/20220706143616_InternalWallet.cs index 558ba9e8..99ec3f45 100644 --- a/src/Migrations/20220706143616_InternalWallet.cs +++ b/src/Migrations/20220706143616_InternalWallet.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20220707110433_RemoveCycleInternalWallet.Designer.cs b/src/Migrations/20220707110433_RemoveCycleInternalWallet.Designer.cs index 589d00e7..27ae5577 100644 --- a/src/Migrations/20220707110433_RemoveCycleInternalWallet.Designer.cs +++ b/src/Migrations/20220707110433_RemoveCycleInternalWallet.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220707110433_RemoveCycleInternalWallet.cs b/src/Migrations/20220707110433_RemoveCycleInternalWallet.cs index cbc186c5..1d004f93 100644 --- a/src/Migrations/20220707110433_RemoveCycleInternalWallet.cs +++ b/src/Migrations/20220707110433_RemoveCycleInternalWallet.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.Designer.cs b/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.Designer.cs index c5ec5da8..87434e4f 100644 --- a/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.Designer.cs +++ b/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.cs b/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.cs index 76f3355a..86e7f967 100644 --- a/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.cs +++ b/src/Migrations/20220711142723_DestNodeNullableUnitRemoval.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220711142843_MoneyUnitEnum.Designer.cs b/src/Migrations/20220711142843_MoneyUnitEnum.Designer.cs index 7035f9f2..e74f49bd 100644 --- a/src/Migrations/20220711142843_MoneyUnitEnum.Designer.cs +++ b/src/Migrations/20220711142843_MoneyUnitEnum.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220711142843_MoneyUnitEnum.cs b/src/Migrations/20220711142843_MoneyUnitEnum.cs index 54fe3909..c772178b 100644 --- a/src/Migrations/20220711142843_MoneyUnitEnum.cs +++ b/src/Migrations/20220711142843_MoneyUnitEnum.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220714131143_NullableFieldsInNodeEntity.Designer.cs b/src/Migrations/20220714131143_NullableFieldsInNodeEntity.Designer.cs index c988bc3f..e7b98f01 100644 --- a/src/Migrations/20220714131143_NullableFieldsInNodeEntity.Designer.cs +++ b/src/Migrations/20220714131143_NullableFieldsInNodeEntity.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220714131143_NullableFieldsInNodeEntity.cs b/src/Migrations/20220714131143_NullableFieldsInNodeEntity.cs index 2eb48907..2235e483 100644 --- a/src/Migrations/20220714131143_NullableFieldsInNodeEntity.cs +++ b/src/Migrations/20220714131143_NullableFieldsInNodeEntity.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220718231848_ChannelOperationRequestFKRename.Designer.cs b/src/Migrations/20220718231848_ChannelOperationRequestFKRename.Designer.cs index f4892fc5..25fe42bb 100644 --- a/src/Migrations/20220718231848_ChannelOperationRequestFKRename.Designer.cs +++ b/src/Migrations/20220718231848_ChannelOperationRequestFKRename.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220718231848_ChannelOperationRequestFKRename.cs b/src/Migrations/20220718231848_ChannelOperationRequestFKRename.cs index 12d2ae85..bc1399d0 100644 --- a/src/Migrations/20220718231848_ChannelOperationRequestFKRename.cs +++ b/src/Migrations/20220718231848_ChannelOperationRequestFKRename.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220726174005_IsFinalisedWallet.Designer.cs b/src/Migrations/20220726174005_IsFinalisedWallet.Designer.cs index be993cde..b0f64788 100644 --- a/src/Migrations/20220726174005_IsFinalisedWallet.Designer.cs +++ b/src/Migrations/20220726174005_IsFinalisedWallet.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220726174005_IsFinalisedWallet.cs b/src/Migrations/20220726174005_IsFinalisedWallet.cs index 67b33cba..42e52cb8 100644 --- a/src/Migrations/20220726174005_IsFinalisedWallet.cs +++ b/src/Migrations/20220726174005_IsFinalisedWallet.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.Designer.cs b/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.Designer.cs index 73e76008..a0355521 100644 --- a/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.Designer.cs +++ b/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.cs b/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.cs index c255089c..df6abcc6 100644 --- a/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.cs +++ b/src/Migrations/20220729100824_AddStatusFieldToChannelEntity.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.Designer.cs b/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.Designer.cs index e19e96da..20955003 100644 --- a/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.Designer.cs +++ b/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.cs b/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.cs index c54a97b1..9697ffca 100644 --- a/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.cs +++ b/src/Migrations/20220801165113_ChannelOperationRequestSignatureOverhaul.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20220801202751_missingOverhaul.Designer.cs b/src/Migrations/20220801202751_missingOverhaul.Designer.cs index 653b72bd..3492e986 100644 --- a/src/Migrations/20220801202751_missingOverhaul.Designer.cs +++ b/src/Migrations/20220801202751_missingOverhaul.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220801202751_missingOverhaul.cs b/src/Migrations/20220801202751_missingOverhaul.cs index 93f45cbe..30fab486 100644 --- a/src/Migrations/20220801202751_missingOverhaul.cs +++ b/src/Migrations/20220801202751_missingOverhaul.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220802192011_UniqueIndexPubkey.Designer.cs b/src/Migrations/20220802192011_UniqueIndexPubkey.Designer.cs index 88d40059..b38bf82c 100644 --- a/src/Migrations/20220802192011_UniqueIndexPubkey.Designer.cs +++ b/src/Migrations/20220802192011_UniqueIndexPubkey.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220802192011_UniqueIndexPubkey.cs b/src/Migrations/20220802192011_UniqueIndexPubkey.cs index f7976eee..c38e846a 100644 --- a/src/Migrations/20220802192011_UniqueIndexPubkey.cs +++ b/src/Migrations/20220802192011_UniqueIndexPubkey.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220808142723_JobIdOperations.Designer.cs b/src/Migrations/20220808142723_JobIdOperations.Designer.cs index 9028da9d..8da27d63 100644 --- a/src/Migrations/20220808142723_JobIdOperations.Designer.cs +++ b/src/Migrations/20220808142723_JobIdOperations.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220808142723_JobIdOperations.cs b/src/Migrations/20220808142723_JobIdOperations.cs index 1579c1c7..2d19aea1 100644 --- a/src/Migrations/20220808142723_JobIdOperations.cs +++ b/src/Migrations/20220808142723_JobIdOperations.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220811173948_UniqueUsername.Designer.cs b/src/Migrations/20220811173948_UniqueUsername.Designer.cs index 2a682a7e..028f28c1 100644 --- a/src/Migrations/20220811173948_UniqueUsername.Designer.cs +++ b/src/Migrations/20220811173948_UniqueUsername.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220811173948_UniqueUsername.cs b/src/Migrations/20220811173948_UniqueUsername.cs index f617d1ce..62487dc8 100644 --- a/src/Migrations/20220811173948_UniqueUsername.cs +++ b/src/Migrations/20220811173948_UniqueUsername.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220817154023_UTXO.Designer.cs b/src/Migrations/20220817154023_UTXO.Designer.cs index c89ebd5b..3b71bd35 100644 --- a/src/Migrations/20220817154023_UTXO.Designer.cs +++ b/src/Migrations/20220817154023_UTXO.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220817154023_UTXO.cs b/src/Migrations/20220817154023_UTXO.cs index 72619e48..70264e8d 100644 --- a/src/Migrations/20220817154023_UTXO.cs +++ b/src/Migrations/20220817154023_UTXO.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20220817160052_UTXO_UINT.Designer.cs b/src/Migrations/20220817160052_UTXO_UINT.Designer.cs index aedd2d1c..52366b5d 100644 --- a/src/Migrations/20220817160052_UTXO_UINT.Designer.cs +++ b/src/Migrations/20220817160052_UTXO_UINT.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220817160052_UTXO_UINT.cs b/src/Migrations/20220817160052_UTXO_UINT.cs index 5c219986..ea7756bd 100644 --- a/src/Migrations/20220817160052_UTXO_UINT.cs +++ b/src/Migrations/20220817160052_UTXO_UINT.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220817184102_UtxoRename.Designer.cs b/src/Migrations/20220817184102_UtxoRename.Designer.cs index e8b08095..65788d69 100644 --- a/src/Migrations/20220817184102_UtxoRename.Designer.cs +++ b/src/Migrations/20220817184102_UtxoRename.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220817184102_UtxoRename.cs b/src/Migrations/20220817184102_UtxoRename.cs index 0b1be356..3c61233d 100644 --- a/src/Migrations/20220817184102_UtxoRename.cs +++ b/src/Migrations/20220817184102_UtxoRename.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20220819223412_AddTxIdToChannelRequests.Designer.cs b/src/Migrations/20220819223412_AddTxIdToChannelRequests.Designer.cs index 543e8862..5a1e1c72 100644 --- a/src/Migrations/20220819223412_AddTxIdToChannelRequests.Designer.cs +++ b/src/Migrations/20220819223412_AddTxIdToChannelRequests.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220819223412_AddTxIdToChannelRequests.cs b/src/Migrations/20220819223412_AddTxIdToChannelRequests.cs index 9bdef978..e7ee140b 100644 --- a/src/Migrations/20220819223412_AddTxIdToChannelRequests.cs +++ b/src/Migrations/20220819223412_AddTxIdToChannelRequests.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.Designer.cs b/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.Designer.cs index 650aa36c..85151b90 100644 --- a/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.Designer.cs +++ b/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.cs b/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.cs index 5e4fa706..03bc5c0f 100644 --- a/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.cs +++ b/src/Migrations/20220822224353_AddClosingReasonToChannelRequests.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.Designer.cs b/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.Designer.cs index 73f9f888..298c6ee3 100644 --- a/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.Designer.cs +++ b/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.cs b/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.cs index e6fe03fd..71f49eed 100644 --- a/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.cs +++ b/src/Migrations/20220824100353_NodeReturningFundsMultisigWallet.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220826163447_UniqueNodeName.Designer.cs b/src/Migrations/20220826163447_UniqueNodeName.Designer.cs index 006fba40..1f31ddee 100644 --- a/src/Migrations/20220826163447_UniqueNodeName.Designer.cs +++ b/src/Migrations/20220826163447_UniqueNodeName.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220826163447_UniqueNodeName.cs b/src/Migrations/20220826163447_UniqueNodeName.cs index dab11407..ddd00a0e 100644 --- a/src/Migrations/20220826163447_UniqueNodeName.cs +++ b/src/Migrations/20220826163447_UniqueNodeName.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220916115623_KeysExtraFields.Designer.cs b/src/Migrations/20220916115623_KeysExtraFields.Designer.cs index 4a7f942e..95a9dd3d 100644 --- a/src/Migrations/20220916115623_KeysExtraFields.Designer.cs +++ b/src/Migrations/20220916115623_KeysExtraFields.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220916115623_KeysExtraFields.cs b/src/Migrations/20220916115623_KeysExtraFields.cs index 3b02f736..8f33e655 100644 --- a/src/Migrations/20220916115623_KeysExtraFields.cs +++ b/src/Migrations/20220916115623_KeysExtraFields.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220916132429_NullableFieldsKey.Designer.cs b/src/Migrations/20220916132429_NullableFieldsKey.Designer.cs index d4de6fad..3821221c 100644 --- a/src/Migrations/20220916132429_NullableFieldsKey.Designer.cs +++ b/src/Migrations/20220916132429_NullableFieldsKey.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220916132429_NullableFieldsKey.cs b/src/Migrations/20220916132429_NullableFieldsKey.cs index 39f2f341..1284e9aa 100644 --- a/src/Migrations/20220916132429_NullableFieldsKey.cs +++ b/src/Migrations/20220916132429_NullableFieldsKey.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20220916170036_Withdrawals.Designer.cs b/src/Migrations/20220916170036_Withdrawals.Designer.cs index a4c7b18a..21156b91 100644 --- a/src/Migrations/20220916170036_Withdrawals.Designer.cs +++ b/src/Migrations/20220916170036_Withdrawals.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20220916170036_Withdrawals.cs b/src/Migrations/20220916170036_Withdrawals.cs index 671e3d00..77df9cc6 100644 --- a/src/Migrations/20220916170036_Withdrawals.cs +++ b/src/Migrations/20220916170036_Withdrawals.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20221222164209_QuartzTables.Designer.cs b/src/Migrations/20221222164209_QuartzTables.Designer.cs index f384bd48..343e91b3 100644 --- a/src/Migrations/20221222164209_QuartzTables.Designer.cs +++ b/src/Migrations/20221222164209_QuartzTables.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20221222164209_QuartzTables.cs b/src/Migrations/20221222164209_QuartzTables.cs index e25d3d4a..db6bacc2 100644 --- a/src/Migrations/20221222164209_QuartzTables.cs +++ b/src/Migrations/20221222164209_QuartzTables.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20221223141608_XPUBInternalWallet.Designer.cs b/src/Migrations/20221223141608_XPUBInternalWallet.Designer.cs index 37e1b6af..606023f7 100644 --- a/src/Migrations/20221223141608_XPUBInternalWallet.Designer.cs +++ b/src/Migrations/20221223141608_XPUBInternalWallet.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20221223141608_XPUBInternalWallet.cs b/src/Migrations/20221223141608_XPUBInternalWallet.cs index aa2445ec..ebd77016 100644 --- a/src/Migrations/20221223141608_XPUBInternalWallet.cs +++ b/src/Migrations/20221223141608_XPUBInternalWallet.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230109171018_KeyFKInternalWallet.Designer.cs b/src/Migrations/20230109171018_KeyFKInternalWallet.Designer.cs index b80376da..4d3afcc2 100644 --- a/src/Migrations/20230109171018_KeyFKInternalWallet.Designer.cs +++ b/src/Migrations/20230109171018_KeyFKInternalWallet.Designer.cs @@ -1,29 +1,12 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -// + + +// using System; -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NodeGuard.Data; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/Migrations/20230109171018_KeyFKInternalWallet.cs b/src/Migrations/20230109171018_KeyFKInternalWallet.cs index cf577115..b27ede5d 100644 --- a/src/Migrations/20230109171018_KeyFKInternalWallet.cs +++ b/src/Migrations/20230109171018_KeyFKInternalWallet.cs @@ -1,23 +1,22 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using Microsoft.EntityFrameworkCore.Migrations; + + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230206185652_LiquidityRules_HotWallet.cs b/src/Migrations/20230206185652_LiquidityRules_HotWallet.cs index 707f1b79..cd64623f 100644 --- a/src/Migrations/20230206185652_LiquidityRules_HotWallet.cs +++ b/src/Migrations/20230206185652_LiquidityRules_HotWallet.cs @@ -1,23 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20230207114842_ChannelNode.cs b/src/Migrations/20230207114842_ChannelNode.cs index a4aeb839..95d25f05 100644 --- a/src/Migrations/20230207114842_ChannelNode.cs +++ b/src/Migrations/20230207114842_ChannelNode.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Microsoft.EntityFrameworkCore.Migrations; diff --git a/src/Migrations/20230207161055_LiquidityRulesRename.cs b/src/Migrations/20230207161055_LiquidityRulesRename.cs index 05589f16..cb788a72 100644 --- a/src/Migrations/20230207161055_LiquidityRulesRename.cs +++ b/src/Migrations/20230207161055_LiquidityRulesRename.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Microsoft.EntityFrameworkCore.Migrations; diff --git a/src/Migrations/20230207164017_NodeAddedToLiquidityRule.cs b/src/Migrations/20230207164017_NodeAddedToLiquidityRule.cs index b9eca47c..2ef9496c 100644 --- a/src/Migrations/20230207164017_NodeAddedToLiquidityRule.cs +++ b/src/Migrations/20230207164017_NodeAddedToLiquidityRule.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Microsoft.EntityFrameworkCore.Migrations; diff --git a/src/Migrations/20230214121821_MigrateWalletsToDerivationPath.cs b/src/Migrations/20230214121821_MigrateWalletsToDerivationPath.cs index 52faf070..a345ffd0 100644 --- a/src/Migrations/20230214121821_MigrateWalletsToDerivationPath.cs +++ b/src/Migrations/20230214121821_MigrateWalletsToDerivationPath.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Microsoft.EntityFrameworkCore.Migrations; diff --git a/src/Migrations/20230215151541_WithdrawalRequestorNullable.cs b/src/Migrations/20230215151541_WithdrawalRequestorNullable.cs index 31727072..b9b288b6 100644 --- a/src/Migrations/20230215151541_WithdrawalRequestorNullable.cs +++ b/src/Migrations/20230215151541_WithdrawalRequestorNullable.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230216090219_AddInternalWalletMasterFingerprint.cs b/src/Migrations/20230216090219_AddInternalWalletMasterFingerprint.cs index 856bf4bb..013eda1b 100644 --- a/src/Migrations/20230216090219_AddInternalWalletMasterFingerprint.cs +++ b/src/Migrations/20230216090219_AddInternalWalletMasterFingerprint.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230216090626_AddConstraintsAndPopulateMasterFingerprint.cs b/src/Migrations/20230216090626_AddConstraintsAndPopulateMasterFingerprint.cs index eeb68ffb..2eee1833 100644 --- a/src/Migrations/20230216090626_AddConstraintsAndPopulateMasterFingerprint.cs +++ b/src/Migrations/20230216090626_AddConstraintsAndPopulateMasterFingerprint.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230220153422_LiquidityRulesEnabledTarget.cs b/src/Migrations/20230220153422_LiquidityRulesEnabledTarget.cs index 0a9270a1..1c0c4495 100644 --- a/src/Migrations/20230220153422_LiquidityRulesEnabledTarget.cs +++ b/src/Migrations/20230220153422_LiquidityRulesEnabledTarget.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230221165751_ChanId.cs b/src/Migrations/20230221165751_ChanId.cs index e6fa6297..8348eff8 100644 --- a/src/Migrations/20230221165751_ChanId.cs +++ b/src/Migrations/20230221165751_ChanId.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230222144340_AutosweepDisablingOption.cs b/src/Migrations/20230222144340_AutosweepDisablingOption.cs index 2c93800d..9509bf66 100644 --- a/src/Migrations/20230222144340_AutosweepDisablingOption.cs +++ b/src/Migrations/20230222144340_AutosweepDisablingOption.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230303101702_AddJobIdToNode.cs b/src/Migrations/20230303101702_AddJobIdToNode.cs index 3a3a7fd6..20d2ae83 100644 --- a/src/Migrations/20230303101702_AddJobIdToNode.cs +++ b/src/Migrations/20230303101702_AddJobIdToNode.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230306090732_ChannelCreatedByNodeGuard.cs b/src/Migrations/20230306090732_ChannelCreatedByNodeGuard.cs index c364c11f..ffdfa791 100644 --- a/src/Migrations/20230306090732_ChannelCreatedByNodeGuard.cs +++ b/src/Migrations/20230306090732_ChannelCreatedByNodeGuard.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230307123551_DestinationNodeChannel.cs b/src/Migrations/20230307123551_DestinationNodeChannel.cs index 2275ecc8..be5d4463 100644 --- a/src/Migrations/20230307123551_DestinationNodeChannel.cs +++ b/src/Migrations/20230307123551_DestinationNodeChannel.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230309121807_UpdateSourceDestChannelNodeIdFromRequests.cs b/src/Migrations/20230309121807_UpdateSourceDestChannelNodeIdFromRequests.cs index 2f84b515..fe9f2f32 100644 --- a/src/Migrations/20230309121807_UpdateSourceDestChannelNodeIdFromRequests.cs +++ b/src/Migrations/20230309121807_UpdateSourceDestChannelNodeIdFromRequests.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230310130535_ChannelOperationReqUserWalletNullable.cs b/src/Migrations/20230310130535_ChannelOperationReqUserWalletNullable.cs index 99dc85dd..a8fbbcc6 100644 --- a/src/Migrations/20230310130535_ChannelOperationReqUserWalletNullable.cs +++ b/src/Migrations/20230310130535_ChannelOperationReqUserWalletNullable.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230330221134_AddMetadataForWithdrawalRequests.cs b/src/Migrations/20230330221134_AddMetadataForWithdrawalRequests.cs index f1ea320f..76b929b3 100644 --- a/src/Migrations/20230330221134_AddMetadataForWithdrawalRequests.cs +++ b/src/Migrations/20230330221134_AddMetadataForWithdrawalRequests.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230425121336_RenameReturnWalletNode.cs b/src/Migrations/20230425121336_RenameReturnWalletNode.cs index 11d6ca7e..0b7b3582 100644 --- a/src/Migrations/20230425121336_RenameReturnWalletNode.cs +++ b/src/Migrations/20230425121336_RenameReturnWalletNode.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230426113508_BIP39Import.cs b/src/Migrations/20230426113508_BIP39Import.cs index fa8d9733..3e6d28f4 100644 --- a/src/Migrations/20230426113508_BIP39Import.cs +++ b/src/Migrations/20230426113508_BIP39Import.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230428172906_BIP39Seedphrase.cs b/src/Migrations/20230428172906_BIP39Seedphrase.cs index e806de3c..7703b722 100644 --- a/src/Migrations/20230428172906_BIP39Seedphrase.cs +++ b/src/Migrations/20230428172906_BIP39Seedphrase.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230501145830_PrivateChannel.cs b/src/Migrations/20230501145830_PrivateChannel.cs index 2e59e73a..77ac26bd 100644 --- a/src/Migrations/20230501145830_PrivateChannel.cs +++ b/src/Migrations/20230501145830_PrivateChannel.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230529155647_ChangelessChannelOperation.cs b/src/Migrations/20230529155647_ChangelessChannelOperation.cs index 5455c564..cdca436f 100644 --- a/src/Migrations/20230529155647_ChangelessChannelOperation.cs +++ b/src/Migrations/20230529155647_ChangelessChannelOperation.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230615063113_feesInChannelRequest.cs b/src/Migrations/20230615063113_feesInChannelRequest.cs index c9dabde6..4deecc41 100644 --- a/src/Migrations/20230615063113_feesInChannelRequest.cs +++ b/src/Migrations/20230615063113_feesInChannelRequest.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230615064918_NullableFees.cs b/src/Migrations/20230615064918_NullableFees.cs index 8e2d10d0..1808e049 100644 --- a/src/Migrations/20230615064918_NullableFees.cs +++ b/src/Migrations/20230615064918_NullableFees.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230704133231_StatusLogsForChannelRequests.cs b/src/Migrations/20230704133231_StatusLogsForChannelRequests.cs index d0d5d937..ad3754b7 100644 --- a/src/Migrations/20230704133231_StatusLogsForChannelRequests.cs +++ b/src/Migrations/20230704133231_StatusLogsForChannelRequests.cs @@ -1,6 +1,21 @@ -using System.Collections.Generic; -using NodeGuard.Helpers; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore.Migrations; +using NodeGuard.Helpers; #nullable disable diff --git a/src/Migrations/20230724145306_RemoveConstraintOnNodeName.cs b/src/Migrations/20230724145306_RemoveConstraintOnNodeName.cs index 6cb9e5bf..0e371f77 100644 --- a/src/Migrations/20230724145306_RemoveConstraintOnNodeName.cs +++ b/src/Migrations/20230724145306_RemoveConstraintOnNodeName.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230725153505_NullableStatusLogs.cs b/src/Migrations/20230725153505_NullableStatusLogs.cs index 69880881..b5414b71 100644 --- a/src/Migrations/20230725153505_NullableStatusLogs.cs +++ b/src/Migrations/20230725153505_NullableStatusLogs.cs @@ -1,6 +1,21 @@ -using System.Collections.Generic; -using NodeGuard.Helpers; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore.Migrations; +using NodeGuard.Helpers; #nullable disable diff --git a/src/Migrations/20230726125844_MempoolRecommendedFeesType.cs b/src/Migrations/20230726125844_MempoolRecommendedFeesType.cs index dfa59175..6fc0172b 100644 --- a/src/Migrations/20230726125844_MempoolRecommendedFeesType.cs +++ b/src/Migrations/20230726125844_MempoolRecommendedFeesType.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230905151204_ChangelessWithdrawalRequest.cs b/src/Migrations/20230905151204_ChangelessWithdrawalRequest.cs index 9bb1e99f..127354cb 100644 --- a/src/Migrations/20230905151204_ChangelessWithdrawalRequest.cs +++ b/src/Migrations/20230905151204_ChangelessWithdrawalRequest.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230913180542_OutputDescriptorWallet.cs b/src/Migrations/20230913180542_OutputDescriptorWallet.cs index a30deee6..88fc9280 100644 --- a/src/Migrations/20230913180542_OutputDescriptorWallet.cs +++ b/src/Migrations/20230913180542_OutputDescriptorWallet.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20230918165135_APIToken.cs b/src/Migrations/20230918165135_APIToken.cs index 2075fa23..dde4822d 100644 --- a/src/Migrations/20230918165135_APIToken.cs +++ b/src/Migrations/20230918165135_APIToken.cs @@ -1,4 +1,19 @@ -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20231108142716_AddressInLiquidityRules.cs b/src/Migrations/20231108142716_AddressInLiquidityRules.cs index 1f19f78b..67e74992 100644 --- a/src/Migrations/20231108142716_AddressInLiquidityRules.cs +++ b/src/Migrations/20231108142716_AddressInLiquidityRules.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20231109094124_WalletInLiquidityRuleNullable.cs b/src/Migrations/20231109094124_WalletInLiquidityRuleNullable.cs index 0c77c1f7..9ff21779 100644 --- a/src/Migrations/20231109094124_WalletInLiquidityRuleNullable.cs +++ b/src/Migrations/20231109094124_WalletInLiquidityRuleNullable.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20231113150751_SeparationSwapAndReverseSwap.cs b/src/Migrations/20231113150751_SeparationSwapAndReverseSwap.cs index d9bc1523..be5ca7b6 100644 --- a/src/Migrations/20231113150751_SeparationSwapAndReverseSwap.cs +++ b/src/Migrations/20231113150751_SeparationSwapAndReverseSwap.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -18,7 +34,7 @@ protected override void Up(MigrationBuilder migrationBuilder) defaultValue: 0); migrationBuilder.Sql(@"UPDATE ""LiquidityRules"" SET ""SwapWalletId"" = ""WalletId"""); - + migrationBuilder.DropForeignKey( name: "FK_LiquidityRules_Wallets_WalletId", table: "LiquidityRules"); diff --git a/src/Migrations/20231205153253_IsNodeDisabled.cs b/src/Migrations/20231205153253_IsNodeDisabled.cs index caf65b97..b3009565 100644 --- a/src/Migrations/20231205153253_IsNodeDisabled.cs +++ b/src/Migrations/20231205153253_IsNodeDisabled.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20231219172043_WithdrawalFeeRate.cs b/src/Migrations/20231219172043_WithdrawalFeeRate.cs index 5b6279c7..bdb3cdd1 100644 --- a/src/Migrations/20231219172043_WithdrawalFeeRate.cs +++ b/src/Migrations/20231219172043_WithdrawalFeeRate.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20240123130535_RemoveJobIdColumn.cs b/src/Migrations/20240123130535_RemoveJobIdColumn.cs index 98e8edd3..4892d98d 100644 --- a/src/Migrations/20240123130535_RemoveJobIdColumn.cs +++ b/src/Migrations/20240123130535_RemoveJobIdColumn.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20240628073255_UtxoFreezing.cs b/src/Migrations/20240628073255_UtxoFreezing.cs index 1f0a6e84..81bac858 100644 --- a/src/Migrations/20240628073255_UtxoFreezing.cs +++ b/src/Migrations/20240628073255_UtxoFreezing.cs @@ -1,4 +1,19 @@ -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20240701130238_unique-tag-key.cs b/src/Migrations/20240701130238_unique-tag-key.cs index e7f8f069..27c077b2 100644 --- a/src/Migrations/20240701130238_unique-tag-key.cs +++ b/src/Migrations/20240701130238_unique-tag-key.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20240718083316_WithdrawalReferenceId.cs b/src/Migrations/20240718083316_WithdrawalReferenceId.cs index 7e3c6dce..f0234938 100644 --- a/src/Migrations/20240718083316_WithdrawalReferenceId.cs +++ b/src/Migrations/20240718083316_WithdrawalReferenceId.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20250610143122_AddWithdrawalDestinations.cs b/src/Migrations/20250610143122_AddWithdrawalDestinations.cs index fcecfa41..6e1c3a3e 100644 --- a/src/Migrations/20250610143122_AddWithdrawalDestinations.cs +++ b/src/Migrations/20250610143122_AddWithdrawalDestinations.cs @@ -1,4 +1,19 @@ -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20250611142943_MigrateLegacyWithdrawalData.cs b/src/Migrations/20250611142943_MigrateLegacyWithdrawalData.cs index d23851f7..4a16c6d0 100644 --- a/src/Migrations/20250611142943_MigrateLegacyWithdrawalData.cs +++ b/src/Migrations/20250611142943_MigrateLegacyWithdrawalData.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20250611154856_RemoveObsoleteWithdrawalProperties.cs b/src/Migrations/20250611154856_RemoveObsoleteWithdrawalProperties.cs index bcf10764..9993a893 100644 --- a/src/Migrations/20250611154856_RemoveObsoleteWithdrawalProperties.cs +++ b/src/Migrations/20250611154856_RemoveObsoleteWithdrawalProperties.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20250729130729_AddBumpingRequest.cs b/src/Migrations/20250729130729_AddBumpingRequest.cs index de78161e..36cf6f64 100644 --- a/src/Migrations/20250729130729_AddBumpingRequest.cs +++ b/src/Migrations/20250729130729_AddBumpingRequest.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20250730123824_AddRequestMetadataWithUser.cs b/src/Migrations/20250730123824_AddRequestMetadataWithUser.cs index fe170392..af838a3d 100644 --- a/src/Migrations/20250730123824_AddRequestMetadataWithUser.cs +++ b/src/Migrations/20250730123824_AddRequestMetadataWithUser.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20250805114247_AddSwapOuts.cs b/src/Migrations/20250805114247_AddSwapOuts.cs index a6d3eebb..a8327988 100644 --- a/src/Migrations/20250805114247_AddSwapOuts.cs +++ b/src/Migrations/20250805114247_AddSwapOuts.cs @@ -1,4 +1,19 @@ -using System; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; diff --git a/src/Migrations/20250820104621_AddLoopDetails.cs b/src/Migrations/20250820104621_AddLoopDetails.cs index 5d89b31f..bd9640c4 100644 --- a/src/Migrations/20250820104621_AddLoopDetails.cs +++ b/src/Migrations/20250820104621_AddLoopDetails.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/20250909123533_AddNodeIdToSwapOutModel.cs b/src/Migrations/20250909123533_AddNodeIdToSwapOutModel.cs index 97cfe453..2300b20c 100644 --- a/src/Migrations/20250909123533_AddNodeIdToSwapOutModel.cs +++ b/src/Migrations/20250909123533_AddNodeIdToSwapOutModel.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/Migrations/DataProtectionKeys/20231122131808_DataProtectionKeys.cs b/src/Migrations/DataProtectionKeys/20231122131808_DataProtectionKeys.cs index 492d8814..08fe01ec 100644 --- a/src/Migrations/DataProtectionKeys/20231122131808_DataProtectionKeys.cs +++ b/src/Migrations/DataProtectionKeys/20231122131808_DataProtectionKeys.cs @@ -1,4 +1,20 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable diff --git a/src/NodeGuard.csproj b/src/NodeGuard.csproj index 56a27521..f61c4356 100644 --- a/src/NodeGuard.csproj +++ b/src/NodeGuard.csproj @@ -11,6 +11,7 @@ true Elenpay NodeGuard + true diff --git a/src/Pages/Error.cshtml.cs b/src/Pages/Error.cshtml.cs index 327fcace..4881d6da 100644 --- a/src/Pages/Error.cshtml.cs +++ b/src/Pages/Error.cshtml.cs @@ -1,25 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using System.Diagnostics; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; namespace NodeGuard.Pages { @@ -43,4 +42,4 @@ public void OnGet() RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; } } -} \ No newline at end of file +} diff --git a/src/Program.cs b/src/Program.cs index 705096b5..70e2a994 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,55 +1,54 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Blazored.Toast; using Blazorise; using Blazorise.Bootstrap; using Blazorise.Icons.FontAwesome; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.DataProtection; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.EntityFrameworkCore; using NodeGuard.Areas.Identity; using NodeGuard.Automapper; using NodeGuard.Data; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories; using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; using NodeGuard.Jobs; +using NodeGuard.Rpc; using NodeGuard.Services; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.DataProtection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Quartz; -using OpenTelemetry.Trace; -using OpenTelemetry.Resources; -using OpenTelemetry.Metrics; +using Npgsql; using OpenTelemetry.Exporter; +using OpenTelemetry.Metrics; +using OpenTelemetry.Resources; +using OpenTelemetry.Trace; +using Quartz; +using Quartz.AspNetCore; using Serilog; using Serilog.Events; -using NodeGuard.Helpers; -using NodeGuard.Rpc; -using Microsoft.AspNetCore.Server.Kestrel.Core; -using Npgsql; -using Quartz.AspNetCore; namespace NodeGuard { public class Program { + [Obsolete] public static async Task Main(string[] args) { AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); @@ -405,4 +404,4 @@ public static async Task Main(string[] args) app.Run(); } } -} \ No newline at end of file +} diff --git a/src/Rpc/GRPCAuthInterceptor.cs b/src/Rpc/GRPCAuthInterceptor.cs index 350da0ff..73777aa7 100644 --- a/src/Rpc/GRPCAuthInterceptor.cs +++ b/src/Rpc/GRPCAuthInterceptor.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Grpc.Core; using Grpc.Core.Interceptors; using NodeGuard.Data.Repositories.Interfaces; @@ -7,16 +23,16 @@ namespace NodeGuard.Rpc; public class GRPCAuthInterceptor : Interceptor { private readonly IAPITokenRepository _apiTokenRepository; - + public GRPCAuthInterceptor(IAPITokenRepository apiTokenRepository) { _apiTokenRepository = apiTokenRepository; } - -public override async Task UnaryServerHandler( - TRequest request, - ServerCallContext context, - UnaryServerMethod continuation) + + public override async Task UnaryServerHandler( + TRequest request, + ServerCallContext context, + UnaryServerMethod continuation) { var token = context.RequestHeaders.FirstOrDefault(x => x.Key == "auth-token")?.Value; if (token == null) @@ -25,13 +41,13 @@ public override async Task UnaryServerHandler( } var apiToken = await _apiTokenRepository.GetByToken(token); - + if (apiToken?.IsBlocked ?? true) { throw new RpcException(new Status(StatusCode.Unauthenticated, "Invalid token")); } - + return await continuation(request, context); } - -} \ No newline at end of file + +} diff --git a/src/Rpc/NodeGuardService.cs b/src/Rpc/NodeGuardService.cs index d554e8cd..860fd414 100644 --- a/src/Rpc/NodeGuardService.cs +++ b/src/Rpc/NodeGuardService.cs @@ -1,15 +1,31 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using AutoMapper; +using Grpc.Core; +using NBitcoin; +using NBXplorer.DerivationStrategy; +using NBXplorer.Models; +using Nodeguard; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; using NodeGuard.Jobs; using NodeGuard.Services; -using Grpc.Core; -using NBitcoin; -using NBXplorer.DerivationStrategy; -using NBXplorer.Models; -using Nodeguard; using Quartz; using LiquidityRule = NodeGuard.Data.Models.LiquidityRule; using Wallet = NodeGuard.Data.Models.Wallet; @@ -232,7 +248,7 @@ public override async Task RequestWithdrawal(RequestW throw new RpcException(new Status(StatusCode.Internal, "Derivation strategy not found")); utxos = await _coinSelectionService.GetUTXOsByOutpointAsync(derivationStrategyBase, outpoints); - + } // Create destination objects for the withdrawal request diff --git a/src/Services/BitcoinService.cs b/src/Services/BitcoinService.cs index 1197bb06..2da86a22 100644 --- a/src/Services/BitcoinService.cs +++ b/src/Services/BitcoinService.cs @@ -1,31 +1,30 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Reflection; using AutoMapper; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; using Humanizer; using NBitcoin; using NBXplorer.DerivationStrategy; using NBXplorer.Models; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; using NSubstitute.Exceptions; // ReSharper disable All @@ -677,4 +676,4 @@ public interface IBitcoinService /// Task MonitorWithdrawals(); } -} \ No newline at end of file +} diff --git a/src/Services/ClipboardService.cs b/src/Services/ClipboardService.cs index 18ec94b9..a43dd326 100644 --- a/src/Services/ClipboardService.cs +++ b/src/Services/ClipboardService.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + namespace NodeGuard.Services; @@ -40,4 +39,4 @@ public ValueTask WriteTextAsync(string text) { return _jsRuntime.InvokeVoidAsync("navigator.clipboard.writeText", text); } -} \ No newline at end of file +} diff --git a/src/Services/CoinSelectionService.cs b/src/Services/CoinSelectionService.cs index ad2daee1..4cf4da22 100644 --- a/src/Services/CoinSelectionService.cs +++ b/src/Services/CoinSelectionService.cs @@ -1,30 +1,29 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; using Humanizer; using NBitcoin; using NBXplorer.DerivationStrategy; using NBXplorer.Models; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; namespace NodeGuard.Services; @@ -67,7 +66,7 @@ public interface ICoinSelectionService /// /// public Task> GetLockedUTXOsForRequest(IBitcoinRequest bitcoinRequest, BitcoinRequestType requestType); - + /// /// Gets the frozen UTXOs /// @@ -79,7 +78,7 @@ public interface ICoinSelectionService DerivationStrategyBase derivationStrategy); } -public class CoinSelectionService: ICoinSelectionService +public class CoinSelectionService : ICoinSelectionService { private readonly ILogger _logger; private readonly IMapper _mapper; @@ -110,12 +109,12 @@ IUTXOTagRepository utxoTagRepository private IBitcoinRequestRepository GetRepository(BitcoinRequestType requestType) { - return requestType switch - { - BitcoinRequestType.ChannelOperation => _channelOperationRequestRepository, - BitcoinRequestType.WalletWithdrawal => _walletWithdrawalRequestRepository, - _ => throw new NotImplementedException() - }; + return requestType switch + { + BitcoinRequestType.ChannelOperation => _channelOperationRequestRepository, + BitcoinRequestType.WalletWithdrawal => _walletWithdrawalRequestRepository, + _ => throw new NotImplementedException() + }; } public async Task LockUTXOs(List selectedUTXOs, IBitcoinRequest bitcoinRequest, BitcoinRequestType requestType) @@ -151,12 +150,12 @@ public async Task> GetLockedUTXOsForRequest(IBitcoinRequest bitcoinRe private async Task> FilterLockedFrozenUTXOs(UTXOChanges? utxoChanges) { var lockedUTXOs = await _fmutxoRepository.GetLockedUTXOs(); - var listLocked = lockedUTXOs.Select(utxo => $"{utxo.TxId}-{utxo.OutputIndex}").ToList(); + var listLocked = lockedUTXOs.Select(utxo => $"{utxo.TxId}-{utxo.OutputIndex}").ToList(); var listFrozen = await GetFrozenUTXOs(); var frozenAndLockedOutpoints = new List(); frozenAndLockedOutpoints.AddRange(listLocked); frozenAndLockedOutpoints.AddRange(listFrozen); - + utxoChanges.RemoveDuplicateUTXOs(); var availableUTXOs = new List(); @@ -175,7 +174,7 @@ private async Task> FilterLockedFrozenUTXOs(UTXOChanges? utxoChanges) return availableUTXOs; } - + public async Task> GetFrozenUTXOs() { var frozenUTXOs = await _utxoTagRepository.GetByKeyValue(Constants.IsFrozenTag, "true"); @@ -191,7 +190,7 @@ public async Task> GetFrozenUTXOs() .Union(listManuallyFrozen) .Except(listManuallyUnfrozen) .ToList(); - + return frozenUTXOsList; } diff --git a/src/Services/GRPCMacaroonInterceptor.cs b/src/Services/GRPCMacaroonInterceptor.cs index 48158cec..2a523943 100644 --- a/src/Services/GRPCMacaroonInterceptor.cs +++ b/src/Services/GRPCMacaroonInterceptor.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Grpc.Core; using Grpc.Core.Interceptors; using NuGet.Packaging; @@ -31,4 +47,4 @@ public override AsyncUnaryCall AsyncUnaryCall( return continuation(request, newContext); } -} \ No newline at end of file +} diff --git a/src/Services/LightningClientService.cs b/src/Services/LightningClientService.cs index b6efa88b..c913bef7 100644 --- a/src/Services/LightningClientService.cs +++ b/src/Services/LightningClientService.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Collections.Concurrent; using Google.Protobuf; @@ -67,7 +66,7 @@ private GrpcChannel CreateLightningClient(string? endpoint) var grpcChannel = GrpcChannel.ForAddress($"https://{endpoint}", new GrpcChannelOptions - {HttpHandler = httpHandler, LoggerFactory = NullLoggerFactory.Instance}); + { HttpHandler = httpHandler, LoggerFactory = NullLoggerFactory.Instance }); _logger.LogInformation("New grpc channel created for endpoint {endpoint}", endpoint); @@ -316,4 +315,4 @@ public void FundingStateStepCancel(Node node, byte[] pendingChannelId, Lightning } }, new Metadata { { "macaroon", node.ChannelAdminMacaroon } }); } -} \ No newline at end of file +} diff --git a/src/Services/LightningRouterService.cs b/src/Services/LightningRouterService.cs index 56140d2a..dd452deb 100644 --- a/src/Services/LightningRouterService.cs +++ b/src/Services/LightningRouterService.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Collections.Concurrent; using Grpc.Core; using Grpc.Net.Client; @@ -33,7 +49,7 @@ private GrpcChannel CreateRouterClient(string? endpoint) var grpcChannel = GrpcChannel.ForAddress($"https://{endpoint}", new GrpcChannelOptions - {HttpHandler = httpHandler, LoggerFactory = NullLoggerFactory.Instance}); + { HttpHandler = httpHandler, LoggerFactory = NullLoggerFactory.Instance }); _logger.LogInformation("New grpc channel created for router endpoint {endpoint}", endpoint); diff --git a/src/Services/LightningService.cs b/src/Services/LightningService.cs index c207c290..d127e327 100644 --- a/src/Services/LightningService.cs +++ b/src/Services/LightningService.cs @@ -1,36 +1,34 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -using System.Diagnostics; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + + using System.Runtime.InteropServices; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; +using System.Security.Cryptography; using Google.Protobuf; using Grpc.Core; using Lnrpc; +using Microsoft.EntityFrameworkCore; using NBitcoin; using NBXplorer.DerivationStrategy; using NBXplorer.Models; -using System.Security.Cryptography; using NodeGuard.Data; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Helpers; -using Microsoft.EntityFrameworkCore; using Routerrpc; using Channel = NodeGuard.Data.Models.Channel; using Transaction = NBitcoin.Transaction; @@ -200,6 +198,7 @@ public record RemoteSignerRequest(string Psbt, SigHash? EnforcedSighash, string /// public record RemoteSignerResponse(string? Psbt); + [Obsolete] public async Task OpenChannel(ChannelOperationRequest channelOperationRequest) { await using var context = await _dbContextFactory.CreateDbContextAsync(); @@ -368,8 +367,8 @@ public async Task OpenChannel(ChannelOperationRequest channelOperationRequest) } } - var finalSignedPSBT = await SignWithInternalWallet(channelOperationRequest, fundedPSBT, derivationStrategyBase, channelfundingTx, network); - + var finalSignedPSBT = await SignWithInternalWallet(channelOperationRequest, fundedPSBT, derivationStrategyBase, channelfundingTx, network); + //Null check if (finalSignedPSBT is null) { @@ -721,9 +720,9 @@ public async Task CreateOpenChannelRequest(ChannelOperationR var upfrontShutdownScriptReq = remoteNodeInfo.Features.ContainsKey((uint)FeatureBit.UpfrontShutdownScriptReq); if (upfrontShutdownScriptOpt && remoteNodeInfo.Features[(uint)FeatureBit.UpfrontShutdownScriptOpt] is - { IsKnown: true } || + { IsKnown: true } || upfrontShutdownScriptReq && remoteNodeInfo.Features[(uint)FeatureBit.UpfrontShutdownScriptReq] is - { IsKnown: true }) + { IsKnown: true }) { var address = await GetCloseAddress(channelOperationRequest, derivationStrategyBase, _nbXplorerService, _logger); @@ -787,7 +786,7 @@ public static void CheckArgumentsAreValid(ChannelOperationRequest channelOperati OperationRequestType requestype, ILogger? _logger = null) { if (channelOperationRequest == null) throw new ArgumentNullException(nameof(channelOperationRequest)); - + //If the wallet is watch only, we cannot open a channel as there is no way securely sign the PSBT with SIGHASH_NONE (the internal wallet is not there) if (channelOperationRequest.Wallet != null && channelOperationRequest.Wallet.IsWatchOnly) { @@ -805,8 +804,8 @@ public static void CheckArgumentsAreValid(ChannelOperationRequest channelOperati $"Invalid request. Requested ${channelOperationRequest.RequestType.ToString()} on ${requestype.ToString()} method"; _logger?.LogError(requestInvalid); - - + + throw new ArgumentOutOfRangeException(requestInvalid); } @@ -1461,4 +1460,4 @@ public async Task> GetChannelsState() } } } -} \ No newline at end of file +} diff --git a/src/Services/LocalStorageService.cs b/src/Services/LocalStorageService.cs index 4c0fba7e..1254a9fc 100644 --- a/src/Services/LocalStorageService.cs +++ b/src/Services/LocalStorageService.cs @@ -1,14 +1,30 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; namespace NodeGuard.Services; -public interface ILocalStorageService +public interface ILocalStorageService { Task LoadStorage(string name, T defaultValue); Task SetStorage(string name, T value); } -public class LocalStorageService: ILocalStorageService +public class LocalStorageService : ILocalStorageService { private ProtectedLocalStorage ProtectedLocalStorage; diff --git a/src/Services/LoopService.cs b/src/Services/LoopService.cs index 2f44317e..fd35b283 100644 --- a/src/Services/LoopService.cs +++ b/src/Services/LoopService.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Collections.Concurrent; using Google.Protobuf; using Grpc.Core.Interceptors; @@ -13,8 +29,8 @@ public interface ILoopService GrpcChannel CreateClient(string endpoint); SwapClient.SwapClientClient GetClient(Node node); Task PingAsync(Node node, CancellationToken cancellationToken = default); - Task CreateSwapOutAsync(Node node, SwapOutRequest request, CancellationToken cancellationToken= default); - Task GetSwapAsync(Node node, string swapId, CancellationToken cancellationToken= default); + Task CreateSwapOutAsync(Node node, SwapOutRequest request, CancellationToken cancellationToken = default); + Task GetSwapAsync(Node node, string swapId, CancellationToken cancellationToken = default); Task LoopOutQuoteAsync(Node node, long amt, int confTarget, CancellationToken cancellationToken = default); } @@ -54,7 +70,7 @@ public GrpcChannel CreateClient(string endpoint) return channel; } - + public SwapClient.SwapClientClient GetClient(Node node) { if (string.IsNullOrEmpty(node.LoopdEndpoint) || string.IsNullOrEmpty(node.LoopdMacaroon)) @@ -71,7 +87,7 @@ public SwapClient.SwapClientClient GetClient(Node node) }); } - public async Task PingAsync(Node node, CancellationToken cancellationToken= default) + public async Task PingAsync(Node node, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(node.LoopdEndpoint) || string.IsNullOrEmpty(node.LoopdMacaroon)) { @@ -89,7 +105,7 @@ public async Task PingAsync(Node node, CancellationToken cancellationToken return true; } - public async Task CreateSwapOutAsync(Node node, SwapOutRequest request, CancellationToken cancellationToken= default) + public async Task CreateSwapOutAsync(Node node, SwapOutRequest request, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(node.LoopdEndpoint) || string.IsNullOrEmpty(node.LoopdMacaroon)) { @@ -110,12 +126,14 @@ public async Task CreateSwapOutAsync(Node node, SwapOutRequest req var maxRoutingFeeRatePPM = 10000; // CalcFee returns the swap fee for a given swap amount. - var calcFee = (long amount, long feeBase, long feeRate) => { + var calcFee = (long amount, long feeBase, long feeRate) => + { return feeBase + amount * feeRate / FeeRateTotalPartsPPM; }; // Took from loopd/cmd/loop/main.go - var getMaxRoutingFee = (long amt) => { + var getMaxRoutingFee = (long amt) => + { return calcFee(amt, maxRoutingFeeBaseSats, maxRoutingFeeRatePPM); }; @@ -126,7 +144,7 @@ public async Task CreateSwapOutAsync(Node node, SwapOutRequest req MaxMinerFee = request.MaxMinerFees ?? 0, MaxPrepayAmt = request.PrepayAmtSat ?? 0, MaxSwapFee = request.MaxServiceFees ?? 0, - MaxPrepayRoutingFee = request.MaxRoutingFeesPercent != null ? calcFee(request.PrepayAmtSat ?? 0, maxRoutingFeeBaseSats, request.MaxRoutingFeesPercent.Value * 10000) : getMaxRoutingFee(request.PrepayAmtSat ?? 0), + MaxPrepayRoutingFee = request.MaxRoutingFeesPercent != null ? calcFee(request.PrepayAmtSat ?? 0, maxRoutingFeeBaseSats, request.MaxRoutingFeesPercent.Value * 10000) : getMaxRoutingFee(request.PrepayAmtSat ?? 0), MaxSwapRoutingFee = request.MaxRoutingFeesPercent != null ? calcFee(request.Amount, maxRoutingFeeBaseSats, request.MaxRoutingFeesPercent.Value * 10000) : getMaxRoutingFee(request.Amount), SweepConfTarget = request.SweepConfTarget, HtlcConfirmations = 3, @@ -153,7 +171,7 @@ public async Task CreateSwapOutAsync(Node node, SwapOutRequest req return await GetSwapAsync(node, Convert.ToHexString(response.IdBytes.ToByteArray()).ToLowerInvariant(), cancellationToken); } - public async Task GetSwapAsync(Node node, string swapId, CancellationToken cancellationToken= default) + public async Task GetSwapAsync(Node node, string swapId, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(node.LoopdEndpoint) || string.IsNullOrEmpty(node.LoopdMacaroon)) { @@ -198,14 +216,14 @@ public async Task LoopOutQuoteAsync(Node node, long amt, int c var client = GetClient(node); var quoteRequest = new QuoteRequest - { + { Amt = amt, ConfTarget = 6, ExternalHtlc = true, Private = false - }; + }; _logger.LogInformation("Requesting Loop Out quote for amount {Amount} satoshis", quoteRequest.Amt); return await client.LoopOutQuoteAsync(quoteRequest, null, null, cancellationToken); } -} \ No newline at end of file +} diff --git a/src/Services/NBXplorerService.cs b/src/Services/NBXplorerService.cs index 08f45ad6..604dd57a 100644 --- a/src/Services/NBXplorerService.cs +++ b/src/Services/NBXplorerService.cs @@ -1,11 +1,25 @@ -using System.Text.Json; -using NodeGuard.Helpers; +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using Microsoft.AspNetCore.WebUtilities; using NBitcoin; -using NBXplorer; using NBXplorer.DerivationStrategy; using NBXplorer.Models; using Newtonsoft.Json; +using NodeGuard.Helpers; namespace NodeGuard.Services; @@ -312,4 +326,4 @@ public async Task GetStatusAsync(CancellationToken cancellation = return statusResult; } -} \ No newline at end of file +} diff --git a/src/Services/NotificationService.cs b/src/Services/NotificationService.cs index ba7a4758..200e24d6 100644 --- a/src/Services/NotificationService.cs +++ b/src/Services/NotificationService.cs @@ -1,24 +1,23 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using NodeGuard.Data; using Microsoft.EntityFrameworkCore; +using NodeGuard.Data; using OneSignalApi.Api; using OneSignalApi.Client; using OneSignalApi.Model; @@ -27,58 +26,60 @@ namespace NodeGuard.Services; public class NotificationService { - private readonly DefaultApi _appInstance; - private readonly ILogger _logger; - private readonly IDbContextFactory _dbContextFactory; - private readonly string _oneSignalApiId; - private readonly string _notificationReturnUrl; - - public NotificationService(ILogger logger, IDbContextFactory dbContextFactory) - { - _logger = logger; - _dbContextFactory = dbContextFactory; - _oneSignalApiId = Constants.PUSH_NOTIFICATIONS_ONESIGNAL_APP_ID; - _notificationReturnUrl = Constants.FUNDSMANAGER_ENDPOINT; - - var appConfig = new Configuration(); - appConfig.BasePath = Constants.PUSH_NOTIFICATIONS_ONESIGNAL_API_BASE_PATH; - appConfig.AccessToken = Constants.PUSH_NOTIFICATIONS_ONESIGNAL_API_TOKEN; - _appInstance = new DefaultApi(appConfig); - } + private readonly DefaultApi _appInstance; + private readonly ILogger _logger; + private readonly IDbContextFactory _dbContextFactory; + private readonly string _oneSignalApiId; + private readonly string _notificationReturnUrl; + + public NotificationService(ILogger logger, IDbContextFactory dbContextFactory) + { + _logger = logger; + _dbContextFactory = dbContextFactory; + _oneSignalApiId = Constants.PUSH_NOTIFICATIONS_ONESIGNAL_APP_ID; + _notificationReturnUrl = Constants.FUNDSMANAGER_ENDPOINT; + + var appConfig = new Configuration(); + appConfig.BasePath = Constants.PUSH_NOTIFICATIONS_ONESIGNAL_API_BASE_PATH; + appConfig.AccessToken = Constants.PUSH_NOTIFICATIONS_ONESIGNAL_API_TOKEN; + _appInstance = new DefaultApi(appConfig); + } + + [Obsolete] + public async Task NotifyRequestSigners(int walletId, string sourcePage) + { + if (Constants.PUSH_NOTIFICATIONS_ONESIGNAL_ENABLED) + { + await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); + var notificationReturnUrl = _notificationReturnUrl + sourcePage; + var notifiableUsersString = applicationDbContext.ApplicationUsers + .Where(user => user.Keys.Any(key => key.Wallets.Any(wallet => wallet.Id == walletId))) + .Select(user => user.Id) + .ToList(); + _logger.LogInformation("Sending notifications to the following Ids: {UsersString}", notifiableUsersString); + if (notifiableUsersString.Count > 0) + await SendNotification("There is a pending item awaiting approval. Click here to continue", notifiableUsersString, notificationReturnUrl); + } + } + + [Obsolete] + private async Task SendNotification(string message, List recipientList, string returnUrl) + { + if (!recipientList.Any() || string.IsNullOrWhiteSpace(message)) + { + return; + } - public async Task NotifyRequestSigners(int walletId, string sourcePage) - { - if (Constants.PUSH_NOTIFICATIONS_ONESIGNAL_ENABLED) - { - await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync(); - var notificationReturnUrl = _notificationReturnUrl + sourcePage; - var notifiableUsersString = applicationDbContext.ApplicationUsers - .Where(user => user.Keys.Any(key => key.Wallets.Any(wallet => wallet.Id == walletId))) - .Select(user => user.Id) - .ToList(); - _logger.LogInformation("Sending notifications to the following Ids: {UsersString}", notifiableUsersString); - if(notifiableUsersString.Count > 0) - await SendNotification("There is a pending item awaiting approval. Click here to continue", notifiableUsersString, notificationReturnUrl); - } - } - - private async Task SendNotification(string message, List recipientList, string returnUrl) - { - if (!recipientList.Any() || string.IsNullOrWhiteSpace(message)) - { - return; - } - - var notification = new Notification(appId:_oneSignalApiId) - { - Contents = new StringMap(en: message), - IncludeExternalUserIds = recipientList, - Url = returnUrl - }; + var notification = new Notification(appId: _oneSignalApiId) + { + Contents = new StringMap(en: message), + IncludeExternalUserIds = recipientList, + Url = returnUrl + }; - var response = await _appInstance.CreateNotificationAsync(notification); - if (response != null) - _logger.LogInformation("Notification created for {ResponseRecipients} recipients", response.Recipients); - } + var response = await _appInstance.CreateNotificationAsync(notification); + if (response != null) + _logger.LogInformation("Notification created for {ResponseRecipients} recipients", response.Recipients); + } } diff --git a/src/Services/PriceConversionService.cs b/src/Services/PriceConversionService.cs index 75f0a83e..af138985 100644 --- a/src/Services/PriceConversionService.cs +++ b/src/Services/PriceConversionService.cs @@ -1,6 +1,21 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Text.Json; using NBitcoin; -using NuGet.Protocol; namespace NodeGuard.Services; @@ -10,7 +25,7 @@ public interface IPriceConversionService public decimal SatToUsdConversion(decimal sats, decimal btcPrice); public decimal BtcToUsdConversion(decimal btc, decimal btcPrice); } -public class PriceConversionService: IPriceConversionService +public class PriceConversionService : IPriceConversionService { private readonly HttpClient _httpClient; @@ -56,4 +71,4 @@ public decimal BtcToUsdConversion(decimal btc, decimal btcPrice) { return btc * btcPrice; } -} \ No newline at end of file +} diff --git a/src/Services/RemoteSignerService.cs b/src/Services/RemoteSignerService.cs index f9aa767d..85634392 100644 --- a/src/Services/RemoteSignerService.cs +++ b/src/Services/RemoteSignerService.cs @@ -1,47 +1,25 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -/* - * NodeGuard - * Copyright (C) 2023 ClovrLabs - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Net; using System.Text; using System.Text.Json; using Amazon.Runtime; -using NodeGuard.Helpers; using NBitcoin; +using NodeGuard.Helpers; namespace NodeGuard.Services; @@ -67,7 +45,7 @@ public RemoteSignerServiceService(ILogger logger) PSBT? result; try { - //Check if ENABLE_REMOTE_SIGNER is set + //Check if ENABLE_REMOTE_SIGNER is set if (!Constants.ENABLE_REMOTE_SIGNER) { _logger.LogWarning("Remote signer is disabled but was called"); @@ -76,16 +54,16 @@ public RemoteSignerServiceService(ILogger logger) if (psbt == null) throw new ArgumentNullException(nameof(psbt)); - var region = Constants.AWS_REGION!; + var region = Constants.AWS_REGION!; //AWS Call to lambda function - var awsAccessKeyId = Constants.AWS_ACCESS_KEY_ID; + var awsAccessKeyId = Constants.AWS_ACCESS_KEY_ID; var awsSecretAccessKey = Constants.AWS_SECRET_ACCESS_KEY; var credentials = new ImmutableCredentials( awsAccessKeyId, awsSecretAccessKey, null); - + var requestPayload = new LightningService.RemoteSignerRequest(psbt.ToBase64(), SigHash.All, CurrentNetworkHelper.GetCurrentNetwork().ToString()); @@ -132,4 +110,4 @@ public RemoteSignerServiceService(ILogger logger) return result; } -} \ No newline at end of file +} diff --git a/src/Services/SwapsService.cs b/src/Services/SwapsService.cs index 546456a6..090b7881 100644 --- a/src/Services/SwapsService.cs +++ b/src/Services/SwapsService.cs @@ -1,119 +1,134 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. using NodeGuard.Data.Models; namespace NodeGuard.Services { - public class SwapOutRequest - { - public long Amount { get; set; } - public string? Address { get; set; } - public long? MaxServiceFees { get; set; } - public long? MaxMinerFees { get; set; } - public ulong[]? ChannelsOut { get; set; } - public int? MaxRoutingFeesPercent { get; set; } - public long? PrepayAmtSat { get; set; } - public int SwapPublicationDeadlineMinutes { get; set; } = 60; - public int SweepConfTarget { get; set; } = 400; - } + public class SwapOutRequest + { + public long Amount { get; set; } + public string? Address { get; set; } + public long? MaxServiceFees { get; set; } + public long? MaxMinerFees { get; set; } + public ulong[]? ChannelsOut { get; set; } + public int? MaxRoutingFeesPercent { get; set; } + public long? PrepayAmtSat { get; set; } + public int SwapPublicationDeadlineMinutes { get; set; } = 60; + public int SweepConfTarget { get; set; } = 400; + } - public class SwapResponse - { - public required byte[] Id { get; set; } - public required string HtlcAddress { get; set; } - public long Amount { get; set; } - public long OffchainFee { get; set; } - public long OnchainFee { get; set; } - public long ServerFee { get; set; } - public SwapOutStatus Status { get; set; } - } + public class SwapResponse + { + public required byte[] Id { get; set; } + public required string HtlcAddress { get; set; } + public long Amount { get; set; } + public long OffchainFee { get; set; } + public long OnchainFee { get; set; } + public long ServerFee { get; set; } + public SwapOutStatus Status { get; set; } + } - public class SwapOutQuoteRequest - { - public long Amount { get; set; } - public int ConfTarget { get; set; } - } + public class SwapOutQuoteRequest + { + public long Amount { get; set; } + public int ConfTarget { get; set; } + } - public class SwapOutQuoteResponse - { - public long ServiceFees { get; set; } - public long OffChainFees { get; set; } - public long OnChainFees { get; set; } - public bool CouldEstimateRoutingFees { get; set; } = false; - public long HtlcSweepFeeSat { get; set; } - public long PrepayAmtSat { get; set; } - } + public class SwapOutQuoteResponse + { + public long ServiceFees { get; set; } + public long OffChainFees { get; set; } + public long OnChainFees { get; set; } + public bool CouldEstimateRoutingFees { get; set; } = false; + public long HtlcSweepFeeSat { get; set; } + public long PrepayAmtSat { get; set; } + } - public interface ISwapsService - { - Task CreateSwapOutAsync(Node node, SwapProvider provider, SwapOutRequest request, CancellationToken cancellationToken = default); - Task GetSwapAsync(Node node, SwapProvider provider, string swapId, CancellationToken cancellationToken = default); - Task GetSwapOutQuoteAsync(Node node, SwapProvider provider, SwapOutQuoteRequest request, CancellationToken cancellationToken = default); - } + public interface ISwapsService + { + Task CreateSwapOutAsync(Node node, SwapProvider provider, SwapOutRequest request, CancellationToken cancellationToken = default); + Task GetSwapAsync(Node node, SwapProvider provider, string swapId, CancellationToken cancellationToken = default); + Task GetSwapOutQuoteAsync(Node node, SwapProvider provider, SwapOutQuoteRequest request, CancellationToken cancellationToken = default); + } - public class SwapsService : ISwapsService - { - private readonly ILoopService _loopService; - private readonly ILightningService _lightningService; - public SwapsService(ILoopService loopService, ILightningService lightningService) - { - _loopService = loopService; - _lightningService = lightningService; - } + public class SwapsService : ISwapsService + { + private readonly ILoopService _loopService; + private readonly ILightningService _lightningService; + public SwapsService(ILoopService loopService, ILightningService lightningService) + { + _loopService = loopService; + _lightningService = lightningService; + } - public async Task CreateSwapOutAsync(Node node, SwapProvider provider, SwapOutRequest request, CancellationToken cancellationToken = default) - { - return provider switch - { - SwapProvider.Loop => await _loopService.CreateSwapOutAsync(node, request, cancellationToken), - _ => throw new NotSupportedException($"Swap provider {provider} is not supported.") - }; - } + public async Task CreateSwapOutAsync(Node node, SwapProvider provider, SwapOutRequest request, CancellationToken cancellationToken = default) + { + return provider switch + { + SwapProvider.Loop => await _loopService.CreateSwapOutAsync(node, request, cancellationToken), + _ => throw new NotSupportedException($"Swap provider {provider} is not supported.") + }; + } - public async Task GetSwapAsync(Node node, SwapProvider provider, string swapId, CancellationToken cancellationToken = default) - { - return provider switch - { - SwapProvider.Loop => await _loopService.GetSwapAsync(node, swapId, cancellationToken), - _ => throw new NotSupportedException($"Swap provider {provider} is not supported.") - }; - } + public async Task GetSwapAsync(Node node, SwapProvider provider, string swapId, CancellationToken cancellationToken = default) + { + return provider switch + { + SwapProvider.Loop => await _loopService.GetSwapAsync(node, swapId, cancellationToken), + _ => throw new NotSupportedException($"Swap provider {provider} is not supported.") + }; + } - public async Task GetSwapOutQuoteAsync(Node node, SwapProvider provider, SwapOutQuoteRequest request, CancellationToken cancellationToken = default) - { - return provider switch - { - SwapProvider.Loop => await GetLoopQuoteAsync(node, request, cancellationToken), - _ => throw new NotSupportedException($"Swap provider {provider} is not supported.") - }; - } + public async Task GetSwapOutQuoteAsync(Node node, SwapProvider provider, SwapOutQuoteRequest request, CancellationToken cancellationToken = default) + { + return provider switch + { + SwapProvider.Loop => await GetLoopQuoteAsync(node, request, cancellationToken), + _ => throw new NotSupportedException($"Swap provider {provider} is not supported.") + }; + } - private async Task GetLoopQuoteAsync(Node node, SwapOutQuoteRequest request, CancellationToken cancellationToken) - { - var loopResponse = await _loopService.LoopOutQuoteAsync(node, request.Amount, request.ConfTarget, cancellationToken); + private async Task GetLoopQuoteAsync(Node node, SwapOutQuoteRequest request, CancellationToken cancellationToken) + { + var loopResponse = await _loopService.LoopOutQuoteAsync(node, request.Amount, request.ConfTarget, cancellationToken); - var quote = new SwapOutQuoteResponse - { - ServiceFees = loopResponse.SwapFeeSat, - OnChainFees = loopResponse.HtlcSweepFeeSat, - HtlcSweepFeeSat = loopResponse.HtlcSweepFeeSat, - PrepayAmtSat = loopResponse.PrepayAmtSat - }; + var quote = new SwapOutQuoteResponse + { + ServiceFees = loopResponse.SwapFeeSat, + OnChainFees = loopResponse.HtlcSweepFeeSat, + HtlcSweepFeeSat = loopResponse.HtlcSweepFeeSat, + PrepayAmtSat = loopResponse.PrepayAmtSat + }; - var lnResponse = await _lightningService.EstimateRouteFee(node.PubKey, request.Amount, null, 30); - ArgumentNullException.ThrowIfNull(lnResponse, nameof(lnResponse)); - - if (lnResponse.FailureReason != Lnrpc.PaymentFailureReason.FailureReasonNone) - { - quote.CouldEstimateRoutingFees = false; - quote.OffChainFees = 0; - } - else - { - quote.CouldEstimateRoutingFees = true; - quote.OffChainFees = lnResponse.RoutingFeeMsat / 1000; - } + var lnResponse = await _lightningService.EstimateRouteFee(node.PubKey, request.Amount, null, 30); + ArgumentNullException.ThrowIfNull(lnResponse, nameof(lnResponse)); - return quote; - } - } -} \ No newline at end of file + if (lnResponse.FailureReason != Lnrpc.PaymentFailureReason.FailureReasonNone) + { + quote.CouldEstimateRoutingFees = false; + quote.OffChainFees = 0; + } + else + { + quote.CouldEstimateRoutingFees = true; + quote.OffChainFees = lnResponse.RoutingFeeMsat / 1000; + } + + return quote; + } + } +} diff --git a/src/Shared/CancellableComponent.razor b/src/Shared/CancellableComponent.cs similarity index 51% rename from src/Shared/CancellableComponent.razor rename to src/Shared/CancellableComponent.cs index 24a2e9f3..388586d3 100644 --- a/src/Shared/CancellableComponent.razor +++ b/src/Shared/CancellableComponent.cs @@ -1,4 +1,21 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + namespace NodeGuard.Shared; + using Microsoft.AspNetCore.Components; /// @@ -14,7 +31,9 @@ public abstract class CancellableComponent : ComponentBase, IDisposable /// protected CancellationToken ComponentCancellationToken => (_cancellationTokenSource ??= new()).Token; - /// + /// + /// Disposes the component and cancels the associated cancellation token. + /// public virtual void Dispose() { if (_cancellationTokenSource == null) @@ -27,4 +46,4 @@ public virtual void Dispose() _cancellationTokenSource = null; GC.SuppressFinalize(this); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Data/Models/APITokenTests.cs b/test/NodeGuard.Tests/Data/Models/APITokenTests.cs index bf744c8c..44c2d1aa 100644 --- a/test/NodeGuard.Tests/Data/Models/APITokenTests.cs +++ b/test/NodeGuard.Tests/Data/Models/APITokenTests.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using System.Security.Cryptography; using FluentAssertions; using NodeGuard.Data.Models; @@ -19,4 +35,4 @@ void GenerateTokenHash_TokenGenerated() // Assert token.TokenHash.Should().NotBeNullOrEmpty(); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Data/Models/WalletTests.cs b/test/NodeGuard.Tests/Data/Models/WalletTests.cs index f631d79e..07fadc65 100644 --- a/test/NodeGuard.Tests/Data/Models/WalletTests.cs +++ b/test/NodeGuard.Tests/Data/Models/WalletTests.cs @@ -1,8 +1,24 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using FluentAssertions; -using NodeGuard.Data.Models; -using NodeGuard.TestHelpers; using NBitcoin; using NBitcoin.Scripting; +using NodeGuard.Data.Models; +using NodeGuard.TestHelpers; namespace NodeGuard.Tests; @@ -27,7 +43,7 @@ void GetDerivationStrategy_NoKeys() void GetDerivationStrategy_SingleSigDerivationStrategy() { // Arrange - var wallet = CreateWallet.SingleSig(_internalWallet); + var wallet = CreateWallet.SingleSig(_internalWallet); // Act var result = wallet.GetDerivationStrategy(); @@ -59,31 +75,31 @@ void GetDerivationStrategy_MultiSigDerivationStrategy() derivation.ScriptPubKey.ToString().Should().Be("0 467798178e61383c90c2b55b1b3255b703caf09d74df3990b0094690090b6ad0"); } - + /// - /// This test check that we use sortedmulti() lexicographical order in a correct way by comparing outputdescriptors of address 0/0 between sparrow and our wallet - /// - /// - /// - /// - /// - [Theory] - [InlineData(2, - "tpubDFjD2KhvH1qGE99v1UgQebupcJEPHxjBRkxjmWxesPPz5jP38GBBHCqimqHtiidrVo5P8PxusC38VT1FLEQGxerdLnvpJHrv6nWeZ62M1kF", // m/48'/1'/0'/2' - "tpubDEGgUQHT3g8uJKSvDL8NnMB3x2dvkmHGR7HQVHk1p7TVdSc3Zzt1DM7fVtdtcS5qeFXwimY8uWLryaeRbbHBMiK4b3PZrKdLjrrwJAHmuX7", // m/48'/1'/0'/2' - "sortedmulti(2,026090f9d9a8dfde88e48f6b7d655bff87d174fec71fe3c76adddb998db79292ed,031a5377f25ac17e37416937c852bac0e3e9b112bddf58479d3d91d81630b28b8f,03674f832d2fc0e22fbfe1e992262aa48b619dd5baefbcbd9f1a9eddb1bbc759bf)")] - [InlineData(3, - "tpubDDzUjTi441Y6P2BmULHFnFTTZNx3tzW6sm7zgzWhbqHyqzKun7cXjAMEGhikgG41e8wdSMRsQb8UpNoRLL5rvWQaEBhvtpwZxUuTuKZ5Wau", // m/44'/1'/0'/0 - "tpubDDpWvccRJRR9ExaRZt17QUxj5yDZnsCQy4Q5RiNaJ3yZSxqrm1y9GEayz5Qgk3R8JyLLPTYyb1mCxQCUz4qCt5tzfusk4CdEbeCp9vyY95R", // m/44'/1'/0'/0 - "sortedmulti(3,031a5377f25ac17e37416937c852bac0e3e9b112bddf58479d3d91d81630b28b8f,035b9a3989b650f08e843de6a6ba268c6e33ee4ba009b261cb3a7fda74dd9845d7,037ae0c9b7bd495e68b8efc1eeef61e5f0a5c39790367c82c39faf9f846f6a92c3)")] - public void DerivationScheme_Lexicographicalorder(int mOfN, string xpub1, string xpub2, string expectedOutputDescriptor) - { - //Arrange + /// This test check that we use sortedmulti() lexicographical order in a correct way by comparing outputdescriptors of address 0/0 between sparrow and our wallet + /// + /// + /// + /// + /// + [Theory] + [InlineData(2, + "tpubDFjD2KhvH1qGE99v1UgQebupcJEPHxjBRkxjmWxesPPz5jP38GBBHCqimqHtiidrVo5P8PxusC38VT1FLEQGxerdLnvpJHrv6nWeZ62M1kF", // m/48'/1'/0'/2' + "tpubDEGgUQHT3g8uJKSvDL8NnMB3x2dvkmHGR7HQVHk1p7TVdSc3Zzt1DM7fVtdtcS5qeFXwimY8uWLryaeRbbHBMiK4b3PZrKdLjrrwJAHmuX7", // m/48'/1'/0'/2' + "sortedmulti(2,026090f9d9a8dfde88e48f6b7d655bff87d174fec71fe3c76adddb998db79292ed,031a5377f25ac17e37416937c852bac0e3e9b112bddf58479d3d91d81630b28b8f,03674f832d2fc0e22fbfe1e992262aa48b619dd5baefbcbd9f1a9eddb1bbc759bf)")] + [InlineData(3, + "tpubDDzUjTi441Y6P2BmULHFnFTTZNx3tzW6sm7zgzWhbqHyqzKun7cXjAMEGhikgG41e8wdSMRsQb8UpNoRLL5rvWQaEBhvtpwZxUuTuKZ5Wau", // m/44'/1'/0'/0 + "tpubDDpWvccRJRR9ExaRZt17QUxj5yDZnsCQy4Q5RiNaJ3yZSxqrm1y9GEayz5Qgk3R8JyLLPTYyb1mCxQCUz4qCt5tzfusk4CdEbeCp9vyY95R", // m/44'/1'/0'/0 + "sortedmulti(3,031a5377f25ac17e37416937c852bac0e3e9b112bddf58479d3d91d81630b28b8f,035b9a3989b650f08e843de6a6ba268c6e33ee4ba009b261cb3a7fda74dd9845d7,037ae0c9b7bd495e68b8efc1eeef61e5f0a5c39790367c82c39faf9f846f6a92c3)")] + public void DerivationScheme_Lexicographicalorder(int mOfN, string xpub1, string xpub2, string expectedOutputDescriptor) + { + //Arrange - var testingMultisigWallet = new Wallet - { - MofN = mOfN, - Keys = new List + var testingMultisigWallet = new Wallet + { + MofN = mOfN, + Keys = new List {new() { Name = "fm", @@ -102,24 +118,24 @@ public void DerivationScheme_Lexicographicalorder(int mOfN, string xpub1, string XPUB =xpub2 }, }, - Name = "Test wallet", - WalletAddressType = WalletAddressType.NativeSegwit, - InternalWalletId = 0, - IsFinalised = true, - CreationDatetime = DateTimeOffset.Now - }; - - //Act - - //Shuffle keys - testingMultisigWallet.Keys = testingMultisigWallet.Keys.OrderBy(a => Guid.NewGuid()).ToList(); - //We derive address 0/0 and check against the output descriptor by sparrow - var script = testingMultisigWallet.GetDerivationStrategy().GetDerivation(new KeyPath("0/0")); - var outputDescriptor = OutputDescriptor.InferFromScript(script.Redeem, new FlatSigningRepository(), Network.RegTest); - //We split after the #checksum - var outputDescriptorString = outputDescriptor.ToString().Split("#", StringSplitOptions.TrimEntries).First(); - - //Assert - outputDescriptorString.Should().Be(expectedOutputDescriptor.Trim()); - } -} \ No newline at end of file + Name = "Test wallet", + WalletAddressType = WalletAddressType.NativeSegwit, + InternalWalletId = 0, + IsFinalised = true, + CreationDatetime = DateTimeOffset.Now + }; + + //Act + + //Shuffle keys + testingMultisigWallet.Keys = testingMultisigWallet.Keys.OrderBy(a => Guid.NewGuid()).ToList(); + //We derive address 0/0 and check against the output descriptor by sparrow + var script = testingMultisigWallet.GetDerivationStrategy().GetDerivation(new KeyPath("0/0")); + var outputDescriptor = OutputDescriptor.InferFromScript(script.Redeem, new FlatSigningRepository(), Network.RegTest); + //We split after the #checksum + var outputDescriptorString = outputDescriptor.ToString().Split("#", StringSplitOptions.TrimEntries).First(); + + //Assert + outputDescriptorString.Should().Be(expectedOutputDescriptor.Trim()); + } +} diff --git a/test/NodeGuard.Tests/Data/Models/WalletWithdrawalRequestTests.cs b/test/NodeGuard.Tests/Data/Models/WalletWithdrawalRequestTests.cs index ab048eae..713e3e96 100644 --- a/test/NodeGuard.Tests/Data/Models/WalletWithdrawalRequestTests.cs +++ b/test/NodeGuard.Tests/Data/Models/WalletWithdrawalRequestTests.cs @@ -1,3 +1,19 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using FluentAssertions; using NodeGuard.Data.Models; @@ -6,9 +22,9 @@ namespace NodeGuard.Tests; public class WalletWithdrawalRequestTests { [Fact] - public async Task SignatureCounter_Positive_RequiresInternalwallet() + public Task SignatureCounter_Positive_RequiresInternalwallet() { - + var request = new WalletWithdrawalRequest { @@ -31,21 +47,22 @@ public async Task SignatureCounter_Positive_RequiresInternalwallet() // Act request.Wallet.MofN = 3; - - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsInternalWalletPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsFinalisedPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsTemplatePSBT = false); - + + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsInternalWalletPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsFinalisedPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsTemplatePSBT = false); + request.WalletWithdrawalRequestPSBTs.First().IsTemplatePSBT = true; // Assert request.Wallet.RequiresInternalWalletSigning.Should().Be(true); request.AreAllRequiredHumanSignaturesCollected.Should().Be(true); request.NumberOfSignaturesCollected.Should().Be(2); + return Task.CompletedTask; } - + [Fact] - public async Task SignatureCounter_Positive_NotRequiresInternalwallet() + public Task SignatureCounter_Positive_NotRequiresInternalwallet() { // Arrange @@ -70,21 +87,22 @@ public async Task SignatureCounter_Positive_NotRequiresInternalwallet() // Act request.Wallet.MofN = 2; - - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsInternalWalletPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsFinalisedPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsTemplatePSBT = false); - + + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsInternalWalletPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsFinalisedPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsTemplatePSBT = false); + request.WalletWithdrawalRequestPSBTs.First().IsTemplatePSBT = true; // Assert request.Wallet.RequiresInternalWalletSigning.Should().Be(false); request.AreAllRequiredHumanSignaturesCollected.Should().Be(true); request.NumberOfSignaturesCollected.Should().Be(2); + return Task.CompletedTask; } - + [Fact] - public async Task SignatureCount_Negative_NotRequiresInternalWallet() + public Task SignatureCount_Negative_NotRequiresInternalWallet() { // Arrange var request = new WalletWithdrawalRequest @@ -109,10 +127,10 @@ public async Task SignatureCount_Negative_NotRequiresInternalWallet() request.Wallet.IsHotWallet = false; request.Wallet.MofN = 2; - - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsInternalWalletPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsFinalisedPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsTemplatePSBT = false); + + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsInternalWalletPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsFinalisedPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsTemplatePSBT = false); request.WalletWithdrawalRequestPSBTs.First().IsTemplatePSBT = true; request.WalletWithdrawalRequestPSBTs.Last().IsFinalisedPSBT = true; @@ -121,10 +139,11 @@ public async Task SignatureCount_Negative_NotRequiresInternalWallet() request.Wallet.RequiresInternalWalletSigning.Should().BeFalse(); request.AreAllRequiredHumanSignaturesCollected.Should().BeFalse(); request.NumberOfSignaturesCollected.Should().Be(1); + return Task.CompletedTask; } - + [Fact] - public async Task SignatureCount_Negative_RequiresInternalWallet() + public Task SignatureCount_Negative_RequiresInternalWallet() { // Arrange var request = new WalletWithdrawalRequest @@ -148,10 +167,10 @@ public async Task SignatureCount_Negative_RequiresInternalWallet() // Act request.Wallet.IsHotWallet = false; request.Wallet.MofN = 3; - - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsInternalWalletPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsFinalisedPSBT = false); - request.WalletWithdrawalRequestPSBTs.ForEach(x=> x.IsTemplatePSBT = false); + + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsInternalWalletPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsFinalisedPSBT = false); + request.WalletWithdrawalRequestPSBTs.ForEach(x => x.IsTemplatePSBT = false); request.WalletWithdrawalRequestPSBTs.First().IsTemplatePSBT = true; request.WalletWithdrawalRequestPSBTs.Last().IsFinalisedPSBT = true; @@ -160,8 +179,9 @@ public async Task SignatureCount_Negative_RequiresInternalWallet() request.Wallet.RequiresInternalWalletSigning.Should().BeTrue(); request.AreAllRequiredHumanSignaturesCollected.Should().BeFalse(); request.NumberOfSignaturesCollected.Should().Be(1); + return Task.CompletedTask; } - - - -} \ No newline at end of file + + + +} diff --git a/test/NodeGuard.Tests/Data/Repositories/ChannelOperationRequestRepositoryTests.cs b/test/NodeGuard.Tests/Data/Repositories/ChannelOperationRequestRepositoryTests.cs index fef7352c..b45d9b30 100644 --- a/test/NodeGuard.Tests/Data/Repositories/ChannelOperationRequestRepositoryTests.cs +++ b/test/NodeGuard.Tests/Data/Repositories/ChannelOperationRequestRepositoryTests.cs @@ -1,7 +1,23 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using FluentAssertions; +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories; @@ -15,7 +31,7 @@ private Mock> SetupDbContextFactory() var options = new DbContextOptionsBuilder() .UseInMemoryDatabase(databaseName: "ChannelOperationRequestRepositoryTests" + _random.Next()) .Options; - var context = ()=> new ApplicationDbContext(options); + var context = () => new ApplicationDbContext(options); dbContextFactory.Setup(x => x.CreateDbContext()).Returns(context); dbContextFactory.Setup(x => x.CreateDbContextAsync(default)).ReturnsAsync(context); return dbContextFactory; @@ -125,4 +141,4 @@ public async Task AddAsync_ChannelOpenOperations_SimultaneousOpsAllowed() result.Item1.Should().BeTrue(); result.Item2.Should().BeNull(); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Data/Repositories/ChannelRepositoryTests.cs b/test/NodeGuard.Tests/Data/Repositories/ChannelRepositoryTests.cs index 3bdb6d5d..08509ad4 100644 --- a/test/NodeGuard.Tests/Data/Repositories/ChannelRepositoryTests.cs +++ b/test/NodeGuard.Tests/Data/Repositories/ChannelRepositoryTests.cs @@ -1,32 +1,31 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using AutoMapper; using FluentAssertions; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; -using NodeGuard.Services; using Google.Protobuf; using Lnrpc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; +using NodeGuard.Services; using Quartz; using Channel = NodeGuard.Data.Models.Channel; @@ -186,4 +185,4 @@ public async Task MarkAsClosed_Negative_ChannelFound() channel.Status.Should().Be(Channel.ChannelStatus.Open); result.Item2.Should().NotBeNull(); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Data/Repositories/FUTXORepositoryTests.cs b/test/NodeGuard.Tests/Data/Repositories/FUTXORepositoryTests.cs index 844b2a05..533debd5 100644 --- a/test/NodeGuard.Tests/Data/Repositories/FUTXORepositoryTests.cs +++ b/test/NodeGuard.Tests/Data/Repositories/FUTXORepositoryTests.cs @@ -1,6 +1,22 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using FluentAssertions; -using NodeGuard.Data.Models; using Microsoft.EntityFrameworkCore; +using NodeGuard.Data.Models; namespace NodeGuard.Data.Repositories; @@ -9,16 +25,16 @@ public class FUTXORepositoryTests private readonly Random _random = new(); private Mock> SetupDbContextFactory() - { - var dbContextFactory = new Mock>(); - var options = new DbContextOptionsBuilder() - .UseInMemoryDatabase(databaseName: "FUTXORepositoryTest" + _random.Next()) - .Options; - var context = ()=> new ApplicationDbContext(options); - dbContextFactory.Setup(x => x.CreateDbContext()).Returns(context); - dbContextFactory.Setup(x => x.CreateDbContextAsync(default)).ReturnsAsync(context); - return dbContextFactory; - } + { + var dbContextFactory = new Mock>(); + var options = new DbContextOptionsBuilder() + .UseInMemoryDatabase(databaseName: "FUTXORepositoryTest" + _random.Next()) + .Options; + var context = () => new ApplicationDbContext(options); + dbContextFactory.Setup(x => x.CreateDbContext()).Returns(context); + dbContextFactory.Setup(x => x.CreateDbContextAsync(default)).ReturnsAsync(context); + return dbContextFactory; + } [Fact] public async Task GetLockedUTXOs_emptyArgs() @@ -40,12 +56,12 @@ public async Task GetLockedUTXOs_emptyArgs() Amount = 0.01m } }, - UTXOs = new List { new () { TxId = "1"} } + UTXOs = new List { new() { TxId = "1" } } }); context.ChannelOperationRequests.Add(new ChannelOperationRequest { Status = ChannelOperationRequestStatus.Pending, - Utxos = new List { new () { TxId = "2"} } + Utxos = new List { new() { TxId = "2" } } }); await context.SaveChangesAsync(); @@ -74,13 +90,13 @@ public async Task GetLockedUTXOs_ignoreWithdrawals() Amount = 0.01m } }, - UTXOs = new List { new () { TxId = "1"} } + UTXOs = new List { new() { TxId = "1" } } }); context.ChannelOperationRequests.Add(new ChannelOperationRequest { Id = 2, Status = ChannelOperationRequestStatus.Pending, - Utxos = new List { new () { TxId = "2"} } + Utxos = new List { new() { TxId = "2" } } }); await context.SaveChangesAsync(); @@ -110,17 +126,17 @@ public async Task GetLockedUTXOs_ignoreChannels() Amount = 0.01m } }, - UTXOs = new List { new () { TxId = "1"} } + UTXOs = new List { new() { TxId = "1" } } }); context.ChannelOperationRequests.Add(new ChannelOperationRequest { Id = 2, Status = ChannelOperationRequestStatus.Pending, - Utxos = new List { new () { TxId = "2"} } + Utxos = new List { new() { TxId = "2" } } }); await context.SaveChangesAsync(); - var result = await futxoRepository.GetLockedUTXOs( null, 2); + var result = await futxoRepository.GetLockedUTXOs(null, 2); result.Should().HaveCount(1); result[0].Id.Should().Be(1); } @@ -146,13 +162,13 @@ public async Task GetLockedUTXOs_failedChannels() Amount = 0.01m } }, - UTXOs = new List { new () { TxId = "1"} } + UTXOs = new List { new() { TxId = "1" } } }); context.ChannelOperationRequests.Add(new ChannelOperationRequest { Id = 2, Status = ChannelOperationRequestStatus.Pending, - Utxos = new List { new () { TxId = "2"} } + Utxos = new List { new() { TxId = "2" } } }); await context.SaveChangesAsync(); @@ -182,13 +198,13 @@ public async Task GetLockedUTXOs_failedCWithdrawals() Amount = 0.01m } }, - UTXOs = new List { new () { TxId = "1"} } + UTXOs = new List { new() { TxId = "1" } } }); context.ChannelOperationRequests.Add(new ChannelOperationRequest { Id = 2, Status = ChannelOperationRequestStatus.Failed, - Utxos = new List { new () { TxId = "2"} } + Utxos = new List { new() { TxId = "2" } } }); await context.SaveChangesAsync(); @@ -196,4 +212,4 @@ public async Task GetLockedUTXOs_failedCWithdrawals() result.Should().HaveCount(1); result[0].Id.Should().Be(1); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Data/Repositories/NodeRepositoryTests.cs b/test/NodeGuard.Tests/Data/Repositories/NodeRepositoryTests.cs index 3a7fffd0..a436f2e4 100644 --- a/test/NodeGuard.Tests/Data/Repositories/NodeRepositoryTests.cs +++ b/test/NodeGuard.Tests/Data/Repositories/NodeRepositoryTests.cs @@ -1,9 +1,25 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using FluentAssertions; +using Lnrpc; +using Microsoft.EntityFrameworkCore; using NodeGuard.Data.Models; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Services; -using Lnrpc; -using Microsoft.EntityFrameworkCore; namespace NodeGuard.Data.Repositories; @@ -17,7 +33,7 @@ private Mock> SetupDbContextFactory() var options = new DbContextOptionsBuilder() .UseInMemoryDatabase(databaseName: "NodeRepositoryTests" + _random.Next()) .Options; - var context = ()=> new ApplicationDbContext(options); + var context = () => new ApplicationDbContext(options); dbContextFactory.Setup(x => x.CreateDbContext()).Returns(context); dbContextFactory.Setup(x => x.CreateDbContextAsync(default)).ReturnsAsync(context); return dbContextFactory; @@ -47,4 +63,4 @@ public async Task AddsNewNode_WhenRemoteNodeNotFound() result.Name.Should().Be("TestAlias"); result.PubKey.Should().Be("TestPubKey"); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Data/Repositories/WalletRepositoryTests.cs b/test/NodeGuard.Tests/Data/Repositories/WalletRepositoryTests.cs index 478dc0a4..064187d2 100644 --- a/test/NodeGuard.Tests/Data/Repositories/WalletRepositoryTests.cs +++ b/test/NodeGuard.Tests/Data/Repositories/WalletRepositoryTests.cs @@ -1,29 +1,28 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using FluentAssertions; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using NBXplorer.DerivationStrategy; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Services; using NodeGuard.TestHelpers; @@ -39,7 +38,7 @@ private Mock> SetupDbContextFactory() var options = new DbContextOptionsBuilder() .UseInMemoryDatabase(databaseName: "WalletRepositoryTest" + _random.Next()) .Options; - var context = ()=> new ApplicationDbContext(options); + var context = () => new ApplicationDbContext(options); dbContextFactory.Setup(x => x.CreateDbContext()).Returns(context); dbContextFactory.Setup(x => x.CreateDbContextAsync(default)).ReturnsAsync(context); return dbContextFactory; @@ -60,7 +59,7 @@ public async Task GetNextSubderivationPath_ReturnsDefault() var walletRepository = new WalletRepository(null, null, dbContextFactory.Object, null, null, null); var result = await walletRepository.GetNextSubderivationPath(); result.Should().Be("0"); - } + } [Fact] public async Task GetNextSubderivationPath_ReturnNextIfNoPrevSubDerivPath() @@ -278,4 +277,4 @@ public async Task ImportBIP39Wallet_WhenSeedPhraseIsInvalid_ShouldReturnError() -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Helpers/LightningHelperTests.cs b/test/NodeGuard.Tests/Helpers/LightningHelperTests.cs index 126aa2eb..8caa7ddb 100644 --- a/test/NodeGuard.Tests/Helpers/LightningHelperTests.cs +++ b/test/NodeGuard.Tests/Helpers/LightningHelperTests.cs @@ -1,28 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using FluentAssertions; -using NodeGuard.Data.Models; -using NodeGuard.Helpers; -using NodeGuard.TestHelpers; using NBitcoin; using NBXplorer.Models; +using NodeGuard.Helpers; +using NodeGuard.TestHelpers; namespace NodeGuard.Tests { @@ -31,14 +29,15 @@ public class LightningHelperTests private InternalWallet _internalWallet = CreateWallet.CreateInternalWallet(); [Fact] + [Obsolete] public void UTXODuplicateTest_Duplicated() { //Arrange var utxoFixture = new UTXO { Value = new Money(10), - Outpoint = new OutPoint(uint256.Parse("2cf4255a9860746bd9bb432feb4cf635dcf96435162f58ccd8283f453e0c7679"),1), - Index =1, + Outpoint = new OutPoint(uint256.Parse("2cf4255a9860746bd9bb432feb4cf635dcf96435162f58ccd8283f453e0c7679"), 1), + Index = 1, ScriptPubKey = new Script() }; @@ -61,6 +60,7 @@ public void UTXODuplicateTest_Duplicated() } [Fact] + [Obsolete] public void UTXODuplicateTest_NoDuplicated() { //Arrange @@ -68,7 +68,7 @@ public void UTXODuplicateTest_NoDuplicated() { Value = new Money(10), Outpoint = new OutPoint(uint256.Parse("2cf4255a9860746bd9bb432feb4cf635dcf96435162f58ccd8283f453e0c7679"), 1), - Index =1, + Index = 1, ScriptPubKey = new Script() }; @@ -91,6 +91,7 @@ public void UTXODuplicateTest_NoDuplicated() } [Fact] + [Obsolete] public void AddDerivationData_MultisigSucceeds() { // Arrange @@ -110,7 +111,7 @@ public void AddDerivationData_MultisigSucceeds() var network = Network.RegTest; var destinationAddress = BitcoinAddress.Create("bcrt1q83ml8tve8vh672wsm83getxfzetaquq352jr6t423tdwjvdz3f3qe4r4t7", network); var changeAddress = BitcoinAddress.Create("bcrt1q8k3av6q5yp83rn332lx8a90k6kukhg28hs5qw7krdq95t629hgsqk6ztmf", network); - + var txBuilder = network.CreateTransactionBuilder(); txBuilder.SetSigningOptions(SigHash.All) .SetChange(changeAddress) @@ -127,8 +128,9 @@ public void AddDerivationData_MultisigSucceeds() var psbt = PSBT.Parse("cHNidP8BAIkBAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wD/////AhAnAAAAAAAAIgAgPHfzrZk7L68p0NnijKzJFlfQcBGipD0uqora6TGiimLwvAtUAgAAACIAID2j1mgUIE8RzjFXzH6V9tW5a6FHvCgHesNoC0XpRbogAAAAAE8BBDWHzwMvESQsgAAAAfw77kI6AYzrbSJqBmMojtD7XuD6nXkKs3DQMOBHMObIA4COLhzUgr3QcZaUPFqBM9Fpr4YCK2uwOBdxZE7AdETXEB/M5N4wAACAAQAAgAEAAIBPAQQ1h88DVqwD9IAAAAH5CK5KZrD/oasUtVrwzkjypwIly5AQkC1pAa+QuT6PgQJRrxXgW7i36sGJWz9fR//v7NgyGgLvIimPidCiA33wYBBg86CzMAAAgAEAAIABAACATwEENYfPA325Ro0AAAAAgN63GqLxTu1/NyL0SV4a0Hn1n8Dzg+Wye9nbb16ZISADr+s+pcKnDcSqKHKWSl4v8Rcq80ZqG/7QObYmZUl/xUYQ7QIQyDAAAIABAACAAAAAAAABASsA5AtUAgAAACIAINCp0IUCw4KZ8J/JokbAV1TBQtK4m6WLzUomP5VBhszOAQVpUiEC2FTFYM/mwE4L60Q0G2p5QElV7YlMD7fcgoJEH79pLLEhAwJn/wsRl0hvcYj5Y3Bv3uQlxZ57pBZ9KSeuEPVNmjS/IQNvzitZiz5ksZFSQuRibjPP4pwo+OWOqZLBL2x5ZrFVqVOuIgYC2FTFYM/mwE4L60Q0G2p5QElV7YlMD7fcgoJEH79pLLEYH8zk3jAAAIABAACAAQAAgAAAAAAAAAAAIgYDAmf/CxGXSG9xiPljcG/e5CXFnnukFn0pJ64Q9U2aNL8YYPOgszAAAIABAACAAQAAgAAAAAAAAAAAIgYDb84rWYs+ZLGRUkLkYm4zz+KcKPjljqmSwS9seWaxVakY7QIQyDAAAIABAACAAAAAAAAAAAAAAAAAAAAA", network); result.Should().BeEquivalentTo(psbt); } - + [Fact] + [Obsolete] public void AddDerivationData_SinglesigSucceeds() { // Arrange @@ -148,7 +150,7 @@ public void AddDerivationData_SinglesigSucceeds() var network = Network.RegTest; var destinationAddress = BitcoinAddress.Create("bcrt1q83ml8tve8vh672wsm83getxfzetaquq352jr6t423tdwjvdz3f3qe4r4t7", network); var changeAddress = BitcoinAddress.Create("bcrt1q8k3av6q5yp83rn332lx8a90k6kukhg28hs5qw7krdq95t629hgsqk6ztmf", network); - + var txBuilder = network.CreateTransactionBuilder(); txBuilder.SetSigningOptions(SigHash.All) .SetChange(changeAddress) @@ -162,8 +164,8 @@ public void AddDerivationData_SinglesigSucceeds() var result = LightningHelper.AddDerivationData(wallet, cleanPsbt, utxoList, coins); // Assert - var psbt = PSBT.Parse( "cHNidP8BAIkBAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wD/////AhAnAAAAAAAAIgAgPHfzrZk7L68p0NnijKzJFlfQcBGipD0uqora6TGiimLwvAtUAgAAACIAID2j1mgUIE8RzjFXzH6V9tW5a6FHvCgHesNoC0XpRbogAAAAAE8BBDWHzwN9uUaNAAAAAYPR/OiA1LbTzxbLPvbXvtAwckIG3g+0T1zblR/ZodaiA5zBFsigPpL8htN/KJ/Ph8SPvQA/K+mSNXTSA0hgvPNuEO0CEMgwAACAAQAAgAEAAAAAAQEfAOQLVAIAAAAWABTpOvUBMqNMfl7P81etji6x4fXrMyIGA3uD9HVjgF5E+eQhHp+Na6femVYpc4bCA4DmimehAdWcGO0CEMgwAACAAQAAgAEAAAAAAAAAAAAAAAAAAA==", network); + var psbt = PSBT.Parse("cHNidP8BAIkBAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wD/////AhAnAAAAAAAAIgAgPHfzrZk7L68p0NnijKzJFlfQcBGipD0uqora6TGiimLwvAtUAgAAACIAID2j1mgUIE8RzjFXzH6V9tW5a6FHvCgHesNoC0XpRbogAAAAAE8BBDWHzwN9uUaNAAAAAYPR/OiA1LbTzxbLPvbXvtAwckIG3g+0T1zblR/ZodaiA5zBFsigPpL8htN/KJ/Ph8SPvQA/K+mSNXTSA0hgvPNuEO0CEMgwAACAAQAAgAEAAAAAAQEfAOQLVAIAAAAWABTpOvUBMqNMfl7P81etji6x4fXrMyIGA3uD9HVjgF5E+eQhHp+Na6femVYpc4bCA4DmimehAdWcGO0CEMgwAACAAQAAgAEAAAAAAAAAAAAAAAAAAA==", network); result.Should().BeEquivalentTo(psbt); } } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Helpers/StringHelperTests.cs b/test/NodeGuard.Tests/Helpers/StringHelperTests.cs index 6fb98e19..0b1f3d59 100644 --- a/test/NodeGuard.Tests/Helpers/StringHelperTests.cs +++ b/test/NodeGuard.Tests/Helpers/StringHelperTests.cs @@ -1,27 +1,21 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using FluentAssertions; using NodeGuard.Helpers; @@ -56,7 +50,7 @@ public void TruncateHeadAndTail_Positive(string pubkey, string expectedTruncated [InlineData("", "", 3)] [InlineData(" ", "", 3)] [InlineData(null, "", 3)] - public void TruncateHeadAndTail_Negative(string pubkey, string expectedTruncated, int numberOfCharactersToDisplay) + public void TruncateHeadAndTail_Negative(string? pubkey, string expectedTruncated, int numberOfCharactersToDisplay) { //Arrange @@ -68,4 +62,4 @@ public void TruncateHeadAndTail_Negative(string pubkey, string expectedTruncated result.Should().Be(expectedTruncated); } } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Helpers/WalletParserTests.cs b/test/NodeGuard.Tests/Helpers/WalletParserTests.cs index 918face5..369b50a9 100644 --- a/test/NodeGuard.Tests/Helpers/WalletParserTests.cs +++ b/test/NodeGuard.Tests/Helpers/WalletParserTests.cs @@ -1,30 +1,45 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using FluentAssertions; using NBitcoin; using NBXplorer.DerivationStrategy; using NodeGuard.Data.Models; using NodeGuard.Helpers; -using NSubstitute.ExceptionExtensions; using Key = NodeGuard.Data.Models.Key; namespace NodeGuard.Tests; public class WalletParserTests { - + [Theory] [InlineData("wsh(multi(2,[62a7956f/84h/1h/0h]tpubDDXgATYzdQkHHhZZCMcNJj8BGDENvzMVou5v9NdxiP4rxDLj33nS233dGFW4htpVZSJ6zds9eVqAV9RyRHHiKtwQKX8eR4n4KN3Dwmj7A3h/0/*,[11312aa2/84h/1h/0h]tpubDC8a54NFtQtMQAZ97VhoU9V6jVTvi9w4Y5SaAXJSBYETKg3AoX5CCKndznhPWxJUBToPCpT44s86QbKdGpKAnSjcMTGW4kE6UQ8vpBjcybW/0/*,[8f71b834/84h/1h/0h]tpubDChjnP9LXNrJp43biqjY7FH93wgRRNrNxB4Q8pH7PPRy8UPcH2S6V46WGVJ47zVGF7SyBJNCpnaogsFbsybVQckGtVhCkng3EtFn8qmxptS/0/*))", "2-of-tpubDDXgATYzdQkHHhZZCMcNJj8BGDENvzMVou5v9NdxiP4rxDLj33nS233dGFW4htpVZSJ6zds9eVqAV9RyRHHiKtwQKX8eR4n4KN3Dwmj7A3h-tpubDC8a54NFtQtMQAZ97VhoU9V6jVTvi9w4Y5SaAXJSBYETKg3AoX5CCKndznhPWxJUBToPCpT44s86QbKdGpKAnSjcMTGW4kE6UQ8vpBjcybW-tpubDChjnP9LXNrJp43biqjY7FH93wgRRNrNxB4Q8pH7PPRy8UPcH2S6V46WGVJ47zVGF7SyBJNCpnaogsFbsybVQckGtVhCkng3EtFn8qmxptS-[keeporder]", - "RegTest", 2,3)] + "RegTest", 2, 3)] [InlineData("wsh(sortedmulti(2,[00000000/48h/1h/1h]tpubDCNTr5eMFBvYQJKJNySFcXM3HdxjseLSpTA5crAPAbXYjBb5zgtwKrHTTdRu11vUCZVYeHcV6H2oj2reuGma9Hu3t1LSPNgL5b8F6W6hsQN/0/*,[60f3a0b3/48h/1h/1h]tpubDCfM7v7fKZ31gTGGggNMycfCr5cDGinyijveRZ44RYSgAgEARwhaBd6PPpWst8kKbhEVoqNasgjHFWZKrEQoJ9pzPVEmNZDNe92hShzEMDy/0/*,[60f3a0b2/48h/1h/1h]tpubDCwziS3VhtLnXSR7oL9Xkft5LVbrsfEQ9h7YkCNSa1cYSi1KNuMEnsb9NeouNjpq91KSK3R87jFx8oFGvSM5g9Vax1VrvawWzD9xnGjgndB/0/*))#jt4e29lt", "2-of-tpubDCfM7v7fKZ31gTGGggNMycfCr5cDGinyijveRZ44RYSgAgEARwhaBd6PPpWst8kKbhEVoqNasgjHFWZKrEQoJ9pzPVEmNZDNe92hShzEMDy-tpubDCNTr5eMFBvYQJKJNySFcXM3HdxjseLSpTA5crAPAbXYjBb5zgtwKrHTTdRu11vUCZVYeHcV6H2oj2reuGma9Hu3t1LSPNgL5b8F6W6hsQN-tpubDCwziS3VhtLnXSR7oL9Xkft5LVbrsfEQ9h7YkCNSa1cYSi1KNuMEnsb9NeouNjpq91KSK3R87jFx8oFGvSM5g9Vax1VrvawWzD9xnGjgndB", - "RegTest", 2,3)] - public void ParseOutputDescriptor_ValidSegwitMultisig(string descriptor, string expectedDerivationStrategy, string network, int m , int n) + "RegTest", 2, 3)] + public void ParseOutputDescriptor_ValidSegwitMultisig(string descriptor, string expectedDerivationStrategy, string network, int m, int n) { //Arrange var currentNetwork = Network.GetNetwork(network); //Act - var (strategyBase,valueTuples) = WalletParser.ParseOutputDescriptor(descriptor, currentNetwork); + var (strategyBase, valueTuples) = WalletParser.ParseOutputDescriptor(descriptor, currentNetwork); //Assert strategyBase.ToString().Should().Be(expectedDerivationStrategy); @@ -35,9 +50,9 @@ public void ParseOutputDescriptor_ValidSegwitMultisig(string descriptor, string rootedKeyPath.Should().NotBeNull(); } strategyBase.Should().BeOfType(); - + ((P2WSHDerivationStrategy)strategyBase).Inner.Should().BeOfType(); - + var inner = (MultisigDerivationStrategy)((P2WSHDerivationStrategy)strategyBase).Inner; inner.IsLegacy.Should().BeFalse(); @@ -50,14 +65,14 @@ public void ParseOutputDescriptor_ValidSegwitMultisig(string descriptor, string CreationDatetime = DateTimeOffset.UtcNow, Name = "Imported key from output descriptor", XPUB = x.Item1.ToString() ?? throw new InvalidOperationException(), - Description =null, + Description = null, MasterFingerprint = x.Item2.MasterFingerprint.ToString(), Path = x.Item2.KeyPath.ToString(), IsBIP39ImportedKey = false, - + }).ToList(); - var msigStrategy = ((P2WSHDerivationStrategy) strategyBase).Inner as MultisigDerivationStrategy; + var msigStrategy = ((P2WSHDerivationStrategy)strategyBase).Inner as MultisigDerivationStrategy; //Create a wallet from the descriptor and test the matching strategies var wallet = new Data.Models.Wallet() { @@ -65,17 +80,17 @@ public void ParseOutputDescriptor_ValidSegwitMultisig(string descriptor, string Keys = new List(keys), IsUnSortedMultiSig = !msigStrategy.LexicographicOrder }; - + var derivationStrategy = wallet.GetDerivationStrategy(); - + derivationStrategy.Should().BeOfType(); - + ((P2WSHDerivationStrategy)derivationStrategy).Inner.Should().BeOfType(); - + strategyBase.ToString().Should().Be(derivationStrategy.ToString()); } - + [Theory] [InlineData("wsh(sortedmulti(2,[00000000/48h/1h/1h]tpubDCNTr5eMFBvYQJKJNySFcXM3HdxjseLSpTA5crAPAbXYjBb5zgtwKrHTTdRu11vUCZVYeHcV6H2oj2reuGma9Hu3t1LSPNgL5b8F6W6hsQN/<0;1>/*,[60f3a0b3/48h/1h/1h]tpubDCfM7v7fKZ31gTGGggNMycfCr5cDGinyijveRZ44RYSgAgEARwhaBd6PPpWst8kKbhEVoqNasgjHFWZKrEQoJ9pzPVEmNZDNe92hShzEMDy/<0;1>/*,[60f3a0b2/48h/1h/1h]tpubDCwziS3VhtLnXSR7oL9Xkft5LVbrsfEQ9h7YkCNSa1cYSi1KNuMEnsb9NeouNjpq91KSK3R87jFx8oFGvSM5g9Vax1VrvawWzD9xnGjgndB/<0;1>/*))#wjr8h7a2", "regtest")] public void ParseOutputDescriptor_InvalidSegwitMultisig_ChangePath(string descriptor, @@ -90,7 +105,7 @@ public void ParseOutputDescriptor_InvalidSegwitMultisig_ChangePath(string descri //Assert function.Should().ThrowExactly("Invalid descriptor should throw an exception when parsed"); } - + [Theory] [InlineData("sh(sortedmulti(2,[00000000/48h/1h/1h]tpubDCNTr5eMFBvYQJKJNySFcXM3HdxjseLSpTA5crAPAbXYjBb5zgtwKrHTTdRu11vUCZVYeHcV6H2oj2reuGma9Hu3t1LSPNgL5b8F6W6hsQN/0/*,[60f3a0b3/48h/1h/1h]tpubDCfM7v7fKZ31gTGGggNMycfCr5cDGinyijveRZ44RYSgAgEARwhaBd6PPpWst8kKbhEVoqNasgjHFWZKrEQoJ9pzPVEmNZDNe92hShzEMDy/0/*,[60f3a0b2/48h/1h/1h]tpubDCwziS3VhtLnXSR7oL9Xkft5LVbrsfEQ9h7YkCNSa1cYSi1KNuMEnsb9NeouNjpq91KSK3R87jFx8oFGvSM5g9Vax1VrvawWzD9xnGjgndB/0/*))", "regtest")] [InlineData("sh(wsh(sortedmulti(2,[00000000/48h/1h/1h]tpubDCNTr5eMFBvYQJKJNySFcXM3HdxjseLSpTA5crAPAbXYjBb5zgtwKrHTTdRu11vUCZVYeHcV6H2oj2reuGma9Hu3t1LSPNgL5b8F6W6hsQN/0/*,[60f3a0b3/48h/1h/1h]tpubDCfM7v7fKZ31gTGGggNMycfCr5cDGinyijveRZ44RYSgAgEARwhaBd6PPpWst8kKbhEVoqNasgjHFWZKrEQoJ9pzPVEmNZDNe92hShzEMDy/0/*,[60f3a0b2/48h/1h/1h]tpubDCwziS3VhtLnXSR7oL9Xkft5LVbrsfEQ9h7YkCNSa1cYSi1KNuMEnsb9NeouNjpq91KSK3R87jFx8oFGvSM5g9Vax1VrvawWzD9xnGjgndB/0/*)))", "regtest")] @@ -108,16 +123,16 @@ public void ParseOutputDescriptor_InvalidSegwitMultisig_UnsupportedMultisig(stri } [Theory] - [InlineData("wpkh([8bafd160/49h/0h/0h]xpub661MyMwAqRbcGVBsTGeNZN6QGVHmMHLdSA4FteGsRrEriu4pnVZMZWnruFFFXkMnyoBjyHndD3Qwcfz4MPzBUxjSevweNFQx7SAYZATtcDw/0/*)#9x4vkw48","xpub661MyMwAqRbcGVBsTGeNZN6QGVHmMHLdSA4FteGsRrEriu4pnVZMZWnruFFFXkMnyoBjyHndD3Qwcfz4MPzBUxjSevweNFQx7SAYZATtcDw","mainnet")] - [InlineData("wpkh([deadbeef/0h/1h/2]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0/*)","xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL","mainnet")] - public async Task ParseOutputDescriptor_ValidSegwitSinglesig(string descriptor, string expectedDerivationStrategy, string network) + [InlineData("wpkh([8bafd160/49h/0h/0h]xpub661MyMwAqRbcGVBsTGeNZN6QGVHmMHLdSA4FteGsRrEriu4pnVZMZWnruFFFXkMnyoBjyHndD3Qwcfz4MPzBUxjSevweNFQx7SAYZATtcDw/0/*)#9x4vkw48", "xpub661MyMwAqRbcGVBsTGeNZN6QGVHmMHLdSA4FteGsRrEriu4pnVZMZWnruFFFXkMnyoBjyHndD3Qwcfz4MPzBUxjSevweNFQx7SAYZATtcDw", "mainnet")] + [InlineData("wpkh([deadbeef/0h/1h/2]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0/*)", "xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL", "mainnet")] + public Task ParseOutputDescriptor_ValidSegwitSinglesig(string descriptor, string expectedDerivationStrategy, string network) { //Arrange var currentNetwork = Network.GetNetwork(network); - + //Act - var (strategyBase,valueTuples) = WalletParser.ParseOutputDescriptor(descriptor, currentNetwork); - + var (strategyBase, valueTuples) = WalletParser.ParseOutputDescriptor(descriptor, currentNetwork); + //Assert strategyBase.ToString().Should().Be(expectedDerivationStrategy); valueTuples.Length.Should().Be(1); @@ -128,20 +143,20 @@ public async Task ParseOutputDescriptor_ValidSegwitSinglesig(string descriptor, rootedKeyPath.Should().NotBeNull(); } strategyBase.Should().BeOfType(); - ((DirectDerivationStrategy) strategyBase).Segwit.Should().Be(true); - + ((DirectDerivationStrategy)strategyBase).Segwit.Should().Be(true); + return Task.CompletedTask; } - + [Theory] - [InlineData("wpkh([8b60afd1/49h/0h/0h]xpub661MyMwAFXkMnyoBjyHndD3QwRbcGVBsTGeNZN6QGVHcfz4MPzBUxjSevweNFQx7SqmMHLdSA4FteGsRrEriu4pnVZMZWnruFFAYZATtcDw/0/*)#9x4vkw48","mainnet")] //Invalid checksum - [InlineData("invalid","mainnet")] //Invalid descriptor - [InlineData("wpkh([8b60afd1/49h/0h/0h]xpub661MyMwAFXkMnyoBjyHndD3QwRbcGVBsTGeNZN6QGVHcfz4MPzBUxjSevweNFQx7SqmMHLdSA4FteGsRrEriu4pnVZMZWnruFFAYZATtcDw/0/*)#9x4vkw48","testnet")] //Invalid network - [InlineData("pkh(xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/2147483648","mainnet")] + [InlineData("wpkh([8b60afd1/49h/0h/0h]xpub661MyMwAFXkMnyoBjyHndD3QwRbcGVBsTGeNZN6QGVHcfz4MPzBUxjSevweNFQx7SqmMHLdSA4FteGsRrEriu4pnVZMZWnruFFAYZATtcDw/0/*)#9x4vkw48", "mainnet")] //Invalid checksum + [InlineData("invalid", "mainnet")] //Invalid descriptor + [InlineData("wpkh([8b60afd1/49h/0h/0h]xpub661MyMwAFXkMnyoBjyHndD3QwRbcGVBsTGeNZN6QGVHcfz4MPzBUxjSevweNFQx7SqmMHLdSA4FteGsRrEriu4pnVZMZWnruFFAYZATtcDw/0/*)#9x4vkw48", "testnet")] //Invalid network + [InlineData("pkh(xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/2147483648", "mainnet")] public void ParseOutputDescriptor_InvalidSegwitSingleSig(string descriptor, string network) { //Arrange var currentNetwork = Network.GetNetwork(network); - + //Act var function = () => WalletParser.ParseOutputDescriptor(descriptor, currentNetwork); @@ -149,7 +164,7 @@ public void ParseOutputDescriptor_InvalidSegwitSingleSig(string descriptor, stri } - + // Testing GetOutputDescriptor method [Fact] public void GetOutputDescriptor_NativeSegwits() @@ -163,7 +178,7 @@ public void GetOutputDescriptor_NativeSegwits() WalletAddressType = WalletAddressType.NativeSegwit, MofN = 1, InternalWalletSubDerivationPath = "0", - Keys = new List() { + Keys = new List() { new() { XPUB = "xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB", Path = "48'/0'/0'", @@ -195,17 +210,17 @@ public void GetOutputDescriptor_NativeSegwits() }, new() { - XPUB = "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz", - Path = "48'/0'/2", + XPUB = "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz", + Path = "48'/0'/2", MasterFingerprint = "ed0210c8" } } }; - + // Act var outputDescriptor1 = wallet1HotWalletCreated.GetOutputDescriptor("mainnet"); var outputDescriptor2 = wallet1ColdWallet.GetOutputDescriptor("mainnet"); - + // Assert outputDescriptor1.Should().Be("wpkh([ed0210c8/48'/0'/0']xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/0/*)#yt9sugwc"); outputDescriptor2.Should().Be( @@ -215,7 +230,7 @@ public void GetOutputDescriptor_NativeSegwits() "[ed0210c8/48'/0'/2]xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz/0/*))#8qt3h45m" ); } - + [Fact] public void GetOutputDescriptor_NestedSegwits() { @@ -228,7 +243,7 @@ public void GetOutputDescriptor_NestedSegwits() WalletAddressType = WalletAddressType.NestedSegwit, MofN = 1, InternalWalletSubDerivationPath = "0", - Keys = new List() { + Keys = new List() { new() { XPUB = "xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB", Path = "48'/0'/0'", @@ -237,7 +252,7 @@ public void GetOutputDescriptor_NestedSegwits() } } }; - + // Testing NodeGuard created Nested Segwit cold wallet var wallet1ColdWallet = new Wallet() { @@ -260,17 +275,17 @@ public void GetOutputDescriptor_NestedSegwits() }, new() { - XPUB = "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz", - Path = "48'/0'/2", + XPUB = "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz", + Path = "48'/0'/2", MasterFingerprint = "ed0210c8" } } }; - + //Act var outputDescriptor1 = wallet1HotWalletCreated.GetOutputDescriptor("mainnet"); var outputDescriptor2 = wallet1ColdWallet.GetOutputDescriptor("mainnet"); - + // Assert outputDescriptor1.Should().Be("sh(wpkh([ed0210c8/48'/0'/0']xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/0/*))#u4qug9gg"); outputDescriptor2.Should().Be( @@ -333,11 +348,11 @@ public void GetOutputDescriptor_Legacy() } } }; - + // Act var outputDescriptor1 = wallet1HotWalletCreated.GetOutputDescriptor("mainnet"); var outputDescriptor2 = wallet1ColdWallet.GetOutputDescriptor("mainnet"); - + // Assert outputDescriptor1.Should().Be("pkh([ed0210c8/48'/0'/0']xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/0/*)#p7sn6nw0"); outputDescriptor2.Should().Be( @@ -360,7 +375,7 @@ public void GetOutputDescriptor_Taproot() WalletAddressType = WalletAddressType.Taproot, MofN = 1, InternalWalletSubDerivationPath = "0", - Keys = new List() { + Keys = new List() { new() { XPUB = "xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB", Path = "48'/0'/0'", @@ -369,7 +384,7 @@ public void GetOutputDescriptor_Taproot() } } }; - + // Testing NodeGuard created Taproot cold wallet var wallet1ColdWallet = new Wallet() { @@ -392,17 +407,17 @@ public void GetOutputDescriptor_Taproot() }, new() { - XPUB = "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz", - Path = "48'/0'/2", + XPUB = "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz", + Path = "48'/0'/2", MasterFingerprint = "ed0210c8" } } }; - + // Act var taprootFunction1 = () => wallet1HotWalletCreated.GetOutputDescriptor("mainnet"); var taprootFunction2 = () => wallet1ColdWallet.GetOutputDescriptor("mainnet"); - + // Assert taprootFunction1.Should().Throw(); taprootFunction2.Should().Throw(); diff --git a/test/NodeGuard.Tests/Jobs/ChannelMonitorJobTests.cs b/test/NodeGuard.Tests/Jobs/ChannelMonitorJobTests.cs index 7e1cc555..6d1bafd0 100644 --- a/test/NodeGuard.Tests/Jobs/ChannelMonitorJobTests.cs +++ b/test/NodeGuard.Tests/Jobs/ChannelMonitorJobTests.cs @@ -1,32 +1,31 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using FluentAssertions; +using Google.Protobuf; +using Lnrpc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using NodeGuard.Data; using NodeGuard.Data.Models; using NodeGuard.Helpers; using NodeGuard.Jobs; using NodeGuard.Services; -using Google.Protobuf; -using Lnrpc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; using Channel = NodeGuard.Data.Models.Channel; namespace NodeGuard.Tests.Jobs; @@ -364,4 +363,4 @@ public async Task MarkClosedChannelsAsClosed_ChannelsIsClosed() var existingChannel2 = await newContext.Channels.LastAsync(); existingChannel2.Status.Should().Be(Channel.ChannelStatus.Closed); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Jobs/NodeChannelSubscribeJobTests.cs b/test/NodeGuard.Tests/Jobs/NodeChannelSubscribeJobTests.cs index b40e0242..bccdead3 100644 --- a/test/NodeGuard.Tests/Jobs/NodeChannelSubscribeJobTests.cs +++ b/test/NodeGuard.Tests/Jobs/NodeChannelSubscribeJobTests.cs @@ -1,27 +1,26 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +using Lnrpc; +using Microsoft.Extensions.Logging; using NodeGuard.Data.Repositories.Interfaces; using NodeGuard.Jobs; using NodeGuard.Services; -using Lnrpc; -using Microsoft.Extensions.Logging; using Channel = NodeGuard.Data.Models.Channel; using Node = NodeGuard.Data.Models.Node; @@ -97,4 +96,4 @@ public async Task NodeUpdateManagement_UpdatesChannelStatus_WhenClosedChannelEve Assert.Equal(Channel.ChannelStatus.Closed, channelToClose.Status); _channelRepositoryMock.Verify(repo => repo.Update(channelToClose), Times.Once); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Rpc/GRPCAuthInterceptorTests.cs b/test/NodeGuard.Tests/Rpc/GRPCAuthInterceptorTests.cs index cc57dee9..bcc328b0 100644 --- a/test/NodeGuard.Tests/Rpc/GRPCAuthInterceptorTests.cs +++ b/test/NodeGuard.Tests/Rpc/GRPCAuthInterceptorTests.cs @@ -1,3 +1,18 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. using FluentAssertions; using Grpc.Core; @@ -15,30 +30,30 @@ public async Task AuthInterceptor_NoTokenProvided() var context = TestServerCallContext.Create(); var mockedApiTokenRepository = new Mock(); var interceptor = new GRPCAuthInterceptor(mockedApiTokenRepository.Object); - var continuation = new UnaryServerMethod(async (request, context) => { return "response"; }); - + var continuation = new UnaryServerMethod((request, context) => { return Task.FromResult("response"); }); + // Act & Assert var act = () => interceptor.UnaryServerHandler(String.Empty, context, continuation); - + // Assert await act .Should() .ThrowAsync() .WithMessage($"Status(StatusCode=\"Unauthenticated\", Detail=\"No token provided\")"); } - + [Fact] public async Task AuthInterceptor_NonExistingToken() { // Arrange - var context = TestServerCallContext.Create(new Metadata{{"auth-token", "iamastupidtoken"}}); + var context = TestServerCallContext.Create(new Metadata { { "auth-token", "iamastupidtoken" } }); var mockedApiTokenRepository = new Mock(); var interceptor = new GRPCAuthInterceptor(mockedApiTokenRepository.Object); - var continuation = new UnaryServerMethod(async (request, context) => { return "response"; }); - + var continuation = new UnaryServerMethod((request, context) => { return Task.FromResult("response"); }); + // Act var act = () => interceptor.UnaryServerHandler(String.Empty, context, continuation); - + // Assert await act .Should() @@ -46,7 +61,7 @@ await act .WithMessage("Status(StatusCode=\"Unauthenticated\", Detail=\"Invalid token\")"); } - + [Fact] public async Task AuthInterceptor_ExistingTokenValid() { @@ -57,22 +72,22 @@ public async Task AuthInterceptor_ExistingTokenValid() //GetBytoken mocked to return a valid token mockedApiTokenRepository.Setup(x => x.GetByToken(It.IsAny())) .ReturnsAsync(apiTokenFixture); - - var context = TestServerCallContext.Create(new Metadata{{"auth-token", validToken}}); + + var context = TestServerCallContext.Create(new Metadata { { "auth-token", validToken } }); var interceptor = new GRPCAuthInterceptor(mockedApiTokenRepository.Object); var mockContinuation = new Mock>(); mockContinuation.Setup(x => x.Invoke( - It.IsAny(), + It.IsAny(), It.IsAny()) ) .ReturnsAsync("response"); - + // In order to test if the request is continued, which would mean that the token is valid, // we mock the continuation function and we verify that it is called once. - + // Act await interceptor.UnaryServerHandler(String.Empty, context, mockContinuation.Object); - + // Assert mockContinuation.Verify( c => c( @@ -80,29 +95,29 @@ public async Task AuthInterceptor_ExistingTokenValid() It.IsAny()), Times.Once); } - + [Fact] public async Task AuthInterceptor_ExistingTokenInvalid() { // Arrange var validToken = "iamaninvalidtoken"; - var apiTokenFixture = new APIToken { TokenHash = validToken , IsBlocked = true}; + var apiTokenFixture = new APIToken { TokenHash = validToken, IsBlocked = true }; var mockedApiTokenRepository = new Mock(); //GetBytoken mocked to return a valid token mockedApiTokenRepository.Setup(x => x.GetByToken(It.IsAny())) .ReturnsAsync(apiTokenFixture); - - var context = TestServerCallContext.Create(new Metadata{{"auth-token", validToken}}); + + var context = TestServerCallContext.Create(new Metadata { { "auth-token", validToken } }); var interceptor = new GRPCAuthInterceptor(mockedApiTokenRepository.Object); - var continuation = new UnaryServerMethod(async (request, context) => { return "response"; }); + var continuation = new UnaryServerMethod((request, context) => { return Task.FromResult("response"); }); // Act var act = () => interceptor.UnaryServerHandler(String.Empty, context, continuation); - + // Assert await act .Should() .ThrowAsync() .WithMessage("Status(StatusCode=\"Unauthenticated\", Detail=\"Invalid token\")"); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Rpc/NodeGuardServiceTests.cs b/test/NodeGuard.Tests/Rpc/NodeGuardServiceTests.cs index 8a8d1345..3523184f 100644 --- a/test/NodeGuard.Tests/Rpc/NodeGuardServiceTests.cs +++ b/test/NodeGuard.Tests/Rpc/NodeGuardServiceTests.cs @@ -1,30 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Collections.Specialized; using AutoMapper; using FluentAssertions; -using NodeGuard.Automapper; -using NodeGuard.Data; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Services; using Grpc.Core; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -32,6 +26,12 @@ using NBXplorer.DerivationStrategy; using NBXplorer.Models; using Nodeguard; +using NodeGuard.Automapper; +using NodeGuard.Data; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Services; using Quartz; using Quartz.Impl; using Channel = NodeGuard.Data.Models.Channel; @@ -67,9 +67,9 @@ public async Task OpenChannel_SourceNodeNotFound_ReturnsNotFoundError() var destPubKey = "destPubKey"; var walletId = 1; - nodeRepositoryMock.Setup(repo => repo.GetByPubkey(sourcePubKey)).ReturnsAsync((Node) null); + nodeRepositoryMock.Setup(repo => repo.GetByPubkey(sourcePubKey)).ReturnsAsync((Node)null); nodeRepositoryMock.Setup(repo => repo.GetByPubkey(destPubKey)) - .ReturnsAsync(new Node {Id = 2, PubKey = destPubKey}); + .ReturnsAsync(new Node { Id = 2, PubKey = destPubKey }); var service = new NodeGuardService(_logger.Object, new Mock().Object, new Mock().Object, @@ -109,8 +109,8 @@ public async Task OpenChannel_DestinationNodeNotFound_ReturnsNotFoundError() var walletId = 1; nodeRepositoryMock.Setup(repo => repo.GetByPubkey(sourcePubKey)) - .ReturnsAsync(new Node {Id = 1, PubKey = sourcePubKey}); - nodeRepositoryMock.Setup(repo => repo.GetByPubkey(destPubKey)).ReturnsAsync((Node) null); + .ReturnsAsync(new Node { Id = 1, PubKey = sourcePubKey }); + nodeRepositoryMock.Setup(repo => repo.GetByPubkey(destPubKey)).ReturnsAsync((Node)null); var service = new NodeGuardService(_logger.Object, new Mock().Object, new Mock().Object, @@ -154,11 +154,11 @@ public async Task OpenChannel_ValidRequest_OpensChannelAndReturnsResponse() var psbt = PSBT.FromTransaction(Transaction.Create(Network.RegTest), Network.RegTest); nodeRepositoryMock.Setup(repo => repo.GetByPubkey(sourcePubKey)) - .ReturnsAsync(new Node {Id = 1, PubKey = sourcePubKey}); + .ReturnsAsync(new Node { Id = 1, PubKey = sourcePubKey }); nodeRepositoryMock.Setup(repo => repo.GetByPubkey(destPubKey)) - .ReturnsAsync(new Node {Id = 2, PubKey = destPubKey}); + .ReturnsAsync(new Node { Id = 2, PubKey = destPubKey }); walletRepositoryMock.Setup(repo => repo.GetById(walletId)) - .ReturnsAsync(new Wallet {Id = walletId}); + .ReturnsAsync(new Wallet { Id = walletId }); channelOperationRequestRepositoryMock.Setup(repo => repo.AddAsync(It.IsAny())) .ReturnsAsync((true, null)); lightningServiceMock.Setup(service => service.GenerateTemplatePSBT(new ChannelOperationRequest())) @@ -218,13 +218,13 @@ public async Task OpenChannel_ValidRequest_OpensChangelessChannelAndReturnsRespo var sourcePubKey = "sourcePubKey"; var destPubKey = "destPubKey"; var walletId = 1; - var wallet = new Wallet() {Id = walletId}; + var wallet = new Wallet() { Id = walletId }; var psbt = PSBT.FromTransaction(Transaction.Create(Network.RegTest), Network.RegTest); nodeRepositoryMock.Setup(repo => repo.GetByPubkey(sourcePubKey)) - .ReturnsAsync(new Node {Id = 1, PubKey = sourcePubKey}); + .ReturnsAsync(new Node { Id = 1, PubKey = sourcePubKey }); nodeRepositoryMock.Setup(repo => repo.GetByPubkey(destPubKey)) - .ReturnsAsync(new Node {Id = 2, PubKey = destPubKey}); + .ReturnsAsync(new Node { Id = 2, PubKey = destPubKey }); walletRepositoryMock.Setup(repo => repo.GetById(walletId)) .ReturnsAsync(wallet); coinSelectionServiceMock.Setup(service => service.GetUTXOsByOutpointAsync(wallet.GetDerivationStrategy(), @@ -295,12 +295,12 @@ public async Task OpenChannel_FailedRequest_NoOutPoints() var sourcePubKey = "sourcePubKey"; var destPubKey = "destPubKey"; var walletId = 1; - var wallet = new Wallet() {Id = walletId}; + var wallet = new Wallet() { Id = walletId }; nodeRepositoryMock.Setup(repo => repo.GetByPubkey(sourcePubKey)) - .ReturnsAsync(new Node {Id = 1, PubKey = sourcePubKey}); + .ReturnsAsync(new Node { Id = 1, PubKey = sourcePubKey }); nodeRepositoryMock.Setup(repo => repo.GetByPubkey(destPubKey)) - .ReturnsAsync(new Node {Id = 2, PubKey = destPubKey}); + .ReturnsAsync(new Node { Id = 2, PubKey = destPubKey }); walletRepositoryMock.Setup(repo => repo.GetById(walletId)) .ReturnsAsync(wallet); @@ -391,7 +391,7 @@ public async Task CloseChannel_ChannelNotFound_ReturnsNotFoundError() ulong channelId = 1234; - channelRepositoryMock.Setup(repo => repo.GetByChanId(It.IsAny())).ReturnsAsync((Channel) null); + channelRepositoryMock.Setup(repo => repo.GetByChanId(It.IsAny())).ReturnsAsync((Channel)null); var service = new NodeGuardService( _logger.Object, new Mock().Object, @@ -476,7 +476,7 @@ public async Task GetLiquidityRules_Success() RebalanceTarget = 0.5M, ChannelId = 1, SwapWalletId = 1, - ReverseSwapWalletId = 1, + ReverseSwapWalletId = 1, SwapWallet = new Wallet(), ReverseSwapWallet = new Wallet(), NodeId = 0, @@ -519,7 +519,7 @@ public async Task GetLiquidityRules_Success() result.LiquidityRules.Should().NotBeEmpty(); result.LiquidityRules.First().MinimumLocalBalance.Should() - .Be((float) (liquidityRules.First().MinimumLocalBalance)); + .Be((float)(liquidityRules.First().MinimumLocalBalance)); } [Fact] @@ -652,7 +652,8 @@ public async Task RequestWithdrawal_Success() } [Fact] - public async Task RequestWithdrawal_NoWallet() + [Obsolete] + public Task RequestWithdrawal_NoWallet() { //Arrange var wallet = InitMockRequestWithdrawal(out var walletRepository, @@ -666,7 +667,7 @@ public async Task RequestWithdrawal_NoWallet() out var walletWithdrawalRequestRepository, out _); - walletRepository.Setup(x => x.GetById(It.IsAny())).ReturnsAsync((Wallet) null); + walletRepository.Setup(x => x.GetById(It.IsAny())).ReturnsAsync((Wallet)null); var requestWithdrawalRequest = new RequestWithdrawalRequest { @@ -690,10 +691,12 @@ public async Task RequestWithdrawal_NoWallet() //Assert resp.Should().ThrowAsync(); + return Task.CompletedTask; } [Fact] - public async Task RequestWithdrawal_NoAvailableUTXOs() + [Obsolete] + public Task RequestWithdrawal_NoAvailableUTXOs() { //Arrange var wallet = InitMockRequestWithdrawal(out var walletRepository, @@ -732,10 +735,12 @@ public async Task RequestWithdrawal_NoAvailableUTXOs() //Assert resp.Should().ThrowAsync(); + return Task.CompletedTask; } [Fact] - public async Task RequestWithdrawal_FailureRepoSave() + [Obsolete] + public Task RequestWithdrawal_FailureRepoSave() { //Arrange var wallet = InitMockRequestWithdrawal(out var walletRepository, @@ -774,10 +779,12 @@ public async Task RequestWithdrawal_FailureRepoSave() //Assert resp.Should().ThrowAsync(); + return Task.CompletedTask; } [Fact] - public async Task RequestWithdrawal_NullTemplatePSBT() + [Obsolete] + public Task RequestWithdrawal_NullTemplatePSBT() { //Arrange var wallet = InitMockRequestWithdrawal(out var walletRepository, @@ -816,6 +823,7 @@ public async Task RequestWithdrawal_NullTemplatePSBT() //Assert resp.Should().ThrowAsync(); + return Task.CompletedTask; } private Wallet InitMockRequestWithdrawal(out Mock walletRepository, @@ -875,7 +883,7 @@ private Wallet InitMockRequestWithdrawal(out Mock walletRepos bitcoinService = new Mock(); - utxoChanges.Confirmed = new UTXOChange() {UTXOs = utxoList}; + utxoChanges.Confirmed = new UTXOChange() { UTXOs = utxoList }; bitcoinService.Setup(x => x.GenerateTemplatePSBT(It.IsAny())) .ReturnsAsync(psbt); @@ -1273,7 +1281,7 @@ public async Task GetAvailableWallets_ReturnsIds() var request = new GetAvailableWalletsRequest() { - Id = {1, 3} + Id = { 1, 3 } }; var nodeGuardService = new NodeGuardService(null, null, walletRepository, null, null, null, null, scheduleFactory.Object, new Mock().Object, @@ -1296,7 +1304,7 @@ public async Task GetAvailableWallets_CantPassTwoFilters() var request = new GetAvailableWalletsRequest() { WalletType = WALLET_TYPE.Hot, - Id = {1, 3} + Id = { 1, 3 } }; var nodeGuardService = new NodeGuardService(null, null, null, null, null, null, null, scheduleFactory.Object, null, diff --git a/test/NodeGuard.Tests/Rpc/TestServerCallContext.cs b/test/NodeGuard.Tests/Rpc/TestServerCallContext.cs index 02a8f5be..b7274abe 100644 --- a/test/NodeGuard.Tests/Rpc/TestServerCallContext.cs +++ b/test/NodeGuard.Tests/Rpc/TestServerCallContext.cs @@ -1,20 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using Grpc.Core; @@ -76,4 +76,4 @@ public static TestServerCallContext Create(Metadata? requestHeaders = null, { return new TestServerCallContext(requestHeaders ?? new Metadata(), cancellationToken); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Services/BitcoinServiceTests.cs b/test/NodeGuard.Tests/Services/BitcoinServiceTests.cs index 5e5ebebc..e3ab5176 100644 --- a/test/NodeGuard.Tests/Services/BitcoinServiceTests.cs +++ b/test/NodeGuard.Tests/Services/BitcoinServiceTests.cs @@ -1,13 +1,29 @@ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + using AutoMapper; using FluentAssertions; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.Helpers; -using NodeGuard.TestHelpers; using Microsoft.Extensions.Logging; using NBitcoin; using NBXplorer.DerivationStrategy; using NBXplorer.Models; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; +using NodeGuard.TestHelpers; using NSubstitute.Exceptions; using Key = NodeGuard.Data.Models.Key; diff --git a/test/NodeGuard.Tests/Services/LightningClientServiceTests.cs b/test/NodeGuard.Tests/Services/LightningClientServiceTests.cs index ef4bc27d..eb925a71 100644 --- a/test/NodeGuard.Tests/Services/LightningClientServiceTests.cs +++ b/test/NodeGuard.Tests/Services/LightningClientServiceTests.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using FluentAssertions; using Microsoft.Extensions.Logging; @@ -25,7 +24,7 @@ namespace NodeGuard.Services; public class LightningClientServiceTests { [Fact] - public async Task CreateLightningClient_EndpointIsNull() + public Task CreateLightningClient_EndpointIsNull() { // Arrange var logger = new Mock>(); @@ -39,6 +38,7 @@ public async Task CreateLightningClient_EndpointIsNull() .Should() .Throw() .WithMessage("Value cannot be null. (Parameter 'endpoint')"); + return Task.CompletedTask; } [Fact] @@ -54,4 +54,4 @@ public void CreateLightningClient_ReturnsLightningClient() // Assert result.Should().NotBeNull(); } -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Services/LightningServiceTests.cs b/test/NodeGuard.Tests/Services/LightningServiceTests.cs index fa417b42..f6ad23aa 100644 --- a/test/NodeGuard.Tests/Services/LightningServiceTests.cs +++ b/test/NodeGuard.Tests/Services/LightningServiceTests.cs @@ -1,36 +1,35 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using System.Security.Cryptography; -using Microsoft.Extensions.Logging; -using NodeGuard.Data; -using NodeGuard.Data.Models; -using NodeGuard.Data.Repositories.Interfaces; -using NodeGuard.TestHelpers; -using NBXplorer.Models; using FluentAssertions; -using NodeGuard.Helpers; using Google.Protobuf; using Lnrpc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using NBitcoin; using NBXplorer.DerivationStrategy; -using Microsoft.EntityFrameworkCore; +using NBXplorer.Models; +using NodeGuard.Data; +using NodeGuard.Data.Models; +using NodeGuard.Data.Repositories.Interfaces; +using NodeGuard.Helpers; +using NodeGuard.TestHelpers; using Channel = NodeGuard.Data.Models.Channel; namespace NodeGuard.Services @@ -72,6 +71,7 @@ public void CheckArgumentsAreValid_RequestTypeNotOpen() } [Fact] + [Obsolete] public async Task OpenChannel_ChannelOperationRequestNotFound() { // Arrange @@ -297,7 +297,7 @@ private static Mock GetNBXplorerServiceFullyMocked(UTXOChange var nbXplorerMock = new Mock(); //Mock to return a wallet address var keyPathInformation = new KeyPathInformation() - { Address = BitcoinAddress.Create("bcrt1q590shaxaf5u08ml8jwlzghz99dup3z9592vxal", Network.RegTest) }; + { Address = BitcoinAddress.Create("bcrt1q590shaxaf5u08ml8jwlzghz99dup3z9592vxal", Network.RegTest) }; nbXplorerMock .Setup(x => x.GetUnusedAsync(It.IsAny(), It.IsAny(), @@ -355,6 +355,7 @@ public void GetCombinedPsbt_CombinedPSBTExists() } [Fact] + [Obsolete] public async Task OpenChannel_SuccessLegacyMultiSig() { // Arrange @@ -497,7 +498,7 @@ public async Task OpenChannel_SuccessLegacyMultiSig() .ReturnsAsync((true, "")); lightningClientService.Setup( - x => x.FundingStateStepVerify(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())); lightningClientService.Setup( + x => x.FundingStateStepVerify(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())); lightningClientService.Setup( x => x.FundingStateStepFinalize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())); // Mock channel repository var channelRepository = new Mock(); @@ -547,6 +548,7 @@ public async Task OpenChannel_SuccessLegacyMultiSig() } [Fact] + [Obsolete] public async Task OpenChannel_SuccessMultiSig() { // Arrange @@ -700,7 +702,7 @@ public async Task OpenChannel_SuccessMultiSig() It.IsAny(), It.IsAny(), It.IsAny() - )); lightningClient + )); lightningClient .Setup(x => x.FundingStateStepFinalize( It.IsAny(), It.IsAny(), @@ -760,6 +762,7 @@ public async Task OpenChannel_SuccessMultiSig() } [Fact] + [Obsolete] public async Task OpenChannel_SuccessSingleSigBip39() { // Arrange @@ -974,6 +977,7 @@ public async Task OpenChannel_SuccessSingleSigBip39() /// This means that we need in in a m-of-n multisig, m-1 signatures so nodeguard is that last one to sign to avoid leaking signatures with SIGHASH_NONE /// [Fact] + [Obsolete] public async Task OpenChannel_FailedIncorrectNumberOfHumanSigs() { // Arrange @@ -1192,6 +1196,7 @@ public async Task OpenChannel_FailedIncorrectNumberOfHumanSigs() } [Fact] + [Obsolete] public async Task OpenChannel_SuccessSingleSig() { // Arrange @@ -1621,7 +1626,7 @@ public async Task GetChannelsStatus_SourceNodeIsManaged_SourceIsInitiator() }; lightningClientService.Setup(x => x.ListChannels(It.IsAny(), null)).ReturnsAsync(listChannelsResponse); - var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null ,null, lightningClientService.Object, null); + var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null, null, lightningClientService.Object, null); // Act var channelStatus = await lightningService.GetChannelsState(); @@ -1665,7 +1670,7 @@ public async Task GetChannelsStatus_SourceNodeIsManaged_SourceIsNotInitiator() }; lightningClientService.Setup(x => x.ListChannels(It.IsAny(), null)).ReturnsAsync(listChannelsResponse); - var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null ,null, lightningClientService.Object, null); + var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null, null, lightningClientService.Object, null); // Act var channelStatus = await lightningService.GetChannelsState(); @@ -1732,7 +1737,7 @@ public async Task GetChannelsStatus_BothNodesAreManaged_SourceIsInitiator() lightningClientService.SetupSequence(x => x.ListChannels(It.IsAny(), null)) .ReturnsAsync(listChannelsResponse1) .ReturnsAsync(listChannelsResponse2); - var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null ,null, lightningClientService.Object, null); + var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null, null, lightningClientService.Object, null); // Act var channelStatus = await lightningService.GetChannelsState(); @@ -1799,7 +1804,7 @@ public async Task GetChannelsStatus_BothNodesAreManaged_SourceIsNotInitiator() lightningClientService.SetupSequence(x => x.ListChannels(It.IsAny(), null)) .ReturnsAsync(listChannelsResponse1) .ReturnsAsync(listChannelsResponse2); - var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null ,null, lightningClientService.Object, null); + var lightningService = new LightningService(null, null, nodeRepository.Object, null, null, null, null, null, null, lightningClientService.Object, null); // Act var channelStatus = await lightningService.GetChannelsState(); diff --git a/test/NodeGuard.Tests/TestHelpers/MockHelpers.cs b/test/NodeGuard.Tests/TestHelpers/MockHelpers.cs index d7b94787..c7fc58fb 100644 --- a/test/NodeGuard.Tests/TestHelpers/MockHelpers.cs +++ b/test/NodeGuard.Tests/TestHelpers/MockHelpers.cs @@ -1,29 +1,24 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; + + +using Grpc.Core; using NodeGuard.Data; using NodeGuard.Data.Repositories.Interfaces; -using Grpc.Core; -using Moq; namespace NodeGuard.TestHelpers; @@ -74,4 +69,4 @@ public MockAsyncStreamReader(IEnumerable results) public Task MoveNext(CancellationToken cancellationToken) => Task.Run(() => enumerator.MoveNext()); -} \ No newline at end of file +} diff --git a/test/NodeGuard.Tests/Usings.cs b/test/NodeGuard.Tests/Usings.cs index 64534d40..2b606bdf 100644 --- a/test/NodeGuard.Tests/Usings.cs +++ b/test/NodeGuard.Tests/Usings.cs @@ -1,21 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + +global using Moq; global using Xunit; -global using Moq; \ No newline at end of file diff --git a/test/NodeGuard.Tests/ValidationHelperTests.cs b/test/NodeGuard.Tests/ValidationHelperTests.cs index 885de2d6..62c21a60 100644 --- a/test/NodeGuard.Tests/ValidationHelperTests.cs +++ b/test/NodeGuard.Tests/ValidationHelperTests.cs @@ -1,20 +1,20 @@ -/* - * NodeGuard - * Copyright (C) 2023 Elenpay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ +// NodeGuard +// Copyright (C) 2025 Elenpay +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY, without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see http://www.gnu.org/licenses/. + + using NodeGuard.Helpers; @@ -29,7 +29,7 @@ public class ValidationHelperTests [InlineData(null, false)] [InlineData("tpubDCNTr5eMFBvYQJKJNySFcXM3HdxjseLS", false)] - public void ValidateXPUBTest(string xpub, bool expected) + public void ValidateXPUBTest(string? xpub, bool expected) { //Arrange @@ -43,4 +43,4 @@ public void ValidateXPUBTest(string xpub, bool expected) -} \ No newline at end of file +}