You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

server.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. "use strict";
  2. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3. if (k2 === undefined) k2 = k;
  4. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  5. }) : (function(o, m, k, k2) {
  6. if (k2 === undefined) k2 = k;
  7. o[k2] = m[k];
  8. }));
  9. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  10. Object.defineProperty(o, "default", { enumerable: true, value: v });
  11. }) : function(o, v) {
  12. o["default"] = v;
  13. });
  14. var __importStar = (this && this.__importStar) || function (mod) {
  15. if (mod && mod.__esModule) return mod;
  16. var result = {};
  17. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  18. __setModuleDefault(result, mod);
  19. return result;
  20. };
  21. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  22. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  23. return new (P || (P = Promise))(function (resolve, reject) {
  24. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  25. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  26. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28. });
  29. };
  30. Object.defineProperty(exports, "__esModule", { value: true });
  31. exports.formatLedgerClose = exports.getLedgerVersion = exports.isConnected = exports.disconnect = exports.connect = void 0;
  32. const common = __importStar(require("../common"));
  33. function isConnected() {
  34. return this.connection.isConnected();
  35. }
  36. exports.isConnected = isConnected;
  37. function getLedgerVersion() {
  38. return this.connection.getLedgerVersion();
  39. }
  40. exports.getLedgerVersion = getLedgerVersion;
  41. function connect() {
  42. return __awaiter(this, void 0, void 0, function* () {
  43. return this.connection.connect();
  44. });
  45. }
  46. exports.connect = connect;
  47. function disconnect() {
  48. return __awaiter(this, void 0, void 0, function* () {
  49. yield this.connection.disconnect();
  50. });
  51. }
  52. exports.disconnect = disconnect;
  53. function formatLedgerClose(ledgerClose) {
  54. return {
  55. baseFeeXRP: common.dropsToXrp(ledgerClose.fee_base),
  56. ledgerHash: ledgerClose.ledger_hash,
  57. ledgerVersion: ledgerClose.ledger_index,
  58. ledgerTimestamp: common.rippleTimeToISO8601(ledgerClose.ledger_time),
  59. reserveBaseXRP: common.dropsToXrp(ledgerClose.reserve_base),
  60. reserveIncrementXRP: common.dropsToXrp(ledgerClose.reserve_inc),
  61. transactionCount: ledgerClose.txn_count,
  62. validatedLedgerVersions: ledgerClose.validated_ledgers
  63. };
  64. }
  65. exports.formatLedgerClose = formatLedgerClose;
  66. //# sourceMappingURL=server.js.map