var config = require(__dirname+'/../../config/config.js');
var ripple = require(__dirname+'/../ripple');

/**
* @requires ripple
* Issue Currency from Cold Wallet to Hot Wallet
* - the cold wallet's secret must be provided
*
* @param {string} currency 
* @param {decimal} amount 
* @param {string} secret
* @param {function(err, deposit)} callback
* @returns [Withdrawals]
*/

function issueCurrency(amount, currency, secret, fn) {
  var opts = {
    to_account: config.get('HOT_WALLET').address,
    from_account: config.get('COLD_WALLET'),
    amount: amount,
    currency: currency,
    issuer: config.get('COLD_WALLET'),
    secret: secret
  };

  ripple.sendCurrency(opts, fn);
}

module.exports = issueCurrency;


var config = require(__dirname+'/../../config/config.js');
var RippleRestClient = require('ripple-rest-client');
var uuid = require('node-uuid');

/**
* @requires ripple
* Issue Currency from Cold Wallet to Hot Wallet
* - the cold wallet's secret must be provided
*
* @param {string} currency 
* @param {decimal} amount 
* @param {string} secret
* @param {function(err, deposit)} callback
* @returns [Withdrawals]
*/

function issueCurrency(amount, currency, secret, callback) {
  var rippleRestClient = new RippleRestClient({
    account: config.get('COLD_WALLET')
  });

  var options = {
    secret: secret,
    client_resource_id: uuid.v4(),
    payment: {
      destination_account: config.get('HOT_WALLET').address,
      source_account: config.get('COLD_WALLET'),
      destination_amount: {
        value: amount.toString(),
        currency: currency,
        issuer: config.get('COLD_WALLET')
      }
    }
  };

  rippleRestClient.sendAndConfirmPayment(options, callback);
}

module.exports = issueCurrency;


use ripple rest client instead of ripple-lib