Sha256: ae7e9fac5fb7e0b2672e113e5ea292e5eb3253d4db7c8ec53cd5361c8896d9f6

Contents?: true

Size: 438 Bytes

Versions: 4

Compression:

Stored size: 438 Bytes

Contents

module Stellar
  class PathPaymentResult
    # send_amount returns the actual amount paid for the corresponding
    # PathPaymentOp to this result.
    #
    def send_amount
      s = success!
      return s.last.amount if s.offers.blank?

      source_currency = s.offers.first.currency_send
      source_offers = s.offers.take_while{|o| o.currency_send == source_currency}

      source_offers.map(&:amount_send).sum
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stellar-base-0.0.20 lib/stellar/path_payment_result.rb
stellar-base-0.0.19 lib/stellar/path_payment_result.rb
stellar-base-0.0.18 lib/stellar/path_payment_result.rb
stellar-base-0.0.17 lib/stellar/path_payment_result.rb