Sha256: ee900810c4bdde203660e113863295464179b703c6df697e468f52d52f0a0f87

Contents?: true

Size: 426 Bytes

Versions: 5

Compression:

Stored size: 426 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_asset = s.offers.first.asset_send
      source_offers = s.offers.take_while{|o| o.asset_send == source_asset}

      source_offers.map(&:amount_send).sum
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stellar-base-0.1.4 lib/stellar/path_payment_result.rb
stellar-base-0.1.3 lib/stellar/path_payment_result.rb
stellar-base-0.1.2 lib/stellar/path_payment_result.rb
stellar-base-0.1.1 lib/stellar/path_payment_result.rb
stellar-base-0.1.0 lib/stellar/path_payment_result.rb