Roman Khimov
a30792dbb6
*: use slices.Index/slices.Contains where appropriate
...
This doesn't touch performance-sensitive parts, but simplifies a lot of code.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Ekaterina Pavlova
d4a3c912fb
cli: fix errors format
...
Error string should not be capitalized or end with punctuation mark.
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-07-12 12:35:10 +03:00
Ekaterina Pavlova
39559b90e2
cli: add Required field for flags
...
Close #2861
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-07-12 11:58:12 +03:00
Ekaterina Pavlova
acde7bd0de
cli: upgrade urfave lib to v2
...
Close #3097
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-07-12 11:58:12 +03:00
Ekaterina Pavlova
2f5c26f14b
cli: use capital letter for Usage
...
To unified cli help only capital letter is used in Usage field.
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-07-12 11:58:12 +03:00
Ekaterina Pavlova
b4fdf8c3c9
wallet: do not store deployed contract script inside Contract
account
...
`Contract` account field should not contain deployed contract script.
Close #3348
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-05 15:27:20 +03:00
Ekaterina Pavlova
700a550973
cli: improve wallet unmarshalling error
...
Made errors more user-friendly.
```
./bin/neo-go wallet import --wif qweqweqweqwe -w wallet1.json
failed to read wallet: open wallet: open wallet.json: no such file or
directory
touch wallet.json
./bin/neo-go wallet import --wif qweqweqweqwe -w wallet.json
failed to read wallet: unmarshal wallet: EOF
```
Close #3134
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-04-04 13:46:54 +03:00
Ekaterina Pavlova
57aa05add3
wallet: make --wif optional in import-multisig command
...
We have a full list of public keys in the import-multisig command, so if
we have a key in the wallet that corresponds to one of these keys
(simple sig), just reuse it for the account automatically
Closes #3266
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-01-26 18:36:29 +03:00
Ekaterina Pavlova
0ffa24932b
cli: add await flag for operations with transactions
...
New --await flag is an option to synchronize on transaction execution
for CLI commands.
Closes #3244
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2023-12-29 15:14:16 +03:00
Ekaterina Pavlova
d7cab3b82c
cli: move wallet-related flags handling to options package
...
Move GetAccFromContext, GetUnlockedAccount, ReadWalletConfig handling
into options package to reuse this code from all CLI handlers.
getDecryptedAccount is replaced by GetUnlockedAccount.
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2023-12-06 10:49:50 +03:00
Anna Shaleva
7e709313d3
cli: ask for NEP2 account label if not provided
...
If NEP2 account label is not provided as a flag for import-related
CLI commands then ask it in the interactive mode.
This change breaks the compatibility with the old behaviour (add
the unnamed account if the name wasn't specified).
2023-01-26 08:50:06 +03:00
Anna Shaleva
b77c2846ee
cli: allow to request NEP2 password from input
...
In case if wrong password was provided via config file we allow the
user to provide the password manually.
2023-01-25 14:20:59 +03:00
Anna Shaleva
1ef39a6e30
cli: properly handle --name and password-related wallet commands
...
Fetch account's name from the CLI argument and do not ask for the
user's input if provided, close #2882 . Fetch password from config
if provided, close #2883 .
2023-01-25 14:20:56 +03:00
Anna Shaleva
82221b0ca7
*: fix Neo and NeoGo misuses
2022-12-07 17:29:09 +03:00
Roman Khimov
b1723f1a79
cli/wallet: improve wallet flag help text, fix #2820
2022-12-06 20:54:01 +03:00
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
5200765dab
cli/wallet: add out/force flags to claim/candidate cmds
...
Fixes #2669 .
2022-10-06 22:19:40 +03:00
Roman Khimov
5bafa5f6b4
cli/wallet: add sysgas option to candidate and claim commands
...
It doesn't make a lot of sense, but hey, it's a transaction, it can have a bit
more GAS.
2022-10-06 22:09:32 +03:00
Roman Khimov
1ea06e9757
cli/wallet: unify claim and candidate code
...
Add -g option to claim which doesn't have a lot of sense, but can be used
anyway.
2022-10-06 21:52:40 +03:00
Roman Khimov
4f3ffe7290
golangci: enable errorlint and fix everything it found
2022-09-02 18:36:23 +03:00
Roman Khimov
58dc8d0c9b
*: always close the wallet after use
...
Fix #2631 .
2022-09-02 14:44:32 +03:00
Roman Khimov
cbc2299295
cli/wallet: add warning for dump and export commands
2022-09-02 14:44:18 +03:00
Roman Khimov
2e6bd51727
cli/wallet: add strip-keys command
...
To strip keys from wallets.
2022-09-01 15:30:34 +03:00
Roman Khimov
c2c10c111c
cli/wallet: process non-out non-rpc calls to sign
...
And document the behavior better. Fixes #2664 .
2022-09-01 15:30:33 +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
be74cc6b55
cli: use nep17 wrapper to implement commands
2022-08-12 18:21:02 +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
28e2010cbd
cli: add UsageText to commands that were missing it
...
Makes --help a bit more useful.
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
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
Anna Shaleva
79f377d0f0
cli: ensure wallet is non-empty while changing password
...
Close #2429 .
2022-04-29 18:42:42 +03:00
Anna Shaleva
19e4c679d3
cli: unify password-related prompts
...
Close #2419 .
2022-04-29 18:35:26 +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
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
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
Anna Shaleva
50296975e2
crypto: allow to provide non-default scrypt parameters
2021-06-11 15:22:28 +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
Anna Shaleva
a61a3d5ceb
cli: add nep11 import
command
2021-04-30 16:23:06 +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
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
Anna Shaleva
6af2f3fdec
cli: use AddressFlag for 'wallet remove' command
2021-04-21 15:51:13 +03:00