-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adapt RpcClient to modules * fix json issue * fix size calculate * Fix getnep5balances name issue * add wallet rpc methods, reconstruct rpc UT * PR correction * move models to rpc server * delete models from rpcclient * change plugins with model * format names * move models back to rpc client * fix build error * change test file * auto calculate network fee, update version * format code * fix issue #1416 Deal with ContractParameterType.Any * change GetStorage parameter to enable id query * add test for issue #1416 * PR correction * use snake_case in json * update neo version * Update src/RpcClient/RpcClient.cs Co-Authored-By: Shargon <[email protected]> * Update src/RpcClient/RpcClient.cs Co-Authored-By: Shargon <[email protected]> * PR correction * update neo version Co-authored-by: Vitor Nazário Coelho <[email protected]> Co-authored-by: Nicole <[email protected]> Co-authored-by: Shargon <[email protected]>
- Loading branch information
1 parent
862cc79
commit bbcfa56
Showing
49 changed files
with
2,382 additions
and
952 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Neo.IO.Json; | ||
|
||
namespace Neo.Network.RPC.Models | ||
{ | ||
public class RpcAccount | ||
{ | ||
public string Address { get; set; } | ||
|
||
public bool HasKey { get; set; } | ||
|
||
public string Label { get; set; } | ||
|
||
public bool WatchOnly { get; set; } | ||
|
||
public JObject ToJson() | ||
{ | ||
return new JObject | ||
{ | ||
["address"] = Address, | ||
["haskey"] = HasKey, | ||
["label"] = Label, | ||
["watchonly"] = WatchOnly | ||
}; | ||
} | ||
|
||
public static RpcAccount FromJson(JObject json) | ||
{ | ||
return new RpcAccount | ||
{ | ||
Address = json["address"].AsString(), | ||
HasKey = json["haskey"].AsBoolean(), | ||
Label = json["label"]?.AsString(), | ||
WatchOnly = json["watchonly"].AsBoolean(), | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using Neo.IO.Json; | ||
using Neo.SmartContract; | ||
using Neo.VM; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Neo.Network.RPC.Models | ||
{ | ||
public class RpcApplicationLog | ||
{ | ||
public UInt256 TxId { get; set; } | ||
|
||
public TriggerType Trigger { get; set; } | ||
|
||
public VMState VMState { get; set; } | ||
|
||
public long GasConsumed { get; set; } | ||
|
||
public List<ContractParameter> Stack { get; set; } | ||
|
||
public List<RpcNotifyEventArgs> Notifications { get; set; } | ||
|
||
public JObject ToJson() | ||
{ | ||
JObject json = new JObject(); | ||
json["txid"] = TxId?.ToString(); | ||
json["trigger"] = Trigger; | ||
json["vmstate"] = VMState; | ||
json["gas_consumed"] = GasConsumed.ToString(); | ||
json["stack"] = Stack.Select(q => q.ToJson()).ToArray(); | ||
json["notifications"] = Notifications.Select(q => q.ToJson()).ToArray(); | ||
return json; | ||
} | ||
|
||
public static RpcApplicationLog FromJson(JObject json) | ||
{ | ||
RpcApplicationLog log = new RpcApplicationLog(); | ||
log.TxId = json["txid"] is null ? null : UInt256.Parse(json["txid"].AsString()); | ||
log.Trigger = json["trigger"].TryGetEnum<TriggerType>(); | ||
log.VMState = json["vmstate"].TryGetEnum<VMState>(); | ||
log.GasConsumed = long.Parse(json["gas_consumed"].AsString()); | ||
log.Stack = ((JArray)json["stack"]).Select(p => ContractParameter.FromJson(p)).ToList(); | ||
log.Notifications = ((JArray)json["notifications"]).Select(p => RpcNotifyEventArgs.FromJson(p)).ToList(); | ||
return log; | ||
} | ||
} | ||
|
||
public class RpcNotifyEventArgs | ||
{ | ||
public UInt160 Contract { get; set; } | ||
|
||
public ContractParameter State { get; set; } | ||
|
||
public JObject ToJson() | ||
{ | ||
JObject json = new JObject(); | ||
json["contract"] = Contract.ToString(); | ||
json["state"] = State.ToJson(); | ||
return json; | ||
} | ||
|
||
public static RpcNotifyEventArgs FromJson(JObject json) | ||
{ | ||
return new RpcNotifyEventArgs | ||
{ | ||
Contract = UInt160.Parse(json["contract"].AsString()), | ||
State = ContractParameter.FromJson(json["state"]) | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Neo.IO.Json; | ||
using Neo.Ledger; | ||
using Neo.SmartContract.Manifest; | ||
using System; | ||
|
||
public class RpcContractState | ||
{ | ||
public ContractState ContractState { get; set; } | ||
|
||
public JObject ToJson() | ||
{ | ||
return ContractState.ToJson(); | ||
} | ||
|
||
public static RpcContractState FromJson(JObject json) | ||
{ | ||
RpcContractState state = new RpcContractState(); | ||
state.ContractState = new ContractState | ||
{ | ||
Id = (int)json["id"].AsNumber(), | ||
Script = Convert.FromBase64String(json["script"].AsString()), | ||
Manifest = ContractManifest.FromJson(json["manifest"]) | ||
}; | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.