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
payerKeypairyesPays the fee; co-signs.
settings#to_syesThe settings account address.
settings_authority#to_s · KeypairyesThe account's settings authority; must sign.
spending_limit#to_syesThe SpendingLimit PDA to close.
rent_collector#to_syesReceives 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_syesThe settings account address.
settings_authority#to_s · KeypairyesThe settings authority; must sign.
spending_limit#to_syesThe SpendingLimit PDA to close.
rent_collector#to_syesReceives 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, nilyesIndexing memo, or nil.
settings_indexIntegeryesIndex of the settings account.
settings_authority_indexIntegeryesIndex of the settings authority.
spending_limit_indexIntegeryesIndex of the SpendingLimit PDA.
rent_collector_indexIntegeryesIndex of the rent collector.
program_indexIntegeryesIndex of the Squads program.

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

Built on Solace