web3 6.17.1__py3-none-any.whl → 6.18.0__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.
web3/_utils/decorators.py CHANGED
@@ -35,22 +35,37 @@ def reject_recursive_repeats(to_wrap: Callable[..., Any]) -> Callable[..., Any]:
35
35
  return wrapped
36
36
 
37
37
 
38
- def deprecated_for(replace_message: str) -> Callable[..., Any]:
38
+ def deprecate_method(
39
+ replacement_method: str = None, deprecation_msg: str = None
40
+ ) -> Callable[..., Any]:
39
41
  """
40
- Decorate a deprecated function, with info about what to use instead, like:
42
+ Decorate a deprecated function with info on its replacement method OR a clarifying
43
+ reason for the deprecation.
41
44
 
42
- @deprecated_for("to_bytes()")
43
- def toAscii(arg):
45
+ @deprecate_method("to_bytes()")
46
+ def to_ascii(arg):
47
+ ...
48
+
49
+ @deprecate_method(deprecation_msg=(
50
+ "This method is no longer supported and will be removed in the next release."
51
+ ))
52
+ def some_method(arg):
44
53
  ...
45
54
  """
55
+ if replacement_method is None and deprecation_msg is None:
56
+ raise ValueError(
57
+ "Must provide either `replacement_method` or `deprecation_msg`"
58
+ )
46
59
 
47
60
  def decorator(to_wrap: TFunc) -> TFunc:
48
61
  @functools.wraps(to_wrap)
49
62
  def wrapper(*args: Any, **kwargs: Any) -> Callable[..., Any]:
50
- warnings.warn(
51
- f"{to_wrap.__name__} is deprecated in favor of {replace_message}",
52
- category=DeprecationWarning,
63
+ msg = (
64
+ f"{to_wrap.__name__} is deprecated in favor of {replacement_method}"
65
+ if replacement_method is not None
66
+ else deprecation_msg
53
67
  )
68
+ warnings.warn(msg, category=DeprecationWarning)
54
69
  return to_wrap(*args, **kwargs)
55
70
 
56
71
  return cast(TFunc, wrapper)
web3/_utils/miner.py CHANGED
@@ -28,18 +28,14 @@ _make_dag: Method[Callable[[BlockNumber], bool]] = Method(
28
28
  mungers=[default_root_munger],
29
29
  )
30
30
 
31
- make_dag = DeprecatedMethod(
32
- _make_dag, "make_dag", msg="All mining methods have been deprecated"
33
- )
31
+ make_dag = DeprecatedMethod(_make_dag, msg="All mining methods have been deprecated")
34
32
 
35
33
  _set_extra: Method[Callable[[str], bool]] = Method(
36
34
  RPC.miner_setExtra,
37
35
  mungers=[default_root_munger],
38
36
  )
39
37
 
40
- set_extra = DeprecatedMethod(
41
- _set_extra, "set_extra", msg="All mining methods have been deprecated"
42
- )
38
+ set_extra = DeprecatedMethod(_set_extra, msg="All mining methods have been deprecated")
43
39
 
44
40
  _set_etherbase: Method[Callable[[ChecksumAddress], bool]] = Method(
45
41
  RPC.miner_setEtherbase,
@@ -47,7 +43,7 @@ _set_etherbase: Method[Callable[[ChecksumAddress], bool]] = Method(
47
43
  )
48
44
 
49
45
  set_etherbase = DeprecatedMethod(
50
- _set_etherbase, "set_etherbase", msg="All mining methods have been deprecated"
46
+ _set_etherbase, msg="All mining methods have been deprecated"
51
47
  )
52
48
 
53
49
  _set_gas_price: Method[Callable[[Wei], bool]] = Method(
@@ -56,7 +52,7 @@ _set_gas_price: Method[Callable[[Wei], bool]] = Method(
56
52
  )
57
53
 
58
54
  set_gas_price = DeprecatedMethod(
59
- _set_gas_price, "set_gas_price", msg="All mining methods have been deprecated"
55
+ _set_gas_price, msg="All mining methods have been deprecated"
60
56
  )
61
57
 
62
58
  _start: Method[Callable[[int], bool]] = Method(
@@ -64,14 +60,14 @@ _start: Method[Callable[[int], bool]] = Method(
64
60
  mungers=[default_root_munger],
65
61
  )
66
62
 
67
- start = DeprecatedMethod(_start, "start", msg="All mining methods have been deprecated")
63
+ start = DeprecatedMethod(_start, msg="All mining methods have been deprecated")
68
64
 
69
65
  _stop: Method[Callable[[], bool]] = Method(
70
66
  RPC.miner_stop,
71
67
  is_property=True,
72
68
  )
73
69
 
74
- stop = DeprecatedMethod(_stop, "stop", msg="All mining methods have been deprecated")
70
+ stop = DeprecatedMethod(_stop, msg="All mining methods have been deprecated")
75
71
 
76
72
  _start_auto_dag: Method[Callable[[], bool]] = Method(
77
73
  RPC.miner_startAutoDag,
@@ -79,7 +75,7 @@ _start_auto_dag: Method[Callable[[], bool]] = Method(
79
75
  )
80
76
 
81
77
  start_auto_dag = DeprecatedMethod(
82
- _start_auto_dag, "start_auto_dag", msg="All mining methods have been deprecated"
78
+ _start_auto_dag, msg="All mining methods have been deprecated"
83
79
  )
84
80
 
85
81
  _stop_auto_dag: Method[Callable[[], bool]] = Method(
@@ -88,5 +84,5 @@ _stop_auto_dag: Method[Callable[[], bool]] = Method(
88
84
  )
89
85
 
90
86
  stop_auto_dag = DeprecatedMethod(
91
- _stop_auto_dag, "stop_auto_dag", msg="All mining methods have been deprecated"
87
+ _stop_auto_dag, msg="All mining methods have been deprecated"
92
88
  )
@@ -55,17 +55,20 @@ ACCOUNT_FOR_UNLOCK = "0x12efDc31B1a8FA1A1e756DFD8A1601055C971E13"
55
55
 
56
56
  class GoEthereumPersonalModuleTest:
57
57
  def test_personal_import_raw_key(self, w3: "Web3") -> None:
58
- actual = w3.geth.personal.import_raw_key(PRIVATE_KEY_HEX, PASSWORD)
58
+ with pytest.warns(DeprecationWarning):
59
+ actual = w3.geth.personal.import_raw_key(PRIVATE_KEY_HEX, PASSWORD)
59
60
  assert actual == ADDRESS
60
61
 
61
62
  def test_personal_list_accounts(self, w3: "Web3") -> None:
62
- accounts = w3.geth.personal.list_accounts()
63
+ with pytest.warns(DeprecationWarning):
64
+ accounts = w3.geth.personal.list_accounts()
63
65
  assert is_list_like(accounts)
64
66
  assert len(accounts) > 0
65
67
  assert all((is_checksum_address(item) for item in accounts))
66
68
 
67
69
  def test_personal_list_wallets(self, w3: "Web3") -> None:
68
- wallets = w3.geth.personal.list_wallets()
70
+ with pytest.warns(DeprecationWarning):
71
+ wallets = w3.geth.personal.list_wallets()
69
72
  assert is_list_like(wallets)
70
73
  assert len(wallets) > 0
71
74
  assert is_checksum_address(wallets[0]["accounts"][0]["address"])
@@ -76,8 +79,8 @@ class GoEthereumPersonalModuleTest:
76
79
  def test_personal_lock_account(
77
80
  self, w3: "Web3", unlockable_account_dual_type: ChecksumAddress
78
81
  ) -> None:
79
- # TODO: how do we test this better?
80
- w3.geth.personal.lock_account(unlockable_account_dual_type)
82
+ with pytest.warns(DeprecationWarning):
83
+ w3.geth.personal.lock_account(unlockable_account_dual_type)
81
84
 
82
85
  def test_personal_unlock_account_success(
83
86
  self,
@@ -85,9 +88,10 @@ class GoEthereumPersonalModuleTest:
85
88
  unlockable_account_dual_type: ChecksumAddress,
86
89
  unlockable_account_pw: str,
87
90
  ) -> None:
88
- result = w3.geth.personal.unlock_account(
89
- unlockable_account_dual_type, unlockable_account_pw
90
- )
91
+ with pytest.warns(DeprecationWarning):
92
+ result = w3.geth.personal.unlock_account(
93
+ unlockable_account_dual_type, unlockable_account_pw
94
+ )
91
95
  assert result is True
92
96
 
93
97
  def test_personal_unlock_account_failure(
@@ -99,7 +103,8 @@ class GoEthereumPersonalModuleTest:
99
103
  )
100
104
 
101
105
  def test_personal_new_account(self, w3: "Web3") -> None:
102
- new_account = w3.geth.personal.new_account(PASSWORD)
106
+ with pytest.warns(DeprecationWarning):
107
+ new_account = w3.geth.personal.new_account(PASSWORD)
103
108
  assert is_checksum_address(new_account)
104
109
 
105
110
  def test_personal_send_transaction(
@@ -118,7 +123,10 @@ class GoEthereumPersonalModuleTest:
118
123
  "value": Wei(1),
119
124
  "gasPrice": w3.to_wei(1, "gwei"),
120
125
  }
121
- txn_hash = w3.geth.personal.send_transaction(txn_params, unlockable_account_pw)
126
+ with pytest.warns(DeprecationWarning):
127
+ txn_hash = w3.geth.personal.send_transaction(
128
+ txn_params, unlockable_account_pw
129
+ )
122
130
  assert txn_hash
123
131
  transaction = w3.eth.get_transaction(txn_hash)
124
132
 
@@ -139,10 +147,13 @@ class GoEthereumPersonalModuleTest:
139
147
  unlockable_account_pw: str,
140
148
  ) -> None:
141
149
  message = "test-web3-geth-personal-sign"
142
- signature = w3.geth.personal.sign(
143
- message, unlockable_account_dual_type, unlockable_account_pw
144
- )
145
- signer = w3.geth.personal.ec_recover(message, signature)
150
+ with pytest.warns(DeprecationWarning):
151
+ signature = w3.geth.personal.sign(
152
+ message, unlockable_account_dual_type, unlockable_account_pw
153
+ )
154
+
155
+ with pytest.warns(DeprecationWarning):
156
+ signer = w3.geth.personal.ec_recover(message, signature)
146
157
  assert is_same_address(signer, unlockable_account_dual_type)
147
158
 
148
159
  @pytest.mark.xfail(
@@ -193,13 +204,14 @@ class GoEthereumPersonalModuleTest:
193
204
  }
194
205
  }
195
206
  """
196
- signature = HexBytes(
197
- w3.geth.personal.sign_typed_data(
198
- json.loads(typed_message),
199
- unlockable_account_dual_type,
200
- unlockable_account_pw,
207
+ with pytest.warns(DeprecationWarning):
208
+ signature = HexBytes(
209
+ w3.geth.personal.sign_typed_data(
210
+ json.loads(typed_message),
211
+ unlockable_account_dual_type,
212
+ unlockable_account_pw,
213
+ )
201
214
  )
202
- )
203
215
 
204
216
  expected_signature = HexBytes(
205
217
  "0xc8b56aaeefd10ab4005c2455daf28d9082af661ac347cd"
@@ -219,33 +231,38 @@ class GoEthereumAsyncPersonalModuleTest:
219
231
  unlockable_account_pw: str,
220
232
  ) -> None:
221
233
  message = "This is a test"
222
- signature = await async_w3.geth.personal.sign(
223
- message, async_unlockable_account_dual_type, unlockable_account_pw
224
- )
234
+ with pytest.warns(DeprecationWarning):
235
+ signature = await async_w3.geth.personal.sign(
236
+ message, async_unlockable_account_dual_type, unlockable_account_pw
237
+ )
225
238
  address = await async_w3.geth.personal.ec_recover(message, signature)
226
239
  assert is_same_address(async_unlockable_account_dual_type, address)
227
240
 
228
241
  @pytest.mark.asyncio
229
242
  async def test_async_import_key(self, async_w3: "AsyncWeb3") -> None:
230
- address = await async_w3.geth.personal.import_raw_key(
231
- THIRD_PRIVATE_KEY_HEX, "Testing"
232
- )
243
+ with pytest.warns(DeprecationWarning):
244
+ address = await async_w3.geth.personal.import_raw_key(
245
+ THIRD_PRIVATE_KEY_HEX, "Testing"
246
+ )
233
247
  assert address is not None
234
248
 
235
249
  @pytest.mark.asyncio
236
250
  async def test_async_list_accounts(self, async_w3: "AsyncWeb3") -> None:
237
- accounts = await async_w3.geth.personal.list_accounts()
251
+ with pytest.warns(DeprecationWarning):
252
+ accounts = await async_w3.geth.personal.list_accounts()
238
253
  assert len(accounts) > 0
239
254
 
240
255
  @pytest.mark.asyncio
241
256
  async def test_async_list_wallets(self, async_w3: "AsyncWeb3") -> None:
242
- wallets = await async_w3.geth.personal.list_wallets()
257
+ with pytest.warns(DeprecationWarning):
258
+ wallets = await async_w3.geth.personal.list_wallets()
243
259
  assert isinstance(wallets[0], AttributeDict)
244
260
 
245
261
  @pytest.mark.asyncio
246
262
  async def test_async_new_account(self, async_w3: "AsyncWeb3") -> None:
247
263
  passphrase = "Create New Account"
248
- account = await async_w3.geth.personal.new_account(passphrase)
264
+ with pytest.warns(DeprecationWarning):
265
+ account = await async_w3.geth.personal.new_account(passphrase)
249
266
  assert is_checksum_address(account)
250
267
 
251
268
  @pytest.mark.asyncio
@@ -255,13 +272,16 @@ class GoEthereumAsyncPersonalModuleTest:
255
272
  async_unlockable_account_dual_type: ChecksumAddress,
256
273
  unlockable_account_pw: str,
257
274
  ) -> None:
258
- unlocked = await async_w3.geth.personal.unlock_account(
259
- async_unlockable_account_dual_type, unlockable_account_pw
260
- )
275
+ with pytest.warns(DeprecationWarning):
276
+ unlocked = await async_w3.geth.personal.unlock_account(
277
+ async_unlockable_account_dual_type, unlockable_account_pw
278
+ )
261
279
  assert unlocked is True
262
- locked = await async_w3.geth.personal.lock_account(
263
- async_unlockable_account_dual_type
264
- )
280
+
281
+ with pytest.warns(DeprecationWarning):
282
+ locked = await async_w3.geth.personal.lock_account(
283
+ async_unlockable_account_dual_type
284
+ )
265
285
  assert locked is True
266
286
 
267
287
  @pytest.mark.asyncio
@@ -275,9 +295,10 @@ class GoEthereumAsyncPersonalModuleTest:
275
295
  tx_params["to"] = async_unlockable_account_dual_type
276
296
  tx_params["from"] = async_unlockable_account_dual_type
277
297
  tx_params["value"] = Wei(123)
278
- response = await async_w3.geth.personal.send_transaction(
279
- tx_params, unlockable_account_pw
280
- )
298
+ with pytest.warns(DeprecationWarning):
299
+ response = await async_w3.geth.personal.send_transaction(
300
+ tx_params, unlockable_account_pw
301
+ )
281
302
  assert response is not None
282
303
 
283
304
  @pytest.mark.xfail(
@@ -291,10 +312,12 @@ class GoEthereumAsyncPersonalModuleTest:
291
312
  unlockable_account_pw: str,
292
313
  ) -> None:
293
314
  message = {"message": "This is a test"}
294
- signature = await async_w3.geth.personal.sign_typed_data(
295
- message, async_unlockable_account_dual_type, unlockable_account_pw
296
- )
297
- address = await async_w3.geth.personal.ec_recover(
298
- json.dumps(message), signature
299
- )
315
+ with pytest.warns(DeprecationWarning):
316
+ signature = await async_w3.geth.personal.sign_typed_data(
317
+ message, async_unlockable_account_dual_type, unlockable_account_pw
318
+ )
319
+ with pytest.warns(DeprecationWarning):
320
+ address = await async_w3.geth.personal.ec_recover(
321
+ json.dumps(message), signature
322
+ )
300
323
  assert is_same_address(async_unlockable_account_dual_type, address)
@@ -57,7 +57,7 @@ from web3._utils.datatypes import (
57
57
  PropertyCheckingFactory,
58
58
  )
59
59
  from web3._utils.decorators import (
60
- deprecated_for,
60
+ deprecate_method,
61
61
  )
62
62
  from web3._utils.empty import (
63
63
  empty,
@@ -727,7 +727,7 @@ class BaseContract:
727
727
  # Public API
728
728
  #
729
729
  @combomethod
730
- @deprecated_for("encode_abi()")
730
+ @deprecate_method("encode_abi()")
731
731
  def encodeABI(
732
732
  cls,
733
733
  fn_name: str,
web3/geth.py CHANGED
@@ -21,6 +21,9 @@ from hexbytes.main import (
21
21
  from web3._utils.compat import (
22
22
  Protocol,
23
23
  )
24
+ from web3._utils.decorators import (
25
+ deprecate_method,
26
+ )
24
27
  from web3._utils.miner import (
25
28
  make_dag,
26
29
  set_etherbase,
@@ -35,6 +38,7 @@ from web3._utils.rpc_abi import (
35
38
  RPC,
36
39
  )
37
40
  from web3.method import (
41
+ DeprecatedMethod,
38
42
  Method,
39
43
  default_root_munger,
40
44
  )
@@ -63,6 +67,12 @@ class UnlockAccountWrapper(Protocol):
63
67
  pass
64
68
 
65
69
 
70
+ GETH_PERSONAL_DEPRECATION_MSG = (
71
+ "Geth now uses `clef` for account and key management. This method will be removed "
72
+ "in web3.py `v7`."
73
+ )
74
+
75
+
66
76
  class GethPersonal(Module):
67
77
  """
68
78
  https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-personal
@@ -70,57 +80,75 @@ class GethPersonal(Module):
70
80
 
71
81
  is_async = False
72
82
 
73
- ec_recover: Method[Callable[[str, HexStr], ChecksumAddress]] = Method(
83
+ _ec_recover: Method[Callable[[str, HexStr], ChecksumAddress]] = Method(
74
84
  RPC.personal_ecRecover,
75
85
  mungers=[default_root_munger],
76
86
  )
87
+ ec_recover = DeprecatedMethod(_ec_recover, msg=GETH_PERSONAL_DEPRECATION_MSG)
77
88
 
78
- import_raw_key: Method[Callable[[str, str], ChecksumAddress]] = Method(
89
+ _import_raw_key: Method[Callable[[str, str], ChecksumAddress]] = Method(
79
90
  RPC.personal_importRawKey,
80
91
  mungers=[default_root_munger],
81
92
  )
93
+ import_raw_key = DeprecatedMethod(
94
+ _import_raw_key, msg=GETH_PERSONAL_DEPRECATION_MSG
95
+ )
82
96
 
83
- list_accounts: Method[Callable[[], List[ChecksumAddress]]] = Method(
97
+ _list_accounts: Method[Callable[[], List[ChecksumAddress]]] = Method(
84
98
  RPC.personal_listAccounts,
85
99
  is_property=True,
86
100
  )
101
+ list_accounts = DeprecatedMethod(_list_accounts, msg=GETH_PERSONAL_DEPRECATION_MSG)
87
102
 
88
- list_wallets: Method[Callable[[], List[GethWallet]]] = Method(
103
+ _list_wallets: Method[Callable[[], List[GethWallet]]] = Method(
89
104
  RPC.personal_listWallets,
90
105
  is_property=True,
91
106
  )
107
+ list_wallets = DeprecatedMethod(_list_wallets, msg=GETH_PERSONAL_DEPRECATION_MSG)
92
108
 
93
- send_transaction: Method[Callable[[TxParams, str], HexBytes]] = Method(
109
+ _send_transaction: Method[Callable[[TxParams, str], HexBytes]] = Method(
94
110
  RPC.personal_sendTransaction,
95
111
  mungers=[default_root_munger],
96
112
  )
113
+ send_transaction = DeprecatedMethod(
114
+ _send_transaction, msg=GETH_PERSONAL_DEPRECATION_MSG
115
+ )
97
116
 
98
- sign: Method[Callable[[str, ChecksumAddress, Optional[str]], HexStr]] = Method(
117
+ _sign: Method[Callable[[str, ChecksumAddress, Optional[str]], HexStr]] = Method(
99
118
  RPC.personal_sign,
100
119
  mungers=[default_root_munger],
101
120
  )
121
+ sign = DeprecatedMethod(_sign, msg=GETH_PERSONAL_DEPRECATION_MSG)
102
122
 
103
- sign_typed_data: Method[
123
+ _sign_typed_data: Method[
104
124
  Callable[[Dict[str, Any], ChecksumAddress, str], HexStr]
105
125
  ] = Method(
106
126
  RPC.personal_signTypedData,
107
127
  mungers=[default_root_munger],
108
128
  )
129
+ sign_typed_data = DeprecatedMethod(
130
+ _sign_typed_data, msg=GETH_PERSONAL_DEPRECATION_MSG
131
+ )
109
132
 
110
- new_account: Method[Callable[[str], ChecksumAddress]] = Method(
133
+ _new_account: Method[Callable[[str], ChecksumAddress]] = Method(
111
134
  RPC.personal_newAccount,
112
135
  mungers=[default_root_munger],
113
136
  )
137
+ new_account = DeprecatedMethod(_new_account, msg=GETH_PERSONAL_DEPRECATION_MSG)
114
138
 
115
- lock_account: Method[Callable[[ChecksumAddress], bool]] = Method(
139
+ _lock_account: Method[Callable[[ChecksumAddress], bool]] = Method(
116
140
  RPC.personal_lockAccount,
117
141
  mungers=[default_root_munger],
118
142
  )
143
+ lock_account = DeprecatedMethod(_lock_account, msg=GETH_PERSONAL_DEPRECATION_MSG)
119
144
 
120
- unlock_account: Method[UnlockAccountWrapper] = Method(
145
+ _unlock_account: Method[UnlockAccountWrapper] = Method(
121
146
  RPC.personal_unlockAccount,
122
147
  mungers=[default_root_munger],
123
148
  )
149
+ unlock_account = DeprecatedMethod(
150
+ _unlock_account, msg=GETH_PERSONAL_DEPRECATION_MSG
151
+ )
124
152
 
125
153
 
126
154
  class GethTxPool(Module):
@@ -373,6 +401,7 @@ class AsyncGethPersonal(Module):
373
401
  mungers=[default_root_munger],
374
402
  )
375
403
 
404
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
376
405
  async def ec_recover(self, message: str, signature: HexStr) -> ChecksumAddress:
377
406
  return await self._ec_recover(message, signature)
378
407
 
@@ -383,6 +412,7 @@ class AsyncGethPersonal(Module):
383
412
  mungers=[default_root_munger],
384
413
  )
385
414
 
415
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
386
416
  async def import_raw_key(
387
417
  self, private_key: str, passphrase: str
388
418
  ) -> ChecksumAddress:
@@ -400,9 +430,11 @@ class AsyncGethPersonal(Module):
400
430
  is_property=True,
401
431
  )
402
432
 
433
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
403
434
  async def list_accounts(self) -> List[ChecksumAddress]:
404
435
  return await self._list_accounts()
405
436
 
437
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
406
438
  async def list_wallets(self) -> List[GethWallet]:
407
439
  return await self._list_wallets()
408
440
 
@@ -413,6 +445,7 @@ class AsyncGethPersonal(Module):
413
445
  mungers=[default_root_munger],
414
446
  )
415
447
 
448
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
416
449
  async def send_transaction(
417
450
  self, transaction: TxParams, passphrase: str
418
451
  ) -> HexBytes:
@@ -434,11 +467,13 @@ class AsyncGethPersonal(Module):
434
467
  mungers=[default_root_munger],
435
468
  )
436
469
 
470
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
437
471
  async def sign(
438
472
  self, message: str, account: ChecksumAddress, passphrase: str
439
473
  ) -> HexStr:
440
474
  return await self._sign(message, account, passphrase)
441
475
 
476
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
442
477
  async def sign_typed_data(
443
478
  self, message: Dict[str, Any], account: ChecksumAddress, passphrase: str
444
479
  ) -> HexStr:
@@ -463,12 +498,15 @@ class AsyncGethPersonal(Module):
463
498
  mungers=[default_root_munger],
464
499
  )
465
500
 
501
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
466
502
  async def new_account(self, passphrase: str) -> ChecksumAddress:
467
503
  return await self._new_account(passphrase)
468
504
 
505
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
469
506
  async def lock_account(self, account: ChecksumAddress) -> bool:
470
507
  return await self._lock_account(account)
471
508
 
509
+ @deprecate_method(deprecation_msg=GETH_PERSONAL_DEPRECATION_MSG)
472
510
  async def unlock_account(
473
511
  self, account: ChecksumAddress, passphrase: str, duration: Optional[int] = None
474
512
  ) -> bool:
web3/method.py CHANGED
@@ -220,7 +220,7 @@ class DeprecatedMethod:
220
220
  def __init__(
221
221
  self,
222
222
  method: Method[Callable[..., Any]],
223
- old_name: str,
223
+ old_name: Optional[str] = None,
224
224
  new_name: Optional[str] = None,
225
225
  msg: Optional[str] = None,
226
226
  ) -> None:
@@ -232,9 +232,17 @@ class DeprecatedMethod:
232
232
  def __get__(
233
233
  self, obj: Optional["Module"] = None, obj_type: Optional[Type["Module"]] = None
234
234
  ) -> Any:
235
- message = f"{self.old_name} is deprecated in favor of {self.new_name}"
236
- if self.msg is not None:
235
+ if self.old_name is not None and self.new_name is not None:
236
+ if self.msg is not None:
237
+ raise ValueError(
238
+ "Cannot specify `old_name` and `new_name` along with `msg`"
239
+ )
240
+
241
+ message = f"{self.old_name} is deprecated in favor of {self.new_name}"
242
+ elif self.msg is not None:
237
243
  message = self.msg
244
+ else:
245
+ raise ValueError("Must provide either `old_name` and `new_name` or `msg`")
238
246
 
239
247
  warnings.warn(
240
248
  message,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: web3
3
- Version: 6.17.1
3
+ Version: 6.18.0
4
4
  Summary: web3.py
5
5
  Home-page: https://github.com/ethereum/web3.py
6
6
  Author: The Ethereum Foundation
@@ -24,7 +24,7 @@ Requires-Dist: aiohttp >=3.7.4.post0
24
24
  Requires-Dist: eth-abi >=4.0.0
25
25
  Requires-Dist: eth-account <0.13,>=0.8.0
26
26
  Requires-Dist: eth-hash[pycryptodome] >=0.5.1
27
- Requires-Dist: eth-typing <4.2.0,>=3.0.0
27
+ Requires-Dist: eth-typing !=4.2.0,>=3.0.0
28
28
  Requires-Dist: eth-utils >=2.1.0
29
29
  Requires-Dist: hexbytes <0.4.0,>=0.1.0
30
30
  Requires-Dist: jsonschema >=4.0.0
@@ -46,7 +46,7 @@ Requires-Dist: flaky >=3.7.0 ; extra == 'dev'
46
46
  Requires-Dist: hypothesis >=3.31.2 ; extra == 'dev'
47
47
  Requires-Dist: pre-commit >=2.21.0 ; extra == 'dev'
48
48
  Requires-Dist: pytest >=7.0.0 ; extra == 'dev'
49
- Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'dev'
49
+ Requires-Dist: pytest-asyncio <0.23,>=0.21.2 ; extra == 'dev'
50
50
  Requires-Dist: pytest-mock >=1.10 ; extra == 'dev'
51
51
  Requires-Dist: pytest-watch >=4.2 ; extra == 'dev'
52
52
  Requires-Dist: pytest-xdist >=1.29 ; extra == 'dev'
@@ -118,11 +118,11 @@ web3/__init__.py,sha256=tieKn-7-iyxdwx_tI7eUGWBpSkawfI2_3pCnwh8PRP4,972
118
118
  web3/constants.py,sha256=eQLRQVMFPbgpOjjkPTMHkY-syncJuO-sPX5UrCSRjzQ,564
119
119
  web3/datastructures.py,sha256=5SuX36p-hGuiK3RwnG8yVsgROvkqzHdDKfTGSzghSy0,9234
120
120
  web3/exceptions.py,sha256=u0qTr7mS9wEmh-0jSfXNlEzJ-Sfigr4MwF6HxE7_wUw,6904
121
- web3/geth.py,sha256=yQIpoJcRgjQiUfo8aPK65wBpBc8EHTUBUqT0oz0VhUE,11826
121
+ web3/geth.py,sha256=IXdSkRg5n8Nv6KXdY94HwEcFnixOosOHoNanvJNA5rk,13676
122
122
  web3/logs.py,sha256=ROs-mDMH_ZOecE7hfbWA5yp27G38FbLjX4lO_WtlZxQ,198
123
123
  web3/main.py,sha256=3bEGj9n4E9dr40RZO2RC0SI6yGeRDJzqHyv98-E6ICw,15893
124
124
  web3/manager.py,sha256=OO32G09QT4j5-p6x5ZxYT82Z5HMnyCm0G1PqPPPHbqA,16212
125
- web3/method.py,sha256=72YMTPVY5W622U2N-LRZWivi1p0uvmV_81S_C1c3xHQ,7987
125
+ web3/method.py,sha256=KKtQR9YjzSWWzl_gsLX0P4JqOEJnCzhN6naM9GOQvm0,8349
126
126
  web3/module.py,sha256=hoPoBaH992SHm_DRA7yxYZTFy61RQJ7_NZTU-AkZmds,4659
127
127
  web3/net.py,sha256=Y3vPzHWVFkfHEZoJxjDOt4tp5ERmZrMuyi4ZFOLmIeA,1562
128
128
  web3/pm.py,sha256=wE-W7zLrphOZfiAe2I95yHIbov8I1-hcVwbx7ymYCAk,21608
@@ -138,7 +138,7 @@ web3/_utils/blocks.py,sha256=l4w71UErmuZayZOBMxvqB6aqIpMS4Nx24m4gsYBoOO0,2059
138
138
  web3/_utils/caching.py,sha256=8ifvmPeZQ5ztFp4FQ6Hyw2xcIUEnHM8WbEAzdQthtzc,1573
139
139
  web3/_utils/contracts.py,sha256=A1cUt1sx60UwZ5yd0NT-2PBDOjE258S45zi1W7L5-SQ,14980
140
140
  web3/_utils/datatypes.py,sha256=kdHO-crgPKfSvSFg6GSdZrlJq3Gxs6zAC337DA-6MKM,1640
141
- web3/_utils/decorators.py,sha256=GKaEFqyZJvvrXOcxutlN6CvWLQU7ZTiHHwcbslixJ0c,1738
141
+ web3/_utils/decorators.py,sha256=0SRHImvFE2RBUwUr8cOEdwrWB6Dg6H9Q1ivyZbWTxBk,2272
142
142
  web3/_utils/empty.py,sha256=jd7-bwIhNLfBjns5WRDCeN1aT1reGgTZ1XlT6olTs3U,144
143
143
  web3/_utils/encoding.py,sha256=VW_-lDqQsEjqrA34Ea8v4Lj8_y3ZHL6EnTGJK-jt5rw,9117
144
144
  web3/_utils/ens.py,sha256=Yoesu3EKz_0bL-CcvdyRK71i-QJFd9rMfyHdf6IivVM,2388
@@ -152,7 +152,7 @@ web3/_utils/http.py,sha256=3zgTqL1oYILisnZxDvwhfAfKVPznDfu2KHxHg-zk25I,195
152
152
  web3/_utils/hypothesis.py,sha256=4Cm4iOWv-uP9irg_Pv63kYNDYUAGhnUH6fOPWRw3A0g,209
153
153
  web3/_utils/math.py,sha256=Tl-EhmKXtPM7t5tkj2VKrJYTtl5DJoTHiKIL95kzQHc,1047
154
154
  web3/_utils/method_formatters.py,sha256=xh8yq2scjjFuPpWPiGNKCibovJ342D1dujgBYlNF3Hw,34231
155
- web3/_utils/miner.py,sha256=egFue_EQqSG2mj1L5tQZDnr83fPpeXm6HVeWeDNjRHQ,2097
155
+ web3/_utils/miner.py,sha256=9Mwsx1IIOu7OCbM93M4tjXvKoUNzb7pJdmx-2xDj-FQ,1974
156
156
  web3/_utils/module.py,sha256=s3oqAZpR5hlbGrHkFNNtqavNqciAQjNkMrMYke-mYlg,3147
157
157
  web3/_utils/normalizers.py,sha256=jb-tMhWyNKWv1TJyrECwOeyDGAGON67jKb0Iz-Rxlcw,7447
158
158
  web3/_utils/request.py,sha256=I-H7CvMJNTPhl3MN0I9laL2xIYRHSdbxXeuF5ICyhPA,8881
@@ -193,7 +193,7 @@ web3/_utils/contract_sources/contract_data/tuple_contracts.py,sha256=qt0cGM1Kh-L
193
193
  web3/_utils/module_testing/__init__.py,sha256=_AuZ0S4xesS7ocRdMHeTN6zju7KqpSsG4NXgmccJonU,455
194
194
  web3/_utils/module_testing/eth_module.py,sha256=JQ0XAF5GlvpHn3oeAi2DfltJdCZwHk7JChfdTi8nTa0,184283
195
195
  web3/_utils/module_testing/go_ethereum_admin_module.py,sha256=_c-6SyzZkfAJ-7ySXUpw9FEr4cg-ShRdAGSAHWanCtY,3406
196
- web3/_utils/module_testing/go_ethereum_personal_module.py,sha256=PRX1dxqxGydHWyzcGVa0EP0IUoiSQyDYaszbmmXDKTU,10432
196
+ web3/_utils/module_testing/go_ethereum_personal_module.py,sha256=KzYEcAs_6Ud_gbu6YMOC6HijTdNFiz-qogMCViedmY0,11536
197
197
  web3/_utils/module_testing/go_ethereum_txpool_module.py,sha256=5f8XL8-2x3keyGRaITxMQYl9oQzjgqGn8zobB-j9BPs,1176
198
198
  web3/_utils/module_testing/module_testing_utils.py,sha256=sfsIUGtVOntKHh-HBiY4FaWvsVsy9UQkCEmhaTnqQSc,5987
199
199
  web3/_utils/module_testing/net_module.py,sha256=ifUTC-5fTcQbwpm0X09OdD5RSPnn00T8klFeYe8tTm4,1272
@@ -207,7 +207,7 @@ web3/beacon/async_beacon.py,sha256=y7cvbsDYjRNDZftzcJyXaSLCsRrASAGxfyCwE53oCG4,7
207
207
  web3/beacon/main.py,sha256=wgSmF-5hu_95L6onnlA33ADDoASFf9OZf-YWnqnY0VY,6640
208
208
  web3/contract/__init__.py,sha256=EX_RmT8D2DDKKsk1U8grCNdLq9b1rF-8xWaR53CBiew,187
209
209
  web3/contract/async_contract.py,sha256=6MtZkm5R-q1jLZAmV9pmp7x6bGi8ANSV97w1QRjjkHY,20748
210
- web3/contract/base_contract.py,sha256=Hz2X8rzPCTWw6sEUpcTSajnzT6I0l20ppsDUoYr3uFA,37920
210
+ web3/contract/base_contract.py,sha256=--yZotLofy6jAZ_NxE75dauHbYqj9YqG5zOhXWLejro,37924
211
211
  web3/contract/contract.py,sha256=Vs5Gjbm8UPF-roBKww6k4H6wW5ox_DMWjt9Wtn-RNNI,19915
212
212
  web3/contract/utils.py,sha256=4wLR3Einq13kCpvEO_p7wZXdSwcEDpdfo26wVq_d29k,12457
213
213
  web3/eth/__init__.py,sha256=CrYZXIlIdKTmznnLNUaA-C3eLvftBnmlVt9uxm-dwAI,124
@@ -275,9 +275,9 @@ web3/utils/address.py,sha256=KC_IpEbixSCuMhaW6V2QCyyJTYKYGS9c8QtI9_aH7zQ,967
275
275
  web3/utils/async_exception_handling.py,sha256=gfLuzP7Y5rc21jZVjWEYAOZUMJkJd9CmsL297UKReow,3096
276
276
  web3/utils/caching.py,sha256=PgfuXiVgPYQuS0S89-jkNOJ3L2uTRt2MkVBvzMkaAXI,1770
277
277
  web3/utils/exception_handling.py,sha256=12xkzIqMAOx0Jcm6PYL98PmWlLPKFll0p9YoLGS_ZNg,3052
278
- web3-6.17.1.dist-info/LICENSE,sha256=ulnXiEqqFp9VyWe8yMFdtDi70RMBJk3mpY3FKujv6l8,1090
279
- web3-6.17.1.dist-info/METADATA,sha256=SVWh6Sfd_zNgdUrpODq5pxGvhQLTUB5OHzIi76LCbGg,4521
280
- web3-6.17.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
281
- web3-6.17.1.dist-info/entry_points.txt,sha256=2qjzGxFUlYBzoP68fcB3AJyMRunWI70uBoxNp17Brb0,64
282
- web3-6.17.1.dist-info/top_level.txt,sha256=5lRZg30BFUrz8eUK60C7OAjNT3FI4YsGmA-vZ0WIOik,15
283
- web3-6.17.1.dist-info/RECORD,,
278
+ web3-6.18.0.dist-info/LICENSE,sha256=ulnXiEqqFp9VyWe8yMFdtDi70RMBJk3mpY3FKujv6l8,1090
279
+ web3-6.18.0.dist-info/METADATA,sha256=grPGPcFqgL_8ihZCBlqeP_FL4rwoCPOBTHgSE_R2dqQ,4522
280
+ web3-6.18.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
281
+ web3-6.18.0.dist-info/entry_points.txt,sha256=2qjzGxFUlYBzoP68fcB3AJyMRunWI70uBoxNp17Brb0,64
282
+ web3-6.18.0.dist-info/top_level.txt,sha256=5lRZg30BFUrz8eUK60C7OAjNT3FI4YsGmA-vZ0WIOik,15
283
+ web3-6.18.0.dist-info/RECORD,,
File without changes
File without changes