Commit graph

278 commits

Author SHA1 Message Date
Anna Shaleva
65503aa9b4 core: add nonce field to transaction
1. Closes #840: added Nonce field to transaction.Transaction and
removed Nonce field from transaction.MinerTx

2. Added following methods to different tx types:
  - NewMinerTx()
  - NewMinerTxWithNonce(...)
  - NewEnrollmentTx(...)
  - NewIssueTx()
  - NewPublishTx(...)
  - NewRegisterTx(...)
  - NewStateTx(...)
in order to avoid code duplication when new transaction is created.

3. Commented out test cases where binary transaction/block are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.

4. Updated other tests

5. Added constant Nonce to GoveringTockenTx, UtilityTokenTx and genesis
block to avoid data variability. Also marked with TODO.
2020-04-14 16:19:41 +03:00
Anna Shaleva
d1f92a585b core: add NewTransactionFromBytes method to Transaction
Added `NewTransactionFromBytes(b []byte)` method to
transaction.Transaction in order to avoid code duplication.
2020-04-13 12:04:43 +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
Roman Khimov
3fa9de764b rpc/client: only return the Result from calls, handle Error internally
Adjust structures accordingly and throw away most of them, they're useless.
2020-02-21 15:23:11 +03:00
Roman Khimov
28a26d2cae rpc/client: look into data first, then HTTP error code
In case of error our own server responds with an HTTP error and proper
JSON-RPC error in the body, so look there first as it has more specific data.
2020-02-21 15:12:04 +03:00
Roman Khimov
bba8ac15ff rpc: introduce proper type for sendrawtransaction, drop useless types
sendrawtransaction just returns a bool, sendtoaddress returns a proper
transaction and that should be the same as the one we have in
TransactionOutputRaw.
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
d24c6d1d9e rpc: move client-related code to a separate package
This includes Client struct with RPC methods and
BalanceGetter implementation with NeoSCAN.
2020-02-21 15:12:04 +03:00