mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 11:45:49 +00:00
Revert "Update pathfind command arguments"
This reverts commit 0753d9cf4a.
This commit is contained in:
@@ -9,18 +9,16 @@ var extend = require('extend');
|
||||
* Only one path find request is allowed per connection, so when another path
|
||||
* find request is triggered it will supercede the existing one, making it emit
|
||||
* the 'end' and 'superceded' events.
|
||||
*
|
||||
* Options:
|
||||
* src_account
|
||||
* dst_account
|
||||
* dst_amount,
|
||||
* src_currencies
|
||||
*/
|
||||
|
||||
function PathFind(remote, options) {
|
||||
function PathFind(remote, src_account, dst_account, dst_amount, src_currencies) {
|
||||
EventEmitter.call(this);
|
||||
this.remote = remote;
|
||||
this.path_options = options;
|
||||
|
||||
this.remote = remote;
|
||||
|
||||
this.src_account = src_account;
|
||||
this.dst_account = dst_account;
|
||||
this.dst_amount = dst_amount;
|
||||
this.src_currencies = src_currencies;
|
||||
};
|
||||
|
||||
util.inherits(PathFind, EventEmitter);
|
||||
@@ -37,7 +35,11 @@ util.inherits(PathFind, EventEmitter);
|
||||
PathFind.prototype.create = function () {
|
||||
var self = this;
|
||||
|
||||
var req = this.remote.request_path_find_create(this.path_options, handleInitialPath);
|
||||
var req = this.remote.request_path_find_create(this.src_account,
|
||||
this.dst_account,
|
||||
this.dst_amount,
|
||||
this.src_currencies,
|
||||
handleInitialPath);
|
||||
|
||||
function handleInitialPath(err, msg) {
|
||||
if (err) {
|
||||
|
||||
@@ -1083,20 +1083,15 @@ Remote.prototype.account = function (accountID) {
|
||||
};
|
||||
|
||||
Remote.prototype.path_find = function (src_account, dst_account, dst_amount, src_currencies) {
|
||||
var options;
|
||||
|
||||
if (typeof src_account === 'object') {
|
||||
options = src_account;
|
||||
} else {
|
||||
options = {
|
||||
src_currencies : options.src_currencies,
|
||||
dst_amount : options.dst_amount,
|
||||
dst_account : options.dst_account || options.destination || options.to,
|
||||
src_account : options.src_account || options.source || options.from
|
||||
}
|
||||
var options = src_account;
|
||||
src_currencies = options.src_currencies;
|
||||
dst_amount = options.dst_amount;
|
||||
dst_account = options.dst_account;
|
||||
src_account = options.src_account;
|
||||
}
|
||||
|
||||
var path_find = new PathFind(this, options);
|
||||
var path_find = new PathFind(this, src_account, dst_account, dst_amount, src_currencies);
|
||||
|
||||
if (this._cur_path_find) {
|
||||
this._cur_path_find.notify_superceded();
|
||||
@@ -1282,10 +1277,6 @@ Remote.prototype.request_ripple_balance = function (account, issuer, currency, l
|
||||
Remote.prepare_currencies = function(ci) {
|
||||
var ci_new = { };
|
||||
|
||||
if (typeof ci === 'string') {
|
||||
ci = { currency: ci }
|
||||
}
|
||||
|
||||
if (ci.hasOwnProperty('issuer')) {
|
||||
ci_new.issuer = UInt160.json_rewrite(ci.issuer);
|
||||
}
|
||||
@@ -1301,10 +1292,10 @@ Remote.prototype.request_ripple_path_find = function (src_account, dst_account,
|
||||
if (typeof src_account === 'object') {
|
||||
var options = src_account;
|
||||
callback = dst_account;
|
||||
src_currencies = options.src_currencies || options.currencies;
|
||||
dst_amount = options.dst_amount || options.amount;
|
||||
dst_account = options.dst_account || options.destination || options.to;
|
||||
src_account = options.src_account || options.source || options.from;
|
||||
src_currencies = options.src_currencies;
|
||||
dst_amount = options.dst_amount;
|
||||
dst_account = options.dst_account;
|
||||
src_account = options.src_account;
|
||||
}
|
||||
|
||||
var request = new Request(this, 'ripple_path_find');
|
||||
@@ -1326,10 +1317,10 @@ Remote.prototype.request_path_find_create = function (src_account, dst_account,
|
||||
if (typeof src_account === 'object') {
|
||||
var options = src_account;
|
||||
callback = dst_account;
|
||||
src_currencies = options.src_currencies || options.currencies;
|
||||
dst_amount = options.dst_amount || options.amount;
|
||||
dst_account = options.dst_account || options.destination || options.to;
|
||||
src_account = options.src_account || options.source || options.from;
|
||||
src_currencies = options.src_currencies;
|
||||
dst_amount = options.dst_amount;
|
||||
dst_account = options.dst_account;
|
||||
src_account = options.src_account;
|
||||
}
|
||||
|
||||
var request = new Request(this, 'path_find');
|
||||
|
||||
Reference in New Issue
Block a user