-
Notifications
You must be signed in to change notification settings - Fork 129
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
feat: add execute hook for multicall #143
Conversation
I like this interface (and now i think |
{ | ||
contractAddress: tokenAddress, | ||
entrypoint: 'approve', | ||
calldata: [toBN(bankAddress).toString(), amount, '0'], |
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.
I assume this is because the amount is an uint256? Should work with toBN(amount)
instead of amount, '0'
.
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.
With toBN(amount)
it passes as is (the object) in the transaction. The transaction goes through but no tokens are approved or sent (in example).The transaction log (in Argent for example) looks like this:
Transaction data
[
"688466037836324210640682130671894602364182264487879175191481661276184612058",
{
"negative": 0,
"words": [
1
],
"length": 1,
"red": null
},
{
"negative": 0,
"words": [
1
],
"length": 1,
"red": null
}
]
Added a minor comment about the example. Should also add a documentation page. |
Fixed minor react-next export issue and added docs on execute hook |
Continue in #145. As we discussed on discord, need to publish the package before we can add an example using it. |
Based on the discussions that have happened in #102 I have created a useStarknetExecute hook enabling multicalls.
Calls need to be defined when creating the hook, and not on submit. Similar to how useSignTypedData is done.
Currently formatting the calldata in calls is up to the UI to implement. I have made an example in next react app that does this. This is an example of an approval and deposit made to a bank contract.
The calls are also not currently view exposed for a 'tx cart' yet, this would be up to the UI to handle separately. Although definitely would want to try implement in the future.