mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-23 05:35:48 +00:00
Remote#fee_tx: Return an Amount of fees for a specified number of units.
This commit is contained in:
@@ -1437,15 +1437,29 @@ Remote.prototype.transaction = function () {
|
||||
return new Transaction(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate a transaction fee for a number of tx fee units.
|
||||
*
|
||||
* This takes into account the last known network and local load fees.
|
||||
*
|
||||
* @return {Amount} Final fee in XRP for specified number of fee units.
|
||||
*/
|
||||
Remote.prototype.fee_tx = function (units)
|
||||
{
|
||||
var fee_unit = this.fee_tx_unit();
|
||||
|
||||
return Amount.from_json(""+Math.ceil(units * fee_unit));
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the current recommended transaction fee unit.
|
||||
*
|
||||
* Multiply this value with the number of fee units in order to calculate the
|
||||
* recommended fee for the transaction you are trying to submit.
|
||||
*
|
||||
* @return {Number} Recommended amount for one fee unit.
|
||||
* @return {Number} Recommended amount for one fee unit as float.
|
||||
*/
|
||||
Remote.prototype.fee_tx = function ()
|
||||
Remote.prototype.fee_tx_unit = function ()
|
||||
{
|
||||
var fee_unit = this._fee_base / this._fee_ref;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user