Commit graph

133 commits

Author SHA1 Message Date
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
325dc7d0e4 cli: implement wallet nep5 remove
Remove unused tokens from the wallet.
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
cc5ec8e6d6 cli: support contract import in wallets
Sometimes we need to use custom verification script, e.g.
for contracts where funds needs to become accessible only
after a certain amount of time.
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
ffc0729adb cli: implement wallet remove-account
Make it possible to remove unneeded accounts from wallet.
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
2d82eb89f8 cli: rename wallet commands
Creating accounts is done frequently so it makes
sense to have lesser name for this command.
`create` -> `init`
`create-account` -> `create`
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
cdf025bf89 transaction: implement AddVerificationHash() method 2020-03-16 14:11:19 +03:00
Evgenii Stratonikov
ca476cbf8a cli: implement Fixed8Flag
Parsing gas from float value is not always a right idea as
a transform from float is not 1-to-1.
This commit implements Fixed8Flag which parses Fixed8 value from string.
2020-03-16 14:11:19 +03:00
Evgenii Stratonikov
c25bdd8253 cli: make dump more structured 2020-03-16 12:49:08 +03:00
Evgenii Stratonikov
ae4dc12273 cli: append blocks to existing dumps 2020-03-16 12:49:08 +03:00
Evgenii Stratonikov
c880435c92 cli: persist restored blocks on exit
Add grace context to execute defer's on exit.
2020-03-16 12:48:51 +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
Roman Khimov
bbd802681e cli: make gas parameter to deployment add gas to the base price
That's how it was intended to behave originally. One thing questionable here
is contract price (policy thing, basically) being moved to smartcontract
package, but it's probably fine for NEO 2.0 (as it won't change) and we'll
make something better for NEO 3.0.
2020-03-11 20:34:36 +03:00
Evgenii Stratonikov
c2924795ad cli: fix a bug in wallet claim
getclaimable RPC expects address as a 1-st argument.
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
97131683d8 cli: display info about imported NEP5 token 2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
053b779be7 cli: implement NEP5 transfer 2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
bcc03e2068 cli: implement NEP5 balance querying 2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
519b27fe0e cli: implement NEP5 token import
To work with NEP5 tokens, one need to save some info
e.g. token Name. This way we will not make additional
RPC just to get Decimals.
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
8d73276393 cli: do not allow default value for an empty address
Right now a bizarre error message can occur if an address flag was not
set: `wallet contains no account for 'AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM'`.
This bug is 10x worse if it occures in `transfer` --from flag.
2020-03-10 09:54:23 +03:00
Evgenii Stratonikov
9be4312d8d cli: implement AddressFlag
This makes code less verbose and performs all parsing
before invoking main function.
2020-03-06 13:50:34 +03:00
Evgenii Stratonikov
a9783d05f5 cli: implement wallet multisig sign command
Implement ability to sign transactions with multisig address.
This should be done in several steps:
1. Create TX with `wallet transfer --out <file>`
2. Sign TX with `wallet multisign sign --in <file> --out <file2>`.
3. Repeat 2 for every party.
Input file contains transaction with possibly incomplete
set of the signatures. Output file will contain the same tx
with updated signature set.
When --rpc flag is provided, result transaction is sent
via `sendrawtransaction`.
2020-03-05 09:45:34 +03:00
Evgenii Stratonikov
0d4ad9f76c cli: add --out flag to the wallet transfer command
When transferring assets from multisig accounts,
it is useful to export tx into a file, so that
other participants can sign it too.
2020-03-05 09:45:12 +03:00
Evgenii Stratonikov
7eaeb18f18 transaction: marshal ContractTX even if Data is nil
It contains no information so it doesn't matter anyway.
2020-03-04 20:01:26 +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
ed190dcfd3 cli: add command for asset transfer
It uses getunspents RPC for getting UTXO and
forming transaction.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
907d599edb cli: add command for GAS claiming
GAS can be claimed via `wallet claim` command.
This will claim first get all claimable outputs via
`getclaimable` RPC and then form a transaction signed
byte the private key from the wallet.
2020-03-02 18:01:49 +03:00
Anna Shaleva
648e0bb242 rpc/smartcontract: merge contract parameter types
Merged two types:
	- smartcontract.ParamType
	- rpc.StackParamType
into single one:
	- smartcontract.ParamType
as they duplicated the functionality.

NOTE: type smartcontract.MapType was added (as in C# implementation).

From now, list of supported smartcontract parameter types:
	UnknownType
	SignatureType
	BoolType
	IntegerType
	Hash160Type
	Hash256Type
	ByteArrayType
	PublicKeyType
	StringType
	ArrayType
	MapType
	InteropInterfaceType
	VoidType
2020-03-02 17:25:21 +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
Evgenii Stratonikov
b50704fd3b rpc: move server-related code to a separate package 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
Evgenii Stratonikov
b6bc4e580a rpc: move functions for Tx building in request package/ 2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
98a1e2170a rpc: move ContractDetails to request/ package 2020-02-21 15:12:04 +03:00
Roman Khimov
f330f2f40b rpc: separate out request and response structures
Mostly as is, no real effort done yet to optimize them, so there are still a
lot of duplicates there, but at least we sort them out into different smaller
packages.
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
2fc6375958 cli: provide separate function for opening wallet 2020-02-21 12:14:53 +03:00
Evgenii Stratonikov
3d67d52537 cli: support account creation in existing wallet 2020-02-21 12:14:53 +03:00
Evgenii Stratonikov
20c98411fd cli: implement wallet WIF/NEP2 export
One positional argument can be provided. If so, it is
interpreted as address and only WIFs corresponding to it
are exported. If address is provided '--decrypt' flag can be
specified to export unencrypted WIFs.
2020-02-21 12:14:52 +03:00
Evgenii Stratonikov
a030411310 cli: implement multisig import to wallet 2020-02-21 12:14:33 +03:00
Evgenii Stratonikov
baa68e1d46 cli: implement wallet WIF import 2020-02-21 11:19:34 +03:00
Evgenii Stratonikov
a71c2c4bfd cli: move password getting to a separate function
Also do not ignore errors from `terminal.ReadPassword`.
2020-02-21 10:45:58 +03:00
Evgenii Stratonikov
02954285c1 cli: declare wallet path flag once 2020-02-20 15:52:07 +03:00
Evgenii Stratonikov
0a894db7f8 storage: add Exists flag to KeyValue in batch
Set Exists flag if an item with the specified key was already
present in storage before persisting.
2020-02-12 12:16:31 +03:00
Evgenii Stratonikov
b1d9e1132d cli: dump storage changes into JSON files 2020-02-12 12:16:31 +03:00
Roman Khimov
ea3b76ded1 network: make NewServer return an error, fix #612
It can return nil in two cases, so we're better return an error and handle
it.
2020-01-22 11:17:51 +03:00
Evgenii Stratonikov
63c56cca5c core: refactor out Block, BlockBase and Header structs
See #597.
2020-01-16 10:16:24 +03:00
Roman Khimov
a52e016c22 cli/server: disable sampling completely
It's not safe, we don't want to lose messages and we don't have that many of
them to try to figure out what is the better value than the default 100.
2020-01-13 17:32:44 +03:00
Roman Khimov
565c1940e3
Merge pull request #587 from nspcc-dev/feature/zap
Closes #284.
2020-01-10 14:50:09 +03:00
Evgenii Stratonikov
289cb1c1d9 rpc: use zap.Logger 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
aecdf470e7 cli,pkg: use zap.Logger 2020-01-10 11:14:27 +03:00
Roman Khimov
aad0d3792d wallet: implement dump command
Mostly a testing tool for the moment.
2020-01-09 18:40:30 +03:00