Skip to content

Conversation

@kclowes
Copy link
Collaborator

@kclowes kclowes commented Jul 31, 2024

What was wrong?

We've agreed that it would be nice if ContractFunctions can be called both with and without parentheses if the function doesn't take arguments or keyword arguments. Both examples are okay below:

myContract.functions.myFnName().call()
myContract.functions.myFnName.call()

Related to Issue #2545
Closes #2541

How was it fixed?

Added a tuple or a dict as fallback if either **args or **kwargs are None

Todo:

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@kclowes kclowes marked this pull request as draft July 31, 2024 21:30
@kclowes kclowes changed the title Validate that kwargs or args are present Allow ContractFunctions to be called via a combomethod style Aug 15, 2024
@kclowes kclowes force-pushed the validate-contract-fn-args-kwargs branch from 9b7f6cb to 013db7b Compare August 16, 2024 21:35
@kclowes kclowes self-assigned this Aug 19, 2024
@kclowes kclowes force-pushed the validate-contract-fn-args-kwargs branch from b78607f to aaa9f50 Compare August 22, 2024 18:19
@kclowes kclowes force-pushed the validate-contract-fn-args-kwargs branch from aaa9f50 to fc0cd9d Compare August 23, 2024 04:15
@kclowes kclowes marked this pull request as ready for review August 23, 2024 04:23
@kclowes kclowes requested review from fselmo, pacrob and reedsa and removed request for fselmo and pacrob August 23, 2024 16:11
Copy link
Collaborator

@fselmo fselmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Contributor

@reedsa reedsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice to have this, fits nicely with the events API. lgtm!

@kclowes kclowes merged commit 9194222 into ethereum:main Aug 23, 2024
@kclowes kclowes deleted the validate-contract-fn-args-kwargs branch August 23, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ContractFunction.call may fail as args and kwargs properties may be None

3 participants