defi-state-querier 0.4.27__py3-none-any.whl → 0.4.29__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
defi_services/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.27"
1
+ __version__ = "0.4.29"
@@ -3,6 +3,7 @@ import logging
3
3
  from web3 import Web3
4
4
 
5
5
  from defi_services.constants.entities.lending_services import LendingServices
6
+ from defi_services.constants.query_constant import Query
6
7
  from defi_services.jobs.queriers.state_querier import StateQuerier
7
8
  from defi_services.services.nft_services import NFTServices
8
9
  from defi_services.services.protocol_services import ProtocolServices
@@ -44,6 +45,15 @@ class MultiStateProcessor:
44
45
  if entity_id in self.services:
45
46
  entity_service: ProtocolServices = self.services.get(entity_id)
46
47
  rpc_calls.update(entity_service.get_function_info([query_type], wallet, block_number, **kwargs))
48
+
49
+ if query_type == Query.token_balance:
50
+ entity_service: TokenServices = self.token_service
51
+ rpc_calls.update(entity_service.get_function_info(wallet, entity_id, block_number))
52
+
53
+ if query_type == Query.nft_balance:
54
+ entity_service: NFTServices = self.nft_service
55
+ rpc_calls.update(entity_service.get_function_info(wallet, entity_id, block_number))
56
+
47
57
  queries[entity_id] = rpc_calls
48
58
 
49
59
  return {query_id: queries}
@@ -77,7 +87,17 @@ class MultiStateProcessor:
77
87
  query_value = decoded_data.get(query_id)
78
88
  for entity, entity_value in query_value.items():
79
89
  result["entity_id"] = entity
80
- if entity in self.lending_services:
90
+ if query_type == Query.token_balance:
91
+ entity_service: TokenServices = self.token_service
92
+ data = entity_service.get_data(
93
+ wallet, entity, entity_value, block_number, **kwargs
94
+ )
95
+ elif query_type == Query.nft_balance:
96
+ entity_service: NFTServices = self.nft_service
97
+ data = entity_service.get_data(
98
+ wallet, entity, entity_value, block_number, **kwargs
99
+ )
100
+ elif entity in self.lending_services:
81
101
  entity_service: ProtocolServices = self.services.get(entity)
82
102
  data = entity_service.get_data(
83
103
  [query_type], wallet, entity_value, block_number, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: defi-state-querier
3
- Version: 0.4.27
3
+ Version: 0.4.29
4
4
  Summary: Calculate apy, apr, and wallet information,... in decentralized applications.
5
5
  Home-page: https://github.com/Centic-io/defi-state-querier
6
6
  Author: Viet-Bang Pham
@@ -12,9 +12,9 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.6
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: web3 <=6.0.0
16
- Requires-Dist: QueryStateLib ==1.1.4
17
- Requires-Dist: python-dotenv >=0.18.0
15
+ Requires-Dist: web3 >=6.0.0
16
+ Requires-Dist: query-blockchain-state-lib ==1.0.1
17
+ Requires-Dist: python-dotenv >=1.0.0
18
18
  Requires-Dist: pymongo >=4.3.3
19
19
 
20
20
  # defi-state-querier
@@ -1,4 +1,4 @@
1
- defi_services/__init__.py,sha256=M6cnWFk1Yz0fBKyJSOiFIvowDDGt2oz9dCYCtlYnCj4,23
1
+ defi_services/__init__.py,sha256=LtSKwkqgueDQK6uLnhs8HgKylJHH36EMo48UDeHgv2Y,23
2
2
  defi_services/abis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  defi_services/abis/dex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  defi_services/abis/dex/biswap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -311,7 +311,7 @@ defi_services/constants/entities/vault_services.py,sha256=IMmQc15wS1KA7EuQqM_Ara
311
311
  defi_services/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
312
312
  defi_services/jobs/processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
313
313
  defi_services/jobs/processors/cosmos_state_processor.py,sha256=2S5fhqHQ4pUtRaLnbFJNUo4jKc5MHq7HA-0FHebOJyo,1334
314
- defi_services/jobs/processors/multi_state_processor.py,sha256=uMv1kVkkBV_GkYnMVaE8UgAhdnu7J_FzU6-fAoXCqjo,4752
314
+ defi_services/jobs/processors/multi_state_processor.py,sha256=W-5qLwIFj4kfx0V2Tj7eg0mjrRb3jyPdxEBB2TBxbW4,5726
315
315
  defi_services/jobs/processors/solana_state_processor.py,sha256=szsBYrkEV8kBzuA_iaSVescnwKJ2MHoTbut5kORbWTs,4065
316
316
  defi_services/jobs/processors/state_processor.py,sha256=Ze_5isU_l_APB262E-VV_4KZwEG6W0XE6PikJZIcAoM,7291
317
317
  defi_services/jobs/processors/substrate_state_processor.py,sha256=KkiY1NkaxnizNJBTfn4twB-zuQo3fT3akOlbie8VF5g,3940
@@ -452,8 +452,8 @@ defi_services/utils/market_service.py,sha256=imPtPHBkpEx5JnhqeIWYqbCjsIEm8IKBYHN
452
452
  defi_services/utils/memory_storage.py,sha256=BOT8laB0iVSCGE-oDlpWJQLbSC6X2blKX4zuQbs4inc,851
453
453
  defi_services/utils/sqrt_price_math.py,sha256=9lgUeWFT4wjl3Vq3b7-jZ2bGvvZx7dDBSfVnM3lsZ8o,5575
454
454
  defi_services/utils/thread_proxy.py,sha256=5Z8biAyEReUkh3vfJSvEv7GwMe3CsE5M8CbghkQtePw,2951
455
- defi_state_querier-0.4.27.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
456
- defi_state_querier-0.4.27.dist-info/METADATA,sha256=6n6M3JXL3mm3__4hYv1Woz2XBLpMdkBMNs2rMBre2ig,4376
457
- defi_state_querier-0.4.27.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
458
- defi_state_querier-0.4.27.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
459
- defi_state_querier-0.4.27.dist-info/RECORD,,
455
+ defi_state_querier-0.4.29.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
456
+ defi_state_querier-0.4.29.dist-info/METADATA,sha256=g77_aICw-H-02oRz1njjw6NjNphiU_-p-IpgK8C9tdA,4388
457
+ defi_state_querier-0.4.29.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
458
+ defi_state_querier-0.4.29.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
459
+ defi_state_querier-0.4.29.dist-info/RECORD,,