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/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/landing/src/components/modules/app-sidebar.tsx b/landing/src/components/modules/app-sidebar.tsx index 2510d8b15..cb5092f86 100644 --- a/landing/src/components/modules/app-sidebar.tsx +++ b/landing/src/components/modules/app-sidebar.tsx @@ -57,10 +57,12 @@ export function AppSidebar() { return ( -
- - Eternum -
+ +
+ + Eternum +
+
diff --git a/landing/src/components/modules/bridge-fees.tsx b/landing/src/components/modules/bridge-fees.tsx index f64d61d8e..2a4ecbb9c 100644 --- a/landing/src/components/modules/bridge-fees.tsx +++ b/landing/src/components/modules/bridge-fees.tsx @@ -86,11 +86,11 @@ export const BridgeFees = ({
{formatFee(feesForAllResources.reduce((sum, fees) => sum + Number(fees.totalFee), 0))} units
- + {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 8cfd63b3c..2c0a36ab0 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"); @@ -180,10 +182,10 @@ export const BridgeIn = () => {
{displayAddress(address || "")}
-
To Realm
+
To Realm
{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..64a59a56a 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); } @@ -161,7 +161,7 @@ export const BridgeOutStep1 = () => {
From Realm
{ - if (value === null) { - setDonkeyEntityId(0n); - setSelectedResourceIds([]); - setSelectedResourceAmounts({}); - return; - } - const currentDonkeyInfo = donkeyInfos?.find((donkey) => donkey.donkeyEntityId?.toString() === value); - setDonkeyEntityId(BigInt(value)); - setSelectedResourceIds( - currentDonkeyInfo!.donkeyResources.map((resource) => resource.resourceId as never) ?? 0, - ); - setSelectedResourceAmounts({ - [currentDonkeyInfo!.donkeyResources[0].resourceId ?? 0]: - currentDonkeyInfo!.donkeyResources[0].amount / RESOURCE_PRECISION, - }); - }} - > - - - - - - Choose a donkey - - {donkeyInfos?.map((donkey) => ( - - Donkey Drove {donkey.donkeyEntityId}{" "} - {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
} -
- -
-
-
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 + + + )} +
+
+
+
+
{
); }; diff --git a/landing/src/components/ui/SelectResources.tsx b/landing/src/components/ui/SelectResources.tsx index 7a998f17e..c9f224a16 100644 --- a/landing/src/components/ui/SelectResources.tsx +++ b/landing/src/components/ui/SelectResources.tsx @@ -70,8 +70,11 @@ export const SelectResources = ({ const updatedResourceIds = [...selectedResourceIds]; updatedResourceIds[index] = value; setSelectedResourceIds(updatedResourceIds); + + // Remove the old resource amount and set the new one + const { [selectedResourceIds[index]]: _, ...remainingAmounts } = selectedResourceAmounts; setSelectedResourceAmounts({ - ...selectedResourceAmounts, + ...remainingAmounts, [value]: 1, }); // playResourceSound(value); @@ -155,10 +158,15 @@ export const SelectSingleResource = ({ value={selectedResourceIds[index]} onChange={(value) => { const updatedResourceIds = [...selectedResourceIds]; + console.log(updatedResourceIds); + console.log(index) updatedResourceIds[index] = value; setSelectedResourceIds(updatedResourceIds); + + // Remove the old resource amount and set the new one + const { [selectedResourceIds[index]]: _, ...remainingAmounts } = selectedResourceAmounts; setSelectedResourceAmounts({ - ...selectedResourceAmounts, + ...remainingAmounts, [value]: 1, }); // playResourceSound(value); diff --git a/landing/src/components/ui/utils/utils.ts b/landing/src/components/ui/utils/utils.ts index 9ab1903d8..99d7d330b 100644 --- a/landing/src/components/ui/utils/utils.ts +++ b/landing/src/components/ui/utils/utils.ts @@ -8,11 +8,11 @@ import { BuildingType, ContractAddress, EternumGlobalConfig, + ResourcesIds, + TickIds, type ID, type Position, type Resource, - ResourcesIds, - TickIds, } from "@bibliothecadao/eternum"; import { type ComponentValue } from "@dojoengine/recs"; import { getEntityIdFromKeys } from "@dojoengine/utils"; @@ -442,7 +442,6 @@ export const getSeasonAddresses = async () => { try { const path = getSeasonAddressesPath(); const data = await getJSONFile(path); - console.log({ data }); return data; } catch (error) { console.error("Error loading season addresses:", error); diff --git a/landing/src/dojo/createSystemCalls.ts b/landing/src/dojo/createSystemCalls.ts index c536942bf..ac226a68a 100644 --- a/landing/src/dojo/createSystemCalls.ts +++ b/landing/src/dojo/createSystemCalls.ts @@ -65,7 +65,8 @@ export function createSystemCalls({ provider }: SetupNetworkResult) { const withErrorHandling = Promise>(fn: T) => { return async (...args: Parameters): Promise> => { try { - return await fn(...args); + const resp = await fn(...args); + return resp; } catch (error: any) { let errorMessage = error.message; @@ -131,15 +132,15 @@ export function createSystemCalls({ provider }: SetupNetworkResult) { }; const bridge_resources_into_realm = async (props: SystemProps.BridgeResourcesIntoRealmProps) => { - await provider.bridge_resources_into_realm(props); + return await provider.bridge_resources_into_realm(props); }; const bridge_start_withdraw_from_realm = async (props: SystemProps.BridgeStartWithdrawFromRealmProps) => { - await provider.bridge_start_withdraw_from_realm(props); + return await provider.bridge_start_withdraw_from_realm(props); }; const bridge_finish_withdraw_from_realm = async (props: SystemProps.BridgeFinishWithdrawFromRealmProps) => { - await provider.bridge_finish_withdraw_from_realm(props); + return await provider.bridge_finish_withdraw_from_realm(props); }; const isLive = async () => { diff --git a/landing/src/dojo/setup.ts b/landing/src/dojo/setup.ts index d1298d938..0efd65ea0 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,44 @@ 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, false); + 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, diff --git a/landing/src/hooks/helpers/useResources.tsx b/landing/src/hooks/helpers/useResources.tsx index c9e1c71f8..bbef77688 100644 --- a/landing/src/hooks/helpers/useResources.tsx +++ b/landing/src/hooks/helpers/useResources.tsx @@ -19,12 +19,13 @@ export function getResourceBalance() { return { getBalance }; } -export function donkeyArrivals() { +export function useDonkeyArrivals() { const { setup: { components: { Position, EntityOwner, ArrivalTime, OwnedResourcesTracker, Weight }, }, } = useDojo(); + const dojo = useDojo(); const getOwnerArrivalsAtBank = (realmEntityIds: ID[]) => { const bankPosition = getComponentValue(Position, getEntityIdFromKeys([BigInt(ADMIN_BANK_ENTITY_ID)])); @@ -46,7 +47,6 @@ export function donkeyArrivals() { }; const getDonkeyInfo = (donkeyEntity: Entity) => { - const dojo = useDojo(); const tickConfigDefault = configManager.getTick(TickIds.Default); const timestamp = Math.floor(Date.now() / 1000); const currentDefaultTick = Math.floor(timestamp / Number(tickConfigDefault)); diff --git a/landing/src/hooks/useBridge.tsx b/landing/src/hooks/useBridge.tsx index c8ec4f577..9b19eb0fe 100644 --- a/landing/src/hooks/useBridge.tsx +++ b/landing/src/hooks/useBridge.tsx @@ -44,14 +44,15 @@ export const useBridgeAsset = () => { const _bridgeStartWithdrawFromRealm = useCallback( async (resources: { tokenAddress: string; amount: bigint }[], throughBankId: bigint, fromRealmEntityId: bigint) => { if (account) { - await bridge_start_withdraw_from_realm({ + return await bridge_start_withdraw_from_realm({ signer: account, resources: resources, through_bank_id: throughBankId, from_realm_entity_id: fromRealmEntityId, }) - .then(() => { + .then((resp) => { toast(`Withdrawal initiated successfully. Resources are on their way to the bank.`); + return resp; }) .catch((e) => { console.error(`Bridge withdraw from realm error:`, e); @@ -62,18 +63,18 @@ export const useBridgeAsset = () => { ); const _bridgeFinishWithdrawFromRealm = useCallback( - async (tokenAddress: string, throughBankId: bigint, fromDonkeyEntityId: bigint) => { + async ( donkeyResources: { tokenAddress: string; from_entity_id: bigint }[], throughBankId: bigint) => { if (account) { - await bridge_finish_withdraw_from_realm({ + return await bridge_finish_withdraw_from_realm({ signer: account, - tokenAddress: tokenAddress, + donkey_resources: donkeyResources, through_bank_id: throughBankId, - from_entity_id: fromDonkeyEntityId, recipient_address: account.address, client_fee_recipient: env.VITE_PUBLIC_CLIENT_FEE_RECIPIENT, }) - .then(() => { + .then((resp) => { toast(`Withdrawal Completed! Resources sent to your wallet!`); + return resp; }) .catch((e) => { console.error(`Bridge withdraw from realm error:`, e); 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/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); 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))", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f8634dc5b..10e2e5cdc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -427,26 +427,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.10)(@types/react@18.3.16)(jsdom@24.1.3)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.37.0)(type-fest@2.19.0)(typescript@5.7.2)(zod@3.24.1) + 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.1) '@dojoengine/state': - specifier: 1.0.1 - version: 1.0.1(@types/node@20.17.10)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.37.0)(typescript@5.7.2)(zod@3.24.1) + 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.1) + 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) @@ -1499,8 +1499,8 @@ packages: peerDependencies: starknet: 6.11.0 - '@dojoengine/core@1.0.3-alpha.0': - resolution: {integrity: sha512-p+xD7Y81E7L5CZmzxpXFQqqtsnXjQcSRCB6SBFa+wJwn4SpuCTWMCuKEuelAKp+c3KlQRZ7bDsLmgoIuOj+xBw==} + '@dojoengine/core@1.0.3-alpha.1': + resolution: {integrity: sha512-UAKjqrgjThj3GpoDGnHp76yGSBO7jsC17iQEPIUevZcrRGFKYBlrE8TnW71y6ATo4xIu1d+OVh9mbhrZx/fG/Q==} hasBin: true peerDependencies: starknet: 6.11.0 @@ -1512,8 +1512,8 @@ packages: react-dom: ^18.2.0 starknet: 6.11.0 - '@dojoengine/create-burner@1.0.3-alpha.0': - resolution: {integrity: sha512-pBcrmygma0GtCsIE56MV3kkGgm0oAYR04dP8rSbV4PYWxpy1LuCsPPKNBu25W7KC5xyI08UWN5EigVvkhtQ09g==} + '@dojoengine/create-burner@1.0.3-alpha.1': + resolution: {integrity: sha512-jV+9dXskKrgFVRjKFTanBE4AUwdiv8L99HSI7EFw7M0lkWDn07kvc1jIH1nmApE9NrKA/RzUsUfuuctKvCQHXw==} peerDependencies: react: ^18.2.0 react-dom: ^18.2.0 @@ -1526,8 +1526,8 @@ packages: starknet: 6.11.0 type-fest: ^2.14.0 - '@dojoengine/react@1.0.3-alpha.0': - resolution: {integrity: sha512-sDVcZcMFl7sgURH1D1QmUs4tEojuN/OmTijztGplE0oBUAEngTpCyFy+JK8HNsyQ7XCcTL+rfD+YSJFWo2ucbA==} + '@dojoengine/react@1.0.3-alpha.1': + resolution: {integrity: sha512-F5Rft2/p9365bJvAoy5JhgVS4Q7roxZ5oZR5xwJvX8Ni6kBzuO3gUJRLw3z52bYhBkyexqxM4IQwOxK6vRP46g==} peerDependencies: react: ^18.2.0 starknet: 6.11.0 @@ -1541,30 +1541,30 @@ packages: peerDependencies: starknet: 6.11.0 - '@dojoengine/state@1.0.3-alpha.0': - resolution: {integrity: sha512-rEf8UgXvbIAR9e+gHF3z6acMQxohNbEn5egDHYyMzuh8rwktavdyW/Zgu7oNkrmZxhL5KxOC9Q0fmAIvGuVjJg==} + '@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.0': - resolution: {integrity: sha512-aeCqmuEFZMeiBSm1XcoCJYOTE8fUhJ6aWHzUAkysg3NegiRIAuINyTEzUY/CQmhFqm5WWCSW/+xod+nhK2tCsw==} + '@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.0': - resolution: {integrity: sha512-avrAHM76If2PNsef3UiY91zTmZha6lfW/hJaDSu169BeHAbJIISdgq/LPler+hSzV7UHnk7slrz2EhYXOGN57Q==} + '@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.0': - resolution: {integrity: sha512-sD8ExibUv3mnFW4fV8PSWixzkP7e0KVIMXBkaEZ9EDFU8qbzg/cyHJs9axXnoRbsMJ4N066NDha7VkdtYJdyRA==} + '@dojoengine/utils@1.0.3-alpha.1': + resolution: {integrity: sha512-nKuUsDw510MjJ36ZwoCe3SjC3An7LCbCom7+xvuzt7tbGqxO0lDe6htSfumCkSxIzsjQc7wTfGJGpLHJIvbDGw==} peerDependencies: starknet: 6.11.0 @@ -10660,11 +10660,11 @@ snapshots: - typescript - utf-8-validate - '@dojoengine/core@1.0.3-alpha.0(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.24.1) + '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.0) starknet: 6.11.0(encoding@0.1.13) - zod: 3.24.1 + zod: 3.24.0 transitivePeerDependencies: - bufferutil - typescript @@ -10686,9 +10686,9 @@ snapshots: - typescript - utf-8-validate - '@dojoengine/create-burner@1.0.3-alpha.0(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.3-alpha.0(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) '@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 @@ -10740,12 +10740,12 @@ snapshots: - utf-8-validate - zod - '@dojoengine/react@1.0.3-alpha.0(@types/node@20.17.10)(@types/react@18.3.16)(@vitest/ui@2.1.8(vitest@2.1.8))(jsdom@24.1.3)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.37.0)(type-fest@2.19.0)(typescript@5.7.2)(zod@3.24.1)': + '@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.1) - '@dojoengine/state': 1.0.3-alpha.0(@types/node@20.17.10)(@vitest/ui@2.1.8(vitest@2.1.8))(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.37.0)(typescript@5.7.2)(zod@3.24.1) - '@dojoengine/torii-client': 1.0.3-alpha.0 - '@dojoengine/utils': 1.0.3-alpha.0(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.1) + '@dojoengine/recs': 2.0.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 @@ -10804,7 +10804,31 @@ snapshots: '@dojoengine/state@1.0.1(@types/node@20.17.10)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.37.0)(typescript@5.7.2)(zod@3.24.1)': dependencies: - '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.1) + '@latticexyz/schema-type': 2.0.12(typescript@5.6.3)(zod@3.24.0) + '@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) + '@latticexyz/utils': 2.0.12 + mobx: 6.13.5 + rxjs: 7.5.5 + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + - zod + + '@dojoengine/state@1.0.1(@types/node@20.17.1)(@vitest/ui@2.1.3)(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.36.0)(typescript@5.6.3)(zod@3.23.8)': + dependencies: + '@dojoengine/recs': 2.0.13(typescript@5.6.3)(zod@3.23.8) '@dojoengine/torii-client': 1.0.1 starknet: 6.11.0(encoding@0.1.13) vitest: 1.6.0(@types/node@20.17.10)(@vitest/ui@2.1.8(vitest@2.1.8))(jsdom@24.1.3)(terser@5.37.0) @@ -10828,10 +10852,10 @@ snapshots: - utf-8-validate - zod - '@dojoengine/state@1.0.3-alpha.0(@types/node@20.17.10)(@vitest/ui@2.1.8(vitest@2.1.8))(jsdom@24.1.3)(starknet@6.11.0(encoding@0.1.13))(terser@5.37.0)(typescript@5.7.2)(zod@3.24.1)': + '@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.1) - '@dojoengine/torii-client': 1.0.3-alpha.0 + '@dojoengine/recs': 2.0.13(typescript@5.7.2)(zod@3.24.0) + '@dojoengine/torii-client': 1.0.3-alpha.1 starknet: 6.11.0(encoding@0.1.13) vitest: 1.6.0(@types/node@20.17.10)(@vitest/ui@2.1.8(vitest@2.1.8))(jsdom@24.1.3)(terser@5.37.0) transitivePeerDependencies: @@ -10858,15 +10882,15 @@ snapshots: dependencies: '@dojoengine/torii-wasm': 1.0.1 - '@dojoengine/torii-client@1.0.3-alpha.0': + '@dojoengine/torii-client@1.0.3-alpha.1': dependencies: - '@dojoengine/torii-wasm': 1.0.3-alpha.0 + '@dojoengine/torii-wasm': 1.0.3-alpha.1 '@dojoengine/torii-wasm@1.0.1': {} - '@dojoengine/torii-wasm@1.0.3-alpha.0': {} + '@dojoengine/torii-wasm@1.0.3-alpha.1': {} - '@dojoengine/utils@1.0.1(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.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.7.2)(zod@3.24.1) '@latticexyz/utils': 2.2.14 @@ -10879,7 +10903,7 @@ snapshots: - utf-8-validate - zod - '@dojoengine/utils@1.0.3-alpha.0(starknet@6.11.0(encoding@0.1.13))(typescript@5.7.2)(zod@3.24.1)': + '@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.1) '@latticexyz/utils': 2.2.14 @@ -11905,6 +11929,26 @@ snapshots: - utf-8-validate - zod + '@latticexyz/schema-type@2.0.12(typescript@5.6.3)(zod@3.24.0)': + dependencies: + abitype: 1.0.0(typescript@5.6.3)(zod@3.24.0) + viem: 2.9.20(typescript@5.6.3)(zod@3.24.0) + 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) + viem: 2.9.20(typescript@5.7.2)(zod@3.24.0) + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + - zod + '@latticexyz/utils@2.0.12': dependencies: mobx: 6.13.5 @@ -14382,10 +14426,15 @@ snapshots: abitype@1.0.0(typescript@5.7.2)(zod@3.24.1): optionalDependencies: - typescript: 5.7.2 - zod: 3.24.1 + typescript: 5.6.3 + zod: 3.23.8 - abitype@1.0.7(typescript@5.7.2)(zod@3.24.1): + abitype@1.0.0(typescript@5.6.3)(zod@3.24.0): + optionalDependencies: + typescript: 5.6.3 + zod: 3.24.0 + + abitype@1.0.0(typescript@5.7.2)(zod@3.24.0): optionalDependencies: typescript: 5.7.2 zod: 3.24.1 @@ -19848,13 +19897,30 @@ snapshots: isows: 1.0.3(ws@8.13.0) ws: 8.13.0 optionalDependencies: - typescript: 5.7.2 + typescript: 5.6.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + + viem@2.9.20(typescript@5.6.3)(zod@3.24.0): + 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.6.3)(zod@3.24.0) + isows: 1.0.3(ws@8.13.0) + ws: 8.13.0 + optionalDependencies: + typescript: 5.6.3 transitivePeerDependencies: - bufferutil - utf-8-validate - zod - vite-node@1.6.0(@types/node@20.17.10)(terser@5.37.0): + viem@2.9.20(typescript@5.7.2)(zod@3.24.0): dependencies: cac: 6.7.14 debug: 4.4.0 diff --git a/sdk/packages/eternum/src/provider/index.ts b/sdk/packages/eternum/src/provider/index.ts index 3f81544a6..48a49f106 100644 --- a/sdk/packages/eternum/src/provider/index.ts +++ b/sdk/packages/eternum/src/provider/index.ts @@ -303,8 +303,6 @@ export class EternumProvider extends EnhancedDojoProvider { public async bridge_start_withdraw_from_realm(props: SystemProps.BridgeStartWithdrawFromRealmProps) { const { resources, through_bank_id, from_realm_entity_id, signer } = props; - console.log({ resources }); - const calls = resources.map((resource) => ({ contractAddress: getContractByName(this.manifest, `${NAMESPACE}-resource_bridge_systems`), entrypoint: "start_withdraw", @@ -314,15 +312,17 @@ export class EternumProvider extends EnhancedDojoProvider { } public async bridge_finish_withdraw_from_realm(props: SystemProps.BridgeFinishWithdrawFromRealmProps) { - const { tokenAddress, through_bank_id, from_entity_id, recipient_address, client_fee_recipient, signer } = props; + const { donkey_resources, through_bank_id, recipient_address, client_fee_recipient, signer } = props; + + + const calls = donkey_resources.map((donkey_resource) => ({ + contractAddress: getContractByName(this.manifest, `${NAMESPACE}-resource_bridge_systems`), + entrypoint: "finish_withdraw", + calldata: [through_bank_id, donkey_resource.from_entity_id, donkey_resource.tokenAddress, recipient_address, client_fee_recipient], + })); + + return await this.executeAndCheckTransaction(signer, calls); - return await this.executeAndCheckTransaction(signer, [ - { - contractAddress: getContractByName(this.manifest, `${NAMESPACE}-resource_bridge_systems`), - entrypoint: "finish_withdraw", - calldata: [through_bank_id, from_entity_id, tokenAddress, recipient_address, client_fee_recipient], - }, - ]); } public async bridge_resources_into_realm(props: SystemProps.BridgeResourcesIntoRealmProps) { diff --git a/sdk/packages/eternum/src/types/provider.ts b/sdk/packages/eternum/src/types/provider.ts index fb45381ab..dd12a9fc8 100644 --- a/sdk/packages/eternum/src/types/provider.ts +++ b/sdk/packages/eternum/src/types/provider.ts @@ -27,8 +27,10 @@ export interface BridgeStartWithdrawFromRealmProps extends SystemSigner { export interface BridgeFinishWithdrawFromRealmProps extends SystemSigner { through_bank_id: num.BigNumberish; - from_entity_id: num.BigNumberish; - tokenAddress: num.BigNumberish; + donkey_resources: { + tokenAddress: num.BigNumberish; + from_entity_id: num.BigNumberish; + }[]; recipient_address: num.BigNumberish; client_fee_recipient: num.BigNumberish; }