Skip to content

Remove a Spending Limit ​

Closes a spending limit on a controlled account, authorized by the settings authority. The closed account's rent is refunded to the named rent collector.

Controlled accounts only via this method. An autonomous account removes a limit through the RemoveSpendingLimit settings transaction action.

Program method — remove_spending_limit_as_authority ​

Signs with payer + settings_authority, then sends. (No rent payer — closing refunds rent.)

ParameterTypeRequiredDefaultDescription
payerKeypairyes—Pays the fee; co-signs.
settings#to_syes—The settings account address.
settings_authority#to_s · Keypairyes—The account's settings authority; must sign.
spending_limit#to_syes—The SpendingLimit PDA to close.
rent_collector#to_syes—Receives the closed account's rent (does not sign).
memoStringnonilOptional indexing memo.

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

ruby
program.remove_spending_limit_as_authority(
  payer:              authority,
  settings:           identity.settings_address,
  settings_authority: authority,
  spending_limit:     spending_limit,
  rent_collector:     authority.address
)

Composer — SquadsSmartAccountsRemoveSpendingLimitAsAuthorityComposer ​

ParameterTypeRequiredDefaultDescription
settings#to_syes—The settings account address.
settings_authority#to_s · Keypairyes—The settings authority; must sign.
spending_limit#to_syes—The SpendingLimit PDA to close.
rent_collector#to_syes—Receives the refunded rent.
memoStringnonilIndexing memo.
ruby
composer = Solace::Composers::SquadsSmartAccountsRemoveSpendingLimitAsAuthorityComposer.new(
  settings:           identity.settings_address,
  settings_authority: authority.address,
  spending_limit:     spending_limit,
  rent_collector:     authority.address
)

tx = Solace::TransactionComposer.new(connection:)
                                .add_instruction(composer)
                                .set_fee_payer(authority)
                                .compose_transaction

tx.sign(authority)
connection.send_transaction(tx.serialize)

Low-level instruction (advanced) ​

  • Discriminator: [94, 32, 68, 127, 251, 44, 145, 7]
  • Encodes (data): option_string(memo) (the accounts carry the rest)
ParameterTypeRequiredDefaultDescription
memoString, nilyes—Indexing memo, or nil.
settings_indexIntegeryes—Index of the settings account.
settings_authority_indexIntegeryes—Index of the settings authority.
spending_limit_indexIntegeryes—Index of the SpendingLimit PDA.
rent_collector_indexIntegeryes—Index of the rent collector.
program_indexIntegeryes—Index of the Squads program.

Unlike the other authority instructions, this one needs no System program account.

Built on Solace