Commit Graph

60 Commits

Author SHA1 Message Date
Stefan ca973b4aa6 feat(wallet) use sql activity filter for incremental updates
Switch from the prototype of duplicating the SQL filter as a runtime
and keeping them in sync on each event that might invalidate the current
filtered entries to a simpler approach of requesting the filter again
and doing the diff to detect the new changes.

Also add a new reset API to model the new entries design requirements.

The new approach shows less corner-case to handle and follows one source
of truth concept making debugging and future maintenance easier.

Other changes

- Fix pending mocking to work with multiple calls
- Refactor tests to account for the new changes

Updates status-desktop #12120
2024-02-12 19:29:15 +01:00
Stefan 812910f087 feat(wallet): Add session-based activity API for dynamic updates
This commit introduces the first steps towards implementing a session-based activity API to support dynamic updates of the current visualized filter in the wallet activity service. This change is necessary to move away from static paginated filtering, which was previously done in SQL, to a more dynamic approach that can handle updates in real-time.

The main changes include:
- Add basic `EventActivitySessionUpdated` support for pending transactions.
- Added a `TODO.md` file outlining the plan and requirements for dynamic activity updates.
- New session-related API to the `activity.Service`
- `session.go` contains the logic for session management and event processing related to activity updates.
- Add test case for incremental filter updates.

The commit also includes:

- various other minor changes and refactoring to support the new session-based approach.
- Deprecation notices added to the `api.go` file for methods that are no longer used by the status-desktop application.
- Clarification comments added to the `scheduler.go` file regarding replacement policies.

Updates: #12120

ghstack-source-id: a61ef74184
Pull Request resolved: https://github.com/status-im/status-go/pull/4480
2024-02-01 19:55:06 +01:00
Stefan 21e6914a3c fix(wallet) fix reading amount for pending transactions
The reading of the amount for pending transactions was done in the same
way as for transfers table. However, the transfers table has a string
hex representation of the amount, while the pending transactions table
has a binary representation of the amount (*big.Int). This was
triggering the not int warning and value was missing.

Updates status-desktop #12120
2024-02-01 18:28:55 +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
Roman Volosovskyi 0bd4a06edc Comment out all logged flaky tests 2024-01-18 06:36:12 +00:00
Stefan 3c4fcaa2ed feat(wallet): propagate status with the pending tx status changed
Replace usage of `eth_getTransactionByHash` with `eth_getTransactionReceipt`
when polling for changes. `eth_getTransactionReceipt` delivers also the
status of the transaction.

Update tests to account for the new changes
Propagate status with the update event

Refactoring of the `pendingtxtracker.go` file to emit notifications with
a new payload structure that includes transaction identity and deletion status.

Closes status-desktop [#12120](https://github.com/status-im/status-desktop/issues/13124)

ghstack-source-id: 936bff5a41
Pull Request resolved: https://github.com/status-im/status-go/pull/4523
2024-01-10 19:42:51 +01:00
Stefan e088e1b3bd chore(wallet): refactor test helpers and update event names
Refactor the test helpers for pending transactions by extracting the mock
implementations and helper functions into a new file `transactions/testhelpers.go`.

Update event names for clarity and consistency in `pendingtxtracker.go`.

Updates status-desktop: [#13124](https://github.com/status-im/status-desktop/issues/13124)

ghstack-source-id: d85756b80f
Pull Request resolved: https://github.com/status-im/status-go/pull/4492
2024-01-10 19:42:51 +01:00
Sale Djenic 6bfc1bed08 chore: read and use nonce from network instead from the local cache when sending tx
Reading the Nonce from the local cache may be incorrect if the tx is made out of the Status app or
if Status app sends a tx prepared by the dapp (via WalletConnect). A submitted tx with a wrong Nonce
results in a failing tx, that's why we need to read the Nonce from the network.
2023-12-29 08:43:03 +01:00
Sale Djenic cfa542378d chore(walletconnect)_: various improvements applied
- `WalletConnectTransfer` identified as a new transfer type
- Wallet-related endpoints that logically belong to the wallet moved from the wallet connect service
- Wallet connect service now receives `transfer.TransactionManager` instead of `transactions.Transactor`
- Deadlock issue when trying to send the tx with the wrong nonce fixed
2023-12-04 11:18:38 +01:00
Sale Djenic dea0b62650 feat(wallet)_: common endpoints added to wallet api
- `SignMessage`
- `BuildTransaction`
- `SendTransactionWithSignature`
2023-11-29 15:34:44 +01:00
Sale Djenic 8641ec5dd5 feat(walletconnect)_: ethereum rpc calls support
Reference: https://docs.walletconnect.com/advanced/rpc-reference/ethereum-rpc
2023-11-27 10:49:23 +01:00
Sale Djenic e9f11f70dd chore(wallet)_: proper release of locked nonce (unlock function call) 2023-11-22 09:46:50 +01:00
Sale Djenic ce121710d9 fix: unlock local nonce when an error occurs and increment only when the tx is sent for real 2023-11-06 18:30:42 +01:00
Sale Djenic 05baec8bec fix: estimate gas function resoved that it uses real network estimation instead of hardcoded value 2023-11-06 18:30:42 +01:00
Sale Djenic b348cca15c feat: added functionality to ask a client to sign a transaction and an endpoint to continue sending using provided signature
This functionality is needed in case the user wants to send a transaction and
signs it using the signature provided by the keycard (or any other compatible way).
2023-10-17 19:42:06 +02:00
Michal Iskierko c85a110a31 feat(CommunityTokens): New deployment contracts and handling signer pub key
New contracts and contract go functions.
Adjust owner&master tokens deployment flow.
Create deployment signature.
CommunityTokens API for handling signer pubkey.

Issue #11954
2023-10-04 11:33:57 +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
Stefan 71800a19f1 fix(wallet) fix pending transactions notification
Also, add regression test.
2023-09-01 00:18:26 +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
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
Michal Iskierko 7d9092e295 fix(Collectibles): Trigger transaction event when creating transaction
Issue #11565
2023-07-18 16:21:20 +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
Anthony Laibe 883f9677c5 feat: nonce management in multi tx 2023-01-12 12:56:57 +01:00
Richard Ramos b8fd999b54
fix: lint (#2845)
Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
2022-09-27 18:59:02 -04:00
Anthony Laibe 8c0f230644
feat: Simple transaction router (#2686) 2022-06-09 15:09:56 +02:00
Anthony Laibe 22bb09a94f
feat: ens register api (#2473) 2022-01-14 12:17:31 +01:00
Anthony Laibe 26bfeddad4
feat: Rpc client manage multiple eth client (#2359) 2021-09-22 13:49:20 -04:00
Roman Volosovskyi d1a581b18c
Fix eip1559 contract transactions 2021-08-19 13:29:54 +03:00
Roman Volosovskyi 9f9f00b7a2
Adjust HashTransaction to eip1559
This commit fixed eip1559 tx signing on keycard.
2021-08-12 18:47:56 +03:00
Andrea Maria Piana f31dc5df92 Use marshal binary 2021-07-20 10:57:38 +02:00
Andrea Maria Piana 03700c934c Send dynamic fee tx parameters 2021-07-20 10:57:38 +02:00
Andrea Maria Piana a4701f41ee linting and remove unused code 2021-07-20 10:57:38 +02:00
Andrea Maria Piana d84da4f515 Fix some tests and restore private/public RPC client 2021-07-20 10:57:38 +02:00
Andrea Maria Piana 1e8688ac56 Upgrade to london signer and cleanup 2021-07-20 10:57:38 +02:00
andrey a4195e5b5c custom nonce 2020-11-24 12:20:57 +01:00
andrey 682722b973 add wallet favourites 2020-09-21 10:48:00 +02:00
Adam Babik 831ab85561
Upgrade deps (#1892) 2020-03-09 08:55:58 +01:00
Pedro Pombeiro c8a911ebd1 Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00
Pedro Pombeiro 287e5cdf79 Abstract `accounts.Key` and geth `keystore` 2020-01-06 10:17:23 +01:00
Pedro Pombeiro dd894ece15 Start abstracting geth Keystore 2019-12-19 14:11:48 +01:00
Pedro Pombeiro 26b6d7c36a Create a home submodule for Eth node bridges- Rename StatusBackend to GethStatusBackend 2019-11-27 17:02:09 +01:00
Adam Babik 26880b83d7
Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
dmitry bf95a71f6f Verify valid sub-accounts using database 2019-08-30 14:11:00 +03:00
Andrea Franz b3e2cb2965
validate signature size on SendTransactionWithSignature (#1401)
* chekc signature size to avoid panic from go-ethereum

* add comment and constant

* add test
2019-03-01 14:49:30 +01:00
Andrea Franz c869160ee7
add HashTransaction (#1379)
* add HashTransaction

* add buildTransaction

* test HashTransaction

* add HashTransaction to backend, lib, and mobile

* refactor buildTransaction

* add getTransactionNonce

* add log funtions
2019-02-21 10:53:39 +01:00
Andrea Franz 72906ac655
send tx with signature (#1374)
* add SendTransactionWithSignature to Transactor

* add comment to SendTransactionWithSignature

* add SendTransactionWithSignature to StatusBackend

*  add SendTransactionWithSignature to lib

* add SendTransactionWithSignature to mobile pkg

* increment nonce if needed

* add TestSendTransactionWithSignature_IncrementingNonce

* add NoError assertion

* validate tx args

* debug CI adding `env`

* CI debug

* remove debug

* return error if tx nonce is not the expected one

* fix lint warning
2019-02-15 12:31:20 +01:00
Andrea Franz 4939268edf
Unlock wallet and chat keys (#1346)
* select account decrypting wallet and chat keys

* adapt account tests to use chat and wallet account/keys

* fix tests using chat address

* changes after review

* fix status service e2e tests

* add account.Info struct returned when creating and recovering an account

* use s.EqualValues to compare recovered accounts

* return Info instead of *Info

* add both address and walletAddress to responses

* Update lib/types.go

Co-Authored-By: gravityblast <andrea@gravityblast.com>

* Update lib/types.go

Co-Authored-By: gravityblast <andrea@gravityblast.com>

* update comment to fix lint
2019-01-18 10:01:14 +01:00