Class: Stellar::PaymentOp

Inherits:
XDR::Struct
  • Object
show all
Defined in:
lib/stellar/payment_op.rb,
generated/stellar/payment_op.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.iso4217(code, issuer, amount) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/stellar/payment_op.rb', line 12

def self.iso4217(code, issuer, amount)
  currency = Stellar::Currency.iso4217(code, issuer)
  with_currency(currency).tap do |result|
    result.amount   = amount
    result.send_max = amount
  end
end

.native(amount) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/stellar/payment_op.rb', line 4

def self.native(amount)
  currency = Stellar::Currency.new(:native)
  with_currency(currency).tap do |result|
    result.amount   = amount
    result.send_max = amount
  end
end

.with_currency(currency) ⇒ Object



20
21
22
23
24
25
# File 'lib/stellar/payment_op.rb', line 20

def self.with_currency(currency)
  new.tap do |result|
    result.currency = currency
    result.path     = []
  end
end

Instance Method Details

#apply_defaultsObject



27
28
29
30
# File 'lib/stellar/payment_op.rb', line 27

def apply_defaults
  self.source_memo ||= ""
  self.memo ||= ""
end