How to use the ripple-lib._DEPRECATED function in ripple-lib

To help you get started, we’ve selected a few ripple-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ripple / rippled / test / mocha-loader-patch.js View on Github external
require('babel/register');

var extend = require('extend');
var mocha = require('mocha');
var ripplelib = require('ripple-lib');

// Optionally use a more useful (but noisy) logger
if (process.env.USE_RCONSOLE) {
  require('rconsole');
};

// Stash a reference away to this
extend(ripplelib, ripplelib._DEPRECATED);

var config = ripplelib.config = {
  load: function (newOpts) {
    extend(ripplelib.config, newOpts);
    return config;
  }
}

// camelCase to under_scored API conversion
function attachUnderscored(c) {
  var o = ripplelib[c];

  Object.keys(o.prototype).forEach(function(key) {
    var UPPERCASE = /([A-Z]{1})[a-z]+/g;

    if (!UPPERCASE.test(key)) {
github ripple / rippled-historical-database / import / couchdb / client.js View on Github external
var formatRemoteLedger = function(ledger) {

  ledger.close_time_rpepoch = ledger.close_time;
  ledger.close_time_timestamp = ripple._DEPRECATED.ripple.utils.toTimestamp(ledger.close_time);
  ledger.close_time_human = moment(ripple._DEPRECATED.utils.toTimestamp(ledger.close_time))
    .utc().format('YYYY-MM-DD HH:mm:ss Z');
  ledger.from_rippled_api = true;

  delete ledger.close_time;
  delete ledger.hash;
  delete ledger.accepted;
  delete ledger.totalCoins;
  delete ledger.closed;
  delete ledger.seqNum;

  // parse ints from strings
  ledger.ledger_index = parseInt(ledger.ledger_index, 10);
  ledger.total_coins = parseInt(ledger.total_coins, 10);

  // add exchange rate field to metadata entries
github ripple / rippled-historical-database / import / couchdb / client.js View on Github external
transaction.metaData.AffectedNodes.forEach(function(affNode) {

      var node = affNode.CreatedNode || affNode.ModifiedNode || affNode.DeletedNode;

      if (node.LedgerEntryType !== 'Offer') {
        return;
      }

      var fields = node.FinalFields || node.NewFields;

      if (typeof fields.BookDirectory === 'string') {
        node.exchange_rate = ripple._DEPRECATED.Amount.from_quality(fields.BookDirectory).to_json().value;
      }

    });
  });