mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-08-23 08:30:51 +00:00
Implement Remote#reserve().
This commit is contained in:
@@ -1477,9 +1477,18 @@ Remote.prototype.fee_tx_unit = function ()
|
||||
*
|
||||
* Returns the base reserve with load fees and safety margin applied.
|
||||
*/
|
||||
Remote.prototype.fee_reserve_base = function ()
|
||||
Remote.prototype.reserve = function (owner_count)
|
||||
{
|
||||
// XXX
|
||||
var reserve_base = Amount.from_json(""+this._reserve_base);
|
||||
var reserve_inc = Amount.from_json(""+this._reserve_inc);
|
||||
|
||||
owner_count = owner_count || 0;
|
||||
|
||||
if (owner_count < 0) {
|
||||
throw new Error("Owner count must not be negative.");
|
||||
}
|
||||
|
||||
return reserve_base.add(reserve_inc.product_human(owner_count));
|
||||
};
|
||||
|
||||
exports.Remote = Remote;
|
||||
|
||||
@@ -157,7 +157,9 @@ var create_accounts = function (remote, src, amount, accounts, callback) {
|
||||
.on('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
callback(m.result != 'tesSUCCESS');
|
||||
if (m.result != 'tesSUCCESS') {
|
||||
callback(new Error("Transaction did not succeed."));
|
||||
} else callback(null);
|
||||
})
|
||||
.on('error', function (m) {
|
||||
// console.log("error: %s", JSON.stringify(m));
|
||||
|
||||
Reference in New Issue
Block a user