Add getLedgerVersion and unit test

This commit is contained in:
Chris Clark
2015-07-08 14:05:25 -07:00
parent 38b254e7f0
commit befd89c3d7
3 changed files with 16 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ const disconnect = server.disconnect;
const getServerInfo = server.getServerInfo;
const getFee = server.getFee;
const isConnected = server.isConnected;
const getLedgerVersion = server.getLedgerVersion;
const getTransaction = require('./ledger/transaction');
const getTransactions = require('./ledger/transactions');
const getTrustlines = require('./ledger/trustlines');
@@ -34,6 +35,7 @@ RippleAPI.prototype = {
isConnected,
getServerInfo,
getFee,
getLedgerVersion,
getTransaction,
getTransactions,

View File

@@ -36,10 +36,15 @@ function getFee() {
return common.dropsToXrp(this.remote.createTransaction()._computeFee());
}
function getLedgerVersion() {
return this.remote.getLedgerSequence();
}
module.exports = {
connect: connect,
disconnect: disconnect,
isConnected: isConnected,
getServerInfo: getServerInfo,
getFee: getFee
connect,
disconnect,
isConnected,
getServerInfo,
getFee,
getLedgerVersion
};

View File

@@ -190,4 +190,8 @@ describe('RippleAPI', function() {
this.api.getPathFind(pathfind,
_.partial(checkResult, getPathFindResponse, done));
});
it('getLedgerVersion', function() {
assert.strictEqual(this.api.getLedgerVersion(), 8819952);
});
});