-
Notifications
You must be signed in to change notification settings - Fork 52
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
Next into season 1 #2647
Next into season 1 #2647
Conversation
* contracts & client: increase resource precision from 3 to 9 * contracts & discord-bot: update folder structure * rustfmt
* new production wip * new production wip * production simplified * new production compiles * update production implementation * scarb fmt * improve scripts * update scripts * improve scripts * knip (#2635) * fix knip * fixed landing knip * fix knip balancing * knip * improve scripts * prettier (#2636) * clean * add prettier rules * update prettier ignore * prettier format * gql codegen * Fix lint CI * scarb fmt --------- Co-authored-by: Bob <wastchenko.constantin@gmail.com> * improve configuration * improve configuration * Enh/clean assets (#2637) * Delete deprecated pngs from /game * Delete deprecated mp3 from /game * Consolidate public assets * Adapt imports * Fix spelling * improve configuration * Fix naming conventions (#2638) * Fix naming conventions in game directory * fix build * Kebab * fix imports * adapt naming conventions * formatting * knip * Formatting * update policies (#2639) * update policies * fix knip * prettier * improve scripts * improve config deploy flow based on env * improve config deploy flow based on env * improve config deploy flow based on env * fix indexing * fix indexing * add permisson revoke script * ++Refactor use-armies and clean battles (#2640) * clean battles * refactor use-armies * refactor use bank * update * working client * working client * rename s0_eternum to s1_eternum * update world address * update env * Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into feat/labor --------- Co-authored-by: raschel <38816784+aymericdelab@users.noreply.github.com> Co-authored-by: Bob <wastchenko.constantin@gmail.com> Co-authored-by: Bob <80072466+bob0005@users.noreply.github.com>
Hi @aymericdelab! You need to be added as a user to interact with me. Please ask @ponderingdemocritus to add you on the settings page. You are receiving this comment because I am set to review all PRs. That is configurable here. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Caution Review failedThe pull request is closed. Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
client/apps/balancing/src/components/modules/resource-table.tsxOops! Something went wrong! :( ESLint: 9.18.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by WalkthroughThis pull request introduces a comprehensive update across multiple repositories and applications, focusing on version migration from "s0_eternum" to "s1_eternum". The changes span configuration management, environment variables, resource handling, and model type updates. Key modifications include transitioning from static global configurations to dynamic configuration retrieval, updating model identifiers, and streamlining address and resource management. Changes
Sequence DiagramsequenceDiagram
participant Client as Client Application
participant Config as Configuration Manager
participant Addresses as Address Utility
participant Blockchain as Blockchain Network
Client->>Config: Request Configuration
Config->>Blockchain: Fetch Dynamic Configuration
Blockchain-->>Config: Return Configuration
Config-->>Client: Provide Configuration
Client->>Addresses: Request Resource Addresses
Addresses->>Blockchain: Retrieve Addresses
Blockchain-->>Addresses: Return Addresses
Addresses-->>Client: Provide Addresses
Possibly related PRs
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Failed to generate code suggestions for PR |
- fix build
…O/eternum into next-into-season-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 23
🔭 Outside diff range comments (8)
client/apps/game/src/hooks/helpers/use-quests.ts (1)
Line range hint
34-41
: Add missing dependencies to theuseMemo
hookThe
quests
array usesquestStatus
inside theuseMemo
hook, but the dependency array is empty. To ensure that the memoization works correctly and the component re-renders whenquestStatus
changes, includequestStatus
in the dependency array.Apply this diff to fix the dependency array:
}, []); + }, [questStatus]);
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/landing/src/hooks/query/entities.tsx (1)
Line range hint
5-13
: Version mismatch between query and fragment.The query uses
s0EternumOwnerModels
but the fragment usess1_eternum_Realm
. This inconsistency could lead to runtime errors. Consider updating the query to use the s1 version consistently.- s0EternumOwnerModels(where: { address: $accountAddress }, limit: 8000) { + s1EternumOwnerModels(where: { address: $accountAddress }, limit: 8000) {client/apps/game-docs/docs/components/ResourceTable.tsx (1)
Line range hint
1-75
: Format the file with Prettier.The pipeline indicates formatting issues that need to be addressed.
Please run Prettier on this file to resolve formatting issues.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/components/TroopsTable.tsx (1)
Line range hint
1-85
: Format the file with Prettier.The pipeline indicates formatting issues that need to be addressed.
Please run Prettier on this file to resolve formatting issues.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/balancing/src/components/modules/resource-table.tsx (1)
Line range hint
1-150
: Format the file with Prettier.The pipeline indicates formatting issues that need to be addressed.
Run Prettier to format the file:
npx prettier --write "client/apps/balancing/src/components/modules/resource-table.tsx"
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/landing/.env.sepolia (1)
Line range hint
1-2
: Critical: Secure the master private key.The master private key is exposed in plaintext in the environment file. This poses a significant security risk if the file is accidentally committed or shared.
Consider:
- Using a secure key management service
- Adding this file to
.gitignore
- Creating a template file (
.env.sepolia.example
) with placeholder valuesclient/apps/game-docs/docs/pages/mechanics/realm/realm.mdx (1)
Line range hint
1-100
: Format the file with Prettier.The pipeline indicates formatting issues that need to be addressed.
Run Prettier on this file to fix the formatting issues.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/pages/mechanics/realm/buildings.mdx (1)
Line range hint
1-100
: Format the file with Prettier.The pipeline indicates formatting issues that need to be addressed.
Run Prettier on this file to fix the formatting issues.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
♻️ Duplicate comments (1)
client/apps/game/.env.slot (1)
1-2
:⚠️ Potential issue
⚠️ Security Risk: Sensitive information exposed in environment fileSimilar to .env.sepolia, the master address and private key should not be committed to version control.
🧰 Tools
🪛 Gitleaks (8.21.2)
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🧹 Nitpick comments (19)
client/apps/game/src/hooks/helpers/use-quests.ts (1)
Line range hint
1-70
: Format the code with PrettierThe linter has detected code style issues. Please format the file with Prettier to adhere to the project's coding standards.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/utils/config.ts (2)
4-7
: Consider caching the configuration to avoid redundant network callsEach call to
ETERNUM_CONFIG
fetches the configuration, which could result in unnecessary network requests if the function is called multiple times. Implement caching to store the configuration after the first retrieval.Apply this diff to cache the configuration:
-export const ETERNUM_CONFIG = async () => { - const config = await getConfigFromNetwork(env.VITE_PUBLIC_CHAIN! as NetworkType); - return config; -}; +let cachedConfig: Awaited<ReturnType<typeof getConfigFromNetwork>> | null = null; + +export const ETERNUM_CONFIG = async () => { + if (!cachedConfig) { + cachedConfig = await getConfigFromNetwork(env.VITE_PUBLIC_CHAIN as NetworkType); + } + return cachedConfig; +};
4-7
: RenameETERNUM_CONFIG
togetEternumConfig
for claritySince
ETERNUM_CONFIG
is a function that retrieves the configuration, renaming it togetEternumConfig
can enhance readability and follow naming conventions for functions.Apply this diff to rename the function:
-export const ETERNUM_CONFIG = async () => { +export const getEternumConfig = async () => {Ensure to update all references to this function throughout the codebase.
client/apps/game/src/utils/addresses.ts (1)
4-7
: Simplify thegetResourceAddresses
function.The intermediate variable assignment is unnecessary. Consider simplifying the function:
export const getResourceAddresses = async () => { - const addresses = (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).resources; - return addresses; + return (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).resources; };client/apps/game/src/hooks/context/signing-policy.ts (1)
Line range hint
24-25
: Simplify chain ID logic and add environment validation.The chain ID ternary expression could be simplified, and it would be beneficial to validate the environment variable.
- chainId: env.VITE_PUBLIC_CHAIN == "mainnet" ? "SN_MAIN" : "SN_SEPOLIA", + chainId: `SN_${env.VITE_PUBLIC_CHAIN === "mainnet" ? "MAIN" : "SEPOLIA"}`,Also, consider adding validation:
const VALID_CHAINS = ["mainnet", "testnet"] as const; if (!VALID_CHAINS.includes(env.VITE_PUBLIC_CHAIN as any)) { throw new Error(`Invalid chain: ${env.VITE_PUBLIC_CHAIN}`); }client/apps/game-docs/docs/utils/formatting.tsx (1)
35-43
: Cache config access for currency formatting functions.Multiple functions are accessing
ETERNUM_CONFIG()
independently, which could lead to unnecessary API calls.Use the cached precision value in these functions as well:
-export const currencyFormat = (num: number, decimals: number): string => { +export const currencyFormat = async (num: number, decimals: number): Promise<string> => { + const precision = await getResourcePrecision(); - return formatNumber(num / ETERNUM_CONFIG().resources.resourcePrecision, decimals); + return formatNumber(num / precision, decimals); }; -export function multiplyByPrecision(value: number): number { +export async function multiplyByPrecision(value: number): Promise<number> { + const precision = await getResourcePrecision(); - return Math.floor(value * ETERNUM_CONFIG().resources.resourcePrecision); + return Math.floor(value * precision); } -export function divideByPrecision(value: number): number { +export async function divideByPrecision(value: number): Promise<number> { + const precision = await getResourcePrecision(); - return value / ETERNUM_CONFIG().resources.resourcePrecision; + return value / precision; }client/apps/game/src/utils/utils.ts (2)
11-11
: Consider strengthening type definitions.The
Chain
type provides good type safety, but theGameManifest
interface could be more specific than[key: string]: unknown
.Consider defining explicit fields in the
GameManifest
interface based on the actual manifest structure.Also applies to: 57-59
67-86
: Consider caching the manifest results.The
getGameManifest
function loads JSON files on every call. Consider memoizing the results to improve performance.+const manifestCache: Record<Chain, GameManifest> = {}; export function getGameManifest(chain: Chain): GameManifest { try { + if (manifestCache[chain]) return manifestCache[chain]; switch (chain) { case "local": - return manifestLocal; + return manifestCache[chain] = manifestLocal; case "sepolia": - return manifestSepolia; + return manifestCache[chain] = manifestSepolia; case "mainnet": - return manifestMainnet; + return manifestCache[chain] = manifestMainnet;client/apps/game/src/three/managers/building-preview.ts (1)
Line range hint
71-72
: Remove debug console.log statements.Debug logging statements should be removed before merging to production.
- console.log("categoryMap", categoryMap); - if (categoryMap) { - console.log("building", categoryMap.get(building + "")); + if (categoryMap) {client/apps/game/src/ui/components/structures/construction/structure-construction-menu.tsx (2)
6-6
: Remove commented-out code.Remove commented-out imports and configuration initialization. If these are kept for reference, they should be documented in the commit message or PR description instead.
Also applies to: 18-18
54-58
: Remove commented-out scale function.The commented-out
scaleResourceCostMinMax
function and its arguments should be removed if they're no longer needed.client/apps/game/src/ui/components/resources/resource-chip.tsx (2)
59-65
: Consider memoizing production ends check.The
productionEndsAt
calculation could be combined with theproductionRate
calculation to reduce the number of memo hooks.const productionRate = useMemo(() => { - return Number(divideByPrecision(Number(production?.production_rate || 0))); + const rate = Number(divideByPrecision(Number(production?.production_rate || 0))); + const endsAt = resourceManager.getProductionEndsAt(); + return { rate, endsAt }; - }, [production]); + }, [production, resourceManager]); - const productionEndsAt = useMemo(() => { - return resourceManager.getProductionEndsAt(); - }, [production]);
Line range hint
138-170
: Improve conditional rendering readability.The nested conditional rendering with multiple ternary operators makes the code harder to read. Consider extracting the production status display into a separate component.
Example:
const ProductionStatus = ({ productionRate, productionEndsAt, currentTick, reachedMaxCap }: ProductionStatusProps) => { // ... render logic };client/apps/landing/src/components/modules/bridge-out-step-2.tsx (1)
61-63
: Add error handling for resource address retrieval.The function should handle potential failures when retrieving resource addresses to prevent undefined behavior.
- const resourceAddresses = await getResourceAddresses(); + try { + const resourceAddresses = await getResourceAddresses(); + if (!resourceAddresses) { + throw new Error("Failed to retrieve resource addresses"); + } + } catch (error) { + console.error("Failed to retrieve resource addresses:", error); + throw error; + }client/apps/landing/src/components/modules/bridge-out-step-1.tsx (1)
Line range hint
134-144
: Add error handling for resource address retrieval and validation.The function should handle potential failures in resource address retrieval and validate the addresses before use.
- const resourceAddresses = await getResourceAddresses(); + try { + const resourceAddresses = await getResourceAddresses(); + if (!resourceAddresses) { + throw new Error("Failed to retrieve resource addresses"); + } + const validResources = await Promise.all( + Object.entries(selectedResourceAmounts) + .filter(([id, amount]) => amount > 0) + .map(async ([id, amount]) => { + const resourceKey = ResourcesIds[id].toLocaleUpperCase() as keyof typeof resourceAddresses; + const tokenAddress = resourceAddresses[resourceKey]?.[1]; + if (!tokenAddress) { + throw new Error(`Invalid token address for resource ${id}`); + } + return { + tokenAddress, + amount: BigInt(amount * RESOURCE_PRECISION), + }; + }), + ); + } catch (error) { + console.error("Failed to process resources:", error); + throw error; + }client/apps/landing/src/components/modules/bridge-in.tsx (2)
74-74
: Consider using a type alias for resource addresses.The state type could be more maintainable with a dedicated type alias.
+type ResourceAddressMap = { [key: string]: [number, string] }; - const [resourceAddresses, setResourceAddresses] = useState<{ [key: string]: [number, string] }>({}); + const [resourceAddresses, setResourceAddresses] = useState<ResourceAddressMap>({});🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
131-133
: Add error handling and loading state for address fetching.The useEffect hook should handle errors and indicate loading state.
+ const [isAddressesLoading, setIsAddressesLoading] = useState(true); useEffect(() => { const fetchAddresses = async () => { + setIsAddressesLoading(true); + try { const addresses = await getResourceAddresses(); + if (!addresses) { + throw new Error("Failed to retrieve resource addresses"); + } setResourceAddresses(addresses); + } catch (error) { + console.error("Failed to fetch addresses:", error); + } finally { + setIsAddressesLoading(false); + } }; fetchAddresses(); }, []);🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/ui/components/trading/market-order-panel.tsx (1)
30-30
: Add documentation for the ONE_MONTH constant.Document the purpose and unit of measurement for better maintainability.
+/** Number of seconds in a month (30.42 days) */ const ONE_MONTH = 2628000;
client/apps/game/.env.slot (1)
25-29
: Remove trailing whitespace in environment variablesThe following lines contain trailing whitespace which might cause issues:
- VITE_PUBLIC_CHAIN
- VITE_PUBLIC_SLOT
- VITE_PUBLIC_NODE_URL
- VITE_PUBLIC_TORII
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (118)
bot/discord/Cargo.lock
is excluded by!**/*.lock
client/public/assets/icons/back.svg
is excluded by!**/*.svg
client/public/assets/icons/battle.svg
is excluded by!**/*.svg
client/public/assets/icons/burn.svg
is excluded by!**/*.svg
client/public/assets/icons/cartridge-small.svg
is excluded by!**/*.svg
client/public/assets/icons/castle.svg
is excluded by!**/*.svg
client/public/assets/icons/check.svg
is excluded by!**/*.svg
client/public/assets/icons/checkbox-checked.svg
is excluded by!**/*.svg
client/public/assets/icons/checkbox-minus.svg
is excluded by!**/*.svg
client/public/assets/icons/checkbox-unchecked.svg
is excluded by!**/*.svg
client/public/assets/icons/chest.svg
is excluded by!**/*.svg
client/public/assets/icons/coins.svg
is excluded by!**/*.svg
client/public/assets/icons/collapse-left.svg
is excluded by!**/*.svg
client/public/assets/icons/combat.svg
is excluded by!**/*.svg
client/public/assets/icons/common/arrow-left-fill.svg
is excluded by!**/*.svg
client/public/assets/icons/common/arrow-left.svg
is excluded by!**/*.svg
client/public/assets/icons/common/arrow-right.svg
is excluded by!**/*.svg
client/public/assets/icons/common/arrow-separator.svg
is excluded by!**/*.svg
client/public/assets/icons/common/bagpack.svg
is excluded by!**/*.svg
client/public/assets/icons/common/bank.svg
is excluded by!**/*.svg
client/public/assets/icons/common/caret-down-fill.svg
is excluded by!**/*.svg
client/public/assets/icons/common/caret-down.svg
is excluded by!**/*.svg
client/public/assets/icons/common/caret-up.svg
is excluded by!**/*.svg
client/public/assets/icons/common/checkmark.svg
is excluded by!**/*.svg
client/public/assets/icons/common/city.svg
is excluded by!**/*.svg
client/public/assets/icons/common/clock.svg
is excluded by!**/*.svg
client/public/assets/icons/common/coin.svg
is excluded by!**/*.svg
client/public/assets/icons/common/collapse.svg
is excluded by!**/*.svg
client/public/assets/icons/common/copy.svg
is excluded by!**/*.svg
client/public/assets/icons/common/cross-circle.svg
is excluded by!**/*.svg
client/public/assets/icons/common/cross-swords.svg
is excluded by!**/*.svg
client/public/assets/icons/common/cross.svg
is excluded by!**/*.svg
client/public/assets/icons/common/crown-circle-outline.svg
is excluded by!**/*.svg
client/public/assets/icons/common/danger.svg
is excluded by!**/*.svg
client/public/assets/icons/common/envelope.svg
is excluded by!**/*.svg
client/public/assets/icons/common/expand.svg
is excluded by!**/*.svg
client/public/assets/icons/common/eye.svg
is excluded by!**/*.svg
client/public/assets/icons/common/farm.svg
is excluded by!**/*.svg
client/public/assets/icons/common/fast-forward.svg
is excluded by!**/*.svg
client/public/assets/icons/common/forward-burger.svg
is excluded by!**/*.svg
client/public/assets/icons/common/happy.svg
is excluded by!**/*.svg
client/public/assets/icons/common/headline-big-left.svg
is excluded by!**/*.svg
client/public/assets/icons/common/headline-big-right.svg
is excluded by!**/*.svg
client/public/assets/icons/common/headline-left.svg
is excluded by!**/*.svg
client/public/assets/icons/common/headline-right.svg
is excluded by!**/*.svg
client/public/assets/icons/common/hex.svg
is excluded by!**/*.svg
client/public/assets/icons/common/import.svg
is excluded by!**/*.svg
client/public/assets/icons/common/info.svg
is excluded by!**/*.svg
client/public/assets/icons/common/leaderboard.svg
is excluded by!**/*.svg
client/public/assets/icons/common/lightning.svg
is excluded by!**/*.svg
client/public/assets/icons/common/lock-closed.svg
is excluded by!**/*.svg
client/public/assets/icons/common/lock-open.svg
is excluded by!**/*.svg
client/public/assets/icons/common/map.svg
is excluded by!**/*.svg
client/public/assets/icons/common/message.svg
is excluded by!**/*.svg
client/public/assets/icons/common/minimize.svg
is excluded by!**/*.svg
client/public/assets/icons/common/more.svg
is excluded by!**/*.svg
client/public/assets/icons/common/muted.svg
is excluded by!**/*.svg
client/public/assets/icons/common/pen.svg
is excluded by!**/*.svg
client/public/assets/icons/common/people.svg
is excluded by!**/*.svg
client/public/assets/icons/common/pick-axe-second.svg
is excluded by!**/*.svg
client/public/assets/icons/common/pick-axe.svg
is excluded by!**/*.svg
client/public/assets/icons/common/plus-sign.svg
is excluded by!**/*.svg
client/public/assets/icons/common/protected.svg
is excluded by!**/*.svg
client/public/assets/icons/common/ratio.svg
is excluded by!**/*.svg
client/public/assets/icons/common/red-dot.svg
is excluded by!**/*.svg
client/public/assets/icons/common/refresh.svg
is excluded by!**/*.svg
client/public/assets/icons/common/relic.svg
is excluded by!**/*.svg
client/public/assets/icons/common/settings.svg
is excluded by!**/*.svg
client/public/assets/icons/common/shield.svg
is excluded by!**/*.svg
client/public/assets/icons/common/skull.svg
is excluded by!**/*.svg
client/public/assets/icons/common/swap.svg
is excluded by!**/*.svg
client/public/assets/icons/common/trashcan.svg
is excluded by!**/*.svg
client/public/assets/icons/common/unmuted.svg
is excluded by!**/*.svg
client/public/assets/icons/common/village.svg
is excluded by!**/*.svg
client/public/assets/icons/common/weight.svg
is excluded by!**/*.svg
client/public/assets/icons/common/world.svg
is excluded by!**/*.svg
client/public/assets/icons/compass.svg
is excluded by!**/*.svg
client/public/assets/icons/controller.svg
is excluded by!**/*.svg
client/public/assets/icons/crown.svg
is excluded by!**/*.svg
client/public/assets/icons/digging.svg
is excluded by!**/*.svg
client/public/assets/icons/disconnect.svg
is excluded by!**/*.svg
client/public/assets/icons/dojo-mark-full-dark.svg
is excluded by!**/*.svg
client/public/assets/icons/eternum-new-logo.svg
is excluded by!**/*.svg
client/public/assets/icons/eternum-words-logo.svg
is excluded by!**/*.svg
client/public/assets/icons/eye.svg
is excluded by!**/*.svg
client/public/assets/icons/fire.svg
is excluded by!**/*.svg
client/public/assets/icons/flag.svg
is excluded by!**/*.svg
client/public/assets/icons/formula/equation.svg
is excluded by!**/*.svg
client/public/assets/icons/helmet.svg
is excluded by!**/*.svg
client/public/assets/icons/info.svg
is excluded by!**/*.svg
client/public/assets/icons/lock.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/anger.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/brilliance.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/detection.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/enlightenment.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/fox.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/fury.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/giants.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/gods.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/perfection.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/power.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/protection.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/rage.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/reflection.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/skill.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/titans.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/twins.svg
is excluded by!**/*.svg
client/public/assets/icons/orders/vitriol.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/Adamantine.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/AlchemicalSilver.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/Cloth.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/Coal.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/ColdIron.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/Copper.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/DeepCrystal.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/DemonHide.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/DesertGlass.svg
is excluded by!**/*.svg
client/public/assets/icons/resources/Diamonds.svg
is excluded by!**/*.svg
📒 Files selected for processing (82)
.github/workflows/discord-bot.yml
(4 hunks)bot/discord/src/actors/tick_sender.rs
(2 hunks)bot/discord/src/actors/torii_client_subscriber.rs
(2 hunks)bot/discord/src/eternum_enums.rs
(1 hunks)bot/discord/src/events/battle_pillage.rs
(2 hunks)bot/discord/src/events/battle_start.rs
(1 hunks)client/apps/balancing/src/components/modules/resource-table.tsx
(4 hunks)client/apps/game-docs/docs/components/BuildingCosts.tsx
(1 hunks)client/apps/game-docs/docs/components/QuestRewards.tsx
(1 hunks)client/apps/game-docs/docs/components/ResourceTable.tsx
(1 hunks)client/apps/game-docs/docs/components/TroopsTable.tsx
(2 hunks)client/apps/game-docs/docs/pages/development/contracts.mdx
(1 hunks)client/apps/game-docs/docs/pages/mechanics/hyperstructures.mdx
(3 hunks)client/apps/game-docs/docs/pages/mechanics/key-concepts.mdx
(1 hunks)client/apps/game-docs/docs/pages/mechanics/military/combat.mdx
(2 hunks)client/apps/game-docs/docs/pages/mechanics/realm/buildings.mdx
(1 hunks)client/apps/game-docs/docs/pages/mechanics/realm/realm.mdx
(3 hunks)client/apps/game-docs/docs/pages/mechanics/resources/storage.mdx
(2 hunks)client/apps/game-docs/docs/pages/mechanics/trading.mdx
(2 hunks)client/apps/game-docs/docs/utils/formatting.tsx
(2 hunks)client/apps/game/.env.local
(1 hunks)client/apps/game/.env.local.sample
(0 hunks)client/apps/game/.env.mainnet
(1 hunks)client/apps/game/.env.preview
(0 hunks)client/apps/game/.env.production
(0 hunks)client/apps/game/.env.sepolia
(1 hunks)client/apps/game/.env.slot
(1 hunks)client/apps/game/.gitignore
(1 hunks)client/apps/game/dojoConfig.ts
(2 hunks)client/apps/game/env.ts
(1 hunks)client/apps/game/src/dojo/queries.ts
(5 hunks)client/apps/game/src/dojo/sync.ts
(7 hunks)client/apps/game/src/hooks/context/signing-policy.ts
(1 hunks)client/apps/game/src/hooks/context/starknet-provider.tsx
(3 hunks)client/apps/game/src/hooks/helpers/use-quests.ts
(3 hunks)client/apps/game/src/hooks/store/use-ui-store.ts
(0 hunks)client/apps/game/src/main.tsx
(1 hunks)client/apps/game/src/three/managers/building-preview.ts
(1 hunks)client/apps/game/src/three/scenes/worldmap.ts
(4 hunks)client/apps/game/src/ui/components/cityview/realm/settle-realm-component.tsx
(2 hunks)client/apps/game/src/ui/components/construction/select-preview-building.tsx
(2 hunks)client/apps/game/src/ui/components/hints/resources.tsx
(3 hunks)client/apps/game/src/ui/components/hyperstructures/hyperstructure-resource-chip.tsx
(1 hunks)client/apps/game/src/ui/components/resources/realm-transfer.tsx
(2 hunks)client/apps/game/src/ui/components/resources/resource-chip.tsx
(6 hunks)client/apps/game/src/ui/components/structures/construction/structure-construction-menu.tsx
(5 hunks)client/apps/game/src/ui/components/trading/market-order-panel.tsx
(3 hunks)client/apps/game/src/ui/layouts/onboarding.tsx
(2 hunks)client/apps/game/src/ui/modules/chat/input-field.tsx
(1 hunks)client/apps/game/src/ui/modules/entity-details/realm/castle.tsx
(1 hunks)client/apps/game/src/ui/modules/onboarding/steps.tsx
(2 hunks)client/apps/game/src/ui/modules/quests/steps/create-trade-steps.ts
(0 hunks)client/apps/game/src/ui/modules/quests/steps/pause-production-steps.ts
(1 hunks)client/apps/game/src/ui/modules/rewards/rewards.tsx
(3 hunks)client/apps/game/src/ui/utils/utils.ts
(2 hunks)client/apps/game/src/utils/addresses.ts
(1 hunks)client/apps/game/src/utils/config.ts
(1 hunks)client/apps/game/src/utils/utils.ts
(1 hunks)client/apps/game/tailwind.config.js
(1 hunks)client/apps/game/tsconfig.json
(1 hunks)client/apps/game/vite.config.ts
(2 hunks)client/apps/landing/.env.mainnet
(1 hunks)client/apps/landing/.env.preview
(0 hunks)client/apps/landing/.env.production
(0 hunks)client/apps/landing/.env.sample
(0 hunks)client/apps/landing/.env.sepolia
(1 hunks)client/apps/landing/.env.slot
(1 hunks)client/apps/landing/dojoConfig.ts
(2 hunks)client/apps/landing/env.ts
(0 hunks)client/apps/landing/src/components/modules/bridge-fees.tsx
(2 hunks)client/apps/landing/src/components/modules/bridge-in.tsx
(4 hunks)client/apps/landing/src/components/modules/bridge-out-step-1.tsx
(2 hunks)client/apps/landing/src/components/modules/bridge-out-step-2.tsx
(2 hunks)client/apps/landing/src/components/modules/bridged-resources.tsx
(2 hunks)client/apps/landing/src/components/providers/starknet-provider.tsx
(1 hunks)client/apps/landing/src/components/ui/utils/addresses.ts
(1 hunks)client/apps/landing/src/components/ui/utils/utils.ts
(2 hunks)client/apps/landing/src/config.ts
(1 hunks)client/apps/landing/src/hooks/gql/gql.ts
(2 hunks)client/apps/landing/src/hooks/helpers/useDonkeyArrivals.tsx
(2 hunks)client/apps/landing/src/hooks/helpers/useEntities.tsx
(2 hunks)client/apps/landing/src/hooks/query/entities.tsx
(1 hunks)
⛔ Files not processed due to max files limit (8)
- client/apps/landing/src/hooks/query/entityOwners.tsx
- client/apps/landing/src/hooks/use-lords-bridged.tsx
- client/apps/landing/src/hooks/use-rewards.tsx
- client/apps/landing/src/lib/utils.ts
- client/apps/landing/src/routes/mint.lazy.tsx
- client/apps/landing/tsconfig.json
- client/config/.gitignore
- client/config/package.json
💤 Files with no reviewable changes (9)
- client/apps/game/src/ui/modules/quests/steps/create-trade-steps.ts
- client/apps/game/src/hooks/store/use-ui-store.ts
- client/apps/landing/env.ts
- client/apps/game/.env.preview
- client/apps/landing/.env.preview
- client/apps/game/.env.local.sample
- client/apps/game/.env.production
- client/apps/landing/.env.sample
- client/apps/landing/.env.production
✅ Files skipped from review due to trivial changes (3)
- bot/discord/src/events/battle_start.rs
- client/apps/game/src/ui/modules/quests/steps/pause-production-steps.ts
- client/apps/game/src/ui/components/construction/select-preview-building.tsx
🧰 Additional context used
🪛 GitHub Actions: lint
client/apps/game-docs/docs/pages/mechanics/realm/buildings.mdx
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/components/TroopsTable.tsx
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/pages/mechanics/realm/realm.mdx
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/landing/src/components/modules/bridge-in.tsx
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/components/ResourceTable.tsx
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/hooks/helpers/use-quests.ts
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/balancing/src/components/modules/resource-table.tsx
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/dojo/sync.ts
[warning] Code style issues found. File needs to be formatted with Prettier.
🪛 GitHub Actions: discord-bot
bot/discord/src/events/battle_pillage.rs
[error] 43-47: Code formatting does not match rustfmt style. The format! macro call needs to be split across multiple lines according to rustfmt standards.
🪛 GitHub Actions: knip
client/apps/landing/dojoConfig.ts
[error] 2-2: Unresolved import: '../../common/utils'
client/apps/game/src/utils/addresses.ts
[warning] 17-17: Unused export: 'getRealmsAddress'
client/apps/game/src/hooks/helpers/use-quests.ts
[warning] 15-15: Unused exported type: 'QuestStatus'
🪛 Gitleaks (8.21.2)
client/apps/game/.env.mainnet
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/.env.sepolia
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/.env.local
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/landing/.env.slot
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/.env.slot
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/landing/.env.mainnet
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
5-5: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🔇 Additional comments (66)
client/apps/game/src/hooks/helpers/use-quests.ts (1)
15-15
:⚠️ Potential issueRemove unused export 'QuestStatus'
The exported type
QuestStatus
is reported as unused by the static analysis tool. Since it's not used outside this module, consider removing theexport
keyword to prevent unnecessary exports and eliminate the warning.Apply this diff to fix the issue:
-export enum QuestStatus { +enum QuestStatus { InProgress, Completed, Claimed, }Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Actions: knip
[warning] 15-15: Unused exported type: 'QuestStatus'
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/landing/dojoConfig.ts (1)
17-17
: Consider handling potential type casting errors.The type casting of
VITE_PUBLIC_CHAIN as Chain
could fail at runtime if the environment variable contains an invalid value.Add runtime validation:
-const manifest = getGameManifest(VITE_PUBLIC_CHAIN as Chain); +const chain = VITE_PUBLIC_CHAIN as Chain; +if (!Object.values(Chain).includes(chain)) { + throw new Error(`Invalid chain: ${VITE_PUBLIC_CHAIN}`); +} +const manifest = getGameManifest(chain);client/apps/game/env.ts (1)
32-32
: LGTM! Consistent with public variable naming.The rename of VRF provider address to include "PUBLIC" prefix aligns with the naming pattern of other public variables in the schema.
bot/discord/src/eternum_enums.rs (1)
36-45
:⚠️ Potential issueBreaking Change: Resource IDs have been reordered.
The reordering of resource IDs from scattered values (29, 249-255) to sequential values (24-31) is a breaking change that requires careful coordination:
- New Demonhide resource added as ID 23
- Existing resources reordered to be sequential (24-31)
This change could impact:
- Stored data referencing old resource IDs
- External systems using these IDs
- Migration scripts may be needed
Let's verify the impact:
client/apps/landing/src/components/providers/starknet-provider.tsx (1)
7-7
: Verify compatibility of getResourceAddresses function.The switch from
getSeasonAddresses
togetResourceAddresses
suggests a change in address management strategy. Ensure that:
- The return format matches the expected structure
- All necessary addresses are still provided
Let's check the implementation:
Also applies to: 10-10
✅ Verification successful
✓ getResourceAddresses implementation is compatible
The function maintains the same interface and properly extracts resource addresses from the season configuration, ensuring compatibility with the starknet provider's usage pattern.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Find and compare both address getter implementations ast-grep --pattern 'function getResourceAddresses() { $$$ }' ast-grep --pattern 'function getSeasonAddresses() { $$$ }'Length of output: 127
Script:
#!/bin/bash # Search for the address functions with more flexible patterns rg "getResourceAddresses|getSeasonAddresses" -A 5 # Also check the specific file mentioned in the import cat "client/apps/landing/src/components/ui/utils/addresses.ts" 2>/dev/null || echo "File not found"Length of output: 18210
client/apps/game/src/hooks/context/starknet-provider.tsx (1)
1-1
: Verify consistency of s0 to s1 transition.The changes reflect the transition from s0 to s1:
- Updated to use
getResourceAddresses
- Changed namespace from "s0_eternum" to "s1_eternum"
Ensure this transition is complete across the codebase.
Let's check for any remaining s0 references:
Also applies to: 16-16, 26-26
✅ Verification successful
Namespace implementation is correct
The different namespace implementations are intentional:
- Game app uses "s1_eternum" for season-specific context
- Landing app uses "eternum" for general purposes
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for remaining s0_eternum references rg "s0_eternum" --type ts --type tsx # Search for potential GraphQL queries using old model ast-grep --pattern 's0_eternum_$_'Length of output: 101
Script:
#!/bin/bash # Search for s0 references with correct file type matching rg "s0[_-]eternum" -t ts -t typescript -t jsx -t tsx -t json -t graphql # Search for specific s0 patterns that might be used in configs or queries rg "s0[\._-]" -t ts -t typescript -t jsx -t tsx -t json -t graphql # Use ast-grep with more specific patterns for TypeScript/React ast-grep --pattern 'import { $_ } from "@/utils/s0_$_"' ast-grep --pattern 'const $_ = "s0_eternum"'Length of output: 738
Script:
#!/bin/bash # Search for s0 references in relevant files cd client/apps && rg "s0[_-]eternum" -g "*.{ts,tsx,json,graphql}" # Search for any s0 prefixed identifiers cd client/apps && rg "s0[\._-]" -g "*.{ts,tsx,json,graphql}" # Search specifically in game directory cd client/apps/game && rg "s0" -g "*.{ts,tsx,json,graphql}"Length of output: 338
Script:
#!/bin/bash # Find the location of starknet-provider.tsx fd "starknet-provider.tsx" # Find any typescript/react files fd -e ts -e tsx # Once we find the correct paths, we can search in the right directoryLength of output: 28632
Script:
#!/bin/bash # Check content of both provider files and addresses util cat client/apps/game/src/hooks/context/starknet-provider.tsx cat client/apps/landing/src/components/providers/starknet-provider.tsx cat client/apps/game/src/utils/addresses.tsLength of output: 5089
client/apps/landing/src/hooks/helpers/useEntities.tsx (1)
33-33
: Update data path to match the new version.The data path
s0EternumResourceModels
still uses the "s0" prefix while the rest of the code has moved to "s1". Verify if this should be updated tos1EternumResourceModels
.client/apps/game-docs/docs/components/BuildingCosts.tsx (1)
1-1
: LGTM! Clean transition to the new configuration system.The changes correctly migrate from
EternumGlobalConfig
toconfigManager
while maintaining the same functionality.Also applies to: 11-13
client/apps/game/vite.config.ts (1)
61-61
: Verify asset references after public directory changes.The changes to asset resolution paths might affect existing asset references:
- New alias
@/assets
points to../../public/assets
- Public directory changed from
../../common/public
to../../public
Please ensure all asset references are updated accordingly.
Also applies to: 102-102
✅ Verification successful
Asset references are properly aligned with the new structure
The new
@/assets
alias is already widely adopted across the codebase, and the public directory structure is in place. The only references to the old path are in other config files, suggesting a coordinated update across the project.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for potentially broken asset references # Search for references to the old public path rg -l "common/public" --type ts --type tsx --type js --type jsx # Search for asset imports that might need updating rg -l "from ['\"]\.\./\.\./common/public" --type ts --type tsx --type js --type jsx # List all files in the public directory to verify structure fd . "../../public" -t fLength of output: 332
Script:
#!/bin/bash # Search for files in the public directory fd public # Search for old path pattern references rg -l "common/public" # Search for new alias usage rg -l "@/assets" # Search for any asset import patterns rg "from ['\"].*?/public/assets"Length of output: 2585
client/apps/game/src/main.tsx (1)
71-71
: LGTM! Good security practice with environment variables.The change from
VITE_VRF_PROVIDER_ADDRESS
toVITE_PUBLIC_VRF_PROVIDER_ADDRESS
better aligns with Vite's conventions for client-exposed variables, making the security implications more explicit.client/apps/game-docs/docs/components/ResourceTable.tsx (2)
2-5
: LGTM! Improved imports with more descriptive constant names.The renamed constants
RESOURCE_PRODUCTION_INPUT_RESOURCES
andRESOURCE_PRODUCTION_OUTPUT_AMOUNTS
better reflect their purpose.🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
13-13
: Verify resource calculation precision.The changes to resource handling logic look correct, but we should ensure that the precision calculations using
ETERNUM_CONFIG().resources.resourcePrecision
maintain accuracy across all resource types.Run this script to verify consistent precision usage:
Also applies to: 17-17, 19-19, 21-21
✅ Verification successful
Resource precision calculations are consistently implemented.
The codebase shows uniform usage of
resourcePrecision
across all resource calculations, including the changes in ResourceTable.tsx.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for all resource precision calculations rg -A 2 "resourcePrecision"Length of output: 14795
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/utils/utils.ts (1)
19-51
: LGTM! Well-implemented address retrieval with proper error handling.The
getSeasonAddresses
function includes:
- Clear type safety
- Comprehensive error handling
- Proper null coalescing
- Good documentation
bot/discord/src/events/battle_pillage.rs (1)
17-17
: LGTM! Improved precision handling with a clear constant.The
RESOURCE_PRECISION
constant improves code clarity and maintainability.client/apps/game-docs/docs/components/TroopsTable.tsx (1)
69-69
: LGTM! Consistent use of ETERNUM_CONFIG().The changes align with the new configuration management pattern.
Also applies to: 74-74
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/ui/components/hyperstructures/hyperstructure-resource-chip.tsx (1)
Line range hint
39-40
: Verify the safety of removing production-based limits.The simplified calculation of
maxContributableAmount
no longer considers production rates or safety margins. This could potentially lead to over-contribution of resources.Consider implementing alternative safeguards to prevent resource depletion, such as:
- Rate limiting
- Minimum balance requirements
- Progressive contribution limits
bot/discord/src/actors/tick_sender.rs (1)
48-48
: Verify all systems are updated to handle s1_eternum models.The model identifier has been updated from s0 to s1. Ensure that all systems consuming tick configuration data are compatible with the new model version.
Also applies to: 64-64
✅ Verification successful
Model transition to s1_eternum is complete and consistent
The codebase has been fully transitioned to use s1_eternum models, with no remaining s0 references. The TickConfig model change is part of this complete transition.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining s0_eternum references that might need updating rg "s0_eternum" --type rust --type typescript --type javascript # Search for systems that might be consuming TickConfig rg "TickConfig" -A 5 --type rust --type typescript --type javascriptLength of output: 202
Script:
#!/bin/bash # Search for s0_eternum and s1_eternum references rg "s[01]_eternum" -g "*.{rs,js,ts,json,toml}" # Search for TickConfig usage rg "TickConfig" -g "*.{rs,js,ts,json,toml}" -B 2 -A 2 # Search specifically for model definitions and consumers ast-grep --pattern 'models: vec![$_]'Length of output: 73157
client/apps/game/src/ui/modules/chat/input-field.tsx (1)
110-118
: Verify message handling compatibility across versions.The message type has been updated from s0 to s1. Consider the following:
- How are existing s0 messages handled?
- Is there a migration plan for historical messages?
- Are all message consumers updated to handle s1 messages?
✅ Verification successful
Migration to s1_eternum-Message appears complete and consistent
The codebase shows no remaining references to s0_eternum-Message, and all relevant files consistently use the new s1 version. The message structure remains unchanged, suggesting a clean version transition.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for message handling logic that might need updates ast-grep --pattern 'Message { $$$ handle($_, $_) { $$$ } $$$ }' # Check for any remaining s0 message references rg "s0_eternum-Message" --type typescript --type javascriptLength of output: 172
Script:
#!/bin/bash # Search for both s0 and s1 message references rg "eternum-Message" -t js -t jsx -t ts -t tsx # Look for message type definitions and handling ast-grep --pattern 'type: "s1_eternum-Message"' # Search for message processing functions rg "function.*Message" -t js -t jsx -t ts -t tsx # Check for any message validation or processing logic rg "processMessage|validateMessage|handleMessage" -t js -t jsx -t ts -t tsxLength of output: 309
Script:
#!/bin/bash # Search for both message versions using correct glob patterns rg "eternum-Message" -g "*.ts" -g "*.tsx" -g "*.js" # Search for specific version references rg "s0_eternum-Message" -g "*.ts" -g "*.tsx" -g "*.js" rg "s1_eternum-Message" -g "*.ts" -g "*.tsx" -g "*.js" # Look for any message type definitions rg "type.*Message.*=.*{" -g "*.ts" -g "*.tsx" -g "*.js"Length of output: 1021
client/apps/game/src/ui/components/hints/resources.tsx (1)
43-43
: Verify consistent resource precision across components.The change introduces RESOURCE_PRECISION constant for standardization. Ensure that:
- The precision value is consistent across all components
- No precision loss occurs during calculations
- All resource-related components are updated to use the new constant
Also applies to: 101-101
✅ Verification successful
Resource precision implementation is consistent across components
The codebase shows standardized usage of
RESOURCE_PRECISION
(1_000_000_000) through consistent multiplication for storage and division for display. The change in resources.tsx aligns with this pattern.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for resource precision usage rg "resourceMultiplier|resourcePrecision|RESOURCE_PRECISION" --type typescript --type javascript # Look for potential precision-sensitive calculations ast-grep --pattern 'resource.$_ / $_'Length of output: 357
Script:
#!/bin/bash # Search with correct file type options rg "resourceMultiplier|resourcePrecision|RESOURCE_PRECISION" -t js -t jsx -t ts -t tsx # Look for constant definition ast-grep --pattern 'const RESOURCE_PRECISION = $_' # Search for resource calculations with multiplication and division ast-grep --pattern 'resource.$_ * $_' ast-grep --pattern 'multiplyByPrecision($_)' ast-grep --pattern 'divideByPrecision($_)'Length of output: 23528
client/apps/game/src/ui/components/cityview/realm/settle-realm-component.tsx (2)
107-113
: Good improvement: Replacing hardcoded address with dynamic fetching.The change from hardcoded
env.VITE_SEASON_PASS_ADDRESS
to dynamicgetSeasonPassAddress()
improves maintainability and flexibility.
116-116
: Verify the compatibility of getOffchainRealm with s1 version.The switch from
getRealm
togetOffchainRealm
needs verification to ensure it's compatible with the s1 version upgrade.✅ Verification successful
getOffchainRealm is compatible with s1 version
The function is version-agnostic as it processes offline realm data from JSON files without any chain-specific dependencies. The change from
getRealm
togetOffchainRealm
appears to be a refactor to better indicate its offline nature.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for other usages of getOffchainRealm to verify s1 compatibility ast-grep --pattern 'getOffchainRealm($$$)'Length of output: 221
Script:
#!/bin/bash # Find definition of getOffchainRealm ast-grep --pattern 'function getOffchainRealm($$$)' ast-grep --pattern 'const getOffchainRealm = $$$' ast-grep --pattern 'export function getOffchainRealm($$$)' ast-grep --pattern 'export const getOffchainRealm = $$$' # Find definition of getRealm for comparison ast-grep --pattern 'function getRealm($$$)' ast-grep --pattern 'const getRealm = $$$' ast-grep --pattern 'export function getRealm($$$)' ast-grep --pattern 'export const getRealm = $$$' # Search for imports of these functions rg "import.*getOffchainRealm.*from" -A 2 rg "import.*getRealm.*from" -A 2Length of output: 526
Script:
#!/bin/bash # Broader search for both functions rg "getOffchainRealm" --type ts --type tsx rg "getRealm[^s]" --type ts --type tsx # Find realm-related utility files fd "realm" -e ts -e tsx # Search for s1 configuration or types rg "s1" --type ts --type tsx -g '!*.test.*' -g '!*.spec.*'Length of output: 1112
Script:
#!/bin/bash # Check content of potential implementation files cat packages/core/src/utils/realm.ts cat packages/react/src/hooks/helpers/use-realm.ts # Try different ripgrep syntax rg -t typescript -t tsx "getOffchainRealm" rg -t typescript -t tsx "getRealm[^s]"Length of output: 6178
client/apps/game/src/dojo/queries.ts (1)
25-25
: Verify complete migration from s0 to s1 models.The model identifiers have been updated from s0 to s1. Let's ensure no s0 references remain.
Also applies to: 90-90, 121-121, 128-128, 158-158, 170-179
✅ Verification successful
Migration to s1 models is complete and consistent
The codebase has been fully migrated to use s1_eternum models. While some query names still contain "s0" in their identifiers, the actual model types they reference are correctly using the s1_eternum prefix. This is just a naming convention in the queries and doesn't affect the model versions being used.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining s0_eternum references rg "s0_eternum" --type typescript # Search for any inconsistent usage of s1_eternum rg "s1_eternum" --type typescriptLength of output: 137
Script:
#!/bin/bash # Search for any remaining s0_eternum references in ts/tsx files rg "s0_eternum" -g "*.{ts,tsx}" -C 2 # Search for s1_eternum usage for context rg "s1_eternum" -g "*.{ts,tsx}" -C 2Length of output: 87401
client/apps/landing/src/hooks/helpers/useDonkeyArrivals.tsx (1)
76-78
:⚠️ Potential issueFix inconsistent version references.
While the typename checks have been updated to
s1_eternum
, there are still references tos0
in:
- Variable
s0EternumEntityOwnerModels
- GraphQL query
s0EternumResourceModels
- GraphQL query
s0EternumPositionModels
This mixed usage of s0 and s1 could lead to confusion and potential bugs.
Also applies to: 105-105
client/apps/landing/src/components/modules/bridge-fees.tsx (1)
40-40
: Verify configuration initialization timing.The configuration is retrieved directly in the component body. Consider moving it inside a
useMemo
hook to ensure proper initialization timing and prevent unnecessary re-computations.- const bridgeConfig = ETERNUM_CONFIG().bridge; + const bridgeConfig = useMemo(() => ETERNUM_CONFIG().bridge, []);client/apps/game/src/ui/components/resources/resource-chip.tsx (1)
72-83
: Verify tick-based balance updates.The balance update logic has been simplified. Please verify that this doesn't affect real-time updates of resource balances, especially for resources with ongoing production.
✅ Verification successful
Balance update logic maintains real-time functionality
The simplified tick-based balance updates are safe and maintain proper real-time functionality. The changes are localized to the resource-chip component, while other components using
resourceManager.balance()
remain unaffected. The interval-based updates correctly handle resources with ongoing production.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for other components that might be affected by the balance calculation changes rg "resourceManager\.balance" --type ts --type tsx -A 5Length of output: 85
Script:
#!/bin/bash # Search for balance-related code in TypeScript files rg "resourceManager\.balance" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' -t tsx -t ts -A 5 # Find ResourceManager implementation fd "resource-manager" -e ts -e tsx # Look for interval-based updates rg "setInterval.*balance" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' -t tsx -t ts -A 5Length of output: 4101
client/apps/game/src/ui/utils/utils.ts (1)
48-48
: LGTM! Improved precision handling.The change to use
RESOURCE_PRECISION
constant instead of accessing through config improves code maintainability and reduces potential configuration errors.Also applies to: 52-52
client/apps/balancing/src/components/modules/resource-table.tsx (1)
3-10
: LGTM! Improved naming clarity for resource constants.The updated constant names better reflect their purpose (e.g.,
RESOURCE_PRODUCTION_INPUT_RESOURCES_SCALED
vsRESOURCE_INPUTS_SCALED
).🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
bot/discord/src/actors/torii_client_subscriber.rs (1)
25-33
: Verify model name updates are complete.The model names have been systematically updated from s0_eternum to s1_eternum. Let's verify no references were missed.
Also applies to: 128-191
✅ Verification successful
Model name updates are complete and consistent ✅
All references have been successfully updated from s0_eternum to s1_eternum across the entire bot directory. No remaining s0_eternum references were found.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining s0_eternum references rg "s0_eternum" bot/discord/src/actors/Length of output: 39
Script:
#!/bin/bash # First verify the file exists fd "torii_client_subscriber.rs" bot/ # Then search for both s0 and s1 patterns in the bot directory echo "Searching for s0_eternum patterns:" rg "s0_eternum" bot/ echo -e "\nSearching for s1_eternum patterns:" rg "s1_eternum" bot/Length of output: 2298
client/apps/game/src/dojo/sync.ts (3)
220-221
: LGTM! Improved configuration management.Using
ETERNUM_CONFIG()
to initialize the Dojo configuration improves the setup process.🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
136-136
: LGTM! Systematic model version update.All model references have been consistently updated from s0_eternum to s1_eternum.
Also applies to: 162-162, 169-169, 192-207, 235-235, 256-266
✅ Verification successful
Verification successful: All model references correctly updated to s1_eternum
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify no s0_eternum references remain rg "s0_eternum" client/apps/game/src/Length of output: 37
Script:
#!/bin/bash # Search for s1_eternum in the sync.ts file with context rg -A 1 "s1_eternum" client/apps/game/src/dojo/sync.tsLength of output: 1508
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
Line range hint
26-26
: Consider performance implications of increased debounce time.The debounce time has been increased from 200ms to 1 second. While this allows for larger batches, it might introduce noticeable delays in UI updates.
Consider monitoring the impact on user experience:
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/landing/src/components/modules/bridged-resources.tsx (1)
9-9
: LGTM! The changes align with the transition from season-based to resource-based addressing.The refactor from
getSeasonAddresses
togetResourceAddresses
maintains the component's functionality while implementing the new addressing scheme.Also applies to: 22-22
client/apps/game/tailwind.config.js (1)
110-110
: Verify that the updated image paths work correctly.The paths have been updated to include the 'public' directory. Ensure these assets are accessible in the production build.
Also applies to: 112-112
✅ Verification successful
All image paths in the configuration are valid and working correctly
All referenced files exist in their specified locations under the public directory. The path updates are correct and consistent with the project's structure.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if the image files exist in the specified paths fd -t f "map.svg" "worldmap-bg.png" -x echo "Found: {}"Length of output: 156
Script:
#!/bin/bash # First, let's see all image references in the config echo "=== Image references in tailwind.config.js ===" cat client/apps/game/tailwind.config.js | grep -E "url\(.*\)" echo -e "\n=== Checking for image files in public directory ===" # Now search for the image files with correct fd syntax fd -t f -e svg -e png -p "public/images"Length of output: 7703
Script:
#!/bin/bash # Check for worldmap-bg.png in textures directory echo "=== Checking for worldmap-bg.png ===" fd -t f "worldmap-bg.png" client/public/textures # Also check if there might be a different textures location echo -e "\n=== Checking for any textures directory ===" fd -t d "textures"Length of output: 322
client/apps/game/src/ui/modules/rewards/rewards.tsx (1)
39-48
: LGTM! Good addition of dynamic Lords address fetching.The initialization of lordsAddress in useEffect is a good practice for dynamic configuration.
client/apps/game/src/ui/components/resources/realm-transfer.tsx (1)
10-10
: LGTM! Good use of RESOURCE_PRECISION constant for standardization.The change improves consistency in resource precision handling across the application by using the standardized RESOURCE_PRECISION constant.
Also applies to: 71-71
client/apps/game/src/ui/modules/onboarding/steps.tsx (1)
105-105
: LGTM! Dynamic address fetching aligns with the season 1 transition.The change from static environment variable to dynamic address fetching via
getSeasonPassAddress()
is a good improvement that aligns with the PR's objective of transitioning to season 1.Run the following script to verify that all references to the season pass address have been updated:
✅ Verification successful
Verification successful: Season pass address transition is correctly implemented
The change from static environment variable to dynamic address fetching is properly implemented. The environment variable is only used in configuration and deployment scripts as expected, while the UI correctly uses the dynamic
getSeasonPassAddress()
function.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining hardcoded season pass addresses. # Test: Search for environment variable usage rg -l "VITE_SEASON_PASS_ADDRESS" # Test: Search for any hardcoded addresses that might be season pass addresses rg -l "0x[a-fA-F0-9]{40}"Length of output: 19801
Script:
#!/bin/bash # Check how VITE_SEASON_PASS_ADDRESS is used in config/index.ts echo "=== Content of config/index.ts ===" cat config/index.ts # Search for any direct usage of the environment variable in imports or code echo -e "\n=== Direct usage of VITE_SEASON_PASS_ADDRESS in code ===" rg "VITE_SEASON_PASS_ADDRESS" -B 2 -A 2Length of output: 4707
client/apps/game/src/ui/layouts/onboarding.tsx (1)
211-222
: LGTM! Simplified button click handler improves readability.The simplified button click handler and consistent text display enhance the code's clarity.
client/apps/landing/src/components/ui/utils/utils.ts (1)
43-43
: LGTM! Consistent use of centralized configuration.The use of
ETERNUM_CONFIG().resources.resourcePrecision
aligns with the PR's objective of centralizing configuration management.Run the following script to verify consistent configuration usage:
Also applies to: 47-47
✅ Verification successful
Verification successful: Resource precision configuration is consistently centralized
The codebase demonstrates uniform usage of
ETERNUM_CONFIG().resources.resourcePrecision
for all resource precision calculations, with no hardcoded values detected.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for consistent use of resource precision configuration. # Test: Search for direct resource precision references rg -l "resourcePrecision" # Test: Search for ETERNUM_CONFIG usage ast-grep --pattern 'ETERNUM_CONFIG().$_'Length of output: 2431
client/apps/landing/src/hooks/gql/gql.ts (1)
18-18
: Verify consistent model identifier updates across GraphQL queries.The model identifiers have been updated from "s0_eternum" to "s1_eternum" as part of the season 1 transition.
Run the following script to verify consistent model identifier updates:
Also applies to: 20-20, 54-54, 60-60
client/apps/landing/src/components/modules/bridge-out-step-2.tsx (1)
15-15
: LGTM! Import statement updated for consistency.The change from
getSeasonAddresses
togetResourceAddresses
aligns with the codebase-wide refactor.client/apps/landing/src/components/modules/bridge-out-step-1.tsx (1)
27-27
: LGTM! Import statement updated consistently.The change aligns with the standardization of resource address handling across the codebase.
client/apps/landing/src/components/modules/bridge-in.tsx (1)
30-31
: LGTM! Imports updated consistently.The changes align with the standardization of resource address handling.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/src/ui/components/trading/market-order-panel.tsx (1)
496-496
: LGTM! Resource initialization updated to use RESOURCE_PRECISION.The change improves consistency by using the standard precision constant.
client/apps/game/src/three/scenes/worldmap.ts (2)
750-750
: Model identifiers updated for Tile queries.The model identifiers have been consistently updated from 's0_eternum-Tile' to 's1_eternum-Tile' across all query clauses.
Also applies to: 758-758, 766-766, 774-774, 785-785
797-797
: Model identifiers updated for Position and related queries.The model identifiers have been consistently updated from 's0_eternum-' to 's1_eternum-' for Position and related components (Army, Health, EntityOwner, Protectee, Stamina).
Also applies to: 805-805, 813-813, 821-821, 833-838
client/apps/game/.gitignore (1)
26-27
: Good addition of .env to gitignore.Adding .env to gitignore is a security best practice to prevent accidentally committing sensitive environment variables.
client/apps/game/tsconfig.json (1)
10-10
: Verify the need for allowing JavaScript files.The
allowJs
compiler option has been enabled. Please ensure this change is intentional and necessary, as it allows JavaScript files to be included in the TypeScript compilation process.✅ Verification successful
The
allowJs
compiler option is justifiedThe change is necessary as there are JavaScript source files that need to be included in the TypeScript compilation, specifically the
entity-worker.js
file in the game app's source directory.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for .js files in the project echo "JavaScript files in the project:" fd -e js --type fLength of output: 1472
.github/workflows/discord-bot.yml (1)
25-25
: Directory paths updated consistently.The workflow has been updated to reflect the new directory structure, changing from 'discord-bot' to 'bot/discord' consistently across sparse-checkout paths and command working directories.
Also applies to: 35-35, 44-44, 57-57
client/apps/landing/.env.sepolia (1)
Line range hint
20-24
: Update placeholder URLs with actual service endpoints.The marketplace API, CDN, and IPFS gateway URLs are using placeholder values (
https://abc.com
). These should be updated with actual service endpoints for the Sepolia environment.client/apps/landing/.env.slot (1)
6-12
: Fix inconsistent slot configuration.The TORII URL uses 'sepolia-rc-18' but the
VITE_PUBLIC_SLOT
is empty. This inconsistency could cause connection issues.Either:
- Set
VITE_PUBLIC_SLOT=sepolia-rc-18
to match the TORII URL, or- Update the TORII URL to match the intended slot configuration
Also applies to: 14-15
client/apps/landing/.env.mainnet (1)
9-10
: Verify game version for production deployment.The game version is set to "v1.0.0-rc0" in mainnet environment. Ensure this is the intended version for production deployment.
✅ Verification successful
Game version is correctly configured for production deployment
The version setup appears intentional with mainnet and sepolia environments synchronized at v1.0.0-rc0 for production stability, while the slot environment (v1.0.0-rc7) serves as a testing ground for newer releases.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check game version consistency across environments echo "Game versions across environments:" echo "Mainnet: $(grep GAME_VERSION client/apps/landing/.env.mainnet)" echo "Sepolia: $(grep GAME_VERSION client/apps/landing/.env.sepolia)" echo "Slot: $(grep GAME_VERSION client/apps/landing/.env.slot)"Length of output: 540
Script:
#!/bin/bash # Check for version configurations in package.json and other common files echo "Checking package.json versions:" fd package.json --exec grep -l "version" {} \; --exec cat {} echo -e "\nChecking for version in configuration files:" fd -e config.ts -e config.js --exec grep "version" {} \; 2>/dev/null echo -e "\nChecking for version in main application files:" fd -e ts -e js -d 2 client/apps/landing --exec grep "version" {} \; 2>/dev/nullLength of output: 19264
client/apps/game/.env.mainnet (1)
20-21
: Verify construction flag for production.The construction flag is set to
true
in the mainnet environment. This should typically befalse
in production unless there's a specific reason.Please confirm if this is intentional.
client/apps/game/.env.local (1)
7-10
: Review development flags for local environment.Development flags are set to
false
in the local environment:
VITE_PUBLIC_DEV=false
VITE_PUBLIC_SHOW_FPS=false
VITE_PUBLIC_GRAPHICS_DEV=false
These should typically be
true
for local development unless there's a specific reason.client/apps/game/.env.sepolia (1)
26-30
: Verify network configuration consistencyEnsure that the network configuration (chain, slot, node URL) is correctly set for the Sepolia environment.
client/apps/game-docs/docs/pages/mechanics/resources/storage.mdx (1)
2-3
: Verify configuration values after migrationThe transition from
EternumGlobalConfig
toETERNUM_CONFIG()
requires verification of resource weight values.Also applies to: 16-17, 21-22
✅ Verification successful
Configuration migration successfully verified
The transition to
ETERNUM_CONFIG()
is correctly implemented, ensuring dynamic resource weight values are properly displayed in the documentation. The configuration is fetched from the network at runtime, maintaining accurate values.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining references to EternumGlobalConfig rg "EternumGlobalConfig" "client/apps/game-docs"Length of output: 46
Script:
#!/bin/bash # Check ETERNUM_CONFIG implementation and usage ast-grep --pattern 'export const ETERNUM_CONFIG' # Search for resource weight references in the documentation rg -A 3 "resource.*weight" "client/apps/game-docs" # Check the content of the storage documentation cat "client/apps/game-docs/docs/pages/mechanics/resources/storage.mdx"Length of output: 2321
client/apps/game-docs/docs/pages/mechanics/key-concepts.mdx (1)
1-3
: LGTM! Configuration import updated correctlyThe import changes align with the new configuration management approach.
client/apps/game-docs/docs/pages/mechanics/military/combat.mdx (1)
28-29
: Verify battle configuration valuesEnsure that the battle parameters (retreat penalty and siege duration) remain accurate after the configuration update.
Also applies to: 35-36
client/apps/game-docs/docs/pages/mechanics/realm/realm.mdx (2)
4-5
: LGTM! Import changes align with the new configuration management approach.The transition from
EternumGlobalConfig
toETERNUM_CONFIG
is consistent with the PR objectives.🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
32-32
: LGTM! Configuration access updates are consistent.The changes correctly use the new
ETERNUM_CONFIG()
function for accessing configuration values.Also applies to: 37-37, 47-47
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/pages/mechanics/realm/buildings.mdx (1)
3-4
: LGTM! Import changes are consistent with the new configuration approach.The removal of
EternumGlobalConfig
and addition ofETERNUM_CONFIG
aligns with the PR objectives.🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game-docs/docs/pages/development/contracts.mdx (2)
87-88
: LGTM! Model path updates align with the new version.The transition from
s0_eternum
tos1_eternum
for model paths is consistent with the version upgrade.
94-97
: Verify the module name change impact.The module name change from
building_systems
toproduction_systems
suggests a broader scope. Ensure all references to this module are updated accordingly.✅ Verification successful
Module rename implementation is complete
The module name change from
building_systems
toproduction_systems
has been properly implemented in the source code. The only remaining references tobuilding_systems
are in manifest and deployment files, which is expected as they represent historical deployment records.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining references to the old module name rg "building_systems" -l # Search for any potential mismatches in module usage ast-grep --pattern 'mod $name { use s0_eternum::$$$ }'Length of output: 889
Script:
#!/bin/bash # Search for building_systems in source code files, excluding manifests and build artifacts rg "building_systems" --type rust -l # Check for module declarations using s1_eternum ast-grep --pattern 'mod $name { use s1_eternum::$$$ }'Length of output: 95
client/apps/game-docs/docs/pages/mechanics/hyperstructures.mdx (2)
2-2
: LGTM! Import changes align with the new configuration approach.The addition of
ETERNUM_CONFIG
is consistent with the PR objectives.
58-58
: LGTM! Victory points calculation updated correctly.The transition to using
ETERNUM_CONFIG()
for hyperstructure points calculation is consistent.Also applies to: 74-74
client/apps/game-docs/docs/pages/mechanics/trading.mdx (2)
2-3
: LGTM! Import changes are consistent.The separation of imports and transition to
ETERNUM_CONFIG
is clean and aligned with the PR objectives.
48-48
: LGTM! Donkey capacity calculation updated correctly.The transition to using
ETERNUM_CONFIG()
for donkey capacity calculation is consistent.
export const lordsAddress = await getLordsAddress(); | ||
export const seasonPassAddress = await getSeasonPassAddress(); | ||
export const realmsAddress = await getRealmsAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential issue with top-level 'await' usage
Using await
at the top level of a module requires support for top-level await
in your project's configuration and the runtime environment. Ensure that your TypeScript configuration (tsconfig.json
) sets "module": "esnext"
and that your runtime supports this feature. If not, consider refactoring the code to handle asynchronous initialization differently.
Apply this diff to encapsulate the asynchronous calls within an async function:
-export const lordsAddress = await getLordsAddress();
-export const seasonPassAddress = await getSeasonPassAddress();
-export const realmsAddress = await getRealmsAddress();
+export const getAddresses = async () => {
+ const lordsAddress = await getLordsAddress();
+ const seasonPassAddress = await getSeasonPassAddress();
+ const realmsAddress = await getRealmsAddress();
+ return { lordsAddress, seasonPassAddress, realmsAddress };
+};
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const lordsAddress = await getLordsAddress(); | |
export const seasonPassAddress = await getSeasonPassAddress(); | |
export const realmsAddress = await getRealmsAddress(); | |
export const getAddresses = async () => { | |
const lordsAddress = await getLordsAddress(); | |
const seasonPassAddress = await getSeasonPassAddress(); | |
const realmsAddress = await getRealmsAddress(); | |
return { lordsAddress, seasonPassAddress, realmsAddress }; | |
}; |
// todo: find another way to know if settler | ||
const isNotSettler = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Address hardcoded value for 'isNotSettler'
The variable isNotSettler
is currently hardcoded to false
. This may lead to incorrect quest claim statuses, especially if the player is not a settler. Implement a proper check to determine if the player is a settler or not.
Do you want assistance in implementing a method to accurately determine the player's settler status? I can help generate the code or open a new issue to track this task.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
import { env } from "./../../env"; | ||
|
||
export const ETERNUM_CONFIG = async () => { | ||
const config = await getConfigFromNetwork(env.VITE_PUBLIC_CHAIN! as NetworkType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Handle potential undefined VITE_PUBLIC_CHAIN
The usage of non-null assertion !
on env.VITE_PUBLIC_CHAIN
assumes that it is always defined. If VITE_PUBLIC_CHAIN
can be undefined, it may cause a runtime error. Consider providing a default value or adding error handling to account for this possibility.
Apply this diff to handle undefined values:
-export const config = await getConfigFromNetwork(env.VITE_PUBLIC_CHAIN! as NetworkType);
+const networkType = (env.VITE_PUBLIC_CHAIN as NetworkType) || DEFAULT_NETWORK;
+export const config = await getConfigFromNetwork(networkType);
Ensure that DEFAULT_NETWORK
is defined appropriately.
Committable suggestion skipped: line range outside the PR's diff.
export const getRealmsAddress = async () => { | ||
return (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).realms; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Remove the unused getRealmsAddress
function from the game app
The static analysis tool is correct. The getRealmsAddress
function in client/apps/game/src/utils/addresses.ts
is unused, as the landing app uses its own implementation from client/apps/landing/src/components/ui/utils/addresses.ts
. Consider moving this shared functionality to a common utility module to avoid duplication.
🔗 Analysis chain
Remove or utilize the unused export.
The getRealmsAddress
function is flagged as unused by the static analysis tool. Either remove it if it's not needed or ensure it's properly utilized in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any usage of getRealmsAddress
rg "getRealmsAddress" --type ts
Length of output: 450
Script:
#!/bin/bash
# Compare the implementations
echo "=== Game implementation ==="
cat client/apps/game/src/utils/addresses.ts
echo -e "\n=== Landing implementation ==="
cat client/apps/landing/src/components/ui/utils/addresses.ts
echo -e "\n=== Config import ==="
cat client/apps/landing/src/config.ts
Length of output: 1925
🧰 Tools
🪛 GitHub Actions: knip
[warning] 17-17: Unused export: 'getRealmsAddress'
import { Chain, getSeasonAddresses } from "../../../../../../common/utils"; | ||
import { env } from "../../../../env"; | ||
|
||
export const getResourceAddresses = async () => { | ||
const addresses = (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).resources; | ||
return addresses; | ||
}; | ||
|
||
export const getSeasonPassAddress = async () => { | ||
return (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).seasonPass; | ||
}; | ||
|
||
export const getLordsAddress = async () => { | ||
return (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).lords; | ||
}; | ||
|
||
export const getRealmsAddress = async () => { | ||
return (await getSeasonAddresses(env.VITE_PUBLIC_CHAIN as Chain)).realms; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider consolidating duplicate address utilities.
These functions are identical to those in client/apps/game/src/utils/addresses.ts
. Consider moving them to a shared utility module to avoid code duplication and potential maintenance issues.
Suggested steps:
- Move these functions to a shared location (e.g.,
common/utils/addresses.ts
) - Update imports in both apps to use the shared module
- Remove duplicate implementations
const lordsAddress = await getLordsAddress(); | ||
setIsLoading(true); | ||
try { | ||
await claim_leaderboard_rewards({ | ||
signer: account, | ||
token: env.VITE_LORDS_ADDRESS!, | ||
token: lordsAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix potential race condition and remove duplicate setIsLoading(false).
The function has two issues:
- Potential race condition by fetching lordsAddress again instead of using state
- Duplicate setIsLoading(false) calls
- const lordsAddress = await getLordsAddress();
setIsLoading(true);
try {
await claim_leaderboard_rewards({
signer: account,
- token: lordsAddress,
+ token: lordsAddress || await getLordsAddress(),
});
} catch (error) {
console.error("Error claiming rewards", error);
} finally {
setIsLoading(false);
}
- setIsLoading(false);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const lordsAddress = await getLordsAddress(); | |
setIsLoading(true); | |
try { | |
await claim_leaderboard_rewards({ | |
signer: account, | |
token: env.VITE_LORDS_ADDRESS!, | |
token: lordsAddress, | |
setIsLoading(true); | |
try { | |
await claim_leaderboard_rewards({ | |
signer: account, | |
token: lordsAddress || await getLordsAddress(), |
@@ -190,7 +190,7 @@ const SeasonPassButton = ({ setSettleRealm }: SeasonPassButtonProps) => { | |||
const realms = usePlayerOwnedRealms(); | |||
|
|||
const createRandomRealm = () => { | |||
const newRealmId = Math.max(...realms.map((realm) => realm.realmId), 0) + 1; | |||
const newRealmId = Math.floor(Math.random() * 8000) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Add ID range validation and separation for dev/test realms
The current random realm ID generation between 1 and 8000 lacks validation and dedicated ranges. While no conflicts were found, this could lead to issues as the system scales. Consider:
- Implementing ID range validation before realm creation
- Reserving specific ranges (e.g., 1-1000 for dev/test, 1001-8000 for production)
- Adding documentation about realm ID allocation strategy
🔗 Analysis chain
Verify the realm ID range and potential conflicts.
The random realm ID generation between 1 and 8000 could potentially conflict with existing realm IDs. Consider:
- Using a dedicated range for dev/test realms to avoid conflicts.
- Verifying that the ID doesn't already exist before creation.
Run the following script to check the current realm ID distribution:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the current realm ID distribution to identify safe ranges for new realms.
# Test: Search for realm ID patterns in the codebase
ast-grep --pattern 'realm_id: $id' | sort -u
# Test: Search for realm ID assignments
rg -A 2 'realm_id.*='
Length of output: 17882
Script:
#!/bin/bash
# Search for realm-related configuration, constants, and type definitions
# Look for configuration files
fd -e json -e yaml -e toml -e env . | xargs rg -i "realm.*id"
# Search for constants and type definitions related to realm IDs
rg -i "const.*realm|type.*realm|interface.*realm" -A 3
# Search for environment variables related to realms
rg "REALM.*ID|REALM.*RANGE|MAX.*REALM"
# Look for schema definitions
fd schema | xargs rg -i "realm.*id"
Length of output: 74600
client/apps/game/.env.local
Outdated
VITE_PUBLIC_CHAIN=sepolia | ||
VITE_PUBLIC_SLOT=sepolia-rc-17 | ||
VITE_PUBLIC_TORII=https://api.cartridge.gg/x/sepolia-rc-18/torii | ||
VITE_PUBLIC_NODE_URL=https://api.cartridge.gg/x/starknet/sepolia | ||
VITE_PUBLIC_TORII_RELAY=/dns4/api.cartridge.gg/tcp/443/x-parity-wss/%2Fx%2Fsepolia-rc-18%2Ftorii%2Fwss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix slot configuration mismatch.
There's a mismatch in the slot configuration:
VITE_PUBLIC_SLOT=sepolia-rc-17
- TORII URL uses 'sepolia-rc-18'
This inconsistency could cause connection issues.
Update the configurations to use the same slot version.
VITE_PUBLIC_MASTER_ADDRESS=0x01BFC84464f990C09Cc0e5D64D18F54c3469fD5c467398BF31293051bAde1C39 | ||
VITE_PUBLIC_MASTER_PRIVATE_KEY=0x075362a844768f31c8058ce31aec3dd7751686440b4f220f410ae0c9bf042e60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The master address and private key should not be committed to version control. Consider:
- Using environment-specific key management
- Adding these variables to
.gitignore
- Providing a template file instead
🧰 Tools
🪛 Gitleaks (8.21.2)
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/.env.sepolia
Outdated
VITE_PUBLIC_ARK_MARKETPLACE_API=https://abc.com | ||
VITE_PUBLIC_IMAGE_CDN_URL=https://abc.com | ||
VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com | ||
VITE_PUBLIC_IPFS_GATEWAY=https://abc.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Update placeholder URLs and review sensitive data exposure
The placeholder URLs using 'abc.com' domain are present in .env.sepolia
and need to be updated with actual Sepolia testnet endpoints. Additionally, this file contains sensitive information (private keys) that should be reviewed for security concerns.
client/apps/game/.env.sepolia
: Update the following placeholder URLs with actual Sepolia testnet endpoints:- VITE_PUBLIC_ARK_MARKETPLACE_API
- VITE_PUBLIC_IMAGE_CDN_URL
- VITE_PUBLIC_IMAGE_PROXY_URL
- VITE_PUBLIC_IPFS_GATEWAY
🔗 Analysis chain
Update placeholder URLs
Multiple URLs are using placeholder domain 'abc.com'. These should be updated with actual production URLs before deployment.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for placeholder URLs in environment files
rg -l "abc.com" "client/apps/game/.env.*"
Length of output: 105
Script:
#!/bin/bash
# List all env files in the project
echo "=== Env files ==="
fd -t f "^\.env" client/apps/game/
# Search for placeholder URLs in all files
echo -e "\n=== Files with placeholder URLs ==="
rg -l "abc\.com" || true
# Check for documentation
echo -e "\n=== Related documentation ==="
fd -t f "README|CONTRIBUTING" -e md | xargs rg -l "VITE_PUBLIC.*URL|VITE_PUBLIC.*API" || true
Length of output: 572
Script:
#!/bin/bash
# List all env files including hidden ones
echo "=== Env files ==="
fd -H -t f "^\.env" client/apps/game/
# Try to directly read the specific file
echo -e "\n=== .env.sepolia content ==="
cat client/apps/game/.env.sepolia 2>/dev/null || echo "File not found"
Length of output: 1694
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (7)
client/apps/game/src/ui/layouts/world.tsx (1)
Line range hint
1-359
: Clean up commented code and console.log statements.Consider the following improvements:
- Remove or document the commented-out Hyperstructure subscription code if it's no longer needed
- Replace console.log statements with proper logging or remove them:
- "AddToSubscriptionStart - 1"
- "AddToSubscriptionStart - 2"
- "AddToSubscriptionStart - 3"
client/apps/landing/src/hooks/use-lords-bridged.tsx (1)
Line range hint
26-41
: Add loading state check and improve error handling in balance fetch.The balance fetch effect should respect the loading state and provide more detailed error handling.
useEffect(() => { + if (isLoading || !bridgeContract?.address) return; + const fetchBalance = async () => { try { const result = await provider.provider.callContract({ contractAddress: lordsAddress, entrypoint: "balance_of", - calldata: [bridgeContract?.address || "0x0"], + calldata: [bridgeContract.address], }); setLordsBalance(BigInt(result[0])); } catch (error) { - console.error("Error fetching balance:", error); + console.error(`Error fetching balance for bridge ${bridgeContract.address}:`, error); setLordsBalance(0n); } }; fetchBalance(); - }, [provider, bridgeContract?.address]); + }, [provider, bridgeContract?.address, isLoading]);client/apps/landing/src/routes/mint.lazy.tsx (2)
54-54
: Improve environment check implementation.The environment check could be improved in several ways:
- Move it to a shared configuration
- Use a more descriptive constant name
- Consider using environment variables for feature flags
Consider extracting this to a shared configuration:
// config/environment.ts export const ENV = { isDevelopment: meta.env.VITE_PUBLIC_CHAIN === 'local', // Add other environment checks here } as const;Then update the component:
- const isDev = meta.env.VITE_PUBLIC_CHAIN === "local"; + const { isDevelopment } = ENV; - {isDev? ( + {isDevelopment ? (Also applies to: 104-109
Line range hint
1-144
: Consider splitting the component for better maintainability.The component has multiple responsibilities and is quite large. Consider splitting it into smaller, focused components:
- MintControls
- MintGrid
- MintActions
This would improve:
- Code organization
- Testing
- Reusability
- Maintenance
Would you like me to help create a detailed plan for this refactoring?
client/apps/landing/.env.mainnet (1)
1-24
: Consider implementing a more robust configuration management systemTo improve the management of environment-specific configurations, consider:
- Using a configuration validation system to ensure all required values are provided
- Implementing environment-specific configuration files
- Setting up a secure secrets management system
- Adding configuration documentation
Would you like me to provide an example implementation of a configuration validation system?
🧰 Tools
🪛 Gitleaks (8.21.2)
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/src/hooks/context/dojo-context.tsx (2)
154-176
: Refactor the account initialization retry logicThe current retry mechanism using
setTimeout
and a retry counter may lead to delayed initialization or potential issues ifcontrollerAccount
remainsnull
. Consider refactoring this logic to use React's effect dependencies or a more reliable method to handle asynchronous account initialization. This can improve code readability and maintainability.
200-211
: Simplify the redundant!isConnected
checkInside the condition where
!isConnected
is alreadytrue
, the additional check!isConnected && (...)
is redundant. You can simplify the code by removing the unnecessary condition, which will enhance readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (22)
client/apps/game-docs/docs/pages/development/getting-started.mdx
(0 hunks)client/apps/game/.env.mainnet
(1 hunks)client/apps/game/.env.production
(1 hunks)client/apps/game/.env.sepolia
(1 hunks)client/apps/game/.env.slot
(1 hunks)client/apps/game/env.ts
(1 hunks)client/apps/game/src/hooks/context/dojo-context.tsx
(3 hunks)client/apps/game/src/main.tsx
(1 hunks)client/apps/game/src/three/scenes/hexagon-scene.ts
(1 hunks)client/apps/game/src/ui/layouts/onboarding.tsx
(4 hunks)client/apps/game/src/ui/layouts/world.tsx
(2 hunks)client/apps/game/src/ui/modules/onboarding/steps.tsx
(2 hunks)client/apps/game/vite.config.ts
(3 hunks)client/apps/landing/.env.mainnet
(1 hunks)client/apps/landing/.env.sepolia
(1 hunks)client/apps/landing/.env.slot
(1 hunks)client/apps/landing/env.ts
(1 hunks)client/apps/landing/src/components/modules/bridge-fees.tsx
(2 hunks)client/apps/landing/src/hooks/context/DojoContext.tsx
(2 hunks)client/apps/landing/src/hooks/use-lords-bridged.tsx
(2 hunks)client/apps/landing/src/routes/mint.lazy.tsx
(3 hunks)client/apps/landing/tsconfig.json
(1 hunks)
💤 Files with no reviewable changes (1)
- client/apps/game-docs/docs/pages/development/getting-started.mdx
🚧 Files skipped from review as they are similar to previous changes (4)
- client/apps/game/src/ui/modules/onboarding/steps.tsx
- client/apps/game/src/ui/layouts/onboarding.tsx
- client/apps/landing/src/components/modules/bridge-fees.tsx
- client/apps/landing/env.ts
🧰 Additional context used
🪛 Gitleaks (8.21.2)
client/apps/game/.env.sepolia
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/.env.slot
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/landing/.env.mainnet
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/landing/.env.slot
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
client/apps/game/.env.mainnet
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🪛 GitHub Actions: knip
client/apps/landing/src/hooks/use-lords-bridged.tsx
[error] 5-5: Unresolved import: '../../../../common/utils'
🪛 GitHub Actions: lint
client/apps/game/env.ts
[warning] Code style issues found. File needs to be formatted with Prettier.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: clippy
🔇 Additional comments (25)
client/apps/landing/tsconfig.json (2)
7-9
: LGTM! Path aliases are properly configured.The path mappings are well-structured, with both the standard
@/*
alias for source files and the newenv
module mapping.
10-12
: Verify JavaScript usage in the codebase.The addition of
allowJs
suggests mixed JavaScript/TypeScript usage. While this enables gradual TypeScript adoption, it's important to ensure this aligns with the team's TypeScript migration strategy.Let's check for JavaScript files in the codebase:
✅ Verification successful
allowJs
configuration is properly justifiedThe setting is appropriate as it's needed for JavaScript configuration files (eslint, postcss, tailwind) while maintaining TypeScript for application code. This aligns with the project's TypeScript strategy, as evidenced by similar configuration in the game app.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for JavaScript files in the src directory # Expected: Confirm if there are .js files that justify enabling allowJs echo "Checking for JavaScript files in the landing app..." fd -e js . client/apps/landing/src echo "Checking TypeScript configuration in other apps..." fd tsconfig.json client/appsLength of output: 392
Script:
#!/bin/bash # Check TypeScript configurations and look for JavaScript files echo "Content of other apps' TypeScript configs:" for config in client/apps/*/tsconfig.json; do echo -e "\n=== $config ===" cat "$config" | grep -A 1 "allowJs" done echo -e "\nChecking for env.ts/env.js in landing app:" fd "env\.(ts|js)" client/apps/landing echo -e "\nChecking for any JS files in landing app root:" fd -e js . client/apps/landing --max-depth 1Length of output: 1213
client/apps/landing/src/hooks/context/DojoContext.tsx (3)
51-55
: Simplified Provider Logic Enhances ClarityThe direct return of
<DojoContextProvider>
without conditional checks simplifies theDojoProvider
component and improves readability and maintainability.
94-94
: Display Address Logic is CorrectThe
displayAddr
correctly usescontrollerAccount.address
when available, and falls back tomasterAddress
whencontrollerAccount
is not available. This ensures that the account display is always accurate.
102-105
: Context Account Object Properly StructuredThe
account
object in the context provider is appropriately populated withcontrollerAccount
anddisplayAddr
, matching theDojoAccount
interface. This ensures consistency across the application when accessing account information.client/apps/game/src/ui/layouts/world.tsx (2)
10-10
: LGTM: LoadingStateKey import looks good.The import is correctly placed and properly used throughout the file for type-safe loading state management.
343-343
: Verify VITE_PUBLIC_GRAPHICS_DEV environment variable configuration.The Leva debug panel visibility now depends on a single environment variable, which is more maintainable. However, we should ensure this variable is properly configured across all environments.
Run this script to check the environment variable configuration:
✅ Verification successful
Environment variable VITE_PUBLIC_GRAPHICS_DEV is properly configured
The variable is:
- Documented in the getting started guide with default value
- Type-safe with Zod validation
- Optional with a default
false
value- Consistently used across the codebase
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if VITE_PUBLIC_GRAPHICS_DEV is defined in environment files # and compare with previous environment variables # Search for the new and old environment variables in all potential env files echo "Checking environment variable configuration..." fd -t f -e env . | xargs grep -l "VITE_PUBLIC_GRAPHICS_DEV\|VITE_PUBLIC_DEV\|VITE_PUBLIC_HIDE_THREEJS_MENU" || trueLength of output: 219
Script:
#!/bin/bash # Search for environment variable usage and configuration echo "Searching for environment variable usage..." rg "VITE_PUBLIC_GRAPHICS_DEV" -l echo -e "\nChecking for example environment files..." fd -t f ".env.example|.env.sample|.env.template" echo -e "\nSearching for environment configuration setup..." rg "defineConfig|loadEnv" -lLength of output: 919
Script:
#!/bin/bash # Check documentation and environment setup echo "Checking documentation for environment setup..." cat client/apps/game-docs/docs/pages/development/getting-started.mdx echo -e "\nChecking environment type definitions..." cat client/apps/game/env.tsLength of output: 5268
client/apps/landing/src/hooks/use-lords-bridged.tsx (1)
2-3
: 🛠️ Refactor suggestionRemove commented code and fix import path.
The commented code and TODO should be removed as they don't provide value. Additionally, there's a pipeline failure indicating that the import path
../../../../common/utils
is unresolved.-// why not working -// import { env } from "env";✅ Verification successful
Remove commented debugging code
The commented env import appears to be a temporary debugging note and should be removed. The common/utils import is correct and consistent with other files in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the correct path for common/utils fd --type f "utils.(ts|tsx|js|jsx)" --exec echo "{}"Length of output: 884
Script:
#!/bin/bash # Check for env imports and module rg "from ['\"]env['\"]" -A 2 # Check for common/utils references rg "from ['\"].*common/utils['\"]" -A 2Length of output: 1718
client/apps/landing/.env.mainnet (3)
9-13
: Review network configuration inconsistenciesThere are several potential issues in the network configuration:
VITE_PUBLIC_TORII
points to localhost while other endpoints are production URLs- Inconsistent slot versions:
sepolia-rc-17
vssepolia-rc-18
in the relay URLPlease verify:
- Should
VITE_PUBLIC_TORII
point to a production URL?- Which slot version is correct for season 1?
15-18
: Verify game version for season 1 releaseThe game version is set to a release candidate (
v1.0.0-rc7
) in what appears to be a production environment file. Should this be updated to a stable release version for season 1?
6-7
: Verify addresses for season 1 transitionSince this PR is transitioning to season 1, please verify that these addresses are correct for the new season:
- VRF provider address
- Client fee recipient address
✅ Verification successful
Addresses are correctly configured for season 1
- VRF provider address is consistently configured across the codebase
- Client fee recipient address is properly set for mainnet environment
- No conflicting configurations found in other environment files
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any references to these addresses in the codebase # to ensure consistency across the transition echo "Searching for VRF provider address references..." rg -l "0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f" echo "Searching for client fee recipient address references..." rg -l "0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5"Length of output: 531
Script:
#!/bin/bash # Check the context of these addresses in configuration files echo "=== VRF Provider Address Context ===" echo "In sepolia.json:" cat config/environments/data/sepolia.json echo -e "\nIn slot.json:" cat config/environments/data/slot.json echo -e "\nIn policies.ts:" cat client/apps/game/src/hooks/context/policies.ts echo -e "\n=== Client Fee Recipient Context ===" echo "In _shared_.ts:" cat config/environments/_shared_.ts # Look for any potential different addresses that might be overrides echo -e "\n=== Checking for potential address overrides ===" rg -i "VRF_PROVIDER|FEE_RECIPIENT" .env*Length of output: 66705
Script:
#!/bin/bash # Check each file separately with proper output handling echo "=== VRF Provider Context ===" echo "In policies.ts:" cat client/apps/game/src/hooks/context/policies.ts echo -e "\nIn slot.json:" cat config/environments/data/slot.json echo -e "\n=== Client Fee Recipient Context ===" echo "In _shared_.ts:" cat config/environments/_shared_.ts # Check for any environment-specific overrides in .env files echo -e "\n=== Environment-specific configurations ===" find . -maxdepth 3 -type f -name ".env*" -exec sh -c 'echo "=== $1 ==="; cat "$1"' sh {} \;Length of output: 82084
Script:
#!/bin/bash # Check environment files specifically echo "=== Environment Files ===" for env_file in $(find . -maxdepth 3 -type f -name ".env*"); do echo "File: $env_file" grep -E "VRF_PROVIDER|FEE_RECIPIENT" "$env_file" || echo "No matching configuration found" doneLength of output: 1253
client/apps/game/src/hooks/context/dojo-context.tsx (1)
137-139
: Verify the creation of anAccount
with address "0x0" in spectator modeWhen
isSpectatorMode
istrue
, anAccount
is created with address and private key set to"0x0"
. Ensure that this practice does not cause unintended side effects or errors in the application. Verify that operations performed with this account handle the"0x0"
address correctly.client/apps/game/.env.production (1)
16-17
: Ensure boolean environment variables are correctly handled in codeEnvironment variables like
VITE_PUBLIC_GRAPHICS_DEV=false
are strings. When used in code, the string"false"
is truthy in JavaScript. Ensure that the code correctly parses this string to a boolean before using it in conditional statements to prevent unintended behavior.client/apps/game/.env.mainnet (1)
6-11
: Verify the configuration URLs and network settings.The configuration includes critical network endpoints for mainnet. Ensure these are the correct production URLs and are properly secured (HTTPS).
✅ Verification successful
Network configuration verified and secure ✅
All endpoints are properly configured using secure protocols (HTTPS/WSS) and point to the correct production environment.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the network endpoints are accessible and secure for url in $(grep -E "^VITE_PUBLIC.*_URL|^VITE_PUBLIC.*TORII" client/apps/game/.env.mainnet); do domain=$(echo $url | cut -d= -f2 | cut -d/ -f3) echo "Checking $domain..." if ! echo "$url" | grep -q "^VITE_PUBLIC.*=https://"; then echo "Warning: Non-HTTPS URL found: $url" fi doneLength of output: 1623
client/apps/landing/.env.slot (1)
11-12
: Fix: Empty VITE_PUBLIC_SLOT value.The VITE_PUBLIC_SLOT variable is empty. This could cause issues in the application if this value is required.
client/apps/game/.env.slot (2)
10-12
: Replace placeholder URLs with actual endpoints.The following URLs are using placeholder domains:
VITE_PUBLIC_IMAGE_CDN_URL=https://abc.com VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com VITE_PUBLIC_IPFS_GATEWAY=https://abc.com
18-22
: Verify slot configuration consistency.The slot configuration appears to use a different naming pattern ('slot-old-star') compared to other environment files. Ensure this is intentional and consistent with the deployment strategy.
✅ Verification successful
Slot configuration is consistent with environment-specific naming patterns
The different slot naming pattern ('slot-old-star') is intentional, as each environment type (mainnet, sepolia, slot) consistently uses its own specific naming convention:
- Mainnet/Production: eternum-prod
- Sepolia: sepolia-rc-17
- Slot: slot-old-star
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for slot naming consistency across env files echo "Analyzing slot naming patterns..." fd -t f "^\.env" -x grep "^VITE_PUBLIC_SLOT=" {} \;Length of output: 341
Script:
#!/bin/bash # Check for slot-related configurations in env files echo "=== Environment Variables ===" fd -H -t f "^\.env" -x grep -H "VITE_PUBLIC_SLOT\|VITE_PUBLIC_CHAIN" {} \; echo -e "\n=== Related Documentation ===" fd -t f "README.md|CONTRIBUTING.md|DEPLOYMENT.md" -x grep -i -A 3 "slot.*configuration\|deployment.*slot" {} \;Length of output: 1339
client/apps/game/env.ts (4)
18-18
: Good practice: Optional flags with defaultsMaking development flags optional with sensible defaults improves developer experience and reduces configuration overhead.
Also applies to: 20-20, 23-23
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
21-21
: Chain enum values are inconsistent across the codebaseThe change from "testnet" to "slot" in
game/env.ts
creates an inconsistency withclient/apps/landing/env.ts
, which still uses "testnet".🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
26-26
: Consistent naming with PUBLIC prefixGood change renaming VRF_PROVIDER_ADDRESS to include the PUBLIC prefix, maintaining consistency with other environment variables.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
31-31
: Verify the URL validation for social linkThe social link URL validation is properly implemented using
z.string().url()
. However, ensure that the default empty string doesn't cause issues in components consuming this value.✅ Verification successful
Empty string default for social link URL is safely implemented
The codebase shows proper handling of the optional social link URL across all usage locations. The empty string default is safe and follows common practices for optional URL fields.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usage of VITE_SOCIAL_LINK to verify empty string handling rg "VITE_SOCIAL_LINK" -A 3Length of output: 1303
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code style issues found. File needs to be formatted with Prettier.
client/apps/game/vite.config.ts (2)
19-19
: Improved dev mode conditionUsing
VITE_PUBLIC_CHAIN === "local"
for dev options is more explicit and reduces configuration complexity by eliminating the need for a separate dev flag.
61-61
: Verify asset paths after directory structure changesThe changes to asset paths require verification:
- New alias
@/assets
points to "../../public/assets"- Public directory changed to "../../public"
Please ensure all asset imports and public assets are still accessible after these changes.
Also applies to: 102-102
client/apps/game/src/main.tsx (2)
71-71
: Consistent environment variable usageGood changes:
- Using renamed
VITE_PUBLIC_VRF_PROVIDER_ADDRESS
- Adding
useBurner
based on chain, which aligns with the new development mode approach
79-81
: Verify stats initialization impactThe change from
VITE_PUBLIC_SHOW_FPS
toVITE_PUBLIC_GRAPHICS_DEV
consolidates development features but might affect existing setups. Ensure this doesn't break any monitoring or debugging workflows.✅ Verification successful
Stats initialization change is safe ✅
The change from
VITE_PUBLIC_SHOW_FPS
toVITE_PUBLIC_GRAPHICS_DEV
is part of a consistent consolidation of development features. No references to the old flag exist, and the new flag properly controls stats initialization along with other development features like light helpers and GUI placement.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any remaining references to SHOW_FPS rg "SHOW_FPS" --type ts --type tsx # Check for stats usage rg "initStats" --type ts --type tsx -A 3Length of output: 131
Script:
#!/bin/bash # Search for both old and new environment variables rg "VITE_PUBLIC_SHOW_FPS|VITE_PUBLIC_GRAPHICS_DEV" -g "*.{ts,tsx}" # Look for stats initialization and related patterns rg "initStats|stats" -g "*.{ts,tsx}" -A 3Length of output: 5013
const [bridgeContract, setBridgeContract] = useState<any>(null); | ||
|
||
useEffect(() => { | ||
const initManifest = async () => { | ||
const manifest = await getGameManifest(meta.env.VITE_PUBLIC_CHAIN); | ||
const bridge = manifest.contracts?.find((contract: { tag: string }) => contract.tag === "s1_eternum-resource_bridge_systems"); | ||
setBridgeContract(bridge); | ||
}; | ||
initManifest(); | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve type safety and error handling in manifest initialization.
The current implementation has several issues:
- Using
any
type forbridgeContract
reduces type safety - No error handling in
initManifest
- No loading state management
Consider this improved implementation:
- const [bridgeContract, setBridgeContract] = useState<any>(null);
+ interface BridgeContract {
+ tag: string;
+ address: string;
+ }
+ const [bridgeContract, setBridgeContract] = useState<BridgeContract | null>(null);
+ const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
const initManifest = async () => {
+ setIsLoading(true);
try {
const manifest = await getGameManifest(meta.env.VITE_PUBLIC_CHAIN);
const bridge = manifest.contracts?.find((contract: { tag: string }) =>
contract.tag === "s1_eternum-resource_bridge_systems"
);
+ if (!bridge) {
+ console.error("Bridge contract not found in manifest");
+ return;
+ }
setBridgeContract(bridge);
+ } catch (error) {
+ console.error("Error initializing manifest:", error);
+ } finally {
+ setIsLoading(false);
+ }
};
initManifest();
}, []);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const [bridgeContract, setBridgeContract] = useState<any>(null); | |
useEffect(() => { | |
const initManifest = async () => { | |
const manifest = await getGameManifest(meta.env.VITE_PUBLIC_CHAIN); | |
const bridge = manifest.contracts?.find((contract: { tag: string }) => contract.tag === "s1_eternum-resource_bridge_systems"); | |
setBridgeContract(bridge); | |
}; | |
initManifest(); | |
}, []); | |
interface BridgeContract { | |
tag: string; | |
address: string; | |
} | |
const [bridgeContract, setBridgeContract] = useState<BridgeContract | null>(null); | |
const [isLoading, setIsLoading] = useState(true); | |
useEffect(() => { | |
const initManifest = async () => { | |
setIsLoading(true); | |
try { | |
const manifest = await getGameManifest(meta.env.VITE_PUBLIC_CHAIN); | |
const bridge = manifest.contracts?.find((contract: { tag: string }) => | |
contract.tag === "s1_eternum-resource_bridge_systems" | |
); | |
if (!bridge) { | |
console.error("Bridge contract not found in manifest"); | |
return; | |
} | |
setBridgeContract(bridge); | |
} catch (error) { | |
console.error("Error initializing manifest:", error); | |
} finally { | |
setIsLoading(false); | |
} | |
}; | |
initManifest(); | |
}, []); |
// todo: why not working | ||
// import { env } from "env"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove commented code.
The commented code and TODO should be removed as they don't provide value.
-// todo: why not working
-// import { env } from "env";
// marketplace | ||
VITE_PUBLIC_ARK_MARKETPLACE_API=https://abc.com | ||
VITE_PUBLIC_IMAGE_CDN_URL=https://abc.com | ||
VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com | ||
VITE_PUBLIC_IPFS_GATEWAY=https://abc.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace placeholder URLs with actual production endpoints
The marketplace and CDN URLs are currently set to placeholder values (abc.com
). These should be replaced with the actual production endpoints for season 1.
Please provide the correct production URLs for:
- ARK marketplace API
- Image CDN
- Image proxy
- IPFS gateway
VITE_PUBLIC_MASTER_ADDRESS=0x01BFC84464f990C09Cc0e5D64D18F54c3469fD5c467398BF31293051bAde1C39 | ||
VITE_PUBLIC_MASTER_PRIVATE_KEY=0x075362a844768f31c8058ce31aec3dd7751686440b4f220f410ae0c9bf042e60 | ||
VITE_PUBLIC_ACCOUNT_CLASS_HASH="0x07dc7899aa655b0aae51eadff6d801a58e97dd99cf4666ee59e704249e51adf2" | ||
VITE_PUBLIC_FEE_TOKEN_ADDRESS=0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRITICAL: Remove sensitive credentials from version control
Exposing private keys and sensitive addresses in the repository poses significant security risks:
- The master private key should never be committed to version control
- These credentials should be managed through secure secret management systems
Recommended actions:
- Immediately rotate the exposed private key
- Move sensitive values to environment-specific secret management
- Update the file to use placeholder values:
-VITE_PUBLIC_MASTER_PRIVATE_KEY=0x075362a844768f31c8058ce31aec3dd7751686440b4f220f410ae0c9bf042e60
+VITE_PUBLIC_MASTER_PRIVATE_KEY=${MASTER_PRIVATE_KEY}
- Add this file to
.gitignore
- Provide a
.env.example
template instead
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
VITE_PUBLIC_MASTER_ADDRESS=0x01BFC84464f990C09Cc0e5D64D18F54c3469fD5c467398BF31293051bAde1C39 | |
VITE_PUBLIC_MASTER_PRIVATE_KEY=0x075362a844768f31c8058ce31aec3dd7751686440b4f220f410ae0c9bf042e60 | |
VITE_PUBLIC_ACCOUNT_CLASS_HASH="0x07dc7899aa655b0aae51eadff6d801a58e97dd99cf4666ee59e704249e51adf2" | |
VITE_PUBLIC_FEE_TOKEN_ADDRESS=0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 | |
VITE_PUBLIC_MASTER_ADDRESS=0x01BFC84464f990C09Cc0e5D64D18F54c3469fD5c467398BF31293051bAde1C39 | |
VITE_PUBLIC_MASTER_PRIVATE_KEY=${MASTER_PRIVATE_KEY} | |
VITE_PUBLIC_ACCOUNT_CLASS_HASH="0x07dc7899aa655b0aae51eadff6d801a58e97dd99cf4666ee59e704249e51adf2" | |
VITE_PUBLIC_FEE_TOKEN_ADDRESS=0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 |
🧰 Tools
🪛 Gitleaks (8.21.2)
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
4-4: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
<DojoContextProvider | ||
value={value} | ||
masterAccount={masterAccount} | ||
controllerAccount={controllerAccount!} | ||
backgroundImage={backgroundImage} | ||
> | ||
<DojoContextProvider | ||
value={value} | ||
masterAccount={masterAccount} | ||
controllerAccount={controllerAccount!} | ||
backgroundImage={backgroundImage} | ||
> | ||
{children} | ||
</DojoContextProvider> | ||
</BurnerProvider> | ||
{children} | ||
</DojoContextProvider> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using non-null assertion on controllerAccount
Using controllerAccount!
assumes that controllerAccount
is always defined. If controllerAccount
is null
or undefined
, this could lead to runtime errors. Consider adding a null check or handling the case when controllerAccount
is not available before passing it to DojoContextProvider
.
@@ -117,7 +117,7 @@ export abstract class HexagonScene { | |||
|
|||
private setupLightHelper(): void { | |||
this.lightHelper = new THREE.DirectionalLightHelper(this.mainDirectionalLight, 1); | |||
if (env.VITE_PUBLIC_DEV == true) this.scene.add(this.lightHelper); | |||
if (env.VITE_PUBLIC_GRAPHICS_DEV == true) this.scene.add(this.lightHelper); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the comparison of the environment variable
env.VITE_PUBLIC_GRAPHICS_DEV
is a string, so comparing it to a boolean true
may not yield the expected result. Update the condition to compare the string value:
if (env.VITE_PUBLIC_GRAPHICS_DEV === 'true') this.scene.add(this.lightHelper);
Alternatively, convert the string to a boolean:
if (env.VITE_PUBLIC_GRAPHICS_DEV === 'true') this.scene.add(this.lightHelper);
This ensures the condition behaves as intended.
VITE_PUBLIC_MASTER_ADDRESS=0x5013b17c43a2b664ec2a38aa45f6d891db1188622ec7cf320411321c3248fb5 | ||
VITE_PUBLIC_MASTER_PRIVATE_KEY=0x5013b17c43a2b664ec2a38aa45f6d891db1188622ec7cf320411321c3248fb5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Remove sensitive information from version control.
The master address and private key should not be committed to version control. This poses a significant security risk.
Recommended actions:
- Remove these values and use environment-specific key management
- Add these variables to
.gitignore
- Provide a template file (e.g.,
.env.example
) with placeholder values
🧰 Tools
🪛 Gitleaks (8.21.2)
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
// optional | ||
VITE_PUBLIC_GAME_VERSION="v1.0.0-rc7" | ||
VITE_PUBLIC_GRAPHICS_DEV=false | ||
VITE_SOCIAL_LINK=http://bit.ly/3Zz1mpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix: Remove inline comments in environment file.
The comment "// optional" should be removed from the environment file. Environment files should only contain key-value pairs.
-// optional
VITE_PUBLIC_GAME_VERSION="v1.0.0-rc7"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// optional | |
VITE_PUBLIC_GAME_VERSION="v1.0.0-rc7" | |
VITE_PUBLIC_GRAPHICS_DEV=false | |
VITE_SOCIAL_LINK=http://bit.ly/3Zz1mpp | |
VITE_PUBLIC_GAME_VERSION="v1.0.0-rc7" | |
VITE_PUBLIC_GRAPHICS_DEV=false | |
VITE_SOCIAL_LINK=http://bit.ly/3Zz1mpp |
VITE_PUBLIC_SLOT= | ||
|
||
VITE_PUBLIC_CONSTRUCTION_FLAG=false | ||
VITE_PUBLIC_HIDE_THREEJS_MENU=false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update placeholder URLs with actual endpoints.
Multiple URLs are using the placeholder domain 'abc.com'. These should be updated with actual production URLs:
- VITE_PUBLIC_ARK_MARKETPLACE_API
- VITE_PUBLIC_IMAGE_CDN_URL
- VITE_PUBLIC_IMAGE_PROXY_URL
- VITE_PUBLIC_IPFS_GATEWAY
Summary by CodeRabbit
Based on the comprehensive summary of changes, here are the high-level release notes:
Release Notes
🚀 New Features
ETERNUM_CONFIG()
function🔧 Configuration Updates
EternumGlobalConfig
with more flexible configuration methods🌐 Model and Address Management
💡 Development Improvements
🔒 Security and Performance
🏗️ Breaking Changes