diff --git a/neo3-gui/neo3-gui/Helpers.cs b/neo3-gui/neo3-gui/Helpers.cs
index 020766bd..c6a7e7eb 100644
--- a/neo3-gui/neo3-gui/Helpers.cs
+++ b/neo3-gui/neo3-gui/Helpers.cs
@@ -112,6 +112,32 @@ public static string SafeSerialize(this ContractParametersContext signContext)
return signContext.ToJson().SerializeJson();
}
+ ///
+ /// create tx by script and signer
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Transaction InitTransaction(this Wallet wallet, byte[] script, params UInt160[] signers)
+ {
+ var cosigners = signers.Select(account => new Cosigner { Account = account }).ToArray();
+ return InitTransaction(wallet, script, cosigners);
+ }
+
+ ///
+ /// create tx by script and signer
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Transaction InitTransaction(this Wallet wallet, byte[] script, params Cosigner[] signers)
+ {
+ var tx = wallet.MakeTransaction(script, null, null, signers);
+ return tx;
+ }
+
///
/// append sign to signContext
@@ -695,7 +721,7 @@ public static byte[] TryGetPrivateKey(this string privateKey)
}
try
{
- return Wallet.GetPrivateKeyFromWIF(privateKey);
+ return Wallet.GetPrivateKeyFromWIF(privateKey);
}
catch (FormatException)
{
diff --git a/neo3-gui/neo3-gui/Models/Contracts/ValidatorModel.cs b/neo3-gui/neo3-gui/Models/Contracts/ValidatorModel.cs
new file mode 100644
index 00000000..e5b5dd61
--- /dev/null
+++ b/neo3-gui/neo3-gui/Models/Contracts/ValidatorModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Neo.Models.Contracts
+{
+ public class ValidatorModel
+ {
+ public string Publickey { get; set; }
+
+ public string Votes { get; set; }
+
+ ///
+ /// In Use
+ ///
+ public bool Active { get; set; }
+ }
+}
diff --git a/neo3-gui/neo3-gui/Models/Contracts/VoteResultModel.cs b/neo3-gui/neo3-gui/Models/Contracts/VoteResultModel.cs
new file mode 100644
index 00000000..133830c2
--- /dev/null
+++ b/neo3-gui/neo3-gui/Models/Contracts/VoteResultModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Neo.Models.Contracts
+{
+ public class VoteResultModel
+ {
+ public UInt256 TxId { get; set; }
+ }
+}
diff --git a/neo3-gui/neo3-gui/Models/ErrorCode.cs b/neo3-gui/neo3-gui/Models/ErrorCode.cs
index c84289a8..7b2d05e0 100644
--- a/neo3-gui/neo3-gui/Models/ErrorCode.cs
+++ b/neo3-gui/neo3-gui/Models/ErrorCode.cs
@@ -62,7 +62,9 @@ public enum ErrorCode
ExecuteContractFail = 20027,
[Description("Unknown contract. ")]
UnknownContract = 20028,
- [Description("Contract already onchain. ")]
+ [Description("Contract already onchain.")]
ContractAlreadyExist = 20029,
+ [Description("Validator already exits.")]
+ ValidatorAlreadyExist = 20030,
}
}
\ No newline at end of file
diff --git a/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs b/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
index c2337c0d..4b443c7b 100644
--- a/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
+++ b/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
@@ -2,9 +2,11 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;
+using Neo.Cryptography.ECC;
using Neo.IO;
using Neo.IO.Json;
using Neo.Ledger;
@@ -16,6 +18,7 @@
using Neo.SmartContract.Native;
using Neo.VM;
using Neo.Wallets;
+using Neo.Wallets.SQLite;
namespace Neo.Services.ApiServices
{
@@ -35,7 +38,16 @@ public async Task