Commit graph

178 commits

Author SHA1 Message Date
AnnaShaleva
0092330fe1 rpc: carefully review places where Client.cache.initDone is used
1. Keep initDone check only for the places where cache is directly accessed.
   We don't need to check it in other places, otherwise we have a mess of
   duplicating checks.
2. Fix bug in code related to block deserialisation. There's no magic, so
   checking that initialisation is done is not enough for proper block
   deserialisation. We need to manually fill StateRootEnabled field.
3. Since transaction doesn't need network magic to compute its hash, we don't
   need to perform Client initialisation before transaction-related requests.
4. Check that cache is initialised before accessing network magic.
5. Refactor the way Policy contract hash is fetched for Client requests.
   We don't really need Client initialisation for that, it's OK to fetch Policy
   hash on-the-fly.
2022-02-22 12:52:14 +03:00
Anna Shaleva
3c75f047c1 cli: refactor nep11-related commands and add tests
Specify tokenID via hex-encoded string.
2022-02-09 11:47:27 +03:00
Anna Shaleva
152cebe4e2 cli: add tests for wallet-related commands
Fixes:
  * Return proper exit code on error.
  * Improve error handling.
2022-02-02 13:48:12 +03:00
Roman Khimov
62b0fceec2 cli/wallet: add change-password command, fix #2233 2022-01-17 16:41:45 +03:00
AnnaShaleva
cf3ec6d9ac cli: print zero balance of known token if token flag specified
Close #2313.
2021-12-28 11:41:38 +03:00
Roman Khimov
dadb3b7240 cli/wallet: improve errNoPath string
It's also used by commands that don't write to the wallet, the text seems to
be wrong for these cases.
2021-12-08 10:36:17 +03:00
Roman Khimov
5196558056 cli/wallet: allow to read wallet from stdin where it's possible
Unfortunately, testing this code is not possible without an additional wrapper
in `input`, but adding it just to test this seems to be too excessive. Fixes
2021-12-08 10:36:17 +03:00
Anna Shaleva
6101d4b251 cli: improve error messages for signStoredTransaction
It's nice for user when he sees meaningful error messages.
2021-11-29 11:34:07 +03:00
Roman Khimov
ce9d0b22cf *: use NEP-XX naming consistently in docs/comments
Standards are NEP-11 and NEP-17, not NEP11, not NEP17, not anything
else. Variable/function names of course can use whatever fits, but documents
and comments should be consistent wrt this.
2021-11-19 12:58:46 +03:00
Roman Khimov
7679a17bc6 cli: provide better error message in case of password read failure 2021-11-03 19:36:11 +03:00
Evgeniy Stratonikov
e3ddbd28ae cli/wallet: do not panic if receiver is missing, fix #2210
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-11 11:04:23 +03:00
Evgeniy Stratonikov
2a78ec8003 cli/wallet: show tx fee before relaying
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-21 11:31:56 +03:00
Anna Shaleva
cbc75afd4d docs: refactor documentation
CLI:
* Typos are fixed
* Documentation on NEP-11 tokens is added
* NeoGo node configuration is moved to a separate file

Compiler:
* Typos and indentations are fixed
* Ops dump example is updated

Consensus:
* Typos are fixed
* Links are fixed

Notifications:
* Minor adjustments

RPC:
* `getversion` response is updated
* `getunclamedgas` comment is removed (not valid since
https://github.com/neo-project/neo-modules/pull/243)

VM:
* Update help message
* `load*` command adjustments
* `astack` command removal
2021-09-08 17:52:46 +03:00
Roman Khimov
24ee8fab5c cli: move wallet candidate getstate into query voter
This command has nothing to do with wallets.
2021-07-22 21:13:44 +03:00
Roman Khimov
5fbb60a9ed cli/wallet: request candidate registration price
Hardcoding 1000 is wrong. Inspired by neo-project/neo-node#788.
2021-07-21 12:26:35 +03:00
Roman Khimov
19717dd9a8 slice: introduce common Copy helper
It's a bit more convenient to use.
2021-07-19 22:57:55 +03:00
Roman Khimov
588f3fbbd3 state: drop State from NEOBalance and NEP17Balance
We're in the `state` package already.
2021-07-19 22:01:07 +03:00
Roman Khimov
41e0218555 cli/wallet: add sysgas to transfer functions
It might also be useful there.
2021-07-02 12:34:18 +03:00
Anna Shaleva
67fe2a82bc cli: remove Can't find matching token in the wallet warning 2021-06-17 11:29:16 +03:00
Anna Shaleva
50296975e2 crypto: allow to provide non-default scrypt parameters 2021-06-11 15:22:28 +03:00
Anna Shaleva
c2b5459646 cli: add wallet candidate getstate 2021-05-31 11:18:59 +03:00
Anna Shaleva
9340a70aa8 cli: add description to vote command on how to unvote 2021-05-28 15:15:37 +03:00
Roman Khimov
c4e084b0d8 *: fix whitespace errors
leading/trailing newlines
2021-05-12 22:51:41 +03:00
Roman Khimov
0500c8f9d7 cli/wallet: fix error handling
cli/wallet/wallet.go:527:19: Error return value of `cli.NewExitError` is not checked (errcheck)
                cli.NewExitError("valid account address must be provided", 1)
2021-05-12 20:19:24 +03:00
Roman Khimov
ec50bb4041 cli/wallet: fix error handling
ineffectual assignment to err (ineffassign)

`err` is shadowed at `tx, err = c.CreateNEP11TransferTx()` line.
2021-05-12 19:34:12 +03:00
Anna Shaleva
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +03:00
Anna Shaleva
f61ab6bd11 cli: add nep11 properties command 2021-04-30 16:23:06 +03:00
Anna Shaleva
ba7ebc2390 cli: add nep11 [tokens | tokensOf | ownerOf] commands 2021-04-30 16:23:06 +03:00
Anna Shaleva
4e55b1a9ed cli: add nep11 ownerOf command 2021-04-30 16:23:06 +03:00
Anna Shaleva
946e940ce0 cli: adjust nep17 transfer command usage text
Token name or hash can be used.
2021-04-30 16:23:06 +03:00
Anna Shaleva
7ea15f02c6 cli: add nep11 transfer command 2021-04-30 16:23:06 +03:00
Anna Shaleva
3eefda7f1a cli: add nep11 balance command 2021-04-30 16:23:06 +03:00
Anna Shaleva
3742e38399 cli: add nep11 remove command 2021-04-30 16:23:06 +03:00
Anna Shaleva
5fdb8e2a01 cli: add nep11 info command 2021-04-30 16:23:06 +03:00
Anna Shaleva
ba8b0fd7b0 cli: reuse existing token flag for nep17-related commands 2021-04-30 16:23:06 +03:00
Anna Shaleva
a61a3d5ceb cli: add nep11 import command 2021-04-30 16:23:06 +03:00
Anna Shaleva
4b8d814ee8 cli: move common NEP17 flags to package variables
These flags will be reused for NEP11 commands.
2021-04-30 16:23:06 +03:00
Anna Shaleva
40ae78cb88 wallet: add Standard field to Token
We need to distinguish NEP11 and NEP17 tokens preesnted in the wallet.
2021-04-30 15:58:27 +03:00
Anna Shaleva
d98abd75d2 cli: refactor handleVote method
Reuse existing RPC client method for transaction sending.
2021-04-23 10:45:15 +03:00
Anna Shaleva
e43ab642d1 cli: refactor handleCandidate method
Reuse existing RPC client method for transaction sending.
2021-04-23 10:45:15 +03:00
Anna Shaleva
14c2d7d25a cli: allow to provide cosigners for 'wallet nep17 multitransfer' 2021-04-23 10:45:15 +03:00
Anna Shaleva
f848783d5d cli: allow to provide cosigners for 'wallet nep17 transfer' 2021-04-23 10:45:15 +03:00
Anna Shaleva
49c35dec20 rpc: allow to provide cosigners for NEP17-transfer-related commands 2021-04-23 10:29:40 +03:00
Anna Shaleva
94316fa36d cli: move GetDataFromContext and ParseParams to a helpers package 2021-04-23 10:26:09 +03:00
Anna Shaleva
d12ae0998f cli: return numWordsRead from GetDataFromContext
It's needed when we have extra args after the 'data' argument. Then
these args are started right from numWordsRead offset.
2021-04-23 10:23:06 +03:00
Anna Shaleva
70fc78b768 cli: update usage text for 'wallet sign' command
RPC endpoint can be provided.
2021-04-21 15:51:19 +03:00
Anna Shaleva
a348347fe8 cli: refactor readAccountInfo method
It doesn't require binwriter.
2021-04-21 15:51:19 +03:00
Anna Shaleva
2daae43eaf cli: add optional 'name' argument to 'wallet import-deployed' command
If the provided WIF is encrypted then we have no way to set the
account name. Fixed.
2021-04-21 15:51:19 +03:00
Anna Shaleva
0ccced2274 cli: add usage description to 'wallet import' command 2021-04-21 15:51:19 +03:00
Anna Shaleva
08e88ce5b2 cli: handle 'name' named argument in 'wallet import-multisig'
If the provided WIF is encrypted, then we won't get account name from
readAccountInfo.
2021-04-21 15:51:19 +03:00