api/lib/tx-to-rest-converter.js
function parsePaymentsFromPathFind(pathfindResults) {
  return pathfindResults.alternatives.map(function(alternative) {
    return {
      source_account: pathfindResults.source_account,
      source_tag: '',
      source_amount: (typeof alternative.source_amount === 'string' ?
      {
        value: utils.dropsToXrp(alternative.source_amount),
        currency: 'XRP',
        issuer: ''
      } :
      {
        value: alternative.source_amount.value,
        currency: alternative.source_amount.currency,
        issuer: (typeof alternative.source_amount.issuer !== 'string'
          || alternative.source_amount.issuer === pathfindResults.source_account
          ? '' : alternative.source_amount.issuer)
      }),
      source_slippage: '0',
      destination_account: pathfindResults.destination_account,
      destination_tag: '',
      destination_amount: (
        typeof pathfindResults.destination_amount === 'string' ?
      {
        value: utils.dropsToXrp(pathfindResults.destination_amount),
        currency: 'XRP',
        issuer: ''
      } :
      {
        value: pathfindResults.destination_amount.value,
        currency: pathfindResults.destination_amount.currency,
        issuer: pathfindResults.destination_amount.issuer
      }),
      invoice_id: '',
      paths: JSON.stringify(alternative.paths_computed),
      partial_payment: false,
      no_direct_ripple: false
    };
  });
}
function parsePaymentsFromPathFind(pathfindResults) {
  return pathfindResults.alternatives.map(function(alternative) {
    return {
      source_account: pathfindResults.source_account,
      source_tag: '',
      source_amount: (typeof alternative.source_amount === 'string' ?
      {
        value: utils.dropsToXrp(alternative.source_amount),
        currency: 'XRP',
        issuer: ''
      } :
      {
        value: alternative.source_amount.value,
        currency: alternative.source_amount.currency,
        issuer: (typeof alternative.source_amount.issuer !== 'string'
          || alternative.source_amount.issuer === pathfindResults.source_account
          ? '' : alternative.source_amount.issuer)
      }),
      source_slippage: '0',
      destination_account: pathfindResults.destination_account,
      destination_tag: '',
      destination_amount: (
        typeof pathfindResults.destination_amount === 'string' ?
      {
        value: utils.dropsToXrp(pathfindResults.destination_amount),
        currency: 'XRP',
        issuer: ''
      } :
      {
        value: pathfindResults.destination_amount.value,
        currency: pathfindResults.destination_amount.currency,
        issuer: pathfindResults.destination_amount.issuer
      }),
      invoice_id: '',
      paths: JSON.stringify(alternative.paths_computed),
      partial_payment: false,
      no_direct_ripple: false
    };
  });
}
function parsePaymentsFromPathFind ( pathfindResults ) { return pathfindResults . alternatives . map ( function ( alternative ) { return { source_account : pathfindResults . source_account , source_tag : '' , source_amount : ( typeof alternative . source_amount === 'string' ? { value : utils . dropsToXrp ( alternative . source_amount ) , currency : 'XRP' , issuer : '' } : { value : alternative . source_amount . value , currency : alternative . source_amount . currency , issuer : ( typeof alternative . source_amount . issuer !== 'string' || alternative . source_amount . issuer === pathfindResults . source_account ? '' : alternative . source_amount . issuer ) } ) , source_slippage : '0' , destination_account : pathfindResults . destination_account , destination_tag : '' , destination_amount : ( typeof pathfindResults . destination_amount === 'string' ? { value : utils . dropsToXrp ( pathfindResults . destination_amount ) , currency : 'XRP' , issuer : '' } : { value : pathfindResults . destination_amount . value , currency : pathfindResults . destination_amount . currency , issuer : pathfindResults . destination_amount . issuer } ) , invoice_id : '' , paths : JSON . stringify ( alternative . paths_computed ) , partial_payment : false , no_direct_ripple : false } ; } ) ; }
Convert the pathfind results returned from rippled into an
array of payments in the ripple-rest format. The client should be
able to submit any of the payments in the array back to ripple-rest.

@param {rippled Pathfind results} pathfindResults
@param {Amount} options.destination_amount Since this is not returned by
rippled in the pathfind results it can either be added
to the results or included in the options here
@param {RippleAddress} options.source_account Since this is not returned
by rippled in the pathfind results it can either be added
to the results or included in the options here

@returns {Array of Payments} payments
Convert the pathfind results returned from rippled into an array of payments in the ripple - rest format . The client should be able to submit any of the payments in the array back to ripple - rest .