Commit graph

43 commits

Author SHA1 Message Date
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
Anna Shaleva
db868f033e cli: allow to provide data for nep17 transfer commands 2021-04-19 10:20:29 +03:00
Anna Shaleva
ced90e0510 cli: use AddressFlag for nep17 import 2021-04-16 15:18:33 +03:00
Anna Shaleva
1d3a297a6b rpc: add Data field to NEP17 TransferTarget
It's a part of transfer, thus it should be passed along with the other
transfer parameters.
2021-04-16 13:54:23 +03:00
Anna Shaleva
ff2b051646 cli: use AddressFlag for nep17-related commands 2021-04-16 12:41:02 +03:00
Roman Khimov
d314f82db3 transaction: drop Network from Transaction
We only need it when signing/verifying.
2021-03-26 13:45:18 +03:00
Evgeniy Stratonikov
b8024dbfa8 cli: support Uint160 hashes with 0x prefix 2021-02-18 14:38:50 +03:00
Anna Shaleva
7896ef0640 rpc: allow client to send nep17 transfer with data 2021-02-11 17:11:36 +03:00
Evgenii Stratonikov
d4723d8e81 cli: use default adress in transfer 2021-01-12 11:14:40 +03:00
Evgenii Stratonikov
d737915843 cli: output nep17 balance using decimals
Also fix balance tests to match full line, not just prefix.
2021-01-11 15:02:24 +03:00
Roman Khimov
e3dfb5d165 cli/wallet: swap name/address checks for token identification
Address identification must have a priority, another token can have this
address in its name, but when there is a hash specified we should take the one
with proper hash.
2020-12-14 15:24:15 +03:00
Roman Khimov
8e2df8902c cli/wallet: don't mangle token symbol in output
It's important to show it as is because it identifies token.
2020-12-14 15:24:15 +03:00
Evgenii Stratonikov
56b23b718d fixedn: allow to parse big decimals 2020-12-09 11:19:25 +03:00
Evgenii Stratonikov
e4c3339c91 util: move Fixed8 to encoding/fixedn package 2020-12-09 11:18:18 +03:00
Evgenii Stratonikov
8be9158e2f cli: remove explicit client.Init() calls
This is done inside `GetRPCClient()`.
2020-12-03 17:57:18 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Renamed from cli/wallet/nep5.go (Browse further)