Commit graph

65 commits

Author SHA1 Message Date
Roman Khimov
0efe3dd42c cli: deduplicate smartcontract/wallet tx confirm/sign/save/send
It's the same code.
2022-10-06 23:03:32 +03:00
Roman Khimov
58dc8d0c9b *: always close the wallet after use
Fix #2631.
2022-09-02 14:44:32 +03:00
Roman Khimov
e569edc841 wallet: add ScriptHash() to Account
It allows to simplify a lot of code and avoid getting a PrivateKey in some
cases.
2022-09-02 14:43:34 +03:00
Roman Khimov
a9237659ff cli/wallet: correct error message
It can be both NEP-11 and NEP-17.
2022-09-01 15:30:33 +03:00
Roman Khimov
1da4b333f6 cli/wallet: modernize nep11 balances command, unify with nep17
Make NEP-11 code use getnep11balances the same way NEP-17 code uses
getnep17balances. This command was introduced well before getnep11balances
appeared, so it required always specifying contract explicitly. Now this
constraint can be relaxed somewhat in most cases.
2022-08-30 12:52:14 +03:00
Roman Khimov
7cfcf072b8 cli/wallet: make NEP-17 token selection logic a bit more robust
1. In the single token mode compare known hashes instead of names, names can
   be misleading.
2. Hardcode NEO/GAS, they are special (if not overrided by the wallet data).
2022-08-30 12:52:14 +03:00
Roman Khimov
5f1fe72504 cli/wallet: use token data from getnepXXbalances
We have this data available since 0.99.1 while all public networks require at
least 0.99.2 for compatibility and NeoFS setups use 0.99.2+ too. This data can
simplify account handling considerably making additional requests unneccessary
in many cases.
2022-08-29 22:52:27 +03:00
Roman Khimov
e28bf55ebb cli/wallet: search for NEP-11 token name in balances
In the same way we do for NEP-17 tokens. This code predates "getnep11balances"
call, so this wasn't possible back then, but now we can improve the situation
(allow specifying names/symbols instead of hashes only).
2022-08-29 22:52:27 +03:00
Roman Khimov
ed6ed61712 neptoken: add Info to replace old NEPXXTokenInfo methods
I'm still not sure it's good to have this exposed from neptoken at all, but
let's try it this way.
2022-08-29 22:52:27 +03:00
Roman Khimov
8005bfcd32 cli/wallet: compensate for CLI waiting time
Similar to ba2e7063dd.
2022-08-22 09:55:31 +03:00
Roman Khimov
f60fa02a96 cli/wallet: deduplicate some transfer code 2022-08-22 09:55:31 +03:00
Roman Khimov
7e212de41a cli: drop the use of deprecated APIs from sc/nep11/nep17 2022-08-19 21:52:43 +03:00
Roman Khimov
f011b3c3dd rpcclient: introduce NEO wrapper
Notice that int64 types are used for gas per block or registration price
because the price has to fit into the system fee limitation and gas per block
value can't be more than 10 GAS. We use int64 for votes as well in other types
since NEO is limited to 100M.
2022-08-17 22:03:09 +03:00
Roman Khimov
ee72b2fa29 rpcclient: add gas package for the GAS contract
Test it with the RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
be74cc6b55 cli: use nep17 wrapper to implement commands 2022-08-12 18:21:02 +03:00
Roman Khimov
593fa4cac8
Merge pull request #2632 from nspcc-dev/rpcclient-actor
RPC client Actor interface
2022-08-09 17:21:24 +03:00
Roman Khimov
afef8b85d9 rpcclient: add deprecation warnings 2022-08-08 09:51:51 +03:00
Roman Khimov
d9feec2be5 cli: use MVUBI for saved transactions
And DO NOT CHANGE TX in paramcontext InitAndSave, because it's really
unobvious and must not be done this way.
2022-08-07 22:33:57 +03:00
Roman Khimov
4c8e00369c cli/wallet: specify --wallet-config for all commands accepting it 2022-08-05 18:28:02 +03:00
Roman Khimov
1518019be8 cli: add excessive arguments checks
Some commands don't accept arguments, but users try giving them and don't
notice a mistake. It's a bit more user-friendly to tell the user that there is
something wrong with the way he tries to use the command.
2022-08-05 15:50:12 +03:00
Roman Khimov
1e0750e3cd rpc: merge response and request under pkg/neorpc
Move result there also.
2022-07-25 11:57:53 +03:00
Roman Khimov
8c668765d2 rpc/client: move to pkg/rpcclient
Better package name, closer to user.
2022-07-21 22:39:53 +03:00
Anna Shaleva
5f36a7ca0f *: do not call wallet.Close() explicitly
NewWallet and NewWalletFromFile close underlying io.Closer by itself,
no need to close it manually. Introduced in #2184.
2022-07-04 19:09:48 +03:00
Anna Shaleva
b2f188f8f0 cli: refactor code that opens wallet
Reduce code duplications, no functional changes.
2022-07-04 13:50:15 +03:00
Anna Shaleva
213bfe6bbf cli: allow to specify wallet via configuration file 2022-07-04 12:57:47 +03:00
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
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
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
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
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
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
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +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
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
Roman Khimov
8f14c61c34
Merge pull request #1906 from nspcc-dev/cli/transfer_param
cli: allow to pass 'data' for nep17 transfer command
2021-04-19 10:43:42 +03:00