Commit Graph

434 Commits

Author SHA1 Message Date
Ivan Belyakov 20c585a621 fix(wallet): new transfers were not loaded in real time 2023-09-05 14:19:36 +02:00
Ivan Belyakov 24bf9aada5 feat(wallet): move balance cache to a common place and make it a
parameter to share between transfers and balance history in an upcoming
commit.
Had to refactor its interface for that reason.
2023-09-05 12:20:49 +02:00
Cuteivist a0eb205ca9
feat: Estimate block number (#3973) 2023-09-04 12:18:46 +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
Dario Gabriel Lipicar d61677403a feat: add extra collection data to collectible header struct 2023-09-01 11:14:29 -03:00
Stefan 71800a19f1 fix(wallet) fix pending transactions notification
Also, add regression test.
2023-09-01 00:18:26 +02:00
Stefan 9cb5e1d3e6 chore(wallet) move computing totalFees to status-go
Updates status-desktop #11597
2023-08-30 13:59:52 +02:00
Ivan Belyakov c24c3966e2 fix(wallet): balance history used a wrong db for accessing accounts.
Balance history was not checked for all chains if no history on
some chain.
Removed `SetInitialRange` from wallet API as internal implementation.
This method was called on adding a brand new Status account to initialize
blocks_range table to avoid transfers history checks.
2023-08-30 10:17:57 +02:00
Stefan 423991fb30 chore(wallet) lookup symbols for wallet activity filter
Updates status-desktop #11597
2023-08-29 17:25:48 +02:00
Andrea Maria Piana 4fba5647d1
Use NewContractMaker for messenger 2023-08-29 14:17:49 +01:00
Cuteivist dd3e408a4e
feat(wallet/activity): Added API for tx and multiTx details (#3939) 2023-08-24 14:23:40 +02:00
Dario Gabriel Lipicar 8d8bd4fc92 fix: handle opensea v2 api error for accounts holding no collectibles 2023-08-24 08:28:36 +02:00
Dario Gabriel Lipicar c494904f18 fix: use all available providers when fetching collectibles by ID 2023-08-24 08:28:36 +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
Stefan afe0fcdcf4 fix(wallet) fix test on checking order of async task
Updates status-desktop: #11404
2023-08-22 18:39:42 +02:00
Anthony Laibe 9d782edb4d feat: wallet custom token with communities 2023-08-22 12:41:35 +02:00
Dario Gabriel Lipicar ae17ad57c3 fix: change cursor of opensea v2 ownership endpoint 2023-08-18 11:55:39 -03:00
Dario Gabriel Lipicar ad0e2c2450 feat: implement opensea v2 endpoints 2023-08-18 09:59:38 -03:00
Dario Gabriel Lipicar 3734f03645 chore: split collection data provider 2023-08-18 09:59:38 -03:00
Ivan Belyakov ea38b788b3 tests: Added unit test for copying 'keypairs_accounts' table to the wallet db.
Added a unit test for changing app and wallet DBs passwords.
Refactored geth_backend to simplify and allow wallet db password changing.
Fixed opening database with wrong password.
2023-08-18 09:00:56 +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
Ivan Belyakov d106b449b6 feat(wallet): move wallet-related tables to a dedicated db.
The only place where appDB is used in wallet is activity,
which refers to `keycards_accounts` table. So a temporary
table `keycards_accounts` is created in wallet db and updated
before each activity query.
2023-08-18 09:00:56 +02:00
Dario Gabriel Lipicar 25ff1dd758 feat: make collectibles api support multiple clients 2023-08-15 10:17:10 -03:00
Dario Gabriel Lipicar d6aae82566 chore: move multi-client scheduler implementation to separate file 2023-08-15 10:17:10 -03:00
Michal Iskierko 9d0acc2265 feat(OwnerToken): Owner token and master token deployment
Adding new smart contracts and generated go files.
Deploy token owner function and master token address getter.
Adding deployer and privilegesLevel columns to community_tokens table.
Passing addressFrom to API calls.

Issue #11250
2023-08-14 20:57:00 +02:00
Dario Gabriel Lipicar 4b394e088e fix: minor collectible provider fixes 2023-08-09 11:21:59 -03:00
Dario Gabriel Lipicar cd83a5fe00 chore: make use of new collectibles data DB 2023-08-09 11:21:59 -03:00
Dario Gabriel Lipicar 33c116f7b1 chore: implement collectibles data db cache 2023-08-09 11:21:59 -03:00
Dario Gabriel Lipicar e30cba4303 fix: parse collectible ownership response from v3 alchemy endpoint properly
Fixes #11832
2023-08-08 13:20:36 -03:00
Dario Gabriel Lipicar d5974dd52e feat: fetch collection metadata when missing 2023-08-04 09:54:18 -03:00
Cuteivist 1f510eae70
fix: Query token id for transactions (#3851) 2023-08-04 13:40:36 +02:00
Cuteivist 06c4eb5df9
feat: Handle collectible mint (#3852) 2023-08-04 12:47:22 +02:00
Dario Gabriel Lipicar 078f71a235 feat: use new collectible account ownership providers 2023-08-03 12:53:00 -03:00
Dario Gabriel Lipicar c92a10b846 feat: implement alchemy and infura collectible account ownership endpoints 2023-08-03 12:53:00 -03:00
Dario Gabriel Lipicar 51d676bb08 chore: reorganized collectibles clients code 2023-08-03 12:53:00 -03:00
Dario Gabriel Lipicar c2ac108556 chore: rework data structures to accomodate new providers 2023-08-03 12:53:00 -03:00
Anthony Laibe 0cd140c9b2 feat: change network selection strategy
1) Only fetch history for networks that match test mode enabled
* Trade Off: it will be only refetch in 12 hours so changing test mode won't trigger a refetch until app is restarted or 12 hours.
I think it is ok as change test mode is not a common use case
2) Do not consider networks that are enabled or not as this can be change more often than every 12 hours
2023-08-02 12:45:37 +02:00
Anthony Laibe 21d9d17cdc chore: reduce batch size for goerli arbitrum/optimism 2023-08-01 13:37:45 +02:00
Stefan eb8d74e1ae feat(wallet) add request id to activity events
Add and use the optional chainID in the wallet event structure.

Updates status-desktop #11380
2023-07-31 18:22:13 +02:00
Anthony Laibe a139871383 fix: celer check on tokens 2023-07-31 13:16:33 +02:00
Dario Gabriel Lipicar 10a42e639d feat: parallel collectibles fetching per account and chain 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar 57424e076c chore: moved collectibles ownership cache to db 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar 85d8e83394 feat: trigger collectibles fetch on new account 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar 5ba5611a8d feat: implement collectibles service 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar b1cf54974e chore: make opensea client return common types 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar 849be69299 chore: use single opensea client instance 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar f138964a9c chore: move scheduler to async dir 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar b5224b3cc5 chore: rename and reorder types 2023-07-27 12:12:03 -03:00
Stefan d956a3e854 feat(wallet) chain id multi-transaction filtering
Updates status-desktop #11631
2023-07-26 13:54:55 +02:00
Anthony Laibe e5ce2c7c03 feat: make activity check optional 2023-07-26 09:07:55 +02:00
Sale Djenic 6a5cdbaa8b fix: review comments applied
`GetKeypairs(includeRemoved bool)` removed
`GetActiveKeypairs()` added
`GetAllKeypairs()` added

`GetAccounts(includeRemoved bool)` removed
`GetActiveAccounts()` added
`GetAllAccounts()` added
2023-07-25 18:11:05 +02:00
Sale Djenic d5bba5d80f chore: wallet accounts improvements - soft delete 2023-07-25 18:11:05 +02:00
Cuteivist 84bfdf4aab
feat: Add contract deployment tx type (#3770) 2023-07-20 16:04:30 +02:00
Stefan 8926990c2d chore(wallet) retrieve all required activity header data as metadata
Add missing fields to activity metadata.

Updates status-desktop #11173
2023-07-20 11:34:41 +02:00
Dario Gabriel Lipicar 1f379aec1f feat: implemented multi chain collectible ownership provider 2023-07-19 07:58:05 -03:00
Anthony Laibe 0f8347dc59 feat: get chain id for url api 2023-07-18 13:50:13 +02:00
Stefan 64f7706567 chore(wallet) index activity filter columns to speed up queries
Implemented required benchmarks

Also

- refactor tests as needed
- don't filter temporary or incomplete transfers (transfers.loaded != 1)

Updates status-desktop #11351
2023-07-14 16:11:14 +02:00
Stefan e6705f264c chore(wallet) refactor activity tests 2023-07-14 16:11:14 +02:00
Dario Gabriel Lipicar 40eed0fd01 fix: ensure correct initialization order for wallet and mesenger services 2023-07-13 16:16:31 -03:00
Anthony Laibe 104d9c8ff6
feat: add related chain id to networks (#3697) 2023-07-13 16:03:49 +02:00
Stefan 8bfcb80ed6 fix(wallet) fix scan to/from hash when for multi_transactions 2023-07-13 00:24:36 +02:00
Dario Gabriel Lipicar 9ee523be99 fix: remove unsupported chainIDs from opensea client 2023-07-12 15:49:18 -03:00
Stefan 69412cf3a3 fix(wallet) fix scan of default NULL multi_transactions.*_network_id 2023-07-12 10:34:32 +02:00
Anthony Laibe 23492467b9 feat: clear balance cache after usage 2023-07-12 09:23:56 +02:00
Stefan 3ce851b84b feat(wallet) report new multi-transactions updates
Updates status-desktop #11233
2023-07-11 22:34:43 +02:00
Ivan Belyakov 09dff82db5 feat(wallet): Move pending transactions to `transactions` module.
Handle creation and deletion of pending transactions automatically
on status-go side.
2023-07-11 16:07:42 +02:00
Dario Gabriel Lipicar 66a21aa7e4 feat(wallet): detect ETH L2 to L1/L2 bridge transactions 2023-07-10 09:59:05 -03:00
Dario Gabriel Lipicar e6711c8cc8 feat(wallet): detect ETH L1 to L2 bridge transactions 2023-07-10 09:59:05 -03:00
Dario Gabriel Lipicar fb6e2a41f7 chore(wallet): reorganize multitx processing code 2023-07-10 09:59:05 -03:00
Anthony Laibe bc92df79d5 fix: fourbyte integration no arg 2023-07-10 12:26:42 +02:00
Stefan 9a30674590 feat(wallet) deliver pending changed events to clients
Add wallet events feed to TransactionManager and send pending changed
events on add and delete

Also

- Remove hardcoded values in the filter query
- Small improvement to query

Updates status-desktop #11233
2023-07-07 15:06:14 +02:00
Anthony Laibe dffcb708ea feat: add fourbyte github integration 2023-07-06 11:31:14 +02:00
Anthony Laibe b5d5fa828c fix: allow l2 bridges 2023-07-05 13:14:19 +02:00
Stefan 0b9555bf31 fix(wallet) returning wrong address identity in filter
This fixes returning address identity after that was changed by
the real to/from fix. Previously the address was wrongly used as from

Updates status-desktop #11233
2023-07-05 10:36:45 +02:00
Anthony Laibe 1cb1c63e82 fix: bonder fees must be lower than amount 2023-07-04 22:32:51 +02:00
Stefan 3b0f4ee2c1 fix(wallet) fix GetMultiTransactions for to_amount nil
Updates status-desktop #11233
2023-07-04 16:49:08 +02:00
Stefan 293fa9d248 fix(wallet) fix filtering failing with NULL values in to_address
Added test to validate the fix

Also change JOIN to LEFT JOIN between `multi_transactions` and `transactions` table so that we return all entries from `multi_transactions` table even if there is no matching entry in `transactions` table, which might be the case for multi transactions that that could not be detected. This will postpone the error case until we get into details of the multi transaction.

Updates status-desktop #11233
2023-07-04 15:51:33 +02:00
Stefan e5e5229e6a feat(tests) disable 4byte remote server dependent tests 2023-07-03 16:50:48 +02:00
Stefan c61a4000d8 feat(wallet) make remaining filter apis async
Implement activity.Scheduler to serialize and limit the number of
calls on the activity service. This way we protect form inefficient
parallel queries and easy support async and rate limiting based on the
API requirements.

Refactor the activity APIs async and use the Scheduler for managing
the activity service calls configured with one of the two rules: cancel
ignore.

Updates status-desktop #11170
2023-07-03 16:50:48 +02:00
Ivan Belyakov 1efecbf73b Fixed concurrent write to blockchain status map 2023-06-30 14:59:07 +02:00
Ivan Belyakov 2f515447d2 fix(wallet): Fixed missing loop for transfers loading.
Made channel for transfers loading buffered - non-blocking
2023-06-28 16:18:43 +02:00
Dario Gabriel Lipicar ce45a7b1e8 fix: properly initialize NFTMetadataProvider in wallet service 2023-06-28 09:22:40 -03:00
Stefan f07a79cd18 fix(wallet) fix crash if to_address is NULL in transfers
Add nill tests for TestGetRecipients, GetOldestTimestamp
Also fix returning duplicate addresses in TestGetRecipients

Updates status-desktop #11170
2023-06-28 09:55:43 +02:00
Dario Gabriel Lipicar afb9621f01 fix: protect OpenSea instances with a mutex 2023-06-27 11:09:02 -03:00
Stefan ea7a389075 feat(wallet) api to retrieve last activity timestamp
Also fix the lookup source for `GetRecipients` API

Updates status-desktop #11169
2023-06-22 14:06:55 +02:00
Dario Gabriel Lipicar 0f305df3b5 fix: identify ETH asset properly in swap transactions 2023-06-21 12:20:22 -03:00
Dario Gabriel Lipicar bf54a57780 fix: correct transfer type detection 2023-06-21 12:10:25 -03:00
Anthony Laibe 8ef3c52f4d fix: parse input data with bytes 2023-06-21 11:42:40 +01: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
Dario Gabriel Lipicar 60b160997c fix(wallet): properly parse multitransaction amounts 2023-06-16 10:05:49 -03:00
Emil Sawicki ad9ad4026b feat: add signature id 2023-06-16 12:10:22 +01:00
Anthony Laibe 9d5b123c95 feat: add api to parse tx input 2023-06-16 12:10:22 +01:00
Anthony Laibe 2375b10b03 feat: load token list in code 2023-06-16 09:00:06 +01:00
Dario Gabriel Lipicar e26c2a7095 feat: add transaction amounts to activity entry 2023-06-15 22:04:19 -03:00
Dario Gabriel Lipicar 86350379b1 chore: rework activity test utils 2023-06-15 22:04:19 -03:00
Stefan 6f2c338f72 feat(wallet) add filter api to retrieve recipients of a wallet
The new API returns all known recipients of a wallet, by
sourcing transfers, pending_transactions and multi_transactions tables
The API is synchronous. Future work will be to make it async.
In some corner cases, when watching a famous wallet, it can
be that there are too many recipients to be returned in one go. Offset
and limit can be used to paginate through the results.

Updates status-desktop #10025
2023-06-15 20:40:44 -03:00
Dario Gabriel Lipicar a2b1640ad7 fix(wallet): respect limits for collectibles fetching 2023-06-15 16:44:02 -03:00
Michal Iskierko ccde92377d feat(BurnCollectibles): Add burn collectibles functionality
Change smart contract with new API.
Update gas amount for deployment.
Add Burn() and EstimateBurn() functions.
Add RemainingSupply() functions.

Issue #10816
2023-06-15 15:38:19 +02:00
Ivan Belyakov 30af25198e feat(wallet): Improved performance of fetching tranfers for Sequential
fetch strategy:
Before:
 - block fetching commands for different accounts were in the same wait
group, making them dependent on each iteration.
 - transfers loading command was checking database for new unloaded
blocks on timeout and was in the same wait group with block fetching, so
it was often blocked until all block fetching commands finish for
iteration.
Now:
 - block fetching commands run independently for each account
 - transfers fetching command is run once on startup for unloaded blocks
from DB
 - fetch history blocks commands are launched once on startup for
accounts with no full history loaded
 - transfers are loaded on each iteration of block range check
without waiting for all ranges to be checked
2023-06-14 15:12:12 +02:00
Ivan Belyakov 2b02968819 fix(wallet): Fixed nil pointer dereferencing for multiTransaction.ToAmount
when sending tx on Optimism
2023-06-14 07:24:18 -03:00
Dario Gabriel Lipicar ffc959a9e3 chore(wallet): split multitransaction command from full struct
Part of #10791
2023-06-13 07:58:40 -03:00
Stefan 4c8fd538ba feat(wallet) return offset in the activity result
Updates status-desktop #10994
2023-06-12 23:04:12 +02:00
Stefan d8eb038d7d feat(wallet): make filer API async
Refactor the filter interface to be an async call which returns
the result using a wallet event
A call to the filter API will cancel the ongoing filter and receive
an error result event

Closes status-desktop #10994
2023-06-12 15:42:26 +02:00
Stefan 87ce6cfbcd feat(wallet) filter activity by status
Main changes:

- extend DB query include status for transactions and pending_transactions
- extend DB query to aggregate data from complex activity entries
- extend tests to include the new status values

Other changes:

- Improve tests with mocked addresses in DB to have a true to/from state

Update status-desktop #10746
2023-06-10 11:43:00 +02:00
Dario Gabriel Lipicar 4eb3d7485a fix(wallet): handle error when calling ERC721 TokenURI function
Fixes #10959
2023-06-08 10:37:20 -03:00
Stefan 5b6f7226bb feat(wallet) extract json blobs and add custom migration support
Extended the migration process with a generic way of applying custom
migration code on top of the SQL files. The implementation provides
a safer way to run GO code along with the SQL migrations and possibility
of rolling back the changes in case of failure to keep the database
consistent.
This custom GO migration is needed to extract the status from
the JSON blob receipt and store it in transfers table.

Other changes:
- Add NULL DB value tracking to JSONBlob helper
- Index status column on transfers table
- Remove unnecessary panic calls
- Move log_parser to wallet's common package and use to extract token
  identity from the logs

Notes:
- there is already an index on transfers table, sqlite creates one for
  each unique constraint therefore add only status to a new index
- the planned refactoring and improvements to the database have been
  postponed due to time constraints. Got the time to migrate the data
  though, extracting it can be done later for a more efficient
  implementation

Update status-desktop #10746
2023-06-08 13:54:40 +02:00
Dario Gabriel Lipicar d73c886d3b fix(wallet) limit nft description length
Fixes #10923
2023-06-07 15:11:29 -03:00
Ivan Belyakov d74d930b70 feat(wallet): enable sequential transfers fetching by default.
"EventNewTransfers' event is sent on each block processed, otherwise
it could take minutes or longer before first 'EventNewTransfers'
is sent.
2023-06-07 08:45:45 +02:00
Dario Gabriel Lipicar 449314a4dc feat(Wallet) detect uniswapV3 swap events
Part of #10251
2023-06-05 12:08:18 -03:00
Dario Gabriel Lipicar 2fc79fb9b5 feat(Wallet) detect uniswapV2 swap events
Part of #10251
2023-06-05 12:08:18 -03: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
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
Ivan Belyakov ad1b8b6d43 fix(wallet): added `remove` event for accounts. Stop loading
transfers for removed account

Updates #10246
2023-06-05 08:22:08 +02:00
IvanBelyakoff 7adfbb5467
feat(wallet): SequentialFetchStrategy improvements: (#3551)
- reverted a change that stopped looking for ERC20 transfers if no nonce
  and balance change found within a block range for ETH
- implemented sending EventRecentHistoryReady event at a proper time
- moved EventFetchingRecentHistory event to Strategy type as it does not make
sense to send this event in loop
- moved iterating through blocks logic to inside of `loadTransfers` command, which
now accepts a block range.
- reuse `uniqueHeaders` function in commands.go
- clean up

Updates #10246
2023-06-01 16:09:50 +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
IvanBelyakoff dc84afb751
Add new transfers fetching for sequential strategy (#3520)
* chore(wallet): refactor sequential transfers commands

* feat(desktop/wallet): add fetching new blocks and transfers for
transfers SequentialFetchStrategy

Updates #10246
2023-05-26 11:27:48 +03:00
Sale Djenic 03d9af0b95 feat: `AddressExists` endpoint added 2023-05-26 07:12:40 +02:00
Roman Volosovskyi ee4003279a
Changes necessary to restore wallet on mobile app 2023-05-25 21:08:34 +02:00
Sale Djenic 0eca7f5088 fix: issues after rebase fixed 2023-05-25 19:46:47 +02:00
Sale Djenic eeaaf0ce3f feat: accounts improvements applied
- old `accounts` table is moved/mapped to `keypairs` and `keypairs_accounts`
- `keycards` table has foreign key which refers to `keypairs.key_uid`
- `Keypair` introduced as a new type
- api endpoints updated according to this change
2023-05-25 19:46:47 +02:00
Michal Iskierko 1c17fbeacc feat(RemoteBurn): Add remote burn collectibles functionality
* Updating smart contract (new burn function)
* remoteBurn() and estimateRemoteBurn() functions
2023-05-25 13:34:53 +02:00
Stefan e78a73bd9f feat(Wallet) complete the filter API
It uses the current data only and doesn't extend with new types or
include new features in activity sources DBs.

Major changes:
- Partially filter by chain IDs
- Partially filter by Status if it is the case
- Partially filter by token types
- Filter by counterparty addresses
- Use wallet accounts for TO/FROM instead of filters

Closes: #10634
2023-05-23 14:48:29 +02:00
Anthony Laibe 8b05ba6d8b fix: check balance for address details 2023-05-22 09:13:09 +02: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
IvanBelyakoff 17aaaf1dca
fix(desktop/wallet): fix bug in balance_cache - balances and nonces (#3509)
were stored in cache by pointers, which caused falsy cache hits in loop
because pointers with same address were created for different block
numbers. Now cache uses block numbers of uint64 as key, which can
overflow but it is not a problem since we use this cache for values
comparison, not as user data.
Fix crash on nil pointer in log.
Remove some unused code.
Protect nonceRanges with mutex while reading.

Updates #10246
2023-05-19 14:46:54 +03:00
IvanBelyakoff 94c7cd32af
feat(wallet): Implemented SequentialFetchStrategy for transfers. (#3480)
By default OnDemandFetchStategy is still used.

Updates #10246
2023-05-19 11:19:48 +03:00
Stefan c020222f1b feat(Wallet): add activity filter api prototype
Add the possibility of retrieving the metadata of wallet activity based
on the given filter criteria.

Current implementation relies that after fetching the metadata, user
will follow up with more requests for details. However, after some
experimenting I'm considering extracting all required information
for the summary viewing while filtering. This way there will be no
need for another batch requests for transfers, multi-transactions and
pending transactions to show the summary. Only when user wants to see
the details for one will specifically request it.

For this first prototype, the filter criteria is limited to:
- time
- type
- addresses

Major changes:
- Add the filter definition to be used in propagating the filter
  information
- Add GetActivityEntries API to return the list of activity entries
  for the given addresses/chainIDs by a view in the complete list
- GetTransfersForIdentities to batch retrieve further details of the
  transfers
- GetPendingTransactionsForIdentities to batch retrieve further details
  of the pending transactions
- Added a new package testutils for tests.
- Added tests

Updates status-desktop #10366
Closes status-desktop #10633
2023-05-14 23:05:28 +02:00
Stefan c5a8b40d9c fix(wallet) don't delete pending transactions for multi-transaction
This is done in Nim after the watched pending transaction changes state.

Note: tried to delete all transactions, not only multi-transaction,
as soon as the state is downloaded but it didn't work: noticed crashes
with minted transactions after restart.

Updates status-desktop #10474
2023-05-08 11:24:37 +02:00
IvanBelyakoff cb9f2dd7d2
feat(wallet): refactor transfers to allow multiple transfer fetching (#3432)
strategies.

On mobile devices we might not want to load all transfers history
to avoid high internet traffic consumption or to save some space.
On desktop we will load all transfers in background.

- Moved current fetching transfers implementation to
OnDemandFetchStrategy
- Implemented QueuedAtomicGroup to cache outgoing commands above a
threshold
- Refactored some type names, methods for better clarity:
  - LastKnownBlock name was misused
  - Block renamed to BlockDAO to clarify what it does and avoid
confusion with geth Block type
- Cleanup - removed unused parameters and types' members
- Changed tests to use in memory DB for speedup
- Added more logging and comments

Updates #10246
2023-05-08 08:02:00 +02:00
Anthony Laibe 722390c784 fix: reponse may contains less results than expected 2023-05-03 08:38:29 +02: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 dd7c59423f feat: add saved address created at 2023-04-22 10:22:43 +02:00
Dario Gabriel Lipicar 4ef5eba6b5 chore: move chainIDs to constants file 2023-04-19 08:30:10 -03:00
Dario Gabriel Lipicar 633c8d1ed5 chore: clean up passing api keys to the wallet service 2023-04-19 08:30:10 -03:00
Dario Gabriel Lipicar c8f0ceccc8 feat: add api to get list of owners from a given nft contract
Fixes #10290
2023-04-19 08:30:10 -03:00
Michal Iskierko 4e3ba2941c fix(AddTokenOwners): Move AddTokenOwners from MintTo
Issue #10161
2023-04-13 11:43:48 +02:00
Sale Djenic 1754c23763 chore: improvements to `GetWalletToken` function 2023-04-06 19:09:13 +02:00
Dario Gabriel Lipicar ff755a1176 fix: add supported chains to OpenSea 2023-04-06 13:42:38 -03:00
Dario Gabriel Lipicar 5bad40c8be feat: add collectible animation info to data fetched from Opensea 2023-04-03 12:32:32 -03:00
Anthony Laibe c84d6fcc35 feat: remove consecutive 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 540001e137 feat: chunk correctly coinmarketcap calls 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 d86446ad53 chore: adding debug 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 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 62220cedee feat: update chunk limit for token 2023-03-31 19:22:53 +02:00