Commit graph

54 commits

Author SHA1 Message Date
Roman Khimov
1ef91fa409 rpc: encode port numbers as proper numbers in getpeers
The way C# node does it.
2021-02-18 17:28:19 +03:00
Roman Khimov
c3b6405f0f transaction: fix asset type JSONization
It's stringy in C#.
2021-02-12 23:02:51 +03:00
Roman Khimov
90a06ed7a5 rpc: fix IsFrozen JSONization for assets
C# node uses `frozen` as field name here.
2021-02-12 00:04:13 +03:00
Roman Khimov
68fc8168ec rpc: add getblocktransfertx RPC call
It uses a bit different output format than getalltransfertx, so
TransferTxEvent type was adjusted accordingly.
2020-11-02 19:01:48 +03:00
Roman Khimov
615ae1b3aa docs: update RPC documentation with *transfers changes 2020-09-15 12:46:40 +03:00
Roman Khimov
2e0e5cff25 rpc/client: add support for getutxotransfers call 2020-09-15 12:46:40 +03:00
Roman Khimov
26d4a05e57 rpc/client: update GetNEP5Transfers call 2020-09-15 12:46:40 +03:00
Roman Khimov
23719f7e72 rpc/server: add new getalltransfertx API
It unifies UTXO and NEP5 transfers for a given address and presents it with
transaction-level grouping (and additional metadata).
2020-09-15 12:46:39 +03:00
Roman Khimov
ebcec6e5dc
Merge pull request #1282 from nspcc-dev/rpc/invoke_with_hashes
rpc: use hashes for verifying in `invoke*` calls
2020-08-07 17:00:36 +03:00
Anna Shaleva
4b351f3123 cli: use hashes for verifying in invoke* calls 2020-08-07 14:41:44 +03:00
Roman Khimov
ab5eff620b rpc: use lowercase JSON field names for StateHeight
Follow neo-project/neo#1808. Note that this is an incompatible change, but
this feature is still considered to be experimental upstream.
2020-08-05 18:15:29 +03:00
Evgenii Stratonikov
eb37f92881 rpc/client: support verifyproof RPC 2020-06-25 17:07:23 +03:00
Evgenii Stratonikov
654877fb1b rpc/client: support getproof RPC 2020-06-25 17:04:23 +03:00
Evgenii Stratonikov
d8dddabc86 rpc/client: support getstateheight RPC 2020-06-25 16:19:47 +03:00
Evgenii Stratonikov
b4b0ae0f51 rpc/client: support getstateroot RPC 2020-06-25 16:19:47 +03:00
Evgenii Stratonikov
44f93c7c69 rpc/server: simplify errors handling during parameter parsing 2020-06-05 12:51:09 +03:00
alexvanin
8db714785d rpc/client: handle client creation error in new wsclient
Client returns error if it can't parse endpoint string. WSClient
should check client error or there could be panic at `cl.cli = nil`
expression.
2020-05-18 16:25:36 +03:00
Roman Khimov
8cd7bc7e07 rpc/client: deduplicate block/header tests a bit
The same data is copied at least three times here.
2020-05-14 17:28:14 +03:00
Roman Khimov
9546e021a9 rpc/block: rework the way Block is JSONized
Our block.Block was JSONized in a bit different fashion than result.Block in
its Nonce and NextConsensus fields. It's not good for notifications because
third-party clients would probably expect to see the same format. Also, using
completely different Block representation in result is probably making our
client a bit weaker as this representation is harder to use with other neo-go
components.

So use the same approach we took for Transactions and wrap block.Base which is
to be serialized in proper way.
2020-05-14 17:28:14 +03:00
Roman Khimov
78716c5335 rpc/client: add support for notification filters
Differing a bit from #895 draft specification, we won't add `verifier` (or
signer) for Neo 2, it's not worth doing so at the moment.
2020-05-14 00:56:26 +03:00
Roman Khimov
966ff28091 rpc: add subscriber queue overflow check
It's not practical adding server-side tests for 2.0 (as it requires generating
more blocks), so we'll leave it for 3.0.
2020-05-14 00:56:26 +03:00
Roman Khimov
5464f9c3ae rpc/client: add notifications support for WSClient
It differs from #895 design in that we have Notifications channel always
exposed as WSClient field, probably it simplifies things a little.
2020-05-13 17:17:41 +03:00
Roman Khimov
556ab39a5a rpc/client: add minimalistic websocket client 2020-04-30 22:59:19 +03:00
Roman Khimov
6333060897 rpc/client: separate out http-related functionality 2020-04-30 22:59:19 +03:00
Roman Khimov
38f9b511ae rpc/client: drop Version from Options
It makes no sense at all, it's a JSON-RPC version.
2020-04-30 22:59:19 +03:00
Roman Khimov
e32367a1c2 rpc/client: fix some comments 2020-04-30 22:59:19 +03:00
Roman Khimov
a49f2bc47c client: remove Balancer getter/setter, make it an Option
Keep it internal to the client instance, it makes no sense exposing it to the
outside user.
2020-04-30 22:59:19 +03:00
Roman Khimov
00d6439eb2 client: make http.Client internal to the Client
Exposing it the outside users is strange, so incapsulate it completely.

Fix DialTimeout setting along the way, handle negative timeouts as invalid.
2020-04-30 22:59:01 +03:00
Anna Shaleva
9c09ad9c89 rpc: fix marshalling of type-specific tx data
closes #585
2020-03-30 15:48:50 +03:00
Anna Shaleva
0be237beb6 rpc: fix double-pointer bugs in RPC Client
Fixed double-pointer bug in following methods:
	- GetRawTransactionVerbose
	- GetBlockVerbose
	- GetBlockHeader
	- GetTxOut
	- ValidateAddress
2020-03-27 16:04:11 +03:00
Evgenii Stratonikov
db2dccf7cb emit: implement AppCallWithOperationAndArgs
It is nice to have a typical task of calling contract method
with specific arguments incapsulated inside some function.
2020-03-27 11:05:36 +03:00
Anna Shaleva
6998c5044b rpc: add testing infrastructure to RPC client package
closes #716

NOTE: RPC client tests contain `serverResponse` json data fetched from examples
published in official C# JSON-RPC API v2.10.3 reference
(see https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html)
2020-03-24 16:02:08 +03:00
Roman Khimov
a5e862c351 rpc/client: add TransferNEP5 method to easily transfer tokens
We have TransferAsset for regular tokens, so it'd be nice to have TransferNEP5
for NEP5 ones. Relates to #599.
2020-03-16 17:52:32 +03:00
Evgenii Stratonikov
cdf025bf89 transaction: implement AddVerificationHash() method 2020-03-16 14:11:19 +03:00
Roman Khimov
734778c1f9
Merge pull request #747 from nspcc-dev/fix-contract-deploy-gas-parameter
Use wallet in smartcontract deploy/invoke commands and calculate GAS properly
2020-03-12 17:00:04 +03:00
Roman Khimov
25da5a30d8 cli: change deploy and invoke commands to use wallet
Passing WIF directly in the command line is not something we should be doing.

Also split netfee and sysfee in the RPC as they're different (and add a script
attribute for free transactions).
2020-03-12 16:19:12 +03:00
Anna Shaleva
307b3b162b rpc: implement missing RPC client methods
Implemented following RPC client methods:
	- getapplicationlog
	- getassetstate
	- getbestblockhash
	- getblockcount
	- getblockhash
	- getblockheader
	- getblocksysfee
	- getconnectioncount
	- getcontractstate
	- getpeers
	- getrawmempool
	- getstorage
	- gettransactionheight
	- gettxout
	- getunclaimed
	- getvalidators
	- getversion
	- submitblock
	- validateaddress
2020-03-12 15:56:59 +03:00
Evgenii Stratonikov
22e99a5b3e rpc: implement (*Client).NEP5TokenInfo()
It can be useful to receive all NEP5 token info at once.
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
cdeba6d417 rpc: implement (*Client).NEP5* methods 2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
95a8fa234f rpc: implement getnep5transfers RPC 2020-03-05 18:22:40 +03:00
Evgenii Stratonikov
2757882d26 rpc: implement getnep5balances RPC 2020-03-05 18:22:40 +03:00
Roman Khimov
a9d8c9e0d3 rpc/client: implement GetRawTransaction, fix #586 2020-03-03 20:43:57 +03:00
Roman Khimov
f01766131b rpc/client: add a set of GetBlock methods
They differ in input and output types (and data), thus four methods are
added.
2020-03-03 20:26:56 +03:00
Roman Khimov
685e34d83c rpc: update client documentation
Add missing methods, move example into something that can be compiled (and fix
it along the way).
2020-03-03 18:59:21 +03:00
Roman Khimov
e41d434a49 *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
Roman Khimov
4c8d327353 rpc: drop duplicating Invoke* structures
And use smartcontract.Parameter instead of vm.StackItem where
appropriate. Closes #689.
2020-03-03 15:38:03 +03:00
Evgenii Stratonikov
05a3625b7d wallet: implement (*Account).SignTx
It is used in both CLI and RPC.
2020-03-02 18:03:56 +03:00
Evgenii Stratonikov
37c2bc4733 rpc: implement (*Client).GetClaimable()
This is needed to form correct Claim transaction.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
9d5841df38 rpc: make (*Client).SendRawTransaction public 2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
624a14f730 rpc: rename (*Client).SendToAddress to TransferAsset
SendToAddress name is similar to the `sendtoaddress` RPC call,
this can cause confusion.

Closes #686.
2020-02-28 14:16:39 +03:00