Commit graph

97 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
Evgeniy Stratonikov
0431e26659 wallet: export SavePretty method
Client code can make use of it, see nspcc-dev/neofs-node#1498.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-06-09 09:47:18 +03:00
Elizaveta Chichindaeva
28908aa3cf [#2442] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Anna Shaleva
2096ad6e81 *: remove io/ioutil uses
Close #1764.
2022-03-17 19:39:18 +03:00
Roman Khimov
33e37e60e5
Merge pull request #2264 from nspcc-dev/fix-win-tests
*: Windows compatibility fixes
2021-11-29 11:25:35 +03:00
AnnaShaleva
aefb6f9fee *: fix tests failing due to path.Join usage
Solution:
Use `file/filepath` package to construct expected path. This package is OS-aware, see https://github.com/golang/go/issues/30616.
2021-11-29 11:11:09 +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
cb5b075e7d wallet: do not store file handle
Close immediately after read/write. This can be a bit slower but
we store everything in memory anyway and code size is smaller.
`wallet.Close()` method is now a no-op.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-06 15:29:52 +03:00
Evgeniy Stratonikov
7b6203d0d4 wallet: allow to open in read-only mode, fix #2182
If wallet was opened via `NewWalletFromFile`, open it as read-only first
and re-open for write if needed.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-05 16:25:50 +03:00
Roman Khimov
6d074a96e9 *: make tests use TempDir(), fix #1319
Simplify things, drop TempFile at the same time (refs. #1764)
2021-08-26 17:29:40 +03:00
Evgeniy Stratonikov
283173bb9d wallet: use named constants in Seek
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-29 17:11:50 +03:00
Evgeniy Stratonikov
a429aa3e68 wallet: truncate file when writing
If wallet size decreases, we need to remove trailing garbage if it
exists. This can happen when removing account or reading pretty-printed
wallet. It doesn't affect our CLI (we decode only file prefix), but
it is nice to always have a valid JSON file.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-29 17:11:49 +03:00
Evgeniy Stratonikov
8f196c8222 wallet: marshal before writing to file
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-29 16:07:36 +03:00
Anna Shaleva
472a44a464 *: regenerate test wallets with resources-friendly scrypt parameters 2021-06-11 15:22:32 +03:00
Anna Shaleva
50296975e2 crypto: allow to provide non-default scrypt parameters 2021-06-11 15:22:28 +03:00
Evgeniy Stratonikov
ea49c6b637 wallet: rename isdefault to isDefault
Follow neo-project/neo#2451 .
2021-05-14 10:31:31 +03:00
Roman Khimov
9d2712573f *: enable godot linter and fix all its warnings
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Roman Khimov
cfc067dd24 *: remove dead code
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +03:00
Anna Shaleva
6d59689d9c core: rename Neo.Crypto.CheckMultisig interop 2021-05-11 18:38:14 +03:00
Anna Shaleva
366e79b9b8 core: rename Neo.Crypto.CheckSig interop 2021-05-11 18:37:55 +03:00
Anna Shaleva
af16c3e009 wallet: add test to regenerate testwallet_NEO3.json 2021-05-11 18:36:30 +03:00
Anna Shaleva
5071173dfd wallet: add test to regenerate CLI testwallet 2021-05-11 18:36:30 +03:00
Anna Shaleva
5017f2d2e6 wallet: add test to regenerate examples wallet 2021-05-11 18:36:30 +03:00
Anna Shaleva
68d0249c50 wallet: refactor regenerate test
Move common code to a separate function.
2021-05-11 18:36:30 +03:00
Anna Shaleva
14189c50aa wallet: add test to regenerate Oracle testwallets 2021-05-11 18:36:30 +03:00
Anna Shaleva
56a616f21c wallet: add test to regenerate Notary testwallets 2021-05-11 18:36:30 +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
eaf45d243b wallet: allow to sign with encrypted contract-based accounts 2021-04-20 14:53:51 +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
Anna Shaleva
0948d53244 examples: add documentation
And provide the wallet for examples `my_wallet.json` with the owner
address inside.
2021-03-23 16:46:15 +03:00
Anna Shaleva
9015e50847 core: refactor Neo.Crypto.CheckMultisigWithECDsaSecpr1
Rename it to Neo.Crypto.CheckMultisig and remove `message` parameter.
2021-03-10 21:46:05 +03:00
Anna Shaleva
cdaca7be3e core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +03:00
Anna Shaleva
2c81fc8b8e *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
Anna Shaleva
59ad0e5e04 wallet: export GetVerificationScript method
We need it to construct witness for P2PNotaryRequest.
2021-02-11 17:11:36 +03:00
Evgenii Stratonikov
cd5219086a wallet: export NewAccountFromPrivateKey()
Don't perform back-and-forth conversion, don't handle error
which never occur.
2020-12-04 12:45:53 +03:00
Roman Khimov
1cf1fe5d74 *: introduce stable contract hashes
Follow neo-project/neo#2044.
2020-11-27 21:47:08 +03:00
Evgenii Stratonikov
7d91a3a89e pkg: move internal/ package to the root directory
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
40a24bad64 cli: add tests for wallet import-deployed
Fix bugs with import, allow to sign tx with contract.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
2699508914 wallet: emit proper multisignature
In case when a signature needs to be added to multisig
we must first find corresponding signer, not append new witness.
2020-08-18 11:24:48 +03:00
Roman Khimov
f46ed798f0
Merge pull request #1169 from nspcc-dev/neo3/rpc/fields_names_adjustment
rpc: adjust RPC calls JSON fields
2020-07-15 18:24:54 +03:00
Anna Shaleva
e9f4693e18 wallet: adjust isDefault field name
Part of #1130
2020-07-15 14:45:57 +03:00
Anna Shaleva
5326fc587a core: rename Neo.Crypto.CheckMultisig to Neo.Crypto.CheckMultisigWithECDsaSecp256r1
Part of #918
2020-07-14 16:19:12 +03:00
Anna Shaleva
17233e1d8e core: rename Neo.Crypto.Verify to Neo.Crypto.VerifyWithECDsaSecp256r1
Part of #918
2020-07-14 16:19:12 +03:00
Evgenii Stratonikov
0b67d80bb1 wallet: marshal script in base64
Related #1015.
2020-07-02 11:43:53 +03:00
Anna Shaleva
6b8957243a *: move wallet config from wallet to config package
In order to avoid dependency cycle at the next commits:

	imports github.com/nspcc-dev/neo-go/pkg/config
	imports github.com/nspcc-dev/neo-go/pkg/wallet
	imports github.com/nspcc-dev/neo-go/pkg/vm
	imports github.com/nspcc-dev/neo-go/pkg/smartcontract/nef
	imports github.com/nspcc-dev/neo-go/pkg/config
2020-06-29 09:15:29 +03:00
Evgenii Stratonikov
7b4ca57e33 *: change address to the new format
NEO3 uses new prefix for address (53 = 0x35), thus string representations as
well as encrypted WIFs should be changed.
2020-06-17 15:58:21 +03:00
Roman Khimov
f2033b5e54 wallet: check for t.GetSignedPart() result correctness
It can return nil easily and signing that is a big mistake.
2020-05-24 23:53:38 +03:00
Evgenii Stratonikov
f9f3192b48 vm: move RET and SYSCALL opcodes 2020-05-07 13:23:05 +03:00
Evgenii Stratonikov
008e6eb233 vm: implement new PUSH opcodes 2020-04-23 10:52:28 +03:00