Commit Graph

61 Commits

Author SHA1 Message Date
Ivan Belyakov 3983114ae5 test(wallet)_: add unit tests for balance fetcher
replace types with interfaces where necessary to allow mocking
implement fake eth scanner and erc20 contracts
2024-07-04 09:29:49 +02:00
Ivan Belyakov d180e19fa8 test(wallet)_: moved all balance related code from token.Manager to
balance_fetcher.BalanceFetcher

Split methods into smaller ones for testability
2024-07-04 09:29:49 +02:00
Mykhailo Prakhov 2cabec66cc
fix(premissions)_: convert balance from GetCachedBalancesByChain (#5415) 2024-06-25 10:14:40 +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
Godfrain Jacques 892fcffce4
chore(communities)_: make member use wallet tokens during permission checking (#5268)
fixes #14913
2024-06-11 14:00:04 -07: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
Michal Iskierko 574450289c feat_: Move community tokens transaction listening to status-go
Use EventWatcher to catch wallet events.
Handling all community tokens wallet events in communitytokens service (database and messenger operations).
Adding new signal to nim: CommunityTokenTransactionSignal, which is emitted everytime when the event is received.

Issue #4351
2024-05-16 16:18:15 +02:00
Sale Djenic 7b09ee073d feat: swap via paraswap 2024-04-08 10:14:48 +02:00
Ivan Belyakov c21e6430a2 fix(wallet): cleanup token_balances table on account removed
Updates #4937
2024-03-27 14:54:30 +01:00
Cuteivist 2aa306ef4c
fix: Pass additional data when community token is received (#4954) 2024-03-25 18:30:59 +01:00
Cuteivist 6c792a0e73
feat: Pass 1 day balance change (#4858) 2024-03-08 13:52:39 +01:00
Cuteivist a866b8025e
feat: Community token received notification (#4682) 2024-02-19 14:55:38 +01:00
Anthony Laibe 9c131edfaa feat: token list updated at global 2024-02-02 11:30:42 +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
Cuteivist 846a4e2363
feat: Community token received notification (#4515) 2024-01-04 13:22:06 +01:00
Cuteivist dac7a0daf9
feat: Fetch community data for tokens (#4497) 2023-12-22 10:43:19 +01:00
Cuteivist 6bfe626558
feat: Use media server for community token images (#4493) 2023-12-21 16:05:29 +01:00
Cuteivist 313375e215
feat: Save previously owned tokens (#4482) 2023-12-21 15:12:50 +01:00
Cuteivist 7af313cd53
feat: Add community manager and fetch cached community metadata (#4450) 2023-12-14 17:50:46 +01:00
Cuteivist dfe6baed9b
feat: Fetch community token image (#4440) 2023-12-12 08:37:57 +01:00
Dario Gabriel Lipicar c88ab45d76 fix: pass context in FindOrCreateTokenByAddress 2023-11-17 16:17:50 -03:00
Anthony Laibe 5381ec4a76 feat: add token list 2023-11-15 09:02:36 +01:00
Cuteivist 05530f57bd
feat: Return only community tokens (#4249) 2023-11-03 13:08:32 +01:00
Cuteivist f57c6a26b5
fix: Correct skip check statement (#4248) 2023-11-02 09:11:48 +01:00
Cuteivist debf3b6e4d
feat: Added ERC20 community id (#4189) 2023-10-25 18:49:18 +02:00
Anthony Laibe 39676c8c01 feat: add sepolia toggle 2023-10-09 12:55:29 +02:00
Anthony Laibe 305b520994 fix: token balance 2023-10-06 11:47:23 +02:00
Roman Volosovskyi 382fcde74e
Scanning of ERC20 tail of transfers history 2023-10-01 10:09:11 +02:00
Dario Gabriel Lipicar 8d1992d2e1 fix: protect token list with a mutex 2023-09-13 08:43:09 -03:00
Anthony Laibe 22fc83de59 feat: create unknown erc20 2023-09-07 10:04:58 +02:00
Stefan c0f32748b4 feat(wallet) lazy load activity info optimization
Trigger async fetching of extra information on each activity filtering
request. Only emit the update event for incomplete entries.

Other changes:

- Make DataEntry light as event payload by making all the fields
  optional
- Add new required fields to the activity DataEntry
- Add collectibles.ManagerInterface to aid testing

Note: this PR keeps compatibility with current master by always
providing non-optional multi-transaction ID. The TODO will be executed
before merging the status-desktop PR.

Experienced a hang on FetchAssetsByCollectibleUniqueID call with:
[{{5 0x21263a042aFE4bAE34F08Bb318056C181bD96D3b} 1209},
{{5 0x9A95631794a42d30C47f214fBe02A72585df35e1} 237},
{{5 0x9A95631794a42d30C47f214fBe02A72585df35e1} 236},
{{5 0x9A95631794a42d30C47f214fBe02A72585df35e1} 832},
{{5 0x9A95631794a42d30C47f214fBe02A72585df35e1} 830},
{{5 0x9A95631794a42d30C47f214fBe02A72585df35e1} 853}]

Updates status-desktop #11597
2023-09-01 19:11:14 +02:00
Andrea Maria Piana 4fba5647d1
Use NewContractMaker for messenger 2023-08-29 14:17:49 +01:00
Anthony Laibe 9d782edb4d feat: wallet custom token with communities 2023-08-22 12:41:35 +02:00
Cuteivist 84bfdf4aab
feat: Add contract deployment tx type (#3770) 2023-07-20 16:04:30 +02:00
Stefan 8e63f44735 feat(wallet) filter activity by erc20
Main changes:

- Refactor activity API to propagate token identities.
- Extend service to convert token identities to symbols for filtering
  multi-transaction
- Filter transfers, pending_transactions and multi-transactions based
  on the provided token identities
- Return involved token identities in activity API
- Test token filtering

Also:

- Fixed calling cancel on a filer activity completed task to release
  resources

Notes:

- Found limitations with the token identity which complicates things
  by not allowing to filter by token groups (like token-code does)

Updates status-desktop #11025
2023-06-20 14:06:49 +02:00
Anthony Laibe 2375b10b03 feat: load token list in code 2023-06-16 09:00:06 +01:00
Dario Gabriel Lipicar 7557f0c799 feat(Wallet): add function to get erc20 token by contract address
Part of #10251
2023-06-05 12:08:18 -03:00
Anthony Laibe 645cd5d03b feat: return only enabled networks from the reader 2023-05-29 08:37:08 +02:00
IvanBelyakoff 2dc6700e38
chore(wallet): fix annoying error on missing argument while logging (#3532)
error on token fetch from store
2023-05-26 11:41:33 +03:00
Andrea Maria Piana 6acb34bab7 Allow setting up wallet with new config
This commit does a few things:

1) Extend create/import account endpoint to get wallet config, some of
   which has been moved to the backend
2) Set up a loop for retrieving balances every 10 minutes, caching the
   balances
3) Return information about which checks are not passing when trying to
   join a token gated community
4) Add tests to the token gated communities
5) Fixes an issue with addresses not matching when checking for
   permissions

The move to the wallet as a background task is not yet complete, I need
to publish a signal, and most likely I will disable it before merging
for now, as it's currently not used by desktop/mobile, but the PR was
  getting to big
2023-05-19 13:23:21 +01:00
Anthony Laibe 722390c784 fix: reponse may contains less results than expected 2023-05-03 08:38:29 +02:00
Anthony Laibe 0c8ce79941 feat: returns tokens even when error 2023-03-31 19:22:53 +02:00
Anthony Laibe e92049b9ca fix: wallet token return on no network 2023-03-31 19:22:53 +02:00
Anthony Laibe 2baa8e8ead feat: filter token by valid chain ID 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 62220cedee feat: update chunk limit for token 2023-03-31 19:22:53 +02:00
Anthony Laibe 60dbc5d44d feat: config optimisation 2023-03-28 15:11:35 +02:00
IvanBelyakoff 612efb9b89
fix(Wallet): Fix uninitialized token map accessed (#3289) 2023-03-15 18:10:36 +03:00
IvanBelyakoff 804b5b43b4
feat(Wallet): implement token list from Uniswap (#3273)
Fixes #8807
2023-03-14 20:33:05 +03:00
Anthony Laibe 60e1978bb5 feat: fallback rpc endpoint 2023-02-28 08:43:57 +01:00