1111 cast ,
1212 overload ,
1313)
14+ import warnings
1415
1516from eth_account import (
1617 Account ,
4041 Literal ,
4142)
4243from web3 ._utils .empty import (
44+ Empty ,
4345 empty ,
4446)
4547from web3 ._utils .encoding import (
104106
105107class Eth (ModuleV2 , Module ):
106108 account = Account ()
107- _default_account = empty
109+ _default_account : Union [ Empty , ChecksumAddress ] = empty
108110 defaultBlock : Literal ["latest" ] = "latest" # noqa: E704
109111 defaultContractFactory : Type [Union [Contract , ConciseContract , ContractCaller ]] = Contract # noqa: E704,E501
110112 iban = Iban
@@ -198,17 +200,29 @@ def chainId(self) -> int:
198200 return self .web3 .manager .request_blocking (RPC .eth_chainId , [])
199201
200202 @property
201- def default_account (self ) -> str :
202- return self .default_account
203+ def default_account (self ) -> Union [Empty , ChecksumAddress ]:
204+ return self ._default_account
205+
206+ @default_account .setter
207+ def default_account (self , account : Union [Empty , ChecksumAddress ]) -> None :
208+ self ._default_account = account
203209
204210 @property
205- def defaultAccount (self ) -> str :
211+ def defaultAccount (self ) -> Union [ Empty , ChecksumAddress ] :
206212 warnings .warn (
207213 'defaultAccount is deprecated in favor of default_account' ,
208214 category = DeprecationWarning ,
209215 )
210216 return self ._default_account
211217
218+ @defaultAccount .setter
219+ def defaultAccount (self , account : Union [Empty , ChecksumAddress ]) -> None :
220+ warnings .warn (
221+ 'defaultAccount is deprecated in favor of default_account' ,
222+ category = DeprecationWarning ,
223+ )
224+ self ._default_account = account
225+
212226 def block_id_munger (
213227 self ,
214228 account : Union [Address , ChecksumAddress , ENS ],
@@ -443,7 +457,6 @@ def call_munger(
443457 if block_identifier is None :
444458 block_identifier = self .defaultBlock
445459
446- < << << << HEAD
447460 return (transaction , block_identifier )
448461
449462 call : Method [Callable [..., Union [bytes , bytearray ]]] = Method (
@@ -456,14 +469,8 @@ def estimate_gas_munger(
456469 transaction : TxParams ,
457470 block_identifier : Optional [BlockIdentifier ] = None
458471 ) -> Sequence [Union [TxParams , BlockIdentifier ]]:
459- if 'from' not in transaction and is_checksum_address (self .defaultAccount ):
460- transaction = assoc (transaction , 'from' , self .defaultAccount )
461- == == == =
462- def estimateGas (self , transaction : TxParams , block_identifier : BlockIdentifier = None ) -> Wei :
463- # TODO: move to middleware
464472 if 'from' not in transaction and is_checksum_address (self .default_account ):
465473 transaction = assoc (transaction , 'from' , self .default_account )
466- >> >> >> > 1 b792773 ... eth .defaultAccount to eth .default_account
467474
468475 if block_identifier is None :
469476 params : Sequence [Union [TxParams , BlockIdentifier ]] = [transaction ]
0 commit comments