From 66a5d8c2fd41b46e5e068e91907f0ea8e9aa0d61 Mon Sep 17 00:00:00 2001 From: starknetdev Date: Fri, 6 Oct 2023 11:46:38 +0100 Subject: [PATCH 1/8] - change start to new_game - change upgrade_adventurer to upgrade - change drop_items to drop - update adventurerId param to felt252 from u256 - add actions per block in Adventurer to indexer, graphql and ui - update game contract addresses - update optimistic data layer with new adventurer variable --- indexer/env-goerli | 2 +- indexer/src/adventurers.ts | 3 +- indexer/src/scores.ts | 3 - indexer/src/utils/events.ts | 5 +- indexer/src/utils/helpers.ts | 8 +- ui/.env | 2 +- .../app/components/actions/KillAdventurer.tsx | 2 +- ui/src/app/components/adventurer/Info.tsx | 12 +- .../adventurer/InventoryDisplay.tsx | 1 - .../app/components/inventory/InventoryRow.tsx | 1 - ui/src/app/components/leaderboard/LiveRow.tsx | 1 - .../components/navigation/TransactionCart.tsx | 12 +- .../app/components/upgrade/StatAttribute.tsx | 2 +- ui/src/app/containers/InventoryScreen.tsx | 4 +- ui/src/app/containers/UpgradeScreen.tsx | 5 +- ui/src/app/hooks/graphql/queries.ts | 3 +- ui/src/app/hooks/graphql/types.ts | 2 +- ui/src/app/lib/utils/parseEvents.ts | 287 +++++++++--------- ui/src/app/lib/utils/processData.ts | 7 +- ui/src/app/lib/utils/syscalls.ts | 11 +- ui/src/app/types/events.ts | 3 +- 21 files changed, 173 insertions(+), 203 deletions(-) diff --git a/indexer/env-goerli b/indexer/env-goerli index 0441e9ee4..0fd370081 100644 --- a/indexer/env-goerli +++ b/indexer/env-goerli @@ -1,3 +1,3 @@ -GAME="0x01263ecbc05e28d1e99f531894838db10b90cfcdd39d020642da1747a733a37a" +GAME="0x0229a6f42ae0bc258acf91b6e6d7f50e77608dbfb5a42e1c362f2041f9333fb5" START=873000 MONGO_CONNECTION_STRING="mongodb://mongo:mongo@54.246.178.155:27017" diff --git a/indexer/src/adventurers.ts b/indexer/src/adventurers.ts index c3710fef1..4af1860db 100644 --- a/indexer/src/adventurers.ts +++ b/indexer/src/adventurers.ts @@ -126,9 +126,8 @@ export default function transform({ header, events }: Block) { ring: as.adventurer.ring.id, beastHealth: as.adventurer.beastHealth, statUpgrades: as.adventurer.statsPointsAvailable, + actionsPerBlock: as.adventurer.actionsPerBlock, name: am.name, - homeRealm: am.homeRealm, - classType: am.class, entropy: am.entropy, createdTime: new Date().toISOString(), lastUpdatedTime: new Date().toISOString(), diff --git a/indexer/src/scores.ts b/indexer/src/scores.ts index f463689f1..907814785 100644 --- a/indexer/src/scores.ts +++ b/indexer/src/scores.ts @@ -72,7 +72,6 @@ export default function transform({ header, events }: Block) { updateTotalPayout({ adventurerId: fp.adventurerId, owner: fp.address, - rank: fp.rank, timestamp: new Date().toISOString(), newPayout: fp.amount, }) @@ -83,7 +82,6 @@ export default function transform({ header, events }: Block) { updateTotalPayout({ adventurerId: sp.adventurerId, owner: sp.address, - rank: sp.rank, timestamp: new Date().toISOString(), newPayout: sp.amount, }) @@ -94,7 +92,6 @@ export default function transform({ header, events }: Block) { updateTotalPayout({ adventurerId: tp.adventurerId, owner: tp.address, - rank: tp.rank, timestamp: new Date().toISOString(), newPayout: tp.amount, }) diff --git a/indexer/src/utils/events.ts b/indexer/src/utils/events.ts index 2be90bf33..368605c32 100644 --- a/indexer/src/utils/events.ts +++ b/indexer/src/utils/events.ts @@ -90,7 +90,8 @@ export const parseAdventurer = combineParsers({ ring: { index: 12, parser: parseLootStatistics }, beastHealth: { index: 13, parser: parseU16 }, statsPointsAvailable: { index: 14, parser: parseU8 }, - mutated: { index: 15, parser: parseBoolean }, + actionsPerBlock: { index: 15, parser: parseU8 }, + mutated: { index: 16, parser: parseBoolean }, }); export const parseAdventurerState = combineParsers({ @@ -170,8 +171,6 @@ export const parseAdventurerDied = combineParsers({ export const parseAdventurerMetadata = combineParsers({ name: { index: 0, parser: parseU128 }, - homeRealm: { index: 1, parser: parseU16 }, - class: { index: 2, parser: parseU8 }, entropy: { index: 3, parser: parseU128 }, }); diff --git a/indexer/src/utils/helpers.ts b/indexer/src/utils/helpers.ts index 5190ff928..6cb3af1c1 100644 --- a/indexer/src/utils/helpers.ts +++ b/indexer/src/utils/helpers.ts @@ -24,9 +24,8 @@ export function insertAdventurer({ ring, beastHealth, statUpgrades, + actionsPerBlock, name, - homeRealm, - classType, entropy, createdTime, lastUpdatedTime, @@ -62,9 +61,8 @@ export function insertAdventurer({ ring: checkExistsInt(BigInt(ring)), beastHealth: encodeIntAsBytes(BigInt(beastHealth)), statUpgrades: checkExistsInt(BigInt(statUpgrades)), + actionsPerBlock: encodeIntAsBytes(BigInt(actionsPerBlock)), name: checkExistsInt(BigInt(name)), - homeRealm: checkExistsInt(BigInt(homeRealm)), - classType: checkExistsInt(BigInt(classType)), entropy: encodeIntAsBytes(BigInt(entropy)), createdTime: createdTime, lastUpdatedTime: lastUpdatedTime, @@ -191,6 +189,7 @@ export function updateAdventurer({ ring: checkExistsInt(BigInt(adventurer.ring.id)), beastHealth: encodeIntAsBytes(BigInt(adventurer.beastHealth)), statUpgrades: encodeIntAsBytes(BigInt(adventurer.statsPointsAvailable)), + actionsPerBlock: encodeIntAsBytes(BigInt(adventurer.actionsPerBlock)), lastUpdatedTime: timestamp, timestamp, }, @@ -546,7 +545,6 @@ export function insertHighScore({ export function updateTotalPayout({ adventurerId, owner, - rank, timestamp, newPayout, }: any) { diff --git a/ui/.env b/ui/.env index e340c0723..fe9f84bec 100644 --- a/ui/.env +++ b/ui/.env @@ -3,7 +3,7 @@ NEXT_PUBLIC_GOERLI_ARCADE_ACCOUNT_CLASS_HASH=0x0715b5e10bf63c36e69c402a81e1eb96b NEXT_PUBLIC_MAINNET_ARCADE_ACCOUNT_CLASS_HASH=0x0 NEXT_PUBLIC_GOERLI_ETH_CONTRACT_ADDRESS=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 NEXT_PUBLIC_MAINNET_ETH_CONTRACT_ADDRESS=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 -NEXT_PUBLIC_GOERLI_GAME_CONTRACT_ADDRESS=0x01263ecbc05e28d1e99f531894838db10b90cfcdd39d020642da1747a733a37a +NEXT_PUBLIC_GOERLI_GAME_CONTRACT_ADDRESS=0x0229a6f42ae0bc258acf91b6e6d7f50e77608dbfb5a42e1c362f2041f9333fb5 NEXT_PUBLIC_MAINNET_GAME_CONTRACT_ADDRESS=0x0 NEXT_PUBLIC_GOERLI_LORDS_CONTRACT_ADDRESS=0x059dac5df32cbce17b081399e97d90be5fba726f97f00638f838613d088e5a47 NEXT_PUBLIC_MAINNET_LORDS_CONTRACT_ADDRESS=0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49 diff --git a/ui/src/app/components/actions/KillAdventurer.tsx b/ui/src/app/components/actions/KillAdventurer.tsx index 8edb21960..99dce054a 100644 --- a/ui/src/app/components/actions/KillAdventurer.tsx +++ b/ui/src/app/components/actions/KillAdventurer.tsx @@ -30,7 +30,7 @@ export default function KillAdventurer() { const slayIdleAdventurerTx = { contractAddress: gameContract?.address ?? "", entrypoint: "slay_idle_adventurer", - calldata: [adventurerTarget, "0"], + calldata: [adventurerTarget], metadata: `Slaying ${adventurerTarget}`, }; diff --git a/ui/src/app/components/adventurer/Info.tsx b/ui/src/app/components/adventurer/Info.tsx index c91a79e50..b25f4b33f 100644 --- a/ui/src/app/components/adventurer/Info.tsx +++ b/ui/src/app/components/adventurer/Info.tsx @@ -64,10 +64,9 @@ export default function Info({ if (gameContract) { const dropItemsTx = { contractAddress: gameContract?.address, - entrypoint: "drop_items", + entrypoint: "drop", calldata: [ adventurer?.id?.toString() ?? "", - "0", newDropItems.length.toString(), ...newDropItems, ], @@ -150,15 +149,6 @@ export default function Info({

)} -
- {formatAdventurer.classType}{" "} - - { - getRealmNameById(formatAdventurer.homeRealm ?? 0) - ?.properties.name - } - -

diff --git a/ui/src/app/components/adventurer/InventoryDisplay.tsx b/ui/src/app/components/adventurer/InventoryDisplay.tsx index c7acae021..01ed410b6 100644 --- a/ui/src/app/components/adventurer/InventoryDisplay.tsx +++ b/ui/src/app/components/adventurer/InventoryDisplay.tsx @@ -89,7 +89,6 @@ export const InventoryCard = ({ entrypoint: "equip", calldata: [ adventurer?.id?.toString() ?? "", - "0", newEquipItems.length.toString(), ...newEquipItems, ], diff --git a/ui/src/app/components/inventory/InventoryRow.tsx b/ui/src/app/components/inventory/InventoryRow.tsx index f26d48bd2..66a2fa98b 100644 --- a/ui/src/app/components/inventory/InventoryRow.tsx +++ b/ui/src/app/components/inventory/InventoryRow.tsx @@ -50,7 +50,6 @@ export const InventoryRow = ({ entrypoint: "equip", calldata: [ adventurer?.id?.toString() ?? "", - "0", equipItems.length, ...equipItems, // getKeyFromValue(gameData.ITEMS, item) ?? "", diff --git a/ui/src/app/components/leaderboard/LiveRow.tsx b/ui/src/app/components/leaderboard/LiveRow.tsx index 656906de4..d5c3b7b15 100644 --- a/ui/src/app/components/leaderboard/LiveRow.tsx +++ b/ui/src/app/components/leaderboard/LiveRow.tsx @@ -64,7 +64,6 @@ const LiveLeaderboardRow = ({ formattedSlayedAdventurers.length.toString(), ...slayAdventurers, adventurer?.id?.toString() ?? "0", - "0", ], metadata: `Slaying ${adventurer.name}`, }; diff --git a/ui/src/app/components/navigation/TransactionCart.tsx b/ui/src/app/components/navigation/TransactionCart.tsx index 4fe130f97..3d58a67a4 100644 --- a/ui/src/app/components/navigation/TransactionCart.tsx +++ b/ui/src/app/components/navigation/TransactionCart.tsx @@ -134,10 +134,10 @@ const TransactionCart = ({ buttonRef, multicall }: TransactionCartProps) => { case "equip": handleEquipItem(); break; - case "drop_items": + case "drop": handleDropItems(); break; - case "upgrade_adventurer": + case "upgrade": handleUpgradeAdventurer(); break; case "slay_idle_adventurers": @@ -235,7 +235,7 @@ const TransactionCart = ({ buttonRef, multicall }: TransactionCartProps) => {
))} - ) : call.entrypoint === "drop_items" ? ( + ) : call.entrypoint === "drop" ? (
{dropItems.map((item: string, index: number) => (
@@ -263,7 +263,7 @@ const TransactionCart = ({ buttonRef, multicall }: TransactionCartProps) => {
))}
- ) : call.entrypoint === "upgrade_adventurer" ? ( + ) : call.entrypoint === "upgrade" ? (
{filteredStats.map( ([string, number], index: number) => ( @@ -370,10 +370,10 @@ const TransactionCart = ({ buttonRef, multicall }: TransactionCartProps) => { if (call.entrypoint === "equip") { setEquipItems([]); } - if (call.entrypoint === "drop_items") { + if (call.entrypoint === "drop") { setDropItems([]); } - if (call.entrypoint === "upgrade_adventurer") { + if (call.entrypoint === "upgrade") { setUpgrades({ ...ZeroUpgrade }); setPurchaseItems([]); } diff --git a/ui/src/app/components/upgrade/StatAttribute.tsx b/ui/src/app/components/upgrade/StatAttribute.tsx index 81491fea7..69d31eded 100644 --- a/ui/src/app/components/upgrade/StatAttribute.tsx +++ b/ui/src/app/components/upgrade/StatAttribute.tsx @@ -57,7 +57,7 @@ export const StatAttribute = ({ if ( Object.values(upgrades).filter((value) => value !== 0).length === 0 ) { - removeEntrypointFromCalls("upgrade_adventurer"); + removeEntrypointFromCalls("upgrade"); } } setButtonClicked(false); diff --git a/ui/src/app/containers/InventoryScreen.tsx b/ui/src/app/containers/InventoryScreen.tsx index f02c1b017..6274e6d07 100644 --- a/ui/src/app/containers/InventoryScreen.tsx +++ b/ui/src/app/containers/InventoryScreen.tsx @@ -67,7 +67,6 @@ export default function InventoryScreen() { entrypoint: "equip", calldata: [ adventurer?.id?.toString() ?? "", - "0", newEquipItems.length.toString(), ...newEquipItems, ], @@ -87,10 +86,9 @@ export default function InventoryScreen() { if (gameContract) { const dropItemsTx = { contractAddress: gameContract?.address, - entrypoint: "drop_items", + entrypoint: "drop", calldata: [ adventurer?.id?.toString() ?? "", - "0", newDropItems.length.toString(), ...newDropItems, ], diff --git a/ui/src/app/containers/UpgradeScreen.tsx b/ui/src/app/containers/UpgradeScreen.tsx index 397fef900..103df4091 100644 --- a/ui/src/app/containers/UpgradeScreen.tsx +++ b/ui/src/app/containers/UpgradeScreen.tsx @@ -227,13 +227,12 @@ export default function UpgradeScreen({ upgrade }: UpgradeScreenProps) { potions?: number, items?: any[] ) => { - removeEntrypointFromCalls("upgrade_adventurer"); + removeEntrypointFromCalls("upgrade"); const upgradeTx = { contractAddress: gameContract?.address ?? "", - entrypoint: "upgrade_adventurer", + entrypoint: "upgrade", calldata: [ adventurer?.id?.toString() ?? "", - "0", potions ? potions.toString() : potionAmount.toString(), currentUpgrades ? currentUpgrades["Strength"].toString() diff --git a/ui/src/app/hooks/graphql/queries.ts b/ui/src/app/hooks/graphql/queries.ts index 98e276440..0b184e1d4 100644 --- a/ui/src/app/hooks/graphql/queries.ts +++ b/ui/src/app/hooks/graphql/queries.ts @@ -4,8 +4,6 @@ const ADVENTURER_FIELDS = ` id lastAction owner - classType - homeRealm name health strength @@ -26,6 +24,7 @@ const ADVENTURER_FIELDS = ` ring beastHealth statUpgrades + actionsPerBlock gold createdTime lastUpdatedTime diff --git a/ui/src/app/hooks/graphql/types.ts b/ui/src/app/hooks/graphql/types.ts index f35bfec97..382ee38bc 100644 --- a/ui/src/app/hooks/graphql/types.ts +++ b/ui/src/app/hooks/graphql/types.ts @@ -20,7 +20,6 @@ export type AdventurerQuery = { lastAction: Maybe; owner: Maybe; race: Maybe; - homeRealm: Maybe; name: Maybe; order: Maybe; health: Maybe; @@ -43,6 +42,7 @@ export type AdventurerQuery = { beast: Maybe; beastHealth: Maybe; statUpgrades: Maybe; + actionsPerBlock: Maybe; gold: Maybe; createdTime: Maybe; lastUpdatedTime: Maybe; diff --git a/ui/src/app/lib/utils/parseEvents.ts b/ui/src/app/lib/utils/parseEvents.ts index acb659070..082d8b13d 100644 --- a/ui/src/app/lib/utils/parseEvents.ts +++ b/ui/src/app/lib/utils/parseEvents.ts @@ -93,7 +93,8 @@ function parseAdventurerState(data: string[]) { }, beastHealth: parseInt(data[38]), statPointsAvailable: parseInt(data[39]), - mutated: convertToBoolean(parseInt(data[40])), + actionsPerBlock: parseInt(data[40]), + mutated: convertToBoolean(parseInt(data[41])), }, }; } @@ -230,12 +231,10 @@ export async function parseEvents( switch (eventName) { case "StartGame": const startGameData: StartGameEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), adventurerMeta: { - name: parseInt(raw.data[41]), - homeRealm: parseInt(raw.data[42]), - class: parseInt(raw.data[43]), - entropy: parseInt(raw.data[44]), + name: parseInt(raw.data[42]), + entropy: parseInt(raw.data[43]), }, }; const startGameEvent = processData( @@ -248,15 +247,15 @@ export async function parseEvents( case "AdventurerUpgraded": const upgradeAvailableData: AdventurerUpgradedEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - bag: parseBag(raw.data.slice(41, 74)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + bag: parseBag(raw.data.slice(42, 75)), }, - strengthIncrease: parseInt(raw.data[75]), - dexterityIncrease: parseInt(raw.data[76]), - vitalityIncrease: parseInt(raw.data[77]), - intelligenceIncrease: parseInt(raw.data[78]), - wisdomIncrease: parseInt(raw.data[79]), - charismaIncrease: parseInt(raw.data[80]), + strengthIncrease: parseInt(raw.data[76]), + dexterityIncrease: parseInt(raw.data[77]), + vitalityIncrease: parseInt(raw.data[78]), + intelligenceIncrease: parseInt(raw.data[79]), + wisdomIncrease: parseInt(raw.data[80]), + charismaIncrease: parseInt(raw.data[81]), }; const upgradeAvailableEvent = processData( upgradeAvailableData, @@ -268,8 +267,8 @@ export async function parseEvents( break; case "DiscoveredHealth": const discoveredHealthData: DiscoveredHealthEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - healthAmount: parseInt(raw.data[41]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + healthAmount: parseInt(raw.data[42]), }; const discoveredHealthEvent = processData( discoveredHealthData, @@ -281,8 +280,8 @@ export async function parseEvents( break; case "DiscoveredGold": const discoveredGoldData: DiscoveredGoldEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - goldAmount: parseInt(raw.data[41]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + goldAmount: parseInt(raw.data[42]), }; const discoveredGoldEvent = processData( discoveredGoldData, @@ -294,8 +293,8 @@ export async function parseEvents( break; case "DiscoveredXP": const discoveredXPData: DiscoveredXPEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - xpAmount: parseInt(raw.data[41]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + xpAmount: parseInt(raw.data[42]), }; const discoveredXPEvent = processData( discoveredXPData, @@ -307,13 +306,13 @@ export async function parseEvents( break; case "DodgedObstacle": const dodgedObstacleData: DodgedObstacleEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - id: parseInt(raw.data[41]), - level: parseInt(raw.data[42]), - damageTaken: parseInt(raw.data[43]), - damageLocation: parseInt(raw.data[44]), - xpEarnedAdventurer: parseInt(raw.data[45]), - xpEarnedItems: parseInt(raw.data[46]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + id: parseInt(raw.data[42]), + level: parseInt(raw.data[43]), + damageTaken: parseInt(raw.data[44]), + damageLocation: parseInt(raw.data[45]), + xpEarnedAdventurer: parseInt(raw.data[46]), + xpEarnedItems: parseInt(raw.data[47]), }; const dodgedObstacleEvent = processData( dodgedObstacleData, @@ -325,13 +324,13 @@ export async function parseEvents( break; case "HitByObstacle": const hitByObstacleData: HitByObstacleEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - id: parseInt(raw.data[41]), - level: parseInt(raw.data[42]), - damageTaken: parseInt(raw.data[43]), - damageLocation: parseInt(raw.data[44]), - xpEarnedAdventurer: parseInt(raw.data[45]), - xpEarnedItems: parseInt(raw.data[46]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + id: parseInt(raw.data[42]), + level: parseInt(raw.data[43]), + damageTaken: parseInt(raw.data[44]), + damageLocation: parseInt(raw.data[45]), + xpEarnedAdventurer: parseInt(raw.data[46]), + xpEarnedItems: parseInt(raw.data[47]), }; const hitByObstacleEvent = processData( hitByObstacleData, @@ -343,17 +342,17 @@ export async function parseEvents( break; case "DiscoveredBeast": const discoveredBeastData: DiscoveredBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, }; @@ -367,22 +366,22 @@ export async function parseEvents( break; case "AmbushedByBeast": const ambushedByBeastData: AmbushedByBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, - damage: parseInt(raw.data[49]), - criticalHit: convertToBoolean(parseInt(raw.data[50])), - location: parseInt(raw.data[51]), + damage: parseInt(raw.data[50]), + criticalHit: convertToBoolean(parseInt(raw.data[51])), + location: parseInt(raw.data[52]), }; const ambushedByBeastEvent = processData( ambushedByBeastData, @@ -394,22 +393,22 @@ export async function parseEvents( break; case "AttackedBeast": const attackedBeastData: AttackedBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, - damage: parseInt(raw.data[49]), - criticalHit: convertToBoolean(parseInt(raw.data[50])), - location: parseInt(raw.data[51]), + damage: parseInt(raw.data[50]), + criticalHit: convertToBoolean(parseInt(raw.data[51])), + location: parseInt(raw.data[52]), }; const attackedBeastEvent = processData( attackedBeastData, @@ -421,22 +420,22 @@ export async function parseEvents( break; case "AttackedByBeast": const attackedByBeastData: AttackedByBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, - damage: parseInt(raw.data[49]), - criticalHit: convertToBoolean(parseInt(raw.data[50])), - location: parseInt(raw.data[51]), + damage: parseInt(raw.data[50]), + criticalHit: convertToBoolean(parseInt(raw.data[51])), + location: parseInt(raw.data[52]), }; const attackedByBeastEvent = processData( attackedByBeastData, @@ -448,24 +447,24 @@ export async function parseEvents( break; case "SlayedBeast": const slayedBeastData: SlayedBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, - damageDealt: parseInt(raw.data[49]), - criticalHit: convertToBoolean(parseInt(raw.data[50])), - xpEarnedAdventurer: parseInt(raw.data[51]), - xpEarnedItems: parseInt(raw.data[52]), - goldEarned: parseInt(raw.data[53]), + damageDealt: parseInt(raw.data[50]), + criticalHit: convertToBoolean(parseInt(raw.data[51])), + xpEarnedAdventurer: parseInt(raw.data[52]), + xpEarnedItems: parseInt(raw.data[53]), + goldEarned: parseInt(raw.data[54]), }; const slayedBeastEvent = processData( slayedBeastData, @@ -477,17 +476,17 @@ export async function parseEvents( break; case "FleeFailed": const fleeFailedData: FleeFailedEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, }; @@ -501,17 +500,17 @@ export async function parseEvents( break; case "FleeSucceeded": const fleeSucceededData: FleeSucceededEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - seed: parseInt(raw.data[41]), - id: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + seed: parseInt(raw.data[42]), + id: parseInt(raw.data[43]), beastSpecs: { - tier: parseInt(raw.data[43]), - itemType: parseInt(raw.data[44]), - level: parseInt(raw.data[45]), + tier: parseInt(raw.data[44]), + itemType: parseInt(raw.data[45]), + level: parseInt(raw.data[46]), specials: { - special1: parseInt(raw.data[46]), - special2: parseInt(raw.data[47]), - special3: parseInt(raw.data[48]), + special1: parseInt(raw.data[47]), + special2: parseInt(raw.data[48]), + special3: parseInt(raw.data[49]), }, }, }; @@ -526,11 +525,11 @@ export async function parseEvents( case "PurchasedItems": const purchasedItemsData: PurchasedItemsEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - bag: parseBag(raw.data.slice(41, 74)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + bag: parseBag(raw.data.slice(42, 75)), }, // Skip array length - purchases: parseItems(raw.data.slice(76)), + purchases: parseItems(raw.data.slice(77)), }; const purchasedItemsEvent = processData( purchasedItemsData, @@ -542,10 +541,10 @@ export async function parseEvents( break; case "PurchasedPotions": const purchasedPotionsData: PurchasedPotionsEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - quantity: parseInt(raw.data[41]), - cost: parseInt(raw.data[42]), - health: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + quantity: parseInt(raw.data[42]), + cost: parseInt(raw.data[43]), + health: parseInt(raw.data[44]), }; const purchasedPotionsEvent = processData( purchasedPotionsData, @@ -562,8 +561,8 @@ export async function parseEvents( ); const equippedItemsData: EquippedItemsEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - bag: parseBag(raw.data.slice(41, 74)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + bag: parseBag(raw.data.slice(42, 75)), }, equippedItems: equippedItems, unequippedItems: unequippedItems, @@ -579,14 +578,14 @@ export async function parseEvents( case "DroppedItems": const itemIds = []; // Skip array length - const itemsData = raw.data.slice(76); + const itemsData = raw.data.slice(77); for (let i = 0; i < itemsData.length; i++) { itemIds.push(parseInt(itemsData[i])); } const droppedItemsData: DroppedItemsEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - bag: parseBag(raw.data.slice(41, 74)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + bag: parseBag(raw.data.slice(42, 75)), }, itemIds: itemIds, }; @@ -600,10 +599,10 @@ export async function parseEvents( break; case "GreatnessIncreased": const greatnessIncreasedData: GreatnessIncreasedEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - itemId: parseInt(raw.data[41]), - previousLevel: parseInt(raw.data[42]), - newLevel: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + itemId: parseInt(raw.data[42]), + previousLevel: parseInt(raw.data[43]), + newLevel: parseInt(raw.data[44]), }; const greatnessIncreasedEvent = processData( greatnessIncreasedData, @@ -615,9 +614,9 @@ export async function parseEvents( break; case "ItemsLeveledUp": const itemsLeveledUpData: ItemsLeveledUpEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), // Skip items length - items: parseItemLevels(raw.data.slice(42)), + items: parseItemLevels(raw.data.slice(43)), }; const itemsLeveledUpEvent = processData( itemsLeveledUpData, @@ -629,8 +628,8 @@ export async function parseEvents( break; case "NewHighScore": const newHighScoreData: NewHighScoreEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - rank: parseInt(raw.data[41]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + rank: parseInt(raw.data[42]), }; const newHighScoreEvent = processData( newHighScoreData, @@ -642,10 +641,10 @@ export async function parseEvents( break; case "AdventurerDied": const adventurerDiedData: AdventurerDiedEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - killedByBeast: parseInt(raw.data[41]), - killedByObstacle: parseInt(raw.data[42]), - callerAddress: raw.data[43], + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + killedByBeast: parseInt(raw.data[42]), + killedByObstacle: parseInt(raw.data[43]), + callerAddress: raw.data[44], }; const adventurerDiedEvent = processData( adventurerDiedData, @@ -657,9 +656,9 @@ export async function parseEvents( break; case "AdventurerLeveledUp": const adventurerLeveledUpData: AdventurerLeveledUpEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - previousLevel: parseInt(raw.data[41]), - newLevel: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + previousLevel: parseInt(raw.data[42]), + newLevel: parseInt(raw.data[43]), }; const adventurerLeveledUpEvent = processData( adventurerLeveledUpData, @@ -671,13 +670,13 @@ export async function parseEvents( break; case "UpgradesAvailable": // Skip array length - const newItems = raw.data.slice(42); + const newItems = raw.data.slice(43); const newItemsIds = []; for (let i = 0; i < newItems.length; i++) { newItemsIds.push(parseInt(newItems[i])); } const upgradesAvailableData: UpgradesAvailableEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), // Skip array length items: newItemsIds, }; @@ -691,10 +690,10 @@ export async function parseEvents( break; case "IdleDeathPenalty": const idleDeathPenaltyData: IdleDeathPenaltyEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 40)), - idleBlocks: parseInt(raw.data[41]), - penaltyThreshold: parseInt(raw.data[42]), - caller: raw.data[43], + adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + idleBlocks: parseInt(raw.data[42]), + penaltyThreshold: parseInt(raw.data[43]), + caller: raw.data[44], }; const idleDeathPenaltyEvent = processData( idleDeathPenaltyData, diff --git a/ui/src/app/lib/utils/processData.ts b/ui/src/app/lib/utils/processData.ts index 7b5372bd8..17c204dd5 100644 --- a/ui/src/app/lib/utils/processData.ts +++ b/ui/src/app/lib/utils/processData.ts @@ -83,9 +83,8 @@ function processAdventurerState(data: any, currentAdventurer?: any) { ring: gameData.ITEMS[data.adventurerState["adventurer"]["ring"]["id"]], beastHealth: data.adventurerState["adventurer"]["beastHealth"], statUpgrades: data.adventurerState["adventurer"]["statPointsAvailable"], + actionsPerBlock: data.adventurerState["adventurer"]["actionsPerBlock"], name: currentAdventurer["name"], - homeRealm: currentAdventurer["homeRealm"], - classType: currentAdventurer["classType"], entropy: currentAdventurer["entropy"], createdTime: currentAdventurer.createdTime, lastUpdatedTime: new Date(), // Use this date for now though it is block_timestamp in indexer @@ -207,9 +206,9 @@ export function processData( startGameEvent.adventurerState["adventurer"]["beastHealth"], statUpgrades: startGameEvent.adventurerState["adventurer"]["statPointsAvailable"], + actionsPerBlock: + startGameEvent.adventurerState["adventurer"]["actionsPerBlock"], name: feltToString(startGameEvent.adventurerMeta["name"]), - homeRealm: startGameEvent.adventurerMeta["homeRealm"], - classType: gameData.CLASSES[startGameEvent.adventurerMeta["class"]], entropy: startGameEvent.adventurerMeta["entropy"], createdTime: new Date(), lastUpdatedTime: new Date(), // Use this date for now though it is block_timestamp in indexer diff --git a/ui/src/app/lib/utils/syscalls.ts b/ui/src/app/lib/utils/syscalls.ts index c273a9c55..c353578b1 100644 --- a/ui/src/app/lib/utils/syscalls.ts +++ b/ui/src/app/lib/utils/syscalls.ts @@ -248,14 +248,11 @@ export function syscalls({ const mintAdventurerTx = { contractAddress: gameContract?.address ?? "", - entrypoint: "start", + entrypoint: "new_game", calldata: [ "0x0628d41075659afebfc27aa2aab36237b08ee0b112debd01e56d037f64f6082a", getKeyFromValue(gameData.ITEMS, formData.startingWeapon) ?? "", stringToFelt(formData.name).toString(), - getRandomNumber(8000), - "1", - "1", ], }; @@ -367,7 +364,7 @@ export function syscalls({ const exploreTx = { contractAddress: gameContract?.address ?? "", entrypoint: "explore", - calldata: [adventurer?.id?.toString() ?? "", "0", till_beast ? "1" : "0"], + calldata: [adventurer?.id?.toString() ?? "", till_beast ? "1" : "0"], }; addToCalls(exploreTx); @@ -616,7 +613,7 @@ export function syscalls({ const attackTx = { contractAddress: gameContract?.address ?? "", entrypoint: "attack", - calldata: [adventurer?.id?.toString() ?? "", "0", tillDeath ? "1" : "0"], + calldata: [adventurer?.id?.toString() ?? "", tillDeath ? "1" : "0"], }; addToCalls(attackTx); @@ -848,7 +845,7 @@ export function syscalls({ const fleeTx = { contractAddress: gameContract?.address ?? "", entrypoint: "flee", - calldata: [adventurer?.id?.toString() ?? "", "0", tillDeath ? "1" : "0"], + calldata: [adventurer?.id?.toString() ?? "", tillDeath ? "1" : "0"], }; addToCalls(fleeTx); diff --git a/ui/src/app/types/events.ts b/ui/src/app/types/events.ts index 580975629..eb7e71baf 100644 --- a/ui/src/app/types/events.ts +++ b/ui/src/app/types/events.ts @@ -8,8 +8,6 @@ type u8 = number; type AdventurerMetadata = { name: u128; - homeRealm: u16; - class: u8; entropy: u128; }; @@ -45,6 +43,7 @@ type Adventurer = { ring: LootStatistics; beastHealth: u16; statPointsAvailable: u8; + actionsPerBlock: u8; mutated: boolean; }; From 810315afb366fae498c0317b69d0b1b372a95b55 Mon Sep 17 00:00:00 2001 From: starknetdev Date: Fri, 6 Oct 2023 11:47:40 +0100 Subject: [PATCH 2/8] update lords contract --- ui/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/.env b/ui/.env index fe9f84bec..e150e36c0 100644 --- a/ui/.env +++ b/ui/.env @@ -5,7 +5,7 @@ NEXT_PUBLIC_GOERLI_ETH_CONTRACT_ADDRESS=0x049d36570d4e46f48e99674bd3fcc84644ddd6 NEXT_PUBLIC_MAINNET_ETH_CONTRACT_ADDRESS=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 NEXT_PUBLIC_GOERLI_GAME_CONTRACT_ADDRESS=0x0229a6f42ae0bc258acf91b6e6d7f50e77608dbfb5a42e1c362f2041f9333fb5 NEXT_PUBLIC_MAINNET_GAME_CONTRACT_ADDRESS=0x0 -NEXT_PUBLIC_GOERLI_LORDS_CONTRACT_ADDRESS=0x059dac5df32cbce17b081399e97d90be5fba726f97f00638f838613d088e5a47 +NEXT_PUBLIC_GOERLI_LORDS_CONTRACT_ADDRESS=0x05e367ac160e5f90c5775089b582dfc987dd148a5a2f977c49def2a6644f724b NEXT_PUBLIC_MAINNET_LORDS_CONTRACT_ADDRESS=0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49 NEXT_PUBLIC_RPC_GOERLI_ENDPOINT=https://starknet-goerli.infura.io/v3/6c536e8272f84d3ba63bf9f248c5e128 NEXT_PUBLIC_RPC_MAINNET_ENDPOINT=https://starknet-mainnet.infura.io/v3/6c536e8272f84d3ba63bf9f248c5e128 From 719b08ae41ad6e88dc5b7176c24131d5e2ead536 Mon Sep 17 00:00:00 2001 From: starknetdev Date: Fri, 6 Oct 2023 11:51:34 +0100 Subject: [PATCH 3/8] fix graphql --- indexer/graphql/src/indexer/graphql.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/indexer/graphql/src/indexer/graphql.py b/indexer/graphql/src/indexer/graphql.py index 276ced2ee..5f077b9ea 100644 --- a/indexer/graphql/src/indexer/graphql.py +++ b/indexer/graphql/src/indexer/graphql.py @@ -621,8 +621,6 @@ class AdventurersFilter: id: Optional[FeltValueFilter] = None lastAction: Optional[FeltValueFilter] = None owner: Optional[HexValueFilter] = None - classType: Optional[ClassFilter] = None - homeRealm: Optional[FeltValueFilter] = None name: Optional[StringFilter] = None health: Optional[FeltValueFilter] = None strength: Optional[FeltValueFilter] = None @@ -643,6 +641,7 @@ class AdventurersFilter: ring: Optional[FeltValueFilter] = None beastHealth: Optional[FeltValueFilter] = None statUpgrades: Optional[FeltValueFilter] = None + actionsPerBlock: Optional[FeltValueFilter] = None gold: Optional[FeltValueFilter] = None createdTime: Optional[OrderByInput] = None lastUpdatedTime: Optional[DateTimeFilter] = None @@ -750,8 +749,6 @@ class AdventurersOrderByInput: id: Optional[OrderByInput] = None lastAction: Optional[OrderByInput] = None owner: Optional[OrderByInput] = None - classType: Optional[OrderByInput] = None - homeRealm: Optional[OrderByInput] = None name: Optional[OrderByInput] = None health: Optional[OrderByInput] = None level: Optional[OrderByInput] = None @@ -773,6 +770,7 @@ class AdventurersOrderByInput: ring: Optional[OrderByInput] = None beastHealth: Optional[OrderByInput] = None statUpgrades: Optional[OrderByInput] = None + actionsPerBlock: Optional[OrderByInput] = None gold: Optional[OrderByInput] = None createdTime: Optional[OrderByInput] = None lastUpdatedTime: Optional[OrderByInput] = None @@ -881,8 +879,6 @@ class Adventurer: id: Optional[FeltValue] lastAction: Optional[FeltValue] owner: Optional[HexValue] - classType: Optional[ClassValue] - homeRealm: Optional[FeltValue] name: Optional[StringValue] health: Optional[FeltValue] strength: Optional[FeltValue] @@ -903,6 +899,7 @@ class Adventurer: ring: Optional[ItemValue] beastHealth: Optional[FeltValue] statUpgrades: Optional[FeltValue] + actionsPerBlock: Optional[FeltValue] gold: Optional[FeltValue] createdTime: Optional[str] lastUpdatedTime: Optional[str] @@ -914,8 +911,6 @@ def from_mongo(cls, data): id=data["id"], lastAction=data["lastAction"], owner=data["owner"], - classType=data["classType"], - homeRealm=data["homeRealm"], name=data["name"], health=data["health"], strength=data["strength"], @@ -936,6 +931,7 @@ def from_mongo(cls, data): ring=data["ring"], beastHealth=data["beastHealth"], statUpgrades=data["statUpgrades"], + actionsPerBlock=data["actionsPerBlock"], gold=data["gold"], createdTime=data["createdTime"], lastUpdatedTime=data["lastUpdatedTime"], From 01a03d570fede49a64ecea0884b5a546f01ccc3b Mon Sep 17 00:00:00 2001 From: starknetdev Date: Fri, 6 Oct 2023 12:43:57 +0100 Subject: [PATCH 4/8] fix optimistic adventurerId --- indexer/src/adventurers.ts | 44 ++-- indexer/src/utils/events.ts | 6 +- indexer/src/utils/helpers.ts | 2 +- ui/src/app/lib/utils/parseEvents.ts | 363 ++++++++++++++-------------- ui/src/app/lib/utils/processData.ts | 40 +-- ui/src/app/types/events.ts | 6 +- 6 files changed, 227 insertions(+), 234 deletions(-) diff --git a/indexer/src/adventurers.ts b/indexer/src/adventurers.ts index 4af1860db..58e6642e7 100644 --- a/indexer/src/adventurers.ts +++ b/indexer/src/adventurers.ts @@ -97,15 +97,15 @@ export default function transform({ header, events }: Block) { return events.flatMap(({ event }) => { switch (event.keys[0]) { case START_GAME: { + console.log("START_GAME", "->", "ADVENTURER UPDATES"); const { value } = parseStartGame(event.data, 0); const as = value.adventurerState; const am = value.adventurerMeta; - console.log("START_GAME", "->", "ADVENTURER UPDATES"); return [ insertAdventurer({ id: as.adventurerId, owner: as.owner, - lastAction: as.adventurer.lastAction, + lastAction: as.adventurer.lastActionBlock, health: as.adventurer.health, xp: as.adventurer.xp, strength: as.adventurer.stats.strength, @@ -136,8 +136,8 @@ export default function transform({ header, events }: Block) { ]; } case ADVENTURER_UPGRADED: { - const { value } = parseAdventurerUpgraded(event.data, 0); console.log("ADVENTURER_UPGRADED", "->", "ADVENTURER UPDATES"); + const { value } = parseAdventurerUpgraded(event.data, 0); return [ updateAdventurer({ adventurerState: value.adventurerStateWithBag.adventurerState, @@ -146,8 +146,8 @@ export default function transform({ header, events }: Block) { ]; } case DISCOVERED_HEALTH: { - const { value } = parseDiscoveredHealth(event.data, 0); console.log("DISCOVERED_HEALTH", "->", "ADVENTURER UPDATES"); + const { value } = parseDiscoveredHealth(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -156,8 +156,8 @@ export default function transform({ header, events }: Block) { ]; } case DISCOVERED_GOLD: { - const { value } = parseDiscoveredGold(event.data, 0); console.log("DISCOVERED_GOLD", "->", "ADVENTURER UPDATES"); + const { value } = parseDiscoveredGold(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -166,8 +166,8 @@ export default function transform({ header, events }: Block) { ]; } case DISCOVERED_XP: { - const { value } = parseDiscoveredXp(event.data, 0); console.log("DISCOVERED_XP", "->", "ADVENTURER UPDATES"); + const { value } = parseDiscoveredXp(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -176,8 +176,8 @@ export default function transform({ header, events }: Block) { ]; } case DODGED_OBSTACLE: { - const { value } = parseDodgedObstacle(event.data, 0); console.log("DODGED_OBSTACLE", "->", "ADVENTURER UPDATES"); + const { value } = parseDodgedObstacle(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -186,8 +186,8 @@ export default function transform({ header, events }: Block) { ]; } case HIT_BY_OBSTACLE: { - const { value } = parseHitByObstacle(event.data, 0); console.log("HIT_BY_OBSTACLE", "->", "ADVENTURER UPDATES"); + const { value } = parseHitByObstacle(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -196,8 +196,8 @@ export default function transform({ header, events }: Block) { ]; } case DISCOVERED_BEAST: { - const { value } = parseDiscoveredBeast(event.data, 0); console.log("DISCOVERED_BEAST", "->", "ADVENTURER UPDATES"); + const { value } = parseDiscoveredBeast(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -206,8 +206,8 @@ export default function transform({ header, events }: Block) { ]; } case PURCHASED_POTIONS: { - const { value } = parseDiscoveredXp(event.data, 0); console.log("PURCHASED_POTIONS", "->", "ADVENTURER UPDATES"); + const { value } = parseDiscoveredXp(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -216,8 +216,8 @@ export default function transform({ header, events }: Block) { ]; } case PURCHASED_ITEMS: { - const { value } = parsePurchasedItems(event.data, 0); console.log("PURCHASED_ITEMS", "->", "ADVENTURER UPDATES"); + const { value } = parsePurchasedItems(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -226,8 +226,8 @@ export default function transform({ header, events }: Block) { ]; } case EQUIPPED_ITEMS: { - const { value } = parseEquippedItems(event.data, 0); console.log("EQUIPPED_ITEMS", "->", "ADVENTURER UPDATES"); + const { value } = parseEquippedItems(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -236,8 +236,8 @@ export default function transform({ header, events }: Block) { ]; } case DROPPED_ITEMS: { - const { value } = parseDroppedItems(event.data, 0); console.log("DROPPED_ITEMS", "->", "ADVENTURER UPDATES"); + const { value } = parseDroppedItems(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -246,8 +246,8 @@ export default function transform({ header, events }: Block) { ]; } case ATTACKED_BEAST: { - const { value } = parseAttackedByBeast(event.data, 0); console.log("ATTACKED_BEAST", "->", "ADVENTURER UPDATES"); + const { value } = parseAttackedByBeast(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -256,8 +256,8 @@ export default function transform({ header, events }: Block) { ]; } case ATTACKED_BY_BEAST: { - const { value } = parseAttackedByBeast(event.data, 0); console.log("ATTACKED_BY_BEAST", "->", "ADVENTURER UPDATES"); + const { value } = parseAttackedByBeast(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -266,8 +266,8 @@ export default function transform({ header, events }: Block) { ]; } case AMBUSHED_BY_BEAST: { - const { value } = parseAmbushedByBeast(event.data, 0); console.log("AMBUSHED_BY_BEAST", "->", "ADVENTURER UPDATES"); + const { value } = parseAmbushedByBeast(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -276,8 +276,8 @@ export default function transform({ header, events }: Block) { ]; } case SLAYED_BEAST: { - const { value } = parseSlayedBeast(event.data, 0); console.log("SLAYED_BEAST", "->", "ADVENTURER UPDATES"); + const { value } = parseSlayedBeast(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -286,8 +286,8 @@ export default function transform({ header, events }: Block) { ]; } case ADVENTURER_DIED: { - const { value } = parseAdventurerDied(event.data, 0); console.log("ADVENTURER_DIED", "->", "ADVENTURER UPDATES"); + const { value } = parseAdventurerDied(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -296,8 +296,8 @@ export default function transform({ header, events }: Block) { ]; } case FLEE_FAILED: { - const { value } = parseFleeFailed(event.data, 0); console.log("FLEE_FAILED", "->", "ADVENTURER UPDATES"); + const { value } = parseFleeFailed(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -306,8 +306,8 @@ export default function transform({ header, events }: Block) { ]; } case FLEE_SUCCEEDED: { - const { value } = parseFleeSucceeded(event.data, 0); console.log("FLEE_SUCCEEDED", "->", "ADVENTURER UPDATES"); + const { value } = parseFleeSucceeded(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -316,8 +316,8 @@ export default function transform({ header, events }: Block) { ]; } case ITEMS_LEVELED_UP: { - const { value } = parseItemsLeveledUp(event.data, 0); console.log("ITEMS_LEVELED_UP", "->", "ADVENTURER UPDATES"); + const { value } = parseItemsLeveledUp(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), @@ -326,8 +326,8 @@ export default function transform({ header, events }: Block) { ]; } case UPGRADES_AVAILABLE: { - const { value } = parseUpgradesAvailable(event.data, 0); console.log("UPGRADES_AVAILABLE", "->", "ADVENTURER UPDATES"); + const { value } = parseUpgradesAvailable(event.data, 0); return [ updateAdventurer({ timestamp: new Date().toISOString(), diff --git a/indexer/src/utils/events.ts b/indexer/src/utils/events.ts index 368605c32..438463a59 100644 --- a/indexer/src/utils/events.ts +++ b/indexer/src/utils/events.ts @@ -75,7 +75,7 @@ export const parseLootWithPrice = combineParsers({ }); export const parseAdventurer = combineParsers({ - lastAction: { index: 0, parser: parseU16 }, + lastActionBlock: { index: 0, parser: parseU16 }, health: { index: 1, parser: parseU16 }, xp: { index: 2, parser: parseU16 }, stats: { index: 3, parser: parseStats }, @@ -96,7 +96,7 @@ export const parseAdventurer = combineParsers({ export const parseAdventurerState = combineParsers({ owner: { index: 0, parser: parseFelt252 }, - adventurerId: { index: 1, parser: parseU256 }, + adventurerId: { index: 1, parser: parseFelt252 }, adventurer: { index: 2, parser: parseAdventurer }, }); @@ -171,7 +171,7 @@ export const parseAdventurerDied = combineParsers({ export const parseAdventurerMetadata = combineParsers({ name: { index: 0, parser: parseU128 }, - entropy: { index: 3, parser: parseU128 }, + entropy: { index: 1, parser: parseU128 }, }); export const parseStartGame = combineParsers({ diff --git a/indexer/src/utils/helpers.ts b/indexer/src/utils/helpers.ts index 6cb3af1c1..61457838c 100644 --- a/indexer/src/utils/helpers.ts +++ b/indexer/src/utils/helpers.ts @@ -168,7 +168,7 @@ export function updateAdventurer({ $set: { id: checkExistsInt(BigInt(adventurerState.adventurerId)), owner: checkExistsInt(BigInt(adventurerState.owner)), - lastAction: encodeIntAsBytes(BigInt(adventurer.lastAction)), + lastAction: encodeIntAsBytes(BigInt(adventurer.lastActionBlock)), health: encodeIntAsBytes(BigInt(adventurer.health)), xp: encodeIntAsBytes(BigInt(adventurer.xp)), strength: encodeIntAsBytes(BigInt(adventurer.stats.strength)), diff --git a/ui/src/app/lib/utils/parseEvents.ts b/ui/src/app/lib/utils/parseEvents.ts index 082d8b13d..2eac86a0d 100644 --- a/ui/src/app/lib/utils/parseEvents.ts +++ b/ui/src/app/lib/utils/parseEvents.ts @@ -33,68 +33,65 @@ import { processData } from "./processData"; function parseAdventurerState(data: string[]) { return { owner: data[0], - adventurerId: { - low: parseInt(data[1]), - high: parseInt(data[2]), - }, + adventurerId: parseInt(data[1]), adventurer: { - lastAction: parseInt(data[3]), - health: parseInt(data[4]), - xp: parseInt(data[5]), + lastAction: parseInt(data[2]), + health: parseInt(data[3]), + xp: parseInt(data[4]), stats: { - strength: parseInt(data[6]), - dexterity: parseInt(data[7]), - vitality: parseInt(data[8]), - intelligence: parseInt(data[9]), - wisdom: parseInt(data[10]), - charisma: parseInt(data[11]), - luck: parseInt(data[12]), + strength: parseInt(data[5]), + dexterity: parseInt(data[6]), + vitality: parseInt(data[7]), + intelligence: parseInt(data[8]), + wisdom: parseInt(data[9]), + charisma: parseInt(data[10]), + luck: parseInt(data[11]), }, - gold: parseInt(data[13]), + gold: parseInt(data[12]), weapon: { - id: parseInt(data[14]), - xp: parseInt(data[15]), - metadata: parseInt(data[16]), + id: parseInt(data[13]), + xp: parseInt(data[14]), + metadata: parseInt(data[15]), }, chest: { - id: parseInt(data[17]), - xp: parseInt(data[18]), - metadata: parseInt(data[19]), + id: parseInt(data[16]), + xp: parseInt(data[17]), + metadata: parseInt(data[18]), }, head: { - id: parseInt(data[20]), - xp: parseInt(data[21]), - metadata: parseInt(data[22]), + id: parseInt(data[19]), + xp: parseInt(data[20]), + metadata: parseInt(data[21]), }, waist: { - id: parseInt(data[23]), - xp: parseInt(data[24]), - metadata: parseInt(data[25]), + id: parseInt(data[22]), + xp: parseInt(data[23]), + metadata: parseInt(data[24]), }, foot: { - id: parseInt(data[26]), - xp: parseInt(data[27]), - metadata: parseInt(data[28]), + id: parseInt(data[25]), + xp: parseInt(data[26]), + metadata: parseInt(data[27]), }, hand: { - id: parseInt(data[29]), - xp: parseInt(data[30]), - metadata: parseInt(data[31]), + id: parseInt(data[28]), + xp: parseInt(data[29]), + metadata: parseInt(data[30]), }, neck: { - id: parseInt(data[32]), - xp: parseInt(data[33]), - metadata: parseInt(data[34]), + id: parseInt(data[31]), + xp: parseInt(data[32]), + metadata: parseInt(data[33]), }, ring: { - id: parseInt(data[35]), - xp: parseInt(data[36]), - metadata: parseInt(data[37]), + id: parseInt(data[34]), + xp: parseInt(data[35]), + metadata: parseInt(data[36]), }, - beastHealth: parseInt(data[38]), - statPointsAvailable: parseInt(data[39]), - actionsPerBlock: parseInt(data[40]), - mutated: convertToBoolean(parseInt(data[41])), + beastHealth: parseInt(data[37]), + statPointsAvailable: parseInt(data[38]), + actionsPerBlock: parseInt(data[39]), + mutated: convertToBoolean(parseInt(data[40])), }, }; } @@ -231,10 +228,10 @@ export async function parseEvents( switch (eventName) { case "StartGame": const startGameData: StartGameEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), adventurerMeta: { - name: parseInt(raw.data[42]), - entropy: parseInt(raw.data[43]), + name: parseInt(raw.data[41]), + entropy: parseInt(raw.data[42]), }, }; const startGameEvent = processData( @@ -247,15 +244,15 @@ export async function parseEvents( case "AdventurerUpgraded": const upgradeAvailableData: AdventurerUpgradedEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - bag: parseBag(raw.data.slice(42, 75)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + bag: parseBag(raw.data.slice(41, 74)), }, - strengthIncrease: parseInt(raw.data[76]), - dexterityIncrease: parseInt(raw.data[77]), - vitalityIncrease: parseInt(raw.data[78]), - intelligenceIncrease: parseInt(raw.data[79]), - wisdomIncrease: parseInt(raw.data[80]), - charismaIncrease: parseInt(raw.data[81]), + strengthIncrease: parseInt(raw.data[75]), + dexterityIncrease: parseInt(raw.data[76]), + vitalityIncrease: parseInt(raw.data[77]), + intelligenceIncrease: parseInt(raw.data[78]), + wisdomIncrease: parseInt(raw.data[79]), + charismaIncrease: parseInt(raw.data[80]), }; const upgradeAvailableEvent = processData( upgradeAvailableData, @@ -267,8 +264,8 @@ export async function parseEvents( break; case "DiscoveredHealth": const discoveredHealthData: DiscoveredHealthEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - healthAmount: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + healthAmount: parseInt(raw.data[41]), }; const discoveredHealthEvent = processData( discoveredHealthData, @@ -280,8 +277,8 @@ export async function parseEvents( break; case "DiscoveredGold": const discoveredGoldData: DiscoveredGoldEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - goldAmount: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + goldAmount: parseInt(raw.data[41]), }; const discoveredGoldEvent = processData( discoveredGoldData, @@ -293,8 +290,8 @@ export async function parseEvents( break; case "DiscoveredXP": const discoveredXPData: DiscoveredXPEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - xpAmount: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + xpAmount: parseInt(raw.data[41]), }; const discoveredXPEvent = processData( discoveredXPData, @@ -306,13 +303,13 @@ export async function parseEvents( break; case "DodgedObstacle": const dodgedObstacleData: DodgedObstacleEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - id: parseInt(raw.data[42]), - level: parseInt(raw.data[43]), - damageTaken: parseInt(raw.data[44]), - damageLocation: parseInt(raw.data[45]), - xpEarnedAdventurer: parseInt(raw.data[46]), - xpEarnedItems: parseInt(raw.data[47]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + id: parseInt(raw.data[41]), + level: parseInt(raw.data[42]), + damageTaken: parseInt(raw.data[43]), + damageLocation: parseInt(raw.data[44]), + xpEarnedAdventurer: parseInt(raw.data[45]), + xpEarnedItems: parseInt(raw.data[46]), }; const dodgedObstacleEvent = processData( dodgedObstacleData, @@ -324,13 +321,13 @@ export async function parseEvents( break; case "HitByObstacle": const hitByObstacleData: HitByObstacleEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - id: parseInt(raw.data[42]), - level: parseInt(raw.data[43]), - damageTaken: parseInt(raw.data[44]), - damageLocation: parseInt(raw.data[45]), - xpEarnedAdventurer: parseInt(raw.data[46]), - xpEarnedItems: parseInt(raw.data[47]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + id: parseInt(raw.data[41]), + level: parseInt(raw.data[42]), + damageTaken: parseInt(raw.data[43]), + damageLocation: parseInt(raw.data[44]), + xpEarnedAdventurer: parseInt(raw.data[45]), + xpEarnedItems: parseInt(raw.data[46]), }; const hitByObstacleEvent = processData( hitByObstacleData, @@ -342,17 +339,17 @@ export async function parseEvents( break; case "DiscoveredBeast": const discoveredBeastData: DiscoveredBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, }; @@ -366,22 +363,22 @@ export async function parseEvents( break; case "AmbushedByBeast": const ambushedByBeastData: AmbushedByBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, - damage: parseInt(raw.data[50]), - criticalHit: convertToBoolean(parseInt(raw.data[51])), - location: parseInt(raw.data[52]), + damage: parseInt(raw.data[49]), + criticalHit: convertToBoolean(parseInt(raw.data[50])), + location: parseInt(raw.data[51]), }; const ambushedByBeastEvent = processData( ambushedByBeastData, @@ -393,22 +390,22 @@ export async function parseEvents( break; case "AttackedBeast": const attackedBeastData: AttackedBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, - damage: parseInt(raw.data[50]), - criticalHit: convertToBoolean(parseInt(raw.data[51])), - location: parseInt(raw.data[52]), + damage: parseInt(raw.data[49]), + criticalHit: convertToBoolean(parseInt(raw.data[50])), + location: parseInt(raw.data[51]), }; const attackedBeastEvent = processData( attackedBeastData, @@ -420,22 +417,22 @@ export async function parseEvents( break; case "AttackedByBeast": const attackedByBeastData: AttackedByBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, - damage: parseInt(raw.data[50]), - criticalHit: convertToBoolean(parseInt(raw.data[51])), - location: parseInt(raw.data[52]), + damage: parseInt(raw.data[49]), + criticalHit: convertToBoolean(parseInt(raw.data[50])), + location: parseInt(raw.data[51]), }; const attackedByBeastEvent = processData( attackedByBeastData, @@ -447,24 +444,24 @@ export async function parseEvents( break; case "SlayedBeast": const slayedBeastData: SlayedBeastEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, - damageDealt: parseInt(raw.data[50]), - criticalHit: convertToBoolean(parseInt(raw.data[51])), - xpEarnedAdventurer: parseInt(raw.data[52]), - xpEarnedItems: parseInt(raw.data[53]), - goldEarned: parseInt(raw.data[54]), + damageDealt: parseInt(raw.data[49]), + criticalHit: convertToBoolean(parseInt(raw.data[50])), + xpEarnedAdventurer: parseInt(raw.data[51]), + xpEarnedItems: parseInt(raw.data[52]), + goldEarned: parseInt(raw.data[53]), }; const slayedBeastEvent = processData( slayedBeastData, @@ -476,17 +473,17 @@ export async function parseEvents( break; case "FleeFailed": const fleeFailedData: FleeFailedEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, }; @@ -500,17 +497,17 @@ export async function parseEvents( break; case "FleeSucceeded": const fleeSucceededData: FleeSucceededEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - seed: parseInt(raw.data[42]), - id: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + seed: parseInt(raw.data[41]), + id: parseInt(raw.data[42]), beastSpecs: { - tier: parseInt(raw.data[44]), - itemType: parseInt(raw.data[45]), - level: parseInt(raw.data[46]), + tier: parseInt(raw.data[43]), + itemType: parseInt(raw.data[44]), + level: parseInt(raw.data[45]), specials: { - special1: parseInt(raw.data[47]), - special2: parseInt(raw.data[48]), - special3: parseInt(raw.data[49]), + special1: parseInt(raw.data[46]), + special2: parseInt(raw.data[47]), + special3: parseInt(raw.data[48]), }, }, }; @@ -525,11 +522,11 @@ export async function parseEvents( case "PurchasedItems": const purchasedItemsData: PurchasedItemsEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - bag: parseBag(raw.data.slice(42, 75)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + bag: parseBag(raw.data.slice(41, 74)), }, // Skip array length - purchases: parseItems(raw.data.slice(77)), + purchases: parseItems(raw.data.slice(76)), }; const purchasedItemsEvent = processData( purchasedItemsData, @@ -541,10 +538,10 @@ export async function parseEvents( break; case "PurchasedPotions": const purchasedPotionsData: PurchasedPotionsEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - quantity: parseInt(raw.data[42]), - cost: parseInt(raw.data[43]), - health: parseInt(raw.data[44]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + quantity: parseInt(raw.data[41]), + cost: parseInt(raw.data[42]), + health: parseInt(raw.data[43]), }; const purchasedPotionsEvent = processData( purchasedPotionsData, @@ -561,8 +558,8 @@ export async function parseEvents( ); const equippedItemsData: EquippedItemsEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - bag: parseBag(raw.data.slice(42, 75)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + bag: parseBag(raw.data.slice(41, 74)), }, equippedItems: equippedItems, unequippedItems: unequippedItems, @@ -584,8 +581,8 @@ export async function parseEvents( } const droppedItemsData: DroppedItemsEvent = { adventurerStateWithBag: { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - bag: parseBag(raw.data.slice(42, 75)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + bag: parseBag(raw.data.slice(41, 74)), }, itemIds: itemIds, }; @@ -599,10 +596,10 @@ export async function parseEvents( break; case "GreatnessIncreased": const greatnessIncreasedData: GreatnessIncreasedEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - itemId: parseInt(raw.data[42]), - previousLevel: parseInt(raw.data[43]), - newLevel: parseInt(raw.data[44]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + itemId: parseInt(raw.data[41]), + previousLevel: parseInt(raw.data[42]), + newLevel: parseInt(raw.data[43]), }; const greatnessIncreasedEvent = processData( greatnessIncreasedData, @@ -614,9 +611,9 @@ export async function parseEvents( break; case "ItemsLeveledUp": const itemsLeveledUpData: ItemsLeveledUpEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), // Skip items length - items: parseItemLevels(raw.data.slice(43)), + items: parseItemLevels(raw.data.slice(42)), }; const itemsLeveledUpEvent = processData( itemsLeveledUpData, @@ -628,8 +625,8 @@ export async function parseEvents( break; case "NewHighScore": const newHighScoreData: NewHighScoreEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - rank: parseInt(raw.data[42]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + rank: parseInt(raw.data[41]), }; const newHighScoreEvent = processData( newHighScoreData, @@ -641,10 +638,10 @@ export async function parseEvents( break; case "AdventurerDied": const adventurerDiedData: AdventurerDiedEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - killedByBeast: parseInt(raw.data[42]), - killedByObstacle: parseInt(raw.data[43]), - callerAddress: raw.data[44], + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + killedByBeast: parseInt(raw.data[41]), + killedByObstacle: parseInt(raw.data[42]), + callerAddress: raw.data[43], }; const adventurerDiedEvent = processData( adventurerDiedData, @@ -656,9 +653,9 @@ export async function parseEvents( break; case "AdventurerLeveledUp": const adventurerLeveledUpData: AdventurerLeveledUpEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - previousLevel: parseInt(raw.data[42]), - newLevel: parseInt(raw.data[43]), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + previousLevel: parseInt(raw.data[41]), + newLevel: parseInt(raw.data[42]), }; const adventurerLeveledUpEvent = processData( adventurerLeveledUpData, @@ -670,13 +667,13 @@ export async function parseEvents( break; case "UpgradesAvailable": // Skip array length - const newItems = raw.data.slice(43); + const newItems = raw.data.slice(42); const newItemsIds = []; for (let i = 0; i < newItems.length; i++) { newItemsIds.push(parseInt(newItems[i])); } const upgradesAvailableData: UpgradesAvailableEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), // Skip array length items: newItemsIds, }; @@ -690,10 +687,10 @@ export async function parseEvents( break; case "IdleDeathPenalty": const idleDeathPenaltyData: IdleDeathPenaltyEvent = { - adventurerState: parseAdventurerState(raw.data.slice(0, 41)), - idleBlocks: parseInt(raw.data[42]), - penaltyThreshold: parseInt(raw.data[43]), - caller: raw.data[44], + adventurerState: parseAdventurerState(raw.data.slice(0, 40)), + idleBlocks: parseInt(raw.data[41]), + penaltyThreshold: parseInt(raw.data[42]), + caller: raw.data[43], }; const idleDeathPenaltyEvent = processData( idleDeathPenaltyData, diff --git a/ui/src/app/lib/utils/processData.ts b/ui/src/app/lib/utils/processData.ts index 17c204dd5..044d7bc28 100644 --- a/ui/src/app/lib/utils/processData.ts +++ b/ui/src/app/lib/utils/processData.ts @@ -60,7 +60,7 @@ type EventData = function processAdventurerState(data: any, currentAdventurer?: any) { const gameData = new GameData(); const updateAdventurerDoc: Adventurer = { - id: data.adventurerState["adventurerId"].low, + id: data.adventurerState["adventurerId"], owner: data.adventurerState["owner"], lastAction: data.adventurerState["adventurer"]["lastAction"], health: data.adventurerState["adventurer"]["health"], @@ -99,7 +99,7 @@ export function processPurchases(data: any, adventurerState: any) { for (let item of data) { purchasedItems.push({ item: gameData.ITEMS[item.item.id], - adventurerId: adventurerState["adventurerId"].low, + adventurerId: adventurerState["adventurerId"], owner: true, equipped: false, ownerAddress: adventurerState["owner"], @@ -157,7 +157,7 @@ export function processData( case "StartGame": const startGameEvent = event as StartGameEvent; const updateAdventurerDoc: Adventurer = { - id: startGameEvent.adventurerState["adventurerId"].low, + id: startGameEvent.adventurerState["adventurerId"], owner: startGameEvent.adventurerState["owner"], lastAction: startGameEvent.adventurerState["adventurer"]["lastAction"], health: startGameEvent.adventurerState["adventurer"]["health"], @@ -229,7 +229,7 @@ export function processData( ); const discoverHealthData = { txHash: txHash, - adventurerId: discoveredHealthEvent.adventurerState["adventurerId"].low, + adventurerId: discoveredHealthEvent.adventurerState["adventurerId"], adventurerHealth: discoveredHealthEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[3], @@ -262,7 +262,7 @@ export function processData( ); const discoverGoldData = { txHash: txHash, - adventurerId: discoveredGoldEvent.adventurerState["adventurerId"].low, + adventurerId: discoveredGoldEvent.adventurerState["adventurerId"], adventurerHealth: discoveredGoldEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[3], @@ -296,7 +296,7 @@ export function processData( ); const discoverXPData = { txHash: txHash, - adventurerId: discoveredXPEvent.adventurerState["adventurerId"].low, + adventurerId: discoveredXPEvent.adventurerState["adventurerId"], adventurerHealth: discoveredXPEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[3], @@ -330,7 +330,7 @@ export function processData( ); const dodgedObstacleData = { txHash: txHash, - adventurerId: dodgedObstacleEvent.adventurerState["adventurerId"].low, + adventurerId: dodgedObstacleEvent.adventurerState["adventurerId"], adventurerHealth: dodgedObstacleEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[2], @@ -368,7 +368,7 @@ export function processData( ); const hitByObstacleData = { txHash: txHash, - adventurerId: hitByObstacleEvent.adventurerState["adventurerId"].low, + adventurerId: hitByObstacleEvent.adventurerState["adventurerId"], adventurerHealth: hitByObstacleEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[2], @@ -406,7 +406,7 @@ export function processData( ); const discoveredBeastData = { txHash: txHash, - adventurerId: discoveredBeastEvent.adventurerState["adventurerId"].low, + adventurerId: discoveredBeastEvent.adventurerState["adventurerId"], adventurerHealth: discoveredBeastEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[1], @@ -458,7 +458,7 @@ export function processData( discoveredBeastEvent.beastSpecs["specials"]["special3"] ], seed: discoveredBeastEvent.seed, - adventurerId: discoveredBeastEvent.adventurerState["adventurerId"].low, + adventurerId: discoveredBeastEvent.adventurerState["adventurerId"], slainOnTime: null, createdTime: new Date(), lastUpdatedTime: new Date(), @@ -477,7 +477,7 @@ export function processData( ); const ambushedByBeastData = { txHash: txHash, - adventurerId: ambushedByBeastEvent.adventurerState["adventurerId"].low, + adventurerId: ambushedByBeastEvent.adventurerState["adventurerId"], adventurerHealth: ambushedByBeastEvent.adventurerState["adventurer"]["health"], discoveryType: gameData.DISCOVERY_TYPES[1], @@ -529,7 +529,7 @@ export function processData( ambushedByBeastEvent.beastSpecs["specials"]["special3"] ], seed: ambushedByBeastEvent.seed, - adventurerId: ambushedByBeastEvent.adventurerState["adventurerId"].low, + adventurerId: ambushedByBeastEvent.adventurerState["adventurerId"], slainOnTime: null, createdTime: new Date(), lastUpdatedTime: new Date(), @@ -554,7 +554,7 @@ export function processData( ambushedByBeastEvent.beastSpecs["specials"]["special3"] ], seed: ambushedByBeastEvent.seed, - adventurerId: ambushedByBeastEvent.adventurerState["adventurerId"].low, + adventurerId: ambushedByBeastEvent.adventurerState["adventurerId"], adventurerHealth: ambushedByBeastEvent.adventurerState["adventurer"]["health"], attacker: "Beast", @@ -601,7 +601,7 @@ export function processData( attackedBeastEvent.beastSpecs["specials"]["special3"] ], seed: attackedBeastEvent.seed, - adventurerId: attackedBeastEvent.adventurerState["adventurerId"].low, + adventurerId: attackedBeastEvent.adventurerState["adventurerId"], adventurerHealth: attackedBeastEvent.adventurerState["adventurer"]["health"], attacker: "Adventurer", @@ -643,7 +643,7 @@ export function processData( attackedByBeastEvent.beastSpecs["specials"]["special3"] ], seed: attackedByBeastEvent.seed, - adventurerId: attackedByBeastEvent.adventurerState["adventurerId"].low, + adventurerId: attackedByBeastEvent.adventurerState["adventurerId"], adventurerHealth: attackedByBeastEvent.adventurerState["adventurer"]["health"], attacker: "Beast", @@ -685,7 +685,7 @@ export function processData( slayedBeastEvent.beastSpecs["specials"]["special3"] ], seed: slayedBeastEvent.seed, - adventurerId: slayedBeastEvent.adventurerState["adventurerId"].low, + adventurerId: slayedBeastEvent.adventurerState["adventurerId"], adventurerHealth: slayedBeastEvent.adventurerState["adventurer"]["health"], attacker: "Adventurer", @@ -728,7 +728,7 @@ export function processData( fleeFailedEvent.beastSpecs["specials"]["special3"] ], seed: fleeFailedEvent.seed, - adventurerId: fleeFailedEvent.adventurerState["adventurerId"].low, + adventurerId: fleeFailedEvent.adventurerState["adventurerId"], adventurerHealth: fleeFailedEvent.adventurerState["adventurer"]["health"], attacker: "Adventurer", @@ -770,7 +770,7 @@ export function processData( fleeSucceededEvent.beastSpecs["specials"]["special3"] ], seed: fleeSucceededEvent.seed, - adventurerId: fleeSucceededEvent.adventurerState["adventurerId"].low, + adventurerId: fleeSucceededEvent.adventurerState["adventurerId"], adventurerHealth: fleeSucceededEvent.adventurerState["adventurer"]["health"], attacker: "Adventurer", @@ -895,7 +895,7 @@ export function processData( special2: null, special3: null, seed: 0, - adventurerId: idleDeathPenaltyEvent.adventurerState["adventurerId"].low, + adventurerId: idleDeathPenaltyEvent.adventurerState["adventurerId"], adventurerHealth: idleDeathPenaltyEvent.adventurerState["adventurer"]["health"], attacker: null, @@ -913,7 +913,7 @@ export function processData( }; const penaltyDiscoveryData = { txHash: txHash, - adventurerId: idleDeathPenaltyEvent.adventurerState["adventurerId"].low, + adventurerId: idleDeathPenaltyEvent.adventurerState["adventurerId"], adventurerHealth: idleDeathPenaltyEvent.adventurerState["adventurer"]["health"], discoveryType: null, diff --git a/ui/src/app/types/events.ts b/ui/src/app/types/events.ts index eb7e71baf..83b329deb 100644 --- a/ui/src/app/types/events.ts +++ b/ui/src/app/types/events.ts @@ -1,8 +1,4 @@ type u128 = number; -type u256 = { - low: u128; - high: u128; -}; type u16 = number; type u8 = number; @@ -108,7 +104,7 @@ type ContractAddress = any; // This needs to be defined or imported from its sou export type AdventurerState = { owner: ContractAddress; - adventurerId: u256; + adventurerId: u128; adventurer: Adventurer; }; From 9fb653ad8d60e5e49dce284dec00b4ad490cee9d Mon Sep 17 00:00:00 2001 From: starknetdev Date: Fri, 6 Oct 2023 15:15:51 +0100 Subject: [PATCH 5/8] hardcode env variables --- ui/src/app/lib/constants.ts | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/ui/src/app/lib/constants.ts b/ui/src/app/lib/constants.ts index 197a650ea..7a429431b 100644 --- a/ui/src/app/lib/constants.ts +++ b/ui/src/app/lib/constants.ts @@ -10,19 +10,21 @@ export const chapter4 = "They find golden coins in their pocket, glimmering in the dim light - an enigma wrapped in the shroud of the unexpected."; export const battle = "A beast lurks in the shadow, prepare for battle!"; +export const NETWORK: "goerli" | "mainnet" = "goerli"; + export function getRPCUrl() { - switch (process.env.NEXT_PUBLIC_NETWORK) { + switch (NETWORK) { case "goerli": - return process.env.NEXT_PUBLIC_RPC_GOERLI_ENDPOINT; + return "https://starknet-goerli.infura.io/v3/6c536e8272f84d3ba63bf9f248c5e128"; case "mainnet": - return process.env.NEXT_PUBLIC_RPC_MAINNET_ENDPOINT; + return "https://starknet-mainnet.infura.io/v3/6c536e8272f84d3ba63bf9f248c5e128"; default: return "http://localhost:8000/graphql"; } } export function getGraphQLUrl() { - switch (process.env.NEXT_PUBLIC_NETWORK) { + switch (NETWORK) { case "goerli": return "https://survivor-indexer.realms.world/goerli-graphql"; case "mainnet": @@ -33,37 +35,39 @@ export function getGraphQLUrl() { } export function getContracts() { - switch (process.env.NEXT_PUBLIC_NETWORK) { + switch (NETWORK) { case "goerli": return { - eth: process.env.NEXT_PUBLIC_GOERLI_ETH_CONTRACT_ADDRESS, - game: process.env.NEXT_PUBLIC_GOERLI_GAME_CONTRACT_ADDRESS, - lords: process.env.NEXT_PUBLIC_GOERLI_LORDS_CONTRACT_ADDRESS, + eth: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + game: "0x0229a6f42ae0bc258acf91b6e6d7f50e77608dbfb5a42e1c362f2041f9333fb5", + lords: + "0x05e367ac160e5f90c5775089b582dfc987dd148a5a2f977c49def2a6644f724b", }; case "mainnet": return { - eth: process.env.NEXT_PUBLIC_MAINNET_ETH_CONTRACT_ADDRESS, - game: process.env.NEXT_PUBLIC_MAINNET_GAME_CONTRACT_ADDRESS, - lords: process.env.NEXT_PUBLIC_MAINNET_LORDS_CONTRACT_ADDRESS, + eth: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + game: "0x0", + lords: + "0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49", }; } } export function getArcadeClassHash() { - switch (process.env.NEXT_PUBLIC_NETWORK) { + switch (NETWORK) { case "goerli": - return process.env.NEXT_PUBLIC_GOERLI_ARCADE_ACCOUNT_CLASS_HASH; + return "0x0715b5e10bf63c36e69c402a81e1eb96b9107ef56eb5e821b00893e39bdcf545"; case "mainnet": - return process.env.NEXT_PUBLIC_MAINNET_ARCADE_ACCOUNT_CLASS_HASH; + return "0x0"; } } export function getAppUrl() { - switch (process.env.NEXT_PUBLIC_NETWORK) { + switch (NETWORK) { case "goerli": - return process.env.NEXT_PUBLIC_GOERLI_APP_URL; + return "https://starknet-goerli.infura.io/v3/6c536e8272f84d3ba63bf9f248c5e128"; case "mainnet": - return process.env.NEXT_PUBLIC_MAINNET_APP_URL; + return "https://starknet-mainnet.infura.io/v3/6c536e8272f84d3ba63bf9f248c5e128"; } } From c6d4468e66082b1658bffae6b5b1e453d421e0e3 Mon Sep 17 00:00:00 2001 From: starknetdev Date: Sat, 7 Oct 2023 10:07:13 +0100 Subject: [PATCH 6/8] update game address --- ui/src/app/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/lib/constants.ts b/ui/src/app/lib/constants.ts index 7a429431b..1be3b186f 100644 --- a/ui/src/app/lib/constants.ts +++ b/ui/src/app/lib/constants.ts @@ -39,7 +39,7 @@ export function getContracts() { case "goerli": return { eth: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", - game: "0x0229a6f42ae0bc258acf91b6e6d7f50e77608dbfb5a42e1c362f2041f9333fb5", + game: "0x00038770136af6a381c58642718a0e088a442a1984c74a64de7960df2e3e5c60", lords: "0x05e367ac160e5f90c5775089b582dfc987dd148a5a2f977c49def2a6644f724b", }; From b90b4a590de554426497d9247dc7fcbf353185be Mon Sep 17 00:00:00 2001 From: starknetdev Date: Sat, 7 Oct 2023 11:46:11 +0100 Subject: [PATCH 7/8] - change penalty time to 7 mins - fix time conversion --- ui/src/app/components/CountDown.tsx | 4 +++- ui/src/app/lib/constants.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/src/app/components/CountDown.tsx b/ui/src/app/components/CountDown.tsx index 1ae967131..120fb2990 100644 --- a/ui/src/app/components/CountDown.tsx +++ b/ui/src/app/components/CountDown.tsx @@ -58,7 +58,7 @@ export const PenaltyCountDown = ({ ? formatDiscoveryTime : formatBattleTime; - const formatLastAction = convertTime(lastAction); + const formatLastAction = lastAction; const targetTime = formatLastAction + penaltyTime * 1000; useEffect(() => { @@ -87,6 +87,8 @@ export const PenaltyCountDown = ({ .padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; }; + console.log(seconds); + return (
{!dataLoading ? ( diff --git a/ui/src/app/lib/constants.ts b/ui/src/app/lib/constants.ts index 1be3b186f..d388861c6 100644 --- a/ui/src/app/lib/constants.ts +++ b/ui/src/app/lib/constants.ts @@ -87,7 +87,7 @@ export const notificationAnimations = [ // ---- CONTRACT PARAMS // Penalty time is 12 blocks, where each block is ~ 15 seconds -export const penaltyTime = 12 * 15; +export const penaltyTime = 420; export const itemCharismaDiscount = 1; export const itemBasePrice = 4; export const itemMinimumPrice = 1; From e3f89fda9853798f1889c6931a191b7442229d55 Mon Sep 17 00:00:00 2001 From: starknetdev Date: Mon, 9 Oct 2023 10:51:19 +0100 Subject: [PATCH 8/8] update game contract --- indexer/env-goerli | 2 +- ui/src/app/components/CountDown.tsx | 7 ------- ui/src/app/lib/constants.ts | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/indexer/env-goerli b/indexer/env-goerli index 0fd370081..317ad9930 100644 --- a/indexer/env-goerli +++ b/indexer/env-goerli @@ -1,3 +1,3 @@ -GAME="0x0229a6f42ae0bc258acf91b6e6d7f50e77608dbfb5a42e1c362f2041f9333fb5" +GAME="0x03f2ac2c55abbf633123ddb72adc3472feefc4e962c4cedc16dda11a2ac8d1d4" START=873000 MONGO_CONNECTION_STRING="mongodb://mongo:mongo@54.246.178.155:27017" diff --git a/ui/src/app/components/CountDown.tsx b/ui/src/app/components/CountDown.tsx index 120fb2990..820c7df65 100644 --- a/ui/src/app/components/CountDown.tsx +++ b/ui/src/app/components/CountDown.tsx @@ -12,11 +12,6 @@ export const HealthCountDown = ({ health }: any) => { end: health, delay: 1000, duration: 5, - // onReset: () => console.log("Resetted!"), - // onUpdate: () => console.log("Updated!"), - // onPauseResume: () => console.log("Paused or resumed!"), - // onStart: ({ pauseResume }) => console.log(pauseResume), - // onEnd: ({ pauseResume }) => console.log(pauseResume), }); useEffect(() => { @@ -87,8 +82,6 @@ export const PenaltyCountDown = ({ .padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; }; - console.log(seconds); - return (
{!dataLoading ? ( diff --git a/ui/src/app/lib/constants.ts b/ui/src/app/lib/constants.ts index d388861c6..9828706ee 100644 --- a/ui/src/app/lib/constants.ts +++ b/ui/src/app/lib/constants.ts @@ -39,7 +39,7 @@ export function getContracts() { case "goerli": return { eth: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", - game: "0x00038770136af6a381c58642718a0e088a442a1984c74a64de7960df2e3e5c60", + game: "0x03f2ac2c55abbf633123ddb72adc3472feefc4e962c4cedc16dda11a2ac8d1d4", lords: "0x05e367ac160e5f90c5775089b582dfc987dd148a5a2f977c49def2a6644f724b", };