Skip to content

Commit

Permalink
bank
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Dec 12, 2024
1 parent 6048689 commit 90afac3
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions client/src/ui/components/trading/MarketModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ReactComponent as Scroll } from "@/assets/icons/Scroll.svg";
import { ReactComponent as Sparkles } from "@/assets/icons/Sparkles.svg";
import { ReactComponent as Swap } from "@/assets/icons/Swap.svg";
import { BattleManager } from "@/dojo/modelManager/BattleManager";
import { addToSubscription } from "@/dojo/queries";
import { configManager } from "@/dojo/setup";
import { useDojo } from "@/hooks/context/DojoContext";
import { useBattlesByPosition } from "@/hooks/helpers/battles/useBattles";
Expand All @@ -25,10 +26,10 @@ import { formatTimeDifference } from "@/ui/modules/military/battle-view/BattlePr
import { currencyFormat, getEntityIdFromKeys } from "@/ui/utils/utils";
import { ID, ResourcesIds } from "@bibliothecadao/eternum";
import { useComponentValue } from "@dojoengine/react";
import { Suspense, lazy, useMemo, useState } from "react";
import { Suspense, lazy, useEffect, useMemo, useState } from "react";
import { ModalContainer } from "../ModalContainer";
import { HintModal } from "../hints/HintModal";
import { TroopDisplay } from "../military/TroopChip";
import { ModalContainer } from "../ModalContainer";

const MarketResourceSidebar = lazy(() =>
import("./MarketResourceSideBar").then((module) => ({ default: module.MarketResourceSidebar })),
Expand Down Expand Up @@ -70,6 +71,20 @@ export const MarketModal = () => {

const bankStructure = getStructure(bank?.position || { x: 0, y: 0 });

useEffect(() => {
const fetch = async () => {
await addToSubscription(
dojo.setup.network.toriiClient,
dojo.setup.sync,
dojo.setup.network.contractComponents as any,
structureEntityId.toString(),
{ x: 0, y: 0 },
);
};

fetch();
}, [bankStructure?.entity_id]);

const battle = useMemo(() => {
if (battles.length === 0) return null;
return battles
Expand Down

0 comments on commit 90afac3

Please sign in to comment.