Files
xahau.js/test/fixtures/requests/index.js
Alan Cohen 6b8cd6151d Filter insufficient source funds paths from pathfind results
When pathfinding with source amount, we need to filter out paths where source
amount is not equal to the specified source amount. This is due to the behavior
of rippled when specifying a source amount during pathfinding.

Example:

 {
  "command": "ripple_path_find",
  "source_account": "rhFQQ4ATC6MDF9ghTq3qAoCsGbGtjnhcXF",
  "destination_account": "rp91GUd5R3Rk3ipqW7XBdtrUJcX8epzGyb",
  "destination_amount": {
    "currency": "EUR",
    "issuer": "rp91GUd5R3Rk3ipqW7XBdtrUJcX8epzGyb",
    "value": -1
  },
  "send_max": {
    "currency": "USD",
    "issuer": "rhFQQ4ATC6MDF9ghTq3qAoCsGbGtjnhcXF",
    "value": "1234567891"
  },
  "id": 2
}
{
  "id": 2,
  "result": {
    "alternatives": [
      {
        "destination_amount": {
          "currency": "EUR",
          "issuer": "rp91GUd5R3Rk3ipqW7XBdtrUJcX8epzGyb",
          "value": "3999889.62127857"
        },
        "paths_canonical": [],
        "paths_computed": [
          [
            {
              "account": "rcsxQxEqU2qquAKp3tBUJy8Z2t19ioQPJ",
              "type": 1,
              "type_hex": "0000000000000001"
            },
            {
              "currency": "EUR",
              "issuer": "rp91GUd5R3Rk3ipqW7XBdtrUJcX8epzGyb",
              "type": 48,
              "type_hex": "0000000000000030"
            }
          ]
        ],
        "source_amount": {
          "currency": "USD",
          "issuer": "rhFQQ4ATC6MDF9ghTq3qAoCsGbGtjnhcXF",
          "value": "4170759.906037564"
        }
      }
    ],
    "destination_account": "rp91GUd5R3Rk3ipqW7XBdtrUJcX8epzGyb",
    "destination_amount": {
      "currency": "EUR",
      "issuer": "rp91GUd5R3Rk3ipqW7XBdtrUJcX8epzGyb",
      "value": "-1"
    },
    "destination_currencies": [
      "EUR",
      "XRP"
    ],
    "full_reply": true,
    "id": 2,
    "source_account": "rhFQQ4ATC6MDF9ghTq3qAoCsGbGtjnhcXF",
    "status": "success"
  },
  "status": "success",
  "type": "response"
}
2016-01-15 13:38:57 -08:00

74 lines
2.6 KiB
JavaScript

'use strict';
module.exports = {
prepareOrder: {
buy: require('./prepare-order'),
sell: require('./prepare-order-sell'),
expiration: require('./prepare-order-expiration')
},
prepareOrderCancellation: {
simple: require('./prepare-order-cancellation'),
withMemos: require('./prepare-order-cancellation-memos')
},
preparePayment: {
normal: require('./prepare-payment'),
minAmountXRP: require('./prepare-payment-min-xrp'),
minAmount: require('./prepare-payment-min'),
wrongAddress: require('./prepare-payment-wrong-address'),
wrongAmount: require('./prepare-payment-wrong-amount'),
wrongPartial: require('./prepare-payment-wrong-partial'),
allOptions: require('./prepare-payment-all-options'),
noCounterparty: require('./prepare-payment-no-counterparty')
},
prepareSettings: {
domain: require('./prepare-settings'),
signers: require('./prepare-settings-signers')
},
prepareSuspendedPaymentCreation: {
normal: require('./prepare-suspended-payment-creation'),
full: require('./prepare-suspended-payment-creation-full')
},
prepareSuspendedPaymentExecution: {
normal: require('./prepare-suspended-payment-execution'),
simple: require('./prepare-suspended-payment-execution-simple')
},
prepareSuspendedPaymentCancellation: {
normal: require('./prepare-suspended-payment-cancellation'),
memos: require('./prepare-suspended-payment-cancellation-memos')
},
prepareTrustline: {
simple: require('./prepare-trustline-simple'),
complex: require('./prepare-trustline'),
frozen: require('./prepare-trustline-frozen.json')
},
sign: {
normal: require('./sign'),
suspended: require('./sign-suspended.json'),
signAs: require('./sign-as')
},
getPaths: {
normal: require('./getpaths/normal'),
UsdToUsd: require('./getpaths/usd2usd'),
XrpToXrp: require('./getpaths/xrp2xrp'),
XrpToXrpNotEnough: require('./getpaths/xrp2xrp-not-enough'),
NotAcceptCurrency: require('./getpaths/not-accept-currency'),
NoPaths: require('./getpaths/no-paths'),
NoPathsSource: require('./getpaths/no-paths-source-amount'),
NoPathsWithCurrencies: require('./getpaths/no-paths-with-currencies'),
sendAll: require('./getpaths/send-all'),
invalid: require('./getpaths/invalid'),
issuer: require('./getpaths/issuer')
},
getOrderbook: {
normal: require('./get-orderbook'),
withXRP: require('./get-orderbook-with-xrp')
},
computeLedgerHash: {
header: require('./compute-ledger-hash'),
transactions: require('./compute-ledger-hash-transactions')
},
combine: {
setDomain: require('./combine.json')
}
};