Exemple #1
0
 def get_account_data(
         self, address: Address,
         block_height: Optional[int]) -> List[AccountBranchData]:
     results = []
     for branch, shard in self.shards.items():
         results.append(
             AccountBranchData(
                 branch=branch,
                 transaction_count=shard.state.get_transaction_count(
                     address.recipient, block_height),
                 balance=shard.state.get_balance(address.recipient,
                                                 block_height),
                 is_contract=len(
                     shard.state.get_code(address.recipient, block_height))
                 > 0,
             ))
     return results
Exemple #2
0
 def get_account_data(
         self, address: Address,
         block_height: Optional[int]) -> List[AccountBranchData]:
     results = []
     for branch, shard in self.shards.items():
         balance_list = []
         token_balances = shard.state.get_balances(address.recipient,
                                                   block_height)
         for k in sorted(
                 token_balances
         ):  # keep token balance sorted to maintain deterministic serialization
             kv = TokenBalancePair(k, token_balances[k])
             balance_list.append(kv)
         results.append(
             AccountBranchData(
                 branch=branch,
                 transaction_count=shard.state.get_transaction_count(
                     address.recipient, block_height),
                 token_balances=balance_list,
                 is_contract=len(
                     shard.state.get_code(address.recipient, block_height))
                 > 0,
             ))
     return results