Skip to content
Merged
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
24 changes: 0 additions & 24 deletions src/Plugins/RpcServer/RpcMethodWithParamsAttribute.cs

This file was deleted.

32 changes: 16 additions & 16 deletions src/Plugins/RpcServer/RpcServer.Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ partial class RpcServer
/// </code>
/// </summary>
/// <returns>The hash of the best block as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetBestBlockHash()
{
return NativeContract.Ledger.CurrentHash(system.StoreView).ToString();
Expand Down Expand Up @@ -88,7 +88,7 @@ protected internal virtual JToken GetBestBlockHash()
/// <param name="verbose">Optional, the default value is false.</param>
/// <returns>The block data as a <see cref="JToken"/>. If the second item of _params is true, then
/// block data is json format, otherwise, the return type is Base64-encoded byte array.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetBlock(BlockHashOrIndex blockHashOrIndex, bool verbose = false)
{
RpcException.ThrowIfNull(blockHashOrIndex, nameof(blockHashOrIndex), RpcError.InvalidParams);
Expand Down Expand Up @@ -118,7 +118,7 @@ protected internal virtual JToken GetBlock(BlockHashOrIndex blockHashOrIndex, bo
/// <code>{"jsonrpc": "2.0", "id": 1, "result": 100 /* The number of block headers in the blockchain */}</code>
/// </summary>
/// <returns>The count of block headers as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
internal virtual JToken GetBlockHeaderCount()
{
return (system.HeaderCache.Last?.Index ?? NativeContract.Ledger.CurrentIndex(system.StoreView)) + 1;
Expand All @@ -132,7 +132,7 @@ internal virtual JToken GetBlockHeaderCount()
/// <code>{"jsonrpc": "2.0", "id": 1, "result": 100 /* The number of blocks in the blockchain */}</code>
/// </summary>
/// <returns>The count of blocks as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetBlockCount()
{
return NativeContract.Ledger.CurrentIndex(system.StoreView) + 1;
Expand All @@ -149,7 +149,7 @@ protected internal virtual JToken GetBlockCount()
/// </summary>
/// <param name="height">Block index (block height)</param>
/// <returns>The hash of the block at the specified height as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetBlockHash(uint height)
{
var snapshot = system.StoreView;
Expand Down Expand Up @@ -209,7 +209,7 @@ protected internal virtual JToken GetBlockHash(uint height)
/// The block header data as a <see cref="JToken"/>.
/// In json format if the second item of _params is true, otherwise Base64-encoded byte array.
/// </returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetBlockHeader(BlockHashOrIndex blockHashOrIndex, bool verbose = false)
{
RpcException.ThrowIfNull(blockHashOrIndex, nameof(blockHashOrIndex), RpcError.InvalidParams);
Expand Down Expand Up @@ -249,7 +249,7 @@ protected internal virtual JToken GetBlockHeader(BlockHashOrIndex blockHashOrInd
/// </summary>
/// <param name="contractNameOrHashOrId">Contract name or script hash or the native contract id.</param>
/// <returns>The contract state in json format as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetContractState(ContractNameOrHashOrId contractNameOrHashOrId)
{
RpcException.ThrowIfNull(contractNameOrHashOrId, nameof(contractNameOrHashOrId), RpcError.InvalidParams);
Expand Down Expand Up @@ -300,7 +300,7 @@ private static UInt160 ToScriptHash(string keyword)
/// </summary>
/// <param name="shouldGetUnverified">Optional, the default value is false.</param>
/// <returns>The memory pool transactions in json format as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetRawMemPool(bool shouldGetUnverified = false)
{
if (!shouldGetUnverified)
Expand Down Expand Up @@ -355,7 +355,7 @@ protected internal virtual JToken GetRawMemPool(bool shouldGetUnverified = false
/// <param name="hash">The transaction hash.</param>
/// <param name="verbose">Optional, the default value is false.</param>
/// <returns>The transaction data as a <see cref="JToken"/>. In json format if verbose is true, otherwise base64string. </returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetRawTransaction(UInt256 hash, bool verbose = false)
{
RpcException.ThrowIfNull(hash, nameof(hash), RpcError.InvalidParams);
Expand Down Expand Up @@ -406,7 +406,7 @@ private static int GetContractId(IReadOnlyStore snapshot, ContractNameOrHashOrId
/// <param name="contractNameOrHashOrId">The contract ID or script hash.</param>
/// <param name="base64Key">The Base64-encoded storage key.</param>
/// <returns>The storage item as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetStorage(ContractNameOrHashOrId contractNameOrHashOrId, string base64Key)
{
RpcException.ThrowIfNull(contractNameOrHashOrId, nameof(contractNameOrHashOrId), RpcError.InvalidParams);
Expand Down Expand Up @@ -456,7 +456,7 @@ protected internal virtual JToken GetStorage(ContractNameOrHashOrId contractName
/// <param name="base64KeyPrefix">The Base64-encoded storage key prefix.</param>
/// <param name="start">The start index.</param>
/// <returns>The found storage items <see cref="StorageItem"/> as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken FindStorage(ContractNameOrHashOrId contractNameOrHashOrId, string base64KeyPrefix, int start = 0)
{
RpcException.ThrowIfNull(contractNameOrHashOrId, nameof(contractNameOrHashOrId), RpcError.InvalidParams);
Expand Down Expand Up @@ -509,7 +509,7 @@ protected internal virtual JToken FindStorage(ContractNameOrHashOrId contractNam
/// </summary>
/// <param name="hash">The transaction hash.</param>
/// <returns>The height of the transaction as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetTransactionHeight(UInt256 hash)
{
RpcException.ThrowIfNull(hash, nameof(hash), RpcError.InvalidParams);
Expand All @@ -534,7 +534,7 @@ protected internal virtual JToken GetTransactionHeight(UInt256 hash)
/// }</code>
/// </summary>
/// <returns>The next block validators as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetNextBlockValidators()
{
using var snapshot = system.GetSnapshotCache();
Expand Down Expand Up @@ -563,7 +563,7 @@ protected internal virtual JToken GetNextBlockValidators()
/// }</code>
/// </summary>
/// <returns>The candidates public key list as a JToken.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetCandidates()
{
using var snapshot = system.GetSnapshotCache();
Expand Down Expand Up @@ -624,7 +624,7 @@ protected internal virtual JToken GetCandidates()
/// <code>{"jsonrpc": "2.0", "id": 1, "result": ["The public key"]}</code>
/// </summary>
/// <returns>The committee members publickeys as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetCommittee()
{
return new JArray(NativeContract.NEO.GetCommittee(system.StoreView).Select(p => (JToken)p.ToString()));
Expand Down Expand Up @@ -711,7 +711,7 @@ protected internal virtual JToken GetCommittee()
/// }</code>
/// </summary>
/// <returns>The native contract states <see cref="ContractState"/> as a <see cref="JToken"/>.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetNativeContracts()
{
var storeView = system.StoreView;
Expand Down
10 changes: 5 additions & 5 deletions src/Plugins/RpcServer/RpcServer.Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ partial class RpcServer
/// <code>{"jsonrpc": "2.0", "id": 1, "result": 10}</code>
/// </summary>
/// <returns>The number of connections as a JToken.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetConnectionCount()
{
return localNode.ConnectedCount;
Expand All @@ -56,7 +56,7 @@ protected internal virtual JToken GetConnectionCount()
/// }</code>
/// </summary>
/// <returns>A JObject containing information about unconnected, bad, and connected peers.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetPeers()
{
return new JObject()
Expand Down Expand Up @@ -146,7 +146,7 @@ private static JObject GetRelayResult(VerifyResult reason, UInt256 hash)
/// }</code>
/// </summary>
/// <returns>A JObject containing detailed version and configuration information.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken GetVersion()
{
JObject json = new();
Expand Down Expand Up @@ -205,7 +205,7 @@ private static string StripPrefix(string s, string prefix)
/// </summary>
/// <param name="base64Tx">The base64-encoded transaction.</param>
/// <returns>A JToken containing the result of the transaction relay.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken SendRawTransaction(string base64Tx)
{
var tx = Result.Ok_Or(
Expand All @@ -225,7 +225,7 @@ protected internal virtual JToken SendRawTransaction(string base64Tx)
/// </summary>
/// <param name="base64Block">The base64-encoded block.</param>
/// <returns>A JToken containing the result of the block submission.</returns>
[RpcMethodWithParams]
[RpcMethod]
protected internal virtual JToken SubmitBlock(string base64Block)
{
var block = Result.Ok_Or(
Expand Down
Loading
Loading