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