Class: Solace::SquadsSmartAccounts::ProgramConfig

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

Overview

Immutable value object representing the deserialized global ProgramConfig account for the Squads Smart Account program. Fetching from the chain is the Program layer’s responsibility — see Solace::Programs::SquadsSmartAccount#get_program_config.

Examples:

config = program.get_program_config
config.treasury                   # => "SQDS4ep..."
config. # => 10_000_000

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#authorityObject (readonly)

Returns the value of attribute authority

Returns:

  • (Object)

    the current value of authority



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

def authority
  @authority
end

#smart_account_creation_feeObject (readonly)

Returns the value of attribute smart_account_creation_fee

Returns:

  • (Object)

    the current value of smart_account_creation_fee



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

def 
  @smart_account_creation_fee
end

#smart_account_indexObject (readonly)

Returns the value of attribute smart_account_index

Returns:

  • (Object)

    the current value of smart_account_index



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

def 
  @smart_account_index
end

#treasuryObject (readonly)

Returns the value of attribute treasury

Returns:

  • (Object)

    the current value of treasury



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

def treasury
  @treasury
end

Class Method Details

.deserialize(io) ⇒ ProgramConfig

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

Parameters:

  • io (IO, StringIO)

    Stream positioned at the start of the account data.

Returns:



24
25
26
27
28
29
30
31
32
33
# File 'lib/solace/squads_smart_accounts/types/program_config.rb', line 24

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

  new(
    smart_account_index:        Solace::Utils::Codecs.decode_le_u128(io),
    authority:                  Solace::Utils::Codecs.decode_pubkey(io),
    smart_account_creation_fee: Solace::Utils::Codecs.decode_le_u64(io),
    treasury:                   Solace::Utils::Codecs.decode_pubkey(io)
  )
end