Method: Stellar::Operation.path_payment_strict_send

Defined in:
lib/stellar/operation.rb

.path_payment_strict_send(destination:, amount:, with:, path: [], source_account: nil) ⇒ Stellar::Operation

Path Payment Strict Receive operation builder.

Parameters:

  • source_account (KeyPair, nil) (defaults to: nil)

    the source account for the operation

  • destination (Stellar::KeyPair)

    the receiver of the payment

  • amount (Array)

    the destination asset and the minimum amount of destination asset to be received

  • with (Array)

    the source asset and amount to pay with

  • path (Array<Stellar::Asset>) (defaults to: [])

    the payment path to use

Returns:

Raises:

  • (ArgumentError)


299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/stellar/operation.rb', line 299

def path_payment_strict_send(destination:, amount:, with:, path: [], source_account: nil)
  raise ArgumentError unless destination.is_a?(KeyPair)

  dest_asset, dest_min = get_asset_amount(amount)
  send_asset, send_amount = get_asset_amount(with)

  op = PathPaymentStrictSendOp.new(
    destination: destination.,
    send_asset: send_asset,
    send_amount: send_amount,
    dest_asset: dest_asset,
    dest_min: dest_min,
    path: path.map { |p| Asset(p) }
  )

  make(source_account: , body: [:path_payment_strict_send, op])
end