Class: Solace::SquadsSmartAccounts::Instructions::RemoveSpendingLimitAsAuthorityInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::RemoveSpendingLimitAsAuthorityInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/remove_spending_limit_as_authority_instruction.rb
Overview
Encodes the ‘removeSpendingLimitAsAuthority` instruction for the Squads Smart Account program.
Closes a SpendingLimit PDA, refunding its rent to the rent collector. Only callable by the account’s settings authority — no consensus involved.
IDL accounts (in order):
0. settings — readonly, non-signer
1. settingsAuthority — readonly, signer
2. spendingLimit — writable, non-signer (closed by the instruction)
3. rentCollector — writable, non-signer (receives the rent refund)
4. program — readonly, non-signer
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:remove_spending_limit_as_authority”)
[94, 32, 68, 127, 251, 44, 145, 7].freeze
Class Method Summary collapse
-
.build(memo:, settings_index:, settings_authority_index:, spending_limit_index:, rent_collector_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for removeSpendingLimitAsAuthority.
-
.data(memo:) ⇒ Array<Integer>
Encodes the ‘RemoveSpendingLimitArgs` struct in Borsh format.
Class Method Details
.build(memo:, settings_index:, settings_authority_index:, spending_limit_index:, rent_collector_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for removeSpendingLimitAsAuthority.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/solace/squads_smart_accounts/instructions/remove_spending_limit_as_authority_instruction.rb', line 31 def self.build( memo:, settings_index:, settings_authority_index:, spending_limit_index:, rent_collector_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ settings_index, , spending_limit_index, rent_collector_index, program_index ] ix.data = data(memo:) end end |
.data(memo:) ⇒ Array<Integer>
Encodes the ‘RemoveSpendingLimitArgs` struct in Borsh format.
56 57 58 |
# File 'lib/solace/squads_smart_accounts/instructions/remove_spending_limit_as_authority_instruction.rb', line 56 def self.data(memo:) DISCRIMINATOR + Solace::Utils::Codecs.encode_option_string(memo) end |