Commit Graph

75 Commits

Author SHA1 Message Date
Ivan Belyakov 43c9860491 fix(wallet)_: fix rpc limiter to reset counters on timeout
fix rpc limiter to delete limits on account removal
fix rpc limiter to not overwrite existing account limit on startup
fix providers down banner on limit reached error
2024-06-20 16:48:28 +02:00
Ivan Belyakov bd816f1e29 chore(wallet)_: tests for wallet.Reader fetching balances
chore(wallet)_: split getWalletTokenBalances into multiple functions

Removed some unused balances methods from wallet API

chore(wallet)_: refactored FetchOrGetWalletTokenBalances

- getWalletTokenBalances only returns cached ones
- update of balances is done in a separate method

chore(wallet)_: fix isVisible in getWalletTokenBalances is overwritten

It is overwritten and in some cases its value is desrespected

chore(wallet)_: simplify getWalletTokenBalance even further

chore(wallet)_: remove accountsDB from wallet.Reader

Call GetTestNetworkEnabled from NetworkManager instead

chore(wallet)_: remove rpc.Client from wallet.Reader.

Added GetActiveNetworks() method for NetworkManager
Removed adding native tokens from networks, as this is done already
in NetworkManager

chore(wallet)_: moved Persistence to token package

As it works with token_balances table, moved Persistence to token package.
Fixed TokenManager's Mark/Get previously owned tokens to use persistence
storage instead of direct SQL calls.
Introduced StorageToken that aggregates Token type, because when
Persistence moved to token package, names clash

test(wallet)_: tests for wallet.Reader.FetchorGetCachedBalances
2024-06-19 16:57:50 +01:00
Ivan Belyakov 4e51b5ba24 feat(wallet)_: more fixes for rpc_limiter_db and chain client, more
tests
2024-05-28 13:44:40 +02:00
Ivan Belyakov cec11e9313 feat(wallet)_: Fixed account limit period for history to infinite instead of per day
Fix rpc stats doubling.
Add test for infinite limit
2024-05-28 13:44:40 +02:00
Ivan Belyakov ce773b69ce feat(wallet)_: fixed lint issues. Fixed rpc stats to include tagged
requests
2024-05-28 13:44:40 +02:00
Ivan Belyakov 725fef8f24 feat(wallet)_: implemented storing RPC requests in sql table
Fixed some tests and minor issues
2024-05-28 13:44:40 +02:00
Ivan Belyakov cdf80b5300 feat(wallet)_: added group tag for RPC chain client
It is needed to be able to set common limits for chain client
Added a test for group tag limiter
Added a mutex to RPC limiter to change counters atomically
Replaced isConnected with atomic.Bool and made it a pointer to
be shared across client instances
2024-05-28 13:44:40 +02:00
Ivan Belyakov bf7aabfa3e feat(wallet)_: renamed some methods for clarity 2024-05-28 13:44:40 +02:00
Ivan Belyakov 9fe87657d6 feat(wallet)_: added and fixed tests for findBlocksCommand with limiter. 2024-05-28 13:44:40 +02:00
Ivan Belyakov 78f05f60b2 feat(wallet)_: add limiter to rpc.client
Add tests for limiter
Use limiter for transfer history commands
2024-05-28 13:44:40 +02:00
Ivan Belyakov 4a1f751ced feat(wallet)_: Implemented RPC limiter interface
Split ClientInterface to aggregation of multiple interfaces
Added tags to RPC stats API
Use tagged RPC client for transfers commands
Implemented general interface for RPC limiting
2024-05-28 13:44:40 +02:00
Ivan Belyakov c0e922f0af fix(wallet)_: fix crash on nil db for statusd if wallet is enabled
Fixed some other issues with prevented startup of statusd:
- ensure paths for DBs are created
- ensure DBs are opened before calling `StartNode`
- ignore error if multiacc database is not available

Updates #14693
2024-05-15 10:19:25 +02:00
Sale Djenic dcc93dee96 fix_: handling throughput limit error from providers 2024-05-12 14:15:02 +02:00
Igor Sirotin 295685c1fe
fix_: skip tests using infura (#5086) 2024-04-24 16:41:42 +02:00
Anthony Laibe 6e44165b51 fix: sepolia balance 2024-03-07 13:11:51 +01:00
Ivan Belyakov 34f1d26371 feat(wallet): replace RPC client's makeCallReturnSingle, makeCallReturnDouble,
makeCallNoReturn functions with a single makeCall function
2024-03-07 07:43:18 +01:00
Anthony Laibe 004bd4e79a fix: gas estimation error cause network error 2024-03-05 13:56:26 +01:00
Sale Djenic bb3006d747 feat: rpc request limiter 2024-02-29 08:26:10 +01:00
Anthony Laibe 972a4f9df9 feat: sepolia default 2024-02-23 11:26:31 +01:00
Michał Iskierko ba7faea027
fix: Use correct chains when checking permissions: mainnet or testnet (#4793)
Fix #18896
2024-02-22 10:17:35 -05:00
Anthony Laibe 0856efff6f fix: resolve first tx of block
This is a workaround when fetching unknown tx without receiver
2024-02-21 13:28:26 +01:00
Anthony Laibe 0808b780f7 feat: add sepolia optimism 2024-01-30 08:57:06 +01:00
Roman Volosovskyi 9c0526f7d9
[#4202] Detect balance and erc20 transfers by a single contract call (#4508) 2024-01-19 16:57:04 +01:00
Siddarth Kumar 926f6a3c72 Revert "test: bump go-libp2p"
This reverts commit d0ca4447c6.
2024-01-18 20:29:33 +00:00
Richard Ramos d0ca4447c6
test: bump go-libp2p 2024-01-18 14:28:06 +00:00
Anthony Laibe 3af8cfc054 fix: allow to update rpc urls
* in all cases update the original urls in case they changed with a new
  api key
* Update current urls only if the current one is the same as the
  previous original one and the original one did change
2024-01-17 09:55:19 +01:00
Sale Djenic 752d1a47f6 fix: networks get updated from a single place now, network.Manager
Runtime networks related env vars are being in use now, updating necessary rpc urls.
2023-11-08 11:31:15 +01:00
Anthony Laibe 21ddaa4b9f feat: arbitrum sepolia 2023-10-17 09:28:13 +02:00
Anthony Laibe 39676c8c01 feat: add sepolia toggle 2023-10-09 12:55:29 +02:00
Roman Volosovskyi 382fcde74e
Scanning of ERC20 tail of transfers history 2023-10-01 10:09:11 +02:00
Anthony Laibe 57c7054dd2 fix: update original url at first login 2023-09-21 09:50:43 +02:00
Roman Volosovskyi 1dca3adb89
Basic test for findBlocksCommand 2023-09-19 13:17:36 +02:00
Anthony Laibe e98952588d feat: original url to networks 2023-09-18 11:30:37 +02:00
Ivan Belyakov 81b94b7a4e fix(wallet): added ChainID to balance cache, as now it is shared between
services and contains balances for all addresses and chains.
Made rpc chain client return ChainID property on `NetworkID()` method
2023-09-07 15:00:19 +02:00
Stefan 524c21834b fix(wallet) propagate multi-transactions IDs to transfers
Mainly refactor API to have control on pending_transactions operations.
Use the new API to migrate the multi-transaction ID from to transfers
in one SQL transaction.
The refactoring was done to better mirror the purpose of pending_transactions

Also:
- Externalize TransactionManager from WalletService to be used by
  other services
- Extract walletEvent as a dependency for all services that need to
  propagate events
- Batch chain requests
- Remove unused APIs
- Add auto delete option for clients that fire and forget transactions

Updates status-desktop #11754
2023-08-22 18:39:42 +02:00
Ivan Belyakov 2df9df10ab fix(tests): moved test db setup to a common place 't/helpers', created
interface for initializing db, which is implemented for appdatabase and
walletdatabase. TBD for multiaccounts DB.
Unified DB initializion for all tests using helpers and new interface.
Reduced sqlcipher kdf iterations for all tests to 1.
2023-08-18 09:00:56 +02:00
Anthony Laibe 14c61d9768 feat: keep original rpc url 2023-08-17 09:56:30 +02:00
Anthony Laibe 4fd94c2345 fix: concurrent client access 2023-08-09 15:47:23 +02:00
Anthony Laibe 104d9c8ff6
feat: add related chain id to networks (#3697) 2023-07-13 16:03:49 +02:00
Dario Gabriel Lipicar da8e8716b2 fix(wallet): Fix block hash for detected blocks with ETH transfers
Part of #10251
2023-06-05 12:08:18 -03:00
Andrea Maria Piana 7fd9fefdef Add LoginAccount endpoint
This commit adds LoginAccount endpoint.
This makes it consistent with CreateAccount and RestoreAccount as they
use similar config.

The notable difference with the previous endpoint is the API, which is
the same as CreateAccount/RestoreAccount, and the fact that it will
override your networks configuration.

Storing them in the config is now not needed anymore, as that's always
driven from the backend, and we won't allow custom networks in the new
wallet.
2023-06-01 10:05:11 +01:00
Vitaliy Vlasov ddfd0c5b14 Add lc-proxy-wrapper dep 2023-05-24 18:48:16 +03:00
Stefan a6d553c937 fix(wallet) ClientWithFallback handling state errors required by BH
The "not found" and "no contract" expected error is caught and wrapped
by ClientWithFallback. The fetching of balance history of next blocks
is aborted which is not desired.

Fix by not treating the error as a connection error in
ClientWithFallback.
2023-05-02 12:07:06 +02:00
Anthony Laibe c84d6fcc35 feat: remove consecutive 2023-03-31 19:22:53 +02:00
Anthony Laibe cd6d22d1c1 chore: re-enable toggle is connected flag 2023-03-31 19:22:53 +02:00
Anthony Laibe 9c33049b4f chore: update connected on global failure 2023-03-31 19:22:53 +02:00
Anthony Laibe 0c8ce79941 feat: returns tokens even when error 2023-03-31 19:22:53 +02:00
Anthony Laibe c9a8ab13c2 fix: set is connected for chain without fallback 2023-03-31 19:22:53 +02:00
Anthony Laibe ec5449c2bd fix: collectible status event 2023-03-31 19:22:53 +02:00
Anthony Laibe b2ea01c32e feat: add up event 2023-03-31 19:22:53 +02:00