A Python SDK for interacting with Squads Protocol on Solana. PySquad provides a simple and intuitive interface for managing multisig wallets, creating and executing transactions, and handling proposals on the Solana blockchain.
- 🏦 Multisig wallet management
- 💼 Transaction creation and execution
- 📝 Proposal creation and approval
- 🔐 Secure key management
- ⚡️ Solana blockchain integration
- 🛡️ Time-locked transactions
- 💰 Treasury management
# Clone the repository
git clone https://github.com/yourusername/pysquad.git
cd pysquad
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
# Install dependencies
pip install -r requirements.txt- anchorpy==0.21.0
- solana==0.36.6
- solders==0.26.0
from sdk.squads import SquadsWallet
from sdk.client import SolanaClient
from solders.pubkey import Pubkey
from solders.solders import Keypair
# Initialize Solana client
client = SolanaClient()
# Create a new multisig wallet
members = [
Member(key=Pubkey("member1_public_key"), permissions={"mask": 7}),
Member(key=Pubkey("member2_public_key"), permissions={"mask": 7})
]
threshold = 2 # Require 2 approvals for transactions
wallet = SquadsWallet(
client=client,
members=members,
threshold=threshold
)
# Deploy the wallet
tx_sig = wallet.deploy()
print(f"Wallet deployed with transaction: {tx_sig}")wallet = SquadsWallet(
client=client,
members=members,
threshold=threshold,
time_lock=0, # Optional time lock in seconds
memo="My multisig wallet" # Optional memo
)# Create a transaction
tx_sig = wallet.create_vault_transaction(
instructions=[your_instructions],
creator=member_keypair,
memo="Transaction description"
)# Create a proposal
proposal_sig = wallet.create_proposal(
creator=member_keypair,
draft=False
)
# Approve a proposal
approval_sig = wallet.approve_proposal(
member=member_keypair,
memo="Approval comment"
)# Execute an approved transaction
execute_sig = wallet.vault_transaction_execute(
member=member_keypair
)pysquad/
├── sdk/
│ ├── squads.py # Main SDK implementation
│ ├── client.py # Solana client wrapper
│ ├── constants.py # Protocol constants
│ └── __init__.py
├── squads/ # Protocol-specific implementations
├── requirements.txt # Project dependencies
└── README.md # This file
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is for interacting with the Squads Protocol on Solana. Please ensure you understand the security implications of managing multisig wallets and executing transactions on the blockchain.
For support, please open an issue in the GitHub repository or contact the maintainers.