mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Add more tests of getFee (#897)
This commit is contained in:
@@ -1075,6 +1075,8 @@ return api.getServerInfo().then(info => {/* ... */});
|
|||||||
|
|
||||||
Returns the estimated transaction fee for the rippled server the RippleAPI instance is connected to.
|
Returns the estimated transaction fee for the rippled server the RippleAPI instance is connected to.
|
||||||
|
|
||||||
|
This will use the [feeCushion parameter](#parameters) provided to the RippleAPI constructor, or the default value of `1.2`.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description
|
Name | Type | Description
|
||||||
@@ -1083,7 +1085,7 @@ cushion | number | *Optional* The fee is the product of the base fee, the `load_
|
|||||||
|
|
||||||
### Return Value
|
### Return Value
|
||||||
|
|
||||||
This method returns a promise that resolves with a string encoded floating point value representing the estimated fee to submit a transaction, expressed in XRP.
|
This method returns a promise that resolves with a string-encoded floating point value representing the estimated fee to submit a transaction, expressed in XRP.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -1092,7 +1094,7 @@ return api.getFee().then(fee => {/* ... */});
|
|||||||
```
|
```
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"0.012"
|
"0.000012"
|
||||||
```
|
```
|
||||||
|
|
||||||
## getLedgerVersion
|
## getLedgerVersion
|
||||||
|
|||||||
@@ -4,13 +4,15 @@
|
|||||||
|
|
||||||
Returns the estimated transaction fee for the rippled server the RippleAPI instance is connected to.
|
Returns the estimated transaction fee for the rippled server the RippleAPI instance is connected to.
|
||||||
|
|
||||||
|
This will use the [feeCushion parameter](#parameters) provided to the RippleAPI constructor, or the default value of `1.2`.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
<%- renderSchema('input/get-fee.json') %>
|
<%- renderSchema('input/get-fee.json') %>
|
||||||
|
|
||||||
### Return Value
|
### Return Value
|
||||||
|
|
||||||
This method returns a promise that resolves with a string encoded floating point value representing the estimated fee to submit a transaction, expressed in XRP.
|
This method returns a promise that resolves with a string-encoded floating point value representing the estimated fee to submit a transaction, expressed in XRP.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -19,5 +21,5 @@ return api.getFee().then(fee => {/* ... */});
|
|||||||
```
|
```
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"0.012"
|
"0.000012"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1854,6 +1854,23 @@ describe('RippleAPI', function () {
|
|||||||
_.partial(checkResult, expectedResponse, 'prepare'));
|
_.partial(checkResult, expectedResponse, 'prepare'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getFee custom cushion', function () {
|
||||||
|
this.api._feeCushion = 1.4;
|
||||||
|
return this.api.getFee().then(fee => {
|
||||||
|
assert.strictEqual(fee, '0.000014');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// This is not recommended since it may result in attempting to pay
|
||||||
|
// less than the base fee. However, this test verifies
|
||||||
|
// the existing behavior.
|
||||||
|
it('getFee cushion less than 1.0', function () {
|
||||||
|
this.api._feeCushion = 0.9;
|
||||||
|
return this.api.getFee().then(fee => {
|
||||||
|
assert.strictEqual(fee, '0.000009');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('disconnect & isConnected', function () {
|
it('disconnect & isConnected', function () {
|
||||||
assert.strictEqual(this.api.isConnected(), true);
|
assert.strictEqual(this.api.isConnected(), true);
|
||||||
return this.api.disconnect().then(() => {
|
return this.api.disconnect().then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user