"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _react() {
  const data = _interopRequireDefault(require("react"));

  _react = function _react() {
    return data;
  };

  return data;
}

function _bytebuffer() {
  const data = _interopRequireDefault(require("bytebuffer"));

  _bytebuffer = function _bytebuffer() {
    return data;
  };

  return data;
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var _default = {
  daoOrg: function () {
    var _daoOrg = _asyncToGenerator(function* (org) {
      const bb = new (_bytebuffer().default)();

      if (!org) {
        return null;
      }

      try {
        bb.writeUTF8String(org.org_id.toLowerCase());
        bb.writeUTF8String(org.name ? org.name : '');
        bb.writeUTF8String(org.address ? org.address : '');
        bb.writeUTF8String(org.url ? org.url : '');
        bb.writeUTF8String(org.tags ? org.tags : '');
        bb.writeInt8(org.state);
        bb.flip();
      } catch (e) {
        throw Error(e.toString());
      }

      return bb.toBuffer();
    });

    function daoOrg(_x) {
      return _daoOrg.apply(this, arguments);
    }

    return daoOrg;
  }(),
  daoExchange: function () {
    var _daoExchange = _asyncToGenerator(function* (asset) {
      const bb = new (_bytebuffer().default)();
      bb.writeString(asset.org_id.toLowerCase());
      bb.writeString(asset.exchange_trs_id);
      bb.writeString(asset.price);
      bb.writeInt8(asset.state);
      bb.writeString(asset.sender_address);
      bb.writeString(asset.received_address);
      bb.flip();
      return bb.toBuffer();
    });

    function daoExchange(_x2) {
      return _daoExchange.apply(this, arguments);
    }

    return daoExchange;
  }(),
  daoContribution: function () {
    var _daoContribution = _asyncToGenerator(function* (asset) {
      const bb = new (_bytebuffer().default)();
      bb.writeUTF8String(asset.title);
      bb.writeUTF8String(asset.received_address);
      bb.writeUTF8String(asset.sender_address);
      bb.writeUTF8String(asset.price);
      bb.writeUTF8String(asset.url);
      bb.flip();
      return bb.toBuffer();
    });

    function daoContribution(_x3) {
      return _daoContribution.apply(this, arguments);
    }

    return daoContribution;
  }(),
  daoConfirmation: function () {
    var _daoConfirmation = _asyncToGenerator(function* (asset) {
      const bb = new (_bytebuffer().default)();
      bb.writeUTF8String(asset.received_address);
      bb.writeUTF8String(asset.sender_address);
      bb.writeUTF8String(asset.url);
      bb.writeInt8(asset.state);
      bb.writeUTF8String(asset.contribution_trs_id);
      bb.flip();
      return bb.toBuffer();
    });

    function daoConfirmation(_x4) {
      return _daoConfirmation.apply(this, arguments);
    }

    return daoConfirmation;
  }()
};
exports.default = _default;