iwa 0.0.1a3__tar.gz

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.
Files changed (198) hide show
  1. iwa-0.0.1a3/LICENSE +21 -0
  2. iwa-0.0.1a3/PKG-INFO +237 -0
  3. iwa-0.0.1a3/README.md +198 -0
  4. iwa-0.0.1a3/pyproject.toml +141 -0
  5. iwa-0.0.1a3/setup.cfg +4 -0
  6. iwa-0.0.1a3/src/conftest.py +22 -0
  7. iwa-0.0.1a3/src/iwa/__init__.py +1 -0
  8. iwa-0.0.1a3/src/iwa/__main__.py +6 -0
  9. iwa-0.0.1a3/src/iwa/core/__init__.py +1 -0
  10. iwa-0.0.1a3/src/iwa/core/chain/__init__.py +68 -0
  11. iwa-0.0.1a3/src/iwa/core/chain/errors.py +47 -0
  12. iwa-0.0.1a3/src/iwa/core/chain/interface.py +504 -0
  13. iwa-0.0.1a3/src/iwa/core/chain/manager.py +38 -0
  14. iwa-0.0.1a3/src/iwa/core/chain/models.py +128 -0
  15. iwa-0.0.1a3/src/iwa/core/chain/rate_limiter.py +204 -0
  16. iwa-0.0.1a3/src/iwa/core/cli.py +235 -0
  17. iwa-0.0.1a3/src/iwa/core/constants.py +29 -0
  18. iwa-0.0.1a3/src/iwa/core/contracts/__init__.py +1 -0
  19. iwa-0.0.1a3/src/iwa/core/contracts/contract.py +309 -0
  20. iwa-0.0.1a3/src/iwa/core/contracts/erc20.py +79 -0
  21. iwa-0.0.1a3/src/iwa/core/contracts/multisend.py +71 -0
  22. iwa-0.0.1a3/src/iwa/core/db.py +317 -0
  23. iwa-0.0.1a3/src/iwa/core/ipfs.py +149 -0
  24. iwa-0.0.1a3/src/iwa/core/keys.py +591 -0
  25. iwa-0.0.1a3/src/iwa/core/mnemonic.py +375 -0
  26. iwa-0.0.1a3/src/iwa/core/models.py +366 -0
  27. iwa-0.0.1a3/src/iwa/core/monitor.py +209 -0
  28. iwa-0.0.1a3/src/iwa/core/plugins.py +45 -0
  29. iwa-0.0.1a3/src/iwa/core/pricing.py +91 -0
  30. iwa-0.0.1a3/src/iwa/core/secrets.py +77 -0
  31. iwa-0.0.1a3/src/iwa/core/services/__init__.py +17 -0
  32. iwa-0.0.1a3/src/iwa/core/services/account.py +57 -0
  33. iwa-0.0.1a3/src/iwa/core/services/balance.py +113 -0
  34. iwa-0.0.1a3/src/iwa/core/services/plugin.py +88 -0
  35. iwa-0.0.1a3/src/iwa/core/services/safe.py +392 -0
  36. iwa-0.0.1a3/src/iwa/core/services/transaction.py +172 -0
  37. iwa-0.0.1a3/src/iwa/core/services/transfer/__init__.py +166 -0
  38. iwa-0.0.1a3/src/iwa/core/services/transfer/base.py +260 -0
  39. iwa-0.0.1a3/src/iwa/core/services/transfer/erc20.py +247 -0
  40. iwa-0.0.1a3/src/iwa/core/services/transfer/multisend.py +386 -0
  41. iwa-0.0.1a3/src/iwa/core/services/transfer/native.py +262 -0
  42. iwa-0.0.1a3/src/iwa/core/services/transfer/swap.py +326 -0
  43. iwa-0.0.1a3/src/iwa/core/tables.py +60 -0
  44. iwa-0.0.1a3/src/iwa/core/test.py +27 -0
  45. iwa-0.0.1a3/src/iwa/core/tests/test_wallet.py +255 -0
  46. iwa-0.0.1a3/src/iwa/core/types.py +59 -0
  47. iwa-0.0.1a3/src/iwa/core/ui.py +99 -0
  48. iwa-0.0.1a3/src/iwa/core/utils.py +64 -0
  49. iwa-0.0.1a3/src/iwa/core/wallet.py +384 -0
  50. iwa-0.0.1a3/src/iwa/plugins/__init__.py +1 -0
  51. iwa-0.0.1a3/src/iwa/plugins/gnosis/__init__.py +5 -0
  52. iwa-0.0.1a3/src/iwa/plugins/gnosis/cow/__init__.py +6 -0
  53. iwa-0.0.1a3/src/iwa/plugins/gnosis/cow/quotes.py +148 -0
  54. iwa-0.0.1a3/src/iwa/plugins/gnosis/cow/swap.py +403 -0
  55. iwa-0.0.1a3/src/iwa/plugins/gnosis/cow/types.py +20 -0
  56. iwa-0.0.1a3/src/iwa/plugins/gnosis/cow_utils.py +44 -0
  57. iwa-0.0.1a3/src/iwa/plugins/gnosis/plugin.py +68 -0
  58. iwa-0.0.1a3/src/iwa/plugins/gnosis/safe.py +157 -0
  59. iwa-0.0.1a3/src/iwa/plugins/gnosis/tests/test_cow.py +227 -0
  60. iwa-0.0.1a3/src/iwa/plugins/gnosis/tests/test_safe.py +100 -0
  61. iwa-0.0.1a3/src/iwa/plugins/olas/__init__.py +5 -0
  62. iwa-0.0.1a3/src/iwa/plugins/olas/constants.py +114 -0
  63. iwa-0.0.1a3/src/iwa/plugins/olas/contracts/activity_checker.py +93 -0
  64. iwa-0.0.1a3/src/iwa/plugins/olas/contracts/base.py +10 -0
  65. iwa-0.0.1a3/src/iwa/plugins/olas/contracts/mech.py +77 -0
  66. iwa-0.0.1a3/src/iwa/plugins/olas/contracts/mech_marketplace.py +43 -0
  67. iwa-0.0.1a3/src/iwa/plugins/olas/contracts/service.py +215 -0
  68. iwa-0.0.1a3/src/iwa/plugins/olas/contracts/staking.py +403 -0
  69. iwa-0.0.1a3/src/iwa/plugins/olas/importer.py +736 -0
  70. iwa-0.0.1a3/src/iwa/plugins/olas/mech_reference.py +135 -0
  71. iwa-0.0.1a3/src/iwa/plugins/olas/models.py +110 -0
  72. iwa-0.0.1a3/src/iwa/plugins/olas/plugin.py +243 -0
  73. iwa-0.0.1a3/src/iwa/plugins/olas/scripts/test_full_mech_flow.py +259 -0
  74. iwa-0.0.1a3/src/iwa/plugins/olas/scripts/test_simple_lifecycle.py +74 -0
  75. iwa-0.0.1a3/src/iwa/plugins/olas/service_manager/__init__.py +60 -0
  76. iwa-0.0.1a3/src/iwa/plugins/olas/service_manager/base.py +113 -0
  77. iwa-0.0.1a3/src/iwa/plugins/olas/service_manager/drain.py +336 -0
  78. iwa-0.0.1a3/src/iwa/plugins/olas/service_manager/lifecycle.py +839 -0
  79. iwa-0.0.1a3/src/iwa/plugins/olas/service_manager/mech.py +322 -0
  80. iwa-0.0.1a3/src/iwa/plugins/olas/service_manager/staking.py +530 -0
  81. iwa-0.0.1a3/src/iwa/plugins/olas/tests/conftest.py +30 -0
  82. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_importer.py +128 -0
  83. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_importer_error_handling.py +349 -0
  84. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_mech_contracts.py +85 -0
  85. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_olas_contracts.py +249 -0
  86. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_olas_integration.py +561 -0
  87. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_olas_models.py +144 -0
  88. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_olas_view.py +258 -0
  89. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_olas_view_actions.py +137 -0
  90. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_olas_view_modals.py +120 -0
  91. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_plugin.py +70 -0
  92. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_plugin_full.py +212 -0
  93. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_lifecycle.py +150 -0
  94. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_manager.py +1065 -0
  95. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_manager_errors.py +208 -0
  96. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_manager_flows.py +497 -0
  97. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_manager_mech.py +135 -0
  98. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_manager_rewards.py +360 -0
  99. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_manager_validation.py +145 -0
  100. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_service_staking.py +342 -0
  101. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_staking_integration.py +269 -0
  102. iwa-0.0.1a3/src/iwa/plugins/olas/tests/test_staking_validation.py +109 -0
  103. iwa-0.0.1a3/src/iwa/plugins/olas/tui/__init__.py +1 -0
  104. iwa-0.0.1a3/src/iwa/plugins/olas/tui/olas_view.py +952 -0
  105. iwa-0.0.1a3/src/iwa/tools/__init__.py +1 -0
  106. iwa-0.0.1a3/src/iwa/tools/check_profile.py +68 -0
  107. iwa-0.0.1a3/src/iwa/tools/list_contracts.py +136 -0
  108. iwa-0.0.1a3/src/iwa/tools/release.py +117 -0
  109. iwa-0.0.1a3/src/iwa/tools/reset_env.py +111 -0
  110. iwa-0.0.1a3/src/iwa/tools/reset_tenderly.py +364 -0
  111. iwa-0.0.1a3/src/iwa/tools/restore_backup.py +82 -0
  112. iwa-0.0.1a3/src/iwa/tools/wallet_check.py +150 -0
  113. iwa-0.0.1a3/src/iwa/tui/__init__.py +1 -0
  114. iwa-0.0.1a3/src/iwa/tui/app.py +174 -0
  115. iwa-0.0.1a3/src/iwa/tui/modals/__init__.py +5 -0
  116. iwa-0.0.1a3/src/iwa/tui/modals/base.py +406 -0
  117. iwa-0.0.1a3/src/iwa/tui/rpc.py +63 -0
  118. iwa-0.0.1a3/src/iwa/tui/screens/__init__.py +1 -0
  119. iwa-0.0.1a3/src/iwa/tui/screens/wallets.py +749 -0
  120. iwa-0.0.1a3/src/iwa/tui/tests/test_app.py +125 -0
  121. iwa-0.0.1a3/src/iwa/tui/tests/test_rpc.py +139 -0
  122. iwa-0.0.1a3/src/iwa/tui/tests/test_wallets_refactor.py +30 -0
  123. iwa-0.0.1a3/src/iwa/tui/tests/test_widgets.py +123 -0
  124. iwa-0.0.1a3/src/iwa/tui/widgets/__init__.py +5 -0
  125. iwa-0.0.1a3/src/iwa/tui/widgets/base.py +100 -0
  126. iwa-0.0.1a3/src/iwa/tui/workers.py +42 -0
  127. iwa-0.0.1a3/src/iwa/web/dependencies.py +76 -0
  128. iwa-0.0.1a3/src/iwa/web/models.py +76 -0
  129. iwa-0.0.1a3/src/iwa/web/routers/accounts.py +115 -0
  130. iwa-0.0.1a3/src/iwa/web/routers/olas/__init__.py +24 -0
  131. iwa-0.0.1a3/src/iwa/web/routers/olas/admin.py +169 -0
  132. iwa-0.0.1a3/src/iwa/web/routers/olas/funding.py +135 -0
  133. iwa-0.0.1a3/src/iwa/web/routers/olas/general.py +29 -0
  134. iwa-0.0.1a3/src/iwa/web/routers/olas/services.py +378 -0
  135. iwa-0.0.1a3/src/iwa/web/routers/olas/staking.py +341 -0
  136. iwa-0.0.1a3/src/iwa/web/routers/state.py +66 -0
  137. iwa-0.0.1a3/src/iwa/web/routers/swap.py +617 -0
  138. iwa-0.0.1a3/src/iwa/web/routers/transactions.py +153 -0
  139. iwa-0.0.1a3/src/iwa/web/server.py +155 -0
  140. iwa-0.0.1a3/src/iwa/web/tests/test_web_endpoints.py +714 -0
  141. iwa-0.0.1a3/src/iwa/web/tests/test_web_olas.py +430 -0
  142. iwa-0.0.1a3/src/iwa/web/tests/test_web_swap.py +103 -0
  143. iwa-0.0.1a3/src/iwa/web/tests/test_web_swap_coverage.py +156 -0
  144. iwa-0.0.1a3/src/iwa.egg-info/PKG-INFO +237 -0
  145. iwa-0.0.1a3/src/iwa.egg-info/SOURCES.txt +196 -0
  146. iwa-0.0.1a3/src/iwa.egg-info/dependency_links.txt +1 -0
  147. iwa-0.0.1a3/src/iwa.egg-info/entry_points.txt +6 -0
  148. iwa-0.0.1a3/src/iwa.egg-info/requires.txt +30 -0
  149. iwa-0.0.1a3/src/iwa.egg-info/top_level.txt +4 -0
  150. iwa-0.0.1a3/src/tests/legacy_cow.py +248 -0
  151. iwa-0.0.1a3/src/tests/legacy_safe.py +93 -0
  152. iwa-0.0.1a3/src/tests/legacy_transaction_retry_logic.py +51 -0
  153. iwa-0.0.1a3/src/tests/legacy_tui.py +440 -0
  154. iwa-0.0.1a3/src/tests/legacy_wallets_screen.py +554 -0
  155. iwa-0.0.1a3/src/tests/legacy_web.py +243 -0
  156. iwa-0.0.1a3/src/tests/test_account_service.py +120 -0
  157. iwa-0.0.1a3/src/tests/test_balance_service.py +186 -0
  158. iwa-0.0.1a3/src/tests/test_chain.py +490 -0
  159. iwa-0.0.1a3/src/tests/test_chain_interface.py +210 -0
  160. iwa-0.0.1a3/src/tests/test_chain_interface_coverage.py +92 -0
  161. iwa-0.0.1a3/src/tests/test_cli.py +139 -0
  162. iwa-0.0.1a3/src/tests/test_contract.py +197 -0
  163. iwa-0.0.1a3/src/tests/test_db.py +180 -0
  164. iwa-0.0.1a3/src/tests/test_drain_coverage.py +174 -0
  165. iwa-0.0.1a3/src/tests/test_erc20.py +95 -0
  166. iwa-0.0.1a3/src/tests/test_gnosis_plugin.py +111 -0
  167. iwa-0.0.1a3/src/tests/test_keys.py +492 -0
  168. iwa-0.0.1a3/src/tests/test_legacy_wallet.py +1285 -0
  169. iwa-0.0.1a3/src/tests/test_main.py +13 -0
  170. iwa-0.0.1a3/src/tests/test_migration.py +52 -0
  171. iwa-0.0.1a3/src/tests/test_mnemonic.py +217 -0
  172. iwa-0.0.1a3/src/tests/test_modals.py +109 -0
  173. iwa-0.0.1a3/src/tests/test_models.py +213 -0
  174. iwa-0.0.1a3/src/tests/test_monitor.py +202 -0
  175. iwa-0.0.1a3/src/tests/test_multisend.py +84 -0
  176. iwa-0.0.1a3/src/tests/test_plugin_service.py +119 -0
  177. iwa-0.0.1a3/src/tests/test_pricing.py +143 -0
  178. iwa-0.0.1a3/src/tests/test_rate_limiter.py +199 -0
  179. iwa-0.0.1a3/src/tests/test_reset_tenderly.py +202 -0
  180. iwa-0.0.1a3/src/tests/test_rpc_view.py +73 -0
  181. iwa-0.0.1a3/src/tests/test_safe_coverage.py +139 -0
  182. iwa-0.0.1a3/src/tests/test_safe_service.py +168 -0
  183. iwa-0.0.1a3/src/tests/test_service_manager_integration.py +61 -0
  184. iwa-0.0.1a3/src/tests/test_service_manager_structure.py +31 -0
  185. iwa-0.0.1a3/src/tests/test_service_transaction.py +176 -0
  186. iwa-0.0.1a3/src/tests/test_staking_router.py +83 -0
  187. iwa-0.0.1a3/src/tests/test_staking_simple.py +31 -0
  188. iwa-0.0.1a3/src/tests/test_tables.py +76 -0
  189. iwa-0.0.1a3/src/tests/test_transaction_service.py +161 -0
  190. iwa-0.0.1a3/src/tests/test_transfer_multisend.py +179 -0
  191. iwa-0.0.1a3/src/tests/test_transfer_native.py +220 -0
  192. iwa-0.0.1a3/src/tests/test_transfer_security.py +93 -0
  193. iwa-0.0.1a3/src/tests/test_transfer_structure.py +37 -0
  194. iwa-0.0.1a3/src/tests/test_transfer_swap_unit.py +155 -0
  195. iwa-0.0.1a3/src/tests/test_ui_coverage.py +66 -0
  196. iwa-0.0.1a3/src/tests/test_utils.py +53 -0
  197. iwa-0.0.1a3/src/tests/test_workers.py +91 -0
  198. iwa-0.0.1a3/src/tools/verify_drain.py +183 -0
iwa-0.0.1a3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Iwa Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
iwa-0.0.1a3/PKG-INFO ADDED
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: iwa
3
+ Version: 0.0.1a3
4
+ Summary: A secure, modular, and plugin-based framework for crypto agents and ops
5
+ Requires-Python: <4.0,>=3.12
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: bip-utils>=2.9.3
9
+ Requires-Dist: cryptography>=46.0.2
10
+ Requires-Dist: eth-account>=0.13.7
11
+ Requires-Dist: loguru>=0.7.3
12
+ Requires-Dist: pydantic>=2.12.0
13
+ Requires-Dist: pydantic-settings>=2.11.0
14
+ Requires-Dist: rich>=14.2.0
15
+ Requires-Dist: tomli>=2.3.0
16
+ Requires-Dist: tomli-w>=1.2.0
17
+ Requires-Dist: typer>=0.19.2
18
+ Requires-Dist: web3>=7.13.0
19
+ Requires-Dist: pyyaml<7.0.0,>=6.0.3
20
+ Requires-Dist: safe-eth-py>=7.14.0
21
+ Requires-Dist: twine>=6.2.0
22
+ Requires-Dist: cowdao-cowpy>=1.0.1
23
+ Requires-Dist: pytest>=9.0.1
24
+ Requires-Dist: textual>=0.47.1
25
+ Requires-Dist: pyperclip>=1.8.2
26
+ Requires-Dist: peewee>=3.17.0
27
+ Requires-Dist: fastapi>=0.115.0
28
+ Requires-Dist: uvicorn>=0.32.0
29
+ Requires-Dist: jinja2>=3.1.4
30
+ Requires-Dist: cbor2==5.8.0
31
+ Requires-Dist: slowapi>=0.1.9
32
+ Requires-Dist: nest-asyncio>=1.6.0
33
+ Requires-Dist: aiohttp>=3.13.3
34
+ Requires-Dist: pynacl>=1.6.2
35
+ Requires-Dist: urllib3>=2.6.3
36
+ Requires-Dist: multiformats>=0.3.1
37
+ Requires-Dist: requests>=2.32.0
38
+ Dynamic: license-file
39
+
40
+ # Iwa
41
+
42
+ [![PyPI version](https://badge.fury.io/py/iwa.svg)](https://badge.fury.io/py/iwa)
43
+ [![Docker Pulls](https://img.shields.io/docker/pulls/dvilela/iwa.svg)](https://hub.docker.com/r/dvilela/iwa)
44
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
45
+ [![Tests](https://img.shields.io/badge/tests-672%20passed-brightgreen.svg)]()
46
+ [![Coverage](https://img.shields.io/badge/coverage-86%25-brightgreen.svg)]()
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
+
49
+ *Iwa (岩), meaning "rock" in Japanese, symbolizes the unshakeable stability and immutable foundation required for secure financial infrastructure.*
50
+
51
+ </br>
52
+ <p align="center">
53
+ <img width="40%" src="https://raw.githubusercontent.com/dvilelaf/iwa/master/images/iwa.png">
54
+ </p>
55
+ </br>
56
+
57
+ Iwa is a Python framework designed for managing crypto wallets and interacting with smart contracts and crypto protocols in a secure, modular, and extensible way. It's ideal for building autonomous agents and applications that require blockchain interactions.
58
+
59
+ ## Features
60
+
61
+ - **Secure Key Storage**: Private keys are encrypted with AES-256-GCM and stored safely. They are never exposed to the application layer; signing happens internally via the `KeyStorage` class.
62
+
63
+ - **Modularity (Plugins)**: Protocols and features are implemented as plugins, loaded dynamically. Currently supports Gnosis (Safe, CowSwap) and Olas (Registry, Services, Staking).
64
+
65
+ - **Multi-Chain Support**: Native support for Gnosis Chain, Ethereum, and Base, with easy extensibility for others.
66
+
67
+ - **Robust Transaction Management**:
68
+ - **RPC Rotation**: Automatically switches RPC providers if one fails or is rate-limited.
69
+ - **Rate Limiting**: Token bucket algorithm with automatic backoff.
70
+ - **Retry Logic**: Automatic retries with exponential backoff for transient failures.
71
+
72
+ - **CLI & TUI Integration**: Interact with your wallet via a unified CLI or a beautiful Terminal User Interface built with Textual.
73
+
74
+ - **Web API**: RESTful API built with FastAPI for web-based integrations.
75
+
76
+ - **Modern Tooling**: Managed with `uv`, `Justfile` for automation, and ready for Docker deployment.
77
+
78
+ ## Architecture
79
+
80
+ ```
81
+ iwa/
82
+ ├── core/ # Core wallet functionality
83
+ │ ├── keys.py # KeyStorage - Encrypted key management
84
+ │ ├── wallet.py # Wallet - High-level interface
85
+ │ ├── chain.py # ChainInterface - Blockchain interaction with rate limiting
86
+ │ ├── services/ # Service layer (accounts, balances, transactions)
87
+ │ └── contracts/ # Contract abstractions (ERC20, Safe)
88
+ ├── plugins/ # Protocol integrations
89
+ │ ├── gnosis/ # Safe multisig and CowSwap DEX
90
+ │ └── olas/ # Olas Registry, Services, Staking
91
+ ├── tui/ # Terminal User Interface (Textual)
92
+ └── web/ # Web API (FastAPI)
93
+ ```
94
+
95
+ ### Key Components
96
+
97
+ | Component | Description |
98
+ |-----------|-------------|
99
+ | `KeyStorage` | Encrypts/decrypts private keys, provides internal signing |
100
+ | `Wallet` | Main high-level interface for user interactions |
101
+ | `ChainInterface` | Manages Web3 connections with rate limiting and RPC rotation |
102
+ | `TransactionService` | Handles transaction signing and sending with retry logic |
103
+ | `PluginService` | Dynamically loads and manages protocol plugins |
104
+
105
+ ## Setup & Usage
106
+
107
+ ### Prerequisites
108
+
109
+ - Python 3.12+
110
+ - [uv](https://github.com/astral-sh/uv) package manager
111
+
112
+ ### Installation
113
+
114
+ ```bash
115
+ # Install from PyPI
116
+ pip install iwa
117
+
118
+ # Or using uv (recommended for tools)
119
+ uv tool install iwa
120
+
121
+ # Or from source
122
+ git clone https://github.com/dvilelaf/iwa.git
123
+ cd iwa
124
+ just install
125
+ ```
126
+
127
+ ### Configuration
128
+
129
+ Create a `secrets.env` file with your configuration:
130
+
131
+ ```bash
132
+ WALLET_PASSWORD=your_secure_password
133
+ GNOSIS_RPC=https://rpc.gnosis.io,https://gnosis.drpc.org
134
+ ETHEREUM_RPC=https://mainnet.infura.io/v3/YOUR_KEY
135
+ BASE_RPC=https://mainnet.base.org
136
+
137
+ # Optional
138
+ GNOSISSCAN_API_KEY=your_api_key
139
+ COINGECKO_API_KEY=your_api_key
140
+ ```
141
+
142
+ ### Running
143
+
144
+ ```bash
145
+ # Launch TUI
146
+ just tui
147
+
148
+ # Launch Web UI
149
+ just web
150
+
151
+ # Use CLI
152
+ iwa wallet list --chain gnosis
153
+ iwa wallet balance <address> --chain gnosis
154
+ ```
155
+
156
+ ### Running Tests
157
+
158
+ ```bash
159
+ just test
160
+ ```
161
+
162
+ ### Security Checks
163
+
164
+ ```bash
165
+ just security # Runs gitleaks, bandit, and pip-audit
166
+ just wallet-check # Verifies password, keys, and mnemonic integrity
167
+ ```
168
+
169
+ ### Docker
170
+
171
+ ```bash
172
+ # Pull from Docker Hub
173
+ docker pull dvilelaf/iwa:latest
174
+
175
+ # Build locally
176
+ just docker-build
177
+ just docker-run
178
+ ```
179
+
180
+ ## Plugins
181
+
182
+ Plugins are located in `src/iwa/plugins`. Currently supported:
183
+
184
+ ### Gnosis Plugin
185
+ - **Safe**: Create and manage Safe multisig wallets
186
+ - **CowSwap**: Token swaps via CoW Protocol with MEV protection, Max balance support, and auto-refreshing UI
187
+
188
+ ### Olas Plugin
189
+ - **Registry**: Interact with Olas service registry
190
+ - **Services**: Create, deploy, and manage Olas services
191
+ - **Staking**: Stake/unstake services and claim rewards
192
+
193
+ ## Transaction Flow
194
+
195
+ 1. **Preparation**: A high-level method prepares a raw transaction dictionary
196
+ 2. **Delegation**: The transaction is passed to `TransactionService`
197
+ 3. **Signing**: `KeyStorage` decrypts the key in memory, signs, and wipes the key
198
+ 4. **Sending**: The signed transaction is sent via `ChainInterface`
199
+ 5. **Recovery**: Automatic RPC rotation and gas bumping on failures
200
+ 6. **Receipt**: Transaction receipt is returned upon success
201
+
202
+ ## Documentation
203
+
204
+ Full documentation is available in the `docs/` directory:
205
+
206
+ ```bash
207
+ # Serve docs locally
208
+ just docs-serve
209
+
210
+ # Build static docs
211
+ just docs-build
212
+ ```
213
+
214
+ ## Development
215
+
216
+ ```bash
217
+ # Format code
218
+ just format
219
+
220
+ # Lint code
221
+ just check
222
+
223
+ # Type check
224
+ just types
225
+ ```
226
+
227
+ ## Contributing
228
+
229
+ 1. Fork the repository
230
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
231
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
232
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
233
+ 5. Open a Pull Request
234
+
235
+ ## License
236
+
237
+ This project is licensed under the MIT License - see the LICENSE file for details.
iwa-0.0.1a3/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # Iwa
2
+
3
+ [![PyPI version](https://badge.fury.io/py/iwa.svg)](https://badge.fury.io/py/iwa)
4
+ [![Docker Pulls](https://img.shields.io/docker/pulls/dvilela/iwa.svg)](https://hub.docker.com/r/dvilela/iwa)
5
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
6
+ [![Tests](https://img.shields.io/badge/tests-672%20passed-brightgreen.svg)]()
7
+ [![Coverage](https://img.shields.io/badge/coverage-86%25-brightgreen.svg)]()
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ *Iwa (岩), meaning "rock" in Japanese, symbolizes the unshakeable stability and immutable foundation required for secure financial infrastructure.*
11
+
12
+ </br>
13
+ <p align="center">
14
+ <img width="40%" src="https://raw.githubusercontent.com/dvilelaf/iwa/master/images/iwa.png">
15
+ </p>
16
+ </br>
17
+
18
+ Iwa is a Python framework designed for managing crypto wallets and interacting with smart contracts and crypto protocols in a secure, modular, and extensible way. It's ideal for building autonomous agents and applications that require blockchain interactions.
19
+
20
+ ## Features
21
+
22
+ - **Secure Key Storage**: Private keys are encrypted with AES-256-GCM and stored safely. They are never exposed to the application layer; signing happens internally via the `KeyStorage` class.
23
+
24
+ - **Modularity (Plugins)**: Protocols and features are implemented as plugins, loaded dynamically. Currently supports Gnosis (Safe, CowSwap) and Olas (Registry, Services, Staking).
25
+
26
+ - **Multi-Chain Support**: Native support for Gnosis Chain, Ethereum, and Base, with easy extensibility for others.
27
+
28
+ - **Robust Transaction Management**:
29
+ - **RPC Rotation**: Automatically switches RPC providers if one fails or is rate-limited.
30
+ - **Rate Limiting**: Token bucket algorithm with automatic backoff.
31
+ - **Retry Logic**: Automatic retries with exponential backoff for transient failures.
32
+
33
+ - **CLI & TUI Integration**: Interact with your wallet via a unified CLI or a beautiful Terminal User Interface built with Textual.
34
+
35
+ - **Web API**: RESTful API built with FastAPI for web-based integrations.
36
+
37
+ - **Modern Tooling**: Managed with `uv`, `Justfile` for automation, and ready for Docker deployment.
38
+
39
+ ## Architecture
40
+
41
+ ```
42
+ iwa/
43
+ ├── core/ # Core wallet functionality
44
+ │ ├── keys.py # KeyStorage - Encrypted key management
45
+ │ ├── wallet.py # Wallet - High-level interface
46
+ │ ├── chain.py # ChainInterface - Blockchain interaction with rate limiting
47
+ │ ├── services/ # Service layer (accounts, balances, transactions)
48
+ │ └── contracts/ # Contract abstractions (ERC20, Safe)
49
+ ├── plugins/ # Protocol integrations
50
+ │ ├── gnosis/ # Safe multisig and CowSwap DEX
51
+ │ └── olas/ # Olas Registry, Services, Staking
52
+ ├── tui/ # Terminal User Interface (Textual)
53
+ └── web/ # Web API (FastAPI)
54
+ ```
55
+
56
+ ### Key Components
57
+
58
+ | Component | Description |
59
+ |-----------|-------------|
60
+ | `KeyStorage` | Encrypts/decrypts private keys, provides internal signing |
61
+ | `Wallet` | Main high-level interface for user interactions |
62
+ | `ChainInterface` | Manages Web3 connections with rate limiting and RPC rotation |
63
+ | `TransactionService` | Handles transaction signing and sending with retry logic |
64
+ | `PluginService` | Dynamically loads and manages protocol plugins |
65
+
66
+ ## Setup & Usage
67
+
68
+ ### Prerequisites
69
+
70
+ - Python 3.12+
71
+ - [uv](https://github.com/astral-sh/uv) package manager
72
+
73
+ ### Installation
74
+
75
+ ```bash
76
+ # Install from PyPI
77
+ pip install iwa
78
+
79
+ # Or using uv (recommended for tools)
80
+ uv tool install iwa
81
+
82
+ # Or from source
83
+ git clone https://github.com/dvilelaf/iwa.git
84
+ cd iwa
85
+ just install
86
+ ```
87
+
88
+ ### Configuration
89
+
90
+ Create a `secrets.env` file with your configuration:
91
+
92
+ ```bash
93
+ WALLET_PASSWORD=your_secure_password
94
+ GNOSIS_RPC=https://rpc.gnosis.io,https://gnosis.drpc.org
95
+ ETHEREUM_RPC=https://mainnet.infura.io/v3/YOUR_KEY
96
+ BASE_RPC=https://mainnet.base.org
97
+
98
+ # Optional
99
+ GNOSISSCAN_API_KEY=your_api_key
100
+ COINGECKO_API_KEY=your_api_key
101
+ ```
102
+
103
+ ### Running
104
+
105
+ ```bash
106
+ # Launch TUI
107
+ just tui
108
+
109
+ # Launch Web UI
110
+ just web
111
+
112
+ # Use CLI
113
+ iwa wallet list --chain gnosis
114
+ iwa wallet balance <address> --chain gnosis
115
+ ```
116
+
117
+ ### Running Tests
118
+
119
+ ```bash
120
+ just test
121
+ ```
122
+
123
+ ### Security Checks
124
+
125
+ ```bash
126
+ just security # Runs gitleaks, bandit, and pip-audit
127
+ just wallet-check # Verifies password, keys, and mnemonic integrity
128
+ ```
129
+
130
+ ### Docker
131
+
132
+ ```bash
133
+ # Pull from Docker Hub
134
+ docker pull dvilelaf/iwa:latest
135
+
136
+ # Build locally
137
+ just docker-build
138
+ just docker-run
139
+ ```
140
+
141
+ ## Plugins
142
+
143
+ Plugins are located in `src/iwa/plugins`. Currently supported:
144
+
145
+ ### Gnosis Plugin
146
+ - **Safe**: Create and manage Safe multisig wallets
147
+ - **CowSwap**: Token swaps via CoW Protocol with MEV protection, Max balance support, and auto-refreshing UI
148
+
149
+ ### Olas Plugin
150
+ - **Registry**: Interact with Olas service registry
151
+ - **Services**: Create, deploy, and manage Olas services
152
+ - **Staking**: Stake/unstake services and claim rewards
153
+
154
+ ## Transaction Flow
155
+
156
+ 1. **Preparation**: A high-level method prepares a raw transaction dictionary
157
+ 2. **Delegation**: The transaction is passed to `TransactionService`
158
+ 3. **Signing**: `KeyStorage` decrypts the key in memory, signs, and wipes the key
159
+ 4. **Sending**: The signed transaction is sent via `ChainInterface`
160
+ 5. **Recovery**: Automatic RPC rotation and gas bumping on failures
161
+ 6. **Receipt**: Transaction receipt is returned upon success
162
+
163
+ ## Documentation
164
+
165
+ Full documentation is available in the `docs/` directory:
166
+
167
+ ```bash
168
+ # Serve docs locally
169
+ just docs-serve
170
+
171
+ # Build static docs
172
+ just docs-build
173
+ ```
174
+
175
+ ## Development
176
+
177
+ ```bash
178
+ # Format code
179
+ just format
180
+
181
+ # Lint code
182
+ just check
183
+
184
+ # Type check
185
+ just types
186
+ ```
187
+
188
+ ## Contributing
189
+
190
+ 1. Fork the repository
191
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
192
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
193
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
194
+ 5. Open a Pull Request
195
+
196
+ ## License
197
+
198
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,141 @@
1
+ [project]
2
+ name = "iwa"
3
+ version = "0.0.1a3"
4
+ description = "A secure, modular, and plugin-based framework for crypto agents and ops"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12,<4.0"
7
+ dependencies = [
8
+ "bip-utils>=2.9.3",
9
+ "cryptography>=46.0.2",
10
+ "eth-account>=0.13.7",
11
+ "loguru>=0.7.3",
12
+ "pydantic>=2.12.0",
13
+ "pydantic-settings>=2.11.0",
14
+ "rich>=14.2.0",
15
+ "tomli>=2.3.0",
16
+ "tomli-w>=1.2.0",
17
+ "typer>=0.19.2",
18
+ "web3>=7.13.0",
19
+ "pyyaml (>=6.0.3,<7.0.0)",
20
+ "safe-eth-py>=7.14.0",
21
+ "twine>=6.2.0",
22
+ "cowdao-cowpy>=1.0.1",
23
+ "pytest>=9.0.1",
24
+ "textual>=0.47.1",
25
+ "pyperclip>=1.8.2",
26
+ "peewee>=3.17.0",
27
+ "fastapi>=0.115.0",
28
+ "uvicorn>=0.32.0",
29
+ "jinja2>=3.1.4",
30
+ "cbor2==5.8.0",
31
+ "slowapi>=0.1.9",
32
+ "nest-asyncio>=1.6.0",
33
+ "aiohttp>=3.13.3",
34
+ "pynacl>=1.6.2",
35
+ "urllib3>=2.6.3",
36
+ "multiformats>=0.3.1",
37
+ "requests>=2.32.0",
38
+ ]
39
+
40
+ [project.scripts]
41
+ iwa = "iwa.core.cli:iwa_cli"
42
+ iwa-wallet-check = "iwa.tools.wallet_check:check_wallet"
43
+ iwa-reset-tenderly = "iwa.tools.reset_tenderly:main"
44
+ iwa-reset-env = "iwa.tools.reset_env:main"
45
+ iwa-check-profile = "iwa.tools.check_profile:main"
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "mypy>=1.18.2",
50
+ "ruff>=0.14.1",
51
+ "twine>=6.2.0",
52
+ "pytest-cov>=6.0.0",
53
+ "pytest-asyncio>=0.23.0",
54
+ "mkdocs>=1.6.1",
55
+ "mkdocs-material>=9.5.49",
56
+ "mkdocstrings[python]>=0.27.0",
57
+ "bandit>=1.9.2",
58
+ "pip-audit>=2.10.0",
59
+ "djlint>=1.34.1",
60
+ ]
61
+
62
+ [build-system]
63
+ requires = ["setuptools>=61.0", "wheel"]
64
+ build-backend = "setuptools.build_meta"
65
+
66
+ [tool.ruff]
67
+ line-length = 100
68
+ target-version = "0.0.1a3"
69
+ fix = true
70
+
71
+ [tool.ruff.lint]
72
+ extend-select = ["I", "B", "C90", "N", "D"] # imports, bugbear, complexity, naming, docstrings
73
+ ignore = [
74
+ "E501",
75
+ "D203",
76
+ "D213",
77
+ "D400", # First line should end with a period
78
+ "D401", # First line should be in imperative mood
79
+ "D415", # First line should end with a period, question mark, or exclamation point
80
+ ]
81
+
82
+ [tool.ruff.lint.per-file-ignores]
83
+ "src/tests/**/*.py" = ["D", "E402"]
84
+ "tests/**/*.py" = ["D", "E402"]
85
+
86
+ [tool.ruff.format]
87
+ quote-style = "double"
88
+ indent-style = "space"
89
+
90
+ # strict = true
91
+ [tool.mypy]
92
+ check_untyped_defs = true
93
+ disallow_untyped_defs = false
94
+ ignore_missing_imports = true
95
+ follow_imports = "silent"
96
+ exclude = [
97
+ "pydantic_core",
98
+ "typing_inspection",
99
+ "src/tests/.*",
100
+ "tests/.*",
101
+ "src/iwa/tools/.*",
102
+ "src/iwa/tui/.*", # TUI is often complex with types, delaying check for speed
103
+ "src/iwa/plugins/olas/scripts/.*", # Integration test scripts, not production code
104
+ ]
105
+
106
+ [[tool.mypy.overrides]]
107
+ module = [
108
+ "bip_utils.*",
109
+ "cowdao_cowpy.*",
110
+ "eth_account.*",
111
+ "loguru.*",
112
+ "peewee.*",
113
+ "playhouse.*",
114
+ "pydantic.*",
115
+ "pydantic_core.*",
116
+ "pyperclip.*",
117
+ "pytest.*",
118
+ "rich.*",
119
+ "safe_eth.*",
120
+ "textual.*",
121
+ "tomli_w.*",
122
+ "typer.*",
123
+ "web3.*",
124
+ "iwa.plugins.*",
125
+ "iwa.tui.*",
126
+ "iwa.core.*",
127
+ "iwa.*",
128
+ "iwa.tools.*",
129
+ "tests.*",
130
+ ]
131
+ ignore_missing_imports = true
132
+ ignore_errors = true
133
+ follow_imports = "skip"
134
+
135
+ [tool.bandit]
136
+ exclude_dirs = ["tests", "src/tests", "src/iwa/plugins/olas/tests"]
137
+ skips = ["B101", "B105", "B106", "B110", "B107", "B112"]
138
+ [tool.djlint]
139
+ profile = "jinja"
140
+ extension = "html"
141
+ indent = 4
iwa-0.0.1a3/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,22 @@
1
+ """Pytest configuration."""
2
+
3
+ import logging
4
+
5
+ import pytest
6
+ from loguru import logger
7
+
8
+
9
+ @pytest.fixture(autouse=True)
10
+ def caplog(caplog):
11
+ """Make loguru logs visible to pytest caplog."""
12
+
13
+ class PropagateHandler(logging.Handler):
14
+ def emit(self, record):
15
+ logging.getLogger(record.name).handle(record)
16
+
17
+ handler_id = logger.add(PropagateHandler(), format="{message}")
18
+ yield caplog
19
+ try:
20
+ logger.remove(handler_id)
21
+ except ValueError:
22
+ pass
@@ -0,0 +1 @@
1
+ """iwa package."""
@@ -0,0 +1,6 @@
1
+ """iwa main."""
2
+
3
+ from iwa.core import cli
4
+
5
+ if __name__ == "__main__":
6
+ cli.iwa_cli()
@@ -0,0 +1 @@
1
+ """iwa.core package."""