Sha256: edf05aa2c261625fb18e66d5fa4c8d2f67dd44e1fd99156d2e3f2a16e0241528

Contents?: true

Size: 432 Bytes

Versions: 24

Compression:

Stored size: 432 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_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

24 entries across 24 versions & 3 rubygems

Version Path
stellar-base-0.20.0 lib/stellar/path_payment_result.rb
stellar-base-0.19.0 lib/stellar/path_payment_result.rb
stellar-base-0.18.0 lib/stellar/path_payment_result.rb
stellar-base-0.17.0 lib/stellar/path_payment_result.rb
stellar-base-0.16.0 lib/stellar/path_payment_result.rb
stellar-base-0.15.0 lib/stellar/path_payment_result.rb
stellar-base-0.14.0 lib/stellar/path_payment_result.rb
stellar-base-0.13.0 lib/stellar/path_payment_result.rb
stellar-base-0.12.0 lib/stellar/path_payment_result.rb
stellar-base-0.11.0 lib/stellar/path_payment_result.rb
auction-ruby-base-0.1.3 lib/stellar/path_payment_result.rb
auction-ruby-base-0.1.2 lib/stellar/path_payment_result.rb
auction-ruby-base-0.1.1 lib/stellar/path_payment_result.rb
stellar-base-0.10.0 lib/stellar/path_payment_result.rb
stellar-base-0.9.0 lib/stellar/path_payment_result.rb
stellar-base-0.8.0 lib/stellar/path_payment_result.rb
stellar-base-0.7.0 lib/stellar/path_payment_result.rb
stellar-base-0.6.1 lib/stellar/path_payment_result.rb
stellar-base-0.6.0 lib/stellar/path_payment_result.rb
stellar-base-0.5.0 lib/stellar/path_payment_result.rb