Skip to content

Commit

Permalink
BREAKING CHANGE: Fix types of XRP values in getServerInfo response
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Clark committed Dec 8, 2015
1 parent 261fba3 commit 99d0806
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
14 changes: 7 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,10 @@ pubkeyNode | string | Public key used to verify this node for internal communica
serverState | string | A string indicating to what extent the server is participating in the network. See [Possible Server States](https://ripple.com/build/rippled-apis/#possible-server-states) for more details.
validatedLedger | object | Information about the fully-validated ledger with the highest sequence number (the most recent).
*validatedLedger.* age | integer | The time since the ledger was closed, in seconds.
*validatedLedger.* baseFeeXRP | number | Base fee, in XRP. This may be represented in scientific notation such as 1e-05 for 0.00005.
*validatedLedger.* baseFeeXRP | [value](#value) | Base fee, in XRP. This may be represented in scientific notation such as 1e-05 for 0.00005.
*validatedLedger.* hash | string | Unique hash for the ledger, as an uppercase hexadecimal string.
*validatedLedger.* reserveBaseXRP | integer | Minimum amount of XRP necessary for every account to keep in reserve.
*validatedLedger.* reserveIncrementXRP | integer | Amount of XRP added to the account reserve for each object an account is responsible for in the ledger.
*validatedLedger.* reserveBaseXRP | [value](#value) | Minimum amount of XRP necessary for every account to keep in reserve.
*validatedLedger.* reserveIncrementXRP | [value](#value) | Amount of XRP added to the account reserve for each object an account is responsible for in the ledger.
*validatedLedger.* ledgerVersion | integer | Identifying sequence number of this ledger version.
validationQuorum | number | Minimum number of trusted validations required in order to validate a ledger version. Some circumstances may cause the server to require more validations.
load | object | *Optional* *(Admin only)* Detailed information about the current load state of the server.
Expand Down Expand Up @@ -717,10 +717,10 @@ return api.getServerInfo().then(info => {/* ... */});
"serverState": "full",
"validatedLedger": {
"age": 5,
"baseFeeXRP": 0.00001,
"baseFeeXRP": "0.00001",
"hash": "4482DEE5362332F54A4036ED57EE1767C9F33CF7CE5A6670355C16CECE381D46",
"reserveBaseXRP": 20,
"reserveIncrementXRP": 5,
"reserveBaseXRP": "20",
"reserveIncrementXRP": "5",
"ledgerVersion": 6595042
},
"validationQuorum": 3
Expand Down Expand Up @@ -3464,7 +3464,7 @@ Name | Type | Description
baseFeeXRP | [value](#value) | Base fee, in XRP.
ledgerHash | string | Unique hash of the ledger that was closed, as hex.
ledgerTimestamp | date-time string | The time at which this ledger closed.
reserveBaseXRP | [value](#value) | The minimum reserve, in drops of XRP, that is required for an account.
reserveBaseXRP | [value](#value) | The minimum reserve, in XRP, that is required for an account.
reserveIncrementXRP | [value](#value) | The increase in account reserve that is added for each item the account owns, such as offers or trust lines.
transactionCount | integer | Number of new transactions included in this ledger.
ledgerVersion | integer | Ledger version of the ledger that closed.
Expand Down
8 changes: 3 additions & 5 deletions src/common/schemas/output/get-server-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,19 @@
"description": "The time since the ledger was closed, in seconds."
},
"baseFeeXRP": {
"type": "number",
"$ref": "value",
"description": "Base fee, in XRP. This may be represented in scientific notation such as 1e-05 for 0.00005."
},
"hash": {
"$ref": "hash256",
"description": "Unique hash for the ledger, as an uppercase hexadecimal string."
},
"reserveBaseXRP": {
"type": "integer",
"minimum": 0,
"$ref": "value",
"description": "Minimum amount of XRP necessary for every account to keep in reserve."
},
"reserveIncrementXRP": {
"type": "integer",
"minimum": 0,
"$ref": "value",
"description": "Amount of XRP added to the account reserve for each object an account is responsible for in the ledger."
},
"ledgerVersion": {
Expand Down
2 changes: 1 addition & 1 deletion src/common/schemas/output/ledger-event.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"reserveBaseXRP": {
"$ref": "value",
"description": "The minimum reserve, in drops of XRP, that is required for an account."
"description": "The minimum reserve, in XRP, that is required for an account."
},
"reserveIncrementXRP": {
"$ref": "value",
Expand Down
16 changes: 11 additions & 5 deletions src/common/serverinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {Connection} from './connection';
export type GetServerInfoResponse = {
buildVersion: string,
completeLedgers: string,
hostid: string,
hostID: string,
ioLatencyMs: number,
load?: {
jobTypes: Array<Object>,
Expand All @@ -23,11 +23,11 @@ export type GetServerInfoResponse = {
serverState: string,
validatedLedger: {
age: number,
baseFeeXrp: number,
baseFeeXRP: string,
hash: string,
reserveBaseXrp: number,
reserveIncXrp: number,
seq: number
reserveBaseXRP: string,
reserveIncrementXRP: string,
ledgerVersion: number
},
validationQuorum: number
}
Expand All @@ -49,6 +49,12 @@ function getServerInfo(connection: Connection): Promise<GetServerInfoResponse> {
reserveIncXrp: 'reserveIncrementXRP',
seq: 'ledgerVersion'
});
info.validatedLedger.baseFeeXRP =
info.validatedLedger.baseFeeXRP.toString();
info.validatedLedger.reserveBaseXRP =
info.validatedLedger.reserveBaseXRP.toString();
info.validatedLedger.reserveIncrementXRP =
info.validatedLedger.reserveIncrementXRP.toString();
return info;
});
}
Expand Down
1 change: 1 addition & 0 deletions test/api-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const address = addresses.ACCOUNT;
const utils = RippleAPI._PRIVATE.ledgerUtils;
const ledgerClosed = require('./fixtures/rippled/ledger-close-newer');
const schemaValidator = RippleAPI._PRIVATE.schemaValidator;
assert.options.strict = true;

function unused() {
}
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/responses/get-server-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"serverState": "full",
"validatedLedger": {
"age": 5,
"baseFeeXRP": 0.00001,
"baseFeeXRP": "0.00001",
"hash": "4482DEE5362332F54A4036ED57EE1767C9F33CF7CE5A6670355C16CECE381D46",
"reserveBaseXRP": 20,
"reserveIncrementXRP": 5,
"reserveBaseXRP": "20",
"reserveIncrementXRP": "5",
"ledgerVersion": 6595042
},
"validationQuorum": 3
Expand Down

0 comments on commit 99d0806

Please sign in to comment.