Class: Solace::Composers::SquadsSmartAccountsCloseSettingsTransactionComposer
- Inherits:
-
Base
- Object
- Base
- Solace::Composers::SquadsSmartAccountsCloseSettingsTransactionComposer
- Defined in:
- lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb
Overview
Composes a ‘closeSettingsTransaction` instruction for the Squads Smart Account program.
Closes a SettingsTransaction and its Proposal, refunding rent to the respective collectors. No smart-account signer is required — only the fee payer signs. The transaction is closeable once its proposal is terminal (Executed/Rejected/Cancelled) or stale.
Required params:
:settings [#to_s] Base58 address of the settings account.
:proposal [#to_s] The Proposal PDA to close.
:transaction [#to_s] The SettingsTransaction PDA to close.
:proposal_rent_collector [#to_s] Receives the proposal rent.
:transaction_rent_collector [#to_s] Receives the transaction rent (must equal
transaction.rent_collector).
Instance Method Summary collapse
-
#build_instruction(context) ⇒ Solace::Instruction
Builds the instruction with resolved account indices.
-
#program_id ⇒ String
Returns the Squads Smart Account program id from the constants.
-
#proposal ⇒ String
Extracts the proposal PDA address from the params.
-
#proposal_rent_collector ⇒ String
Extracts the proposal rent collector address from the params.
-
#settings ⇒ String
Extracts the settings address from the params.
-
#setup_accounts ⇒ Object
Declares all accounts required by this instruction.
-
#system_program ⇒ String
Returns the system program id from the constants.
-
#transaction ⇒ String
Extracts the settings transaction PDA address from the params.
-
#transaction_rent_collector ⇒ String
Extracts the transaction rent collector address from the params.
Instance Method Details
#build_instruction(context) ⇒ Solace::Instruction
Builds the instruction with resolved account indices.
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 85 def build_instruction(context) SquadsSmartAccounts::Instructions::CloseSettingsTransactionInstruction.build( settings_index: context.index_of(settings), proposal_index: context.index_of(proposal), transaction_index: context.index_of(transaction), proposal_rent_collector_index: context.index_of(proposal_rent_collector), transaction_rent_collector_index: context.index_of(transaction_rent_collector), system_program_index: context.index_of(system_program), program_index: context.index_of(program_id) ) end |
#program_id ⇒ String
Returns the Squads Smart Account program id from the constants
59 60 61 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 59 def program_id SquadsSmartAccounts::PROGRAM_ID end |
#proposal ⇒ String
Extracts the proposal PDA address from the params
31 32 33 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 31 def proposal params[:proposal].to_s end |
#proposal_rent_collector ⇒ String
Extracts the proposal rent collector address from the params
45 46 47 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 45 def proposal_rent_collector params[:proposal_rent_collector].to_s end |
#settings ⇒ String
Extracts the settings address from the params
24 25 26 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 24 def settings params[:settings].to_s end |
#setup_accounts ⇒ Object
Declares all accounts required by this instruction.
71 72 73 74 75 76 77 78 79 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 71 def setup_accounts account_context.add_readonly_nonsigner(settings) account_context.add_writable_nonsigner(proposal) account_context.add_writable_nonsigner(transaction) account_context.add_writable_nonsigner(proposal_rent_collector) account_context.add_writable_nonsigner(transaction_rent_collector) account_context.add_readonly_nonsigner(system_program) account_context.add_readonly_nonsigner(program_id) end |
#system_program ⇒ String
Returns the system program id from the constants
66 67 68 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 66 def system_program Solace::Constants::SYSTEM_PROGRAM_ID end |
#transaction ⇒ String
Extracts the settings transaction PDA address from the params
38 39 40 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 38 def transaction params[:transaction].to_s end |
#transaction_rent_collector ⇒ String
Extracts the transaction rent collector address from the params
52 53 54 |
# File 'lib/solace/squads_smart_accounts/composers/close_settings_transaction_composer.rb', line 52 def transaction_rent_collector params[:transaction_rent_collector].to_s end |