Skip to content

Update contract.py #2846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions newsfragments/2846.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Set default block_identifier in ContractFunction.call() to None

6 changes: 3 additions & 3 deletions web3/contract/async_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def factory(cls, class_name: str, **kwargs: Any) -> "AsyncContractFunction":
async def call(
self,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
state_override: Optional[CallOverride] = None,
ccip_read_enabled: Optional[bool] = None,
) -> Any:
Expand Down Expand Up @@ -565,7 +565,7 @@ def __init__(
w3: "AsyncWeb3",
address: ChecksumAddress,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
ccip_read_enabled: Optional[bool] = None,
decode_tuples: Optional[bool] = False,
) -> None:
Expand Down Expand Up @@ -605,7 +605,7 @@ def __init__(
def __call__(
self,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
ccip_read_enabled: Optional[bool] = None,
) -> "AsyncContractCaller":
if transaction is None:
Expand Down
2 changes: 1 addition & 1 deletion web3/contract/base_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ def call_function(
fn: TContractFn,
*args: Any,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
ccip_read_enabled: Optional[bool] = None,
**kwargs: Any,
) -> Any:
Expand Down
6 changes: 3 additions & 3 deletions web3/contract/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def factory(cls, class_name: str, **kwargs: Any) -> "ContractFunction":
def call(
self,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
state_override: Optional[CallOverride] = None,
ccip_read_enabled: Optional[bool] = None,
) -> Any:
Expand Down Expand Up @@ -561,7 +561,7 @@ def __init__(
w3: "Web3",
address: ChecksumAddress,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
ccip_read_enabled: Optional[bool] = None,
decode_tuples: Optional[bool] = False,
) -> None:
Expand Down Expand Up @@ -596,7 +596,7 @@ def __init__(
def __call__(
self,
transaction: Optional[TxParams] = None,
block_identifier: BlockIdentifier = "latest",
block_identifier: BlockIdentifier = None,
ccip_read_enabled: Optional[bool] = None,
) -> "ContractCaller":
if transaction is None:
Expand Down