Skip to content

Create a Proposal

Opens the voting record for a stored transaction. A proposal created with draft: false (the default) starts Active and is ready to vote on; draft: true starts Draft and must be activated first.

The creator must hold the Initiate permission. A proposal is 1:1 with its transaction (both derived from the same index). See the async lifecycle.

Program method — create_proposal

Signs with payer + creator + rent_payer, then sends. The Proposal PDA is derived from the settings address and transaction index.

ParameterTypeRequiredDefaultDescription
payerKeypairyesPays the fee; co-signs.
settings#to_syesThe settings account address.
creator#to_s · KeypairyesAn Initiate-holding member; must sign.
rent_payer#to_s · KeypairyesFunds the Proposal account's rent; must sign.
transaction_indexIntegeryesIndex of the transaction this proposal tracks.
draftBooleannofalseStart as Draft (needs activation) instead of Active.

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

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

Composer — SquadsSmartAccountsCreateProposalComposer

ParameterTypeRequiredDefaultDescription
settings#to_syesThe settings account address.
proposal#to_syesThe Proposal PDA to create (from get_proposal_address).
creator#to_s · KeypairyesAn Initiate-holding member; must sign.
rent_payer#to_s · KeypairyesFunds the account's rent; must sign.
transaction_indexIntegeryesIndex of the tracked transaction.
draftBooleannofalseStart as Draft instead of Active.
ruby
proposal, = program.get_proposal_address(
  settings_address:  identity.settings_address,
  transaction_index: 1
)

composer = Solace::Composers::SquadsSmartAccountsCreateProposalComposer.new(
  settings:          identity.settings_address,
  proposal:,
  creator:           creator.address,
  rent_payer:        creator.address,
  transaction_index: 1
)

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: [132, 116, 68, 174, 216, 160, 198, 22]
  • Encodes (data): le_u64(transaction_index) + bool(draft)
ParameterTypeRequiredDefaultDescription
transaction_indexIntegeryesIndex of the tracked transaction.
draftBooleanyesStart as Draft instead of Active.
settings_indexIntegeryesIndex of the settings account.
proposal_indexIntegeryesIndex of the Proposal PDA.
creator_indexIntegeryesIndex of the creator.
rent_payer_indexIntegeryesIndex of the rent payer.
system_program_indexIntegeryesIndex of the System program.
program_indexIntegeryesIndex of the Squads program.

Built on Solace