Move ripple-rest/api into src/api, exposing RippleAPI

This commit is contained in:
Chris Clark
2015-05-22 13:57:41 -07:00
parent 16e3541a10
commit 278331cc4a
100 changed files with 5653 additions and 72 deletions

33
src/api/server/server.js Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
const common = require('../common');
function connect(callback) {
this.remote.connect(callback);
}
function isConnected() {
return common.server.isConnected(this.remote);
}
function getServerStatus(callback) {
common.server.getStatus(this.remote, function(error, status) {
if (error) {
callback(new common.errors.RippledNetworkError(error.message));
} else {
callback(null, status);
}
});
}
function getFee(callback) {
const fee = this.remote.createTransaction()._computeFee();
callback(null, {fee: common.dropsToXrp(fee)});
}
module.exports = {
connect: connect,
isConnected: isConnected,
getServerStatus: getServerStatus,
getFee: getFee
};