Sha256: a27b12f190512841364b665d052a9df93df0b60f24e7d7deb6ec36a4263b2d39

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 Bytes

Contents

module Stellar
  class PaymentOp

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

    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

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

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stellar-base-0.0.5 lib/stellar/payment_op.rb
stellar-base-0.0.4 lib/stellar/payment_op.rb
stellar-base-0.0.3 lib/stellar/payment_op.rb