Closes: #279.
Adds contracts that can be used with `nim-web3` as part of the effort to enable `nim-status` to support stickers.
Adds support for any ERC-20 token contract that has been added in to nim-status.
Adds SNT, Stickers, StickerMarket, and StickerPacks contract for use with stickers.
Adds integration tests to verify they are working.
1. the added integration tests currently rely on the default current network, which is mainnet, and uses infura to make some real calls which may not be ideal. There could possibly be more work to make these unit testable, however part of the exercise was to show consumers how the public API could be used.
2. This PR bumps `nim-web3` to a forked branch that adds better support for `Bool` to `nim-web3` (https://github.com/status-im/nim-web3/pull/39). If that PR is merged, `nim-status` will need to point back to the original `nim-web3` repo.
3. This PR introduces a lenghty export statement in `status/private/contracts.nim` because `nim-web3` does not export generated contracts and procs. There is an open PR (https://github.com/status-im/nim-web3/pull/40) that addresses this. If this PR is merged, we can remove the lengthy export statement.
Previous usage of nim-waku code in the example client was implemented in the
example client itself. Move that code and logic inside the library so that
nim-waku is an integral part of nim-status.
Closes#286.
Closes#272.
Closes#258.
Closes#241.
We're already checking `chat = FALSE` in `getWalletAccounts` (plural), and we
should do the same in `getWalletAccount` (singular).
This allows `getWalletAccount` to retrieve the address for the default created
account, a.k.a. `Status account`. That address should be usable with e.g. the
`/sendtransaction` command.
Also, in SQL statements (and some comments) switch from 0/1 to FALSE/TRUE for
boolean columns.
Closes#289.
Closes: #239
Remove all `except Exception as e` where possible. In some instances, transitive dependencies out of our control were the source of this error. Even in instances of the Nim library, like `parseJson`, for example, force us to `except Exception` to prevent it from bubbling up to higher layers in the abstraction.
At the lowest levels, we are catching all errors that inherit from `CatchableError` and translating them to be useful for layers above. At the highest level, which is our public API layer, meant to be directly consumed by consumer clients, we are catching all catchable exceptions from the layers below and translating them in to a Result type.
There's one remaining import of a non-api (private) module in
`examples/client/client/tasks.nim`:
```
../../status/private/protocol
```
That one will be removed in a forthcoming PR that moves import/usage of
nim-waku from the example client to the nim-status library itself.
Change the name from `status/client.nim` to `status/api.nim`.
Break up `api.nim` in to modules, and put the modules in to the `status/api` directory.
Update the tests.
Note: on mac keyboards the delete key is backspace and on mac laptop keyboards
fn+delete is delete ("forward delete"). Some mac keyboards have a separate key,
also named delete, for performing forward deletion.
`status/waku.nim` is an older module that provided just enough waku v2
integration to allow for a test.
This commit modifies it re: the recent nim-waku refactor efforts so that it and
the test for it works correctly.
The module will soon be overhauled by moving the example client's waku
logic (with some adaptations) into `status/waku.nim`.
The example client we're building is more than a "chat" program: it
has (beginnings of) support for wallets and eventually the full range of
capabilities implemented in nim-status.
Rename `examples/chat.nim` to `examples/client.nim` and make a number of
related changes/renamings that help to make it more clear that the example
client is a "client in general", not just a chat client.
Also, put the copied example waku chat2 code under `examples/waku/`.
The name of the repo is not being changed. But instead of doing:
```nim
import nim_status
```
You would do:
```nim
import status
```
This is in line with nim-chronos (`import chronos`), nim-waku (`import waku`),
and many other Nim libs.
Copy protobuf specs from status-go, make necessary adjustments for use via
nim-protobuf-serialization. Many thanks to @richard-ramos for his help with
this aspect and others!
Implement "first steps" towards encoding and decoding Status payloads when
sending and receiving messages.
That consists of using an incomplete
`ProtocolMessage(ApplicationMetadataMessage(ChatMessage)))` wrapping of
messages, assuming all messages currently being sent correspond to public
chats. It's incomplete because there are many fields for which values are not
being derived, and there is no encryption performed.
A series of future pull requests will fill in the missing pieces and expand our
usage of the protobuf specs, i.e. allow nim-status to send and receive more
kinds of Status messages.
Note that the waku v2 content topics are not yet using a hash of the
user-supplied topic name; that will also be addressed in a future pull request.
It's also important to note that a refactor is pending re: moving the import
and usage of nim-waku inside the `nim_status` library, as well refactorings re:
exception handling, imports and exports, and other aspects that have been
commented upon in other recent pull requests. This commit builds on the work
done to date in the same way as before, but there is already awareness of what
should be changed and can be improved.
Ensure that joined waku v2 content topics (whether joined in the TUI or
specified on the command-line) conform to the recommendations in
[23/WAKU2-TOPICS](https://rfc.vac.dev/spec/23/).
Unrelated to the main focus of this commit: use a fixed-length array instead of
a sequence for collecting bytes of user input (keyboard and mouse) in the
`input` worker thread. It's more efficient to do it that way: less allocation
and garbage collection.
---
Closes#217.
Closes: #224.
Allows a user to import a wallet account via 12-word mnemonic seed.
The account is first imported in the account generator. Then a wallet account is derived at the root wallet path (m/44'/60’/0’/0/0) from the master key of the mnemonic. This account is then stored in the Accounts table of the user’s db.
Add funcs to support importing a wallet account via private key.
Support password validation before importing the keystore file. Prevent duplicate keystore files from being imported.
Add keystore file unit tests for storing and loading of key files
Add import wallet pk command to example chat client
Refactor web3_conversions imports to insteaad import `nim_status/conversions`.
Closes: #214, #215.
Almost all the work for #197 is included in this PR.
Generate a new wallet account using `/add`, `/addaccount`
feat: create settings when creating/importing a login account
When creating or importing a new account (a login account, not a wallet account), settings are now created.
feat: list wallet accounts
Wallet accounts can be listed using `/wallets`, `/listwalletaccounts`, and `/listwallets`. This gets all accounts in the user db that are not chat accounts. It would be much better to store all wallet accounts in the db using the `wallet` flag, however status-go did not do this, reserving that flag for the root wallet account and creating a unique db constraint on that column.