-
Notifications
You must be signed in to change notification settings - Fork 114
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 new Instructions to already existing transactions #175
Comments
your example might not work. |
@yihau my current use case requires the transaction to be passed in as an argument to a function then an additional instruction which is the new instruction is then added to the transaction before it is then used. func CreatePostRes(tx types.Transaction, ref common.PublicKey){
//do simple check
if len(tx.Message.Instruction) < 1 {
return
}
instruction := fetchNewInstruction(ref)
//append instruction to tx
tx = AddIxToTransaction(tx, instruction) //we do the tricky stuff here
...
} Something like the above. If only there was a way to decompile instructions then compile them back with the data intact. I think that might be helpful too. |
I also need an analog of the transaction.add() in the @solana/web3.js package. I want to send a transaction with the instruction |
I would like to know if it is possible to add new instructions to pre-existing transactions similar to
transaction.add()
in the@solana/web3.js
package.I tried to do something to make it work using the example below
I tried to make it work using the example above.
It returns tx hash but the second instruction isn't added to the transaction when viewed on the explorar
Is there a way to do this?
The text was updated successfully, but these errors were encountered: