From 4b640b71344c7f96c56a43c9fb486da4eda30447 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 23 Apr 2024 18:04:12 +0200 Subject: [PATCH] PBC: Shards are WIP --- personal_data/fetchers/partisia_blockchain.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/personal_data/fetchers/partisia_blockchain.py b/personal_data/fetchers/partisia_blockchain.py index a165cf3..10527d5 100644 --- a/personal_data/fetchers/partisia_blockchain.py +++ b/personal_data/fetchers/partisia_blockchain.py @@ -25,6 +25,9 @@ HOSTNAME = 'reader.partisiablockchain.com' URL_ACCOUNT_PLUGIN = 'https://{hostname}/{shard}blockchain/accountPlugin/local' URL_ACCOUNT_PLUGIN_GLOBAL = 'https://{hostname}/{shard}blockchain/accountPlugin/global' +def shard_id_for_address(address: str) -> str: + return 'shards/Shard2/' # TODO + @dataclasses.dataclass(frozen=True) class MpcBalance(Scraper): dataset_name = 'defi_mpc_balance' @@ -52,7 +55,6 @@ class MpcBalance(Scraper): url = URL_ACCOUNT_PLUGIN_GLOBAL.format( hostname = HOSTNAME, shard = '', - #shard = 'shards/Shard0/', ) json_data, date = self.get_json(url, data=data) @@ -69,7 +71,7 @@ class MpcBalance(Scraper): url = URL_ACCOUNT_PLUGIN.format( hostname = HOSTNAME, - shard = 'shards/Shard0/', + shard = shard_id_for_address(address), ) data: dict = {'path':[{'type':'field','name':'accounts'},{'type':'avl','keyType':'BLOCKCHAIN_ADDRESS','key':address}]}