Class: Solace::Composers::SquadsSmartAccountsSetNewSettingsAuthorityAsAuthorityComposer
- Inherits:
-
Base
- Object
- Base
- Solace::Composers::SquadsSmartAccountsSetNewSettingsAuthorityAsAuthorityComposer
- Defined in:
- lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb
Overview
Composes a ‘setNewSettingsAuthorityAsAuthority` instruction for the Squads Smart Account program.
Hands the settings authority of a controlled smart account to a new key. Only the current settings authority may do this — single signature, no consensus.
Required params:
:settings [String] Base58 address of the settings account.
:settings_authority [#to_s, Keypair] The current settings authority (must sign).
:rent_payer [#to_s, Keypair] Pays for settings account reallocation (must sign).
:new_settings_authority [#to_s, nil] Base58 pubkey of the new settings authority, or
nil to renounce control — the program convention
stores Pubkey::default(), permanently converting
the account to autonomous.
Optional params:
:memo [String] Indexing memo (default: nil).
Instance Method Summary collapse
-
#build_instruction(context) ⇒ Solace::Instruction
Builds the instruction with resolved account indices.
-
#memo ⇒ String?
Extracts the memo from the params.
-
#new_settings_authority ⇒ String
Extracts the new settings authority address from the params.
-
#program_id ⇒ String
Returns the Squads Smart Account program id from the constants.
-
#rent_payer ⇒ String
Extracts the rent payer address from the params.
-
#settings ⇒ String
Extracts the settings address from the params.
-
#settings_authority ⇒ String
Extracts the current settings authority 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.
Instance Method Details
#build_instruction(context) ⇒ Solace::Instruction
Builds the instruction with resolved account indices.
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 87 def build_instruction(context) SquadsSmartAccounts::Instructions::SetNewSettingsAuthorityAsAuthorityInstruction.build( new_settings_authority:, memo:, settings_index: context.index_of(settings), settings_authority_index: context.index_of(), rent_payer_index: context.index_of(rent_payer), system_program_index: context.index_of(system_program), program_index: context.index_of(program_id) ) end |
#memo ⇒ String?
Extracts the memo from the params
56 57 58 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 56 def memo params[:memo] end |
#new_settings_authority ⇒ String
Extracts the new settings authority address from the params. A nil param renounces control: the program convention stores Pubkey::default(), permanently converting the account to autonomous.
49 50 51 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 49 def (params[:new_settings_authority] || SquadsSmartAccounts::DEFAULT_PUBKEY).to_s end |
#program_id ⇒ String
Returns the Squads Smart Account program id from the constants
63 64 65 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 63 def program_id SquadsSmartAccounts::PROGRAM_ID end |
#rent_payer ⇒ String
Extracts the rent payer address from the params
40 41 42 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 40 def rent_payer params[:rent_payer].to_s end |
#settings ⇒ String
Extracts the settings address from the params
26 27 28 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 26 def settings params[:settings].to_s end |
#settings_authority ⇒ String
Extracts the current settings authority address from the params
33 34 35 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 33 def params[:settings_authority].to_s end |
#setup_accounts ⇒ Object
Declares all accounts required by this instruction.
75 76 77 78 79 80 81 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 75 def setup_accounts account_context.add_writable_nonsigner(settings) account_context.add_readonly_signer() account_context.add_writable_signer(rent_payer) 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
70 71 72 |
# File 'lib/solace/squads_smart_accounts/composers/set_new_settings_authority_as_authority_composer.rb', line 70 def system_program Solace::Constants::SYSTEM_PROGRAM_ID end |