Skip to content

Create a Transaction ​

Stores a set of inner instructions on-chain as a pending vault transaction — it does not execute yet. This is step one of the async lifecycle: the transaction awaits a proposal and approvals before it can run.

The creator must hold the Initiate permission. The transaction is stored at the settings account's transaction_index + 1; the program derives that index and the Transaction PDA for you. Scope: simple messages only — no Address Lookup Tables or ephemeral signers.

Program method — create_transaction ​

Signs with payer + creator + rent_payer, then sends.

ParameterTypeRequiredDefaultDescription
payerKeypairyes—Pays the fee; co-signs.
settings#to_syes—The settings account address.
creator#to_s · Keypairyes—An Initiate-holding member; must sign.
rent_payer#to_s · Keypairyes—Funds the Transaction account's rent; must sign.
instructionsArray<Composers::Base>yes—Inner instruction composers (e.g. a SystemProgramTransferComposer spending from the vault).
account_indexIntegerno0Vault index the inner message spends from.
memoStringnonilOptional indexing memo.

Plus the shared sign: / execute: controls and Solace::Transaction return — see Conventions.

ruby
recipient = Solace::Keypair.generate

program.create_transaction(
  payer:        creator,
  settings:     identity.settings_address,
  creator:,
  rent_payer:   creator,
  instructions: [
    Solace::Composers::SystemProgramTransferComposer.new(
      from:     identity.smart_account_address,
      to:       recipient.address,
      lamports: 250_000_000
    )
  ]
)

Composer — SquadsSmartAccountsCreateTransactionComposer ​

The composer compiles the inner instructions into the stored message itself. The Transaction PDA must be resolved first (the program method derives it from the next index).

ParameterTypeRequiredDefaultDescription
settings#to_syes—The settings account address.
transaction#to_syes—The Transaction PDA to create (from get_transaction_address).
creator#to_s · Keypairyes—An Initiate-holding member; must sign.
rent_payer#to_s · Keypairyes—Funds the account's rent; must sign.
instructionsArray<Composers::Base>yes—Inner instruction composers.
account_indexIntegerno0Vault index the message spends from.
ephemeral_signersIntegerno0Ephemeral signer count (only 0 is supported).
memoStringnonilIndexing memo.
ruby
transaction, = program.get_transaction_address(
  settings_address:  identity.settings_address,
  transaction_index: 1
)

composer = Solace::Composers::SquadsSmartAccountsCreateTransactionComposer.new(
  settings:     identity.settings_address,
  transaction:,
  creator:      creator.address,
  rent_payer:   creator.address,
  instructions: [
    Solace::Composers::SystemProgramTransferComposer.new(
      from:     identity.smart_account_address,
      to:       recipient.address,
      lamports: 250_000_000
    )
  ]
)

tx = Solace::TransactionComposer.new(connection:)
                                .add_instruction(composer)
                                .set_fee_payer(creator)
                                .compose_transaction

tx.sign(creator)
connection.send_transaction(tx.serialize)

Low-level instruction (advanced) ​

The deployed program models the args as a TransactionPayload enum and requires a trailing program account — both reflected here.

  • Discriminator: [227, 193, 53, 239, 55, 126, 112, 105]
  • Encodes (data): [0] (TransactionPayload variant) + account_index + ephemeral_signers + bytes(transaction_message) + option_string(memo)
ParameterTypeRequiredDefaultDescription
account_indexIntegeryes—Vault index the message spends from.
ephemeral_signersIntegeryes—Ephemeral signer count (0).
transaction_messageArray<Integer>yes—The serialized compiled message bytes.
memoString, nilyes—Indexing memo, or nil.
settings_indexIntegeryes—Index of the settings account.
transaction_indexIntegeryes—Index of the Transaction PDA.
creator_indexIntegeryes—Index of the creator.
rent_payer_indexIntegeryes—Index of the rent payer.
system_program_indexIntegeryes—Index of the System program.
program_indexIntegeryes—Index of the Squads program.

Built on Solace