Class: Solace::SquadsSmartAccounts::Settings

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

Overview

Immutable value object representing the deserialized Settings account of a smart account. The settings account is the root state account created by ‘createSmartAccount` and holds the signer set, threshold, and time lock.

Examples:

settings = program.get_settings(settings_address: settings_address)
settings.threshold      # => 1
settings.signers        # => [SmartAccountSigner, ...]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#account_utilizationObject (readonly)

Returns the value of attribute account_utilization

Returns:

  • (Object)

    the current value of account_utilization



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def 
  @account_utilization
end

#archivable_afterObject (readonly)

Returns the value of attribute archivable_after

Returns:

  • (Object)

    the current value of archivable_after



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def archivable_after
  @archivable_after
end

#archival_authorityObject (readonly)

Returns the value of attribute archival_authority

Returns:

  • (Object)

    the current value of archival_authority



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def archival_authority
  @archival_authority
end

#bumpObject (readonly)

Returns the value of attribute bump

Returns:

  • (Object)

    the current value of bump



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def bump
  @bump
end

#seedObject (readonly)

Returns the value of attribute seed

Returns:

  • (Object)

    the current value of seed



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def seed
  @seed
end

#settings_authorityObject (readonly)

Returns the value of attribute settings_authority

Returns:

  • (Object)

    the current value of settings_authority



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def settings_authority
  @settings_authority
end

#signersObject (readonly)

Returns the value of attribute signers

Returns:

  • (Object)

    the current value of signers



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def signers
  @signers
end

#stale_transaction_indexObject (readonly)

Returns the value of attribute stale_transaction_index

Returns:

  • (Object)

    the current value of stale_transaction_index



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def stale_transaction_index
  @stale_transaction_index
end

#thresholdObject (readonly)

Returns the value of attribute threshold

Returns:

  • (Object)

    the current value of threshold



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def threshold
  @threshold
end

#time_lockObject (readonly)

Returns the value of attribute time_lock

Returns:

  • (Object)

    the current value of time_lock



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def time_lock
  @time_lock
end

#transaction_indexObject (readonly)

Returns the value of attribute transaction_index

Returns:

  • (Object)

    the current value of transaction_index



13
14
15
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 13

def transaction_index
  @transaction_index
end

Class Method Details

.deserialize(io) ⇒ Settings

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

Parameters:

  • io (IO, StringIO)

    Stream positioned at the start of the account data.

Returns:

  • (Settings)

    The deserialized, frozen settings value.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/solace/squads_smart_accounts/types/settings.rb', line 30

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

  new(
    seed:                    Solace::Utils::Codecs.decode_le_u128(io),
    settings_authority:      Solace::Utils::Codecs.decode_pubkey(io),
    threshold:               Solace::Utils::Codecs.decode_le_u16(io),
    time_lock:               Solace::Utils::Codecs.decode_le_u32(io),
    transaction_index:       Solace::Utils::Codecs.decode_le_u64(io),
    stale_transaction_index: Solace::Utils::Codecs.decode_le_u64(io),
    archival_authority:      Solace::Utils::Codecs.decode_option_pubkey(io),
    archivable_after:        Solace::Utils::Codecs.decode_le_u64(io),
    bump:                    Solace::Utils::Codecs.decode_u8(io),
    signers:                 Solace::Utils::Codecs.(io),
    account_utilization:     Solace::Utils::Codecs.decode_u8(io)
    # Trailing reserved1/reserved2 bytes are not read.
  )
end