-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add useTransaction
hook
#134
Conversation
🦋 Changeset detectedLatest commit: 51ae6ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
const giveAlert = (name, greeting) => { | ||
alert('Hello ' + name + '! ' + greeting); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hook is meant to be for Ethereum contract calls. Can you add an example that actually calls an Ethereum contract? You can use useContract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove these current stories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll use useContract
and remove current stories
alert(await contract.greet()) | ||
); | ||
|
||
// @ts-expect-error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you paste the error that you are seeing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's expected since the useContract
does not return any type defs as of now
Closes #126
Description
I've added a
useTransaction
hook. This hook takes the function and an array of arguments to this function as an argument.This hook returns an object containing the
execute
method,loading
state, anderror
state. On calling thisexecute
method, the function passed in the hook as an argument will get executed.