Commit Graph

84 Commits

Author SHA1 Message Date
Cuteivist bc4093299e
feat: Filter by collectibles (#4028) 2023-09-21 08:58:36 +02:00
Roman Volosovskyi 1dca3adb89
Basic test for findBlocksCommand 2023-09-19 13:17:36 +02:00
Stefan 70341f85a5 fix(wallet) send/receive for duplicate transactions
Brings consistency in case when sender and receiver are both in the
filter address list. This fixes the case of sender and receiver in
addresses and filters out duplicate entries.

Also

- refactor tests to provide support for owners
- adapt TestGetActivityEntriesWithSameTransactionForSenderAndReceiverInDB
  to the use of owner instead of from
2023-09-12 11:58:24 +02:00
Cuteivist e77fc59f5e
feat: Add activity filtering by contract deploy and minting (#4009) 2023-09-11 11:54: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
Anthony Laibe 22fc83de59 feat: create unknown erc20 2023-09-07 10:04:58 +02:00
Stefan 555aae4d0f fix(wallet) filter by sub-transaction chain ID
Closes status-desktop #12077
2023-09-06 21:08:39 +02:00
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
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
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
Cuteivist dd3e408a4e
feat(wallet/activity): Added API for tx and multiTx details (#3939) 2023-08-24 14:23:40 +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 21d9d17cdc chore: reduce batch size for goerli arbitrum/optimism 2023-08-01 13:37:45 +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
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 8bfcb80ed6 fix(wallet) fix scan to/from hash when for multi_transactions 2023-07-13 00:24:36 +02: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
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
Stefan 3b0f4ee2c1 fix(wallet) fix GetMultiTransactions for to_amount nil
Updates status-desktop #11233
2023-07-04 16:49:08 +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
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 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
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
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
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 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
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
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 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
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
Roman Volosovskyi ee4003279a
Changes necessary to restore wallet on mobile app 2023-05-25 21:08:34 +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