cityofzion / neomodules Goto Github PK
View Code? Open in Web Editor NEWThis project forked from brunofreitasgit/neo-rpc-sharpclient
License: MIT License
This project forked from brunofreitasgit/neo-rpc-sharpclient
License: MIT License
Right now only get_balance, get_claimed, get_claimable, get_unclaimed, get_address calls are implemented on NeoModules.Rest because they are useful for developers and do not exist nativelly on RPC nodes. However, some devs might prefer working only with REST APIs, so the missing api calls might be interesting to implement to.
Refer to https://neoscan.io/doc/Neoscan.Api.html for the documentation.
"NeoNodesListService.GetNodeList" is not working properly.
The status code of the following URL is 404.
What is the cause of 404?
https://github.com/CityOfZion/NeoModules/blob/master/src/NeoModules.RPC/NeoNodesListService.cs#L11
https://github.com/CityOfZion/NeoModules/blob/master/src/NeoModules.RPC/NeoNodesListService.cs#L12
In the editor and in the native player, the RPC code works fine to invoke a contract and returns the expected result. But in WebGL I get the following stack trace during the RpcClient.SendAsync call:
NeoModules.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to send rpc requests(s) ---> System.ArgumentNullException: Value cannot be null. UnityLoader.js:1043:37
Parameter name: obj UnityLoader.js:1043:37
at System.Threading.Monitor.ReliableEnterTimeout (System.Object obj, System.Int32 timeout, System.Boolean& lockTaken) [0x00000] in <00000000000000000000000000000000>:0 UnityLoader.js:1043:37
--- End of inner exception stack trace --- UnityLoader.js:1043:37
at NeoModules.JsonRpc.Client.RpcClient+<SendAsync>d__17.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 UnityLoader.js:1043:37
--- End of stack trace from previous location where exception was thrown ---
I did some testing and found that the Nethereum RPC client does work in WebGL as long as the AOT version of the Newtonsoft DLL is used, however I have tried that and still receive the error above. I'm unable to pinpoint where the difference lies between the RPC implementation in NeoModules and Nethereum that leads to the error, as the RPC client code doesn't seem all that different.
I suppose it fails here:
Output = new TransactionOutput
{
...
AssetId = UInt256.Parse(balanceEntry.AssetHash),
...
}
because balanceEntry.AssetHash is null (restService returns null at least for local private network)
Native coins transfer does not work because of this issue (AccountSignerTransactionManager.SendNativeAsset())
I have some problem with the RPC library parsing getapplicationlog result.
Error and working curl example:
As you can see, json parsing throws on path 'executions[0].notifications[0].state.type'
Curl request:
curl -X POST \
http://localhost:20332 \
-H 'Content-Type: application/json' \
-d '{ "jsonrpc": "2.0", "id": 5, "method": "getapplicationlog", "params": ["a5e6a987e36bcc99545cb2b68c1d9dd855ce51eb2e78be4b270299b6f54cb3e0"] }'
Curl response:
{"jsonrpc":"2.0","id":5,"result":{"txid":"0x8fdc250403ecabda4a5d204fe5f1f3596533be5a6eefd1c2c73d123961d846a2","executions":[{"trigger":"Application","contract":"0xef95a5008fe8bd2a28673a1cb49559a7d7d860f2","vmstate":"HALT, BREAK","gas_consumed":"8.879","stack":[{"type":"Integer","value":"1"}],"notifications":[{"contract":"0xfde69a7dd2a1c948977fb3ce512158987c0e2197","state":{"type":"Array","value":[{"type":"ByteArray","value":"6f7261636c654f70657261746f72"},{"type":"ByteArray","value":"6d8603dc755b733aa10f0bb96585c8bed967ce1b"},{"type":"ByteArray","value":"736e656f5f7072696365"},{"type":"ByteArray","value":""},{"type":"ByteArray","value":"78ea9741"},{"type":"Integer","value":"2"}]}},{"contract":"0xfde69a7dd2a1c948977fb3ce512158987c0e2197","state":{"type":"Array","value":[{"type":"ByteArray","value":"6f7261636c654f70657261746f72"},{"type":"ByteArray","value":"6d8603dc755b733aa10f0bb96585c8bed967ce1b"},{"type":"ByteArray","value":"736e656f5f7072696365"},{"type":"ByteArray","value":""},{"type":"Integer","value":"1094979175"},{"type":"Integer","value":"5"}]}}]}]}}
neo cli version 2.9.4
C# packages:
<PackageReference Include="NeoModules.Rest" Version="2.0.0" />
<PackageReference Include="NeoModules.RPC" Version="1.2.0" />
Trying to use the Nuget package and in the object AccountSignerTransactionManager there is no CallContract but there is in the code.
When you expect to have a new Nuget version?
JsonSerializationException occurs when acquiring NodeList and performing Json deserialization.
I think the cause is that there is "type: WebSockets" in Site.
"Type: webSockets" was added 4 days ago.
CityOfZion/neo-mon@7b61d08#diff-830ceffa80e1e74ebac9697c8d391e31R18
I coded the deserialization process of the node list with reference to the sample.
https://github.com/CityOfZion/NeoModules/blob/master/src/NeoModules.Demo/Program.cs#L134
private static async Task<NodeList> NodesListTestAsync()
{
var service = new NeoNodesListService();
var result = await service.GetNodesList(MonitorNet.TestNet);
var nodes = JsonConvert.DeserializeObject<NodeList>(result);
return nodes;
}
Right now, the only way NeoModules has to get the transaction history of an address is to use the neoscan.io public API. However, this being the only solution right now, it's dangerous to depend on a single point of failure for you application/service. This means we have to design/implement another way to get this type of data.
The only way to do it with the tools of NeoModules.RPC now is to search block by block (since block 0 to blockCount) for transactions of a specific address. Of course this is an absurd solution, so we need to implement some kind of persistance/chain integration, that do not compromise the decoupling of the project.
When I deploy a smart contract in the blockchain using NeoGui i get the script hash:
0xf79edf718d2bb58d3eba9975e1d5b4c9feb21a69
then I try to execute the CallContract using this hash I get BatFormat Exception.
I notice in the example the Script Hash that you have are a little bit different:
// contract
public const string ContractScriptHash = "ed07cffad18f1308db51920d99a2af60ac66a7b3";
where do you calculate this Contract script hash?????
But method returns DTOs.Block object that has 'long Index' column.
double has not enough accuracy for money operations, decimal is recommended. Especially when there are 18 digits to the right of the floating point.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.