Merge pull request 'fix: cleanup: Remove swap functionality from cheats page after #393 fix (#400)' (#410) from fix/issue-400 into master

This commit is contained in:
johba 2026-03-02 08:57:03 +01:00
commit b1c2e4aff8
4 changed files with 18 additions and 30 deletions

View file

@ -160,6 +160,7 @@ services:
export VITE_LOCAL_RPC_PROXY_TARGET=http://anvil:8545
export VITE_LOCAL_GRAPHQL_PROXY_TARGET=http://ponder:42069
export VITE_SWAP_ROUTER=0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4
export VITE_ENABLE_LOCAL_SWAP=true
export VITE_BASE_PATH=/app/
# Overlay kraiken-lib from workspace (may be newer than baked-in image)

View file

@ -164,29 +164,27 @@ test.describe('Acquire & Stake', () => {
await mintButton.click();
await page.waitForTimeout(3_000);
console.log('[TEST] Buying KRK tokens via swap...');
console.log('[TEST] Navigating to get-krk page to buy KRK...');
await navigateSPA(page, '/app/get-krk');
await expect(page.getByRole('heading', { name: 'Get $KRK Tokens' })).toBeVisible({ timeout: 10_000 });
await page.screenshot({ path: 'test-results/before-swap.png' });
// Check if swap is available
const buyWarning = await page.getByText('Connect to the Base Sepolia fork').isVisible().catch(() => false);
if (buyWarning) {
throw new Error('Swap not available - chain config issue persists');
}
const ethToSpendInput = page.getByLabel('ETH to spend');
await expect(ethToSpendInput).toBeVisible({ timeout: 15_000 });
await ethToSpendInput.fill('0.05');
const buyButton = page.getByRole('button', { name: 'Buy' }).last();
const buyButton = page.getByRole('button', { name: 'Buy KRK' });
await expect(buyButton).toBeVisible();
console.log('[TEST] Clicking Buy button...');
console.log('[TEST] Clicking Buy KRK button...');
await buyButton.click();
// Wait for button to show "Submitting..." then return to "Buy"
// Wait for button to show "Submitting..." then return to "Buy KRK"
console.log('[TEST] Waiting for swap to process...');
try {
await page.getByRole('button', { name: /Submitting/i }).waitFor({ state: 'visible', timeout: 5_000 });
console.log('[TEST] Swap initiated, waiting for completion...');
await page.getByRole('button', { name: 'Buy' }).last().waitFor({ state: 'visible', timeout: 60_000 });
await page.getByRole('button', { name: 'Buy KRK' }).waitFor({ state: 'visible', timeout: 60_000 });
console.log('[TEST] Swap completed!');
} catch (e) {
console.log('[TEST] No "Submitting" state detected, swap may have completed instantly');

View file

@ -175,12 +175,17 @@ test.describe('Max Stake All Tax Rates', () => {
await mintButton.click();
await page.waitForTimeout(3_000);
// Step 2: Buy a large amount of KRK tokens
// Step 2: Buy a large amount of KRK tokens via the get-krk page
console.log('[TEST] Navigating to get-krk page to buy KRK...');
await navigateSPA(page, '/app/get-krk');
await expect(page.getByRole('heading', { name: 'Get $KRK Tokens' })).toBeVisible({ timeout: 10_000 });
console.log('[TEST] Buying KRK tokens (swapping 5 ETH)...');
const ethToSpendInput = page.getByLabel('ETH to spend');
await expect(ethToSpendInput).toBeVisible({ timeout: 15_000 });
await ethToSpendInput.fill('5');
const buyButton = page.getByRole('button', { name: 'Buy' }).last();
const buyButton = page.getByRole('button', { name: 'Buy KRK' });
await expect(buyButton).toBeVisible();
await buyButton.click();
@ -188,7 +193,7 @@ test.describe('Max Stake All Tax Rates', () => {
console.log('[TEST] Waiting for swap to process...');
try {
await page.getByRole('button', { name: /Submitting/i }).waitFor({ state: 'visible', timeout: 5_000 });
await page.getByRole('button', { name: 'Buy' }).last().waitFor({ state: 'visible', timeout: 60_000 });
await page.getByRole('button', { name: 'Buy KRK' }).waitFor({ state: 'visible', timeout: 60_000 });
console.log('[TEST] Swap completed!');
} catch (e) {
console.log('[TEST] Swap may have completed instantly');

View file

@ -105,19 +105,6 @@
</div>
</FCard>
<FCard title="Buy KRK">
<div class="cheats-form">
<template v-if="!canSwap">
<p class="cheats-warning">Connect to the Base Sepolia fork to enable the quick swap helper.</p>
</template>
<template v-else>
<FInput v-model="swapAmount" label="ETH to spend" type="number"></FInput>
<FButton :disabled="swapping" @click="buyKrk">{{ swapping ? 'Submitting' : 'Buy' }}</FButton>
<p class="cheats-hint">Wraps ETH into WETH, approves the swap router, and trades into KRK.</p>
</template>
</div>
</FCard>
<FCard title="Force Recenter">
<div class="cheats-form">
<template v-if="!canTriggerRecenter">
@ -172,7 +159,6 @@ import {
coerceString,
getErrorMessage,
ensureAddress,
useSwapKrk,
} from '@/composables/useSwapKrk';
const toast = useToast();
@ -180,8 +166,6 @@ const statCollection = useStatCollection();
const { address, chainId } = useAccount();
const wagmiConfig: WagmiConfig = config;
const { swapAmount, swapping, canSwap, buyKrk } = useSwapKrk();
const rpcUrl = ref('');
let lastAutoRpcUrl = '';