Commit Graph

172 Commits

Author SHA1 Message Date
IvanBelyakoff fe4e079bea
fix(wallet): fix crash on market price cache concurrent write (#3307) 2023-03-17 09:33:20 +03:00
IvanBelyakoff 612efb9b89
fix(Wallet): Fix uninitialized token map accessed (#3289) 2023-03-15 18:10:36 +03:00
IvanBelyakoff 2c9714f0f8
fix(wallet/coingecko): Fix coingecko crash on race writing to tokens map (#3274) 2023-03-14 21:59:10 +03:00
IvanBelyakoff 804b5b43b4
feat(Wallet): implement token list from Uniswap (#3273)
Fixes #8807
2023-03-14 20:33:05 +03:00
Dario Gabriel Lipicar bac7eb08ca feat(Wallet): add API to fetch collectibles in a paginated way 2023-03-10 11:27:03 -03:00
Dario Gabriel Lipicar 7b6fc87f89 fix(wallet): use OpenSea api key only for mainnet endpoint 2023-03-10 08:55:58 -03:00
Stefan f607164122 feat(wallet) add GetMultiTransactions wallet API
Updates status-desktop #7663
2023-03-07 19:38:31 +04:00
Anthony Laibe bbe4e57f0f fix: use correct chain client 2023-03-07 16:24:32 +01:00
Dario Gabriel Lipicar 3f3e8f8894 feat(Wallet): add opensea asset fetching by contract address and token id 2023-03-07 10:33:50 -03:00
Dario Gabriel Lipicar 67bcf10466 feat(Wallet): handle erc721 transfers 2023-03-07 10:33:50 -03:00
IvanBelyakoff 48078393f9
feat: Update saved addresses DB to store ENS, isTest flag and chains (#3183)
prefixes. Changed primary keys and API methods.
Fixed tests and added new ones.
Fixed saved addresses and transaction tests to use ':memory:' sqlite
DB instead of a tmp file to speed up testing by hundred of times.

Fixes #8599
2023-03-06 16:26:46 +03:00
Stefan 7c7c3a1f13 feat(wallet): keep multi-transactions relation after transaction is complete
Updates status-desktop #7663
2023-03-01 23:34:00 +04:00
Stefan 226fa7d696 chore(wallet) increase the all-time fetching sample count
Also:
- extend maximum expected DB entries to fetch
- fix test TestBalanceHistoryGetWithoutOverlappingFetch passing because of all-time stride side effect

Closes status-desktop #9624
2023-03-01 19:55:07 +04:00
Anthony Laibe 42ee98e295 feat: Add circuit breaker for market provider 2023-03-01 08:58:00 +01:00
Stefan 411607d43d chore(wallet): hardcode specific average block duration for L2
The L2 networks have their own block number and average block duration,
so we need to hardcode to keep the logic simplified.

Updates status-desktop: #9582
2023-02-28 12:03:43 +04:00
Anthony Laibe 60e1978bb5 feat: fallback rpc endpoint 2023-02-28 08:43:57 +01:00
Anthony Laibe e543fda4b5 feat: add coingecko fallback 2023-02-27 09:55:04 +01:00
Anthony Laibe f81758ec6e feat: add time to check 2023-02-23 18:23:29 +01:00
Khushboo-dev-cpp dd3f4058c2
fix: Return statement after sendToL2 was missing (#3217)
fixes #9483
2023-02-22 08:39:26 +01:00
dlipicar 1d1a95091d
feat: implement currency formatting calculation (#3191) 2023-02-17 11:11:07 -03:00
Stefan f4f6b25302 feat: convert history balance tokens to fiat
Add history.exchange sub-package with following responsibilities

- fetch and caches daily exchange rates for tokens
    - Partial update if missing form yesterday back
- Implement all time fetching special case
- Fetches the price of the token after merging entries for the selected
chains

history.service package changes

- Return ValuePoint instead of DataPoint
    - Value point contains the value in fiat as float64 instead
- Convert merged values from tokens balance (wei) to fiat

Other changes

- Move start/stop balance history to startWallet/stopWallet
- Move cryptocompare to thirdparty package to avoid recursive import
- Rename DataPoint.Value to DataPoint.Balance
- Don't merge entries for single chain
2023-02-15 18:17:21 +04:00
Andrea Maria Piana b69042e7d7 Fix duplicated notifications on receiving contact update
This commit fixes an issue where when accepting a contact request
the other end would display an extra notification.

It also changes WaitOnResponse to collect results. This should make
tests less flaky, since sometimes messages are processed in different
batches.
Now we need to be though exact on what we expect from the response (i.e
use == instead of >, otherwise the same behavior applies)
This uncovered a couple of issues with messenger.Merge, so I have moved
the struct to use a map based collection instead of an array.
2023-02-14 09:22:37 +00:00
Michal Iskierko 8acc46f758 feat(collectibles): Mint collectibles (ERC-721):
Add testing smart contract and go api.
Add collectibles service.

Issue #3051
2023-02-13 12:59:55 +01:00
Khushboo-dev-cpp 9b32c6067a
fix: Fix issue where best routes with not enough balance is returned (#3164) 2023-02-08 16:22:50 +05:30
Stefan 8934426cbd fix: request token balance for overridden tokens
Fix balance for tokens overrides are not requested in case of fall back
when etherscan bulk fetch not working.

Updates status-desktop: #9091
2023-02-07 19:38:53 +04:00
Anthony Laibe b6a33089c8 fix: ensure bonder fees are lower than amount 2023-02-06 17:18:30 +01:00
Sale Djenic d44fa42cbf feat: `GetDerivedAddressForPath` endpoint added 2023-02-01 09:03:59 +01:00
Stefan d024d36718 fix: fix wallet.history.TestServiceAtEnd
First check was relying on sorting result of two items that had the same
weight and is not guaranteed to be deterministic.
2023-01-30 20:11:01 +04:00
Stefan 90b39eeb41 fix: merge balance history using block time
This change improves on the previous implementation which used
the block number that doesn't work with incompatible blockchains e.g. L1 vs. L2

Closes: #9205
2023-01-27 16:28:59 +04:00
Stefan a2ff03c79e feat: retrieve balance history for tokens and cache it to DB
Extends wallet module with the history package with the following
components:

BalanceDB (balance_db.go)

- Keeps track of balance information (token count, block, block timestamp)
for a token identity (chain, address, currency)
- The cached data is stored in `balance_history` table.
- Uniqueness constrained is enforced by the `balance_history_identify_entry`
UNIQUE index.
- Optimal DB fetching is ensured by the `balance_history_filter_entries`
index

Balance (balance.go)

- Provides two stages:
    - Fetch of balance history using RPC calls (Balance.update function)
    - Retrieving of cached balance data from the DB it exists (Balance.get
    function)
- Fetching and retrieving of data is done for specific time intervals
    defined by TimeInterval "enumeration"
- Update process is done for a token identity by the Balance.Update function
- The granularity of data points returned is defined by the constant
increment step define in `timeIntervalToStride` for each time interval.
- The `blocksStride` values have a common divisor to have cache hit
between time intervals.

Service (service.go)

- Main APIs
    - StartBalanceHistory: Regularly updates balance history for all
    enabled networks, available accounts and provided tokens.
    - GetBalanceHistory: retrieves cached token count for a token identity
    (chain, address, currency) for multiple chains
    - UpdateVisibleTokens: will set the list of tokens to have historical
    balance fetched. This is a simplification to limit tokens to a small
    list that make sense

Fetch balance history for ECR20 tokens

- Add token.Manager.GetTokenBalanceAt to fetch balance of a specific
block number of ECR20.
- Add tokenChainClientSource concrete implementation of DataSource
to fetch balance of ECR20 tokens.
- Chose the correct DataSource implementation based on the token
"is native" property.

Tests

Tests are implemented using a mock of `DataSource` interface used
to intercept the RPC calls.

Notes:

- the timestamp used for retrieving block balance is constant

Closes status-desktop: #8175, #8226, #8862
2023-01-25 22:25:50 +04:00
Anthony Laibe e8cd779e35 feat: api to return service up or down 2023-01-21 13:11:03 +01:00
dlipicar c2a8dd8a0c
feat(wallet): add price cache (#3107) 2023-01-19 11:49:48 -03:00
Andrea Maria Piana ed9ca8392c Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00
dlipicar 77a56e2b93
Feature/8640 unified currency rounding (#3079)
* feat(@desktop/wallet): added iso4217 library for fiat currency display decimals

* feat(@desktop/wallet): added token peg info and use numbers for token market values

* feat(@desktop/wallet): added
2023-01-12 14:54:14 -03:00
Anthony Laibe 883f9677c5 feat: nonce management in multi tx 2023-01-12 12:56:57 +01:00
Anthony Laibe 04de916cba fix: wallet downloader for l2 chain 2023-01-11 09:56:08 +01:00
Anthony Laibe 78795ce3e0 feat: reduce infura call
check if token exists before making the call
2023-01-10 09:42:08 +01:00
dlipicar 7d04be3613
Revert "feat/currency rounding (#3041)" (#3046)
This reverts commit 3d22f4a86d.
2023-01-04 09:40:26 -03:00
Anthony Laibe 99ff0a18b0 feat: cbridge integration 2023-01-04 08:23:18 +01:00
dlipicar 3d22f4a86d
feat/currency rounding (#3041)
* feat(@desktop/wallet): added iso4217 library for fiat currency display decimals

* feat(@desktop/wallet): added token peg info and use numbers for token market values

* feat(@desktop/wallet): extend wallet api to fetch prices in multiple currencies

* chore(@desktop/wallet): rename token peg field for clarity
2023-01-03 10:24:55 -03:00
frank 9137257638
synchronize display name (#2989) 2022-12-29 14:16:19 +08:00
Anthony Laibe 6abbe98cd2 feat: allow to lock amount in router 2022-12-21 16:58:33 +01:00
Anthony Laibe d7bf19fdbb feat: allow to get wallet token for specific addresses 2022-12-08 09:16:17 +01:00
Anthony Laibe c735e2a6bb feat: add wallet ticker 2022-12-02 10:53:21 +01:00
Anthony Laibe 0d1837f858 feat: add ticker in backend rather than in clients 2022-12-02 10:53:21 +01:00
Anthony Laibe eff02a79a9 feat: add wallet token endpoint 2022-12-02 09:32:07 +01:00
Anthony Laibe f3b1448efa fix: router preferred chains 2022-12-02 09:27:44 +01:00
Anthony Laibe 4c29c97591 feat: bridge tx 2022-11-30 09:18:24 +01:00
dlipicar ba053c8a5d
fix: keep original case for collectible trait types (#2984) 2022-11-29 09:28:37 -03:00
Khushboo-dev-cpp d41fcaf8a9
feat: delete message for new design (#2922) (#2965)
Co-authored-by: yqrashawn <namy.19@gmail.com>
2022-11-22 11:12:16 +01:00