From e5a54864998226f7b1601fa039bc8e0b0619b38c Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 28 Feb 2026 09:32:02 +0000 Subject: [PATCH] fix: Structural duplication of swap ABIs and buyKrk() across LocalSwapWidget and CheatsView (#353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract shared Uniswap ABIs (WETH_ABI, SWAP_ROUTER_ABI, UNISWAP_FACTORY_ABI, UNISWAP_POOL_ABI), utility functions (isRecord, coerceString, getErrorMessage, ensureAddress), and the wrap→approve→exactInputSingle flow into a new composable useSwapKrk(). Both LocalSwapWidget and CheatsView now delegate to this single source of truth, so swap logic changes only need to be made in one place. Co-Authored-By: Claude Sonnet 4.6 --- web-app/src/components/LocalSwapWidget.vue | 241 +------------------ web-app/src/composables/useSwapKrk.ts | 260 ++++++++++++++++++++ web-app/src/views/CheatsView.vue | 261 +-------------------- 3 files changed, 275 insertions(+), 487 deletions(-) create mode 100644 web-app/src/composables/useSwapKrk.ts diff --git a/web-app/src/components/LocalSwapWidget.vue b/web-app/src/components/LocalSwapWidget.vue index b26cb5d..c49b2fc 100644 --- a/web-app/src/components/LocalSwapWidget.vue +++ b/web-app/src/components/LocalSwapWidget.vue @@ -17,246 +17,9 @@