Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bob/fix landing #2649

Merged
merged 34 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5fca84b
contracts & client: increase resource precision from 3 to 9 (#2625)
credence0x Jan 7, 2025
06c9e22
Merge branch 'season-1' of https://github.com/BibliothecaDAO/eternum …
credence0x Jan 7, 2025
1a48f2f
update contracts folder structure (#2626)
credence0x Jan 7, 2025
2e99610
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
credence0x Jan 9, 2025
5803a40
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
credence0x Jan 10, 2025
a9bffe8
new production (#2629)
credence0x Jan 16, 2025
c610451
Merge branch 'next' into next-into-season-1
aymericdelab Jan 18, 2025
e4e8f8b
fix build
aymericdelab Jan 18, 2025
ddb62bf
fix build
aymericdelab Jan 19, 2025
8a24dda
fix build
aymericdelab Jan 19, 2025
84c0a45
fix
aymericdelab Jan 19, 2025
e2c694b
fix build
aymericdelab Jan 19, 2025
0d4e6f8
Merge branch 'next' into next-into-season-1
aymericdelab Jan 19, 2025
4718c4c
fix build
aymericdelab Jan 19, 2025
4fd331c
fix
aymericdelab Jan 19, 2025
94a376b
knip clean
aymericdelab Jan 20, 2025
9b9c4de
Move config folder to root
bob0005 Jan 20, 2025
5abea52
- Move game/assets to public folder
bob0005 Jan 20, 2025
1742288
Merge branch 'next-into-season-1' of https://github.com/BibliothecaDA…
bob0005 Jan 20, 2025
cbeff22
fix env and deploy
aymericdelab Jan 20, 2025
6b05341
clean env
aymericdelab Jan 20, 2025
8af9607
remove burner
aymericdelab Jan 20, 2025
ad2f9f4
update contracts
aymericdelab Jan 20, 2025
8f43edc
prepare landing
aymericdelab Jan 20, 2025
282a116
Merge branch 'deploy' into next-into-season-1
aymericdelab Jan 20, 2025
57521f3
pnpm lock
aymericdelab Jan 20, 2025
f9d9055
contracts:scripts:fix torii pid
credence0x Jan 21, 2025
95cf687
update erc721 and erc20 in torii toml in between deploys
credence0x Jan 21, 2025
f47aaad
formatting
bob0005 Jan 21, 2025
ebafc21
Fix landing build
bob0005 Jan 21, 2025
36c5eff
Fix landing build
bob0005 Jan 21, 2025
218ca28
Fix tmp landing build, NEEDS TO BE REVERTED
bob0005 Jan 21, 2025
8f150ff
Merge branch 'next' into bob/fix-landing
bob0005 Jan 21, 2025
24d2394
fix tsconfig
bob0005 Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions client/apps/landing/dojoConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createDojoConfig } from "@dojoengine/core";
import { Chain, getGameManifest } from "../../common/utils";

import { Chain, getGameManifest } from "../../../config/utils/utils";
import { env } from "./env";

const {
Expand All @@ -14,7 +13,7 @@ const {
VITE_PUBLIC_CHAIN,
} = env;

const manifest = getGameManifest(VITE_PUBLIC_CHAIN as Chain);
const manifest = await getGameManifest(VITE_PUBLIC_CHAIN as Chain);

export const dojoConfig = createDojoConfig({
rpcUrl: VITE_PUBLIC_NODE_URL,
Expand Down
3 changes: 2 additions & 1 deletion client/apps/landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"format:check": "npx prettier --check . --root=..",
"lint": "eslint .",
"preview": "vite preview",
"storybook": "storybook dev -p 6006"
"storybook": "storybook dev -p 6006",
"vite-plugin-pwa": "^0.20.5"
Comment on lines +16 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Move vite-plugin-pwa to dependencies section.

The vite-plugin-pwa entry is incorrectly placed in the scripts section. It should be moved to the dependencies section.

  "scripts": {
-   "storybook": "storybook dev -p 6006",
-   "vite-plugin-pwa": "^0.20.5"
+   "storybook": "storybook dev -p 6006"
  },
  "dependencies": {
+   "vite-plugin-pwa": "^0.20.5",
    "@ark-project/core": "3.0.0-beta.1",

Committable suggestion skipped: line range outside the PR's diff.

},
"dependencies": {
"@ark-project/core": "3.0.0-beta.1",
Expand Down
11 changes: 7 additions & 4 deletions client/apps/landing/src/components/modules/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import { Link } from "@tanstack/react-router";
import { Castle, Coins, Gamepad2, Home, PlayCircle, Scale, Sheet, Ship, Twitter } from "lucide-react";
import { TypeH2 } from "../typography/type-h2";

import Discord from "@/assets/icons/discord.svg?react";
import EternumLogo from "@/assets/icons/eternum-new-logo.svg?react";
// import { default as Discord } from "@/assets/icons/discord.svg?react";
// import { default as EternumLogo } from "@/assets/icons/eternum-new-logo.svg?react";
// import Discord from "@/assets/icons/discord.svg?react";
// import EternumLogo from "@/assets/icons/eternum-new-logo.svg?react";

// Menu items.
const items = [
{
Expand Down Expand Up @@ -59,7 +62,7 @@ export function AppSidebar() {
<SidebarContent>
<a href="/">
<div className="flex flex-col items-center">
<EternumLogo className="w-24 h-24 fill-gold mx-auto pt-8" />
{/* <EternumLogo className="w-24 h-24 fill-gold mx-auto pt-8" /> */}
<TypeH2 className="p-3">Eternum</TypeH2>
</div>
</a>
Expand Down Expand Up @@ -95,7 +98,7 @@ export function AppSidebar() {
<Twitter />
</a>
<a href="https://discord.gg/realmsworld" target="_blank" rel="noopener noreferrer">
<Discord className="w-6 h-6 fill-gold" />
{/* <Discord className="w-6 h-6 fill-gold" /> */}
</a>
</div>
</SidebarGroupContent>
Expand Down
6 changes: 3 additions & 3 deletions client/apps/landing/src/components/modules/bridge-fees.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourcesIds } from "@bibliothecadao/eternum";
import { configManager, ResourcesIds } from "@bibliothecadao/eternum";
import { Minus, Plus } from "lucide-react";
import { useMemo } from "react";
import { Button } from "../ui/button";
Expand Down Expand Up @@ -40,7 +40,7 @@ export const BridgeFees = ({
type,
setResourceFees,
}: FeesCollapsibleProps) => {
const bridgeConfig = ETERNUM_CONFIG().bridge;
const bridgeConfig = configManager.getResourceBridgeFeeSplitConfig();

const calculateBridgeFeeDisplayPercent = (percent: number) => {
return (percent * 100) / BRIDGE_FEE_DENOMINATOR;
Expand Down Expand Up @@ -91,7 +91,7 @@ export const BridgeFees = ({
</CollapsibleTrigger>
<CollapsibleContent className="flex flex-col ">
{feesForAllResources.map((fees) => {
const resourceName = ResourcesIds[fees.id as keyof typeof ResourcesIds];
const resourceName = ResourcesIds[fees.id as keyof typeof ResourcesIds].toString();
return (
<div key={fees.id} className="flex flex-col gap-2 py-4 border-b border-gold/15">
<div className="font-semibold text-sm">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Player, ResourcesIds } from "@bibliothecadao/eternum";
import { PlayerInfo, ResourcesIds } from "@bibliothecadao/eternum";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { useState } from "react";
import { Button } from "../ui/button";
Expand All @@ -11,7 +11,7 @@ interface PlayerLeaderboardPanelProps {
/** Title displayed at the top of the leaderboard */
title?: string;
/** Array of players to display in the leaderboard */
players: Player[];
players: PlayerInfo[];
/** Whether to show player rankings */
showRank?: boolean;
/** Custom points suffix (e.g. "pts", "points", etc) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ColorMode } from "@cartridge/controller";
import { mainnet, sepolia } from "@starknet-react/chains";
import { StarknetConfig, argent, braavos, jsonRpcProvider, useInjectedConnectors, voyager } from "@starknet-react/core";
import React, { useCallback } from "react";
import { constants } from "starknet";
import { env } from "../../../env";
import { getResourceAddresses } from "../ui/utils/addresses";
//import { cartridgeController } from "./cartridge-controller";
Expand All @@ -17,18 +18,20 @@ const otherResources = Object.entries(resourceAddresses)
const theme: string = "eternum";
const slot: string = env.VITE_PUBLIC_SLOT;
const namespace: string = "eternum";
const preset: string = "eternum";
const colorMode: ColorMode = "dark";

const cartridgeController = new ControllerConnector({
policies: [],
rpc: "https://api.cartridge.gg/x/starknet/" + env.VITE_PUBLIC_CHAIN,
chains: [{ rpcUrl: env.VITE_PUBLIC_NODE_URL }],
defaultChainId: constants.StarknetChainId.SN_SEPOLIA,
namespace,
slot,
preset,
theme,
colorMode,
tokens: {
erc20: [LORDS, ...otherResources],
},
// namespace,
slot,
});

export function StarknetProvider({ children, onlyCartridge }: { children: React.ReactNode; onlyCartridge?: boolean }) {
Expand Down
12 changes: 6 additions & 6 deletions client/apps/landing/src/components/ui/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { Slot } from "@radix-ui/react-slot";
import { VariantProps, cva } from "class-variance-authority";
import { PanelLeft } from "lucide-react";
import * as React from "react";

import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Separator } from "@/components/ui/separator";
Expand All @@ -11,6 +6,10 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { useIsMobile } from "@/hooks/use-mobile";
import { cn } from "@/lib/utils";
import { Slot } from "@radix-ui/react-slot";
import { VariantProps, cva } from "class-variance-authority";
import { PanelLeft } from "lucide-react";
import * as React from "react";

const SIDEBAR_COOKIE_NAME = "sidebar:state";
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
Expand Down Expand Up @@ -635,5 +634,6 @@ export {
SidebarRail,
SidebarSeparator,
SidebarTrigger,
useSidebar,
useSidebar
};

2 changes: 1 addition & 1 deletion client/apps/landing/src/components/ui/utils/addresses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain, getSeasonAddresses } from "../../../../../../common/utils";
import { Chain, getSeasonAddresses } from "../../../../../../../config/utils/utils";
import { env } from "../../../../env";

export const getResourceAddresses = async () => {
Expand Down
9 changes: 7 additions & 2 deletions client/apps/landing/src/hooks/use-lords-bridged.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { lordsAddress } from "@/config";
// why not working
// import { env } from "env";
import { useEffect, useState } from "react";
import { getGameManifest } from "../../../../common/utils";
import { Chain, getGameManifest } from "../../../../../config/utils/utils";
import { env } from "../../env";
import { useDojo } from "./context/DojoContext";

const { VITE_PUBLIC_CHAIN } = env;

export const useLordsBridgeBalance = () => {
const {
network: { provider },
Expand All @@ -16,7 +19,9 @@ export const useLordsBridgeBalance = () => {

useEffect(() => {
const initManifest = async () => {
const manifest = await getGameManifest(meta.env.VITE_PUBLIC_CHAIN);
const manifest: { contracts?: Array<{ tag: string; address?: string }> } = await getGameManifest(
VITE_PUBLIC_CHAIN as Chain,
);
const bridge = manifest.contracts?.find(
(contract: { tag: string }) => contract.tag === "s1_eternum-resource_bridge_systems",
);
Expand Down
1 change: 1 addition & 0 deletions client/apps/landing/src/hooks/use-rewards.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getLordsAddress } from "@/components/ui/utils/addresses";
import { configManager } from "@bibliothecadao/eternum";
import { useAccount } from "@starknet-react/core";
import { useEffect, useState } from "react";
Expand Down
2 changes: 1 addition & 1 deletion client/apps/landing/src/routes/mint.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Mint() {
[data, realmsAddress],
);

const isDev = meta.env.VITE_PUBLIC_CHAIN === "local";
const isDev = import.meta.env.VITE_PUBLIC_CHAIN === "local" || import.meta.env.VITE_PUBLIC_DEV === "true";

const { deselectAllNfts, isNftSelected, selectBatchNfts, toggleNftSelection, totalSelectedNfts, selectedTokenIds } =
useNftSelection({ userAddress: address as `0x${string}` });
Expand Down
14 changes: 14 additions & 0 deletions client/apps/landing/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@ export type RealmMetadata = {
value: string | number;
}[];
};

export type SeasonPassMint = {
node: {
__typename?: "Token__Balance";
tokenMetadata: {
__typename: "ERC721__Token";
tokenId: string;
metadataDescription: string;
imagePath: string;
contractAddress: string;
metadata: string;
};
};
} | null;
9 changes: 3 additions & 6 deletions client/apps/landing/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"env": ["./env.ts"]
},
"allowJs": true
},
"include": ["src", "env.ts"]
"@/*": ["./src/*"]
}
}
}
1 change: 1 addition & 0 deletions client/apps/landing/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default defineConfig(({ mode }) => {
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@/assets": path.resolve(__dirname, "../../public/assets"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Misaligned public directory configurations

The current setup has inconsistent public directory configurations:

  • publicDir points to ../../common/public
  • @/assets alias points to ../../public/assets
  • Actual assets are located in client/public/assets/

These paths should be aligned to use the same base public directory to ensure correct asset serving and building.

🔗 Analysis chain

Verify assets directory structure and alignment.

The new alias points to ../../public/assets while the publicDir is set to ../../common/public. Verify that this directory structure is intentional and the assets are in the correct location.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if both directories exist and their relationship
echo "Checking public directories..."
fd -t d "public$" --max-depth 3
echo "Checking assets directories..."
fd -t d "assets$" --max-depth 4

Length of output: 246


Script:

#!/bin/bash
# Check the vite config file for publicDir setting
echo "Checking vite.config.ts content..."
cat client/apps/landing/vite.config.ts

Length of output: 1145

},
},
server: {
Expand Down
4 changes: 2 additions & 2 deletions config/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function getSeasonAddresses(chain: Chain): Promise<SeasonAddresses>
const ADDRESSES_FILE = `../../contracts/common/addresses/${chain}.json`;
console.log({ ADDRESSES_FILE });
try {
const seasonAddressesJson = (await import(ADDRESSES_FILE)).default;
const seasonAddressesJson = (await import(/* @vite-ignore */ ADDRESSES_FILE)).default;

return seasonAddressesJson;
} catch (error) {
Expand All @@ -38,7 +38,7 @@ interface GameManifest {
export async function getGameManifest(chain: Chain): Promise<GameManifest> {
const MANIFEST_FILE = `../../contracts/game/manifest_${chain}.json`;
try {
const manifest = (await import(MANIFEST_FILE)).default;
const manifest = (await import(/* @vite-ignore */ MANIFEST_FILE)).default;
return manifest;
} catch (error) {
throw new Error(`Failed to load game manifest for chain ${chain}: ${error}`);
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/modelManager/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class ClientConfigManager {

// this.resourceInputs[Number(resourceType)] = inputs;
// }
return ;
this.resourceInputs = Object.entries(this.config.resources.resourceInputs).reduce(
(acc, [key, inputs]) => {
acc[Number(key)] = inputs.map((input: { resource: number; amount: number }) => ({
Expand Down Expand Up @@ -162,6 +163,7 @@ export class ClientConfigManager {
// }
// this.realmUpgradeCosts[index] = resources;
// }
return;
this.realmUpgradeCosts = Object.fromEntries(
Object.entries(this.config.realmUpgradeCosts).map(([key, costs]) => [
key,
Expand Down Expand Up @@ -198,6 +200,7 @@ export class ClientConfigManager {
// this.resourceBuildingCosts[Number(resourceId)] = resourceCosts;

// }
return;
this.resourceBuildingCosts = Object.fromEntries(
Object.entries(this.config.resources.resourceBuildingCosts).map(([key, costs]) => [
key,
Expand Down Expand Up @@ -235,6 +238,7 @@ export class ClientConfigManager {
// }
// this.buildingCosts[Number(buildingType)] = resourceCosts;
// }
return;
this.buildingCosts = Object.fromEntries(
Object.entries(this.config.buildings.buildingCosts).map(([key, costs]) => [
key,
Expand Down
Loading