Class: Solace::Composers::SquadsSmartAccountsAddSignerAsAuthorityComposer
- Inherits:
-
Base
- Object
- Base
- Solace::Composers::SquadsSmartAccountsAddSignerAsAuthorityComposer
- Defined in:
- lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb
Overview
Composes an ‘addSignerAsAuthority` instruction for the Squads Smart Account program.
Adds a new signer to a controlled smart account. Only the account’s 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 account's settings authority (must sign).
:rent_payer [#to_s, Keypair] Pays for settings account reallocation (must sign).
:new_signer [SquadsSmartAccounts::SmartAccountSigner] The signer to add.
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_signer ⇒ SquadsSmartAccounts::SmartAccountSigner
Extracts the new signer 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 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.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 81 def build_instruction(context) SquadsSmartAccounts::Instructions::AddSignerAsAuthorityInstruction.build( new_signer:, 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
50 51 52 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 50 def memo params[:memo] end |
#new_signer ⇒ SquadsSmartAccounts::SmartAccountSigner
Extracts the new signer from the params
43 44 45 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 43 def new_signer params[:new_signer] end |
#program_id ⇒ String
Returns the Squads Smart Account program id from the constants
57 58 59 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 57 def program_id SquadsSmartAccounts::PROGRAM_ID end |
#rent_payer ⇒ String
Extracts the rent payer address from the params
36 37 38 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 36 def rent_payer params[:rent_payer].to_s end |
#settings ⇒ String
Extracts the settings address from the params
22 23 24 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 22 def settings params[:settings].to_s end |
#settings_authority ⇒ String
Extracts the settings authority address from the params
29 30 31 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 29 def params[:settings_authority].to_s end |
#setup_accounts ⇒ Object
Declares all accounts required by this instruction.
69 70 71 72 73 74 75 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 69 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
64 65 66 |
# File 'lib/solace/squads_smart_accounts/composers/add_signer_as_authority_composer.rb', line 64 def system_program Solace::Constants::SYSTEM_PROGRAM_ID end |