Class: StellarSpectrum::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/stellar_spectrum/client.rb

Constant Summary collapse

MAX_LOCK_TIME_IN_SECONDS =
120

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(redis_url: StellarSpectrum.configuration.redis_url, seeds: StellarSpectrum.configuration.seeds, horizon_url: StellarSpectrum.configuration.horizon_url) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
17
18
# File 'lib/stellar_spectrum/client.rb', line 10

def initialize(
  redis_url: StellarSpectrum.configuration.redis_url,
  seeds: StellarSpectrum.configuration.seeds,
  horizon_url: StellarSpectrum.configuration.horizon_url
)
  self.redis_url = redis_url
  self.seeds = seeds
  self.horizon_url = horizon_url
end

Instance Attribute Details

#horizon_urlObject

Returns the value of attribute horizon_url.



6
7
8
# File 'lib/stellar_spectrum/client.rb', line 6

def horizon_url
  @horizon_url
end

#redis_urlObject

Returns the value of attribute redis_url.



4
5
6
# File 'lib/stellar_spectrum/client.rb', line 4

def redis_url
  @redis_url
end

#seedsObject

Returns the value of attribute seeds.



5
6
7
# File 'lib/stellar_spectrum/client.rb', line 5

def seeds
  @seeds
end

Instance Method Details

#send_payment(from:, to:, amount:, memo: nil, transaction_source: nil, sequence: nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/stellar_spectrum/client.rb', line 20

def send_payment(
  from:,
  to:,
  amount:,
  memo: nil,
  transaction_source: nil,
  sequence: nil
)
  result = SendPayment.(
    from: from,
    to: to,
    amount: amount,
    memo: memo,
    seeds: seeds,
    redis_url: redis_url,
    horizon_url: horizon_url,
    force_transaction_source: transaction_source,
    force_sequence_number: sequence,
    force_lock: false,
  )

  result.send_asset_response
end