Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
61286b6
plugin: Add SignClient
Wi1l-B0t Apr 13, 2025
6966048
Merge branch 'master' into plugin.sign-client
cschuchardt88 Apr 15, 2025
60b5fbd
Merge branch 'master' into plugin.sign-client
NGDAdmin Apr 16, 2025
d6a4d2b
Merge branch 'master' into plugin.sign-client
NGDAdmin Apr 17, 2025
517503e
Update src/Plugins/SignClient/SignClient.cs
shargon Apr 17, 2025
f82b80f
Merge branch 'master' into plugin.sign-client
Apr 17, 2025
3337619
optimize: better error message when rpc exception
Wi1l-B0t Apr 17, 2025
9b39bec
Merge branch 'master' into plugin.sign-client
Wi1l-B0t Apr 17, 2025
25ad27e
Merge branch 'master' into plugin.sign-client
Wi1l-B0t Apr 17, 2025
3a6b8d1
Merge branch 'master' into plugin.sign-client
Wi1l-B0t Apr 17, 2025
f119221
optimize: exception message for invalid input
Wi1l-B0t Apr 17, 2025
a978d57
Merge branch 'master' into plugin.sign-client
Wi1l-B0t Apr 18, 2025
298a9de
rename SignerFactory to SignerManger, and add more comments
Wi1l-B0t Apr 19, 2025
359a252
Merge branch 'master' into plugin.sign-client
Apr 21, 2025
52f349e
Merge branch 'master' into plugin.sign-client
NGDAdmin Apr 22, 2025
5bc2526
Merge branch 'master' into plugin.sign-client
Apr 22, 2025
e8383f8
Merge branch 'master' into plugin.sign-client
Wi1l-B0t Apr 24, 2025
66f3033
Merge branch 'master' into plugin.sign-client
Apr 26, 2025
f7f2a16
Merge branch 'master' into plugin.sign-client
NGDAdmin Apr 29, 2025
1aec52b
Merge branch 'master' into plugin.sign-client
Wi1l-B0t Apr 30, 2025
3bc0e65
optimize sign client settings
Wi1l-B0t May 2, 2025
d8d884a
Move EndPoint to settings
shargon May 5, 2025
2258eca
Clean
shargon May 5, 2025
e3d83d4
Merge branch 'master' into plugin.sign-client
shargon May 5, 2025
ad723b5
Merge branch 'master' into plugin.sign-client
Wi1l-B0t May 5, 2025
d6f477b
Merge branch 'master' into plugin.sign-client
cschuchardt88 May 7, 2025
ad78c74
Merge branch 'master' into plugin.sign-client
shargon May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
351 changes: 345 additions & 6 deletions neo.sln

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Neo.CLI/CLI/MainService.Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void OnCloseWalletCommand()

if (CurrentWallet is not null)
{
SignerFactory.UnregisterSigner(CurrentWallet.Name);
SignerManager.UnregisterSigner(CurrentWallet.Name);
}

CurrentWallet = null;
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.CLI/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void CreateWallet(string path, string password, bool createDefaultAccount
wallet.Save();

CurrentWallet = wallet;
SignerFactory.RegisterSigner(wallet.Name, wallet);
SignerManager.RegisterSigner(wallet.Name, wallet);
}

private bool NoWallet()
Expand Down Expand Up @@ -296,10 +296,10 @@ public void OpenWallet(string path, string password)
throw new FileNotFoundException($"Wallet file \"{path}\" not found.");
}

if (CurrentWallet is not null) SignerFactory.UnregisterSigner(CurrentWallet.Name);
if (CurrentWallet is not null) SignerManager.UnregisterSigner(CurrentWallet.Name);

CurrentWallet = Wallet.Open(path, password, NeoSystem.Settings) ?? throw new NotSupportedException();
SignerFactory.RegisterSigner(CurrentWallet.Name, CurrentWallet);
SignerManager.RegisterSigner(CurrentWallet.Name, CurrentWallet);
}

public async void Start(CommandLineOptions options)
Expand Down
2 changes: 1 addition & 1 deletion src/Neo/Sign/ISigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Neo.Sign
public interface ISigner
{
/// <summary>
/// Signs the <see cref="ContractParametersContext"/> with the wallet.
/// Signs the <see cref="ContractParametersContext"/> with the signer.
/// </summary>
/// <param name="context">The <see cref="ContractParametersContext"/> to be used.</param>
/// <returns>
Expand Down
3 changes: 2 additions & 1 deletion src/Neo/Sign/SignException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class SignException : Exception
/// Initializes a new instance of the <see cref="SignException"/> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public SignException(string message) : base(message) { }
/// <param name="cause">The cause of the exception.</param>
public SignException(string message, Exception cause = null) : base(message, cause) { }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2015-2025 The Neo Project.
//
// SignerFactory.cs file belongs to the neo project and is free
// SignerManager.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
Expand All @@ -15,7 +15,7 @@

namespace Neo.Sign
{
public static class SignerFactory
public static class SignerManager
{
private static readonly ConcurrentDictionary<string, ISigner> s_signers = new();

Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/DBFTPlugin/DBFTPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void IWalletChangedHandler.IWalletProvider_WalletChanged_Handler(object sender,
[ConsoleCommand("start consensus", Category = "Consensus", Description = "Start consensus service (dBFT)")]
private void OnStart(string signerName = "")
{
var signer = SignerFactory.GetSignerOrDefault(signerName);
var signer = SignerManager.GetSignerOrDefault(signerName);
Start(signer ?? walletProvider.GetWallet());
}

Expand Down
57 changes: 57 additions & 0 deletions src/Plugins/SignClient/Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (C) 2015-2025 The Neo Project.
//
// Settings.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Microsoft.Extensions.Configuration;
using System.Net;

namespace Neo.Plugins.SignClient
{
public class Settings : PluginSettings
{
/// <summary>
/// Only support local host at present, so host always is "127.0.0.1" or "::1" now.
/// </summary>
public static readonly string DefaultEndpoint = $"http://{IPAddress.Loopback}:9991";
public const string SectionName = "PluginConfiguration";

/// <summary>
/// The name of the sign client(i.e. Signer).
/// </summary>
public readonly string Name;

/// <summary>
/// The host of the sign client(i.e. Signer).
/// </summary>
public readonly string Endpoint;

public Settings(IConfigurationSection section) : base(section)
{
Name = section.GetValue("Name", "SignClient");
Endpoint = section.GetValue("Endpoint", DefaultEndpoint);
}

public static Settings Default
{
get
{
var section = new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
[SectionName + ":Name"] = "SignClient",
[SectionName + ":Endpoint"] = DefaultEndpoint
})
.Build()
.GetSection(SectionName);
return new Settings(section);
}
}
}
}
Loading