94 lines
3.4 KiB
TypeScript
94 lines
3.4 KiB
TypeScript
import deploymentsLocal from "../../onchain/deployments-local.json";
|
|
|
|
const LOCAL_PONDER_URL = import.meta.env.VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK ?? "http://127.0.0.1:42069/graphql";
|
|
const LOCAL_TXNBOT_URL = import.meta.env.VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK ?? "http://127.0.0.1:43069";
|
|
const LOCAL_RPC_URL = import.meta.env.VITE_LOCAL_RPC_URL ?? "/rpc/anvil";
|
|
|
|
const localContracts = (deploymentsLocal as any)?.contracts ?? {};
|
|
const localInfra = (deploymentsLocal as any)?.infrastructure ?? {};
|
|
const LOCAL_KRAIKEN = (localContracts.Kraiken ?? "").trim();
|
|
const LOCAL_STAKE = (localContracts.Stake ?? "").trim();
|
|
const LOCAL_LM = (localContracts.LiquidityManager ?? "").trim();
|
|
const LOCAL_WETH = (localInfra.weth ?? "0x4200000000000000000000000000000000000006").trim();
|
|
const LOCAL_ROUTER = "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4";
|
|
|
|
function detectDefaultChainId(): number {
|
|
const envValue = import.meta.env.VITE_DEFAULT_CHAIN_ID;
|
|
if (envValue) {
|
|
const parsed = Number(envValue);
|
|
if (Number.isFinite(parsed)) {
|
|
return parsed;
|
|
}
|
|
}
|
|
|
|
if (typeof window !== "undefined") {
|
|
const host = window.location.hostname.toLowerCase();
|
|
if (host === "localhost" || host === "127.0.0.1" || host === "::1") {
|
|
return 31337;
|
|
}
|
|
}
|
|
|
|
return 84532;
|
|
}
|
|
|
|
export const DEFAULT_CHAIN_ID = detectDefaultChainId();
|
|
|
|
export const chainsData = [
|
|
{
|
|
// local base sepolia fork
|
|
id: 31337,
|
|
graphql: LOCAL_PONDER_URL,
|
|
path: "local",
|
|
stake: LOCAL_STAKE,
|
|
harb: LOCAL_KRAIKEN,
|
|
uniswap: "",
|
|
cheats: {
|
|
weth: LOCAL_WETH,
|
|
swapRouter: LOCAL_ROUTER,
|
|
liquidityManager: LOCAL_LM,
|
|
txnBot: LOCAL_TXNBOT_URL,
|
|
rpc: LOCAL_RPC_URL,
|
|
}
|
|
},
|
|
{
|
|
// sepolia
|
|
id: 11155111,
|
|
graphql: import.meta.env.VITE_PONDER_SEPOLIA ?? "",
|
|
path: "sepolia",
|
|
stake: "0xCd21a41a137BCAf8743E47D048F57D92398f7Da9",
|
|
harb: "0x087F256D11fe533b0c7d372e44Ee0F9e47C89dF9",
|
|
uniswap: "https://app.uniswap.org/swap?chain=mainnet&inputCurrency=NATIVE",
|
|
cheats: null
|
|
}, {
|
|
// base-sepolia (local dev default)
|
|
id: 84532,
|
|
graphql: import.meta.env.VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK ?? LOCAL_PONDER_URL,
|
|
path: "sepoliabase",
|
|
stake: "0xe28020BCdEeAf2779dd47c670A8eFC2973316EE2",
|
|
harb: "0x22c264Ecf8D4E49D1E3CabD8DD39b7C4Ab51C1B8",
|
|
uniswap: "https://app.uniswap.org/swap?chain=mainnet&inputCurrency=NATIVE",
|
|
cheats: {
|
|
weth: "0x4200000000000000000000000000000000000006",
|
|
swapRouter: "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4",
|
|
txnBot: import.meta.env.VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK ?? LOCAL_TXNBOT_URL
|
|
}
|
|
},
|
|
{
|
|
// base mainnet
|
|
id: 8453,
|
|
graphql: import.meta.env.VITE_PONDER_BASE ?? "",
|
|
path: "base",
|
|
stake: "0xed70707fab05d973ad41eae8d17e2bcd36192cfc",
|
|
harb: "0x45caa5929f6ee038039984205bdecf968b954820",
|
|
uniswap: "https://app.uniswap.org/swap?chain=mainnet&inputCurrency=NATIVE",
|
|
cheats: {
|
|
weth: "0x4200000000000000000000000000000000000006",
|
|
swapRouter: "",
|
|
txnBot: import.meta.env.VITE_TXNBOT_BASE ?? ""
|
|
}
|
|
},
|
|
];
|
|
|
|
export function getChain(id:number){
|
|
return chainsData.find((obj) => obj.id === id)
|
|
}
|