Skip to content

Close a Transaction

Closes a vault Transaction and its Proposal, refunding their rent. Use this to clean up after a transaction reaches a terminal state.

Closeable once the proposal is Executed, Rejected, or Cancelled, or is stale and not Approved. An Approved-but-unexecuted vault proposal cannot be closed — it can still execute. No member signature is required; only the fee payer signs.

Program method — close_transaction

Signs with payer only, then sends. The rent collectors default to the on-chain stored values (the proposal's and transaction's rent collectors) when omitted.

ParameterTypeRequiredDefaultDescription
payerKeypairyesPays the fee; the only signer.
settings#to_syesThe settings account address.
transaction_indexIntegeryesIndex of the transaction to close.
proposal_rent_collector#to_snostored valueReceives the proposal rent (defaults to the proposal's stored collector).
transaction_rent_collector#to_snostored valueReceives the transaction rent (defaults to the transaction's stored collector).

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

ruby
program.close_transaction(
  payer:             creator,
  settings:          identity.settings_address,
  transaction_index: 1
)

Composer — SquadsSmartAccountsCloseTransactionComposer

The rent collectors must be resolved (the program method reads them from the on-chain proposal and transaction).

ParameterTypeRequiredDefaultDescription
settings#to_syesThe settings account address.
proposal#to_syesThe Proposal PDA to close.
transaction#to_syesThe vault Transaction PDA to close.
proposal_rent_collector#to_syesReceives the proposal rent.
transaction_rent_collector#to_syesReceives the transaction rent (must equal transaction.rent_collector).
ruby
proposal,    = program.get_proposal_address(settings_address: identity.settings_address, transaction_index: 1)
transaction, = program.get_transaction_address(settings_address: identity.settings_address, transaction_index: 1)

composer = Solace::Composers::SquadsSmartAccountsCloseTransactionComposer.new(
  settings:                   identity.settings_address,
  proposal:,
  transaction:,
  proposal_rent_collector:    creator.address,
  transaction_rent_collector: creator.address
)

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)

  • Discriminator: [97, 46, 152, 170, 42, 215, 192, 218]
  • Encodes (data): the discriminator only — closeTransaction takes no arguments.
ParameterTypeRequiredDefaultDescription
settings_indexIntegeryesIndex of the settings account.
proposal_indexIntegeryesIndex of the Proposal PDA.
transaction_indexIntegeryesIndex of the Transaction PDA.
proposal_rent_collector_indexIntegeryesIndex of the proposal rent collector.
transaction_rent_collector_indexIntegeryesIndex of the transaction rent collector.
system_program_indexIntegeryesIndex of the System program.
program_indexIntegeryesIndex of the Squads program.

Built on Solace