How to use the ripple-binary-codec.encodeQuality function in ripple-binary-codec

To help you get started, we’ve selected a few ripple-binary-codec 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 / ripple-lib / test / fixtures / orderbook.js View on Github external
module.exports.transactionWithCreatedOffer = function(options) {
  options = options || {};
  _.defaults(options, {
    account: addresses.ACCOUNT,
    amount: '1.9951'
  });

  const takerGets = new IOUValue(options.amount);
  const takerPays = new IOUValue(module.exports.TAKER_PAYS);
  const quality = takerPays.divide(takerGets);

  const BookDirectory = binary.encodeQuality(quality.toString());

  const meta = new Meta({
    AffectedNodes: [
      {
        CreatedNode: {
          LedgerEntryType: 'Offer',
          LedgerIndex: 'AF3C702057C9C47DB9E809FD8C76CD22521012C5CC7AE95D914EC9E226F1D7E5',
          NewFields: {
            Account: options.account,
            BookDirectory: BookDirectory,
            Flags: 131072,
            Sequence: 1404,
            TakerGets: {
              currency: 'USD',
              issuer: addresses.ISSUER,
              value: options.amount
github ripple / ripple-lib / src / core / orderbookutils.js View on Github external
OrderBookUtils.convertOfferQualityToHexFromText = function(quality) {
  return binary.encodeQuality(quality);
};