Skip to content
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

Refactor useTransaction hook's execute fn's API #234

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

Dhaiwat10
Copy link
Member

@Dhaiwat10 Dhaiwat10 commented Jan 11, 2022

Closes #174

Description

This PR changes the API of the useTransaction hook. You can now pass in fn args directly to the execute function instead of passing them to the useTransaction hook.

Old API:

const [execute, loading, error] = useTransaction(greeter.setGreeting, ['Hello, world!',
  {
    value: ethers.utils.parseEther('0.1')
]);

await execute();

New API:

const [execute, loading, error] = useTransaction(greeter.setGreeting);

await execute(['Hello, world!',
  {
    value: ethers.utils.parseEther('0.1')
  }
]);

@changeset-bot
Copy link

changeset-bot bot commented Jan 11, 2022

🦋 Changeset detected

Latest commit: 1af6189

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@web3-ui/hooks Minor
@web3-ui/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Dhaiwat10 Dhaiwat10 merged commit b66e93a into main Jan 11, 2022
@Dhaiwat10 Dhaiwat10 deleted the usetransaction-refactor branch January 11, 2022 01:23
@github-actions github-actions bot mentioned this pull request Jan 11, 2022
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.

Enhance useTransaction hook
1 participant