Skip to content

Commit

Permalink
working pragma version (no persistent data)
Browse files Browse the repository at this point in the history
  • Loading branch information
starknetdev committed May 23, 2024
1 parent 39d07e7 commit d563c5e
Show file tree
Hide file tree
Showing 35 changed files with 992 additions and 1,561 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contracts/beasts/target/CACHEDIR.TAG

keys
account
loot-survivor.pem
ls1.5.pem
contracts/game_entropy/target/CACHEDIR.TAG
contracts/game_entropy/target/dev/game_entropy.sierra

Expand Down
4 changes: 2 additions & 2 deletions indexer/env-sepolia
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GAME="0x02b66531874c952844913b8cbc573878c794112b546cbf39409013e33d4777fe"
START=60000
GAME="0x06c63851635f1e0ee0695a157292892cabaa030a8eca20a32b6a86c968c47c33"
START=68300
MONGO_CONNECTION_STRING="mongodb://mongo:mongo@mongo:27017"
MONGO_DB="mongo"
STREAM_URL='https://sepolia.starknet.a5a.ch'
2 changes: 1 addition & 1 deletion indexer/graphql/Dockerfile.sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ RUN python3 -m pip install pycryptodome
RUN poetry config virtualenvs.create false
RUN poetry install

ENTRYPOINT [ "indexer", "graphql", "--mongo", "mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@54.74.126.103:27017", "--port", "8080" ]
ENTRYPOINT [ "indexer", "graphql", "--mongo", "mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@54.157.59.41:27017", "--port", "8080" ]
4 changes: 4 additions & 0 deletions indexer/graphql/src/indexer/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ class OrderByInput:
@strawberry.input
class AdventurersFilter:
id: Optional[FeltValueFilter] = None
entropy: Optional[HexValueFilter] = None
lastAction: Optional[FeltValueFilter] = None
owner: Optional[HexValueFilter] = None
name: Optional[StringFilter] = None
Expand Down Expand Up @@ -778,6 +779,7 @@ class ItemsFilter:
@strawberry.input
class AdventurersOrderByInput:
id: Optional[OrderByInput] = None
entropy: Optional[OrderByInput] = None
lastAction: Optional[OrderByInput] = None
owner: Optional[OrderByInput] = None
name: Optional[OrderByInput] = None
Expand Down Expand Up @@ -905,6 +907,7 @@ class ItemsOrderByInput:
@strawberry.type
class Adventurer:
id: Optional[FeltValue]
entropy: Optional[HexValue]
lastAction: Optional[FeltValue]
owner: Optional[HexValue]
name: Optional[StringValue]
Expand Down Expand Up @@ -939,6 +942,7 @@ class Adventurer:
def from_mongo(cls, data):
return cls(
id=data["id"],
entropy=data["entropy"],
lastAction=data["lastAction"],
owner=data["owner"],
name=data["name"],
Expand Down
12 changes: 6 additions & 6 deletions indexer/sepolia-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:


adventurers_indexer:
image: quay.io/apibara/sink-mongo:0.4.2
image: quay.io/apibara/sink-mongo:0.8.0
depends_on:
- etcd
- mongo
Expand All @@ -45,7 +45,7 @@ services:
- indexer

battles_indexer:
image: quay.io/apibara/sink-mongo:0.4.2
image: quay.io/apibara/sink-mongo:0.8.0
depends_on:
- etcd
- mongo
Expand All @@ -64,7 +64,7 @@ services:
- indexer

beasts_indexer:
image: quay.io/apibara/sink-mongo:0.4.2
image: quay.io/apibara/sink-mongo:0.8.0
depends_on:
- etcd
- mongo
Expand All @@ -83,7 +83,7 @@ services:
- indexer

discoveries_indexer:
image: quay.io/apibara/sink-mongo:0.4.2
image: quay.io/apibara/sink-mongo:0.8.0
depends_on:
- etcd
- mongo
Expand All @@ -102,7 +102,7 @@ services:
- indexer

items_indexer:
image: quay.io/apibara/sink-mongo:0.4.2
image: quay.io/apibara/sink-mongo:0.8.0
depends_on:
- etcd
- mongo
Expand All @@ -121,7 +121,7 @@ services:
- indexer

scores_indexer:
image: quay.io/apibara/sink-mongo:0.4.2
image: quay.io/apibara/sink-mongo:0.8.0
depends_on:
- etcd
- mongo
Expand Down
1 change: 1 addition & 0 deletions indexer/src/adventurers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default function transform({ header, events }: Block) {
insertAdventurer({
id: as.adventurerId,
owner: as.owner,
entropy: as.adventurerEntropy,
lastAction: as.adventurer.lastActionBlock,
health: as.adventurer.health,
xp: as.adventurer.xp,
Expand Down
3 changes: 2 additions & 1 deletion indexer/src/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export const parseAdventurer = combineParsers({
export const parseAdventurerState = combineParsers({
owner: { index: 0, parser: parseFelt252 },
adventurerId: { index: 1, parser: parseFelt252 },
adventurer: { index: 2, parser: parseAdventurer },
adventurerEntropy: { index: 2, parser: parseFelt252 },
adventurer: { index: 3, parser: parseAdventurer },
});

export const parseSpecialPowers = combineParsers({
Expand Down
3 changes: 3 additions & 0 deletions indexer/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { encodeIntAsBytes, checkExistsInt } from "./encode.ts";
export function insertAdventurer({
id,
owner,
entropy,
lastAction,
health,
xp,
Expand Down Expand Up @@ -42,6 +43,7 @@ export function insertAdventurer({
update: {
$set: {
...entity,
entropy: encodeIntAsBytes(BigInt(entropy)),
lastAction: encodeIntAsBytes(BigInt(lastAction)),
health: encodeIntAsBytes(BigInt(health)),
xp: encodeIntAsBytes(BigInt(xp)),
Expand Down Expand Up @@ -171,6 +173,7 @@ export function updateAdventurer({
update: {
$set: {
...entity,
entropy: encodeIntAsBytes(BigInt(adventurerState.adventurerEntropy)),
lastAction: encodeIntAsBytes(BigInt(adventurer.lastActionBlock)),
health: encodeIntAsBytes(BigInt(adventurer.health)),
xp: encodeIntAsBytes(BigInt(adventurer.xp)),
Expand Down
Loading

0 comments on commit d563c5e

Please sign in to comment.