mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Use maxAmount in getPaths results so they can be passed to preparePayment
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"source": {"$ref": "adjustment"},
|
||||
"source": {"$ref": "maxAdjustment"},
|
||||
"destination": {"$ref": "adjustment"},
|
||||
"paths": {"type": "string"}
|
||||
},
|
||||
|
||||
@@ -9,12 +9,13 @@ function parsePaths(paths) {
|
||||
}
|
||||
|
||||
function parsePathfind(sourceAddress: string,
|
||||
destinationAmount: Object, pathfindResult: Object): Object {
|
||||
destinationAmount: Object, pathfindResult: Object
|
||||
): Object {
|
||||
return pathfindResult.alternatives.map(function(alternative) {
|
||||
return {
|
||||
source: {
|
||||
address: sourceAddress,
|
||||
amount: parseAmount(alternative.source_amount)
|
||||
maxAmount: parseAmount(alternative.source_amount)
|
||||
},
|
||||
destination: {
|
||||
address: pathfindResult.destination_account,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"source": {
|
||||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||
"amount": {
|
||||
"maxAmount": {
|
||||
"currency": "USD",
|
||||
"value": "0.000001002",
|
||||
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"source": {
|
||||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J",
|
||||
"amount": {
|
||||
"maxAmount": {
|
||||
"currency": "XRP",
|
||||
"value": "0.000002"
|
||||
}
|
||||
|
||||
6
test/fixtures/api/responses/get-paths.json
vendored
6
test/fixtures/api/responses/get-paths.json
vendored
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"source": {
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"amount": {
|
||||
"maxAmount": {
|
||||
"currency": "JPY",
|
||||
"value": "0.1117218827811721",
|
||||
"counterparty": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||
@@ -21,7 +21,7 @@
|
||||
{
|
||||
"source": {
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"amount": {
|
||||
"maxAmount": {
|
||||
"currency": "USD",
|
||||
"value": "0.001002",
|
||||
"counterparty": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||
@@ -40,7 +40,7 @@
|
||||
{
|
||||
"source": {
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"amount": {
|
||||
"maxAmount": {
|
||||
"currency": "XRP",
|
||||
"value": "0.207669"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user