From c070d43a1c9b0b148248c2c6112c9d55324ffce9 Mon Sep 17 00:00:00 2001 From: RedBeardEth <90423049+RedBeardEth@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:07:39 +1100 Subject: [PATCH 1/6] fix for 0 donkey bridge, base manifest on chain env --- landing/dojoConfig.ts | 8 ++++++-- landing/src/components/modules/bridge-in.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/landing/dojoConfig.ts b/landing/dojoConfig.ts index 41617863d..b80bfa33d 100644 --- a/landing/dojoConfig.ts +++ b/landing/dojoConfig.ts @@ -19,9 +19,13 @@ const { // const isLocal = VITE_PUBLIC_CHAIN === "local" || VITE_PUBLIC_CHAIN === "testnet"; // const manifest = VITE_PUBLIC_DEV === true && isLocal ? devManifest : productionManifest; -let manifest = VITE_PUBLIC_DEV === true ? devManifest : sepoliaManifest; +const manifestMap = { + 'local': devManifest, + 'mainnet': productionManifest, + 'sepolia': sepoliaManifest +} as const; -manifest = VITE_PUBLIC_CHAIN === "mainnet" ? productionManifest : manifest; +const manifest = manifestMap[VITE_PUBLIC_CHAIN as keyof typeof manifestMap] ?? sepoliaManifest; export const getManifest = () => { return manifest; diff --git a/landing/src/components/modules/bridge-in.tsx b/landing/src/components/modules/bridge-in.tsx index 8cfd63b3c..5dbc36d92 100644 --- a/landing/src/components/modules/bridge-in.tsx +++ b/landing/src/components/modules/bridge-in.tsx @@ -281,7 +281,7 @@ export const BridgeIn = () => { disabled={ isLoading || !realmEntityId || - donkeyBalance.balance <= donkeysNeeded || + donkeyBalance.balance < donkeysNeeded || !Object.values(selectedResourceAmounts).some((amount) => amount > 0) } onClick={() => onBridgeIntoRealm()} From 66a454e87b5f9d328076127c47c5fa539c5cee6b Mon Sep 17 00:00:00 2001 From: RedBeardEth <90423049+RedBeardEth@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:55:43 +1100 Subject: [PATCH 2/6] working multi bridge out step 2, fix transaction success states --- landing/src/components/modules/bridge-in.tsx | 12 +- .../components/modules/bridge-out-step-1.tsx | 10 +- .../components/modules/bridge-out-step-2.tsx | 240 ++++++++++++------ landing/src/components/ui/SelectResources.tsx | 12 +- landing/src/components/ui/utils/utils.ts | 5 +- landing/src/dojo/createSystemCalls.ts | 9 +- landing/src/hooks/helpers/useResources.tsx | 4 +- landing/src/hooks/useBridge.tsx | 15 +- sdk/packages/eternum/src/provider/index.ts | 20 +- sdk/packages/eternum/src/types/provider.ts | 6 +- 10 files changed, 217 insertions(+), 116 deletions(-) diff --git a/landing/src/components/modules/bridge-in.tsx b/landing/src/components/modules/bridge-in.tsx index 5dbc36d92..7613194b2 100644 --- a/landing/src/components/modules/bridge-in.tsx +++ b/landing/src/components/modules/bridge-in.tsx @@ -149,9 +149,11 @@ export const BridgeIn = () => { throw new Error("No valid resources selected"); } - await bridgeIntoRealm(validResources, ADMIN_BANK_ENTITY_ID, BigInt(realmEntityId!)); - setSelectedResourceIds([]); - setSelectedResourceAmounts({}); + const resp = await bridgeIntoRealm(validResources, ADMIN_BANK_ENTITY_ID, BigInt(realmEntityId!)); + if (resp) { + setSelectedResourceIds([]); + setSelectedResourceAmounts({}); + } } catch (error) { console.error("Bridge into realm error:", error); toast.error("Failed to transfer resources"); @@ -337,7 +339,7 @@ const ResourceInputRow = ({ : "0"; return ( -
+
{res?.id && ( diff --git a/landing/src/components/modules/bridge-out-step-1.tsx b/landing/src/components/modules/bridge-out-step-1.tsx index c14a1bc95..be6372648 100644 --- a/landing/src/components/modules/bridge-out-step-1.tsx +++ b/landing/src/components/modules/bridge-out-step-1.tsx @@ -136,11 +136,11 @@ export const BridgeOutStep1 = () => { }; }), ); - console.log(validResources); - await bridgeStartWithdrawFromRealm(validResources, ADMIN_BANK_ENTITY_ID, BigInt(realmEntityId!)); - - setSelectedResourceIds([]); - setSelectedResourceAmounts({}); + const tx = await bridgeStartWithdrawFromRealm(validResources, ADMIN_BANK_ENTITY_ID, BigInt(realmEntityId!)); + if (tx) { + setSelectedResourceIds([]); + setSelectedResourceAmounts({}); + } } finally { setIsLoading(false); } diff --git a/landing/src/components/modules/bridge-out-step-2.tsx b/landing/src/components/modules/bridge-out-step-2.tsx index 95cadc364..505bdec6c 100644 --- a/landing/src/components/modules/bridge-out-step-2.tsx +++ b/landing/src/components/modules/bridge-out-step-2.tsx @@ -1,33 +1,29 @@ +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"; import { useEntities } from "@/hooks/helpers/useEntities"; -import { donkeyArrivals } from "@/hooks/helpers/useResources"; +import { useDonkeyArrivals } from "@/hooks/helpers/useResources"; import { useBridgeAsset } from "@/hooks/useBridge"; import { displayAddress } from "@/lib/utils"; import { ADMIN_BANK_ENTITY_ID, RESOURCE_PRECISION, ResourcesIds } from "@bibliothecadao/eternum"; import { useAccount } from "@starknet-react/core"; -import { Loader } from "lucide-react"; -import { useMemo, useState } from "react"; +import { ChevronDown, ChevronUp, Loader } from "lucide-react"; +import { useEffect, useMemo, useState } from "react"; import { TypeP } from "../typography/type-p"; import { ShowSingleResource } from "../ui/SelectResources"; import { Button } from "../ui/button"; import { ResourceIcon } from "../ui/elements/ResourceIcon"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select"; +import { Input } from "../ui/input"; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../ui/table"; import { getSeasonAddresses } from "../ui/utils/utils"; import { BridgeFees } from "./bridge-fees"; export const BridgeOutStep2 = () => { const { address } = useAccount(); - const { getOwnerArrivalsAtBank, getDonkeyInfo } = donkeyArrivals(); - const [donkeyEntityId, setDonkeyEntityId] = useState(0n); + const { getOwnerArrivalsAtBank, getDonkeyInfo } = useDonkeyArrivals(); const [isLoading, setIsLoading] = useState(false); const [selectedResourceIds, setSelectedResourceIds] = useState([]); const [selectedResourceAmounts, setSelectedResourceAmounts] = useState<{ [key: string]: number }>({}); - const selectedResourceId = useMemo(() => selectedResourceIds[0] ?? 0, [selectedResourceIds]); - const selectedResourceAmount = useMemo( - () => selectedResourceAmounts[selectedResourceId] ?? 0, - [selectedResourceAmounts, selectedResourceId], - ); const [resourceFees, setResourceFees] = useState< { @@ -53,23 +49,65 @@ export const BridgeOutStep2 = () => { const { bridgeFinishWithdrawFromRealm } = useBridgeAsset(); const onFinishWithdrawFromBank = async () => { - if (selectedResourceId) { + if (selectedResourceIds.length) { const resourceAddresses = await getSeasonAddresses(); - const selectedResourceName = ResourcesIds[selectedResourceId]; - const tokenAddress = resourceAddresses[selectedResourceName.toUpperCase() as keyof typeof resourceAddresses][1]; + const donkeyResources = selectedResourceIds.map((id,index)=>( + { + tokenAddress: resourceAddresses[ResourcesIds[id].toUpperCase() as keyof typeof resourceAddresses][1], + from_entity_id: Array.from(selectedDonkeys)[index] + } + )) try { setIsLoading(true); - await bridgeFinishWithdrawFromRealm(tokenAddress as string, ADMIN_BANK_ENTITY_ID, donkeyEntityId); + const tx = await bridgeFinishWithdrawFromRealm(donkeyResources,ADMIN_BANK_ENTITY_ID); + if (tx) { + setSelectedDonkeys(new Set()); + setSelectedResourceIds([]); + setSelectedResourceAmounts({}); + } + } catch (e) { + console.log(e); } finally { - setDonkeyEntityId(0n); - setSelectedResourceIds([]); - setSelectedResourceAmounts({}); setIsLoading(false); } } }; const [isFeesOpen, setIsFeesOpen] = useState(false); + const [selectedDonkeys, setSelectedDonkeys] = useState>(new Set()); + const [isTableOpen, setIsTableOpen] = useState(false); + + const updateResourcesFromSelectedDonkeys = (selectedDonkeyIds: Set) => { + const allResources = Array.from(selectedDonkeyIds).flatMap( + (id) => + donkeyInfos.find((d) => d.donkeyEntityId && BigInt(d.donkeyEntityId) === id) + ?.donkeyResources || [], + ); + + setSelectedResourceIds(allResources.map((r) => r.resourceId as never)); + setSelectedResourceAmounts( + allResources.reduce( + (acc, r) => ({ + ...acc, + [r.resourceId]: (acc[r.resourceId] || 0) + r.amount / RESOURCE_PRECISION, + }), + {}, + ), + ); + }; + useEffect(() => { + const newSelected = new Set(); + + donkeyInfos?.forEach((donkey) => { + if (Number(donkey.donkeyArrivalTime) * 1000 <= Date.now()) { + newSelected.add(BigInt(donkey.donkeyEntityId || 0)); + } + }); + + setSelectedDonkeys(newSelected); + updateResourcesFromSelectedDonkeys(newSelected); + }, [donkeyInfos]); + return ( <>
@@ -78,64 +116,114 @@ export const BridgeOutStep2 = () => { and you will be unable to withdraw 1 hour after the Season is won
-
-
-
Select Donkey
- -
-
-
To
-
{displayAddress(address || "")}
-
+
+
Withdraw To
+
{displayAddress(address || "")}
- {selectedResourceIds.length > 0 && ( - setSelectedResourceIds(value as unknown as never[])} - selectedResourceAmounts={selectedResourceAmounts} - setSelectedResourceAmounts={setSelectedResourceAmounts} - /> - )} + + +
Select Donkeys (optional)
+ {isTableOpen ? ( + + ) : ( + + )} +
+ + +
+ + + + + 0 && selectedDonkeys.size === donkeyInfos.length} + onChange={() => { + const newSelected = new Set(); + + if (selectedDonkeys.size !== donkeyInfos.length) { + donkeyInfos.forEach((donkey) => { + if (Number(donkey.donkeyArrivalTime) * 1000 <= Date.now()) { + newSelected.add(BigInt(donkey.donkeyEntityId || 0)); + } + }); + } + setSe + setSelectedDonkeys(newSelected); + updateResourcesFromSelectedDonkeys(newSelected); + }} + /> + + Donkey ID + Resources + Status + + + + {donkeyInfos?.map((donkey) => { + const isArrived = Number(donkey.donkeyArrivalTime) * 1000 <= Date.now(); + return ( + { + if (!isArrived) return; + + const newSelected = new Set(selectedDonkeys); + const donkeyId = BigInt(donkey.donkeyEntityId || 0); + if (newSelected.has(donkeyId)) { + newSelected.delete(donkeyId); + } else { + newSelected.add(donkeyId); + } + setSelectedDonkeys(newSelected); + updateResourcesFromSelectedDonkeys(newSelected); + }} + > + + + + #{donkey.donkeyEntityId} + + {donkey.donkeyResources.map((resource) => ( +
+ + {(resource.amount / RESOURCE_PRECISION).toFixed(2)} +
+ ))} +
+ + {Number(donkey.donkeyArrivalTime) * 1000 <= Date.now() ? ( + Arrived + ) : ( + `Arrives in ${Math.floor( + (Number(donkey.donkeyArrivalTime) * 1000 - Date.now()) / (1000 * 60 * 60), + )}h ${Math.floor(((Number(donkey.donkeyArrivalTime) * 1000 - Date.now()) / (1000 * 60)) % 60)}m` + )} + +
+ ); + })} + {!donkeyInfos?.length && ( + + + No donkeys found at the bank + + + )} +
+
+
+
+
{
- + {feesForAllResources.map((fees) => { const resourceName = ResourcesIds[fees.id as keyof typeof ResourcesIds]; return ( -
+
{resourceName} @@ -114,11 +114,10 @@ export const BridgeFees = ({
{fees.seasonPoolFee}
-
+
Client Fees ({calculateBridgeFeeDisplayPercent(bridgeConfig.client_fee_on_dpt_percent)}%)
{fees.clientFee}
-
); })} diff --git a/landing/src/components/modules/bridge-in.tsx b/landing/src/components/modules/bridge-in.tsx index 7613194b2..483df7697 100644 --- a/landing/src/components/modules/bridge-in.tsx +++ b/landing/src/components/modules/bridge-in.tsx @@ -258,9 +258,9 @@ export const BridgeIn = () => { setResourceFees={setResourceFees} type="deposit" /> -
+
-
Total Amount Received
+
Resources Received
{Object.entries(selectedResourceAmounts).map(([id, amount]) => { if (amount === 0) return null; @@ -268,7 +268,7 @@ export const BridgeIn = () => { return (
- {resourceName} + {resourceName}
{(amount - Number(resourceFees.find((fee) => fee.id === id)?.totalFee ?? 0)).toFixed(2)}
diff --git a/landing/src/components/modules/bridge.tsx b/landing/src/components/modules/bridge.tsx deleted file mode 100644 index aa4e4f7f8..000000000 --- a/landing/src/components/modules/bridge.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export const Bridge = () => { - return
Bridge
; -}; diff --git a/landing/src/components/modules/swap-panel.tsx b/landing/src/components/modules/swap-panel.tsx index df22a554d..a5fb46b7c 100644 --- a/landing/src/components/modules/swap-panel.tsx +++ b/landing/src/components/modules/swap-panel.tsx @@ -1,4 +1,5 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { BookOpen } from "lucide-react"; import { BridgeIn } from "./bridge-in"; import { BridgeOutStep1 } from "./bridge-out-step-1"; import { BridgeOutStep2 } from "./bridge-out-step-2"; @@ -28,6 +29,16 @@ export const SwapPanel = () => { +
); }; diff --git a/landing/src/routes/season-passes.lazy.tsx b/landing/src/routes/season-passes.lazy.tsx index 16dbef7a4..948b0578f 100644 --- a/landing/src/routes/season-passes.lazy.tsx +++ b/landing/src/routes/season-passes.lazy.tsx @@ -20,7 +20,7 @@ export const Route = createLazyFileRoute("/season-passes")({ function SeasonPasses() { const { connectors } = useConnect(); - const { address, account } = useAccount(); + const { address } = useAccount(); const [isTransferOpen, setIsTransferOpen] = useState(false); From 2eb2ced3c93fb43c56e2e86adb92434498050362 Mon Sep 17 00:00:00 2001 From: RedBeardEth <90423049+RedBeardEth@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:48:59 +1100 Subject: [PATCH 4/6] update dojo version --- landing/package.json | 12 ++-- pnpm-lock.yaml | 136 +++++++++++++++++++++---------------------- 2 files changed, 73 insertions(+), 75 deletions(-) diff --git a/landing/package.json b/landing/package.json index b43917c44..b28262fa3 100644 --- a/landing/package.json +++ b/landing/package.json @@ -19,13 +19,13 @@ "@bibliothecadao/eternum": "workspace:^", "@cartridge/connector": "^0.5.3", "@cartridge/controller": "^0.5.3", - "@dojoengine/core": "1.0.1", - "@dojoengine/create-burner": "1.0.1", - "@dojoengine/react": "1.0.1", + "@dojoengine/core": "1.0.3-alpha.1", + "@dojoengine/create-burner": "1.0.3-alpha.1", + "@dojoengine/react": "1.0.3-alpha.1", "@dojoengine/recs": "^2.0.13", - "@dojoengine/state": "1.0.1", - "@dojoengine/torii-client": "1.0.1", - "@dojoengine/utils": "1.0.1", + "@dojoengine/state": "1.0.3-alpha.1", + "@dojoengine/torii-client": "1.0.3-alpha.1", + "@dojoengine/utils": "1.0.3-alpha.1", "@graphql-codegen/schema-ast": "^4.1.0", "@graphql-typed-document-node/core": "^3.2.0", "@headlessui/react": "^1.7.18", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 033831bc9..f0af970a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -424,26 +424,26 @@ importers: specifier: ^0.5.3 version: 0.5.5(encoding@0.1.13) '@dojoengine/core': - specifier: 1.0.1 - version: 1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2) + specifier: 1.0.3-alpha.1 + version: 1.0.3-alpha.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2) '@dojoengine/create-burner': - specifier: 1.0.1 - version: 1.0.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2) + specifier: 1.0.3-alpha.1 + version: 1.0.3-alpha.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2) '@dojoengine/react': - specifier: 1.0.1 - version: 1.0.1(@types/node@20.17.9)(@types/react@18.3.15)(jsdom@24.1.3)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(type-fest@4.26.1)(typescript@5.7.2)(zod@3.24.0) + specifier: 1.0.3-alpha.1 + version: 1.0.3-alpha.1(@types/node@20.17.9)(@types/react@18.3.15)(jsdom@24.1.3)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(type-fest@4.26.1)(typescript@5.7.2)(zod@3.24.0) '@dojoengine/recs': specifier: ^2.0.13 version: 2.0.13(typescript@5.7.2)(zod@3.24.0) '@dojoengine/state': - specifier: 1.0.1 - version: 1.0.1(@types/node@20.17.9)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.7.2)(zod@3.24.0) + specifier: 1.0.3-alpha.1 + version: 1.0.3-alpha.1(@types/node@20.17.9)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.7.2)(zod@3.24.0) '@dojoengine/torii-client': - specifier: 1.0.1 - version: 1.0.1 + specifier: 1.0.3-alpha.1 + version: 1.0.3-alpha.1 '@dojoengine/utils': - specifier: 1.0.1 - version: 1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.0) + specifier: 1.0.3-alpha.1 + version: 1.0.3-alpha.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.0) '@graphql-codegen/schema-ast': specifier: ^4.1.0 version: 4.1.0(graphql@16.9.0) @@ -1537,6 +1537,12 @@ packages: peerDependencies: starknet: 6.11.0 + '@dojoengine/core@1.0.3-alpha.1': + resolution: {integrity: sha512-UAKjqrgjThj3GpoDGnHp76yGSBO7jsC17iQEPIUevZcrRGFKYBlrE8TnW71y6ATo4xIu1d+OVh9mbhrZx/fG/Q==} + hasBin: true + peerDependencies: + starknet: 6.11.0 + '@dojoengine/create-burner@1.0.1': resolution: {integrity: sha512-E6k5baRzIo91pET90NGWOsUHyXYSuVapIb7lb8z8dvZ+Zdru+RzQqC9K8nIpFjjDtGTbfCaQb8fZ/meUuvf0Ww==} peerDependencies: @@ -1544,6 +1550,13 @@ packages: react-dom: ^18.2.0 starknet: 6.11.0 + '@dojoengine/create-burner@1.0.3-alpha.1': + resolution: {integrity: sha512-jV+9dXskKrgFVRjKFTanBE4AUwdiv8L99HSI7EFw7M0lkWDn07kvc1jIH1nmApE9NrKA/RzUsUfuuctKvCQHXw==} + peerDependencies: + react: ^18.2.0 + react-dom: ^18.2.0 + starknet: 6.11.0 + '@dojoengine/react@1.0.1': resolution: {integrity: sha512-DsAvGlrOuOjp2LeL6H3VHjcT32tz7dhvUIrjKRMgFX2NWcbqYVKaOv4Jm1YX4oSZi+SqDvKhlzrOma1sfrITdg==} peerDependencies: @@ -1551,6 +1564,13 @@ packages: starknet: 6.11.0 type-fest: ^2.14.0 + '@dojoengine/react@1.0.3-alpha.1': + resolution: {integrity: sha512-F5Rft2/p9365bJvAoy5JhgVS4Q7roxZ5oZR5xwJvX8Ni6kBzuO3gUJRLw3z52bYhBkyexqxM4IQwOxK6vRP46g==} + peerDependencies: + react: ^18.2.0 + starknet: 6.11.0 + type-fest: ^2.14.0 + '@dojoengine/recs@2.0.13': resolution: {integrity: sha512-Cgz4Unlnk2FSDoFTYKrJexX/KiSYPMFMxftxQkC+9LUKS5yNGkgFQM7xu4/L1HvpDAenL7NjUmH6ynRAS7Iifw==} @@ -1559,17 +1579,33 @@ packages: peerDependencies: starknet: 6.11.0 + '@dojoengine/state@1.0.3-alpha.1': + resolution: {integrity: sha512-wjInSqugEKhHu5L7RxOJI55mZ+J68k5QNfN/ESQxvecztTBMIF7PRBCizojVS56q0ke5dOhXsy7yxiIncs/OAg==} + peerDependencies: + starknet: 6.11.0 + '@dojoengine/torii-client@1.0.1': resolution: {integrity: sha512-10dFxX/wSFv7nSIAMo+Vly84CHyPEhyPB7T4od5aTDI+TuYOVIYqj4sDuytccZrj0cZmiDcw6vm9wL/C3rieKQ==} + '@dojoengine/torii-client@1.0.3-alpha.1': + resolution: {integrity: sha512-n3+Z6SyG2hovMrDvU3OMsSta3Ai37hW5Jy/DC+uYwJP55HNh0oHQ8ovGtBvwgytnMsKKnagpXzP68Ai8dHwmYg==} + '@dojoengine/torii-wasm@1.0.1': resolution: {integrity: sha512-/kr0BP+Kb6aNqtTPniFOLErHRhBoXWZnCoY1zuHjWQI0IJi820MjtgrCObG8TDjxHvtjgGLGt92IlwiTDlbdEQ==} + '@dojoengine/torii-wasm@1.0.3-alpha.1': + resolution: {integrity: sha512-piNAMay3E1ZFSgzJ4DE2zySf7FqtRJYHPkLmaoWnrJfUnfcsfFCYY+hRm/KoYCcohZWwab3MfFcQxDIKj1Zuyw==} + '@dojoengine/utils@1.0.1': resolution: {integrity: sha512-2E5bCYSeifsLxN5bmez8ziJSKbexWxRr3Ss3+txDWLICzfIqNA6eF43rBgUp6/w4NDI57ClimSq7TwXcU/lepA==} peerDependencies: starknet: 6.11.0 + '@dojoengine/utils@1.0.3-alpha.1': + resolution: {integrity: sha512-nKuUsDw510MjJ36ZwoCe3SjC3An7LCbCom7+xvuzt7tbGqxO0lDe6htSfumCkSxIzsjQc7wTfGJGpLHJIvbDGw==} + peerDependencies: + starknet: 6.11.0 + '@emotion/hash@0.9.2': resolution: {integrity: sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==} @@ -11026,11 +11062,11 @@ snapshots: - typescript - utf-8-validate - '@dojoengine/core@1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)': + '@dojoengine/core@1.0.3-alpha.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)': dependencies: - '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.23.8) + '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.0) starknet: 6.11.0(encoding@0.1.13) - zod: 3.23.8 + zod: 3.24.0 transitivePeerDependencies: - bufferutil - typescript @@ -11052,10 +11088,10 @@ snapshots: - typescript - utf-8-validate - '@dojoengine/create-burner@1.0.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)': + '@dojoengine/create-burner@1.0.3-alpha.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)': dependencies: - '@dojoengine/core': 1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2) - '@scure/bip32': 1.5.0 + '@dojoengine/core': 1.0.3-alpha.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2) + '@scure/bip32': 1.6.0 '@starknet-react/core': 2.3.0(get-starknet-core@3.3.4(starknet@6.11.0(encoding@0.1.13)))(react@18.3.1)(starknet@6.11.0(encoding@0.1.13)) encoding: 0.1.13 get-starknet-core: 3.3.4(starknet@6.11.0(encoding@0.1.13)) @@ -11106,12 +11142,12 @@ snapshots: - utf-8-validate - zod - '@dojoengine/react@1.0.1(@types/node@20.17.9)(@types/react@18.3.15)(jsdom@24.1.3)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(type-fest@4.26.1)(typescript@5.7.2)(zod@3.24.0)': + '@dojoengine/react@1.0.3-alpha.1(@types/node@20.17.9)(@types/react@18.3.15)(jsdom@24.1.3)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(type-fest@4.26.1)(typescript@5.7.2)(zod@3.24.0)': dependencies: '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.0) - '@dojoengine/state': 1.0.1(@types/node@20.17.9)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.7.2)(zod@3.24.0) - '@dojoengine/torii-client': 1.0.1 - '@dojoengine/utils': 1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.0) + '@dojoengine/state': 1.0.3-alpha.1(@types/node@20.17.9)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.7.2)(zod@3.24.0) + '@dojoengine/torii-client': 1.0.3-alpha.1 + '@dojoengine/utils': 1.0.3-alpha.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.0) '@latticexyz/utils': 2.2.14 encoding: 0.1.13 fast-deep-equal: 3.1.3 @@ -11180,18 +11216,6 @@ snapshots: - utf-8-validate - zod - '@dojoengine/recs@2.0.13(typescript@5.7.2)(zod@3.23.8)': - dependencies: - '@latticexyz/schema-type': 2.0.12(typescript@5.7.2)(zod@3.23.8) - '@latticexyz/utils': 2.0.12 - mobx: 6.13.5 - rxjs: 7.5.5 - transitivePeerDependencies: - - bufferutil - - typescript - - utf-8-validate - - zod - '@dojoengine/recs@2.0.13(typescript@5.7.2)(zod@3.24.0)': dependencies: '@latticexyz/schema-type': 2.0.12(typescript@5.7.2)(zod@3.24.0) @@ -11230,10 +11254,10 @@ snapshots: - utf-8-validate - zod - '@dojoengine/state@1.0.1(@types/node@20.17.9)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.7.2)(zod@3.24.0)': + '@dojoengine/state@1.0.3-alpha.1(@types/node@20.17.9)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.7.2)(zod@3.24.0)': dependencies: '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.0) - '@dojoengine/torii-client': 1.0.1 + '@dojoengine/torii-client': 1.0.3-alpha.1 starknet: 6.11.0(encoding@0.1.13) vitest: 1.6.0(@types/node@20.17.9)(jsdom@24.1.3)(terser@5.36.0) transitivePeerDependencies: @@ -11260,8 +11284,14 @@ snapshots: dependencies: '@dojoengine/torii-wasm': 1.0.1 + '@dojoengine/torii-client@1.0.3-alpha.1': + dependencies: + '@dojoengine/torii-wasm': 1.0.3-alpha.1 + '@dojoengine/torii-wasm@1.0.1': {} + '@dojoengine/torii-wasm@1.0.3-alpha.1': {} + '@dojoengine/utils@1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.6.3)(zod@3.23.8)': dependencies: '@dojoengine/recs': 2.0.13(typescript@5.6.3)(zod@3.23.8) @@ -11275,7 +11305,7 @@ snapshots: - utf-8-validate - zod - '@dojoengine/utils@1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.0)': + '@dojoengine/utils@1.0.3-alpha.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.0)': dependencies: '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.0) '@latticexyz/utils': 2.2.14 @@ -12336,16 +12366,6 @@ snapshots: - utf-8-validate - zod - '@latticexyz/schema-type@2.0.12(typescript@5.7.2)(zod@3.23.8)': - dependencies: - abitype: 1.0.0(typescript@5.7.2)(zod@3.23.8) - viem: 2.9.20(typescript@5.7.2)(zod@3.23.8) - transitivePeerDependencies: - - bufferutil - - typescript - - utf-8-validate - - zod - '@latticexyz/schema-type@2.0.12(typescript@5.7.2)(zod@3.24.0)': dependencies: abitype: 1.0.0(typescript@5.7.2)(zod@3.24.0) @@ -15405,11 +15425,6 @@ snapshots: typescript: 5.6.3 zod: 3.24.0 - abitype@1.0.0(typescript@5.7.2)(zod@3.23.8): - optionalDependencies: - typescript: 5.7.2 - zod: 3.23.8 - abitype@1.0.0(typescript@5.7.2)(zod@3.24.0): optionalDependencies: typescript: 5.7.2 @@ -21192,23 +21207,6 @@ snapshots: - utf-8-validate - zod - viem@2.9.20(typescript@5.7.2)(zod@3.23.8): - dependencies: - '@adraffy/ens-normalize': 1.10.0 - '@noble/curves': 1.2.0 - '@noble/hashes': 1.3.2 - '@scure/bip32': 1.3.2 - '@scure/bip39': 1.2.1 - abitype: 1.0.0(typescript@5.7.2)(zod@3.23.8) - isows: 1.0.3(ws@8.13.0) - ws: 8.13.0 - optionalDependencies: - typescript: 5.7.2 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod - viem@2.9.20(typescript@5.7.2)(zod@3.24.0): dependencies: '@adraffy/ens-normalize': 1.10.0 From a0a06ccae283602a99a29d3eac66f616eedefd02 Mon Sep 17 00:00:00 2001 From: RedBeardEth <90423049+RedBeardEth@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:01:32 +1100 Subject: [PATCH 5/6] update dojo sync --- landing/src/dojo/setup.ts | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/landing/src/dojo/setup.ts b/landing/src/dojo/setup.ts index e83b271b1..6640be7f0 100644 --- a/landing/src/dojo/setup.ts +++ b/landing/src/dojo/setup.ts @@ -1,5 +1,7 @@ +import { WORLD_CONFIG_ID } from "@bibliothecadao/eternum"; import { DojoConfig } from "@dojoengine/core"; -import { getSyncEntities, getSyncEvents } from "@dojoengine/state"; +import { getSyncEntities, getSyncEvents, syncEntities } from "@dojoengine/state"; +import { Clause } from "@dojoengine/torii-client"; import { createClientComponents } from "./createClientComponents"; import { createSystemCalls } from "./createSystemCalls"; import { ClientConfigManager } from "./modelManager/ConfigManager"; @@ -59,14 +61,40 @@ export async function setup({ ...config }: DojoConfig) { // count "FragmentMineDiscovered", ]) as any; + const clauses: Clause[] = [ + { + Keys: { + keys: [undefined], + pattern_matching: "FixedLen", + models: [], + }, + }, + { + Keys: { + keys: [WORLD_CONFIG_ID.toString(), undefined], + pattern_matching: "VariableLen", + models: [], + }, + }, + { + Keys: { + keys: [WORLD_CONFIG_ID.toString()], + pattern_matching: "VariableLen", + models: [], + }, + }, + ]; // fetch all existing entities from torii with optional component filtering - const sync = await getSyncEntities(network.toriiClient, filteredComponents, undefined, [], 10_000); + await getSyncEntities(network.toriiClient, filteredComponents, { Composite: { operator: "Or", clauses } } , [], 10_000); - const eventSync = getSyncEvents(network.toriiClient, filteredEvents, undefined, [], 20_000, false, false); + const sync = await syncEntities(network.toriiClient, filteredComponents, [], false); configManager.setDojo(components); + const eventSync = getSyncEvents(network.toriiClient, filteredEvents, undefined, [], 20_000, false, false); + + return { network, components, From f0a0e2a5836567bb96a2235d43e5b6d74aea2c0d Mon Sep 17 00:00:00 2001 From: RedBeardEth <90423049+RedBeardEth@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:32:57 +1100 Subject: [PATCH 6/6] add realm select border animation --- landing/src/components/modules/bridge-in.tsx | 4 ++-- landing/src/components/modules/bridge-out-step-1.tsx | 2 +- landing/src/dojo/setup.ts | 10 +++++++--- landing/src/index.css | 6 ++++++ landing/tailwind.config.js | 8 ++++++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/landing/src/components/modules/bridge-in.tsx b/landing/src/components/modules/bridge-in.tsx index 483df7697..2c0a36ab0 100644 --- a/landing/src/components/modules/bridge-in.tsx +++ b/landing/src/components/modules/bridge-in.tsx @@ -182,10 +182,10 @@ export const BridgeIn = () => {
{displayAddress(address || "")}
-
To Realm
+
To Realm
setRealmEntityId(value)}> - + diff --git a/landing/src/dojo/setup.ts b/landing/src/dojo/setup.ts index 6640be7f0..0efd65ea0 100644 --- a/landing/src/dojo/setup.ts +++ b/landing/src/dojo/setup.ts @@ -62,7 +62,6 @@ export async function setup({ ...config }: DojoConfig) { "FragmentMineDiscovered", ]) as any; const clauses: Clause[] = [ - { Keys: { keys: [undefined], @@ -86,7 +85,13 @@ export async function setup({ ...config }: DojoConfig) { }, ]; // fetch all existing entities from torii with optional component filtering - await getSyncEntities(network.toriiClient, filteredComponents, { Composite: { operator: "Or", clauses } } , [], 10_000); + await getSyncEntities( + network.toriiClient, + filteredComponents, + { Composite: { operator: "Or", clauses } }, + [], + 10_000, + ); const sync = await syncEntities(network.toriiClient, filteredComponents, [], false); @@ -94,7 +99,6 @@ export async function setup({ ...config }: DojoConfig) { const eventSync = getSyncEvents(network.toriiClient, filteredEvents, undefined, [], 20_000, false, false); - return { network, components, diff --git a/landing/src/index.css b/landing/src/index.css index 05ff390c0..88c37949b 100644 --- a/landing/src/index.css +++ b/landing/src/index.css @@ -107,3 +107,9 @@ /* border: 2px solid var(--gray-gold, #776756); */ @apply bg-gold; } + +@property --border-angle { + inherits: false; + initial-value: 0deg; + syntax: ''; +} \ No newline at end of file diff --git a/landing/tailwind.config.js b/landing/tailwind.config.js index 8b87a38be..27e40196b 100644 --- a/landing/tailwind.config.js +++ b/landing/tailwind.config.js @@ -76,6 +76,14 @@ export default { md: "calc(var(--radius) - 2px)", sm: "calc(var(--radius) - 4px)", }, + animation: { + border: "border 4s linear infinite", + }, + keyframes: { + border: { + to: { "--border-angle": "360deg" }, + }, + }, colors: { background: "hsl(var(--background))", foreground: "hsl(var(--foreground))",