-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
transfer-hook: Add update
instruction
#5662
Comments
would it be possible for me to work on this issue? I'm a bit of a newcomer to this domain but wouldn't mind tackling it. |
Of course! I’d start with the interface change, then in separate PRs we can address the different clients. Feel free to request my review. |
I am also trying to implement this. I have added the new instruction to the interface and example program. I have also added a subcommand to the CLI. When testing with the CLI, the RPC simulation fails with custom program error: 0x47af3bc1. How can I decode this? Also is there an easy way to show logs of the failed RPC simulation? |
I figured out the error, it is I thought I could simply just create a new The error arises when:
is called in the new update instruction in the example program. Also why is the TLV instruction type |
This is going to try to initialize a new TLV entry and it will error if it exists, so it's not appropriate for updating an existing one! You'll have to add an
This is because the instructions' discriminator is used to identify which set of extra accounts are required for a particular instruction. For example:
The confusing bit here is that besides "initializing extra required accounts", Transfer Hook has only one instruction: execute the transfer. |
Thank you! I have a working implementation now, that updates tlv-account-resolution, the transfer-hook-interface, and the example program. How can I let you review it? |
I saw! If you can't request my review just tag me in a comment or the PR description. |
Done as of #5894 ! |
Problem
A program implementing the transfer-hook interface only absolutely requires one instruction, the
execute
hook which is called by token-2022.However, the interface does also include an initialization function, which is needed in some form to write data to the extra-account-metas account. An implementer may choose to do something else for that instruction.
Similarly, there's no way to
update
the extra-account-metas account with just the interface.Solution
This behavior is fine as is, but it would be nicer to have a recommended-but-not-required
update
instruction for devs looking to implement the transfer hook.cc @buffalojoec
The text was updated successfully, but these errors were encountered: