Commit Graph

32 Commits

Author SHA1 Message Date
Sale Djenic 04784d18a0 fix_: canceling route generation before the route gets generated doesn't allow subscribing for events 2024-10-02 17:33:00 +02:00
Sale Djenic 28506bcd17 chore_: improvements of the sending route generated by the router process
This commit simplifies the sending process of the best route suggested by the router.
It also makes the sending process the same for accounts (key pairs) migrated to a keycard
and those stored locally in local keystore files.

Deprecated endpoints:
- `CreateMultiTransaction`
- `ProceedWithTransactionsSignatures`

Deprecated signal:
- `wallet.sign.transactions`

New endpoints:
- `BuildTransactionsFromRoute`
- `SendRouterTransactionsWithSignatures`

The flow for sending the best router suggested by the router:
- call `BuildTransactionsFromRoute`
- wait for the `wallet.router.sign-transactions` signal
- sign received hashes using `SignMessage` call or sign on keycard
- call `SendRouterTransactionsWithSignatures` with the signatures of signed hashes from the previous step
- `wallet.router.transactions-sent` signal will be sent after transactions are sent or if an error occurs

New signals:
- `wallet.router.sending-transactions-started` // notifies client that the sending transactions process started
- `wallet.router.sign-transactions` // notifies client about the list of transactions that need to be signed
- `wallet.router.transactions-sent` // notifies client about transactions that are sent
- `wallet.transaction.status-changed` // notifies about status of sent transactions
2024-10-01 14:30:33 +02:00
Sale Djenic 4a7031b455 chore_: move path constants to wallet common location 2024-10-01 14:30:33 +02:00
Khushboo Mehta 4816769506 feat!: Return prices array along with SuggestedRoutes 2024-09-11 17:03:33 +02:00
Sale Djenic 0235889e12 feat_: check for balances after each fees update 2024-09-11 13:51:51 +02:00
Sale Djenic 506a76bf9f feat_: recalculate route fees with every new block 2024-09-11 13:51:51 +02:00
Sale Djenic 1bb9cbc573 chore_: router response moved to wallet responses location
Following the approach we did for keeping requests at the same location, these changes introduce
new location for responses. `SuggestedRoutesResponse` is moved there and renamed to
`RouterSuggestedRoutes` and code is updated accordingly.

New type `Route` defined (since a single route is composed of zero or more paths).

Types `Route`, `Path`, `Graph` and `Node` belong to a new `routs` package now.
2024-09-11 13:51:51 +02:00
Sale Djenic 00559692bc chore!: router code organization improvements
It's a breaking change due to errors' changes, the list of mapped old error codes:
- `"WR-001"` is now `"WRR-001"`
- `"WR-002"` is now `"WRR-002"`
- `"WR-003"` is now `"WRR-003"`
- `"WR-004"` is now `"WRR-004"`
- `"WR-005"` is now `"WRR-005"`
- `"WR-006"` is now `"WRR-006"`
- `"WR-007"` is now `"WRR-007"`
- `"WR-008"` is now `"WRR-008"`
- `"WR-009"` is now `"WRR-009"`
- `"WR-010"` is now `"WRR-010"`
- `"WR-011"` is now `"WRR-011"`
- `"WR-012"` is now `"WRR-012"`
- `"WR-013"` is now `"WRR-013"`
- `"WR-014"` is now `"WRR-014"`
- `"WR-015"` is now `"WRR-015"`
- `"WR-019"` is now `"WRR-016"`
- `"WR-020"` is now `"WRR-017"`
- `"WR-021"` is now `"WRR-018"`
- `"WR-025"` is now `"WRR-019"`

- `"WR-016"` is now `"WR-001"`
- `"WR-017"` is now `"WR-002"`
- `"WR-018"` is now `"WR-003"`
- `"WR-022"` is now `"WR-004"`
- `"WR-023"` is now `"WR-005"`
- `"WR-024"` is now `"WR-006"`
- `"WR-026"` is now `"WR-007"`
- `"WR-027"` is now `"WR-008"`

Other changes:
- `RouteInputParams` type moved to `requests` package and code updated accordingly
- `SuggestedFees` type moved to a new `fees` package and code updated accordingly
- `SendType` type moved to a new `sendtype` package and code updated accordingly
- the following functions moved to `common` package
  - `ArrayContainsElement`
  - `ArraysWithSameElements`
  - `SameSingleChainTransfer`
  - `CopyMapGeneric`
  - `GweiToEth`
  - `WeiToGwei`
- the following consts moved to `common` package
  - `HexAddressLength`
  - `SupportedNetworks`
  - `SupportedTestNetworks`
2024-09-11 13:51:51 +02:00
Sale Djenic d10d492515 chore!: removed v2 mark from api endpoints, structs and files marked as router v2
Breaking change!

Since the old router logic is removed, there is no need to have files and structs marked as v2.

Renamed endpoints:
- `GetSuggestedRoutesV2` to `GetSuggestedRoutes`
- `GetSuggestedRoutesV2Async` to `GetSuggestedRoutesAsync`
- `StopSuggestedRoutesV2AsyncCalcualtion` to `StopSuggestedRoutesAsyncCalcualtion`
2024-09-11 13:51:51 +02:00
Sale Djenic e58787536a chore_: old router logic removed 2024-09-11 13:51:51 +02:00
Dario Gabriel Lipicar dc7ca3ddb4 fix(wallet)_: fix single chain operation check 2024-08-29 16:14:15 -03:00
Sale Djenic 9b9a91f654 chore_: map insufficient funds error
This commit maps this kind of errors
`status-proxy-0.error: failed with 50011064 gas: insufficient funds for gas * price + value: address 0x4eeB09cf0076F840b38511D808464eE48efD4305 have 0 want 10000000000000`
to this form:
`status-proxy-0.error: failed with 50011064 gas: insufficient funds for gas * price + value: address 0x4eeB09cf0076F840b38511D808464eE48efD4305`

which means that we don't want to display to a user details of how much they have and how much is needed for fees, cause those data are very often
misleading, referring mostly to "how much user has".

New error added in case there is no positive balances across all enabled chains.
2024-08-28 08:23:18 +02:00
Sale Djenic 378e5741b9 feat_: the router - add candidates, as potential paths, by taking the max amount on enabled chains 2024-07-05 14:51:34 +02:00
Samuel Hawksby-Robinson 5f666e6ad9 test(router_validation)_: blended my validation with latest develop 2024-07-03 11:47:04 +01:00
Sale Djenic 92361d9e20 feat_: new endpoint added for an async route/s calculation
- `GetSuggestedRoutesV2Async` calculates the route/s based on input parameters and sends
`wallet.suggested.routes` signal to notify a client.
2024-07-01 15:07:17 +02:00
Sale Djenic 1cdcc0dcc2 chore_: tests for router candidates added 2024-06-26 11:02:13 +01:00
Sale Djenic 68464d949c chore_: calculating multi tx candidates improvements
- router logic splitted into two more logical functions
- locked amount validation improved
- hop and swap processors cached data kept per from/to chain and from/to token
- Clear function which clears the local cache is added
- process of evaluating `amountToSend` if more than a single network is locked is improved
- optimized params for require approval function
2024-06-26 11:02:13 +01:00
Sale Djenic d1f8064437 chore_: typo in `disabledToChaindIDs` parameter name resolved 2024-06-26 11:02:13 +01:00
Anthony fb261e4a0e feat_: change how we compute fees 2024-06-20 10:30:01 +02:00
Sale Djenic 462013520f chore_: swap via paraswap improvements 2024-06-14 15:44:38 +02:00
Sale Djenic 9c3b49b866 chore_: celer bridge disabled, due to making correct routes using a single (hop) bridge 2024-06-14 15:44:38 +02:00
Sale Djenic ddc75815eb chore_: stickers buy added to the router 2024-06-11 19:46:43 +02:00
Sale Djenic 39a7d41135 chore_: making contract type param internal to hop bridge processor type 2024-06-10 16:38:38 +02:00
Sale Djenic 07cf6cd52d chore_: `Bridge` interface renamed to `PathProcessor` interface and necessary changes applied due to that change 2024-06-07 15:50:38 +02:00
Sale Djenic fe21fd9e97 chore_: bridge moved to router 2024-06-07 15:50:38 +02:00
Sale Djenic a5a83eb74e chore_: ens set public key improvements 2024-06-07 13:15:40 +02:00
Sale Djenic bb5545d430 chore_: ens release improvements 2024-06-06 11:51:14 +02:00
Sale Djenic 11f83780d1 chore_: ens register improvements 2024-06-05 14:45:46 +02:00
Sale Djenic 74b1dfd694 fix_: hop contracts' addresses updated 2024-05-28 13:55:54 +02:00
Sale Djenic c74931c333 fix_: hop bridge improvements
- handling `null` values in the Hop response
- using data returned from the Hop api when preparing data for estimation and calling `swapAndSend` and `sendToL2`
- estimating gas for bridges implemented in the bridges implementation types, avoiding wrong gas for placing bridge transactions
2024-05-28 13:55:54 +02:00
Sale Djenic 4a1a29b6a5 chore_: checks per sending type added (part3) 2024-05-18 00:00:23 +02:00
Sale Djenic 7a016d0859 chore_: router moved to router package (part2) 2024-05-18 00:00:23 +02:00