Sha256: 123e407f7d9b50a8647a774fe58fe801108dcd65596fe00551c07e0c8cc22151

Contents?: true

Size: 445 Bytes

Versions: 2

Compression:

Stored size: 445 Bytes

Contents

module Stellar
  class PathPaymentStrictReceiveResult
    # 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_bought
      source_offers = s.offers.take_while{|o| o.asset_bought == source_asset}

      source_offers.map(&:amount_bought).sum
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stellar-base-0.22.0 lib/stellar/path_payment_strict_receive_result.rb
stellar-base-0.21.0 lib/stellar/path_payment_strict_receive_result.rb