Skip to content

Commit

Permalink
Add getLedgerVersion and unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Clark committed Jul 8, 2015
1 parent 38b254e commit befd89c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/api/index.js
Expand Up @@ -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');
Expand Down Expand Up @@ -34,6 +35,7 @@ RippleAPI.prototype = {
isConnected,
getServerInfo,
getFee,
getLedgerVersion,

getTransaction,
getTransactions,
Expand Down
15 changes: 10 additions & 5 deletions src/api/server/server.js
Expand Up @@ -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
};
4 changes: 4 additions & 0 deletions test/api-test.js
Expand Up @@ -190,4 +190,8 @@ describe('RippleAPI', function() {
this.api.getPathFind(pathfind,
_.partial(checkResult, getPathFindResponse, done));
});

it('getLedgerVersion', function() {
assert.strictEqual(this.api.getLedgerVersion(), 8819952);
});
});

0 comments on commit befd89c

Please sign in to comment.