Transaction Builder
Learn how to use arbitrary instructions within Squads using Transaction Builder.
Last updated
Learn how to use arbitrary instructions within Squads using Transaction Builder.
Last updated
Users can create custom transactions and populate them with arbitrary instructions using the Transaction Builder. This allows them to interact directly with any programs on Solana from a Squad.
To create a custom transaction draft:
Go to the "TX Builder" tab and click the "Create transaction" button. If you already know the type of transaction you want to create, click on one of the templates.
Choose the type of transaction you would like to create:
Anchor programs (with IDL)
Solana programs (written in Rust)
Import a base58 encoded transaction
Validators (using predefined templates)
Switchboard program
Once you've selected the type, you'll be taken to the draft screen where you can add instructions to the transaction.
To populate a custom transaction draft for programs written in Anchor:
To add a custom instruction, click on the draft and select "Add instruction" from the dropdown menu.
Choose the "Custom instruction" option and enter the program address. Click "Next".
Select the desired instruction from the list and click "Add instruction".
Fill out the required information in the Accounts section and click "Save draft". If necessary, you can add additional instructions to the draft to run multiple custom instructions in one transaction. You can also provide a name and description for the transaction.
After you populate the transaction with instructions and run a simulation to verify that everything is correct, launch a transaction inside your Squad by clicking on "Initiate Transaction". The custom transaction with arbitrary instructions will be launched upon transaction execution.
To add a custom instruction, click on the draft and then click "Add instruction". Select the "Custom instruction" option.
Insert the program address, and then click "Add instruction".
Enter the account information and select the desired data options (Buffer or Raw). Finally, click "Save draft". You can add another instruction inside the draft to run two custom instructions in one transaction.
Once you have populated the transaction with instructions and run a simulation to verify that everything is correct, launch the transaction inside your Squad by clicking on "Initiate Transaction". The custom transaction with arbitrary instructions will be launched upon transaction execution.
To add an instruction, click on the draft and select "Add instruction". Then, choose the "Import base58 encoded tx" option.
Insert the base58 encoded transaction and click "Next". Review the data and click "Add instruction".
Once you have verified the data and run a simulation to ensure its correctness, initiate a transaction within your Squad by clicking on "Initiate Transaction". This will launch a custom transaction with arbitrary instructions upon execution.
Click on "Add instruction".
Select the template you want to use from the list: Stake program, Vote program, Stake Pool program, or Switchboard program.
Populate any of the templates with the required data and launch a transaction. Once the transaction meets confirmation threshold and is executed, the interaction with the program will be made.