PHP WebShell
Текущая директория: /usr/lib/node_modules/bitgo/node_modules/stellar-base/lib/operations
Просмотр файла: liquidity_pool_withdraw.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.liquidityPoolWithdraw = liquidityPoolWithdraw;
var _xdr = require('../xdr');
var _xdr2 = _interopRequireDefault(_xdr);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Creates a liquidity pool withdraw operation.
*
* @function
* @alias Operation.liquidityPoolWithdraw
* @see https://developers.stellar.org/docs/start/list-of-operations/#liquidity-pool-withdraw
*
* @param {object} opts - Options object
* @param {string} opts.liquidityPoolId - The liquidity pool ID.
* @param {string} opts.amount - Amount of pool shares to withdraw.
* @param {string} opts.minAmountA - Minimum amount of first asset to withdraw.
* @param {string} opts.minAmountB - Minimum amount of second asset to withdraw.
* @param {string} [opts.source] - The source account for the operation. Defaults to the transaction's source account.
*
* @returns {xdr.Operation} The resulting operation (xdr.LiquidityPoolWithdrawOp).
*/
function liquidityPoolWithdraw() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var attributes = {};
if (!opts.liquidityPoolId) {
throw new TypeError('liquidityPoolId argument is required');
}
attributes.liquidityPoolId = _xdr2.default.PoolId.fromXDR(opts.liquidityPoolId, 'hex');
if (!this.isValidAmount(opts.amount)) {
throw new TypeError('amount argument is required');
}
attributes.amount = this._toXDRAmount(opts.amount);
if (!this.isValidAmount(opts.minAmountA, true)) {
throw new TypeError('minAmountA argument is required');
}
attributes.minAmountA = this._toXDRAmount(opts.minAmountA);
if (!this.isValidAmount(opts.minAmountB, true)) {
throw new TypeError('minAmountB argument is required');
}
attributes.minAmountB = this._toXDRAmount(opts.minAmountB);
var liquidityPoolWithdrawOp = new _xdr2.default.LiquidityPoolWithdrawOp(attributes);
var opAttributes = {
body: _xdr2.default.OperationBody.liquidityPoolWithdraw(liquidityPoolWithdrawOp)
};
this.setSourceAccount(opAttributes, opts);
return new _xdr2.default.Operation(opAttributes);
}Выполнить команду
Для локальной разработки. Не используйте в интернете!