mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
Switch back to ripple_path_find
This commit is contained in:
@@ -25,12 +25,13 @@ export type PathFind = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PathFindParams = {
|
export type PathFindRequest = {
|
||||||
src_account: string,
|
command: string,
|
||||||
dst_amount: RippledAmount,
|
source_account: string,
|
||||||
dst_account: string,
|
destination_amount: RippledAmount,
|
||||||
src_amount?: RippledAmount,
|
destination_account: string,
|
||||||
src_currencies?: Array<string>
|
source_amount?: RippledAmount,
|
||||||
|
source_currencies?: Array<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RippledPathsResponse = {
|
export type RippledPathsResponse = {
|
||||||
|
|||||||
@@ -10,34 +10,36 @@ const NotFoundError = utils.common.errors.NotFoundError;
|
|||||||
const ValidationError = utils.common.errors.ValidationError;
|
const ValidationError = utils.common.errors.ValidationError;
|
||||||
import type {Remote} from '../../core/remote';
|
import type {Remote} from '../../core/remote';
|
||||||
import type {RippledAmount} from '../common/types.js';
|
import type {RippledAmount} from '../common/types.js';
|
||||||
import type {GetPaths, PathFind, PathFindParams,
|
import type {GetPaths, PathFind, RippledPathsResponse, PathFindRequest}
|
||||||
RippledPathsResponse} from './pathfind-types.js';
|
from './pathfind-types.js';
|
||||||
|
|
||||||
|
|
||||||
function addParams(params: PathFindParams, result: RippledPathsResponse) {
|
function addParams(request: PathFindRequest, result: RippledPathsResponse) {
|
||||||
return _.defaults(_.assign({}, result, {
|
return _.defaults(_.assign({}, result, {
|
||||||
source_account: params.src_account,
|
source_account: request.source_account,
|
||||||
source_currencies: params.src_currencies
|
source_currencies: request.source_currencies
|
||||||
}), {destination_amount: params.dst_amount});
|
}), {destination_amount: request.destination_amount});
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestPathFind(remote: Remote, pathfind: PathFind, callback) {
|
function requestPathFind(remote: Remote, pathfind: PathFind, callback) {
|
||||||
const destinationAmount = _.assign({value: -1}, pathfind.destination.amount);
|
const destinationAmount = _.assign({value: -1}, pathfind.destination.amount);
|
||||||
const params: PathFindParams = {
|
const request: PathFindRequest = {
|
||||||
src_account: pathfind.source.address,
|
command: 'ripple_path_find',
|
||||||
dst_account: pathfind.destination.address,
|
source_account: pathfind.source.address,
|
||||||
dst_amount: toRippledAmount(destinationAmount)
|
destination_account: pathfind.destination.address,
|
||||||
|
destination_amount: toRippledAmount(destinationAmount)
|
||||||
};
|
};
|
||||||
if (typeof params.dst_amount === 'object' && !params.dst_amount.issuer) {
|
if (typeof request.destination_amount === 'object'
|
||||||
|
&& !request.destination_amount.issuer) {
|
||||||
// Convert blank issuer to sender's address
|
// Convert blank issuer to sender's address
|
||||||
// (Ripple convention for 'any issuer')
|
// (Ripple convention for 'any issuer')
|
||||||
// https://ripple.com/build/transactions/
|
// https://ripple.com/build/transactions/
|
||||||
// #special-issuer-values-for-sendmax-and-amount
|
// #special-issuer-values-for-sendmax-and-amount
|
||||||
// https://ripple.com/build/ripple-rest/#counterparties-in-payments
|
// https://ripple.com/build/ripple-rest/#counterparties-in-payments
|
||||||
params.dst_amount.issuer = params.dst_account;
|
request.destination_amount.issuer = request.destination_account;
|
||||||
}
|
}
|
||||||
if (pathfind.source.currencies && pathfind.source.currencies.length > 0) {
|
if (pathfind.source.currencies && pathfind.source.currencies.length > 0) {
|
||||||
params.src_currencies = pathfind.source.currencies.map(amount =>
|
request.source_currencies = pathfind.source.currencies.map(amount =>
|
||||||
_.omit(toRippledAmount(amount), 'value'));
|
_.omit(toRippledAmount(amount), 'value'));
|
||||||
}
|
}
|
||||||
if (pathfind.source.amount) {
|
if (pathfind.source.amount) {
|
||||||
@@ -45,14 +47,14 @@ function requestPathFind(remote: Remote, pathfind: PathFind, callback) {
|
|||||||
throw new ValidationError('Cannot specify both source.amount'
|
throw new ValidationError('Cannot specify both source.amount'
|
||||||
+ ' and destination.amount.value in getPaths');
|
+ ' and destination.amount.value in getPaths');
|
||||||
}
|
}
|
||||||
params.src_amount = toRippledAmount(pathfind.source.amount);
|
request.source_amount = toRippledAmount(pathfind.source.amount);
|
||||||
if (params.src_amount.currency && !params.src_amount.issuer) {
|
if (request.source_amount.currency && !request.source_amount.issuer) {
|
||||||
params.src_amount.issuer = pathfind.source.address;
|
request.source_amount.issuer = pathfind.source.address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remote.createPathFind(params,
|
remote.rawRequest(request,
|
||||||
composeAsync(_.partial(addParams, params), convertErrors(callback)));
|
composeAsync(_.partial(addParams, request), convertErrors(callback)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDirectXrpPath(paths: RippledPathsResponse, xrpBalance: string
|
function addDirectXrpPath(paths: RippledPathsResponse, xrpBalance: string
|
||||||
|
|||||||
617
test/fixtures/api/rippled/path-find-send-all.json
vendored
617
test/fixtures/api/rippled/path-find-send-all.json
vendored
@@ -1,313 +1,316 @@
|
|||||||
{
|
{
|
||||||
"alternatives": [
|
"result": {
|
||||||
{
|
"alternatives": [
|
||||||
"destination_amount": {
|
{
|
||||||
"currency": "USD",
|
"destination_amount": {
|
||||||
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
"currency": "USD",
|
||||||
"value": "4.93463759481038"
|
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
},
|
"value": "4.93463759481038"
|
||||||
"paths_computed": [
|
},
|
||||||
[
|
"paths_computed": [
|
||||||
{
|
[
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
{
|
||||||
"type": 1,
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
"type_hex": "0000000000000001"
|
"type": 1,
|
||||||
},
|
"type_hex": "0000000000000001"
|
||||||
{
|
},
|
||||||
"currency": "XRP",
|
{
|
||||||
"type": 16,
|
"currency": "XRP",
|
||||||
"type_hex": "0000000000000010"
|
"type": 16,
|
||||||
},
|
"type_hex": "0000000000000010"
|
||||||
{
|
},
|
||||||
"currency": "USD",
|
{
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
"currency": "USD",
|
||||||
"type": 48,
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
"type_hex": "0000000000000030"
|
"type": 48,
|
||||||
},
|
"type_hex": "0000000000000030"
|
||||||
{
|
},
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
{
|
||||||
"type": 1,
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
"type_hex": "0000000000000001"
|
"type": 1,
|
||||||
},
|
"type_hex": "0000000000000001"
|
||||||
{
|
},
|
||||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
{
|
||||||
"type": 1,
|
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
"type_hex": "0000000000000001"
|
"type": 1,
|
||||||
}
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"type": 16,
|
||||||
|
"type_hex": "0000000000000010"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
]
|
||||||
],
|
],
|
||||||
[
|
"source_amount": {
|
||||||
{
|
"currency": "USD",
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
"type": 1,
|
"value": "5"
|
||||||
"type_hex": "0000000000000001"
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"currency": "XRP",
|
"destination_amount": {
|
||||||
"type": 16,
|
"currency": "USD",
|
||||||
"type_hex": "0000000000000010"
|
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
},
|
"value": "4.93463759481038"
|
||||||
{
|
},
|
||||||
"currency": "USD",
|
"paths_computed": [
|
||||||
"issuer": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
[
|
||||||
"type": 48,
|
{
|
||||||
"type_hex": "0000000000000030"
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
},
|
"type": 1,
|
||||||
{
|
"type_hex": "0000000000000001"
|
||||||
"account": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
},
|
||||||
"type": 1,
|
{
|
||||||
"type_hex": "0000000000000001"
|
"currency": "XRP",
|
||||||
},
|
"type": 16,
|
||||||
{
|
"type_hex": "0000000000000010"
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
},
|
||||||
"type": 1,
|
{
|
||||||
"type_hex": "0000000000000001"
|
"currency": "USD",
|
||||||
}
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
]
|
"type": 48,
|
||||||
],
|
"type_hex": "0000000000000030"
|
||||||
"source_amount": {
|
},
|
||||||
"currency": "USD",
|
{
|
||||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
"value": "5"
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "EUR",
|
||||||
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"source_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"value": "5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"destination_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"value": "4.93463759481038"
|
||||||
|
},
|
||||||
|
"paths_computed": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"type": 16,
|
||||||
|
"type_hex": "0000000000000010"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"type": 16,
|
||||||
|
"type_hex": "0000000000000010"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "JPY",
|
||||||
|
"issuer": "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"source_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"value": "5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"destination_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"value": "4.990019960079841"
|
||||||
|
},
|
||||||
|
"paths_computed": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"source_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"value": "5"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"destination_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"value": "-1"
|
||||||
},
|
},
|
||||||
{
|
"full_reply": true,
|
||||||
"destination_amount": {
|
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
|
||||||
"value": "4.93463759481038"
|
|
||||||
},
|
|
||||||
"paths_computed": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "XRP",
|
|
||||||
"type": 16,
|
|
||||||
"type_hex": "0000000000000010"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "EUR",
|
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"source_amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
|
||||||
"value": "5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"destination_amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
|
||||||
"value": "4.93463759481038"
|
|
||||||
},
|
|
||||||
"paths_computed": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "XRP",
|
|
||||||
"type": 16,
|
|
||||||
"type_hex": "0000000000000010"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "XRP",
|
|
||||||
"type": 16,
|
|
||||||
"type_hex": "0000000000000010"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rfsEoNBUBbvkf4jPcFe2u9CyaQagLVHGfP",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "JPY",
|
|
||||||
"issuer": "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"source_amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
|
||||||
"value": "5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"destination_amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
|
||||||
"value": "4.990019960079841"
|
|
||||||
},
|
|
||||||
"paths_computed": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 48,
|
|
||||||
"type_hex": "0000000000000030"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"type": 1,
|
|
||||||
"type_hex": "0000000000000001"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"source_amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
|
||||||
"value": "5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
|
||||||
"destination_amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
|
||||||
"value": "-1"
|
|
||||||
},
|
},
|
||||||
"full_reply": true,
|
"type": "response",
|
||||||
"id": 1,
|
"status": "success",
|
||||||
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
"id": 1
|
||||||
"type": "path_find"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,9 +254,9 @@ module.exports = function(port) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mock.on('request_path_find', function(request, conn) {
|
mock.on('request_ripple_path_find', function(request, conn) {
|
||||||
let response = null;
|
let response = null;
|
||||||
if (request.subcommand === 'close') {
|
if (request.subcommand === 'close') { // for path_find command
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (request.source_account === addresses.NOTFOUND) {
|
if (request.source_account === addresses.NOTFOUND) {
|
||||||
|
|||||||
Reference in New Issue
Block a user