Class: Solace::SquadsSmartAccounts::SettingsTransaction

Inherits:
Data
  • Object
show all
Defined in:
lib/solace/squads_smart_accounts/types/settings_transaction.rb

Overview

Immutable value object for a deserialized SettingsTransaction account — a pending batch of SettingsActions stored by ‘createSettingsTransaction` and applied by `executeSettingsTransaction` once its proposal is approved.

Layout (state/settings_transaction.rs): settings(32), creator(32), rent_collector(32), index(u64), bump(u8), actions(Vec<SettingsAction>). Only the fixed header is decoded — enough to resolve the rent collector for ‘closeSettingsTransaction` and verify identity; the trailing actions Vec is not read (the program reads the actions on-chain).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#bumpObject (readonly)

Returns the value of attribute bump

Returns:

  • (Object)

    the current value of bump



14
15
16
# File 'lib/solace/squads_smart_accounts/types/settings_transaction.rb', line 14

def bump
  @bump
end

#creatorObject (readonly)

Returns the value of attribute creator

Returns:

  • (Object)

    the current value of creator



14
15
16
# File 'lib/solace/squads_smart_accounts/types/settings_transaction.rb', line 14

def creator
  @creator
end

#indexObject (readonly)

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



14
15
16
# File 'lib/solace/squads_smart_accounts/types/settings_transaction.rb', line 14

def index
  @index
end

#rent_collectorObject (readonly)

Returns the value of attribute rent_collector

Returns:

  • (Object)

    the current value of rent_collector



14
15
16
# File 'lib/solace/squads_smart_accounts/types/settings_transaction.rb', line 14

def rent_collector
  @rent_collector
end

#settingsObject (readonly)

Returns the value of attribute settings

Returns:

  • (Object)

    the current value of settings



14
15
16
# File 'lib/solace/squads_smart_accounts/types/settings_transaction.rb', line 14

def settings
  @settings
end

Class Method Details

.deserialize(io) ⇒ SettingsTransaction

Deserializes a SettingsTransaction account from a stream of Borsh-encoded account data.

Parameters:

  • io (IO, StringIO)

    Stream positioned at the start of the account data.

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/solace/squads_smart_accounts/types/settings_transaction.rb', line 26

def self.deserialize(io)
  io.read(8) # skip 8-byte Anchor discriminator

  new(
    settings:       Solace::Utils::Codecs.decode_pubkey(io),
    creator:        Solace::Utils::Codecs.decode_pubkey(io),
    rent_collector: Solace::Utils::Codecs.decode_pubkey(io),
    index:          Solace::Utils::Codecs.decode_le_u64(io),
    bump:           Solace::Utils::Codecs.decode_u8(io)
    # Trailing actions Vec<SettingsAction> is not read.
  )
end