diff --git a/neo3-gui/neo3-gui/ClientApp/src/neonode.js b/neo3-gui/neo3-gui/ClientApp/src/neonode.js index 1d5b751..1765325 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/neonode.js +++ b/neo3-gui/neo3-gui/ClientApp/src/neonode.js @@ -28,7 +28,13 @@ class NeoNode { } start(env, errorCallback) { - this.node = this.runCommand("dotnet neo3-gui.dll", env, errorCallback); + if (isWin) { + this.node = this.runCommand("./neo3-gui.exe", env, errorCallback); + + } else { + this.node = this.runCommand("./neo3-gui", env, errorCallback); + } + // this.node = this.runCommand("dotnet neo3-gui.dll", env, errorCallback); } startNode(network, port, errorCallback) { @@ -40,7 +46,7 @@ class NeoNode { * force restart node after 1 second (using config file) */ switchNode(network) { - console.log("switche to:", network); + console.log("switch to:", network); if (network) { Config.changeNetwork(network); } @@ -82,7 +88,7 @@ class NeoNode { } const ps = spawn(command, [], { - shell: true, + shell: false, encoding: "utf8", cwd: path.join(startPath, "build-neo-node"), env: childEnv, diff --git a/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/IRepository.cs b/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/IRepository.cs new file mode 100644 index 0000000..ad28491 --- /dev/null +++ b/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/IRepository.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Numerics; +using Neo; +using Neo.Common.Storage; +using Neo.Common.Storage.SQLiteModules; +using Neo.Models; + +interface IRepository +{ + byte[] Identity { get; } + uint? GetMaxSyncIndex(); + void AddSyncIndex(uint index); + //void SetMaxSyncIndex(uint height); + + void AddTransfer(TransferInfo transfer); + void AddTransaction(TransactionInfo transaction); + + + void UpdateBalance(UInt160 addressHash, UInt160 assetHash, BigInteger balance, uint height); + + PageList QueryTransactions(TransactionFilter filter, bool includeTransfers = false); + IEnumerable FindAssetBalance(BalanceFilter filter); + + void CreateContract(ContractEntity newContract); + void DeleteContract(UInt160 contractHash, UInt256 txId, DateTime time); + void MigrateContract(ContractEntity migrateContract); + IEnumerable GetAllContracts(); + + ContractEntity GetActiveContract(UInt160 contract); + ContractEntity GetActiveContract(string contractHash); + ContractEntity GetContract(long id); + AddressEntity GetAddress(long id); + void Commit(); +} + +public class SQLiteRepository : IRepository +{ + private SQLiteContext _db; + + public SQLiteRepository(string path) + { + _db = new SQLiteContext(path); + } + public byte[] Identity => _db.Identity; + public uint? GetMaxSyncIndex() + { + return _db.GetMaxSyncIndex(); + } + + public void AddSyncIndex(uint index) + { + _db.Add(new SyncIndex() { BlockHeight = index }); + } + + //public void SetMaxSyncIndex(uint height) + //{ + // throw new NotImplementedException(); + //} + + public void AddTransfer(TransferInfo transfer) + { + //var from = GetOrCreateAddress(transfer.From); + //var to = GetOrCreateAddress(transfer.To); + //var asset = GetActiveContract(transfer.Asset); + + //var tran = new TransferEntity + //{ + // BlockHeight = transfer.BlockHeight, + // TxId = transfer.TxId?.ToBigEndianHex(), + // FromId = from?.Id, + // ToId = to?.Id, + // Amount = transfer.Amount.ToByteArray(), + // AssetId = asset.Id, + // Time = transfer.TimeStamp.FromTimestampMS(), + // Trigger = transfer.Trigger, + // TokenId = transfer.TokenId, + //}; + //_db.Transfers.Add(tran); + } + + public void AddTransaction(TransactionInfo transaction) + { + throw new NotImplementedException(); + } + + public void UpdateBalance(UInt160 addressHash, UInt160 assetHash, BigInteger balance, uint height) + { + throw new NotImplementedException(); + } + + public PageList QueryTransactions(TransactionFilter filter, bool includeTransfers = false) + { + throw new NotImplementedException(); + } + + public IEnumerable FindAssetBalance(BalanceFilter filter) + { + throw new NotImplementedException(); + } + + public void CreateContract(ContractEntity newContract) + { + throw new NotImplementedException(); + } + + public void DeleteContract(UInt160 contractHash, UInt256 txId, DateTime time) + { + throw new NotImplementedException(); + } + + public void MigrateContract(ContractEntity migrateContract) + { + throw new NotImplementedException(); + } + + public IEnumerable GetAllContracts() + { + throw new NotImplementedException(); + } + + public ContractEntity GetActiveContract(UInt160 contract) + { + throw new NotImplementedException(); + } + + public ContractEntity GetActiveContract(string contractHash) + { + throw new NotImplementedException(); + } + + public ContractEntity GetContract(long id) + { + throw new NotImplementedException(); + } + + public AddressEntity GetAddress(long id) + { + throw new NotImplementedException(); + } + + public void Commit() + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/neo3-gui/neo3-gui/publish.sc.sh b/neo3-gui/neo3-gui/publish.sc.sh new file mode 100644 index 0000000..2bb18fd --- /dev/null +++ b/neo3-gui/neo3-gui/publish.sc.sh @@ -0,0 +1,4 @@ +dotnet publish --sc -c Release -o ClientApp/build-neo-node +cd ClientApp +npm install +npm run publish \ No newline at end of file