iwa 0.0.16__py3-none-any.whl → 0.0.17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,8 @@ requests relative to the time elapsed since the last checkpoint.
10
10
 
11
11
  from typing import Tuple
12
12
 
13
+ from web3 import Web3
14
+
13
15
  from iwa.core.constants import DEFAULT_MECH_CONTRACT_ADDRESS
14
16
  from iwa.core.types import EthereumAddress
15
17
  from iwa.plugins.olas.contracts.base import OLAS_ABI_PATH, ContractInstance
@@ -68,6 +70,9 @@ class ActivityCheckerContract(ContractInstance):
68
70
  def get_multisig_nonces(self, multisig: EthereumAddress) -> Tuple[int, int]:
69
71
  """Get the nonces for a multisig address.
70
72
 
73
+ This method reads directly from the source contracts to ensure fresh data
74
+ and compatibility with Legacy/MM contracts.
75
+
71
76
  Args:
72
77
  multisig: The multisig address to check.
73
78
 
@@ -77,8 +82,52 @@ class ActivityCheckerContract(ContractInstance):
77
82
  - mech_requests_count: Total mech requests made
78
83
 
79
84
  """
80
- nonces = self.contract.functions.getMultisigNonces(multisig).call()
81
- return (nonces[0], nonces[1])
85
+ # 1. Get Safe Nonce
86
+ safe_nonce = 0
87
+ try:
88
+ # Minimal ABI for Safe nonce
89
+ safe_abi = [{"name": "nonce", "type": "function", "inputs": [], "outputs": [{"type": "uint256"}]}]
90
+ safe_contract = self.chain_interface.web3._web3.eth.contract(
91
+ address=Web3.to_checksum_address(multisig), abi=safe_abi
92
+ )
93
+ safe_nonce = safe_contract.functions.nonce().call()
94
+ except Exception as e:
95
+ # Fallback or log error? If safe read fails, something is very wrong.
96
+ # But we don't want to crash the whole status check if possible.
97
+ # For now, let's log and keep 0 or re-raise if critical.
98
+ # safe_nonce is critical for liveness check (diffNonces).
99
+ from loguru import logger
100
+ logger.warning(f"Failed to read Safe nonce for {multisig}: {e}")
101
+
102
+ # 2. Get Mech Requests Count
103
+ mech_requests = 0
104
+
105
+ if self.mech_marketplace:
106
+ # Case A: Marketplace (MM)
107
+ try:
108
+ # Minimal ABI for Marketplace mapRequestCounts
109
+ mp_abi = [{"name": "mapRequestCounts", "type": "function", "inputs": [{"type": "address"}], "outputs": [{"type": "uint256"}]}]
110
+ mp_contract = self.chain_interface.web3._web3.eth.contract(
111
+ address=Web3.to_checksum_address(self.mech_marketplace), abi=mp_abi
112
+ )
113
+ mech_requests = mp_contract.functions.mapRequestCounts(multisig).call()
114
+ except Exception as e:
115
+ from loguru import logger
116
+ logger.warning(f"Failed to read Marketplace requests for {multisig}: {e}")
117
+ else:
118
+ # Case B: Legacy (AgentMech)
119
+ try:
120
+ # Minimal ABI for AgentMech getRequestsCount
121
+ mech_abi = [{"name": "getRequestsCount", "type": "function", "inputs": [{"type": "address"}], "outputs": [{"type": "uint256"}]}]
122
+ mech_contract = self.chain_interface.web3._web3.eth.contract(
123
+ address=Web3.to_checksum_address(self.agent_mech), abi=mech_abi
124
+ )
125
+ mech_requests = mech_contract.functions.getRequestsCount(multisig).call()
126
+ except Exception as e:
127
+ from loguru import logger
128
+ logger.warning(f"Failed to read AgentMech requests for {multisig}: {e}")
129
+
130
+ return (safe_nonce, mech_requests)
82
131
 
83
132
  def is_ratio_pass(
84
133
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iwa
3
- Version: 0.0.16
3
+ Version: 0.0.17
4
4
  Summary: A secure, modular, and plugin-based framework for crypto agents and ops
5
5
  Requires-Python: <4.0,>=3.12
6
6
  Description-Content-Type: text/markdown
@@ -61,7 +61,7 @@ iwa/plugins/olas/importer.py,sha256=f8KlZ9dGcNbpg8uoTYbO9sDvbluZoslhpWFLqPjPnLA,
61
61
  iwa/plugins/olas/mech_reference.py,sha256=CaSCpQnQL4F7wOG6Ox6Zdoy-uNEQ78YBwVLILQZKL8Q,5782
62
62
  iwa/plugins/olas/models.py,sha256=xC5hYakX53pBT6zZteM9cyiC7t6XRLLpobjQmDYueOo,3520
63
63
  iwa/plugins/olas/plugin.py,sha256=S_vnvZ02VdVWD7N5kp7u5JIRQ2JLtfwGDZ7OHkAN0M8,9390
64
- iwa/plugins/olas/contracts/activity_checker.py,sha256=PTLvsFdi3PdsFMxRVcXfwlQMRyJYHIzrHf3OaPVtFqU,3943
64
+ iwa/plugins/olas/contracts/activity_checker.py,sha256=sQSzBWF7meXzCzVw4G0wowjTTRddraGPppQ8PyLcuaU,6429
65
65
  iwa/plugins/olas/contracts/base.py,sha256=y73aQbDq6l4zUpz_eQAg4MsLkTAEqjjupXlcvxjfgCI,240
66
66
  iwa/plugins/olas/contracts/mech.py,sha256=dXYtyORc-oiu9ga5PtTquOFkoakb6BLGKvlUsteygIg,2767
67
67
  iwa/plugins/olas/contracts/mech_marketplace.py,sha256=hMADl5MQGvT2wLRKu4vHGe4RrAZVq8Y2M_EvXWWz528,1554
@@ -150,7 +150,7 @@ iwa/web/tests/test_web_endpoints.py,sha256=C264MH-CTyDW4GLUrTXBgLJKUk4-89pFAScBd
150
150
  iwa/web/tests/test_web_olas.py,sha256=0CVSsrncOeJ3x0ECV7mVLQV_CXZRrOqGiVjgLIi6hZ8,16308
151
151
  iwa/web/tests/test_web_swap.py,sha256=7A4gBJFL01kIXPtW1E1J17SCsVc_0DmUn-R8kKrnnVA,2974
152
152
  iwa/web/tests/test_web_swap_coverage.py,sha256=zGNrzlhZ_vWDCvWmLcoUwFgqxnrp_ACbo49AtWBS_Kw,5584
153
- iwa-0.0.16.dist-info/licenses/LICENSE,sha256=eIubm_IlBHPYRQlLNZKbBNKhJUUP3JH0A2miZUhAVfI,1078
153
+ iwa-0.0.17.dist-info/licenses/LICENSE,sha256=eIubm_IlBHPYRQlLNZKbBNKhJUUP3JH0A2miZUhAVfI,1078
154
154
  tests/legacy_cow.py,sha256=oOkZvIxL70ReEoD9oHQbOD5GpjIr6AGNHcOCgfPlerU,8389
155
155
  tests/legacy_safe.py,sha256=AssM2g13E74dNGODu_H0Q0y412lgqsrYnEzI97nm_Ts,2972
156
156
  tests/legacy_transaction_retry_logic.py,sha256=D9RqZ7DBu61Xr2djBAodU2p9UE939LL-DnQXswX5iQk,1497
@@ -202,8 +202,8 @@ tests/test_utils.py,sha256=vkP49rYNI8BRzLpWR3WnKdDr8upeZjZcs7Rx0pjbQMo,1292
202
202
  tests/test_workers.py,sha256=MInwdkFY5LdmFB3o1odIaSD7AQZb3263hNafO1De5PE,2793
203
203
  tools/create_and_stake_service.py,sha256=1xwy_bJQI1j9yIQ968Oc9Db_F6mk1659LuuZntTASDE,3742
204
204
  tools/verify_drain.py,sha256=PkMjblyOOAuQge88FwfEzRtCYeEtJxXhPBmtQYCoQ-8,6743
205
- iwa-0.0.16.dist-info/METADATA,sha256=4uDBeClkmX50DO4TFAPhy0DpCiiLp4zwDFsrIzV6SwA,7295
206
- iwa-0.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
207
- iwa-0.0.16.dist-info/entry_points.txt,sha256=nwB6kscrfA7M00pYmL2j-sBH6eF6h2ga9IK1BZxdiyQ,241
208
- iwa-0.0.16.dist-info/top_level.txt,sha256=kedS9cRUbm4JE2wYeabIXilhHjN8KCw0IGbqqqsw0Bs,16
209
- iwa-0.0.16.dist-info/RECORD,,
205
+ iwa-0.0.17.dist-info/METADATA,sha256=vzZKb09UmfMfeWTcLbJnUCxWHIr-DGWNvSvUM5k9RcQ,7295
206
+ iwa-0.0.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
207
+ iwa-0.0.17.dist-info/entry_points.txt,sha256=nwB6kscrfA7M00pYmL2j-sBH6eF6h2ga9IK1BZxdiyQ,241
208
+ iwa-0.0.17.dist-info/top_level.txt,sha256=kedS9cRUbm4JE2wYeabIXilhHjN8KCw0IGbqqqsw0Bs,16
209
+ iwa-0.0.17.dist-info/RECORD,,
File without changes