1
0

PBC: Shards are WIP
Some checks failed
Build container / Package-Python (push) Failing after 26s
Build container / Package-Container (push) Successful in 1m20s

This commit is contained in:
Jon Michael Aanes 2024-04-23 18:04:12 +02:00
parent e612d7a10d
commit 4b640b7134
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -25,6 +25,9 @@ HOSTNAME = 'reader.partisiablockchain.com'
URL_ACCOUNT_PLUGIN = 'https://{hostname}/{shard}blockchain/accountPlugin/local' URL_ACCOUNT_PLUGIN = 'https://{hostname}/{shard}blockchain/accountPlugin/local'
URL_ACCOUNT_PLUGIN_GLOBAL = 'https://{hostname}/{shard}blockchain/accountPlugin/global' 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) @dataclasses.dataclass(frozen=True)
class MpcBalance(Scraper): class MpcBalance(Scraper):
dataset_name = 'defi_mpc_balance' dataset_name = 'defi_mpc_balance'
@ -52,7 +55,6 @@ class MpcBalance(Scraper):
url = URL_ACCOUNT_PLUGIN_GLOBAL.format( url = URL_ACCOUNT_PLUGIN_GLOBAL.format(
hostname = HOSTNAME, hostname = HOSTNAME,
shard = '', shard = '',
#shard = 'shards/Shard0/',
) )
json_data, date = self.get_json(url, data=data) json_data, date = self.get_json(url, data=data)
@ -69,7 +71,7 @@ class MpcBalance(Scraper):
url = URL_ACCOUNT_PLUGIN.format( url = URL_ACCOUNT_PLUGIN.format(
hostname = HOSTNAME, 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}]} data: dict = {'path':[{'type':'field','name':'accounts'},{'type':'avl','keyType':'BLOCKCHAIN_ADDRESS','key':address}]}