fill stake e2e

This commit is contained in:
johba 2025-10-08 15:51:49 +00:00
parent 30ed4aa072
commit aa1ddfcecd
6 changed files with 610 additions and 12 deletions

View file

@ -2,9 +2,9 @@ import deploymentsLocal from '../../onchain/deployments-local.json';
const env = import.meta.env;
const LOCAL_PONDER_URL = env.VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK ?? '/api/graphql';
const LOCAL_TXNBOT_URL = env.VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK ?? '/api/txn';
const LOCAL_RPC_URL = env.VITE_LOCAL_RPC_URL ?? '/api/rpc';
const LOCAL_PONDER_PATH = '/api/graphql';
const LOCAL_TXNBOT_PATH = '/api/txn';
const LOCAL_RPC_PATH = '/api/rpc';
interface DeploymentContracts {
Kraiken?: string;
@ -45,11 +45,28 @@ function detectDefaultChainId(): number {
export const DEFAULT_CHAIN_ID = detectDefaultChainId();
function resolveLocalEndpoint(value: string | undefined, fallback: string): string {
const candidate = (value ?? fallback).trim();
if (!candidate) {
return fallback;
}
if (candidate.startsWith('http://') || candidate.startsWith('https://')) {
return candidate;
}
return candidate.startsWith('/') ? candidate : `/${candidate}`;
}
const LOCAL_GRAPHQL_ENDPOINT = resolveLocalEndpoint(env.VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK, LOCAL_PONDER_PATH);
const LOCAL_TXNBOT_ENDPOINT = resolveLocalEndpoint(env.VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK, LOCAL_TXNBOT_PATH);
const LOCAL_RPC_ENDPOINT = resolveLocalEndpoint(env.VITE_LOCAL_RPC_URL, LOCAL_RPC_PATH);
export const chainsData = [
{
// local base sepolia fork
id: 31337,
graphql: LOCAL_PONDER_URL,
graphql: LOCAL_GRAPHQL_ENDPOINT,
path: 'local',
stake: LOCAL_STAKE,
harb: LOCAL_KRAIKEN,
@ -58,14 +75,14 @@ export const chainsData = [
weth: LOCAL_WETH,
swapRouter: LOCAL_ROUTER,
liquidityManager: LOCAL_LM,
txnBot: LOCAL_TXNBOT_URL,
rpc: LOCAL_RPC_URL,
txnBot: LOCAL_TXNBOT_ENDPOINT,
rpc: LOCAL_RPC_ENDPOINT,
},
},
{
// sepolia
id: 11155111,
graphql: import.meta.env.VITE_PONDER_SEPOLIA ?? '',
graphql: env.VITE_PONDER_SEPOLIA ?? '',
path: 'sepolia',
stake: '0xCd21a41a137BCAf8743E47D048F57D92398f7Da9',
harb: '0x087F256D11fe533b0c7d372e44Ee0F9e47C89dF9',
@ -75,7 +92,7 @@ export const chainsData = [
{
// base-sepolia (local dev default)
id: 84532,
graphql: import.meta.env.VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK ?? LOCAL_PONDER_URL,
graphql: LOCAL_GRAPHQL_ENDPOINT,
path: 'sepoliabase',
stake: '0xe28020BCdEeAf2779dd47c670A8eFC2973316EE2',
harb: '0x22c264Ecf8D4E49D1E3CabD8DD39b7C4Ab51C1B8',
@ -83,13 +100,13 @@ export const chainsData = [
cheats: {
weth: '0x4200000000000000000000000000000000000006',
swapRouter: '0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4',
txnBot: import.meta.env.VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK ?? LOCAL_TXNBOT_URL,
txnBot: LOCAL_TXNBOT_ENDPOINT,
},
},
{
// base mainnet
id: 8453,
graphql: import.meta.env.VITE_PONDER_BASE ?? '',
graphql: env.VITE_PONDER_BASE ?? '',
path: 'base',
stake: '0xed70707fab05d973ad41eae8d17e2bcd36192cfc',
harb: '0x45caa5929f6ee038039984205bdecf968b954820',
@ -97,7 +114,7 @@ export const chainsData = [
cheats: {
weth: '0x4200000000000000000000000000000000000006',
swapRouter: '',
txnBot: import.meta.env.VITE_TXNBOT_BASE ?? '',
txnBot: env.VITE_TXNBOT_BASE ?? '',
},
},
];

View file

@ -27,7 +27,10 @@ class ChainConfigService {
if (!normalized) {
throw new Error(`${label} endpoint not configured for chain ${chainId}.`);
}
return normalized;
if (normalized.startsWith('http://') || normalized.startsWith('https://')) {
return normalized;
}
return normalized.startsWith('/') ? normalized : `/${normalized}`;
}
}