POST
/
api
/
v0
/
smart_account
/
transaction
/
prepare
curl --request POST \
  --url https://developer-api.squads.so/api/v0/smart_account/transaction/prepare \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "smart_account_address": "<string>",
  "transaction": "<string>",
  "transaction_signers": [
    "<string>"
  ],
  "fee_config": {
    "currency": "sol",
    "payer_address": "<string>"
  }
}'
{
  "transaction": "<string>",
  "fee": {
    "amount": "<string>",
    "amount_decimal": "<string>",
    "currency": "<string>",
    "sol_equivalent": {
      "amount": "<string>",
      "amount_decimal": "<string>"
    }
  }
}

Execute any arbitrary transaction using your Smart Account as a signer. This is one of the core functionalities of a Smart Account - it enables you to use your Smart Account like a regular Solana wallet, but with the added security of multi-signature controls and self-custodial programmability.

Key Concepts

  • Smart Account as a Signer: Your Smart Account can act as a signer for any Solana transaction, just like a regular wallet. This means you can interact with any protocol or program on Solana.

  • Multi-signature Security: The transaction will only be executed if it meets the Smart Account’s threshold requirements. For example, if your Smart Account requires 2-of-3 signatures, you’ll need to provide at least 2 valid signatures from authorized signers.

  • Transaction Preparation: The transaction you provide should be properly constructed and encoded in base64 format. This transaction should include all the instructions you want to execute.

Common Use Cases

  1. Token Transfers: Send tokens from your Smart Account to any recipient
  2. DeFi Interactions: Interact with DeFi protocols (swaps, lending, etc.)
  3. NFT Operations: Buy, sell, or transfer NFTs
  4. Program Interactions: Call any program on Solana with your Smart Account as the signer
Message signing is currently not supported on smart accounts.

Important Notes

  • The transaction must be properly constructed and include all necessary instructions
  • All provided transaction_signers must be registered signers of the Smart Account
  • The number of valid signatures must meet or exceed the Smart Account’s threshold

The submitted instructions must be under 1050 bytes to allow for fee configuration instructions.

Constructing Instructions

When building your instructions, treat them as regular Solana transactions but use your Smart Account’s address wherever you would normally use a signer’s address. For example:

// If you're transferring tokens, use your Smart Account's address as the owner
const transferInstruction = createTransferInstruction(
  sourceTokenAccount, // from token account (owned by Smart Account)
  destinationTokenAccount, // to token account
  smartAccountAddress, // owner (Smart Account address)
  amount
);

Authorizations

Authorization
string
header
required

Authorization header using the Bearer scheme. Example: "Authorization: Bearer {token}"

Headers

x-squads-network
enum<string>
default:mainnet

Specifies which Solana network to use. Defaults to 'mainnet' if not provided. Valid values are 'devnet' or 'mainnet'.

Available options:
devnet,
mainnet

Body

application/json

Response

200
application/json

Transaction successfully prepared

The response is of type object.