Class: Stellar::PathPaymentStrictReceiveResult

Inherits:
Object
  • Object
show all
Defined in:
lib/stellar/path_payment_strict_receive_result.rb

Instance Method Summary collapse

Instance Method Details

#send_amountObject

send_amount returns the actual amount paid for the corresponding PathPaymentOp to this result.


6
7
8
9
10
11
12
13
14
# File 'lib/stellar/path_payment_strict_receive_result.rb', line 6

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