Conversation
Changed for neo 3.0, not final yet.
sync with neo-project
Codecov Report
@@ Coverage Diff @@
## master #850 +/- ##
==========================================
+ Coverage 52.59% 53.62% +1.03%
==========================================
Files 179 193 +14
Lines 12707 13211 +504
==========================================
+ Hits 6683 7085 +402
- Misses 6024 6126 +102
Continue to review full report at Codecov.
|
|
We can move most of the classes to the |
Yes, we can inherit from 'Block' to add property "confirmations" and "nextblockhash". |
vncoelho
left a comment
There was a problem hiding this comment.
It looks clear, nice design.
I think @jsolman will like.
What do you think @igormcoelho?
igormcoelho
left a comment
There was a problem hiding this comment.
Nice work being done here... SDK is fundamental for any dev platform.
I recommend renaming quite a few things... GetBlock for example could be ModelBlock or SDKBlock, or in the worst case, Block using different namespace.. but it's confusing. This applies to all other classes.
neo.UnitTests/SDK/UT_RpcClient.cs
Outdated
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Neo.UnitTests.SDK |
There was a problem hiding this comment.
The RpcClient has been moved to Neo.Network.RPC. So this namespace should be changed too.
There was a problem hiding this comment.
Put it the same place with others
neo/Network/RPC/HttpService.cs
Outdated
|
|
||
| namespace Neo.Network.RPC | ||
| { | ||
| public class HttpService : IDisposable |
There was a problem hiding this comment.
I think we can remove this class, and move HttpClient into RpcClient.
neo/Network/RPC/IRpcClient.cs
Outdated
| /// <summary> | ||
| /// Wrappar of NEO RPC APIs | ||
| /// </summary> | ||
| public interface IRpcClient |
There was a problem hiding this comment.
Why do we need this interface?
neo/Network/RPC/Model/RpcBlock.cs
Outdated
| using Neo.IO.Json; | ||
| using Neo.Network.P2P.Payloads; | ||
|
|
||
| namespace Neo.Network.RPC.Model |
There was a problem hiding this comment.
| namespace Neo.Network.RPC.Model | |
| namespace Neo.Network.RPC.Models |
And many other classes are the same.
neo/Network/RPC/RpcServer.cs
Outdated
| } | ||
|
|
||
| private static JObject CreateErrorResponse(JObject id, int code, string message, JObject data = null) | ||
| internal static JObject CreateErrorResponse(JObject id, int code, string message, JObject data = null) |
There was a problem hiding this comment.
This method is covered in unit test.
There was a problem hiding this comment.
According to the discussion here, we don't need to test private methods. Testing for public methods can completely cover private methods.
neo.UnitTests/SDK/UT_RpcClient.cs
Outdated
| { | ||
| // create block | ||
| var block = new Block(); | ||
| TestUtils.SetupBlockWithValues(block, UInt256.Zero, out UInt256 merkRootVal, out UInt160 val160, out uint timestampVal, out uint indexVal, out Witness scriptVal, out Transaction[] transactionsVal, 0); |
There was a problem hiding this comment.
should be ulong now, timestamp is in ms
|
@erikzhang should we open a new branch for all NEO3 SDK functions?
|
No. I don't think it's necessary. |
PR correction
No, the REST is more about RpcServer reconstruction, we won't have it in this PR. |
|
hi, all. |
| namespace Neo.UnitTests | ||
| { | ||
| [TestClass] | ||
| public class UT_RpcClient |
There was a problem hiding this comment.
Should this file be moved into a sub folder?
There was a problem hiding this comment.
Yes, I have moved the file to Network/RPC folder
Codecov Report
@@ Coverage Diff @@
## master #850 +/- ##
==========================================
+ Coverage 52.74% 53.76% +1.02%
==========================================
Files 180 194 +14
Lines 12749 13253 +504
==========================================
+ Hits 6724 7126 +402
- Misses 6025 6127 +102
Continue to review full report at Codecov.
|
vncoelho
left a comment
There was a problem hiding this comment.
For maintenance it looks better. A great job!
Hope it also give all the flexibility you want for the SDK RPC module.
* Add NEO SDK based on RPC client * add rpc interface methods for neo3 * update unit test * add unit test * Update TransactionHelper.cs Changed for neo 3.0, not final yet. * implement sdk rpc client methods * backup files * change class name * remove uncompleted modules for pull request * change json deserialize method with Neo JObject * modified JSON implementation, added FromJson() * more RPC change * PR correction * RPC module fix, remove newton.json * fix * fix getblock issue * PR correction * PR Correction * PR Correction: rename RPC models * PR Correction * resolve conflicts * Clean code * Clean code * Clean code * Clean code * Update RpcValidateAddressResult.cs * Clean code * PR correction * Move test file to the right place
#849 NEO SDK based on RPC interfaces
Add NEO SDK RPC module
This PR contains the rpc client module for neo3 and the unit tests for all the methods