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

Commit

Permalink
upgrade to v2.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Zhang committed Sep 6, 2017
1 parent 3c2af89 commit 9d35af1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
7 changes: 4 additions & 3 deletions neo-cli/Network/RPC/RpcServerWithWallet.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Neo.Core;
using Neo.IO.Json;
using Neo.SmartContract;
using Neo.Wallets;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -57,7 +58,7 @@ protected override JObject Process(string method, JArray _params)
}, change_address: change_address, fee: fee);
if (tx == null)
throw new RpcException(-300, "Insufficient funds");
SignatureContext context = new SignatureContext(tx);
ContractParametersContext context = new ContractParametersContext(tx);
Program.Wallet.Sign(context);
if (context.Completed)
{
Expand Down Expand Up @@ -101,7 +102,7 @@ protected override JObject Process(string method, JArray _params)
}, change_address: change_address, fee: fee);
if (tx == null)
throw new RpcException(-300, "Insufficient funds");
SignatureContext context = new SignatureContext(tx);
ContractParametersContext context = new ContractParametersContext(tx);
Program.Wallet.Sign(context);
if (context.Completed)
{
Expand All @@ -121,7 +122,7 @@ protected override JObject Process(string method, JArray _params)
else
{
KeyPair key = Program.Wallet.CreateKey();
Contract contract = Program.Wallet.GetContracts(key.PublicKeyHash).First(p => p.IsStandard);
VerificationContract contract = Program.Wallet.GetContracts(key.PublicKeyHash).First(p => p.IsStandard);
return contract.Address;
}
case "dumpprivkey":
Expand Down
9 changes: 5 additions & 4 deletions neo-cli/Shell/Coins.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Neo.Core;
using Neo.Network;
using Neo.SmartContract;
using Neo.Wallets;
using System;
using System.Linq;
Expand All @@ -25,7 +26,7 @@ public Fixed8 UnavailableBonus()

try
{
unavailable = Blockchain.CalculateBonus(current_wallet.FindUnspentCoins().Where(p => p.Output.AssetId.Equals(Blockchain.SystemShare.Hash)).Select(p => p.Reference), height);
unavailable = Blockchain.CalculateBonus(current_wallet.FindUnspentCoins().Where(p => p.Output.AssetId.Equals(Blockchain.GoverningToken.Hash)).Select(p => p.Reference), height);
}
catch (Exception)
{
Expand Down Expand Up @@ -63,7 +64,7 @@ public ClaimTransaction Claim()
{
new TransactionOutput
{
AssetId = Blockchain.SystemCoin.Hash,
AssetId = Blockchain.UtilityToken.Hash,
Value = Blockchain.CalculateBonus(claims),
ScriptHash = current_wallet.GetChangeAddress()
}
Expand All @@ -82,11 +83,11 @@ private Transaction SignTransaction(Transaction tx)
Console.WriteLine($"no transaction specified");
return null;
}
SignatureContext context;
ContractParametersContext context;

try
{
context = new SignatureContext(tx);
context = new ContractParametersContext(tx);
}
catch (InvalidOperationException)
{
Expand Down
19 changes: 10 additions & 9 deletions neo-cli/Shell/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Neo.Network;
using Neo.Network.RPC;
using Neo.Services;
using Neo.SmartContract;
using Neo.Wallets;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -115,7 +116,7 @@ private bool OnCreateAddressCommand(string[] args)
for (int i = 1; i <= count; i++)
{
KeyPair key = Program.Wallet.CreateKey();
Contract contract = Program.Wallet.GetContracts(key.PublicKeyHash).First(p => p.IsStandard);
VerificationContract contract = Program.Wallet.GetContracts(key.PublicKeyHash).First(p => p.IsStandard);
addresses.Add(contract.Address);
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write($"[{i}/{count}]");
Expand Down Expand Up @@ -144,7 +145,7 @@ private bool OnCreateWalletCommand(string[] args)
}
Program.Wallet = UserWallet.Create(args[2], password);
}
Contract contract = Program.Wallet.GetContracts().First(p => p.IsStandard);
VerificationContract contract = Program.Wallet.GetContracts().First(p => p.IsStandard);
KeyPair key = Program.Wallet.GetKey(contract.PublicKeyHash);
Console.WriteLine($"address: {contract.Address}");
Console.WriteLine($" pubkey: {key.PublicKey.EncodePoint(true).ToHexString()}");
Expand Down Expand Up @@ -334,7 +335,7 @@ private bool OnImportKeyCommand(string[] args)
{
KeyPair key = Program.Wallet.CreateKey(prikey);
Array.Clear(prikey, 0, prikey.Length);
Contract contract = Program.Wallet.GetContracts(key.PublicKeyHash).First(p => p.IsStandard);
VerificationContract contract = Program.Wallet.GetContracts(key.PublicKeyHash).First(p => p.IsStandard);
Console.WriteLine($"address: {contract.Address}");
Console.WriteLine($" pubkey: {key.PublicKey.EncodePoint(true).ToHexString()}");
}
Expand Down Expand Up @@ -407,7 +408,7 @@ private bool OnListKeyCommand(string[] args)
private bool OnListAddressCommand(string[] args)
{
if (Program.Wallet == null) return true;
foreach (Contract contract in Program.Wallet.GetContracts())
foreach (VerificationContract contract in Program.Wallet.GetContracts())
{
Console.WriteLine($"{contract.Address}\t{(contract.IsStandard ? "Standard" : "Nonstandard")}");
}
Expand Down Expand Up @@ -545,11 +546,11 @@ private bool OnSendCommand(string[] args)
{
case "neo":
case "ans":
assetId = Blockchain.SystemShare.Hash;
assetId = Blockchain.GoverningToken.Hash;
break;
case "gas":
case "anc":
assetId = Blockchain.SystemCoin.Hash;
assetId = Blockchain.UtilityToken.Hash;
break;
default:
assetId = UInt256.Parse(args[1]);
Expand Down Expand Up @@ -607,7 +608,7 @@ private bool OnSendCommand(string[] args)
return true;
}
}
SignatureContext context = new SignatureContext(tx);
ContractParametersContext context = new ContractParametersContext(tx);
Program.Wallet.Sign(context);
if (context.Completed)
{
Expand Down Expand Up @@ -683,11 +684,11 @@ private bool OnShowUtxoCommand(string[] args)
{
case "neo":
case "ans":
assetId = Blockchain.SystemShare.Hash;
assetId = Blockchain.GoverningToken.Hash;
break;
case "gas":
case "anc":
assetId = Blockchain.SystemCoin.Hash;
assetId = Blockchain.UtilityToken.Hash;
break;
default:
assetId = UInt256.Parse(args[2]);
Expand Down
4 changes: 2 additions & 2 deletions neo-cli/neo-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Copyright>2016-2017 The Neo Project</Copyright>
<AssemblyTitle>Neo.CLI</AssemblyTitle>
<Version>2.1.0.1</Version>
<Version>2.3.2</Version>
<Authors>The Neo Project</Authors>
<TargetFramework>netcoreapp1.0</TargetFramework>
<AssemblyName>neo-cli</AssemblyName>
Expand Down Expand Up @@ -31,7 +31,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" />
<PackageReference Include="Neo" Version="2.1.0" />
<PackageReference Include="Neo" Version="2.3.2" />
</ItemGroup>

</Project>

0 comments on commit 9d35af1

Please sign in to comment.