Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Neo 3.0.0-CI01152 #712

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions neo-cli/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

namespace Neo.CLI
{
public partial class MainService : ConsoleServiceBase
public partial class MainService : ConsoleServiceBase, IWalletProvider
{
public event EventHandler WalletChanged;
public event EventHandler<Wallet> WalletOpened;

private Wallet currentWallet;
public Wallet CurrentWallet
Expand All @@ -43,7 +43,7 @@ public Wallet CurrentWallet
private set
{
currentWallet = value;
WalletChanged?.Invoke(this, EventArgs.Empty);
WalletOpened?.Invoke(this, value);
}
}

Expand Down Expand Up @@ -120,6 +120,11 @@ internal static UInt160 StringToAddress(string input)
return input.ToScriptHash();
}

Wallet IWalletProvider.GetWallet()
{
return CurrentWallet;
}

public override void RunConsole()
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/neo-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI01148" />
<PackageReference Include="Neo" Version="3.0.0-CI01152" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion neo-gui/GUI/DeployContractDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public byte[] GetScript()
byte[] script = textBox8.Text.HexToBytes();
string manifest = "";
using ScriptBuilder sb = new ScriptBuilder();
sb.EmitAppCall(NativeContract.ContractManagement.Hash, "deploy", script, manifest);
sb.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", script, manifest);
return sb.ToArray();
}

Expand Down
2 changes: 1 addition & 1 deletion neo-gui/GUI/ElectionDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public byte[] GetScript()
{
ECPoint pubkey = (ECPoint)comboBox1.SelectedItem;
using ScriptBuilder sb = new ScriptBuilder();
sb.EmitAppCall(NativeContract.NEO.Hash, "registerValidator", pubkey);
sb.EmitDynamicCall(NativeContract.NEO.Hash, "registerValidator", pubkey);
return sb.ToArray();
}

Expand Down
2 changes: 1 addition & 1 deletion neo-gui/GUI/InvokeContractDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Transaction GetTransaction()
private void UpdateScript()
{
using ScriptBuilder sb = new ScriptBuilder();
sb.EmitAppCall(script_hash, (string)comboBox1.SelectedItem, parameters);
sb.EmitDynamicCall(script_hash, (string)comboBox1.SelectedItem, parameters);
textBox6.Text = sb.ToArray().ToHexString();
}

Expand Down
36 changes: 18 additions & 18 deletions neo-gui/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,28 @@ private static void OpenBrowser(string url)
}
}

private void Service_WalletChanged(object sender, EventArgs e)
private void Service_WalletChanged(object sender, Wallet wallet)
{
if (InvokeRequired)
{
Invoke(new EventHandler(Service_WalletChanged), sender, e);
Invoke(new EventHandler<Wallet>(Service_WalletChanged), sender, wallet);
return;
}

listView3.Items.Clear();
修改密码CToolStripMenuItem.Enabled = Service.CurrentWallet is UserWallet;
交易TToolStripMenuItem.Enabled = Service.CurrentWallet != null;
signDataToolStripMenuItem.Enabled = Service.CurrentWallet != null;
deployContractToolStripMenuItem.Enabled = Service.CurrentWallet != null;
invokeContractToolStripMenuItem.Enabled = Service.CurrentWallet != null;
选举EToolStripMenuItem.Enabled = Service.CurrentWallet != null;
创建新地址NToolStripMenuItem.Enabled = Service.CurrentWallet != null;
导入私钥IToolStripMenuItem.Enabled = Service.CurrentWallet != null;
创建智能合约SToolStripMenuItem.Enabled = Service.CurrentWallet != null;
修改密码CToolStripMenuItem.Enabled = wallet is UserWallet;
交易TToolStripMenuItem.Enabled = wallet != null;
signDataToolStripMenuItem.Enabled = wallet != null;
deployContractToolStripMenuItem.Enabled = wallet != null;
invokeContractToolStripMenuItem.Enabled = wallet != null;
选举EToolStripMenuItem.Enabled = wallet != null;
创建新地址NToolStripMenuItem.Enabled = wallet != null;
导入私钥IToolStripMenuItem.Enabled = wallet != null;
创建智能合约SToolStripMenuItem.Enabled = wallet != null;
listView1.Items.Clear();
if (Service.CurrentWallet != null)
if (wallet != null)
{
foreach (WalletAccount account in Service.CurrentWallet.GetAccounts().ToArray())
foreach (WalletAccount account in wallet.GetAccounts().ToArray())
{
AddAccount(account);
}
Expand All @@ -160,14 +160,14 @@ private void RefreshConfirmations()
private void MainForm_Load(object sender, EventArgs e)
{
actor = Service.NeoSystem.ActorSystem.ActorOf(EventWrapper<Blockchain.PersistCompleted>.Props(Blockchain_PersistCompleted));
Service.WalletChanged += Service_WalletChanged;
Service.WalletOpened += Service_WalletChanged;
}

private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (actor != null)
Service.NeoSystem.ActorSystem.Stop(actor);
Service.WalletChanged -= Service_WalletChanged;
Service.WalletOpened -= Service_WalletChanged;
}

private void timer1_Tick(object sender, EventArgs e)
Expand Down Expand Up @@ -198,10 +198,10 @@ private void timer1_Tick(object sender, EventArgs e)
using (ScriptBuilder sb = new ScriptBuilder())
{
for (int i = addresses.Length - 1; i >= 0; i--)
sb.EmitAppCall(assetId, "balanceOf", addresses[i]);
sb.EmitDynamicCall(assetId, "balanceOf", addresses[i]);
sb.Emit(OpCode.DEPTH, OpCode.PACK);
sb.EmitAppCall(assetId, "decimals");
sb.EmitAppCall(assetId, "name");
sb.EmitDynamicCall(assetId, "decimals");
sb.EmitDynamicCall(assetId, "name");
script = sb.ToArray();
}
using ApplicationEngine engine = ApplicationEngine.Run(script, snapshot, gas: 0_20000000L * addresses.Length);
Expand Down
2 changes: 1 addition & 1 deletion neo-gui/GUI/VotingDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public byte[] GetScript()
{
ECPoint[] pubkeys = textBox1.Lines.Select(p => ECPoint.Parse(p, ECCurve.Secp256r1)).ToArray();
using ScriptBuilder sb = new ScriptBuilder();
sb.EmitAppCall(NativeContract.NEO.Hash, "vote", new ContractParameter
sb.EmitDynamicCall(NativeContract.NEO.Hash, "vote", new ContractParameter
{
Type = ContractParameterType.Hash160,
Value = script_hash
Expand Down