UNPKG

@okxweb3/coin-stellar

Version:

@okxweb3/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

29 lines 1.15 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.clawback = void 0; const xdr_1 = __importDefault(require("../xdr")); const decode_encode_muxed_account_1 = require("../util/decode_encode_muxed_account"); function clawback(opts) { const attributes = {}; if (!this.isValidAmount(opts.amount)) { throw new TypeError(this.constructAmountRequirementsError('amount')); } attributes.amount = this._toXDRAmount(opts.amount); attributes.asset = opts.asset.toXDRObject(); try { attributes.from = (0, decode_encode_muxed_account_1.decodeAddressToMuxedAccount)(opts.from); } catch (e) { throw new Error('from address is invalid'); } const opAttributes = { body: xdr_1.default.OperationBody.clawback(new xdr_1.default.ClawbackOp(attributes)) }; this.setSourceAccount(opAttributes, opts); return new xdr_1.default.Operation(opAttributes); } exports.clawback = clawback; //# sourceMappingURL=clawback.js.map