@faremeter/wallet-solana-squads
@faremeter/wallet-solana-squads lets Faremeter payment handlers operate through a Squads multisig. It orchestrates proposal creation, approvals, and execution so x402 transactions can flow through multisig governance automatically.
The adapter exposes the same interface as other Solana wallets (buildTransaction) while hiding the Squads specifics.
Quick start
API surface
createSquadsWallet(network, connection, keypair, multisigPda, squadMember)
Returns an object with:
network: passed through unchanged.publicKey: the admin keypair’s public key (used for payer identity).buildTransaction(instructions): orchestrates the Squads flow and returns a fully signedVersionedTransaction.
connection: standard@solana/web3.jsConnection.keypair: admin signer controlling the multisig.multisigPda: Squads multisig PDA (PublicKey).squadMember: additionalKeypairthat co-approves proposals (for 2-of-N setups). Extend the implementation if your multisig policy requires more signers.
buildTransaction(instructions)
The core method performs the following steps:
- Derives the vault PDA for the multisig (
multisig.getVaultPda). - Reads the multisig account to obtain the current
transactionIndex. - Creates a vault transaction proposal wrapping the provided instructions.
- Submits a proposal, approves it with both the admin and member keypairs.
- Executes the transaction via Squads RPC helpers (
vaultTransactionExecute). - Builds a
VersionedTransactiontargeting the multisig vault and signs it with the admin keypair.
["faremeter","wallet-solana-squads"], including transaction signatures (base58 encoded).
If any of the Squads RPC calls fail, the function throws; wrap buildTransaction in your own retry or monitoring layers if needed.
Usage patterns
- Multiple approvers: Duplicate the approval section to gather more signatures when your multisig policy demands it.
- Custom memos: Update the
memoargument invaultTransactionCreateto label payments for audit trails. - Observability: Capture the emitted log entries to trace the lifecycle of each multisig payment attempt.
- Versioned transactions: The adapter returns a
VersionedTransactionready for downstream handlers (@faremeter/payment-solana) to serialize and send.
Related references
@faremeter/payment-solana: consumes the wallet object for client-side payments.@faremeter/wallet-ledger: hardware wallet alternative when you don’t need multisig.- Squads SDK docs: the adapter relies on
@sqds/multisigand@solana/kitprimitives under the hood. - Source: GitHub › packages/wallet-solana-squads