From b578d06dd352cd6e0cf21cfb488cf6fce967ca88 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 22 Nov 2012 11:51:40 -0800 Subject: [PATCH] Work toward ripple_path_find. --- src/js/remote.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/js/remote.js b/src/js/remote.js index dcc85cb9..313c4b54 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -937,7 +937,29 @@ Remote.prototype.request_ripple_balance = function (account, issuer, currency, c 'account_limit' : accountLimit // Limit set by account with dst as issuer. }); }); -} +}; + +Remote.prototype.request_ripple_path_find = function (src_account, dst_account, dst_amount, source_currencies) { + var self = this; + var request = new Request(this, 'ripple_path_find'); + + request.message.source_account = UInt160.json_rewrite(src_account); + request.message.destination_account = UInt160.json_rewrite(dst_account); + request.message.destination_amount = Amount.json_rewrite(dst_amount); + request.message.source_currencies = source_currencies.map(function (ci) { + var ci_new = {}; + + if ('issuer' in ci) + ci_new.issuer = UInt160.json_rewrite(ci.issuer); + + if ('currency' in ci) + ci_new.currency = Currency.json_rewrite(ci.currency); + + return ci_new; + }); + + return request; +}; Remote.prototype.request_unl_list = function () { return new Request(this, 'unl_list');