-
Notifications
You must be signed in to change notification settings - Fork 65
feat: evm svm bridge action hooks #1543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
james-a-morris
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments
| import { defaultSwapSlippage, bnZero } from "utils"; | ||
|
|
||
| import { useBridgeAction } from "./useBridgeAction"; | ||
| import { useBridgeAction } from "./useBridgeAction_new"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to stay as *_new?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we should eventually replace the old useBridgeAction file with this new one. I just kept this convention because this makes things a bit easier when we need to consolidate possible changes/fixes that got introduced on master.
gsteenkamp89
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
* Add validation or SVM addresses (#1478) * Add validation or SVM addresses Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * add unit tests for validators Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * handle runtime throws Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * feat: custom wallet ui sidebar (#1470) * feat: custom wallet ui sidebar * fixup * fixup * fixup * fixup * fixup * review requests * feat: solana wallet support (#1483) * feat: custom wallet ui sidebar * fixup * fixup * fixup * fixup * fixup * review requests * feat: solana wallet support * fixup * fixup * fixup * fixup * pin solana web3 js * take first metamask button Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> Co-authored-by: Gerhard Steenkamp <gerhard@umaproject.org> * Feat/improve wallet selection ux (#1489) * feat: custom wallet ui sidebar * fixup * fixup * fixup * fixup * fixup * review requests * feat: solana wallet support * fixup * fixup * fixup * fixup * pin solana web3 js * take first metamask button Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * track latest wallets Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * detect browser wallets Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * show installed Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * style fixes Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * remove onboard css Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * fix sorting logic Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> Co-authored-by: Dong-Ha Kim <dongha.kim210@gmail.com> * Feat/generate routes for solana (#1485) * bump packages Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * add solana devnet configs, edit script to handle sol addresses Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * update lock file Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * fix: sepolia universal swap routes * feat: evm svm bridge action hooks (#1543) * refactor: useBridgeAction evm strategy * feat: add svm strategy bridge action * fix: solana devnet assets * feat: use new bridge action hook * chore: temp mock limits and fees for solana * fixup * chore: use `vite-plugin-node-polyfills` * fixup * fixup * fix: allow `sortChains` to handle balances with unmatched decimals * fix: solana grayscale * review requests * feat: support svm useBalance hooks (#1558) * refactor: useBridgeAction evm strategy * feat: add svm strategy bridge action * fix: solana devnet assets * feat: use new bridge action hook * chore: temp mock limits and fees for solana * fixup * feat: support svm useBalance hooks * chore: use `vite-plugin-node-polyfills` * fixup * fixup * fix: allow `sortChains` to handle balances with unmatched decimals * fixup * fix: useMaxBalance * fixup * feat(api): support svm (#1589) * feat(coingecko): support cg sol base currency * chore: bump sdk and constants * feat: support solana in api utils * feat: support svm addresses in balance endpoints * feat: support svm in gas costs/price endpoints * feat: support svm in limits and suggested-fees * fixup * test: fix _utils * fixup * fixup * fixup * fix: useBalance svm strategy * feat: evm/svm recipient edge cases (#1579) * feat: evm/svm recipient edge cases * fixup * feat: enable solana mainnet + fixes (#1592) * feat: upgrade spoke pool verifier (#1593) * chore: bump contracts + `SpokePoolVerifier` deposit * re-gen routes * bump * Drop redundant export * bump sdk * Fixes filldeadline & empty message for deposits to Solana (#1605) * update sdk Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * feat: solana featured bridge route banner (#1603) * Fix deposit (#1621) * feat(deposit-tracking): implement evm & svm strategies for tracking deposit and fill status (#1586) * chore: clean up legacy `useBalance` hook * fix: relayer gas fees for solana (#1626) * fix: always consider recipient address for * fix: correctly parse addresses * fixup * fix: sol decimals in fee calculator * improve: disable speedup option for specific chains (#1622) * fix: use address param instead of depositor when querying deposits (#1637) * Support updated SpokePool program IDL (#1633) * update deps Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * encode outputAmount for deposits as uint8array Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * log relay data for manual filling Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * hardcode temp address Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * improve: fixes Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * remove hardcoded svm spoke id Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * generate routes with updated program id Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * remove unused route pda helper Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> Co-authored-by: james-a-morris <jaamorris@cs.stonybrook.edu> * use solana's logic for detecting installed wallets (#1655) Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * Fix SVM WalletConnect adapter (#1656) * chore: sync epic solana with master (#1696) * chore: update vercel.json with indexer route (#1625) * chore: Enable CAKE (#1602) * feat: enable usdc-bnb -> hl (#1631) * fix: blocked address uni trading api + loop detected error (#1632) * fix: dummy swapper for mulitcall3 as swapper * fix: 508 loop detected error in /coingecko * fixup * fixup * fixup * chore: update codeowners (#1639) * chore: update codeowners * fixup * improve: add custom vanity mappings to chain paths (#1629) * improve: add custom vanity mappings to chain paths Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * improve: we're already in lowercase Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: allow cli args for swap test scripts (#1636) * feat: allow cli args for swap test scripts * refactor: single swap script + flow type cli arg * Add LI.FI DEX strategy implementation (#1634) * feat(bridge): use unchecked txn to accelerate user flow (#1635) This PR accelerates the post-deposit user flow on Mainnet by immediately providing a transaction hash. We've introduced `sendUncheckedTransaction` for Mainnet deposits, enabling instant redirection to the deposit status page. This avoids the 10-15 second delay for transaction mining, significantly improving user experience. This change is the most efficient solution without a major dApp overhaul. The core issue is the need for a transaction hash to create the deposit status URL. The `sendUncheckedTransaction` method is the fastest way to obtain this hash. While a more comprehensive solution could be built, it would require a significant refactor. This targeted change delivers the necessary user experience improvement with minimal disruption to the existing codebase. Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * don't cache user pool value (#1640) * don't cache user pool value Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * refetch LP token balances after adding or withdrawing from LP Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * feat: add PMF survey form integration and megaphone icon (#1630) * feat: add PMF survey form integration and megaphone icon - Introduced a new hook `usePMFForm` to manage user interaction with the PMF survey form. - Added a new SVG icon for the megaphone to enhance UI. - Updated `.env.example` to include a new environment variable for the PMF survey form URL. - Integrated the PMF survey button in the `DepositStatusUpperCard` component, displaying it conditionally based on user eligibility. * feat: enhance DepositStatus components with PMF form integration - Integrated `usePMFForm` hook to conditionally render components based on PMF form availability. - Updated `DepositTimesCard` to display fees in a collapsible format when the PMF form is available. - Added bridge fee and gas fee display in `DepositStatusUpperCard`. - Improved UI responsiveness with new styled components for better user interaction. Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * refactor: update DepositStatus components Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * improve: rearrange quote Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * refactor: simplify DepositStatus components by removing PMF form dependencies - Removed the `usePMFForm` hook and related conditional rendering from `DepositStatusLowerCard` and `DepositTimesCard`. - Streamlined the rendering logic for displaying fees and amounts sent, enhancing code clarity and maintainability. Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * improve: remove comments Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * improve: only reset PMF form on refresh/account change Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> --------- Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * feat: support new `SpokePoolPeriphery` contracts (#1645) * fix: disable indexer api cache (#1644) * fix: disable indexer api cache * Update vercel.json * Update vercel.json * Update vercel.json * Update vercel.json * feat: update tracking plan version and add PMFButtonClicked event (#1646) - Updated the tracking plan version from 50 to 51 in the Ampli integration. - Introduced a new event `pmfButtonClicked` to track user interactions with the PMF survey button. - Enhanced the `usePMFForm` hook to include tracking for the PMF button click event when the form is opened. Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * fix: exclusiveRelayer address parsing (#1648) * Minor fix to swap script (#1650) * Implement concurrent cross-swap quote fetching capability (#1638) * DO NOT MERGE: add Across v4 banner (#1652) * refactor Banners. add v4 Banner Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * clean up Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * clean up Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * fix: correct contract detection logic in useToAccount hook (#1651) Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * fix: use correct origin swap recipient when using `SpokePoolPeriphery` (#1654) * fix: use correct origin swap recipient when using `SpokePoolPeriphery` * fixup * fix: Updated Zora explorer link (#1653) * send ETH to recipient if 7702 implementation (#1649) * chore: temp disable polygon (#1659) Polygon is having some issues following Heimdall v2 upgrade. * Revert "chore: temp disable polygon (#1659)" (#1660) This reverts commit 24de8b4. * feat: add 0x DEX strategy (#1647) * Add 0x DEX strategy with exact output estimation * Add remaining 0x AllowanceHolder addresses * feat: add otel tracer (#1657) * feat: add otel tracer * fixup * fixup * fixup * fixup * fixup * fixup * fixup * fixup * fixup * fixup * fixup * fixup * fixup * test * fixup * fixup * fixup * feat: add tracing to /swap/approval * fixup * add spans * fixup * fixup * Run route generation scripts in pre-commit step (#1662) * fix: make gas markup parsing more robust (#1664) * fix: local sdk patch for gas price (#1666) * chore: set cross swap type in trace (#1667) * chore: set cross swap type in trace * fixup * feat: select best quote based on all possible cross swap types (#1661) * Select best quote based on possible cross swap types * Add timeouts to individual quote promises * Revert "feat: select best quote based on all possible cross swap types (#1661)" (#1669) This reverts commit c7f2ee6. * feat(swap): Set body schema and validations for embedded actions (#1665) * swap api body schema and validation * use function name from interface * Update api/swap/_utils.ts Co-authored-by: Ashwin <213675439+ashwinrava@users.noreply.github.com> * add recursion limit * use input error with invalid method code --------- Co-authored-by: Ashwin <213675439+ashwinrava@users.noreply.github.com> * chore: Clear SDK hurdle (#1643) * feat: support `include/excludeSources` query params (#1663) * feat: add sources gen script * feat: add support for `includeSources` and `excludeSources` * improve errors * fixup * improve error handling * fix: output a2b * fix: swap script * fixup * fixup * chore: more swap span attributes (#1672) * feat: resubmission of PR #1661 (#1673) * Select best quote based on possible cross swap types * Add timeouts to individual quote promises * Extract nested logs from failed promises * feat: propagate swap provider to swap quote response (#1674) * feat: propagate swap provider to swap quote response * fixup * fixup * revert strategies * fixup * feat: add `requestId` to selected responses (#1678) * feat: add `requestId` to selected responses * fixup * fixup * set request id in span * fix: misc cross swap service improvements (#1679) * feat: propagate swap provider to swap quote response * fixup * fixup * revert strategies * chore: perf tweaks cross-swap-service * fixup * fixup * fixup * fixup * a2a chunk size to 1 * fixup * fixup * add flag to skip tx exec * revert enabling lifi and 0x * fixup * chore: improve span attributes (#1680) * feat: add support `prioritizationMode` in strategies config (#1681) * feat: add support `prioritizationMode` in strategies config * fixup * misc improvements * fix: wrap `strategyFetches` in functions * fix tests * fixup * feat: add swap chains and tokens endpoints (#1685) * feat: add swap chains and tokens endpoints * Increase cache ttl * chore: set parent incoming request attr (#1682) * chore: set more incoming req parent attributes * fixup * test: fix * chore: temp disable Polygon (#1689) * Revert "chore: temp disable Polygon (#1689)" (#1690) This reverts commit 2be7926. * type fixes * fixup * enable solana * fixup * fixup * fixup * fixup * fixup --------- Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> Co-authored-by: amateima <89395931+amateima@users.noreply.github.com> Co-authored-by: Paul <108695806+pxrl@users.noreply.github.com> Co-authored-by: James Morris, MS <96435344+james-a-morris@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ashwin <213675439+ashwinrava@users.noreply.github.com> Co-authored-by: Gerhard Steenkamp <51655063+gsteenkamp89@users.noreply.github.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Melisa Guevara <melisaguevarav@gmail.com> * fix: solana deposit status tracking (#1710) * ignore yalc changes Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * bump sdk Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * memoize strategy instance (#1714) Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * Force rebuild 1/2 This reverts commit 55506ff. * Force rebuild 2/2 This reverts commit f69c94adda48cc85452c139fa4a7a201a4815e40. * Bump SDK for relayFeeCalculator updates * Bump sdk * Bump * fix: EVM => Hyperliquid (#1729) * fix evm bridges to hyperliquid Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * fixup Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * allow filtering of disabled external project routes Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * disable Solana to Hyperliquid Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * check in Chain selector if external project route actually exists for from chain Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * Improves wallet connection flow (#1722) Updates the wallet connection process to support both EVM and Solana wallets. It introduces separate connect buttons for each type of wallet, and updates the connection logic to reflect the status of both EVM and Solana connections. * Bump * force simulation when destination is Solana Signed-off-by: bennett <bennett@umaproject.org> * fix: required `recipient` query param if dst is svm (#1747) * fix: use default address for querying quotes (#1750) * fix: max deposit from svm (#1739) * allow un minified production build for local dev Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * use token balance as max amount Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * check if sol address is program (#1751) Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * feat: include token in banner (#1749) Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> * add resolutions for bs58 and base-x (#1755) Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * Fix fill tracking delay (#1756) * bump sdk (#1762) Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> * Fix/default route selection on connect (#1763) --------- Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu> Signed-off-by: bennett <bennett@umaproject.org> Co-authored-by: Dong-Ha Kim <dongha.kim210@gmail.com> Co-authored-by: Paul <108695806+pxrl@users.noreply.github.com> Co-authored-by: James Morris, MS <96435344+james-a-morris@users.noreply.github.com> Co-authored-by: Melisa Guevara <melisaguevarav@gmail.com> Co-authored-by: james-a-morris <jaamorris@cs.stonybrook.edu> Co-authored-by: amateima <89395931+amateima@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ashwin <213675439+ashwinrava@users.noreply.github.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: bennett <bennett@umaproject.org>
Closes ACX-3978
This PR refactors the
useBridgeActionhook to use different ecosystem-specific strategies based on the selected route'soriginChainId.