-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: balance transfer & deployed txn #14
Conversation
// Note: you may need to static call getSenderAddress() not call() as per | ||
// the spec. Leaving as-is for now. | ||
// let call = call_builder.call_raw().await; |
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.
are you saying this is not correct and shouldn't work?
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.
Yeah the entry point says to do a staticcall when calling getSenderAddress. Here it's currently doing a regular call I think.
Not sure exactly the difference but it seems to work as-is for now for simple account so I'm leaving it as-is. But something to be aware of if there are issues in the future
// TODO test/fix: if invalid call data (e.g. sending balance that you don't | ||
// have), the account will still be deployed but the transfer won't happen. | ||
// Why can't we detect this? |
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.
We should know the balance of the smart account. If the smart account has not been deployed then the balance would be 0
, if it has been deployed we can get the balance of the contract before sending the user operation I believe.
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.
Yeah we can get the balance, my point was that the UserOperation went through even though the transaction was invalid. Not what I was expecting. I would've expected the whole thing to revert
Adds test coverage for transferring native token balance from the smart account to another account. It does this transfer twice, the first time as part of the account deployment, and the second against the deployed account.
This fixes some issues in the process:
undefined
factory
andfactoryData
when working against a deployed accountCREATE2
implementation asgetSenderAddress()
only works when the account isn't yet deployed