From 743cfb814e62640a50fa93b6b58115d378220ed8 Mon Sep 17 00:00:00 2001 From: starknetdev Date: Mon, 9 Oct 2023 17:41:43 +0100 Subject: [PATCH] fix reward parser --- indexer/src/scores.ts | 4 ++-- indexer/src/utils/events.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indexer/src/scores.ts b/indexer/src/scores.ts index 907814785..2fe462853 100644 --- a/indexer/src/scores.ts +++ b/indexer/src/scores.ts @@ -44,9 +44,9 @@ export default function transform({ header, events }: Block) { return events.flatMap(({ event, receipt }) => { switch (event.keys[0]) { case NEW_HIGH_SCORE: { + console.log("NEW_HIGH_SCORE", "->", "SCORES UPDATE"); const { value } = parseNewHighScore(event.data, 0); const as = value.adventurer_state; - console.log("NEW_HIGH_SCORE", "->", "SCORES UPDATE"); return [ insertHighScore({ adventurerId: as.adventurerId, @@ -61,11 +61,11 @@ export default function transform({ header, events }: Block) { ]; } case REWARD_DISTRIBUTION: { + console.log("REWARD_DISTRIBUTION", "->", "SCORES UPDATE"); const { value } = parseRewardDistribution(event.data, 0); const fp = value.firstPlace; const sp = value.secondPlace; const tp = value.thirdPlace; - console.log("REWARD_DISTRIBUTION", "->", "SCORES UPDATE"); const updates: any[] = []; if (BigInt(fp.amount) > 0) { updates.push( diff --git a/indexer/src/utils/events.ts b/indexer/src/utils/events.ts index 438463a59..c131755e3 100644 --- a/indexer/src/utils/events.ts +++ b/indexer/src/utils/events.ts @@ -304,7 +304,7 @@ export const parseItemsLeveledUp = combineParsers({ }); export const parsePlayerReward = combineParsers({ - adventurerId: { index: 0, parser: parseU256 }, + adventurerId: { index: 0, parser: parseFelt252 }, rank: { index: 1, parser: parseU8 }, amount: { index: 2, parser: parseU256 }, address: { index: 3, parser: parseFelt252 },