TX Builder
Learn how to use arbitrary instructions within Squads using Transaction Builder.
Learn how to use arbitrary instructions within Squads using Transaction Builder.
In Squad V3 users can create custom transactions and populate them with arbitrary instructions through the Transaction Builder to interact with any programs on Solana directly from a Squad.
To create a draft custom transaction:
Navigate to the “TX Builder” tab and click “Create transaction”. If you already know the type of TX you want to create, just click on one of the templates.
2. After you click on "+Create transaction", you will be directed to the transaction screen. Here you can click on "Add instruction" to start crafting it or delete the draft if you don't need it anymore.
All custom transactions are first saved as a draft, which needs to be populated with the instructions data before the launch. You can save your custom transaction after it is initiated.
3. After clicking on "Add instruction" you will see a pop-up of available options. You can create a custom transaction to interact with:
a. Anchor programs (with IDL)
b. Solana programs (written in Rust)
c. Import a base58 encoded transaction
d. Validators (using predefined templates)
e. Switchboard program
To populate the custom transaction draft for programs written in Anchor:
Click on the draft, click “Add instruction”, select the "Custom instruction" option.
Insert the program address and click "Next".
3. Select the instruction from the list and click "Add instruction".
4. Populate the Accounts with the required data and click "Save draft". You can add another instruction inside the draft to run two custom instructions in one transaction. You can also add a name and description to the transaction.
After you populate the draft with arbitrary instucrtions you can run a simulation to check if your transaction is assembled correctly.
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. (More on transaction execution).
To populate the custom transaction draft for programs written in Rust:
Click on the draft, click “Add instruction”, select the "Custom instruction" option.
2. Insert the program address and click "Add instruction".
Insert the account info and then populate the desired data options (Buffer or Raw). Then click "Save draft". You can add another instruction inside the draft to run two custom instructions in one transaction.
After you populate the draft with arbitrary instucrtions you can run a simulation to check if your transaction is assembled correctly.
3. 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. (More on transaction execution).
To populate the draft with instructions from base58 encoded transactions:
Click on the draft, click “Add instruction”, select the "Import base58 encoded tx" option.
Insert the base58 encoded transaction, click "Next". Check the data and click "Add instruction".
After you have checked the data and run a simulation to verify that everything is correct, launch a transaction inside your Squad by clicking on "Initiate Transaction". A custom transaction with arbitrary instructions will be launched upon transaction execution (More on transaction execution).
To interact with the validators and stake pools using predefined templates:
Click on "Add instruction".
Select from the list the template you want to use: Stake program, Vote program, Stake Pool program, Switchboard program.
The stake program template allows you to interact with validators to deactivate and withdraw staked SOL.
The vote program template allows you to change the withdraw authority, withdraw stake rewards, and change the commission of the validator.
The stake pool program template allows you to set the manager, fees, and funding authority of the stake pool.
Using Switchboard program template allows you to interact with Switchboard and create and manage feeds from a multisig.
3. 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.