iwa 0.0.17__py3-none-any.whl → 0.0.19__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,7 +10,7 @@ iwa/core/mnemonic.py,sha256=LiG1VmpydQoHQ0pHUJ1OIlrWJry47VSMnOqPM_Yk-O8,12930
10
10
  iwa/core/models.py,sha256=kBQ0cBe6uFmL2QfW7mjKiMFeZxhT-FRN-RyK3Ko0vE8,12849
11
11
  iwa/core/monitor.py,sha256=OmhKVMkfhvtxig3wDUL6iGwBIClTx0YUqMncCao4SqI,7953
12
12
  iwa/core/plugins.py,sha256=FLvOG4S397fKi0aTH1fWBEtexn4yvGv_QzGWqFrhSKE,1102
13
- iwa/core/pricing.py,sha256=U-vIjJwzh6O7MZTAFZx6mFFxaiLcwn6PnsZc4g0z4IQ,4293
13
+ iwa/core/pricing.py,sha256=uENpqVMmuogZHctsLuEsU7WJ1cLSNAI-rZTtbpTDjeQ,4048
14
14
  iwa/core/secrets.py,sha256=U7DZKrwKuSOFV00Ij3ISrrO1cWn_t1GBW_0PyAqjcD4,2588
15
15
  iwa/core/tables.py,sha256=y7Cg67PAGHYVMVyAjbo_CQ9t2iz7UXE-OTuUHRyFRTo,2021
16
16
  iwa/core/test.py,sha256=gey0dql5eajo1itOhgkSrgfyGWue2eSfpr0xzX3vc38,643
@@ -20,7 +20,7 @@ iwa/core/utils.py,sha256=shJuANkXSWVO3NF49syPA9hCG7H5AzaMJOG8V4fo6IM,4279
20
20
  iwa/core/wallet.py,sha256=sNFK-_0y-EgeLpNHt9o5tCqTM0oVqJra-eAWjR7AgyU,13038
21
21
  iwa/core/chain/__init__.py,sha256=XJMmn0ed-_aVkY2iEMKpuTxPgIKBd41dexSVmEZTa-o,1604
22
22
  iwa/core/chain/errors.py,sha256=9SEbhxZ-qASPkzt-DoI51qq0GRJVqRgqgL720gO7a64,1275
23
- iwa/core/chain/interface.py,sha256=BIUPJUAV8oeeiUtZcj0zi2B0mGad2qS5ajy1PhBT-1k,21182
23
+ iwa/core/chain/interface.py,sha256=uUIUo9Q6Sr4h9AjqFe6WqQzdbMs9VkJcUj0mgd6lfx4,18602
24
24
  iwa/core/chain/manager.py,sha256=cFEzh6pK5OyVhjhpeMAqhc9RnRDQR1DjIGiGKp-FXBI,1159
25
25
  iwa/core/chain/models.py,sha256=0OgBo08FZEQisOdd00YUMXSAV7BC0CcWpqJ2y-gs0cI,4863
26
26
  iwa/core/chain/rate_limiter.py,sha256=gU7TmWdH9D_wbXKT1X7mIgoIUCWVuebgvRhxiyLGAmI,6613
@@ -36,12 +36,12 @@ iwa/core/services/account.py,sha256=01MoEvl6FJlMnMB4fGwsPtnGa4kgA-d5hJeKu_ACg7Y,
36
36
  iwa/core/services/balance.py,sha256=mPE12CuOFfCaJXaQXWOcQM1O03ZF3ghpy_-oOjNk_GE,4104
37
37
  iwa/core/services/plugin.py,sha256=GNNlbtELyHl7MNVChrypF76GYphxXduxDog4kx1MLi8,3277
38
38
  iwa/core/services/safe.py,sha256=ytNJMndXrzTMHwhDZKYLIh4Q0UTWDBgQgTpof-UqIkA,14827
39
- iwa/core/services/transaction.py,sha256=3IeTLntewa9XevPTMrNhjOUwdv0nMdU3KqlxljjL0Z0,14286
39
+ iwa/core/services/transaction.py,sha256=DiEVwE1L_UpCyC5UmknaRwRYRxsDlAkwMQRN64NiwIQ,15162
40
40
  iwa/core/services/transfer/__init__.py,sha256=ZJfshFxJRsp8rkOqfVvd1cqEzIJ9tqBJh8pc0l90GLk,5576
41
41
  iwa/core/services/transfer/base.py,sha256=sohz-Ss2i-pGYGl4x9bD93cnYKcSvsXaXyvyRawvgQs,9043
42
- iwa/core/services/transfer/erc20.py,sha256=0GvlfETgdJg15azs1apH1gI6Vm3gAv22o1saNbIfiAY,8685
42
+ iwa/core/services/transfer/erc20.py,sha256=958ctXPWxq_KSQNoaG7RqWbC8SRb9NB3MzhtC2dp_NU,8960
43
43
  iwa/core/services/transfer/multisend.py,sha256=MuOTjzUQoYg1eSixXKhJGBmB1c0ymLelvk4puHm_VGE,15194
44
- iwa/core/services/transfer/native.py,sha256=Z0v41OMbbcTjwdYLDwMO-8G81UMPYDdQ3y8BdbsJimM,9350
44
+ iwa/core/services/transfer/native.py,sha256=2CiUOP1gHEXAtLG0-8FaykV3u3jclq5y71gXQNEoc3w,10433
45
45
  iwa/core/services/transfer/swap.py,sha256=exOJdzwkZaGbrFWfmQT_2JMcZUxnkiehXca8TH-vlF0,12269
46
46
  iwa/core/tests/test_wallet.py,sha256=N8_gO7KkV5nqk_KcHqW_xOwNNKpDuXHeFgnala3bB84,9361
47
47
  iwa/plugins/__init__.py,sha256=zy-DjOZn8GSgIETN2X_GAb9O6yk71t6ZRzeUgoZ52KA,23
@@ -56,33 +56,35 @@ iwa/plugins/gnosis/cow/types.py,sha256=-9VRiFhAkmN1iIJ95Pg7zLFSeXtkkW00sl13usxi3
56
56
  iwa/plugins/gnosis/tests/test_cow.py,sha256=iVy5ockMIcPZWsX4WGXU91DhBsYEZ5NOxtFzAQ2sK3o,8440
57
57
  iwa/plugins/gnosis/tests/test_safe.py,sha256=pw1zrYvAiVtmPIU5k7BtOQpDNAQTSTrLIaeljCjSahc,3216
58
58
  iwa/plugins/olas/__init__.py,sha256=_NhBczzM61fhGYwGhnWfEeL8Jywyy_730GASe2BxzeQ,106
59
- iwa/plugins/olas/constants.py,sha256=nbthnzu90xgfbXOU2GwovbNmDLUBNDSZBrEQ02H-5wk,7381
59
+ iwa/plugins/olas/constants.py,sha256=iTFoO2QW3KbhL5k5sKsJxxyDytl9wVIb_9hAih55KrE,7728
60
60
  iwa/plugins/olas/importer.py,sha256=f8KlZ9dGcNbpg8uoTYbO9sDvbluZoslhpWFLqPjPnLA,26717
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=sQSzBWF7meXzCzVw4G0wowjTTRddraGPppQ8PyLcuaU,6429
64
+ iwa/plugins/olas/contracts/activity_checker.py,sha256=PTLvsFdi3PdsFMxRVcXfwlQMRyJYHIzrHf3OaPVtFqU,3943
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
68
+ iwa/plugins/olas/contracts/mech_marketplace_v1.py,sha256=ooF5uw1wxwYsoriGUGGxXxmaD8DtWZtK4TJBCUNTGtI,2501
68
69
  iwa/plugins/olas/contracts/service.py,sha256=BDQKeCTCnBNrwKD1a8rrlLytpKG3CAdjr-s0ec-dsFY,8243
69
70
  iwa/plugins/olas/contracts/staking.py,sha256=vt2UZ6G0edg1EbPrzFK5AIse531bQTu4PLydQ6rgrAA,14494
70
71
  iwa/plugins/olas/contracts/abis/activity_checker.json,sha256=HT0IMbyTLMO71ITBKwoS950rHe772suPP4b8eDAodJ0,2230
71
72
  iwa/plugins/olas/contracts/abis/mech.json,sha256=bMMCXInjE_2PTPnc_sIyS_H8pod5Sm_e-xTbKgZppKc,16369
72
73
  iwa/plugins/olas/contracts/abis/mech_marketplace.json,sha256=KPnF-H_UATb3wdb_7o6ky_hSp5xwgvckD-QqylsWJLg,32468
74
+ iwa/plugins/olas/contracts/abis/mech_marketplace_v1.json,sha256=sB9RhPcEI7xYLWKrebAP-s3v6hdeAH9V3njPNZqSM-M,20678
73
75
  iwa/plugins/olas/contracts/abis/mech_new.json,sha256=j6HkhTpVQEA4la13Kp1Q_pwlt2x5Ywh7GCEjz4q2_ws,20995
74
76
  iwa/plugins/olas/contracts/abis/service_manager.json,sha256=jsByfx_NPNqHJBbauGEg2S41D0ZYUHa24TzpJQuk604,29735
75
77
  iwa/plugins/olas/contracts/abis/service_registry.json,sha256=phtK1FHUZRtUHP0HeISyO2jlrlzGiETON_Ljd_kLYn4,43864
76
78
  iwa/plugins/olas/contracts/abis/service_registry_token_utility.json,sha256=GR02mv9b8yckGubh_Huca_jbczw30AG-34ocZELNLPI,57624
77
79
  iwa/plugins/olas/contracts/abis/staking.json,sha256=_W3NBuygSU-tsqdWTD7P0PmCVz7ZUCqIoJkW60ChjLw,31139
78
80
  iwa/plugins/olas/contracts/abis/staking_token.json,sha256=cuUOmi1s4Z6VSIX0an_IxK6qkPeoyPt3NUdvlX8GlPI,81288
79
- iwa/plugins/olas/scripts/test_full_mech_flow.py,sha256=id9IxC06FOKwexgwsG5nbsTB2rQLlIq5a5soMvK0IgY,9021
81
+ iwa/plugins/olas/scripts/test_full_mech_flow.py,sha256=Fqoq5bn7Z_3YyRrnuqNAZy9cwQDLiXP6Vf3EIeWPo2I,9024
80
82
  iwa/plugins/olas/scripts/test_simple_lifecycle.py,sha256=8T50tOZx3afeECSfCNAb0rAHNtYOsBaeXlMwKXElCk8,2099
81
83
  iwa/plugins/olas/service_manager/__init__.py,sha256=GXiThMEY3nPgHUl1i-DLrF4h96z9jPxxI8Jepo2E1PM,1926
82
84
  iwa/plugins/olas/service_manager/base.py,sha256=CCTH7RiYtgyFwRszrMLxNf1rNM_6leWHuJJmse4m2wI,4854
83
85
  iwa/plugins/olas/service_manager/drain.py,sha256=IS7YYKuQdkULcNdxfHVzjcq95pXKdpajolzLL78u4jc,12430
84
86
  iwa/plugins/olas/service_manager/lifecycle.py,sha256=DIB6yrP0VPICu6558uQJuFp2sgrA66iVNTzZVUUowGw,47159
85
- iwa/plugins/olas/service_manager/mech.py,sha256=Rl4FJIYrT9L4gzTd7-7xBZaxBEHWFyMmN5TuSNfEdZc,15964
87
+ iwa/plugins/olas/service_manager/mech.py,sha256=WJtf90y9JrFAo6QHosFn0bfM_2q9VjMBmXhYzwDsUpU,27620
86
88
  iwa/plugins/olas/service_manager/staking.py,sha256=Z9GzlPfY7qSSjc9xPhWvb9qywxu_7OB3Gc1eBli07pY,28058
87
89
  iwa/plugins/olas/tests/conftest.py,sha256=4vM7EI00SrTGyeP0hNzsGSQHEj2-iznVgzlNh2_OGfo,739
88
90
  iwa/plugins/olas/tests/test_importer.py,sha256=i9LKov7kNRECB3hmRnhKBwcfx3uxtjWe4BB77bOOpeo,4282
@@ -113,7 +115,7 @@ iwa/tools/check_profile.py,sha256=0LAv9wx4wMM610mX88-6tIoDi2I5LDzh0W9nkprt42s,21
113
115
  iwa/tools/list_contracts.py,sha256=2w-LYB2RVS-eGil2kLiBIEm3tYYhYzT4lAuGO6VtLJU,4861
114
116
  iwa/tools/release.py,sha256=-Z9GG6Y-K6KG32K0VUf_MruiUdJxG6W7ToOMzhyCH7Y,3963
115
117
  iwa/tools/reset_env.py,sha256=FKN0wuh9Xq00c94B2kEFehHPKcWldxYqgU45yJwg5Cg,3140
116
- iwa/tools/reset_tenderly.py,sha256=w1-KujdqRpimrgiREvoRwVXsGsGoYisCLmYTcsJ6Np8,11295
118
+ iwa/tools/reset_tenderly.py,sha256=usKfOLrQvdCzEncueg-Sz3spqX80vHPQmbh2tIygo8o,11295
117
119
  iwa/tools/restore_backup.py,sha256=_LJbmKv9SlekLUQFdjI3aHCvAc6uePobJe3bQEFyatk,2455
118
120
  iwa/tools/wallet_check.py,sha256=IQLgb8oCt4oG6FMEAqzUxM57DLv_UE24dFUSVxtBo_Y,4774
119
121
  iwa/tui/__init__.py,sha256=XYIZNQNy-fZC1NHHM0sd9qUO0vE1slml-cm0CpQ4NLY,27
@@ -150,7 +152,7 @@ iwa/web/tests/test_web_endpoints.py,sha256=C264MH-CTyDW4GLUrTXBgLJKUk4-89pFAScBd
150
152
  iwa/web/tests/test_web_olas.py,sha256=0CVSsrncOeJ3x0ECV7mVLQV_CXZRrOqGiVjgLIi6hZ8,16308
151
153
  iwa/web/tests/test_web_swap.py,sha256=7A4gBJFL01kIXPtW1E1J17SCsVc_0DmUn-R8kKrnnVA,2974
152
154
  iwa/web/tests/test_web_swap_coverage.py,sha256=zGNrzlhZ_vWDCvWmLcoUwFgqxnrp_ACbo49AtWBS_Kw,5584
153
- iwa-0.0.17.dist-info/licenses/LICENSE,sha256=eIubm_IlBHPYRQlLNZKbBNKhJUUP3JH0A2miZUhAVfI,1078
155
+ iwa-0.0.19.dist-info/licenses/LICENSE,sha256=eIubm_IlBHPYRQlLNZKbBNKhJUUP3JH0A2miZUhAVfI,1078
154
156
  tests/legacy_cow.py,sha256=oOkZvIxL70ReEoD9oHQbOD5GpjIr6AGNHcOCgfPlerU,8389
155
157
  tests/legacy_safe.py,sha256=AssM2g13E74dNGODu_H0Q0y412lgqsrYnEzI97nm_Ts,2972
156
158
  tests/legacy_transaction_retry_logic.py,sha256=D9RqZ7DBu61Xr2djBAodU2p9UE939LL-DnQXswX5iQk,1497
@@ -159,7 +161,7 @@ tests/legacy_wallets_screen.py,sha256=9hZnX-VhKgwH9w8MxbNdboRyNxLDhOakLKJECsw_vh
159
161
  tests/legacy_web.py,sha256=q2ERIriaDHT3Q8axG2N3ucO7f2VSvV_WkuPR00DVko4,8577
160
162
  tests/test_account_service.py,sha256=g_AIVT2jhlvUtbFTaCd-d15x4CmXJQaV66tlAgnaXwY,3745
161
163
  tests/test_balance_service.py,sha256=86iEkPd2M1-UFy3qOxV1EguQOEYbboy2-2mAyS3ctGs,6549
162
- tests/test_chain.py,sha256=z3Mo9mHNQZ0aXSlrHUcdtNgGqsNyOwWYQAmmKa_dqiM,17221
164
+ tests/test_chain.py,sha256=cWSLUHRl2Iz55wQA08bk8RvAQnp_ZHCqA829KJ3Ur6c,13609
163
165
  tests/test_chain_interface.py,sha256=Wu0q0sREtmYBp7YvWrBIrrSTtqeQj18oJp2VmMUEMec,8312
164
166
  tests/test_chain_interface_coverage.py,sha256=fvrVvw8-DMwdsSFKQHUhpbfutrVRxnnTc-tjB7Bb-jo,3327
165
167
  tests/test_cli.py,sha256=WW6EDeHLws5-BqFNOy11pH_D5lttuyspD5hrDCFpR0Q,3968
@@ -169,7 +171,7 @@ tests/test_drain_coverage.py,sha256=jtN5tIXzSTlS2IjwLS60azyMYsjFDlSTUa98JM1bMic,
169
171
  tests/test_erc20.py,sha256=kNEw1afpm5EbXRNXkjpkBNZIy7Af1nqGlztKH5IWAwU,3074
170
172
  tests/test_gnosis_plugin.py,sha256=XMoHBCTrnVBq9bXYPzMUIrhr95caucMVRxooCjKrzjg,3454
171
173
  tests/test_keys.py,sha256=pxlGlHB-NaTbC8qar093ttdHLLtkM8irVNmCbH2KVf4,17421
172
- tests/test_legacy_wallet.py,sha256=j7AorUMvuChyxy18y9j8Ux8wpZa2_ZvKutp5obKLLI0,49895
174
+ tests/test_legacy_wallet.py,sha256=Caj3xP1FijRyLKa-xKiZu6NCAsQRHjWbsnAarncAoA0,49798
173
175
  tests/test_main.py,sha256=y2xr7HjCt4rHsxm8y6n24FKCteSHPyxC3DFuMcUgX1Y,475
174
176
  tests/test_migration.py,sha256=fYoxzI3KqGh0cPV0bFcbvGrAnKcNlvnwjggG_uD0QGo,1789
175
177
  tests/test_mnemonic.py,sha256=BFtXMMg17uHWh_H-ZwAOn0qzgbUCqL8BRLkgRjzfzxo,7379
@@ -187,11 +189,11 @@ tests/test_safe_coverage.py,sha256=g9Bdrpkc-Mc8HBjk07lYNRkzxWZiF922uiVLZqhehBE,5
187
189
  tests/test_safe_service.py,sha256=nxDYmGd6p2gGe7BEeMxsqS8CgeJarPofV38HC6Cop44,5770
188
190
  tests/test_service_manager_integration.py,sha256=I_BLUzEKrVTyg_8jqsUK0oFD3aQVPCRJ7z0gY8P-j04,2354
189
191
  tests/test_service_manager_structure.py,sha256=zK506ucCXCBHcjPYKrKEuK1bgq0xsbawyL8Y-wahXf8,868
190
- tests/test_service_transaction.py,sha256=SecU2Fy32jLH4lg0CZHNrNkqM1pzPnYB0qZtxqaDnFE,6416
191
- tests/test_staking_router.py,sha256=e8bI_u24SsORn9bkf4QWOtFoGxi86WTyu_Zl_QnUvpA,2769
192
+ tests/test_service_transaction.py,sha256=IeqYhmRD-pIXffBJrBQwfPx-qnfNEJs0iPM3eCb8MLo,7054
193
+ tests/test_staking_router.py,sha256=cnOtwWeQPu09kecVhlCf1WA4ONqs13OcQJhJCx2EOPY,3067
192
194
  tests/test_staking_simple.py,sha256=NHyZ1pcVQEJGFiGseC5m6Y9Y6FJGnRIFJUwhd1hAV9g,1138
193
195
  tests/test_tables.py,sha256=1KQHgxuizoOrRxpubDdnzk9iaU5Lwyp3bcWP_hZD5uU,2686
194
- tests/test_transaction_service.py,sha256=iuRMyOsMS4fRNIhudbW0ovSfA6vGzZpjIApVryOpO3U,5283
196
+ tests/test_transaction_service.py,sha256=TXhIleUNOnp3DXi-RrKJ1Y_6dA6de5TQLOc9qndMHm4,5765
195
197
  tests/test_transfer_multisend.py,sha256=PErjNqNwN66TMh4oVa307re64Ucccg1LkXqB0KlkmsI,6677
196
198
  tests/test_transfer_native.py,sha256=cDbb4poV_veIw6eHpokrHe9yUndOjA6rQhrHd_IY3HQ,7445
197
199
  tests/test_transfer_security.py,sha256=gdpC6ybdXQbQgILbAQ0GqjWdwn9AJRNR3B_7TYg0NxI,3617
@@ -202,8 +204,8 @@ tests/test_utils.py,sha256=vkP49rYNI8BRzLpWR3WnKdDr8upeZjZcs7Rx0pjbQMo,1292
202
204
  tests/test_workers.py,sha256=MInwdkFY5LdmFB3o1odIaSD7AQZb3263hNafO1De5PE,2793
203
205
  tools/create_and_stake_service.py,sha256=1xwy_bJQI1j9yIQ968Oc9Db_F6mk1659LuuZntTASDE,3742
204
206
  tools/verify_drain.py,sha256=PkMjblyOOAuQge88FwfEzRtCYeEtJxXhPBmtQYCoQ-8,6743
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,,
207
+ iwa-0.0.19.dist-info/METADATA,sha256=ueADSL3j41OZTVAxdOovoGm6S4pPn9g2M4g2l7yVRgM,7295
208
+ iwa-0.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
209
+ iwa-0.0.19.dist-info/entry_points.txt,sha256=nwB6kscrfA7M00pYmL2j-sBH6eF6h2ga9IK1BZxdiyQ,241
210
+ iwa-0.0.19.dist-info/top_level.txt,sha256=kedS9cRUbm4JE2wYeabIXilhHjN8KCw0IGbqqqsw0Bs,16
211
+ iwa-0.0.19.dist-info/RECORD,,
tests/test_chain.py CHANGED
@@ -195,43 +195,8 @@ def test_wait_for_no_pending_tx(mock_web3):
195
195
  assert ci.wait_for_no_pending_tx("0xSender") is False
196
196
 
197
197
 
198
- def test_send_native_transfer(mock_web3):
199
- chain = MagicMock(spec=SupportedChain, rpcs=["https://rpc"], chain_id=1, native_currency="ETH")
200
- chain.name = "TestChain"
201
- type(chain).rpc = PropertyMock(return_value="https://rpc")
202
- ci = ChainInterface(chain)
203
- account = MagicMock(address="0xSender", key="key")
204
-
205
- ci.web3.eth.get_transaction_count.return_value = 0
206
- ci.web3.eth.gas_price = 10
207
- ci.web3.eth.estimate_gas.return_value = 21000
208
-
209
- # Sufficient balance
210
- ci.web3.eth.get_balance.return_value = 10**18 # plenty
211
- ci.web3.eth.get_balance.return_value = 10**18 # plenty
212
- # Valid mock return for success: (True, dict_receipt)
213
- # The actual method returns tx_hash.hex().
214
- mock_signed_tx = MagicMock()
215
- mock_signed_tx.raw_transaction = b"raw"
216
- mock_receipt = {"transactionHash": b"hash", "status": 1}
217
-
218
- with (
219
- patch.object(ci.web3.eth, "send_raw_transaction", return_value=b"hash"),
220
- patch.object(ci.web3.eth, "wait_for_transaction_receipt", return_value=mock_receipt),
221
- patch.object(ci, "wait_for_no_pending_tx", return_value=True),
222
- ):
223
- success, tx_hash = ci.send_native_transfer(
224
- account.address, "0xReceiver", 1000, sign_callback=lambda tx: mock_signed_tx
225
- )
226
- assert success is True
227
- assert tx_hash == "68617368"
228
-
229
- # Insufficient balance
230
- ci.web3.eth.get_balance.return_value = 0
231
- ci.web3.from_wei.return_value = 0.0
232
- assert ci.send_native_transfer(
233
- account.address, "0xReceiver", 1000, sign_callback=lambda tx: mock_signed_tx
234
- ) == (False, None)
198
+ # NOTE: test_send_native_transfer was removed because the method was removed
199
+ # from ChainInterface. Native transfers now go through TransactionService.
235
200
 
236
201
 
237
202
  def test_chain_interfaces_get():
@@ -352,66 +317,6 @@ def test_chain_interface_with_real_chains():
352
317
  # --- Negative Tests ---
353
318
 
354
319
 
355
- def test_send_native_transfer_insufficient_balance(mock_web3):
356
- """Test send_native_transfer fails with insufficient balance."""
357
- chain = MagicMock(spec=SupportedChain)
358
- chain.name = "TestChain"
359
- chain.rpcs = ["https://rpc"]
360
- chain.chain_id = 1
361
- chain.native_currency = "ETH"
362
- type(chain).rpc = PropertyMock(return_value="https://rpc")
363
-
364
- ci = ChainInterface(chain)
365
- ci.web3.eth.get_transaction_count.return_value = 0
366
- ci.web3.eth.gas_price = 1000000000 # 1 gwei
367
- ci.web3.eth.estimate_gas.return_value = 21000
368
- ci.web3.eth.get_balance.return_value = 1000 # Very low balance
369
- ci.web3.from_wei.return_value = 0.000001
370
-
371
- sign_callback = MagicMock()
372
-
373
- success, tx_hash = ci.send_native_transfer(
374
- from_address="0x1111111111111111111111111111111111111111",
375
- to_address="0x2222222222222222222222222222222222222222",
376
- value_wei=10**18, # 1 ETH - more than available
377
- sign_callback=sign_callback,
378
- )
379
-
380
- assert success is False
381
- assert tx_hash is None
382
- sign_callback.assert_not_called()
383
-
384
-
385
- def test_send_native_transfer_rpc_error(mock_web3):
386
- """Test send_native_transfer handles RPC errors."""
387
- chain = MagicMock(spec=SupportedChain)
388
- chain.name = "TestChain"
389
- chain.rpcs = ["https://rpc"]
390
- chain.chain_id = 1
391
- chain.native_currency = "ETH"
392
- type(chain).rpc = PropertyMock(return_value="https://rpc")
393
-
394
- ci = ChainInterface(chain)
395
- ci.web3.eth.get_transaction_count.return_value = 0
396
- ci.web3.eth.gas_price = 1000000000
397
- ci.web3.eth.estimate_gas.return_value = 21000
398
- ci.web3.eth.get_balance.return_value = 10**19 # Enough balance
399
- ci.web3.from_wei.return_value = 10.0
400
- ci.web3.eth.send_raw_transaction.side_effect = Exception("Connection refused")
401
-
402
- sign_callback = MagicMock()
403
- sign_callback.return_value = MagicMock(raw_transaction=b"signed")
404
-
405
- success, tx_hash = ci.send_native_transfer(
406
- from_address="0x1111111111111111111111111111111111111111",
407
- to_address="0x2222222222222222222222222222222222222222",
408
- value_wei=10**17,
409
- sign_callback=sign_callback,
410
- )
411
-
412
- assert success is False
413
- assert tx_hash is None
414
-
415
320
 
416
321
  def test_get_token_symbol_fallback_on_error(mock_web3):
417
322
  """Test get_token_symbol returns truncated address on error."""
@@ -345,23 +345,23 @@ def test_send_native_success(wallet, mock_key_storage, mock_chain_interfaces, mo
345
345
  mock_key_storage.get_account.return_value = account
346
346
 
347
347
  chain_interface = mock_chain_interfaces.get.return_value
348
- # chain_interface.get_native_balance_wei.return_value = ... # Ignored
349
348
  mock_balance_service.get_native_balance_wei.return_value = 2000000000000000000
350
349
 
351
350
  chain_interface.web3.eth.gas_price = 1000000000
352
351
  chain_interface.web3.eth.estimate_gas.return_value = 21000
353
352
  chain_interface.web3.from_wei.side_effect = lambda val, unit: float(val) / 10**18
354
353
 
355
- # Mock return values for success
356
- chain_interface.sign_and_send_transaction.return_value = (True, {})
357
- chain_interface.send_native_transfer.return_value = (True, "0xHash")
354
+ # Mock TransactionService return (native transfers now go through TransactionService)
355
+ wallet.transaction_service.sign_and_send.return_value = (
356
+ True,
357
+ {"status": 1, "transactionHash": b"hash"},
358
+ )
358
359
 
359
360
  wallet.send(
360
361
  "sender", VALID_ADDR_2, amount_wei=1000000000000000000, token_address_or_name="native"
361
362
  ) # 1 ETH
362
363
 
363
- # wallet.transaction_service.sign_and_send.assert_called_once()
364
- chain_interface.send_native_transfer.assert_called_once()
364
+ wallet.transaction_service.sign_and_send.assert_called_once()
365
365
 
366
366
 
367
367
  def test_send_erc20_success(wallet, mock_key_storage, mock_chain_interfaces):
@@ -18,8 +18,19 @@ def mock_chain_interfaces():
18
18
  gnosis_interface.web3 = MagicMock()
19
19
  instance.get.return_value = gnosis_interface
20
20
 
21
- # Mock with_retry to execute the operation
22
- gnosis_interface.with_retry.side_effect = lambda op, **kwargs: op()
21
+ # Mock with_retry to simulate retry behavior (up to 6 attempts)
22
+ def mock_with_retry(op, max_retries=6, **kwargs):
23
+ last_error = None
24
+ for attempt in range(max_retries + 1):
25
+ try:
26
+ return op()
27
+ except Exception as e:
28
+ last_error = e
29
+ if attempt >= max_retries:
30
+ raise
31
+ raise last_error
32
+
33
+ gnosis_interface.with_retry.side_effect = mock_with_retry
23
34
 
24
35
  yield instance
25
36
 
@@ -100,7 +111,7 @@ def test_sign_and_send_retry_on_low_gas(
100
111
  def test_sign_and_send_max_retries_exhausted(
101
112
  transaction_service, mock_key_storage, mock_chain_interfaces
102
113
  ):
103
- """Test sign_and_send fails after max gas retries."""
114
+ """Test sign_and_send fails after max retries (with_retry default of 6 + 1)."""
104
115
  tx = {"to": "0x123", "value": 100, "nonce": 5, "gas": 10000}
105
116
  mock_key_storage.sign_transaction.return_value = MagicMock(raw_transaction=b"raw_tx")
106
117
 
@@ -119,8 +130,8 @@ def test_sign_and_send_max_retries_exhausted(
119
130
  # Should fail after max retries
120
131
  assert success is False
121
132
  assert receipt == {} # Returns empty dict on failure
122
- # Should have tried 10 times (max_retries)
123
- assert chain_interface.web3.eth.send_raw_transaction.call_count == 10
133
+ # Should have tried 7 times (6 retries + 1 initial = max_retries+1 from with_retry)
134
+ assert chain_interface.web3.eth.send_raw_transaction.call_count == 7
124
135
 
125
136
 
126
137
  def test_sign_and_send_transaction_reverted(
@@ -144,7 +155,11 @@ def test_sign_and_send_transaction_reverted(
144
155
  def test_sign_and_send_rpc_error_triggers_rotation(
145
156
  transaction_service, mock_key_storage, mock_chain_interfaces
146
157
  ):
147
- """Test sign_and_send rotates RPC on connection error."""
158
+ """Test sign_and_send retries on connection error via with_retry.
159
+
160
+ RPC rotation is now handled internally by with_retry, so we just verify
161
+ that the operation retries and eventually succeeds.
162
+ """
148
163
  tx = {"to": "0x123", "value": 100, "nonce": 5, "gas": 21000}
149
164
  mock_key_storage.sign_transaction.return_value = MagicMock(raw_transaction=b"raw_tx")
150
165
 
@@ -156,13 +171,13 @@ def test_sign_and_send_rpc_error_triggers_rotation(
156
171
  b"tx_hash",
157
172
  ]
158
173
  chain_interface.web3.eth.wait_for_transaction_receipt.return_value = MagicMock(status=1)
159
- chain_interface.rotate_rpc.return_value = True
160
174
 
161
175
  with patch("time.sleep"):
162
176
  success, receipt = transaction_service.sign_and_send(tx, "signer")
163
177
 
164
178
  assert success is True
165
- chain_interface.rotate_rpc.assert_called()
179
+ # Verify retry happened - send_raw_transaction called twice
180
+ assert chain_interface.web3.eth.send_raw_transaction.call_count == 2
166
181
 
167
182
 
168
183
  def test_sign_and_send_signer_not_found(
@@ -1,17 +1,25 @@
1
1
  """Tests for staking.py router coverage."""
2
2
 
3
+ import sys
3
4
  from unittest.mock import MagicMock, patch
4
5
 
5
6
  import pytest
6
7
 
7
8
 
8
9
  @pytest.fixture(autouse=True)
9
- def mock_key_storage():
10
- """Bypass KeyStorage security check."""
11
- with (
12
- patch("iwa.core.keys.KeyStorage.__init__", return_value=None),
13
- patch("iwa.web.dependencies.wallet", MagicMock()),
14
- ):
10
+ def mock_dependencies():
11
+ """Mock wallet dependency before importing router modules.
12
+
13
+ The iwa.web.dependencies module instantiates Wallet() at module level,
14
+ which fails in test environment. We pre-populate sys.modules to prevent
15
+ the actual import.
16
+ """
17
+ # Create mock module
18
+ mock_dep_module = MagicMock()
19
+ mock_dep_module.wallet = MagicMock()
20
+
21
+ # Pre-populate sys.modules to prevent real import
22
+ with patch.dict(sys.modules, {"iwa.web.dependencies": mock_dep_module}):
15
23
  yield
16
24
 
17
25
 
@@ -56,8 +56,19 @@ def mock_chain_interfaces():
56
56
 
57
57
  instance.get.return_value = gnosis_interface
58
58
 
59
- # Mock with_retry to execute the operation
60
- gnosis_interface.with_retry.side_effect = lambda op, **kwargs: op()
59
+ # Mock with_retry to simulate retry behavior (up to 6 attempts)
60
+ def mock_with_retry(op, max_retries=6, **kwargs):
61
+ last_error = None
62
+ for attempt in range(max_retries + 1):
63
+ try:
64
+ return op()
65
+ except Exception as e:
66
+ last_error = e
67
+ if attempt >= max_retries:
68
+ raise
69
+ raise last_error
70
+
71
+ gnosis_interface.with_retry.side_effect = mock_with_retry
61
72
 
62
73
  yield instance
63
74
 
@@ -68,7 +79,6 @@ def mock_external_deps():
68
79
  with (
69
80
  patch("iwa.core.services.transaction.log_transaction") as mock_log,
70
81
  patch("iwa.core.pricing.PriceService") as mock_price,
71
- patch("iwa.core.services.transaction.time.sleep") as _, # speed up tests
72
82
  ):
73
83
  mock_price.return_value.get_token_price.return_value = 1.0 # 1 EUR per Token
74
84
  yield {
@@ -146,7 +156,11 @@ def test_sign_and_send_low_gas_retry(
146
156
  def test_sign_and_send_rpc_rotation(
147
157
  mock_key_storage, mock_account_service, mock_chain_interfaces, mock_external_deps
148
158
  ):
149
- """Test RPC rotation on generic error."""
159
+ """Test retry on generic error via with_retry.
160
+
161
+ RPC rotation is now handled internally by with_retry, so we just verify
162
+ that the operation retries and eventually succeeds.
163
+ """
150
164
  service = TransactionService(mock_key_storage, mock_account_service)
151
165
  chain_interface = mock_chain_interfaces.get.return_value
152
166
 
@@ -155,11 +169,11 @@ def test_sign_and_send_rpc_rotation(
155
169
  Exception("Connection reset"),
156
170
  b"tx_hash_bytes",
157
171
  ]
158
- chain_interface.rotate_rpc.return_value = True
159
172
 
160
173
  tx = {"to": "0xDest", "value": 100}
161
174
 
162
175
  success, receipt = service.sign_and_send(tx, "signer")
163
176
 
164
177
  assert success is True
165
- chain_interface.rotate_rpc.assert_called_once()
178
+ # Verify retry happened - send_raw_transaction called twice
179
+ assert chain_interface.web3.eth.send_raw_transaction.call_count == 2
File without changes