Class: Stellar::LedgerKey

Inherits:
Object
  • Object
show all
Extended by:
DSL
Defined in:
lib/stellar/ledger_key.rb

Class Method Summary collapse

Methods included from DSL

Asset, ClaimPredicate, Claimant, KeyPair, SignerKey

Class Method Details

.from(account_id:, **options) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stellar/ledger_key.rb', line 13

def from(account_id:, **options)
  field, value = options.first
  case field
  when nil
    (account_id: KeyPair().)
  when :balance_id
    claimable_balance(balance_id: ClaimableBalanceID.v0(Stellar::Convert.from_hex(value.to_s)))
  when :offer_id
    offer(seller_id: , offer_id: Integer(value))
  when :data_name
    data(account_id: , data_name: value.to_s)
  when :asset
    trust_line(account_id: , asset: Asset(value))
  else
    raise ArgumentError, "unknown option #{field} (not in :asset, :offer_id, :data_name, :balance_id)"
  end
end

.switch_for_arm(name) ⇒ Object


9
10
11
# File 'lib/stellar/ledger_key.rb', line 9

def switch_for_arm(name)
  (@switch_by_arm ||= switches.invert).fetch(name)
end