Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a #22

Merged
merged 2 commits into from
Dec 22, 2020
Merged

a #22

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
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ The resulting folder structure is going to be like this:
### ApplicationLogs
Add this plugin to your application if need to access the log files. This can be useful to handle notifications, but remember that this also largely increases the space used by the application. `LevelDBStore` and `RpcServer` are also needed for this plugin. You can find more details [here](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api/getapplicationlog.html).

### SystemLog
Enable neo-cli Logging with timestamps by showing messages with different levels (shown with different colors) \(useful for debugging\).

### StatesDumper
Exports neo-cli status data \(useful for debugging\), such as storage modifications block by block.

Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionSuffix>preview3</VersionSuffix>
<VersionSuffix>preview4</VersionSuffix>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
<Authors>The Neo Project</Authors>
Expand All @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI01105" />
<PackageReference Include="Neo" Version="3.0.0-preview4" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/RpcClient/Nep17API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public async Task<Transaction> CreateTransferTxAsync(UInt160 scriptHash, KeyPair
var sender = Contract.CreateSignatureRedeemScript(fromKey.PublicKey).ToScriptHash();
Signer[] signers = new[] { new Signer { Scopes = WitnessScope.CalledByEntry, Account = sender } };

byte[] script = data is null ? scriptHash.MakeScript("transfer", sender, to, amount) : scriptHash.MakeScript("transfer", sender, to, amount, data);
byte[] script = scriptHash.MakeScript("transfer", sender, to, amount, data);

TransactionManagerFactory factory = new TransactionManagerFactory(rpcClient, magic);
TransactionManager manager = await factory.MakeTransactionAsync(script, signers).ConfigureAwait(false);
Expand All @@ -137,7 +137,7 @@ public async Task<Transaction> CreateTransferTxAsync(UInt160 scriptHash, int m,
var sender = Contract.CreateMultiSigContract(m, pubKeys).ScriptHash;
Signer[] signers = new[] { new Signer { Scopes = WitnessScope.CalledByEntry, Account = sender } };

byte[] script = data is null ? scriptHash.MakeScript("transfer", sender, to, amount) : scriptHash.MakeScript("transfer", sender, to, amount, data);
byte[] script = scriptHash.MakeScript("transfer", sender, to, amount, data);

TransactionManagerFactory factory = new TransactionManagerFactory(rpcClient, magic);
TransactionManager manager = await factory.MakeTransactionAsync(script, signers).ConfigureAwait(false);
Expand Down
8 changes: 4 additions & 4 deletions tests/Neo.Network.RPC.Tests/RpcTestCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,18 @@
"jsonrpc": "2.0",
"id": 1,
"method": "getcontractstate",
"params": [ "0x74c21a1ca66b7a190bf2a65db83ba6fe550cea64" ]
"params": [ "0x0a46e2e37c9987f570b4af253fb77e7eef0f72b6" ]
},
"Response": {
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": -1,
"updatecounter": 0,
"hash": "0x74c21a1ca66b7a190bf2a65db83ba6fe550cea64",
"script": "DANORU9BGvd7Zw==",
"hash": "0x0a46e2e37c9987f570b4af253fb77e7eef0f72b6",
"script": "DAhOZW9Ub2tlbkEa93tn",
"manifest": {
"name": "NEO",
"name": "NeoToken",
"groups": [],
"supportedstandards": [
"NEP-17"
Expand Down
10 changes: 5 additions & 5 deletions tests/Neo.Network.RPC.Tests/UT_Nep17API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,29 @@ public async Task TestGetTokenInfo()
.ReturnsAsync(test.Response.Result)
.Verifiable();

if (test.Request.Params[0].AsString() == "0xb399c051778cf37a1e4ef88509b2e054d0420a32")
if (test.Request.Params[0].AsString() == "0xa6a6c15dcdc9b997dac448b6926522d22efeedfb")
{
var result = await nep17API.GetTokenInfoAsync(NativeContract.GAS.Hash);
Assert.AreEqual(NativeContract.GAS.Symbol, result.Symbol);
Assert.AreEqual(8, (int)result.Decimals);
Assert.AreEqual(1_00000000, (int)result.TotalSupply);
Assert.AreEqual("GAS", result.Name);
Assert.AreEqual("GasToken", result.Name);
}
else if (test.Request.Params[0].AsString() == "0x74c21a1ca66b7a190bf2a65db83ba6fe550cea64")
else if (test.Request.Params[0].AsString() == "0x0a46e2e37c9987f570b4af253fb77e7eef0f72b6")
{
var result = await nep17API.GetTokenInfoAsync(NativeContract.NEO.Hash);
Assert.AreEqual(NativeContract.NEO.Symbol, result.Symbol);
Assert.AreEqual(0, (int)result.Decimals);
Assert.AreEqual(1_00000000, (int)result.TotalSupply);
Assert.AreEqual("NEO", result.Name);
Assert.AreEqual("NeoToken", result.Name);
}
}
}

[TestMethod]
public async Task TestTransfer()
{
byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", sender, UInt160.Zero, new BigInteger(1_00000000));
byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", sender, UInt160.Zero, new BigInteger(1_00000000), null);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter());

var result = await nep17API.CreateTransferTxAsync(NativeContract.GAS.Hash, keyPair1, UInt160.Zero, new BigInteger(1_00000000));
Expand Down
1 change: 1 addition & 0 deletions tests/Neo.Network.RPC.Tests/UT_RpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ public async Task TestGetUnclaimedGas()
{
var test = TestUtils.RpcTestCases.Find(p => p.Name == nameof(rpc.GetUnclaimedGasAsync).ToLower());
var result = await rpc.GetUnclaimedGasAsync(test.Request.Params[0].AsString());
Assert.AreEqual(result.ToJson().AsString(), RpcUnclaimedGas.FromJson(result.ToJson()).ToJson().AsString());
Assert.AreEqual(test.Response.Result["unclaimed"].AsString(), result.Unclaimed.ToString());
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Neo.Network.RPC.Tests/UT_WalletAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public async Task TestClaimGas()
byte[] balanceScript = NativeContract.NEO.Hash.MakeScript("balanceOf", sender);
UT_TransactionManager.MockInvokeScript(rpcClientMock, balanceScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1_00000000) });

byte[] testScript = NativeContract.NEO.Hash.MakeScript("transfer", sender, sender, new BigInteger(1_00000000));
byte[] testScript = NativeContract.NEO.Hash.MakeScript("transfer", sender, sender, new BigInteger(1_00000000), null);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1_10000000) });

var json = new JObject();
Expand All @@ -96,7 +96,7 @@ public async Task TestTransfer()
byte[] decimalsScript = NativeContract.GAS.Hash.MakeScript("decimals");
UT_TransactionManager.MockInvokeScript(rpcClientMock, decimalsScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(8) });

byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", sender, UInt160.Zero, NativeContract.GAS.Factor * 100);
byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", sender, UInt160.Zero, NativeContract.GAS.Factor * 100, null);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1_10000000) });

var json = new JObject();
Expand All @@ -118,7 +118,7 @@ public async Task TestTransferfromMultiSigAccount()
byte[] decimalsScript = NativeContract.GAS.Hash.MakeScript("decimals");
UT_TransactionManager.MockInvokeScript(rpcClientMock, decimalsScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(8) });

byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", multiSender, UInt160.Zero, NativeContract.GAS.Factor * 100);
byte[] testScript = NativeContract.GAS.Hash.MakeScript("transfer", multiSender, UInt160.Zero, NativeContract.GAS.Factor * 100, null);
UT_TransactionManager.MockInvokeScript(rpcClientMock, testScript, new ContractParameter { Type = ContractParameterType.Integer, Value = new BigInteger(1_10000000) });

var json = new JObject();
Expand Down