Documentation Index
Fetch the complete documentation index at: https://docs.glam.systems/llms.txt
Use this file to discover all available pages before exploring further.
When a GLAM vault is owned by a Squads multisig, all vault operations must go through the Squads approval process. This guide shows how to create Squads proposals for GLAM vault operations using the SDK.
Prerequisites
- A GLAM vault where the manager is set to a Squads vault PDA
- A wallet with Squads Proposer permission
- The
@sqds/multisig package installed alongside the GLAM SDK
How It Works
- Build a GLAM instruction using the SDK’s
txBuilder methods
- Wrap the instruction in a Squads vault transaction
- Create a Squads proposal for multisig members to vote on
- Once approved, the transaction executes through Squads
Creating a Proposal
The following example creates a proposal to enable the JupiterSwap protocol on a vault:
import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js";
import { GlamClient, getProgramAndBitflagByProtocolName } from "@glamsystems/glam-sdk";
import * as multisig from "@sqds/multisig";
// Initialize clients
const glamClient = new GlamClient({
statePda: new PublicKey("GlamState111111111111111111111111111111111"),
});
const multisigPda = new PublicKey("SquadsMultisig111111111111111111111111111");
// Derive the Squads vault PDA (index 0 is the default vault)
const [squadsVaultPda] = multisig.getVaultPda({
multisigPda,
index: 0,
});
// 1. Build the GLAM instruction
const permissionsMap = getProgramAndBitflagByProtocolName(glamClient.staging);
const [integrationProgram, protocolBitflag] = permissionsMap["JupiterSwap"];
const ix = await glamClient.access.txBuilder.enableDisableProtocolsIx(
new PublicKey(integrationProgram),
parseInt(protocolBitflag, 2),
true, // enable
squadsVaultPda // signer is the Squads vault
);
// 2. Wrap into a transaction message
const blockhash = (await glamClient.blockhashWithCache.get()).blockhash;
const txMessage = new TransactionMessage({
payerKey: squadsVaultPda,
recentBlockhash: blockhash,
instructions: [ix],
});
// 3. Get the next transaction index
const multisigInfo = await multisig.accounts.Multisig.fromAccountAddress(
glamClient.connection,
multisigPda
);
const newTransactionIndex = BigInt(Number(multisigInfo.transactionIndex) + 1);
// 4. Create Squads vault transaction instruction
const ixCreateSquadsTx = multisig.instructions.vaultTransactionCreate({
multisigPda,
transactionIndex: newTransactionIndex,
creator: glamClient.signer,
vaultIndex: 0,
ephemeralSigners: 0,
transactionMessage: txMessage,
});
// 5. Create Squads proposal instruction
const ixCreateSquadsProposal = multisig.instructions.proposalCreate({
multisigPda,
creator: glamClient.signer,
transactionIndex: newTransactionIndex,
});
// 6. Send the transaction
const tx = new Transaction().add(ixCreateSquadsTx, ixCreateSquadsProposal);
const vTx = await glamClient.intoVersionedTransaction(tx);
const txSig = await glamClient.sendAndConfirm(vTx);
// 7. Get the proposal URL
const [transactionPda] = multisig.getTransactionPda({
multisigPda,
index: newTransactionIndex,
});
console.log(
"View proposal:",
`https://app.squads.so/squads/${squadsVaultPda}/transactions/${transactionPda}`
);
Finding Your Squads Multisig Address
The multisig PDA is different from the Squads vault address. To find it:
- Go to
https://app.squads.so/squads/<your-squads>/settings
- Look for the “Multisig Account” address
Other Vault Operations
You can create proposals for any GLAM vault operation by using the appropriate txBuilder method:
// Grant delegate permissions
const ix = await glamClient.access.txBuilder.grantDelegatePermissionsIx(
delegatePubkey,
new PublicKey(integrationProgram),
parseInt(protocolBitflag, 2),
permissions,
squadsVaultPda
);
// Set protocol policy
const ix = await glamClient.access.txBuilder.setProtocolPolicyIx(
new PublicKey(integrationProgram),
parseInt(protocolBitflag, 2),
policy.encode(),
squadsVaultPda
);
The pattern is the same: build the instruction with squadsVaultPda as the signer, wrap it in a Squads transaction, and create a proposal.
After Creating a Proposal
Once the proposal is created:
- Share the proposal URL with other multisig members
- Members vote on the proposal through the Squads UI
- When the threshold is reached, any member can execute the transaction
- The GLAM vault operation takes effect
References