Skip to content

Commit 6018172

Browse files
authored
Merge pull request #166 from PotLock/testnet
Testnet
2 parents 48a0bc2 + 72c24be commit 6018172

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

indexer_app/tasks.py

+7-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from django.conf import settings
1313
from django.db.models import Count, DecimalField, Q, Sum, Value
1414
from django.db.models.functions import Cast, NullIf
15-
from near_lake_framework import LakeConfig, streamer
15+
from near_lake_framework import LakeConfig, streamer, Network
1616
import stellar_sdk
1717
from stellar_sdk.soroban_server import EventFilter, EventFilterType
1818
from stellar_sdk import Address, stellar_xdr, scval
@@ -36,22 +36,16 @@ async def indexer(from_block: int, to_block: int):
3636
"""
3737
# Initialize lake indexer
3838
logger.info(f"from block: {from_block}")
39-
lake_config = (
40-
LakeConfig.testnet()
39+
40+
lake_config = LakeConfig(
41+
Network.TESTNET
4142
if settings.ENVIRONMENT == "testnet"
42-
else LakeConfig.mainnet()
43-
)
44-
lake_config.start_block_height = (
43+
else Network.MAINNET,
44+
settings.AWS_ACCESS_KEY_ID,
45+
settings.AWS_SECRET_ACCESS_KEY,
4546
from_block
46-
if from_block
47-
else logger.info(
48-
"Starting to index from latest block"
49-
) # TODO: wtf is this shitty code
5047
)
51-
lake_config.aws_access_key_id = settings.AWS_ACCESS_KEY_ID
52-
lake_config.aws_secret_key = settings.AWS_SECRET_ACCESS_KEY
5348
_, streamer_messages_queue = streamer(lake_config)
54-
block_count = 0
5549

5650
while True:
5751
try:
@@ -63,8 +57,6 @@ async def indexer(from_block: int, to_block: int):
6357
logger.info(
6458
f"Time to fetch new block: {fetch_end_time - fetch_start_time:.4f} seconds"
6559
)
66-
block_count += 1
67-
6860
# Log time before caching block height
6961
save_start_time = time.time()
7062
# Update current block height

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readme = "README.md"
99
python = "^3.11"
1010
django = "^5.0.4"
1111
psycopg2-binary = "^2.9.9"
12-
near-lake-framework = "^0.0.7"
12+
near-lake-framework = "^0.1.3"
1313
celery = "^5.3.6"
1414
redis = { extras = ["hiredis"], version = "^5.0.3" }
1515
requests = "^2.31.0"

0 commit comments

Comments
 (0)