Commit graph

154 commits

Author SHA1 Message Date
Roman Khimov
483fefbb62 cli: allow specifying system fee via -s for invocations
Makes it possible to migrate a contract on Neo 2.
2021-02-26 14:52:45 +03:00
Evgenii Stratonikov
7a976d47f3 cli: allow to export state root dumps 2020-09-15 16:16:48 +03:00
Evgenii Stratonikov
67ee4ed0a6 cli: allow to import state root dumps 2020-09-15 16:16:48 +03:00
Evgenii Stratonikov
916603d495 cli: return proper error on block import fail 2020-09-15 12:03:59 +03:00
Evgenii Stratonikov
5703c4859b cli: rename readBlock to readBytes
It reads only byte slice.
2020-09-15 11:11:55 +03:00
Roman Khimov
56b2a16389 *: use proper YAML library import path, fix #1306 2020-08-12 16:26:41 +03:00
Anna Shaleva
4b351f3123 cli: use hashes for verifying in invoke* calls 2020-08-07 14:41:44 +03:00
Roman Khimov
2f90a06db3
Merge pull request #990 from nspcc-dev/feature/mpt
Initial MPT implementation (2.x)
2020-06-01 18:58:35 +03:00
Evgenii Stratonikov
314430be1d mpt: implement NEO storage key conversion 2020-06-01 18:15:13 +03:00
Evgenii Stratonikov
78bd01db57 cli: support DB restore from diff
Diff dumps provided by NGD contain index of the first block.
Also do proper error handling.
2020-05-27 10:46:12 +03:00
Anna Shaleva
99d0bafa2c compiler: add ability to generate .abi.json file
A part of integration with NEO Blockchain Toolkit (see #902). To be
able to deploy smart-contract compiled with neo-go compiler via NEO
Express, we have to generate additional .abi.json file. This file
contains the following information:
 - hash of the compiled contract
 - smart-contract metadata (title, description, version, author,
email, has-storage, has-dynamic-invoke, is-payable)
 - smart-contract entry point
 - functions
 - events

However, this .abi.json file is slightly different from the one,
described in manifest.go, so we have to add auxilaury stractures for
json marshalling. The .abi.json format used by NEO-Express is described
[here](https://github.com/neo-project/neo-devpack-dotnet/blob/master/src/Neo.Compiler.MSIL/FuncExport.cs#L66).
2020-05-04 08:31:14 +03:00
Anna Shaleva
87b0e76a8c rpc, smartcontract: move contract metadata to smartcontract package 2020-04-29 13:50:05 +03:00
Roman Khimov
2b943b76ae cli: check for method presence for invokefunction commands
Fixes #828.
2020-04-13 11:21:11 +03:00
Evgenii Stratonikov
450263bcae cli: rename contract compile --emitdebug to --debug
It is more intuitive and easier to type.
2020-04-08 15:54:25 +03:00
Evgenii Stratonikov
c71ad6a5db cli: output contract after compiling only with --verbose flag
Also remove Debug from compiler option as it is used only in CLI.
2020-04-08 13:09:51 +03:00
Evgenii Stratonikov
73c7b408b7 cli: rename --debug flag in contract compile 2020-04-08 13:09:51 +03:00
Evgenii Stratonikov
5bdee683e6 cli,compiler: support emitting debug info in a file 2020-04-06 15:30:07 +03:00
Anna Shaleva
5a984fdf88 config: move config.go out of config/
closes #423
2020-03-31 17:55:59 +03:00
Roman Khimov
79b930f6de
Merge pull request #790 from nspcc-dev/fix/deploy
cli: fix type in flags.Fixed8FromContext
2020-03-24 17:37:08 +03:00
Evgenii Stratonikov
7310666479 cli: fix type in flags.Fixed8FromContext 2020-03-24 17:17:28 +03:00
Anna Shaleva
2001a40312 util: JSONify uint160 using LE instead of BE
closes #769
2020-03-23 17:38:58 +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
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