mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-22 13:15:49 +00:00
Move ripple-rest/api into src/api, exposing RippleAPI
This commit is contained in:
33
src/api/server/server.js
Normal file
33
src/api/server/server.js
Normal 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
|
||||
};
|
||||
Reference in New Issue
Block a user