Skip to content

Commit

Permalink
Backend: upgrade NBitcoin to version 7.0.13
Browse files Browse the repository at this point in the history
Updated NBitcoin to version 7.0.13 because older NBitcoin
versions can't decode bech32 strings of length > 90, which is
needed for Silent Payment address decoding. Use property
UnknownParameters of BitcoinUrlBuilder as UnknowParameters
is deprecated. Had to change some code since return type of
new property is different.
  • Loading branch information
webwarrior-ws committed Jul 15, 2024
1 parent 3af561c commit 9d3c534
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.0.2\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="NBitcoin">
<HintPath>..\..\packages\NBitcoin.6.0.17\lib\net461\NBitcoin.dll</HintPath>
<HintPath>..\..\packages\NBitcoin.7.0.13\lib\netstandard2.0\NBitcoin.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="FSharp.Core" version="4.7.0" targetFramework="net461" />
<package id="Fsdk" version="0.6.0--date20230530-1155.git-3bb8d08" targetFramework="net46" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="net46" />
<package id="NBitcoin" version="6.0.17" targetFramework="net471" />
<package id="NBitcoin" version="7.0.13" targetFramework="net471" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net46" />
<package id="NUnit" version="2.6.4" targetFramework="net46" />
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/GWallet.Backend-legacy.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
<HintPath>..\..\packages\NBitcoin.Altcoins.3.0.8\lib\net452\NBitcoin.Altcoins.dll</HintPath>
</Reference>
<Reference Include="NBitcoin">
<HintPath>..\..\packages\NBitcoin.6.0.17\lib\net461\NBitcoin.dll</HintPath>
<HintPath>..\..\packages\NBitcoin.7.0.13\lib\netstandard2.0\NBitcoin.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions">
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/GWallet.Backend.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.2">
<GeneratePathProperty></GeneratePathProperty>
</PackageReference>
<PackageReference Include="NBitcoin" Version="6.0.17">
<PackageReference Include="NBitcoin" Version="7.0.13">
<GeneratePathProperty></GeneratePathProperty>
</PackageReference>
<PackageReference Include="NBitcoin.Altcoins" Version="3.0.8">
Expand Down
7 changes: 4 additions & 3 deletions src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,10 @@ module Account =
}
}

let MaybeReportWarningsForUnknownParameters addressOrUrl (unknownParams: System.Collections.Generic.Dictionary<string, string>) =
let MaybeReportWarningsForUnknownParameters addressOrUrl (unknownParams: System.Collections.Generic.IReadOnlyDictionary<string, string>) =
if not (isNull unknownParams) && unknownParams.Any() then
// convert unknownParams to mutable dictionary since we may have to remove keys from it
let unknownParams = dict <| seq { for key in unknownParams.Keys -> key, unknownParams.[key] }

let unknownToUs =

Expand All @@ -607,8 +609,7 @@ module Account =
if addressOrUrl.StartsWith "bitcoin:" || addressOrUrl.StartsWith "litecoin:" then
let uriBuilder = BitcoinUrlBuilder (addressOrUrl, network)

// FIXME: fix typo "UnknowParameters" in NBitcoin
MaybeReportWarningsForUnknownParameters addressOrUrl uriBuilder.UnknowParameters
MaybeReportWarningsForUnknownParameters addressOrUrl uriBuilder.UnknownParameters

if null = uriBuilder.Address then
failwith <| SPrintF1 "Address started with 'bitcoin:' but an address could not be extracted: %s" addressOrUrl
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="net46" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net46" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net46" />
<package id="NBitcoin" version="6.0.17" targetFramework="net471" />
<package id="NBitcoin" version="7.0.13" targetFramework="net471" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="net452" />
<package id="Nethereum" version="0.99.0--date20240303-0535.git-f0bc8be" targetFramework="net471" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net471" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.0.2\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="NBitcoin">
<HintPath>..\..\packages\NBitcoin.6.0.17\lib\netstandard2.1\NBitcoin.dll</HintPath>
<HintPath>..\..\packages\NBitcoin.7.0.13\lib\netstandard2.1\NBitcoin.dll</HintPath>
</Reference>
<Reference Include="NBitcoin.Altcoins">
<HintPath>..\..\packages\NBitcoin.Altcoins.3.0.8\lib\netstandard2.1\NBitcoin.Altcoins.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.Android/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="monoandroid90" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="monoandroid90" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="monoandroid90" />
<package id="NBitcoin" version="6.0.17" targetFramework="monoandroid90" />
<package id="NBitcoin" version="7.0.13" targetFramework="monoandroid90" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="monoandroid90" />
<package id="Nethereum" version="0.99.0--date20240303-0535.git-f0bc8be" targetFramework="monoandroid90" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="monoandroid90" />
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="NBitcoin">
<HintPath>..\..\packages\NBitcoin.6.0.17\lib\net461\NBitcoin.dll</HintPath>
<HintPath>..\..\packages\NBitcoin.7.0.13\lib\netstandard2.0\NBitcoin.dll</HintPath>
</Reference>
<Reference Include="NBitcoin.Altcoins">
<HintPath>..\..\packages\NBitcoin.Altcoins.3.0.8\lib\net452\NBitcoin.Altcoins.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.Gtk/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<package id="JsonRpcSharp" version="0.99.0--date20240303-0338.git-d673848" targetFramework="net471" />
<package id="Microsoft.CSharp" version="4.3.0" targetFramework="net471" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="net461" />
<package id="NBitcoin" version="6.0.17" targetFramework="net471" />
<package id="NBitcoin" version="7.0.13" targetFramework="net471" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="net471" />
<package id="Nethereum" version="0.99.0--date20240303-0535.git-f0bc8be" targetFramework="net471" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net461" />
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="NBitcoin">
<HintPath>..\..\packages\NBitcoin.6.0.17\lib\netstandard2.1\NBitcoin.dll</HintPath>
<HintPath>..\..\packages\NBitcoin.7.0.13\lib\netstandard2.1\NBitcoin.dll</HintPath>
</Reference>
<Reference Include="NBitcoin.Altcoins">
<HintPath>..\..\packages\NBitcoin.Altcoins.3.0.8\lib\netstandard2.1\NBitcoin.Altcoins.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.Mac/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="xamarinmac20" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="xamarinmac20" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="xamarinmac20" />
<package id="NBitcoin" version="6.0.17" targetFramework="xamarinmac20" />
<package id="NBitcoin" version="7.0.13" targetFramework="xamarinmac20" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="xamarinmac20" />
<package id="Nethereum" version="0.99.0--date20240303-0535.git-f0bc8be" targetFramework="xamarinmac20" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="xamarinmac20" />
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.iOS/GWallet.Frontend.XF.iOS.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="NBitcoin">
<HintPath>..\..\packages\NBitcoin.6.0.17\lib\netstandard2.1\NBitcoin.dll</HintPath>
<HintPath>..\..\packages\NBitcoin.7.0.13\lib\netstandard2.1\NBitcoin.dll</HintPath>
</Reference>
<Reference Include="NBitcoin.Altcoins">
<HintPath>..\..\packages\NBitcoin.Altcoins.3.0.8\lib\netstandard2.1\NBitcoin.Altcoins.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.XF.iOS/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="xamarinios10" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="xamarinios10" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="xamarinios10" />
<package id="NBitcoin" version="6.0.17" targetFramework="xamarinios10" />
<package id="NBitcoin" version="7.0.13" targetFramework="xamarinios10" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="xamarinios10" />
<package id="Nethereum" version="0.99.0--date20240303-0535.git-f0bc8be" targetFramework="xamarinios10" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="xamarinios10" />
Expand Down

0 comments on commit 9d3c534

Please sign in to comment.