UNPKG

@okxweb3/coin-stellar

Version:

@ok/coin-stellar is a Stellar SDK for building Web3 wallets and applications. It supports Stellar and PI blockchains, enabling private key management, address generation, transaction signing, trustline creation, and asset transfers

27 lines 1.25 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createPassiveSellOffer = void 0; const xdr_1 = __importDefault(require("../xdr")); function createPassiveSellOffer(opts) { const attributes = {}; attributes.selling = opts.selling.toXDRObject(); attributes.buying = opts.buying.toXDRObject(); if (!this.isValidAmount(opts.amount)) { throw new TypeError(this.constructAmountRequirementsError('amount')); } attributes.amount = this._toXDRAmount(opts.amount); if (opts.price === undefined) { throw new TypeError('price argument is required'); } attributes.price = this._toXDRPrice(opts.price); const createPassiveSellOfferOp = new xdr_1.default.CreatePassiveSellOfferOp(attributes); const opAttributes = {}; opAttributes.body = xdr_1.default.OperationBody.createPassiveSellOffer(createPassiveSellOfferOp); this.setSourceAccount(opAttributes, opts); return new xdr_1.default.Operation(opAttributes); } exports.createPassiveSellOffer = createPassiveSellOffer; //# sourceMappingURL=create_passive_sell_offer.js.map