Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["server-example", "webhook-api", "programs/*", "order-engine-sdk"]
members = ["server-example", "webhook-api", "programs/*", "order-engine-sdk", "squads-sdk"]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -29,6 +29,7 @@ reqwest = { version = "0.12", features = [
"blocking",
] }
solana-client = "~2"
solana-transaction-status = "~2"
solana-program = "~2"
solana-program-test = "~2"
solana-rpc-client = "~2"
Expand All @@ -38,6 +39,7 @@ spl-token-2022 = { version = "9.0.0" }

serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
sha2 = "0.10"
strum = { version = "0.26.3", features = ["derive"] }
test-case = "3.3.1"
tokio = "1.43.0"
Expand Down
16 changes: 16 additions & 0 deletions squads-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "squads-sdk"
version = "0.1.0"
edition = { workspace = true }

[dependencies]
base64 = { workspace = true }
bincode = { workspace = true }
sha2 = { workspace = true }
solana-sdk = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
solana-client = { workspace = true }
solana-transaction-status = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
30 changes: 30 additions & 0 deletions squads-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# squads-sdk

Rust SDK for wrapping and unwrapping Solana transactions in the Squads V5 multisig format (`executeTransactionSyncV2`).

## Features

- **Wrap** — take swap instructions and wrap them into a Squads multisig transaction, with optional ALT support
- **Unwrap** — recover inner instructions from a wrapped transaction (with or without ALTs)
- **Settings parsing** — parse on-chain Squads V5 settings accounts (members, threshold, etc.)
- **PDA derivation** — derive settings and vault PDAs
- **Preflight validation** — check CPI account limits and estimated tx size before wrapping
- **Detection** — identify whether a transaction is Squads-wrapped

## Error variants

| Variant | When |
|---------|------|
| `InvalidConfig` | Empty members, zero threshold, threshold > members |
| `CpiAccountLimitExceeded` | Inner instructions + Squads overhead > 64 accounts |
| `TransactionSizeExceeded` | Wrapped tx exceeds size limit |
| `UnrecognizedDiscriminator` | Transaction doesn't contain a Squads V2 instruction |
| `InvalidBase64` / `InvalidTransaction` | Malformed input |
| `InvalidSettingsData` | Settings account data is corrupted or truncated |

## Limitations

- Only supports `executeTransactionSyncV2` (not V1)
- Unwrap requires the caller to provide resolved account keys for ALT transactions (no RPC)
- Wrap produces unsigned transactions — caller must collect member signatures
- Squads CPI is limited to 64 accounts
Loading
Loading