diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md index ab7c9f0..7d70df8 100644 --- a/docs/ENVIRONMENT.md +++ b/docs/ENVIRONMENT.md @@ -81,6 +81,15 @@ docker inspect landing --format '{{.NetworkSettings.Networks.harb_harb-network.I For testing login: `lobsterDao`, `test123`, `lobster-x010syqe?412!` (defined in `web-app/src/views/LoginView.vue`) +## Webapp Environment Variables + +| Variable | Default | Set in docker-compose | Purpose | +|---|---|---|---| +| `VITE_ENABLE_LOCAL_SWAP` | `false` (unset) | `true` | Show inline ETH→$KRK swap widget on Get KRK page instead of the Uniswap link. Enable for local dev; leave unset for production builds. | +| `VITE_KRAIKEN_ADDRESS` | from `deployments-local.json` | via `contracts.env` | Override KRK token address. | +| `VITE_STAKE_ADDRESS` | from `deployments-local.json` | via `contracts.env` | Override Stake contract address. | +| `VITE_DEFAULT_CHAIN_ID` | auto-detected (31337 on localhost) | — | Force the default chain. | + ## Contract Addresses After bootstrap, addresses are in `/home/debian/harb/tmp/containers/contracts.env`. diff --git a/web-app/src/components/LocalSwapWidget.vue b/web-app/src/components/LocalSwapWidget.vue index 716ec4d..b26cb5d 100644 --- a/web-app/src/components/LocalSwapWidget.vue +++ b/web-app/src/components/LocalSwapWidget.vue @@ -1,7 +1,7 @@ @@ -28,6 +28,7 @@ import { useWallet } from '@/composables/useWallet'; const toast = useToast(); const { address, chainId } = useAccount(); +const { loadBalance } = useWallet(); const swapAmount = ref('0.1'); const swapping = ref(false); @@ -240,17 +241,16 @@ async function buyKrk() { fee: 10_000, recipient: caller, amountIn: amount, - amountOutMinimum: 0n, + amountOutMinimum: 0n, // no slippage protection — acceptable on no-MEV local anvil sqrtPriceLimitX96: 0n, }, ], chainId: currentChainId, }); - const { loadBalance } = useWallet(); await loadBalance(); - toast.success('Swap submitted. Watch your wallet for KRK.'); + toast.success('Swap complete. $KRK has been added to your wallet.'); } catch (error: unknown) { toast.error(getErrorMessage(error, 'Swap failed')); } finally { diff --git a/web-app/src/views/CheatsView.vue b/web-app/src/views/CheatsView.vue index c7a8a62..66f772c 100644 --- a/web-app/src/views/CheatsView.vue +++ b/web-app/src/views/CheatsView.vue @@ -172,6 +172,7 @@ import { const toast = useToast(); const statCollection = useStatCollection(); const { address, chainId } = useAccount(); +const { loadBalance } = useWallet(); const wagmiConfig: WagmiConfig = config; const rpcUrl = ref(''); @@ -1056,13 +1057,10 @@ async function buyKrk() { ], chainId, }); - - // FIX: Refresh KRK balance immediately after swap completes - // This ensures the balance is up-to-date when navigating to the stake page - const { loadBalance } = useWallet(); + await loadBalance(); - - toast.success('Swap submitted. Watch your wallet for KRK.'); + + toast.success('Swap complete. $KRK has been added to your wallet.'); } catch (error: unknown) { toast.error(getErrorMessage(error, 'Swap failed')); } finally {