-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[New]
RestServer
Plugin
#3390
base: master
Are you sure you want to change the base?
[New]
RestServer
Plugin
#3390
Conversation
throw new QueryParameterNotFoundException(nameof(method)); | ||
try | ||
{ | ||
var engine = ScriptHelper.InvokeMethod(_neosystem.Settings, _neosystem.StoreView, contracts.Hash, method, contractParameters, out var script); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need supporting signer account and scope like what invokefunction did, or methods can't pass verifywitness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cschuchardt88 conflict |
|
@cschuchardt88 Can we go on this? RestServer is useful, we need update and fix this. |
@superboyiii Where are we with this? |
@superboyiii did you test the missing features? I added the features you required. Just let me know if it good...because I limited it. |
I will. |
@cschuchardt88 Need resolve conflict |
@cschuchardt88 Wallet module is missing? Still can see it in readme but I can't find it. |
I ended up removing it, because of security reason with pathing. Everyone had problem with that in when it was in other repo |
public static ApplicationEngine InvokeMethod(ProtocolSettings protocolSettings, DataCache snapshot, UInt160 scriptHash, string method, ContractParameter[] args, Signer[]? signers, out byte[] script) | ||
{ | ||
using var scriptBuilder = new ScriptBuilder(); | ||
scriptBuilder.EmitDynamicCall(scriptHash, method, CallFlags.ReadOnly, args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always set CallFlags as ReadOnly, this doesn't make sense. As it invokes without wallet or broadcasting any real transaction, we can make it always as CallFlags.All.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK ill change that. This was written way back when i didnt know much.
Even change it to CallFlags.All. The result stack is still incorrect. It should be true, but shows false. Rest request:
Rpc request:
|
Co-authored-by: Owen <[email protected]>
Oops i didnt pass in transaction. |
@cschuchardt88 Need make result stack return correct value. |
Description
In this section you will learn about
RestServer
plugin and how it works.Checkout the docs in
./docs/RestServer
folder.Dependencies
Required
Required
Required
Required
Required
Required
Required
linux maybe
Required
Required
Required
Swagger
(optional)Swagger
(optional)Swagger
(optional)Swagger
(optional)Swagger
(optional)Swagger UI
(optional)In Docker
These files go in the same directory as the
RestServer.dll
. In neo-cliplugins/RestServer/
folder.Response Headers
neo-cli
andRestServer
version.JSON Serializer
RestServer
uses custom Newtonsoft Json Converters to serialize controller actionresponses and
route
parameters.One Way Binding -
Write
only.Neo.SmartContract.ContractState
Neo.SmartContract.NefFile
Neo.SmartContract.MethodToken
Neo.SmartContract.Native.TrimmedBlock
Neo.SmartContract.Manifest.ContractAbi
Neo.SmartContract.Manifest.ContractGroup
Neo.SmartContract.Manifest.ContractManifest
Neo.SmartContract.Manifest.ContractPermission
Neo.SmartContract.Manifest.ContractPermissionDescriptor
Neo.Network.P2P.Payloads.Block
Neo.Network.P2P.Payloads.Header
Neo.Network.P2P.Payloads.Signer
Neo.Network.P2P.Payloads.TransactionAttribute
Neo.Network.P2P.Payloads.Transaction
Neo.Network.P2P.Payloads.Witness
Two Way Binding -
Read
&Write
System.Guid
System.ReadOnlyMemory<T>
Neo.BigDecimal
Neo.UInt160
Neo.UInt256
Neo.Cryptography.ECC.ECPoint
Neo.VM.Types.Array
Neo.VM.Types.Boolean
Neo.VM.Types.Buffer
Neo.VM.Types.ByteString
Neo.VM.Types.Integer
Neo.VM.Types.InteropInterface
Neo.VM.Types.Null
Neo.VM.Types.Map
Neo.VM.Types.Pointer
Neo.VM.Types.StackItem
Neo.VM.Types.Struct
Remote Endpoints
Parametes
{hash}
can be any Neo N3 address or scripthash;{address}
can be any Neo N3 address only;{number}
and{index}
can be any uint32.Parameter Examples
{hash}
- 0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5 or NiHURyS83nX2mpxtA7xq84cGxVbHojj5Wc{address}
- NiHURyS83nX2mpxtA7xq84cGxVbHojj5Wc{number}
- 1{index}
- 2500000Paths
[GET]
/api/v1/utils/{hash}/address
[GET]
/api/v1/utils/{address}/scripthash
[GET]
/api/v1/utils/{hash}/{address}/validate
[GET]
/api/v1/node/peers
[GET]
/api/v1/node/plugins
[GET]
/api/v1/node/settings
[GET]
/api/v1/ledger/neo/accounts
[GET]
/api/v1/ledger/gas/accounts
[GET]
/api/v1/ledger/blocks?page={number}&size={number}
[GET]
/api/v1/ledger/blocks/height
[GET]
/api/v1/ledger/blocks/{index}
[GET]
/api/v1/ledger/blocks/{index}/header
[GET]
/api/v1/ledger/blocks/{index}/witness
[GET]
/api/v1/ledger/blocks/{index}/transactions?page={number}&size={number}
[GET]
/api/v1/ledger/transactions/{hash}
[GET]
/api/v1/ledger/transactions/{hash}/witnesses
[GET]
/api/v1/ledger/transactions/{hash}/signers
[GET]
/api/v1/ledger/transactions/{hash}/attributes
[GET]
/api/v1/ledger/memorypool?page={number}&size={number}
[GET]
/api/v1/ledger/memorypool/verified?page={number}&size={number}
[GET]
/api/v1/ledger/memorypool/unverified?page={number}&size={number}
[GET]
/api/v1/ledger/memorypool/count
[GET]
/api/v1/tokens/balanceof/{address}
[GET]
/api/v1/tokens/nep-11?page={number}&size={number}
[GET]
/api/v1/tokens/nep-11/count
[GET]
/api/v1/tokens/nep-11/{hash}/balanceof/{address}
[GET]
/api/v1/tokens/nep-17?page={number}&size={number}
[GET]
/api/v1/tokens/nep-17/count
[GET]
/api/v1/tokens/nep-17/{hash}/balanceof/{address}
[GET]
/api/v1/contracts?page={number}&size={number}
[GET]
/api/v1/contracts/count
[GET]
/api/v1/contracts/{hash}
[GET]
/api/v1/contracts/{hash}/abi
[GET]
/api/v1/contracts/{hash}/manifest
[GET]
/api/v1/contracts/{hash}/nef
[GET]
/api/v1/contracts/{hash}/storage
Type of change
How Has This Been Tested?
By @superboyiii from neo-project/neo-modules#839
Checklist: