55from typing import Dict
66
77import requests
8+ import stellar_sdk
89from asgiref .sync import sync_to_async
910from django .conf import settings
1011from django .core .cache import cache
1112from django .db import transaction
1213from django .utils import timezone
1314from near_lake_framework .near_primitives import ExecutionOutcome , Receipt
14- import stellar_sdk
1515
1616from accounts .models import Account
1717from activities .models import Activity
@@ -1462,7 +1462,7 @@ def update_approved_projects(
14621462
14631463
14641464def update_application (event_data , txhash , reviewer_id = None , chain_id = "stellar" ):
1465- if type (event_data ) == list :
1465+ if isinstance (event_data , list ) :
14661466 round_id , application_data , reviewer_id = (
14671467 event_data [0 ],
14681468 event_data [1 ],
@@ -1540,8 +1540,8 @@ def get_pair_projects(pair_id: int, round_id: int, chain_id: str) -> Dict:
15401540 if chain_id == "stellar" :
15411541 server = stellar_sdk .SorobanServer (
15421542 "https://soroban-testnet.stellar.org"
1543- if settings .ENVIRONMENT == "testnet" or settings . ENVIRONMENT == "local"
1544- else "https://horizon.stellar.org "
1543+ if settings .ENVIRONMENT == "testnet"
1544+ else "https://rpc.lightsail.network "
15451545 )
15461546
15471547 contract_id = settings .STELLAR_CONTRACT_ID
@@ -1550,7 +1550,8 @@ def get_pair_projects(pair_id: int, round_id: int, chain_id: str) -> Dict:
15501550 stellar_sdk .scval .to_uint128 (round_id ),
15511551 stellar_sdk .scval .to_uint32 (pair_id ),
15521552 ]
1553- public_key = "GAA3KC7HAHPZ2OGSAV5WBOFCJ3NSSPHKCYZAEI36DQJP2EB2FCGKSEFB" # TODO: move to settings
1553+ # TODO: move to settings
1554+ public_key = "GAA3KC7HAHPZ2OGSAV5WBOFCJ3NSSPHKCYZAEI36DQJP2EB2FCGKSEFB"
15541555 acct = server .load_account (public_key )
15551556
15561557 pair_result = server .simulate_transaction (
@@ -1581,7 +1582,7 @@ def process_vote_event(event_data, tx_hash, chain_id="stellar"):
15811582 try :
15821583 logger .info (f"process_vote_event: { event_data } , { tx_hash } , { chain_id } " )
15831584 with transaction .atomic ():
1584- if type (event_data ) == list :
1585+ if isinstance (event_data , list ) :
15851586 round_id , vote_data = event_data [0 ], event_data [1 ]
15861587 else :
15871588 # vote_event_data = event_data['vote']
@@ -2165,7 +2166,7 @@ def handle_new_stellar_list_registration(
21652166 defaults = {
21662167 "signer_id" : data ["registered_by" ],
21672168 "receiver_id" : contract_id ,
2168- "timestamp" : data ["submitted_ms" ],
2169+ "timestamp" : datetime . fromtimestamp ( data ["submitted_ms" ] / 1000 ) ,
21692170 "tx_hash" : tx_hash ,
21702171 }
21712172
@@ -2380,12 +2381,14 @@ async def handle_update_campaign(data: dict):
23802381 logger .error (f"Failed to update campaign: { e } " )
23812382
23822383
2383- async def handle_delete_campaign (campaign_id : int ):
2384+ async def handle_delete_campaign (data : dict ):
23842385 """
23852386 Index a campaign deletion event.
23862387 campaign_id: on_chain_id of the campaign to delete
23872388 """
23882389
2390+ campaign_id = data ["campaign_id" ]
2391+
23892392 try :
23902393 logger .info (f"Deleting campaign: { campaign_id } " )
23912394
0 commit comments