Evgenii Stratonikov
6bdaefcfa4
rpc/client: use CreateTxFromScript
where possible
...
There is substantial overlap between `CreateTxFromScript` and
`SignAndPushInvocationTx`. This commit refactors both of them
to reuse common code.
2020-08-18 11:24:48 +03:00
Roman Khimov
e7d13e6db2
*: fix misspellings found in Go Report Card
2020-08-14 12:16:24 +03:00
Evgenii Stratonikov
78eade24a3
cli/wallet: decrypt account immediately
2020-08-12 16:54:59 +03:00
Evgenii Stratonikov
832ec5eaa0
cli: implement candidate (un)register
2020-08-12 16:54:59 +03:00
Evgenii Stratonikov
88e926fbc3
cli: move wallet vote
to validator vote
2020-08-12 16:54:58 +03:00
Roman Khimov
c3c88a57cd
Merge pull request #1281 from nspcc-dev/drop-go-1.12-and-fix-some-things
...
Drop go 1.12 and fix some things
2020-08-07 13:34:54 +03:00
Roman Khimov
0e2784cd2c
always wrap errors when creating new ones with fmt.Errorf()
...
It doesn't really change anything in most of the cases, but it's a useful
habit anyway.
Fix #350 .
2020-08-07 12:21:52 +03:00
Evgenii Stratonikov
05c24d9401
cli: support voting
...
Closes #1206 .
2020-08-06 20:39:13 +03:00
Evgenii Stratonikov
2dd6ef964e
cli: allow to transfer multiple tokens in multitransfer
...
Like this:
./neogo wallet nep5 multitransfer -w wallet1_solo.json
--from NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK -r http://127.0.0.1:30333
neo:NYqxsNMHxDg3T19APYP27mBZFfauC4zngR:2
neo:NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK:3
gas:NYqxsNMHxDg3T19APYP27mBZFfauC4zngR:2
2020-08-04 10:36:06 +03:00
Evgenii Stratonikov
e013477bc9
rpc,cli: support multitransfer transactions
...
Allow to transfer single asset to multiple recepients
in a single transaction. It is currently a separate command in CLI
and can be merged in future.
2020-07-24 17:01:30 +03:00
Anna Shaleva
c2534b1a0b
rpc: adjust sendrawtransaction
RPC-call
...
It should return tx has instead of boolean.
2020-07-22 08:37:46 +03:00
Anna Shaleva
c3431f4fff
cli: add extra validUntilBlockIncrement to transferNEP5
...
When we export tx to a file, we might need validUntilBlock to be larger
a bit in order to use it in future.
2020-07-07 13:23:01 +03:00
Anna Shaleva
73b630db9b
*: switch from fixed8 to int64
...
Follow C# implementation, we have to marshall JSON Fixed8 fields without
taking into account decimals.
2020-06-29 21:39:27 +03:00
alexvanin
642a221e39
cli: update wallet path argument name in cli context
...
In #1104 wallet path argument has changed from `--path` to `--wallet`
but cli application still getting wallet path with `ctx.String("path")`
instead of `ctx.String("wallet")`.
2020-06-25 18:46:24 +03:00
Evgenii Stratonikov
f66199c99f
cli: hardcode NEO and GAS token info
...
Don't make extra network queries for already known contracts.
2020-06-25 17:21:26 +03:00
Evgenii Stratonikov
b599b395e8
cli: output nep5 token hashes in LE
...
CLI use always operates with little-endian representation.
2020-06-25 17:21:26 +03:00
Evgenii Stratonikov
65cb6dd0ad
cli: change name for wallet path flag
...
`-p` is used for `--privnet`, `-w` is for wallet.
Fix CLI error:
balance flag redefined: p
panic: balance flag redefined: p
2020-06-25 17:21:18 +03:00
Roman Khimov
16ce63e653
cli: unify RPC endpoint flags under options package
...
This makes rpc flags consistent across all commands, previously some commands
used 'endpoint, e' and some 'rpc, r', some had ability to change timeout and
some hadn't. Now 'rpc-endpoint, r' is used everywhere along with 'timeout, t'.
2020-06-18 12:10:59 +03:00
Evgenii Stratonikov
b3b1137030
cli: allow to convert wallet from NEO2 to NEO3 format
...
This command may be helpful to have during transition.
2020-06-17 15:49:34 +03:00
Roman Khimov
709146f295
transaction: drop Inputs and Outputs, forget UTXO
2020-06-05 19:20:16 +03:00
Roman Khimov
0a09a20900
transaction: drop Register transaction type
...
And everything associated like SystemFee configuration.
2020-06-05 19:20:16 +03:00
Roman Khimov
e358c70ecc
cli/wallet: drop classic transfer support
...
We do have 'nep5 transfer' and that's enough for now.
2020-06-05 19:20:16 +03:00
Roman Khimov
c0e044961d
cli/wallet: add ability to save NEP5 transfer transaction
...
It allows to use multisig cli operations for multisig transaction creation and
send.
2020-06-05 19:20:16 +03:00
Roman Khimov
d496cc9687
cli/wallet: switch claim command to claim NEP5 GAS
2020-06-05 19:20:16 +03:00
Roman Khimov
3b2644da4f
rpc/client: pass token as simple hash into TransferNEP5
...
It doesn't need full wallet.Token structure.
2020-06-05 19:20:16 +03:00
Anna Shaleva
7acf5b2841
core: add SystemFee and NetworkFee to transaction
...
closes #831
2020-05-20 23:26:48 +03:00
Anna Shaleva
2b5c14160c
core: add sender field to transaction
...
closes #860
2020-04-20 17:21:28 +03:00
Anna Shaleva
5fa11987d2
core: add validUntilBlock field to transaction
...
1. closes #841
2. Commented out test cases where binary transaction are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.
3. Updated other tests.
4. Added cache to calculateValidUntilBlock() RPC-client method.
2020-04-15 13:46:43 +03:00
Anna Shaleva
65503aa9b4
core: add nonce field to transaction
...
1. Closes #840 : added Nonce field to transaction.Transaction and
removed Nonce field from transaction.MinerTx
2. Added following methods to different tx types:
- NewMinerTx()
- NewMinerTxWithNonce(...)
- NewEnrollmentTx(...)
- NewIssueTx()
- NewPublishTx(...)
- NewRegisterTx(...)
- NewStateTx(...)
in order to avoid code duplication when new transaction is created.
3. Commented out test cases where binary transaction/block are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.
4. Updated other tests
5. Added constant Nonce to GoveringTockenTx, UtilityTokenTx and genesis
block to avoid data variability. Also marked with TODO.
2020-04-14 16:19:41 +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
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
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
Evgenii Stratonikov
2fc6375958
cli: provide separate function for opening wallet
2020-02-21 12:14:53 +03:00
Evgenii Stratonikov
3d67d52537
cli: support account creation in existing wallet
2020-02-21 12:14:53 +03:00
Evgenii Stratonikov
20c98411fd
cli: implement wallet WIF/NEP2 export
...
One positional argument can be provided. If so, it is
interpreted as address and only WIFs corresponding to it
are exported. If address is provided '--decrypt' flag can be
specified to export unencrypted WIFs.
2020-02-21 12:14:52 +03:00
Evgenii Stratonikov
a030411310
cli: implement multisig import to wallet
2020-02-21 12:14:33 +03:00
Evgenii Stratonikov
baa68e1d46
cli: implement wallet WIF import
2020-02-21 11:19:34 +03:00
Evgenii Stratonikov
a71c2c4bfd
cli: move password getting to a separate function
...
Also do not ignore errors from `terminal.ReadPassword`.
2020-02-21 10:45:58 +03:00
Evgenii Stratonikov
02954285c1
cli: declare wallet path flag once
2020-02-20 15:52:07 +03:00
Roman Khimov
aad0d3792d
wallet: implement dump
command
...
Mostly a testing tool for the moment.
2020-01-09 18:40:30 +03:00
Roman Khimov
c8aa061421
cli/wallet: use more secure way to read passwords
...
They were printed in plaintext, believe it or not. Also, `ssh/terminal` does
some proper magic to really read something from the terminal.
2019-12-03 20:04:52 +03:00
Roman Khimov
dafd385f57
cli: extend NewCommand() to NewCommands()
...
So that each module could now return an array of commands. It's gonna be used
in the future to extend them.
2019-10-19 23:58:45 +03:00
Evgeniy Kulikov
67cbcac643
Fix typos ( #133 )
...
* Fix typos
* revert chains/unit_testnet
* revert chains
* fix review comments (thx @AlexVanin )
2019-02-13 18:01:10 +00:00
Evgeniy Kulikov
f000b76879
[FIX] Formatting and code-style ( #118 )
...
* [FIX] Formatting and code-style
- gofmt
- import resort
- prealloc slices
- simplify code
* fix vet
2019-01-25 12:20:35 +01:00
Sathvik Birudavolu
5b57a10250
Fix NEP2Encrypt add Unit Tests ( #108 )
...
* fix NEP2 add unit tests
* version update
2018-12-05 12:30:13 +01:00
Anthony De Meulemeester
f3f6662fc9
Base wallet implementation ( #35 )
...
* Initial draft of the neo-go wallet
* Cleanup + more test for util package
* integrated wallet into neo-cli partially
* base wallet implementation + smartcontract code.
2018-03-02 16:24:09 +01:00